:root {
  --bg: #0a0e13;
  --bg-2: #111a24;
  --card: #131c27;
  --card-2: #18222f;
  --line: #1f2a37;        /* softer hairline */
  --line-2: #182230;      /* even quieter dividers */
  --text: #eaf1f8;
  --muted: #93a6ba;       /* a touch brighter for readability */
  --accent: #4aa8ff;
  --accent-2: #2f86d6;
  --accent-soft: rgba(74, 168, 255, 0.10);
  --good: #35d399;
  --good-dim: #1c3a30;
  --warn: #f5b14c;
  --warn-dim: #3a2f1a;
  --bad: #ff6b6b;
  --bad-dim: #3a1f22;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.30);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1100px 540px at 50% -14%, #11202f 0%, var(--bg) 58%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

/* ---------- Tab bar (shell) ---------- */
.tabbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: rgba(11, 15, 20, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  white-space: nowrap;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
@media (min-width: 900px) { .tab { flex: 1 1 auto; } }
.tab:hover { color: var(--text); }
.tab.active { background: linear-gradient(90deg, #7c5cff 0%, #3ea6ff 100%); color: #fff; border-color: transparent; font-weight: 700; }

/* ---------- Views ---------- */
.view {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 26px);
  padding-top: calc(70px + env(safe-area-inset-top));
}
.view.hidden { display: none; }
/* Tasks & Dashboard use the whole page width */
#tasksView { max-width: none; }
#dashboardView { max-width: none; }
/* Dashboard sections stack full-width; each fills the screen via its own internal grid. */
.loading-screen { text-align: center; color: var(--muted); padding: 80px 0; }

/* Coach tab — embedded health-coach app, full-bleed below the tab bar */
#coachView { max-width: none; padding: calc(52px + env(safe-area-inset-top)) 0 0; }
.coach-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.coach-bar a { color: var(--accent); text-decoration: none; font-weight: 600; }
.coach-frame { display: block; width: 100%; height: calc(100vh - 52px - env(safe-area-inset-top) - 43px); border: 0; background: var(--bg); }

/* ---------- Trading progress rail (now inline, not fixed) ---------- */
.tv-rail { display: flex; gap: 6px; margin-bottom: 16px; }
.rail-dot {
  flex: 1;
  background: none;
  border: 0;
  padding: 6px 2px 8px;
  cursor: pointer;
  color: var(--muted);
  font: inherit;
  border-top: 3px solid var(--line);
  border-radius: 2px;
  transition: color .2s, border-color .2s;
}
.rail-dot .rail-label { font-size: 11px; letter-spacing: .02em; }
.rail-dot.active { color: var(--accent); border-top-color: var(--accent); }
.rail-dot.done { color: var(--good); border-top-color: var(--good); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dash-hero { margin: 2px 0 22px; }
.dash-hero .dash-date { color: var(--muted); font-size: 13px; letter-spacing: .01em; }
.dash-hero h1 { margin: 5px 0 0; font-size: 27px; font-weight: 650; letter-spacing: -0.025em; }
.dash-hero-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* At-a-glance chips */
.glance { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.glance-chip { font: inherit; font-size: 12px; font-weight: 600; padding: 7px 13px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); cursor: pointer; transition: transform .08s ease, border-color .15s, background .15s; }
.glance-chip b { color: var(--text); }
.glance-chip.all b { color: var(--good); }
.glance-chip.hot b { color: var(--warn); }
.glance-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.glance-chip:active { transform: scale(.94); }

/* Micro-interactions */
.pill, .area-card, .dt-item, .card, .move-chip, .fchip, .glance-chip, .btn-primary, .btn-ghost, .btn-soft, .dense-btn, .tab { transition: transform .08s ease, border-color .15s, background .15s, color .15s; }
.pill:active, .area-card:active, .dt-item:active, .move-chip:active, .fchip:active, .dense-btn:active, .pill-del:active, .task-check:active, .dt-check:active { transform: scale(.96); }
.area-card:hover { transform: translateY(-1px); }
/* NOTE: fill-mode is `backwards` not `both` on purpose — `both`/`forwards`
   leaves a lingering identity transform that becomes a containing block and
   breaks position:fixed for the planner modal nested inside a section. */
.dash-sec, .dash-hero, .capture { animation: ccFadeUp .4s ease backwards; }
.dash-sec:nth-child(3) { animation-delay: .04s; }
.dash-sec:nth-child(4) { animation-delay: .08s; }
.dash-sec:nth-child(5) { animation-delay: .12s; }
.dash-sec:nth-child(n+6) { animation-delay: .16s; }
@keyframes ccFadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dash-sec, .dash-hero, .capture { animation: none; } * { transition: none !important; } }

/* Movable sections */
.dash-sec { position: relative; margin-bottom: 12px; }
.sec-arrange { display: none; position: absolute; top: -2px; right: 6px; z-index: 6; gap: 5px; }
#dashboardView.arranging .sec-arrange { display: flex; }
#dashboardView.arranging .dash-sec { outline: 1px dashed var(--accent); outline-offset: 5px; border-radius: 14px; }
.sec-arrange button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); cursor: pointer; font-size: 15px; box-shadow: var(--shadow); }
.sec-arrange button:hover { border-color: var(--accent); color: var(--accent); }

.section-head { display: flex; align-items: center; justify-content: space-between; margin: 30px 0 14px; }
.section-head h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.section-head .small { font-size: 13px; }
.count { font-size: 13px; color: var(--muted); font-weight: 600; }
.sh-actions { display: flex; align-items: center; gap: 10px; }
.src-link { font-size: 11px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.src-link:hover { color: var(--accent); }
.routine-title .src-link, .routine-group-label .src-link { font-weight: 400; }
.count.done { color: var(--good); }
.empty { padding: 8px 2px 0; line-height: 1.5; }

/* ---- Health score ---- */
.score-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}
.ring { width: 116px; height: 116px; flex: none; }
.ring-bg { fill: none; stroke: var(--bg-2); stroke-width: 10; }
.ring-fg {
  fill: none; stroke-width: 10; stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 65px 65px;
  transition: stroke-dasharray .6s ease;
}
.ring-good .ring-fg { stroke: var(--good); }
.ring-warn .ring-fg { stroke: var(--warn); }
.ring-accent .ring-fg { stroke: var(--accent); }
.ring-bad .ring-fg { stroke: var(--bad); }
.ring-muted .ring-fg { stroke: var(--line); }
.ring-num { fill: var(--text); font-size: 30px; font-weight: 800; text-anchor: middle; }
.ring-cap { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.score-body { flex: 1; min-width: 0; }
.score-title { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); }
.score-summary { margin: 6px 0 10px; font-size: 15px; line-height: 1.4; }
.score-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.score-chip {
  position: relative; display: inline-flex; align-items: center;
  padding: 5px 10px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line);
  font-size: 12px; overflow: hidden;
}
.score-chip i { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(62, 166, 255, 0.20); }
.score-chip b { position: relative; font-weight: 600; color: var(--text); }

