/* ============================================================
   Релокация · Mobile App · C·Pro design tokens
   Dark by default, light theme via data-theme="light"
   ============================================================ */

:root,
[data-theme="dark"] {
  --bg:           #0B1A2C;
  --bg-card:      #14283F;
  --bg-soft:      #102237;
  --bg-elev:      #1B3251;
  --bg-tabbar:    rgba(11, 26, 44, 0.92);
  --ink:          #E8EEF5;
  --ink-soft:     #A9B8CA;
  --ink-mute:     #6B7E96;
  --line:         #1F3A5C;
  --line-soft:    #19314D;
  --accent:       #E07856;
  --accent-soft:  #3D2A22;
  --good:         #6FB389;
  --good-soft:    #1F3D2E;
  --warn:         #E5A24A;
  --warn-soft:    #3B2E18;
  --bad:          #D96A6A;
  --bad-soft:     #3A1E1E;
  --mute:         #6B7E96;
  --gastro:       #C088B0;
  --gastro-soft:  #36223A;
  --shadow-sm:    0 1px 0 rgba(0,0,0,.18);
  --shadow-md:    0 4px 16px -8px rgba(0,0,0,.55);
  --shadow-lg:    0 24px 48px -24px rgba(0,0,0,.7);
}

[data-theme="light"] {
  --bg:           #FBFAF7;
  --bg-card:      #FFFFFF;
  --bg-soft:      #F1EEE7;
  --bg-elev:      #FFFFFF;
  --bg-tabbar:    rgba(251, 250, 247, 0.94);
  --ink:          #16140F;
  --ink-soft:     #4D4636;
  --ink-mute:     #8B8270;
  --line:         #DDD5C4;
  --line-soft:    #ECE6D5;
  --accent:       #C26B3D;
  --accent-soft:  #F3E2D5;
  --good:         #4F7A4D;
  --good-soft:    #DCE9DA;
  --warn:         #C26B3D;
  --warn-soft:    #F3E2D5;
  --bad:          #B04A37;
  --bad-soft:     #F0D5CC;
  --mute:         #8B8270;
  --gastro:       #8E5C7B;
  --gastro-soft:  #EBDCE5;
  --shadow-sm:    0 1px 0 rgba(0,0,0,.04);
  --shadow-md:    0 4px 16px -8px rgba(80,60,30,.18);
}

/* ============================================================
   Reset and base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  font-variant-numeric: tabular-nums;
}

/* Adaptive base scale across viewport widths */
@media (min-width: 380px) { body { font-size: 15.5px; } }
@media (min-width: 480px) { body { font-size: 16px; } }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { background: transparent; border: 0; outline: 0; }
a { color: inherit; text-decoration: none; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
::selection { background: var(--accent); color: var(--bg); }

/* ============================================================
   App shell
   ============================================================ */
#root { min-height: 100vh; min-height: 100dvh; }

.app {
  position: relative;
  /* Фиксируем к вьюпорту — .app НЕ скроллится сам, скроллер только .page.
     Без этого .app рос с контентом + overflow-x:hidden давал неявный
     overflow-y:auto → три конкурирующих скроллера и залипание на части устройств. */
  height: 100vh;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding-top: max(env(safe-area-inset-top, 0px), 24px);
  overflow: hidden;
}

@media (min-width: 481px) {
  body {
    background:
      radial-gradient(ellipse at top, color-mix(in oklab, var(--bg-card) 50%, var(--bg)) 0%, var(--bg) 60%),
      var(--bg);
    background-attachment: fixed;
  }
  .app {
    border-left: 1px solid var(--line-soft);
    border-right: 1px solid var(--line-soft);
    box-shadow: var(--shadow-lg);
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in oklab, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  padding: 0 16px;
  border-bottom: 1px solid var(--line-soft);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 52px;
}

.topbar-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.topbar-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-right: -8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: background .12s;
}
.icon-btn:active { background: var(--bg-soft); }
.icon-btn.on { color: var(--accent); }

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  margin-left: -6px;
  padding: 6px 8px;
}

