:root {
  color-scheme: light;
  --bg: #f3ece2;
  --surface: rgba(255, 250, 244, 0.92);
  --surface-strong: #fffaf5;
  --surface-accent: linear-gradient(135deg, rgba(122, 62, 35, 0.96), rgba(184, 104, 57, 0.94));
  --text: #201711;
  --muted: #65584c;
  --line: rgba(72, 49, 31, 0.14);
  --accent: #b15a31;
  --accent-strong: #8e401c;
  --utility: #f2b15e;
  --utility-strong: #dd8d2f;
  --danger: #8a312a;
  --shadow: 0 20px 48px rgba(55, 31, 14, 0.1);
  font-family: "Segoe UI", "Avenir Next", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(202, 126, 76, 0.22), transparent 22rem),
    radial-gradient(circle at top right, rgba(241, 213, 173, 0.55), transparent 18rem),
    linear-gradient(180deg, #f4eadb 0%, var(--bg) 42%, #efe7dd 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  width: min(100%, 78rem);
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

.hero,
.grid,
.stats-grid,
.action-row,
.split-fields,
.management-grid,
.starter-grid,
.compact-form {
  display: grid;
  gap: 1rem;
}

.hero {
  align-items: end;
  padding: 1rem 0 1.25rem;
}

.hero h1,
.panel h2,
.mini-stat h2 {
  margin: 0;
  font-family: Georgia, "Iowan Old Style", serif;
  line-height: 1.02;
}

.hero h1 {
  font-size: clamp(2.4rem, 9vw, 5rem);
  letter-spacing: -0.05em;
  max-width: 9ch;
}

.hero-note {
  padding: 1rem 1.1rem;
  border-radius: 1.4rem;
  background: rgba(255, 247, 237, 0.75);
  border: 1px solid rgba(120, 84, 50, 0.12);
}

.hero-note p:last-child,
.lede,
.muted,
.panel-copy,
.subtle {
  color: var(--muted);
}

.lede,
.panel-copy {
  max-width: 40rem;
  font-size: 1.02rem;
}

.panel-copy {
  margin: 0.35rem 0 0;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.6rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  padding: 1rem;
}

.panel-soft {
  background: rgba(255, 247, 238, 0.82);
}

.panel-accent {
  background: var(--surface-accent);
  color: #fff7f1;
}

.panel-accent .eyebrow,
.panel-accent .status,
.panel-accent label > span {
  color: rgba(255, 243, 233, 0.84);
}

.panel-accent .panel-copy {
  color: rgba(255, 239, 228, 0.82);
}

.panel-accent input,
.panel-accent select,
.panel-accent textarea,
.panel-accent .ghost,
.panel-accent .primary,
.panel-accent .utility {
  border-color: rgba(255, 232, 214, 0.18);
}

.panel + .panel,
.panel + .grid,
.panel + .stats-grid,
.hero + .panel,
.grid + .panel,
.stats-grid + .grid,
.grid + .grid,
.onboarding + .panel {
  margin-top: 1rem;
}

.panel-head,
.review-head,
.onboarding-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.log-form,
.quick-add-form,
.stack,
.dynamic-fields {
  display: grid;
  gap: 0.9rem;
}

.log-form label,
.quick-add-form label,
.filter-control {
  display: grid;
  gap: 0.35rem;
  font-weight: 600;
}

.log-form label > span,
.quick-add-form label > span,
.filter-control > span {
  font-size: 0.92rem;
}

input,
select,
textarea,
.ghost,
.primary,
.danger,
.utility {
  border-radius: 1rem;
  border: 1px solid var(--line);
  background: var(--surface-strong);
  min-height: 3rem;
  padding: 0.8rem 0.95rem;
}

textarea {
  resize: vertical;
}

.ghost,
.primary,
.danger,
.utility {
  cursor: pointer;
  font-weight: 700;
}

.ghost {
  background: transparent;
}

.primary {
  background: #fff5ec;
  border-color: #fff5ec;
  color: #5d2612;
}

.utility {
  background: linear-gradient(180deg, var(--utility), var(--utility-strong));
  border-color: rgba(255, 245, 231, 0.24);
  color: #40200c;
  box-shadow: 0 10px 24px rgba(104, 55, 16, 0.22);
}

.danger {
  background: rgba(138, 49, 42, 0.08);
  color: var(--danger);
  border-color: rgba(138, 49, 42, 0.24);
}

.status {
  margin: 0;
  min-height: 1.25rem;
}

.stats-grid,
.grid,
.management-grid,
.starter-grid,
.split-fields,
.compact-form {
  grid-template-columns: 1fr;
}

.mini-stat h2 {
  font-size: clamp(1.4rem, 4.8vw, 2.4rem);
}

.card,
.starter-card {
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 0.9rem;
  background: rgba(255, 249, 241, 0.88);
}

.card h3,
.card p,
.card ul,
.card h4,
.starter-card h3,
.starter-card p {
  margin: 0;
}

.card h4 {
  font-size: 0.98rem;
}

.meta,
.inline-actions,
.activity-header,
.starter-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.activity-header,
.starter-card-head {
  align-items: center;
  justify-content: space-between;
}

.inline-actions {
  margin-top: 0.8rem;
}

.inline-actions button {
  min-height: 2.6rem;
  padding: 0.55rem 0.8rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: #efe0d1;
  color: #4a3522;
  font-size: 0.84rem;
}

.activity-swatch {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.swatch-dot {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 999px;
  background: #d7b394;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.starter-option {
  position: relative;
}

.starter-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.starter-card {
  min-height: 100%;
  display: grid;
  gap: 0.55rem;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.starter-option input:checked + .starter-card {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(96, 51, 22, 0.12);
  transform: translateY(-1px);
  background: #fff4ea;
}

.starter-badge {
  font-size: 0.78rem;
  color: var(--accent-strong);
  font-weight: 700;
}

.empty-note {
  padding: 0.75rem 0.9rem;
  border-radius: 1rem;
  background: rgba(255, 248, 239, 0.88);
  border: 1px dashed var(--line);
}

.intensity-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
}

.intensity-grid input {
  display: none;
}

.intensity-grid label {
  display: grid;
  place-items: center;
  min-height: 3rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 235, 220, 0.26);
  background: rgba(255, 248, 241, 0.1);
  color: #fff3e8;
  cursor: pointer;
}

.intensity-grid input:checked + label {
  background: #fff3e7;
  color: #5e2614;
  border-color: #fff3e7;
}

ul.clean {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

li.row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px dashed var(--line);
}

li.row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.review-panel .stack,
.review-activity,
.section-block {
  display: grid;
  gap: 0.75rem;
}

.is-hidden {
  display: none !important;
}

.onboarding-cta {
  min-width: min(100%, 18rem);
  box-shadow: 0 12px 28px rgba(90, 43, 20, 0.16);
}

.starter-option:hover .starter-card,
.starter-option:focus-within .starter-card {
  border-color: rgba(177, 90, 49, 0.55);
  box-shadow: 0 12px 28px rgba(96, 51, 22, 0.1);
  transform: translateY(-1px);
}

.starter-option input:checked + .starter-card .starter-badge {
  color: #6d2f14;
}
@media (min-width: 760px) {
  .shell {
    padding: 2rem 1.5rem 4rem;
  }

  .hero {
    grid-template-columns: minmax(0, 1.4fr) minmax(18rem, 0.8fr);
  }

  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .grid-wide {
    grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
  }

  .management-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .starter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .split-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .action-row {
    grid-template-columns: repeat(2, minmax(0, max-content));
    align-items: center;
  }
}


.setup-banner {
  background: linear-gradient(135deg, rgba(255, 245, 236, 0.96), rgba(247, 231, 214, 0.94));
}

.setup-banner .panel-copy {
  max-width: 34rem;
}

.tap-log-panel {
  background: rgba(255, 250, 244, 0.96);
}

.tap-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.tap-btn {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  width: 100%;
  padding: 0.875rem 1rem;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 1rem;
  cursor: pointer;
  text-align: left;
  transition: transform 80ms ease, box-shadow 80ms ease;
  min-height: 64px;
}

.tap-btn:hover {
  box-shadow: 0 4px 16px rgba(55, 31, 14, 0.1);
}

.tap-btn:active {
  transform: scale(0.985);
  box-shadow: none;
}

.tap-btn-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
}