/* ---- Pills ---- */
.pill-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 560px) { .pill-list { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } }
.pill {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; cursor: pointer;
  transition: border-color .15s;
}
.pill.on { border-color: var(--good-dim); }
.pill-check {
  flex: none; width: 24px; height: 24px; border-radius: 8px;
  border: 2px solid var(--line); display: grid; place-items: center;
  color: var(--good); font-weight: 800; font-size: 14px;
}
.pill.on .pill-check { background: var(--good-dim); border-color: var(--good); }
.pill-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.pill-name { font-weight: 600; }
.pill.on .pill-name { color: var(--good); }
.pill-sub { font-size: 12px; color: var(--muted); }
.pill-del { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; display: grid; place-items: center; opacity: .45; transition: opacity .15s, color .15s; }
.pill-del:hover { opacity: 1; color: var(--bad); border-color: var(--bad-dim); }

.med-add-toggle { margin-top: 12px; font: inherit; font-size: 13px; font-weight: 600; padding: 8px 14px; border-radius: 10px; border: 1px dashed var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.med-add-toggle:hover { color: var(--text); border-color: var(--accent); }
.med-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.med-add .med-cancel { flex: 0 0 auto; padding: 11px 14px; }
.med-add .med-name { flex: 2 1 160px; min-width: 0; }
.med-add .med-dose { flex: 1 1 110px; min-width: 0; }
.med-add .med-time { flex: 0 1 130px; }
.med-add .btn-primary { flex: 0 0 auto; padding: 11px 18px; }

/* ---- Morning routine (pills ring + checklist combined) ---- */
.routine-card {
  background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px;
}
.routine-top { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.routine-card .ring { width: 78px; height: 78px; }
.routine-body { flex: 1; min-width: 0; }
.routine-title { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); }
.routine-summary { margin: 4px 0 8px; font-size: 14px; line-height: 1.35; }
.routine-prog { height: 6px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.routine-prog span { display: block; height: 100%; background: var(--good); border-radius: 999px; transition: width .45s ease; }
.routine-group { margin-bottom: 10px; }
.routine-group:last-of-type { margin-bottom: 0; }
/* column view — time-of-day groups side by side */
.routine-cols { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; align-items: flex-start; }
.routine-cols .routine-group { flex: 0 0 190px; max-width: 230px; margin: 0; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.routine-cols .routine-group .pill-list { grid-template-columns: 1fr; }
.routine-cols .pill { background: var(--card); }
.routine-cols .pill.on { background: var(--card-2); }
@media (min-width: 760px) { .routine-cols .routine-group { flex: 1 1 0; max-width: none; } }
.routine-group-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 6px; }
/* compact pill tiles inside the routine */
.routine-card .pill-list { gap: 6px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.routine-card .pill { padding: 8px 11px; gap: 10px; border-radius: 10px; background: var(--bg-2); transition: border-color .15s, background .15s; }
.routine-card .pill.on { background: var(--card); border-color: var(--good-dim); }
.routine-card .pill-check { width: 19px; height: 19px; border-radius: 50%; border-width: 2px; font-size: 12px; }
.routine-card .pill.on .pill-check { background: var(--good); border-color: var(--good); color: #04121f; }
.routine-card .pill-name { font-size: 13px; line-height: 1.25; }
.routine-card .pill.on .pill-name { color: var(--muted); text-decoration: line-through; }
.routine-card .pill-sub { font-size: 11px; }
.routine-card .pill-del { width: 18px; height: 18px; font-size: 13px; }
.routine-card .med-add { margin-top: 10px; }
.routine-prog span { background: linear-gradient(90deg, var(--good), #2dd4bf); }
.routine-group-label { display: flex; align-items: center; gap: 7px; }
.rg-count { font-size: 10px; font-weight: 700; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
.rg-count.all { color: var(--good); border-color: var(--good-dim); }

/* ---- My areas (nav links) ---- */
.areas-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 560px) { .areas-grid { grid-template-columns: repeat(3, 1fr); } }
.area-card { display: flex; align-items: center; gap: 12px; padding: 14px 15px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--text); transition: border-color .15s, background .15s; }
.area-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.area-emoji { font-size: 22px; flex: none; }
.area-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.area-label { font-weight: 600; }
.area-desc { font-size: 12px; color: var(--muted); }
.area-arrow { color: var(--muted); flex: none; }

/* ---- This week (calendar) ---- */
.cal-connect .muted { line-height: 1.5; margin: 0 0 12px; font-size: 14px; }
.cal-form { display: flex; gap: 8px; }
.cal-form #calInput { flex: 1; min-width: 0; }
.cal-form .btn-primary { flex: 0 0 auto; padding: 11px 18px; }
.cal-week { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 560px) { .cal-week { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .cal-week { grid-template-columns: repeat(7, 1fr); } }
.cal-day { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.cal-day.is-today { border-color: var(--accent); }
.cal-dh { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 6px; display: flex; gap: 6px; }
.cal-dh span { color: var(--text); }
.cal-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cal-ev { display: flex; gap: 7px; align-items: flex-start; font-size: 12px; line-height: 1.3; }
.cal-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; }
.cal-body { min-width: 0; }
.cal-t { color: var(--accent); font-size: 11px; }
.cal-s { display: block; }
.cal-empty { color: var(--muted); font-size: 12px; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.cal-leg { display: inline-flex; align-items: center; gap: 6px; }
.cal-leg i { width: 9px; height: 9px; border-radius: 50%; }
.cal-color { flex: none; width: 36px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-2); cursor: pointer; }
.me-row .cal-name { flex: 1 1 110px; min-width: 0; }
.me-row .cal-url { flex: 2 1 180px; min-width: 0; }
.me-add .cal-add-name { flex: 1 1 120px; min-width: 0; }
.me-add .cal-add-url { flex: 2 1 200px; min-width: 0; }

/* ---- Day tasks (Yesterday / Today / Tomorrow) ---- */
.day-cols { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .day-cols { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .day-cols { grid-template-columns: repeat(4, 1fr); } }
.day-col { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.day-col.is-today { border-color: var(--accent); }
.day-col.is-high { border-color: #5a2a2f; }
.dt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.dt-head h3 { margin: 0; font-size: 14px; }
.dt-date { color: var(--muted); font-weight: 500; font-size: 12px; margin-left: 4px; }
.dt-count { font-size: 12px; color: var(--muted); flex: none; }
.dt-count.all { color: var(--good); }
.dt-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.dt-item { display: flex; align-items: center; gap: 9px; }
.dt-check { flex: none; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line); background: transparent; color: var(--good); font-weight: 800; font-size: 13px; display: grid; place-items: center; cursor: pointer; }
.dt-check.on { background: var(--good-dim); border-color: var(--good); }
.dt-name { flex: 1; font-size: 14px; line-height: 1.35; min-width: 0; }
.dt-item.done .dt-name { color: var(--muted); text-decoration: line-through; }
.dt-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.dt-empty { color: var(--muted); font-size: 13px; margin: 2px 0 0; }

/* ---- Goals & Playbook (read-only reference) ---- */
.pb-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; }
.pb-card > summary, .pb-pillar > summary { cursor: pointer; list-style: none; }
.pb-card > summary::-webkit-details-marker, .pb-pillar > summary::-webkit-details-marker { display: none; }
.pb-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.pb-top h2 { margin: 0; font-size: 18px; }
.pb-identity { margin: 0 0 14px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--bg-2); border-radius: 0 10px 10px 0; color: var(--text); font-style: italic; line-height: 1.5; font-size: 14px; }
.pb-pillar { border-top: 1px solid var(--line); padding: 10px 0; }
.pb-pillar > summary { padding: 6px 0; }
.pb-pname { font-weight: 700; font-size: 15px; }
.pb-why { margin: 6px 0 12px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.pb-sec { margin-bottom: 12px; }
.pb-h { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); margin-bottom: 6px; }
.pb-list { margin: 0; padding-left: 18px; display: grid; grid-template-columns: 1fr; gap: 4px; }
@media (min-width: 560px) { .pb-list { grid-template-columns: 1fr 1fr; } }
.pb-list li { font-size: 13px; line-height: 1.4; }
.pb-foot { margin: 6px 0 12px; }
.pb-card.open { padding: 16px; }
.pb-card.open .pb-top { padding: 0 0 12px; }
.pb-card .media-edit { max-height: 60vh; overflow-y: auto; }
.me-row .pb-item { flex: 2 1 160px; min-width: 0; }
.me-row .pb-pillar { flex: 0 1 150px; }
.me-row .pb-section { flex: 1 1 110px; min-width: 0; }
.me-add .pb-add-item { flex: 2 1 180px; min-width: 0; }
.me-add .pb-add-pillar { flex: 0 1 150px; }
.me-add .pb-add-section { flex: 1 1 120px; min-width: 0; }

/* ---- Pillar launcher ---- */
.pillar-launch { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; padding: 48px 20px; max-width: 420px; margin: 0 auto; }
.pl-emoji { font-size: 56px; line-height: 1; }
.pl-title { margin: 4px 0 0; font-size: 26px; letter-spacing: -0.02em; }
.pl-sub { margin: 0 0 8px; color: var(--muted); font-size: 15px; }
.pillar-launch .pl-open { text-decoration: none; width: 100%; max-width: 320px; text-align: center; }
.pillar-launch .pl-preview { width: 100%; max-width: 320px; }

/* ---- Mirrored Notion page (read-only) ---- */
.nb { font-size: 14px; line-height: 1.5; color: var(--text); }
.nb h3, .nb h4, .nb h5 { margin: 16px 0 8px; line-height: 1.3; }
.nb h3 { font-size: 18px; } .nb h4 { font-size: 16px; } .nb h5 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.nb-p { margin: 6px 0; }
.nb-list { margin: 6px 0 6px 20px; padding: 0; }
.nb-list li { margin: 3px 0; }
.nb-todo { display: flex; gap: 8px; align-items: flex-start; margin: 4px 0; }
.nb-check { flex: none; width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--line); display: grid; place-items: center; color: var(--good); font-size: 12px; font-weight: 800; margin-top: 1px; }
.nb-check.on { background: var(--good-dim); border-color: var(--good); }
.nb-done { color: var(--muted); text-decoration: line-through; }
.nb-quote { border-left: 3px solid var(--accent); padding: 4px 12px; margin: 8px 0; color: var(--muted); }
.nb-callout { display: flex; gap: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 8px 0; }
.nb-toggle { margin: 6px 0; }
.nb-toggle > summary { cursor: pointer; font-weight: 600; list-style: revert; }
.nb-toggle-body { padding: 6px 0 6px 14px; }
.nb-hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.nb-code { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow: auto; font-size: 12px; white-space: pre-wrap; margin: 8px 0; }
.nb-img { max-width: 100%; border-radius: 8px; margin: 8px 0; display: block; }
.nb-tablewrap { overflow-x: auto; margin: 8px 0; }
.nb-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.nb-table td { border: 1px solid var(--line); padding: 6px 10px; vertical-align: top; }
.nb-cols { display: flex; gap: 16px; flex-wrap: wrap; }
.nb-col { flex: 1 1 240px; min-width: 0; }
.nb-db { display: inline-block; margin: 6px 0; color: var(--accent); text-decoration: none; }
.nb code { background: var(--bg-2); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* ---- Weekly Journal ---- */
.jtabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.jtab { font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; }
.jtab.on { background: var(--card-2); color: var(--text); border-color: var(--accent); }
.journal-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.journal-form .field { display: flex; flex-direction: column; gap: 6px; }
.journal-form .field.full { grid-column: 1 / -1; }
.journal-form label { font-size: 13px; color: var(--muted); }
.journal-form textarea { resize: vertical; }

/* ---- Health quick-log ---- */
.health-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.health-grid .field.full, .health-grid .full { grid-column: 1 / -1; }
.switch { display: flex; align-items: center; gap: 10px; padding: 8px 0; }
.switch input { width: 22px; height: 22px; accent-color: var(--good); }
.switch span { color: var(--muted); font-size: 14px; }

/* ---- Media ---- */
.media-subhead {
  font-size: 12px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .08em;
  margin: 18px 0 8px;
}
.media-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .media-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); } }
.media-spotify iframe { width: 100%; height: 152px; border: 0; border-radius: 12px; display: block; }
.media-yt { cursor: pointer; }
.yt-thumb {
  position: relative; aspect-ratio: 16 / 9;
  background-size: cover; background-position: center;
  border-radius: 12px; display: grid; place-items: center;
  border: 1px solid var(--line);
}
.yt-play {
  font-size: 22px; color: #fff;
  background: rgba(0, 0, 0, 0.55);
  width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center; padding-left: 4px;
}
.media-cap { font-size: 13px; margin-top: 6px; color: var(--text); }
.yt-frame { aspect-ratio: 16 / 9; }
.yt-frame iframe { width: 100%; height: 100%; border: 0; border-radius: 12px; }
.media-link {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px;
  text-decoration: none; color: var(--text);
}
.media-link small { color: var(--muted); }
.yt-badge { position: absolute; top: 8px; right: 8px; background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }

/* Media edit mode */
.media-edit { display: flex; flex-direction: column; gap: 8px; }
.me-row { display: flex; gap: 8px; align-items: center; }
.me-row .me-title { flex: 1 1 130px; min-width: 0; }
.me-row .me-url { flex: 2 1 200px; min-width: 0; }
.me-row .me-cat { flex: 0 1 130px; }
.me-del { flex: none; width: 38px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.me-del:hover { color: var(--bad); border-color: var(--bad-dim); }
.me-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.me-add .me-add-url { flex: 2 1 220px; min-width: 0; }
.me-add .me-add-title { flex: 1 1 140px; min-width: 0; }
.me-add .btn-primary { flex: 0 0 auto; padding: 11px 18px; }

/* ============================================================
   TASKS
   ============================================================ */
.task-summary { display: flex; gap: 14px; margin-top: 8px; font-size: 14px; color: var(--muted); }
.task-summary b { color: var(--text); }
.task-summary .over b { color: var(--bad); }
.task-summary .hot b { color: var(--warn); }

.task-add { margin: 2px 0 10px; display: flex; flex-direction: column; gap: 8px; }
.task-add #taskAddName { font-size: 15px; padding: 11px 12px; }
.task-add-row { display: flex; gap: 8px; }
.task-add-row select { flex: 1; min-width: 0; }
.task-add-row input[type="date"] { flex: 0 1 150px; min-width: 0; }
.task-add-row .btn-primary { flex: 0 0 auto; padding: 11px 18px; }

#tasksView .dash-hero { margin: 0 0 10px; }
#tasksView .task-controls { margin-bottom: 10px; }
#tasksView .fchips { margin-bottom: 12px; }

/* On wider screens, quick-add collapses to a single row to free vertical space */
@media (min-width: 720px) {
  .task-add { flex-direction: row; align-items: center; }
  .task-add #taskAddName { flex: 1; }
  .task-add-row { flex: 0 0 auto; }
}

.task-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.task-search { flex: 1; min-width: 0; }
.done-toggle { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.done-toggle input { width: 18px; height: 18px; accent-color: var(--accent); }

.view-toggle { flex: none; display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.view-toggle button {
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 7px 14px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.view-toggle button.on { background: var(--card-2); color: var(--text); }

/* ---- Board (Kanban) ---- */
.board-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.bc-left { display: flex; align-items: center; gap: 10px; }
.bc-label { font-size: 13px; color: var(--muted); }
.bc-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: middle; flex: none; }
.dense-btn { font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; white-space: nowrap; }
.dense-btn.on { background: var(--card-2); color: var(--text); border-color: var(--accent); }
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; -webkit-overflow-scrolling: touch; }
.board-col {
  flex: 0 0 205px; max-width: 230px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px; display: flex; flex-direction: column;
  transition: border-color .15s, background .15s;
}
.board-col.drop { border-color: var(--accent); background: var(--card); }
.bc-head[draggable="true"] { cursor: grab; }
.bc-head[draggable="true"]:active { cursor: grabbing; }
.bc-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 4px 8px; cursor: pointer; user-select: none; }
.bc-title { font-weight: 700; font-size: 13px; }
.bc-count { font-size: 11px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; flex: none; }
.bc-body { display: flex; flex-direction: column; gap: 6px; min-height: 44px; }
.bc-empty { border: 1px dashed var(--line); border-radius: 8px; padding: 10px; text-align: center; color: var(--muted); font-size: 12px; }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 9px; overflow: hidden; cursor: grab; position: relative;
}
.card .task-head { padding-right: 32px; }
.card-move {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  border-radius: 6px; border: 1px solid var(--line); background: var(--card-2);
  color: var(--muted); font-size: 13px; line-height: 1; cursor: pointer;
  display: grid; place-items: center; opacity: .7;
}
.card-move:hover { opacity: 1; color: var(--accent); border-color: var(--accent); }
.move-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.move-chip { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; font-weight: 600; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.move-chip.on { border-color: var(--accent); background: var(--card-2); }
.move-chip i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.card:active { cursor: grabbing; }
.card.high { border-color: #5a2a2f; }
.card.open { border-color: var(--accent); cursor: default; }
.card.dragging { opacity: .45; }
.card .task-head { padding: 8px 10px; gap: 9px; align-items: flex-start; }
.card .task-check { width: 19px; height: 19px; border-radius: 6px; margin-top: 0; }
.card .task-line { gap: 6px; }
.card .task-name {
  font-size: 13px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card.done .task-name { color: var(--muted); text-decoration: line-through; }
.card .task-badge { font-size: 9px; padding: 1px 6px; }
.card .task-meta { gap: 8px; margin-top: 4px; font-size: 11px; flex-wrap: nowrap; overflow: hidden; }
.card .task-cat { min-width: 0; overflow: hidden; }
.card .task-cat i { flex: none; }
.card .task-date { flex: none; white-space: nowrap; }

/* Compact (title-only) mode — max density */
.board.dense .card .task-head { padding: 6px 9px; gap: 8px; align-items: center; }
.board.dense .card .task-check { width: 17px; height: 17px; }
.board.dense .card .task-name { -webkit-line-clamp: 1; }
.board.dense .card .task-badge { display: none; }
.board.dense .card .task-meta { display: none; }
.board.dense .bc-body { gap: 4px; }

/* Collapsed column — thin vertical strip; tap to expand */
.board-col.collapsed { flex: 0 0 40px; max-width: 40px; min-width: 40px; padding: 8px 4px; cursor: pointer; }
.board-col.collapsed .bc-head { flex-direction: column; gap: 10px; padding: 2px 0; height: 100%; justify-content: flex-start; }
.board-col.collapsed .bc-title { writing-mode: vertical-rl; font-size: 12px; white-space: nowrap; }
.board-col.collapsed .bc-count { order: -1; }
.board-col.collapsed .bc-dot { margin: 0 0 2px; }

/* Status grouping: columns fill the page (no horizontal scroll on wider screens) */
@media (min-width: 720px) {
  .board.by-status { overflow-x: visible; }
  .board.by-status .board-col { flex: 1 1 0; max-width: none; }
  .board.by-status .board-col.collapsed { flex: 0 0 40px; max-width: 40px; }
}

.fchips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.fchip {
  font: inherit; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line);
  color: var(--muted); cursor: pointer;
}
.fchip.on { background: var(--card-2); border-color: var(--accent); color: var(--text); }

.task-group { margin-bottom: 20px; }
.tg-head { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.tg-head h3 { margin: 0; font-size: 15px; }
.tg-count { font-size: 12px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; }

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.task {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.task.high { border-color: #5a2a2f; }
.task.open { border-color: var(--accent); }
.task-head { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; }
.task-check {
  flex: none; width: 24px; height: 24px; margin-top: 1px;
  border-radius: 7px; border: 2px solid var(--line);
  background: transparent; color: var(--good); font-weight: 800; font-size: 14px;
  display: grid; place-items: center; cursor: pointer;
}
.task-check.on { background: var(--good-dim); border-color: var(--good); }
.task-main { flex: 1; min-width: 0; cursor: pointer; }
.task-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-name { font-weight: 600; line-height: 1.35; }
.task.done .task-name { color: var(--muted); text-decoration: line-through; }
.task-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 999px; }
.task-badge.high { background: var(--bad-dim); color: var(--bad); }
.task-badge.ip { background: var(--card-2); color: var(--accent); }
.task-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 5px; font-size: 12px; color: var(--muted); }
.task-cat { display: inline-flex; align-items: center; gap: 6px; }
.task-cat i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.task-date.over { color: var(--bad); font-weight: 600; }
.task-attach { color: var(--muted); }
.task-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.task-tag { font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); color: var(--muted); }

/* Attachments in editor */
.te-filebox { display: flex; flex-direction: column; gap: 6px; }
.te-files { display: flex; flex-direction: column; gap: 4px; }
.te-file { font-size: 13px; color: var(--accent); text-decoration: none; }
.te-attach { font-size: 12px; color: var(--muted); }

/* Task editor modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.6); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: calc(58px + env(safe-area-inset-top)) 16px 24px; overflow-y: auto;
}
.modal-card { width: 100%; max-width: 460px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 18px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal-title { flex: 1; min-width: 0; font-size: 17px; font-weight: 700; background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; color: var(--text); padding: 10px 12px; }
.modal-title:focus { outline: none; border-color: var(--accent); }
.modal-x { flex: none; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--card-2); color: var(--muted); cursor: pointer; font-size: 14px; }
.modal-body { display: flex; flex-direction: column; gap: 14px; }
.modal-body .te-row { display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 12px; }
.modal-body .te-row label { font-size: 13px; color: var(--muted); }
.modal-body select, .modal-body input[type="date"] { width: 100%; padding: 11px 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn-ghost { flex: 1; text-align: center; text-decoration: none; padding: 12px; }

/* Quick capture bar */
.capture { display: flex; gap: 8px; margin: 0 0 18px; }
.capture #captureInput { flex: 1; min-width: 0; font-size: 15px; padding: 13px 14px; }
.capture .btn-primary { flex: 0 0 auto; padding: 13px 20px; }

/* Plan my day — board of category columns */
.plan-title { font-size: 17px; font-weight: 700; }
/* Bound the wide modal to the viewport and make it a flex column so the board
   always fits and scrolls inside the card (regardless of window height). */
.modal-card.modal-wide {
  max-width: min(1150px, 95vw);
  display: flex; flex-direction: column;
  max-height: calc(100vh - 58px - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}
.modal-card.modal-wide .modal-head { flex: none; }
.plan-board { display: flex; gap: 10px; overflow: auto; flex: 1 1 auto; min-height: 0; padding-bottom: 4px; }
.plan-board .board-col { flex: 0 0 210px; max-width: 240px; align-self: flex-start; }
/* Scoped under .plan-board — `.plan-card` also exists in the Trading tab
   (column layout); scoping here avoids that collision and wins on specificity. */
.plan-board .plan-card { display: flex; flex-direction: row; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; cursor: default; transition: border-color .15s, background .15s, transform .08s ease; }
.plan-board .plan-card:hover { border-color: var(--accent); background: var(--card-2); }
.plan-board .plan-card.in { border-color: var(--good-dim); background: var(--good-dim); }
.plan-board .plan-toggle { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--card-2); color: var(--accent); font-size: 15px; cursor: pointer; display: grid; place-items: center; transition: background .15s, border-color .15s, transform .08s ease; }
.plan-board .plan-card:hover .plan-toggle { border-color: var(--accent); }
.plan-board .plan-toggle:active { transform: scale(.9); }
.plan-board .plan-card.in .plan-toggle { background: var(--good); border-color: var(--good); color: #04121f; }
.plan-board .plan-card-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.plan-board .plan-name { min-width: 0; font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.plan-board .plan-card-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.plan-board .plan-card-meta:empty { display: none; }
.plan-board .plan-when { font-size: 11px; color: var(--muted); }
.plan-board .plan-when.over { color: var(--bad); font-weight: 600; }

.task-editor { border-top: 1px solid var(--line); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg-2); }
.te-row { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 10px; }
.te-row label { font-size: 13px; color: var(--muted); }
.te-row select, .te-row input { padding: 9px 10px; }
.te-actions { display: flex; gap: 8px; margin-top: 2px; }
.te-actions .btn-ghost { flex: 1; text-align: center; padding: 10px; font-size: 14px; text-decoration: none; }
.te-del { color: var(--bad); border-color: var(--bad-dim); }

/* ============================================================
   TRADING (ported from smc-session)
   ============================================================ */
.hero { text-align: center; margin: 6px 0 18px; }
.hero-date { color: var(--muted); font-size: 14px; }
.verdict { display: inline-block; margin: 8px 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.verdict.good { color: var(--good); }
.verdict.warn { color: var(--warn); }
.verdict.bad { color: var(--bad); }
.hero-note { color: var(--muted); font-size: 14px; }

.why {
  background: linear-gradient(180deg, var(--card) 0%, var(--card-2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px;
}
.why-tag { display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin-bottom: 6px; }
.why p { margin: 0; line-height: 1.5; font-size: 15px; }

.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.plan-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.plan-card .k { color: var(--muted); font-size: 12px; }
.plan-card .v { font-size: 17px; font-weight: 700; }
.plan-card .v small { color: var(--muted); font-weight: 500; font-size: 12px; }

.today-summary { margin-bottom: 14px; }
.cta-stack { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.rest-banner { background: var(--warn-dim); border: 1px solid #5a4a25; color: #ffd9a0; border-radius: 12px; padding: 12px 14px; font-size: 14px; text-align: center; }

/* Buttons */
.btn-primary, .btn-ghost, .btn-soft {
  font: inherit; font-weight: 700; border-radius: 12px;
  padding: 14px 18px; cursor: pointer; border: 1px solid transparent;
  transition: transform .05s, filter .15s, background .15s;
}
.btn-primary:active, .btn-ghost:active, .btn-soft:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%); color: #04121f; }
.btn-primary:disabled { background: #25323f; color: #5d6e7e; cursor: not-allowed; }
.btn-primary.big { font-size: 18px; padding: 18px; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-soft { background: var(--card-2); border-color: var(--line); color: var(--text); }

.stage-head { margin: 4px 0 16px; }
.stage-head h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.stage-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.stage-actions { display: flex; gap: 10px; margin-top: 18px; }
.stage-actions .btn-primary { flex: 1; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.chip.pos { color: var(--good); border-color: var(--good-dim); }
.chip.neg { color: var(--bad); border-color: var(--bad-dim); }
.chip.warn { color: var(--warn); border-color: #5a4a25; }

.rules-card, .checks-card, .mgmt-note { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.rules-card h3, .checks-card h3, .mgmt-note h4 { margin: 0 0 12px; font-size: 15px; }
.rules-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.rules-list li { display: flex; gap: 10px; align-items: flex-start; line-height: 1.4; font-size: 14px; }
.rule-n { flex: none; width: 22px; height: 22px; border-radius: 6px; background: var(--card-2); color: var(--accent); font-size: 12px; font-weight: 700; display: grid; place-items: center; }

.check { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-radius: 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.check:last-of-type { border-bottom: 0; }
.check input { width: 20px; height: 20px; accent-color: var(--good); pointer-events: none; }
.check.on { color: var(--good); }
.check span { font-size: 15px; }

.inline-warn { margin-top: 10px; background: var(--warn-dim); border: 1px solid #5a4a25; color: #ffd9a0; border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.4; }

.steps { display: flex; flex-direction: column; gap: 10px; }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.step.done { border-color: var(--good-dim); }
.step summary { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none; }
.step summary::-webkit-details-marker { display: none; }
.step-num { flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--card-2); color: var(--accent); font-weight: 800; display: grid; place-items: center; }
.step.done .step-num { background: var(--good-dim); color: var(--good); }
.step-title { flex: 1; font-weight: 700; font-size: 15px; }
.step-tick { color: var(--good); font-weight: 800; }
.step-body { padding: 0 16px 16px; }
.step-hint { color: var(--muted); font-size: 13px; margin: 0 0 10px; line-height: 1.4; }
.step-checks { margin: 0 0 12px; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }
.step-checks li { font-size: 14px; line-height: 1.4; }
.step-confirm { width: 100%; }
.step.done .step-confirm { background: var(--good-dim); color: var(--good); }

.bias-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 14px; }
.bias-btn { font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); cursor: pointer; }
.bias-btn.on { background: var(--accent); border-color: var(--accent); color: #04121f; }

.mgmt-note ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }
.mgmt-note li { font-size: 13px; color: var(--muted); line-height: 1.4; }

/* Forms */
form { display: block; }
.grid, form .field { margin-bottom: 12px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full, .form-section { grid-column: 1 / -1; }
.field label { font-size: 13px; color: var(--muted); }
input, select, textarea { font: inherit; background: var(--bg-2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; }
.form-section h4 { margin: 8px 0 2px; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.rating-row { display: flex; align-items: center; gap: 12px; }
.rating-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.rating-value { min-width: 28px; text-align: center; font-weight: 700; background: var(--card-2); border-radius: 8px; padding: 4px 0; }

.rr-readout { grid-column: 1 / -1; background: var(--bg-2); border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 2px 0 14px; color: var(--muted); }
.rr-readout.good { border-color: var(--good-dim); color: var(--good); }
.rr-readout.warn { border-color: #5a4a25; color: var(--warn); }
.rr-readout .ok { color: var(--good); }
.rr-readout .bad { color: var(--bad); }
.rr-readout strong { color: var(--text); }

.status { font-size: 14px; margin: 6px 0; min-height: 1em; }
.status.full { grid-column: 1 / -1; }
.status.error { color: var(--bad); }
.status.success { color: var(--good); }
.muted { color: var(--muted); }

.guard, .done-card { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px 20px; margin-top: 8px; }
.guard-icon, .done-icon { font-size: 40px; }
.guard h2, .done-card h2 { margin: 12px 0 8px; }
.guard p, .done-card p { color: var(--muted); line-height: 1.5; margin: 0 0 16px; }
.done-card .muted { font-size: 13px; }

.trade-summary { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.trade-summary li { display: flex; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--card-2); border: 1px solid var(--line); color: var(--text); padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; z-index: 50; max-width: 90vw; }
.toast.success { border-color: var(--good-dim); }
.toast.error { border-color: var(--bad-dim); }
.toast.hidden { display: none; }

/* File upload */
.file-input { width: 100%; color: var(--muted); font-size: 13px; }
.file-preview { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.file-preview:empty { margin-top: 0; }
.file-preview img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.file-preview span { font-size: 12px; color: var(--muted); word-break: break-all; }

/* Stats */
.stats-loading, .stats-empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.stats-empty p { margin: 4px 0; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 4px 0 8px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.stat-k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.stat-v { font-size: 18px; font-weight: 700; }
.stat-v.pos { color: var(--good); }
.stat-v.neg { color: var(--bad); }
.stats-section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-top: 12px; }
.stats-section h4 { margin: 0 0 10px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.eq-chart { width: 100%; height: 120px; display: block; }
.eq-zero { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.eq-line { fill: none; stroke-width: 2; }
.eq-line.eq-pos { stroke: var(--good); }
.eq-line.eq-neg { stroke: var(--bad); }
.eq-dot.eq-pos { fill: var(--good); }
.eq-dot.eq-neg { fill: var(--bad); }
.wl-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--bg-2); }
.wl-win { background: var(--good); }
.wl-be { background: var(--muted); }
.wl-loss { background: var(--bad); }
.wl-legend { display: flex; gap: 16px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.wl-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.wl-legend .dot.win { background: var(--good); }
.wl-legend .dot.be { background: var(--muted); }
.wl-legend .dot.loss { background: var(--bad); }

@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .score-card { flex-direction: column; text-align: center; }
}

/* ============================================================
   FUN — playful colour & motion layer (dashboard)
   ============================================================ */
/* Hero: gradient title + wiggly emoji + fun subtitle line */
.hero-title {
  background: linear-gradient(92deg, #eaf1f8 0%, #8fc7ff 55%, #b79bff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-emoji { display: inline-block; transform-origin: 70% 70%; }
.dash-hero-row h1:hover .hero-emoji { animation: heroWiggle .6s ease; }
@keyframes heroWiggle { 0%,100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 50% { transform: rotate(-10deg); } 80% { transform: rotate(6deg); } }
.dash-sub { margin: 6px 0 0; font-size: 13px; color: #8fb0cf; }

/* Glance chips — colour per metric */
.glance-chip.routine { border-color: rgba(74,168,255,.38); background: rgba(74,168,255,.10); }
.glance-chip.routine b { color: #4aa8ff; }
.glance-chip.today { border-color: rgba(53,211,153,.38); background: rgba(53,211,153,.10); }
.glance-chip.today b { color: #35d399; }
.glance-chip.hot { border-color: rgba(245,177,76,.42); background: rgba(245,177,76,.12); }
.glance-chip.hot b { color: #f5b14c; }
.glance-chip.all { border-color: rgba(53,211,153,.5); }
.glance-chip.all b { color: #35d399; }

/* Section headings — colour-coded gradient accent bar */
.section-head h2 { position: relative; padding-left: 14px; }
.section-head h2::before {
  content: ""; position: absolute; left: 0; top: .16em; bottom: .16em;
  width: 5px; border-radius: 3px;
  background: linear-gradient(180deg, #7c5cff, #3ea6ff);
}
.dash-sec[data-sec="areas"] .section-head h2::before { background: linear-gradient(180deg, #9a7dff, #6d5cff); }
.dash-sec[data-sec="calendar"] .section-head h2::before { background: linear-gradient(180deg, #2dd4bf, #14b8a6); }
.dash-sec[data-sec="day"] .section-head h2::before { background: linear-gradient(180deg, #35d399, #10b981); }
.dash-sec[data-sec="email"] .section-head h2::before { background: linear-gradient(180deg, #4aa8ff, #2f86d6); }
.dash-sec[data-sec="media"] .section-head h2::before { background: linear-gradient(180deg, #f06fb0, #e255a1); }

/* Area cards — emoji badge + colourful hover glow */
.area-emoji { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; line-height: 1; flex: none; }
.area-card { transition: transform .16s cubic-bezier(.34,1.56,.64,1), border-color .15s, box-shadow .2s, background .15s; }
.area-card:hover {
  border-color: var(--ac, var(--accent));
  background: var(--card-2);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -10px var(--ac, var(--accent));
}
.area-card:hover .area-arrow { color: var(--ac, var(--accent)); }

@media (prefers-reduced-motion: reduce) {
  .dash-hero-row h1:hover .hero-emoji { animation: none; }
  .area-card:hover { transform: none; }
}

/* ---- Podcast library (compact list) ---- */
.pod-list { display: flex; flex-direction: column; gap: 8px; }
.pod-row { display: flex; align-items: center; gap: 12px; padding: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s, transform .08s ease; }
.pod-row:hover { border-color: var(--accent); background: var(--card-2); }
.pod-row:active { transform: scale(.99); }
.pod-thumb { flex: none; width: 54px; height: 54px; border-radius: 9px; background-size: cover; background-position: center; background-color: var(--bg-2); display: grid; place-items: center; font-size: 22px; }
.pod-thumb.ph { color: var(--muted); }
.pod-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pod-title { font-weight: 600; font-size: 14px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-play { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card-2); color: var(--accent); font-size: 13px; cursor: pointer; display: grid; place-items: center; }
.pod-row:hover .pod-play { border-color: var(--accent); background: var(--accent-soft); }
.pod-playing { margin: 0 0 8px; }

/* ---- Inbox (Gmail preview) ---- */
.mail-list { display: flex; flex-direction: column; gap: 8px; }
.mail-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.mail-row:hover { border-color: var(--accent); background: var(--card-2); }
.mail-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: transparent; border: 1px solid var(--line); }
.mail-row.unread .mail-dot { background: var(--accent); border-color: var(--accent); }
.mail-main { flex: 1; min-width: 0; }
.mail-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mail-from { font-size: 13px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row.unread .mail-from { color: var(--text); }
.mail-date { flex: none; font-size: 11px; color: var(--muted); }
.mail-subj { font-size: 13px; color: var(--text); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-row.unread .mail-subj { font-weight: 600; }
.mail-snip { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-add { flex: none; align-self: center; font: inherit; font-size: 12px; font-weight: 600; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--card-2); color: var(--accent); cursor: pointer; white-space: nowrap; }
.mail-add:hover { border-color: var(--accent); background: var(--accent-soft); }
.mail-add.added { color: var(--good); border-color: var(--good-dim); background: var(--good-dim); }