.page {
  flex: 1;
  min-height: 0; /* критично: позволяет flex-элементу сжаться → overflow-y:auto реально скроллит */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 8px 16px calc(100px + env(safe-area-inset-bottom, 0));
}

/* ============================================================
   Bottom tab bar
   ============================================================ */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--bg-tabbar);
  backdrop-filter: saturate(150%) blur(20px);
  -webkit-backdrop-filter: saturate(150%) blur(20px);
  border-top: 1px solid var(--line);
  z-index: 100;
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}

.tabbar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 6px;
  color: var(--ink-mute);
  border-radius: 8px;
  position: relative;
}
.tabbar-btn:active { background: var(--bg-soft); }
.tabbar-btn.on { color: var(--accent); }
.tabbar-btn svg { display: block; }
.tabbar-btn .tlabel {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tabbar-btn.center {
  background: var(--accent);
  color: white;
  margin: -10px 6px 6px;
  border-radius: 14px;
  padding: 0;
  height: 48px;
  justify-content: center;
}
.tabbar-btn.center .tlabel { display: none; }
.tabbar-btn.center:active { background: color-mix(in oklab, var(--accent) 80%, black); }

/* ============================================================
   Cards, lists, primitives
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}
.card.flat {
  background: var(--bg-soft);
  border-color: var(--line-soft);
}
.card.elev {
  background: var(--bg-elev);
  box-shadow: var(--shadow-md);
}

.row { display: flex; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.center { align-items: center; }
.baseline { align-items: baseline; }
.end { align-items: flex-end; }
.flex-1 { flex: 1; }
.shrink-0 { flex-shrink: 0; }
.wrap { flex-wrap: wrap; }

/* Spacing utilities. Phase 4: значения с точным совпадением переписаны
   на var(--space-*) — внешний результат идентичен (px те же), но при
   смене токена изменения пропагируются. Уникальные px (6/10/14/20/22)
   оставлены как есть — у них нет соответствующего токена. */
.g-22 { gap: 22px; }
.g-4 { gap: var(--space-2xs); } .g-6 { gap: 6px; } .g-8 { gap: var(--space-xs); }
.g-10 { gap: 10px; } .g-12 { gap: var(--space-sm); } .g-14 { gap: 14px; }
.g-16 { gap: var(--space-md); } .g-20 { gap: 20px; } .g-24 { gap: var(--space-lg); }

.mt-2 { margin-top: 2px; } .mt-4 { margin-top: var(--space-2xs); } .mt-6 { margin-top: 6px; }
.mt-8 { margin-top: var(--space-xs); } .mt-10 { margin-top: 10px; } .mt-12 { margin-top: var(--space-sm); }
.mt-16 { margin-top: var(--space-md); } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: var(--space-lg); }
.mt-32 { margin-top: var(--space-xl); }
.mb-8 { margin-bottom: var(--space-xs); } .mb-16 { margin-bottom: var(--space-md); }
.mx-16-n { margin-left: calc(var(--space-md) * -1); margin-right: calc(var(--space-md) * -1); }
.p-0 { padding: 0; } .p-8 { padding: var(--space-xs); } .p-12 { padding: var(--space-sm); }
.p-14 { padding: 14px; } .p-16 { padding: var(--space-md); }
.px-12 { padding-left: 12px; padding-right: 12px; }
.px-14 { padding-left: 14px; padding-right: 14px; }
.py-12 { padding-top: 12px; padding-bottom: 12px; }

.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.eyebrow-tight { letter-spacing: 0.08em; }