.tap-btn-body {
  flex: 1;
  display: grid;
  gap: 0.15rem;
}

.tap-btn-body strong {
  font-size: 1rem;
  color: var(--text);
  font-weight: 600;
}

.tap-btn-body span {
  font-size: 0.82rem;
  color: var(--muted);
}

.tap-btn-plus {
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 300;
  line-height: 1;
  flex-shrink: 0;
}

.tap-confirm {
  margin-top: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 1rem;
  background: rgba(255, 249, 241, 0.98);
  border: 1px solid rgba(177, 90, 49, 0.22);
  display: grid;
  gap: 0.6rem;
}

.tap-confirm p {
  margin: 0;
  font-weight: 600;
  color: var(--accent-strong);
}

.tap-context-drawer {
  margin-top: 0.75rem;
  padding: 1rem;
  background: rgba(255, 248, 239, 0.92);
  border: 1px solid var(--line);
  border-radius: 1rem;
}

@media (min-width: 760px) {
  .tap-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Bottom nav ──────────────────────────────────────── */

.shell {
  padding-bottom: calc(72px + env(safe-area-inset-bottom) + 1rem);
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  padding: 0.4rem 0 0.5rem;
  transition: color 120ms ease;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
}

.nav-btn.active {
  color: var(--accent);
}

/* ── Trends / charts ─────────────────────────────────── */

.trends-panel {
  margin-top: 1rem;
}

.trends-content {
  min-height: 2rem;
}

.trends-grid {
  display: grid;
  gap: 0.9rem;
}

.trend-card {
  padding: 0.85rem;
  border-radius: 1rem;
  background: rgba(255, 249, 241, 0.88);
  border: 1px solid var(--line);
}

.trend-card .eyebrow {
  margin-bottom: 0.6rem;
}

.chart-empty {
  font-size: 0.82rem;
  padding: 0.25rem 0;
}

.horiz-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr) 2rem;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.horiz-bar-row:last-child {
  margin-bottom: 0;
}

