*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --bg: #0f172a;
  --card-bg: #ffffff;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --border-subtle: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --radius-card: 18px;
  --shadow-card: 0 14px 40px rgba(15, 23, 42, 0.24);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #0f766e 0, #0f172a 50%, #020617 100%);
  color: var(--text-main);
}

/* App shell */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  padding: 1rem 1.25rem 0.25rem;
  color: #f9fafb;
}

/* Top bar with brand + hamburger */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.5);
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 0.9rem;
}

.app-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.subtitle {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: #e2e8f0;
}

/* Hamburger button */

.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.6);
  color: #e5e7eb;
  font-size: 0.75rem;
  cursor: pointer;
}

.menu-toggle:hover {
  background: rgba(15, 23, 42, 0.95);
}

.menu-toggle:focus-visible {
  outline: 2px solid #22c55e;
  outline-offset: 2px;
}

.hamburger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.hamburger span {
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: #e5e7eb;
}

.menu-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
}

/* Dropdown panel */

.main-menu {
  position: absolute;
  top: 3.25rem;
  right: 1.25rem;
  background: #020617;
  border-radius: 16px;
  padding: 0.45rem 0.2rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.65);
  min-width: 210px;
  z-index: 30;
}

.main-menu[hidden] {
  display: none;
}

.main-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.main-menu li + li {
  margin-top: 0.2rem;
}

.menu-link {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  text-decoration: none;
  color: #e5e7eb;
  font-size: 0.9rem;
  background: transparent;
}

.menu-link-sub {
  font-size: 0.72rem;
  color: #9ca3af;
}

.menu-link:hover {
  background: rgba(15, 118, 110, 0.35);
}

/* Submenu inside nav */

.main-menu .has-submenu {
  display: flex;
  flex-direction: column;
  margin-top: 0.6rem;
}

.main-menu .submenu-toggle {
  appearance: none;
  border: none;
  background: none;
  color: #e5e7eb;
  width: 100%;
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  text-align: left;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.submenu-caret {
  margin-left: 0.4rem;
  opacity: 0.8;
}

.main-menu .submenu {
  display: none;
  margin-top: 0.2rem;
  padding: 0.15rem 0 0.35rem 0.9rem;
  border-left: 2px solid rgba(148, 163, 184, 0.45);
  background: transparent; /* no white card */
}

.main-menu .has-submenu.submenu-open > .submenu {
  display: block;
}

.main-menu .submenu .menu-link {
  padding: 0.4rem 0.5rem;
  border-radius: 10px;
  background: transparent;
  color: #e5e7eb;
  font-size: 0.86rem;
}

.main-menu .submenu .menu-link:hover {
  background: rgba(15, 118, 110, 0.35);
}

.main-menu .submenu .menu-link-sub {
  color: #9ca3af;
}

/* On wider screens, tuck menu to the left slightly */

@media (min-width: 880px) {
  .app-header {
    padding-inline: 1.5rem;
  }
  .main-menu {
    top: 3.1rem;
    right: 1.5rem;
  }
}

/* Layout */

.app-main {
  flex: 1;
  padding: 1rem 1rem 1.5rem; /* was 1rem 1.25rem 1.5rem */
  display: grid;
  gap: 1rem;
  max-width: 1040px;
  margin: 0 auto;
}
/* Cards */

.card {
  background: var(--card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 1.1rem 1.1rem 1.15rem;
}

/* Controls layout */

.controls {
  order: 2;
}

.graph-panel {
  order: 1;
}

@media (min-width: 880px) {
  .app-main {
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    align-items: start;
  }
  .controls {
    order: 1;
    position: sticky;
    top: 0.75rem;
    align-self: flex-start;
  }
  .graph-panel {
    order: 2;
  }
}

/* Fields */

h2 {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.field-row .field {
  flex: 1 1 130px;
}

.field {
  margin-bottom: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

label {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-main);
}

.field-inline-input {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: #f9fafb;
  border: 1px solid var(--border-subtle);
}

input[type="number"],
select {
  flex: 1;
  padding: 0.46rem 0.55rem;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  font-size: 0.9rem;
  outline: none;
  min-height: 40px;
}

input[type="number"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.2);
}

.hint {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 0.15rem;
}

/* Warning text */

.warning {
  color: #b91c1c;
}

/* Section label */

.separator-label {
  margin: 0.2rem 0 0.4rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Toggle (switch) */

.toggle-row {
  margin-bottom: 0.4rem;
}

.switch-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
}

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-block;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #e5e7eb;
  border-radius: 999px;
  transition: 0.2s;
}

.slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  top: 3px;
  border-radius: 999px;
  background-color: #ffffff;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background-color: var(--accent);
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
}