.serif {
  font-family: 'Lora', Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.serif-italic {
  font-family: 'Lora', Georgia, serif;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.01em;
}
.mono {
  font-family: 'JetBrains Mono', monospace;
  font-variant-numeric: tabular-nums;
}

/* Adaptive base for editable cells */
.editable { font-size: 14px; }

.h1 {
  font-family: 'Lora', Georgia, serif;
  font-weight: 500;
  font-size: clamp(28px, 8vw, 36px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
}
.h2 {
  font-family: 'Lora', Georgia, serif;
  font-weight: 500;
  font-size: clamp(20px, 5.5vw, 24px);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0;
}
.h3 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.005em;
  margin: 0;
}

/* Font-size utilities. Phase 4: где значение точно равно токену —
   используем var(--text-*). Уникальные значения (15/16/17/19/21/23
   и clamp-варианты) оставлены как px. */
.fs-10 { font-size: var(--text-micro); } .fs-11 { font-size: var(--text-caption); }
.fs-12 { font-size: var(--text-body-sm); } .fs-13 { font-size: var(--text-body); }
.fs-14 { font-size: var(--text-heading-sm); } .fs-15 { font-size: 16px; }
.fs-16 { font-size: 17px; } .fs-18 { font-size: 19px; }
.fs-20 { font-size: 21px; } .fs-22 { font-size: 23px; }
.fs-26 { font-size: 27px; } .fs-30 { font-size: clamp(28px, 8vw, 32px); }
.fs-36 { font-size: clamp(32px, 9vw, 38px); } .fs-44 { font-size: clamp(38px, 11vw, 46px); }
.fs-56 { font-size: clamp(48px, 14vw, 60px); }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }

.t-mute { color: var(--ink-mute); }
.t-soft { color: var(--ink-soft); }
.t-accent { color: var(--accent); }
.t-good { color: var(--good); }
.t-warn { color: var(--warn); }
.t-bad { color: var(--bad); }
.t-gastro { color: var(--gastro); }

.upper { text-transform: uppercase; letter-spacing: 0.1em; }
.right { text-align: right; }
.center-text { text-align: center; }

.divider {
  height: 1px;
  background: var(--line-soft);
  margin: 12px 0;
}
.divider.tight { margin: 8px 0; }

/* Section header inside page */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 24px 0 12px;
}
.section-head:first-child { margin-top: 8px; }
.section-head .title {
  font-family: 'Lora', Georgia, serif;
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.01em;
  margin: 0;
}
.section-head .action {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
}

/* ============================================================
   Tags / Pills / Badges
   ============================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tag.good { color: var(--good); background: var(--good-soft); border-color: color-mix(in oklab, var(--good) 30%, var(--line)); }
.tag.warn { color: var(--warn); background: var(--warn-soft); border-color: color-mix(in oklab, var(--warn) 30%, var(--line)); }
.tag.bad  { color: var(--bad);  background: var(--bad-soft);  border-color: color-mix(in oklab, var(--bad) 30%, var(--line)); }
.tag.gastro { color: var(--gastro); background: var(--gastro-soft); border-color: color-mix(in oklab, var(--gastro) 30%, var(--line)); }
.tag.solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tag.accent { background: var(--accent); color: white; border-color: var(--accent); }

/* Wrap вместо горизонтального скролла — все опции видны, без обрезки
   на полуслове и без конфликта с вертикальным скроллом страницы. */
.pillrow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 0;
}
.pill {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: 99px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--bg-card);
  border: 1px solid var(--line);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.pill.on { background: var(--accent); color: white; border-color: var(--accent); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  background: var(--bg-card);
  color: var(--ink);
  border: 1px solid var(--line);
  font-family: 'Inter', sans-serif;
}
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn.ghost {
  background: transparent;
}
.btn.danger {
  background: var(--bad);
  color: white;
  border-color: var(--bad);
}
.btn.full { width: 100%; }
.btn.sm { padding: 6px 10px; font-size: 12px; }
.btn.cta {
  height: 52px;
  font-size: 15px;
  font-weight: 500;
  border-radius: 12px;
}
.btn[aria-busy="true"] { opacity: 0.7; cursor: progress; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:disabled:active { transform: none; }

/* ── DS Field (Sprint 9 Phase 2a) ── */
.ds-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}
.ds-field-label {
  font-family: var(--font-mono);
  font-size: var(--text-micro);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
}
.ds-field-required { color: var(--accent); }
.ds-field-hint {
  font-size: var(--text-caption);
  color: var(--ink-mute);
  line-height: var(--leading-base);
}
.ds-field-error { color: var(--bad); }