.horiz-bar-label {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.horiz-bar-track {
  height: 7px;
  background: rgba(0, 0, 0, 0.07);
  border-radius: 4px;
  overflow: hidden;
}

.horiz-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 400ms ease;
}

.horiz-bar-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  text-align: right;
}

@media (min-width: 760px) {
  .trends-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Timeline load more ──────────────────────────────── */

.timeline-more {
  width: 100%;
  margin-top: 0.75rem;
}

/* ── Skins panel ─────────────────────────────────────── */

.skins-panel {
  margin-top: 1rem;
}

.skins-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.skin-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem;
  border-radius: 1rem;
  border: 2px solid var(--line);
  background: var(--surface-strong);
  cursor: pointer;
  transition: border-color 120ms ease, transform 80ms ease;
  min-height: auto;
}

.skin-btn span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}

.skin-btn.active {
  border-color: var(--accent);
}

.skin-btn:hover {
  transform: translateY(-1px);
}

.skin-preview {
  width: 100%;
  height: 48px;
  border-radius: 0.6rem;
}

.skin-warm {
  background: linear-gradient(135deg, #f4eadb 0%, #d8a066 100%);
}

.skin-dnd {
  background: linear-gradient(135deg, #1a1020 0%, #c9982a 100%);
}

.skin-systems {
  background: linear-gradient(135deg, #0d1117 0%, #58a6ff 100%);
}

/* ── D&D theme ───────────────────────────────────────── */

[data-theme="dnd"] {
  color-scheme: dark;
  --bg: #1a1020;
  --surface: rgba(38, 24, 52, 0.94);
  --surface-strong: rgba(50, 32, 68, 0.98);
  --surface-accent: linear-gradient(135deg, rgba(90, 48, 130, 0.96), rgba(160, 90, 200, 0.88));
  --text: #e8dcc8;
  --muted: #a89880;
  --line: rgba(200, 170, 130, 0.14);
  --accent: #c9982a;
  --accent-strong: #a07820;
  --utility: #c9982a;
  --utility-strong: #a07820;
  --danger: #c45040;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.45);
}

[data-theme="dnd"] body {
  background:
    radial-gradient(circle at top left, rgba(100, 50, 150, 0.2), transparent 24rem),
    radial-gradient(circle at top right, rgba(200, 152, 50, 0.08), transparent 20rem),
    linear-gradient(180deg, #1e1228 0%, #1a1020 42%, #130c1a 100%);
}

[data-theme="dnd"] .card,
[data-theme="dnd"] .starter-card,
[data-theme="dnd"] .trend-card,
[data-theme="dnd"] .empty-note,
[data-theme="dnd"] .tap-context-drawer {
  background: rgba(40, 26, 58, 0.9);
}

[data-theme="dnd"] .primary {
  background: rgba(201, 152, 42, 0.14);
  border-color: rgba(201, 152, 42, 0.3);
  color: #c9982a;
}

[data-theme="dnd"] .pill {
  background: rgba(60, 40, 90, 0.9);
  color: #e8dcc8;
}

[data-theme="dnd"] .bottom-nav {
  background: rgba(30, 18, 42, 0.96);
}

[data-theme="dnd"] .horiz-bar-track {
  background: rgba(200, 170, 130, 0.1);
}

/* ── Systems theme ───────────────────────────────────── */

[data-theme="systems"] {
  color-scheme: dark;
  --bg: #0d1117;
  --surface: rgba(22, 27, 34, 0.97);
  --surface-strong: rgba(30, 37, 46, 0.99);
  --surface-accent: linear-gradient(135deg, rgba(12, 20, 30, 0.97), rgba(30, 55, 80, 0.94));
  --text: #c9d1d9;
  --muted: #8b949e;
  --line: rgba(139, 148, 158, 0.14);
  --accent: #58a6ff;
  --accent-strong: #1f6feb;
  --utility: #238636;
  --utility-strong: #196127;
  --danger: #da3633;
  --shadow: 0 20px 48px rgba(0, 0, 0, 0.55);
  font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
}

[data-theme="systems"] body {
  background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
}

[data-theme="systems"] .card,
[data-theme="systems"] .starter-card,
[data-theme="systems"] .trend-card,
[data-theme="systems"] .empty-note,
[data-theme="systems"] .tap-context-drawer {
  background: rgba(22, 27, 34, 0.96);
}

[data-theme="systems"] .primary {
  background: rgba(88, 166, 255, 0.1);
  border-color: rgba(88, 166, 255, 0.28);
  color: #58a6ff;
}

[data-theme="systems"] .pill {
  background: rgba(30, 37, 46, 0.95);
  color: #c9d1d9;
}

[data-theme="systems"] .bottom-nav {
  background: rgba(13, 17, 23, 0.97);
}

[data-theme="systems"] .horiz-bar-track {
  background: rgba(139, 148, 158, 0.1);
}

[data-theme="systems"] .hero h1,
[data-theme="systems"] .panel h2,
[data-theme="systems"] .mini-stat h2 {
  font-family: "Cascadia Code", "Fira Code", "Consolas", monospace;
}

/* ── Reflection textarea ─────────────────────────────── */

.reflection-input {
  width: 100%;
  font-size: 0.9rem;
}

/* ── Tap button refinements ──────────────────────────── */

.tap-btn-meta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.tap-btn-week {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.78rem;
}

/* ── Stats delta ─────────────────────────────────────── */

.week-delta {
  margin: 0 0 0.25rem;
  font-size: 0.78rem;
  font-weight: 600;
  min-height: 1em;
}

.delta-up {
  color: #b15a31;
}

.delta-down {
  color: var(--muted);
}

.delta-flat {
  color: var(--muted);
  font-weight: 400;
}

/* ── Trend card wide ─────────────────────────────────── */

.trend-card-wide {
  grid-column: 1 / -1;
}

/* ── FAB ─────────────────────────────────────────────── */

.fab {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom));
  right: 1rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(177, 90, 49, 0.35);
  transition: transform 100ms ease, box-shadow 100ms ease;
}

.fab svg {
  width: 22px;
  height: 22px;
}

.fab:active {
  transform: scale(0.9);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ── FAB sheet ───────────────────────────────────────── */

.fab-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  z-index: 190;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.fab-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 72vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 1.4rem 1.4rem 0 0;
  border-top: 1px solid var(--line);
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom));
  z-index: 200;
  animation: sheet-up 220ms cubic-bezier(0.32, 0.72, 0, 1);
}