.insulin-settings {
  border-radius: 12px;
  padding: 0.7rem 0.7rem 0.75rem;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  margin-bottom: 0.8rem;
  transition: opacity 0.2s;
}

.label-inline {
  margin: 0.2rem 0 0.3rem;
  font-size: 0.83rem;
  font-weight: 500;
}

/* Chips */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 0.78rem;
  cursor: pointer;
}

.chip input[type="checkbox"] {
  cursor: pointer;
}

/* Buttons */

.primary-btn {
  margin-top: 0.4rem;
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #ecfeff;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.03em;
}

.primary-btn:hover {
  background: #115e59;
}

.primary-btn:active {
  transform: translateY(1px);
}

/* Graph area */

.graph-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.graph-header h2 {
  margin-bottom: 0.1rem;
}

.graph-subtitle {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.canvas-wrapper {
  width: 100%;
  max-width: 100%;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  overflow-x: auto;   /* allow sideways scroll if needed */
  overflow-y: hidden;
}


#graph,
#carbCalibrationGraph {
  display: block;
  width: 100%;
  height: 260px;
}

/* Summary */

.summary {
  margin-top: 0.65rem;
  display: grid;
  gap: 0.4rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  font-size: 0.82rem;
}

.summary-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.summary-value {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
}

.dot.dot-second {
  background: #ec4899;
}

.dot-noinsulin {
  background: #64748b;
}
.dot-pre {
  background: #1d4ed8;
}
.dot-at {
  background: #dc2626;
}
.dot-post {
  background: #f97316;
}
.dot-lowinsulin {
  background: #888888;
}
.dot-highinsulin {
  background: #c0392b;
}

/* Disclaimer */

.disclaimer {
  margin-top: 0.8rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Footer */

.app-footer {
  padding: 0.8rem 1.25rem 1.1rem;
  font-size: 0.76rem;
  color: #cbd5e1;
  text-align: center;
}

/* Mobile tweaks */

@media (max-width: 600px) {
  .app-main {
    padding-inline: 0.75rem;   /* keeps teal background visible on both sides */
    width: 100%;
    max-width: 480px;          /* or 420px if you want it tighter */
    margin: 0 auto;            /* centers the column so both sides match */
  }

  .card {
    width: 100%;
    box-sizing: border-box;    /* ensure borders/padding don't push past container */
  }
}

  /* NEW: make header content the same width as cards */
  .app-header {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .card {
    padding: 0.9rem 0.85rem 1rem;
  }

  .subtitle {
    font-size: 0.82rem;
  }

  #graph {
    height: 240px;
  }
}


.info-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.74rem;
  cursor: pointer;
  padding: 0;
  margin-left: 0.4rem;
  text-decoration: underline;
}
.info-link:hover {
  color: #0d9488;
}

/* Helper cards + privacy */

.sample-display {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
  background: #f1f5f9;
  padding: 6px 10px;
  border-radius: 8px;
  margin-top: 4px;
}

.helper-card {
  margin-top: 1.5rem;
  text-align: center;
}

.helper-card h2 {
  font-size: 1.1rem;
  margin-bottom: .5rem;
}

.helper-card .image-wrapper {
  display: flex;
  justify-content: center;
  margin-top: .75rem;
}

.dexcom-help-image {
  width: 500px;
  max-width: 90%;
  border-radius: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.privacy-card {
  max-width: 900px;
  margin: 0.75rem auto 1.5rem;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.18);
  border-left: 4px solid #0ea5e9;
  border-radius: 12px;
  color: #e2e8f0;
  backdrop-filter: blur(6px);
}