/* ── Toast (Sprint 9 Phase 2b) ── */
.toast-stack {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--layout-tabbar-height) + var(--space-md) + env(safe-area-inset-bottom, 0));
  width: min(calc(100% - var(--space-md) * 2), 440px);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  z-index: var(--z-toast);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-soft);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-body-sm);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  animation: rc-slide-up var(--motion-base) var(--motion-ease);
}
.toast-success { border-left-color: var(--good); }
.toast-warn { border-left-color: var(--warn); }
.toast-danger { border-left-color: var(--bad); }
.toast-info { border-left-color: var(--accent); }
.toast-action {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.toast-close {
  background: none;
  border: none;
  color: var(--ink-mute);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

/* ── Banner (Sprint 9 Phase 2b) ── */
.banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--line-soft);
  background: var(--bg-card);
  border-left-width: 3px;
}
.banner-info { border-left-color: var(--accent); }
.banner-success { border-left-color: var(--good); }
.banner-warn { border-left-color: var(--warn); }
.banner-danger { border-left-color: var(--bad); }
.banner-icon { display: flex; color: var(--ink-soft); }
.banner-content { flex: 1; min-width: 0; }
.banner-title { font-size: var(--text-body-sm); font-weight: var(--weight-medium); }
.banner-body { font-size: var(--text-caption); color: var(--ink-soft); margin-top: 2px; line-height: var(--leading-base); }
.banner-close {
  background: none; border: none; color: var(--ink-mute);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px;
}

/* ── Avatar (Sprint 9 Phase 2b) ── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-weight: var(--weight-medium);
  flex-shrink: 0;
  user-select: none;
}

.cta-stack {
  position: sticky;
  bottom: 100px;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
  margin: 16px -16px -16px;
  padding: 12px 16px 16px;
  z-index: 10;
}

/* ============================================================
   Inputs
   ============================================================ */
.input,
.textarea {
  display: block;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 14px;
  color: var(--ink);
  font-family: inherit;
  transition: border-color .12s;
}
.input:focus, .textarea:focus { border-color: var(--accent); }
.input::placeholder { color: var(--ink-mute); }
.textarea { min-height: 80px; resize: vertical; line-height: 1.5; }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
}
.search input { flex: 1; font-size: 14px; }

.editable {
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--line);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--ink);
  padding: 2px 4px;
  width: 80px;
  text-align: right;
}
.editable:focus { border-bottom-color: var(--accent); background: var(--bg-soft); }
.editable.wide { width: 100%; text-align: left; }

/* Slider styled */
.slider {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  width: 100%;
  height: 28px;
}
.slider::-webkit-slider-runnable-track {
  height: 2px;
  background: var(--line);
  border-radius: 2px;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: -8px;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line);
}
.slider::-moz-range-track { height: 2px; background: var(--line); }
.slider::-moz-range-thumb {
  width: 18px; height: 18px; background: var(--accent);
  border: 2px solid var(--bg); border-radius: 50%; cursor: pointer;
}