@keyframes sheet-up {
  from { transform: translateY(30%); opacity: 0.5; }
  to   { transform: translateY(0);   opacity: 1;   }
}

.fab-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.fab-sheet-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.fab-close {
  min-height: 2.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── Toast ───────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--text);
  color: var(--bg);
  padding: 0.6rem 1.25rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 300;
  pointer-events: none;
  white-space: nowrap;
  animation: toast-in 200ms ease forwards;
}

.toast-out {
  opacity: 0;
  transition: opacity 300ms ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(6px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0);   }
}

/* ── Tap button left color accent ────────────────────── */

.tap-btn {
  border-left: 3px solid transparent;
  padding-left: calc(1rem - 3px);
}

/* ── Trend badge ─────────────────────────────────────── */

.trend-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.trend-up   { background: rgba(121, 146, 111, 0.16); color: #4a7a40; }
.trend-down { background: rgba(196, 122, 122, 0.16); color: #a04040; }
.trend-flat { background: rgba(120, 120, 120, 0.12); color: var(--muted); }

/* ── Segmented bar ───────────────────────────────────── */

.segmented-bar {
  display: flex;
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
  gap: 1px;
  margin-bottom: 0.55rem;
}

.seg-bar {
  height: 100%;
  transition: width 400ms ease;
  min-width: 2px;
}

.seg-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.75rem;
}

.seg-label {
  font-size: 0.78rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.seg-label strong {
  color: var(--text);
}

.seg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── 4-week heatmap ──────────────────────────────────── */

.heatmap-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 3px;
}

.heatmap-days span {
  text-align: center;
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 600;
}

.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--line);
}

.heatmap-cell-active {
  background: var(--accent);
}

/* ── Sub-tabs (review section) ───────────────────────── */

.sub-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 0.3rem;
}

.sub-tab {
  flex: 1;
  border: none;
  background: none;
  border-radius: 0.8rem;
  padding: 0.55rem 1rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  min-height: 2.4rem;
  transition: background 140ms ease, color 140ms ease;
}

.sub-tab.active {
  background: var(--surface-strong);
  color: var(--accent);
}

/* ── Detail entry toggle bar ─────────────────────────── */

.detail-entry-bar {
  display: flex;
  justify-content: center;
  padding: 0.35rem 0 0.1rem;
}

.detail-toggle {
  font-size: 0.85rem;
  color: var(--muted);
  min-height: 2.2rem;
  padding: 0.35rem 1.25rem;
  border-color: var(--line);
}

/* ── Form close button ───────────────────────────────── */

.form-close-btn {
  min-height: 2.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── General polish ──────────────────────────────────── */

.mini-stat {
  position: relative;
}

.mini-stat h2 {
  line-height: 1;
  margin-bottom: 0.1rem;
}

.trend-card .eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
}