.privacy-card h2 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
  font-weight: 600;
  color: #f1f5f9;
}

.privacy-card p {
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.35rem;
  color: #cbd5e1;
}

.visually-hidden {
  position: absolute;
  left: -9999px;
}

/* =========================
   Carb pages – mobile tweaks
   ========================= */

@media (max-width: 768px) {
  /* Make sure controls + graph stack cleanly */
  .carb-calibration-page .app-main,
  .two-meal-page .app-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  /* Slightly tighter margins so cards don't feel huge */
  .carb-calibration-page .card,
  .two-meal-page .card {
    margin-inline: 0.75rem;
    width: calc(100% - 1.5rem);   /* keeps card inside viewport */
    box-sizing: border-box;
  }

  /* Inputs card gets a bit more breathing room at the top */
  .carb-calibration-page .card.controls,
  .two-meal-page .card.controls {
    margin-top: 0.75rem;
    overflow-x: auto;             /* inner horizontal scroll, not page zoom */
  }

  .carb-calibration-page .card.controls table,
  .two-meal-page .card.controls table {
    width: 100%;
    min-width: 480px;             /* adjust if you want narrower/wider */
  }

  /* Graph panel: keep it from feeling too tall */
  .carb-calibration-page .graph-panel .canvas-wrapper,
  .two-meal-page .graph-panel .canvas-wrapper {
    max-height: 230px;
  }

  .carb-calibration-page #carbCalibrationGraph,
  .two-meal-page #carbCalibrationGraph {
    max-height: 230px;
  }

  /* Tables: shrink font a bit so they look less “heavy” on phones */
  .carb-calibration-page table,
  .two-meal-page table {
    font-size: 0.85rem;
  }

  .carb-calibration-page th,
  .carb-calibration-page td,
  .two-meal-page th,
  .two-meal-page td {
    padding: 0.35rem 0.4rem;
  }

  /* Hints/text paragraphs slightly smaller on these dense pages */
  .carb-calibration-page .hint,
  .two-meal-page .hint {
    font-size: 0.85rem;
    line-height: 1.35;
  }
}

/* Optional: hide any tiny leftover horizontal overflow */
body.carb-calibration-page,
body.two-meal-page,
body.logbook-page {
  overflow-x: hidden;
}

/* Extra guardrails for the carb-impact & two-meal pages on mobile */
@media (max-width: 768px) {
  /* Keep overall layout from exceeding viewport width */
  .carb-calibration-page,
  .carb-calibration-page .app-shell,
  .carb-calibration-page .app-main,
  .carb-calibration-page .card,
  .two-meal-page,
  .two-meal-page .app-shell,
  .two-meal-page .app-main,
  .two-meal-page .card {
    max-width: 100%;
  }

  .carb-calibration-page,
  .two-meal-page {
    overflow-x: hidden;
  }
}


/* =========================
   Landing page layout
   ========================= */

/* Override the 2-column app-main layout so home feels like a true landing page */
/* =========================
   Landing page layout + quiz
   ========================= */

/* Make the landing content a single flowing column */
/* Landing page single-column flow */
.landing-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  /* removed max-width so it uses .app-main's 1040px centered width */
}

/* Hero section */

.hero-card {
  background: radial-gradient(circle at top left, #ccfbf1 0, #ffffff 45%, #e0f2fe 100%);
  padding: 1.2rem 1.1rem 1.3rem;
  position: relative;
  overflow: hidden;
}

.hero-text h2 {
  margin: 0 0 0.65rem;
  font-size: 1.35rem;
  line-height: 1.3;
}

.hero-subtitle {
  margin: 0 0 0.8rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.08);
  color: #047857;
  margin: 0 0 0.7rem;
}

.hero-bullets {
  margin: 0 0 0.8rem 0;
  padding-left: 1.1rem;
  font-size: 0.9rem;
  color: var(--text-main);
}