/* Segmented control */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
  gap: 0;
}
.segmented button {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 7px;
  border-radius: 6px;
  color: var(--ink-soft);
  text-transform: uppercase;
}
.segmented button.on {
  background: var(--bg-card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ============================================================
   Stats
   ============================================================ */
.stat-num {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
}
.stat-row:last-child { border-bottom: 0; }
.stat-row .stat-label { color: var(--ink-soft); }
.stat-row .stat-value {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: var(--ink);
  font-size: 13px;
}

/* Progress bar */
.bar {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  transition: width .25s ease;
}
.bar.good > span { background: var(--good); }
.bar.warn > span { background: var(--warn); }
.bar.bad > span { background: var(--bad); }
.bar.gastro > span { background: var(--gastro); }

/* Dot */
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.bad  { background: var(--bad); }
.dot.gastro { background: var(--gastro); }

/* ============================================================
   List rows (settings-style)
   ============================================================ */
.lrow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.lrow:first-child { border-radius: 10px 10px 0 0; }
.lrow:last-child { border-radius: 0 0 10px 10px; border-bottom: 0; }
.lrow:only-child { border-radius: 10px; }
.lgroup { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.lrow .lprefix { flex-shrink: 0; color: var(--ink-soft); width: 30px; }
.lrow .lcontent { flex: 1; min-width: 0; }
.lrow .ltitle { color: var(--ink); }
.lrow .lsub { font-size: 11.5px; color: var(--ink-mute); margin-top: 2px; }
.lrow .lvalue { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--ink-soft); }
.lrow .lchev { color: var(--ink-mute); font-size: 16px; }

/* ============================================================
   Sheets
   ============================================================ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  animation: fade-in .15s;
}
.sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  border-top: 1px solid var(--line);
  z-index: 201;
  max-height: 85vh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 0);
  animation: slide-up .2s cubic-bezier(.2,.7,.3,1);
}
.sheet-grip {
  width: 38px;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  margin: 8px auto;
}
.sheet-head {
  padding: 4px 18px 14px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-body { padding: 16px 18px 22px; }

@keyframes slide-up {
  from { transform: translate(-50%, 100%); }
  to   { transform: translate(-50%, 0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================================================
   Hero / countdown
   ============================================================ */
.hero {
  padding: 8px 0 0;
}
.hero-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(64px, 18vw, 88px);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 500;
}

/* ============================================================
   Helpers for SVG icons
   ============================================================ */
.iconv {
  width: 22px; height: 22px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.iconv.sm { width: 16px; height: 16px; }

/* Tap feedback */
.tap {
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.tap:active { transform: scale(0.985); }

/* Hero card · subtle gradient accent */
.hero-card {
  background:
    linear-gradient(160deg, color-mix(in oklab, var(--accent) 8%, var(--bg-card)) 0%, var(--bg-card) 60%),
    var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

/* Skeleton */
.skel {
  background: linear-gradient(90deg, var(--bg-soft) 0%, var(--bg-card) 50%, var(--bg-soft) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Skeleton — Phase 6 #10 */
@keyframes rc-skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Toggle */
.toggle {
  width: 42px;
  height: 24px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 99px;
  position: relative;
  transition: background .15s;
  flex-shrink: 0;
}
.toggle > span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: var(--ink-mute);
  border-radius: 50%;
  transition: transform .15s, background .15s;
}
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on > span { transform: translateX(18px); background: white; }

/* Chip with delta */
.chip-delta {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
}
.chip-delta.up { color: var(--good); }
.chip-delta.down { color: var(--bad); }

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--ink-mute);
  font-size: 13px;
}
.empty .ico { font-size: 32px; opacity: 0.4; margin-bottom: 12px; font-family: 'Lora', serif; }

/* ============================================================
   Page header (in-page big title)
   ============================================================ */
.page-head {
  padding: 12px 0 4px;
}
.page-head .h1 { margin-bottom: 4px; }
.page-head .lede {
  font-family: 'Lora', Georgia, serif;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
  margin-top: 8px;
}

/* ============================================================
   Mini bar chart cell
   ============================================================ */
.cell-bar {
  display: inline-block;
  vertical-align: middle;
  width: 80px;
  height: 6px;
  background: var(--line-soft);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}
.cell-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
}