.hero-bullets li + li {
  margin-top: 0.25rem;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.hero-primary {
  max-width: 260px;
  text-align: center;
}

.secondary-link {
  font-size: 0.88rem;
  text-decoration: none;
  color: var(--accent);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px dashed rgba(15, 118, 110, 0.4);
  background: rgba(240, 253, 250, 0.65);
}

.secondary-link:hover {
  background: rgba(209, 250, 229, 0.9);
}

.hero-disclaimer {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Tiny abstract “graph” hint in the hero corner
   (fills some of that right-side empty space visually) */

.hero-card::after {
  content: none;
}


/* QUIZ */

/* QUIZ */

.quiz-card {
  /* match general card padding so left/right edges line up visually */
  padding: 1.1rem 1.1rem 1.15rem;
  position: relative;
  overflow: hidden;
}

/* no decorative circle on the quiz, so it matches other cards */
.quiz-card::after {
  content: none;
}

.quiz-card h2 {
  margin-top: 0;
  margin-bottom: 0.3rem;
}


.quiz-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.quiz-choice-btn {
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease-out;
}

.quiz-choice-btn:hover {
  border-color: rgba(15, 118, 110, 0.7);
  background: #ecfeff;
}

.quiz-choice-btn.active {
  border-color: rgba(15, 118, 110, 0.9);
  background: #ccfbf1;
  box-shadow: 0 0 0 1px rgba(45, 212, 191, 0.8);
}

.quiz-result {
  background: #f1f5f9;
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
  font-size: 0.85rem;
}

.quiz-result-title {
  margin: 0 0 0.25rem;
  font-weight: 600;
}

.quiz-result p {
  margin: 0;
}

.quiz-result a {
  text-decoration: underline;
}

/* Sections: “How the site is organized” */

.sections-card h2 {
  margin-bottom: 0.35rem;
}

.section-intro {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.7rem;
}

.section-group + .section-group {
  border-top: 1px solid #e2e8f0;
  padding-top: 0.8rem;
  margin-top: 0.8rem;
}

.section-group h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.section-description {
  margin: 0 0 0.6rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Tiles for each tool/page */

.tile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem;
}

@media (min-width: 720px) {
  .tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.tool-tile {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.8rem 0.85rem;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  text-decoration: none;
  color: var(--text-main);
  position: relative;
  overflow: hidden;
}

.tool-tile:hover {
  border-color: rgba(15, 118, 110, 0.7);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18);
  transform: translateY(-1px);
  transition: all 0.16s ease-out;
}

.tool-tile h4 {
  margin: 0;
  font-size: 0.98rem;
}

.tool-tile p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.tile-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #0369a1;
}

.tile-tag {
  margin-top: 0.25rem;
  align-self: flex-start;
  font-size: 0.72rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  background: #e0f2fe;
  color: #1d4ed8;
}

/* Definitions grid */

.definition-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
  margin-top: 0.6rem;
}

@media (min-width: 720px) {
  .definition-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.definition {
  padding: 0.6rem 0.65rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px dashed #e2e8f0;
}

.definition h3 {
  margin: 0 0 0.25rem;
  font-size: 0.96rem;
}

.definition p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

/* Safety card styling */

.disclaimer-card {
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.disclaimer-card h2 {
  margin-top: 0;
}

.disclaimer-card p {
  font-size: 0.85rem;
}

/* Mobile tweaks */

@media (max-width: 600px) {
  .hero-card {
    padding: 1.05rem 0.9rem 1.15rem;
  }

  .hero-text h2 {
    font-size: 1.18rem;
  }

  .tile-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Make the 3rd card in "Finding potential patterns" span full width on wider screens */
@media (min-width: 720px) {
  .sections-card .section-group:nth-of-type(3) .tile-grid .tool-tile:nth-child(3) {
    grid-column: 1 / -1;
  }
}

/* Final alignment fix for landing cards */
.landing-page .hero-card,
.landing-page .quiz-card {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
  box-sizing: border-box;
}

/* =========================
   Logbook page
   ========================= */

/* Row of buttons under "Add log entry" */
.logbook-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* Secondary pill buttons (clear / export / load, etc.) */
.secondary-btn {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 500;
}

.secondary-btn:hover {
  background: #e2e8f0;
}

/* Logbook table container */

.table-wrapper {
  width: 100%;
  overflow-x: auto;                /* <-- actual horizontal scroll lives here */
  -webkit-overflow-scrolling: touch;  /* nicer scrolling on iOS */
}

.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;      /* still wider than the screen */
  font-size: 0.8rem;     /* slightly smaller text so more fits on screen */
}

/* Let headers wrap, keep data cells on one line */
.table-wrapper th {
  padding: 0.3rem 0.35rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  white-space: normal;   /* allow two-line headers like “Exercise intensity” */
  font-weight: 600;
  font-size: 0.78rem;
  color: #0f172a;
}

.table-wrapper td {
  padding: 0.3rem 0.35rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  white-space: nowrap;   /* keep your data nice and compact */
}

.table-wrapper {
  width: 100%;
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  background: #f8fafc;
}


.table-wrapper thead {
  background: #e2e8f0;
}


.table-wrapper th {
  font-weight: 600;
  font-size: 0.8rem;
  color: #0f172a;
}

.table-wrapper tbody tr:nth-child(even) {
  background: #f9fafb;
}

/* Inputs inside table cells */
.table-wrapper input[type="number"],
.table-wrapper input[type="time"],
.table-wrapper input[type="date"],
.table-wrapper select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.25rem 0.35rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.82rem;
}

.table-wrapper input:focus,
.table-wrapper select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.15);
  outline: none;
}

/* Remove-row button */
.row-remove-btn {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: none;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 0.8rem;
  cursor: pointer;
}

.row-remove-btn:hover {
  background: #fecaca;
}

/* Mobile tweaks */
@media (max-width: 600px) {
  .table-wrapper table {
    font-size: 0.8rem;
    min-width: 520px;
  }
}

/* Make a secondary version of the full-width pill button */
.fullwidth {
  width: 100%;
  justify-content: center;
}

/* Smaller spacing between side-by-side export buttons */
.logbook-buttons.small-gap {
  gap: 0.4rem;
}

/* Match pill shape & height of add button */
.secondary-btn.fullwidth {
  border-radius: 999px;
  padding: 0.85rem 1.2rem;
  font-size: 1rem;
  border: 1px solid #cbd5e1;
  background: #e5e7eb;
  font-weight: 600;
  cursor: pointer;
}

.secondary-btn.fullwidth:hover {
  background: #d1d5db;
}

/* Match Clear button to Add button size */
.secondary-btn.fullwidth {
  width: 100%;
  border-radius: 999px;
  padding: 0.55rem .75rem; /* matches primary-btn */
  font-size: 1rem;
  font-weight: 600;
  background: #e5e7eb;
  border: 1px solid #cbd5e1;
  text-align: center;
}

.secondary-btn.fullwidth:hover {
  background: #d1d5db;
}

/* Center export buttons + consistent spacing */
.logbook-buttons.small-gap {
  justify-content: center;
  display: flex;
  gap: 1rem;         /* evenly spaced */
  margin-top: 0.75rem;
  margin-bottom: 1.25rem; /* extra breathing room below */
}

/* Make export buttons same pill style as before */
.logbook-buttons.small-gap .secondary-btn {
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
}

/* =========================
   Logbook page layout fixes
   (same idea as carb pages)
   ========================= */

body.logbook-page {
  overflow-x: auto;   /* allow horizontal scroll if needed */
}


/* Mobile layout: stack cards and keep them inside the viewport */
@media (max-width: 768px) {
  .logbook-page .app-main {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  /* Keep cards nicely inset from the edges on mobile */
  .logbook-page .card {
    width: calc(100% - 1.5rem);  /* matches 0.75rem side margins */
    margin-inline: 0.75rem;
    box-sizing: border-box;
  }

  /* Let the log entries table scroll inside its card
     instead of stretching the entire page wider */
  .logbook-page .graph-panel {
    overflow-x: auto;
  }

  .logbook-page .graph-panel table {
    min-width: 480px;  /* tweak up/down if you want */
  }
}

.tile-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2f6df6;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}


