﻿/* ===========================================================
   Self Growth360 — Psychology Growth App
   Self-contained design system (no frameworks)
   =========================================================== */

/* Accessibility: respect reduced-motion (vestibular safety — esp. the
   breathing pacer & fades). One systemic rule, app-wide. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===========================================================
   PSYCHOLOGY-BACKED COLOR SYSTEM
   Each hue is chosen for its researched emotional effect, so a
   feature's color reinforces what it's for:
     calm (blue)        → lowers arousal: stress, anxiety, breathing
     growth (green)     → balance & renewal: habits, wellbeing, life balance
     confidence (gold)  → optimism & self-worth: confidence, esteem
     focus (indigo)     → concentration & discipline: focus, habits lab
     insight (violet)   → introspection & meaning: self-discovery, purpose
     social (coral)     → warmth & connection: relationships, communication
     compassion (rose)  → nurturing & emotion: self-compassion, feelings
     alert (red)        → urgency, used sparingly: crisis & emergency
   Base is a deep indigo-navy (restful, trustworthy) rather than flat black.
   =========================================================== */
:root {
  --bg: #0a0c14;               /* deep cool charcoal, not muddy navy */
  --bg-soft: #0f121d;
  --surface: #151926;          /* cards step up clearly from bg */
  --surface-2: #1d2233;
  --surface-3: #272d42;
  --line: #242a3d;             /* crisp, subtle borders */
  --text: #f2f4fc;
  --text-dim: #a7afca;
  --text-mute: #828aac;

  --primary: #7e9bff;          /* trust / calm blue-indigo */
  --primary-soft: #20274a;
  --accent: #34dcae;           /* growth teal-green */
  --warn: #ffc24d;
  --danger: #ff6b81;
  --good: #46d39a;

  /* psychology tokens — use these to color features by purpose */
  --c-calm: #5aa9ff;
  --c-calm-soft: rgba(90,169,255,.15);
  --c-growth: #3ed3a0;
  --c-growth-soft: rgba(62,211,160,.15);
  --c-confidence: #ffc94d;
  --c-confidence-soft: rgba(255,201,77,.15);
  --c-focus: #8b7bff;
  --c-focus-soft: rgba(139,123,255,.15);
  --c-insight: #c084fc;
  --c-insight-soft: rgba(192,132,252,.15);
  --c-social: #ff8a6b;
  --c-social-soft: rgba(255,138,107,.15);
  --c-compassion: #ff9ec4;
  --c-compassion-soft: rgba(255,158,196,.15);
  --c-alert: #ff6b81;
  --c-alert-soft: rgba(255,107,129,.15);

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 30px;
  --shadow: 0 14px 48px rgba(4,8,20,.45);
  --shadow-sm: 0 4px 18px rgba(4,8,20,.30);

  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', Georgia, serif;
  --maxw: 1180px;
}

/* light theme */
[data-theme="light"] {
  --bg: #f7f9ff;
  --bg-soft: #f0f4fe;
  --surface: #ffffff;
  --surface-2: #f3f6fe;
  --surface-3: #e9eefb;
  --line: #e2e8f6;
  --text: #1b2240;
  --text-dim: #525d80;
  --text-mute: #6b748f;
  --primary: #5b6cf0;
  --primary-soft: #e9ecfe;
  --accent: #10b58f;
  --warn: #d28c14;
  --danger: #e8556d;
  --good: #2eab4b;
  /* psychology tokens — deeper for contrast on light surfaces */
  --c-calm: #2f7fe6; --c-calm-soft: rgba(47,127,230,.12);
  --c-growth: #149f7a; --c-growth-soft: rgba(20,159,122,.12);
  --c-confidence: #c98a12; --c-confidence-soft: rgba(201,138,18,.14);
  --c-focus: #6a55e6; --c-focus-soft: rgba(106,85,230,.12);
  --c-insight: #9b4fd6; --c-insight-soft: rgba(155,79,214,.12);
  --c-social: #e06542; --c-social-soft: rgba(224,101,66,.12);
  --c-compassion: #d9568f; --c-compassion-soft: rgba(217,86,143,.12);
  --c-alert: #df4d64; --c-alert-soft: rgba(223,77,100,.12);
  --shadow: 0 10px 40px rgba(40,50,90,.12);
  --shadow-sm: 0 4px 18px rgba(40,50,90,.08);
}
[data-theme="light"] body::before {
  background:
    radial-gradient(900px 480px at 8% -8%, rgba(91,108,240,.14), transparent 60%),
    radial-gradient(820px 460px at 55% -12%, rgba(255,158,196,.10), transparent 60%),
    radial-gradient(760px 420px at 102% 4%, rgba(16,181,143,.12), transparent 55%);
}

/* accessibility: visible keyboard focus */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
[data-act] { cursor: pointer; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background-color: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(720px 380px at 6% -10%, rgba(126,155,255,.10), transparent 60%),
    radial-gradient(640px 360px at 104% 2%, rgba(52,220,174,.07), transparent 58%);
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
h1,h2,h3,h4 { line-height: 1.2; margin: 0 0 .4em; }
.serif { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; }

/* ---------- boot / splash ---------- */
.boot {
  position: fixed; inset: 0; z-index: 100; min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center;
  background:
    radial-gradient(1000px 620px at 50% 18%, rgba(16,176,131,.15), transparent 60%),
    radial-gradient(900px 620px at 50% 100%, rgba(221,148,66,.11), transparent 60%),
    #f6f4ef;
  animation: bootFade .5s ease both;
}
[data-theme="dark"] .boot { background:
    radial-gradient(1000px 620px at 50% 18%, rgba(16,176,131,.16), transparent 60%),
    radial-gradient(900px 620px at 50% 100%, rgba(124,140,255,.14), transparent 60%),
    #0f1320; }
@keyframes bootFade { from { opacity: 0; } to { opacity: 1; } }
.boot-ring {
  width: 104px; height: 104px; border-radius: 50%; position: relative; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(16,176,131,.16), rgba(221,148,66,.12));
  box-shadow: 0 14px 44px rgba(16,176,131,.30);
  animation: bootPulse 2.2s ease-in-out infinite;
}
.boot-ring::before {
  content: ""; position: absolute; inset: -7px; border-radius: 50%;
  border: 2.5px solid transparent; border-top-color: #10b083; border-right-color: #dd9442;
  animation: bootSpin 1.05s linear infinite;
}
@keyframes bootSpin { to { transform: rotate(360deg); } }
@keyframes bootPulse { 0%,100% { transform: scale(1); box-shadow: 0 14px 44px rgba(16,176,131,.30); } 50% { transform: scale(1.05); box-shadow: 0 18px 54px rgba(16,176,131,.42); } }
.boot-logo { width: 66px; height: 66px; border-radius: 17px; background: #fff; padding: 7px; display: block; animation: none; }
.boot-name { font-family: var(--serif, Georgia, serif); font-size: 25px; font-weight: 700; letter-spacing: -.01em; color: #1c2630; margin-top: 8px; }
[data-theme="dark"] .boot-name { color: #ECEAE0; }
.boot-name b { color: #10b083; font-weight: 700; }
.boot-tag { font-size: 13px; color: #8b94a2; }
.boot-bar { width: 190px; height: 4px; border-radius: 99px; background: rgba(28,37,48,.10); overflow: hidden; margin-top: 10px; }
[data-theme="dark"] .boot-bar { background: rgba(255,255,255,.10); }
.boot-bar span { display: block; height: 100%; width: 42%; border-radius: 99px; background: linear-gradient(90deg, #10b083, #dd9442); animation: bootBar 1.15s ease-in-out infinite; }
@keyframes bootBar { 0% { margin-left: -42%; } 100% { margin-left: 100%; } }
@keyframes float { 50% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) {
  .boot-ring, .boot-ring::before, .boot-bar span { animation: none; }
  .boot-bar span { width: 100%; margin-left: 0; }
}

/* ===========================================================
   Layout shell
   =========================================================== */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--bg-soft), var(--bg));
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--line2, rgba(127,127,127,.25)); border-radius: 99px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 14px; }
.brand .logo { font-size: 26px; }
.brand .name { font-family: var(--serif); font-weight: 700; font-size: 21px; letter-spacing: -.01em; }
.brand .name span { color: var(--primary); }

.nav-group-label { font-size: 10.5px; letter-spacing: .14em; font-weight: 700; text-transform: uppercase; color: var(--text-mute); padding: 15px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 12px;
  color: var(--text-dim); cursor: pointer; border: none;
  font-weight: 600; font-size: 14px; transition: background .16s, color .16s, box-shadow .16s, transform .1s; user-select: none;
  position: relative;
}
.nav-item .ico {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center;
  font-size: 16px; line-height: 1; border-radius: 9px; background: transparent; transition: background .16s, transform .16s;
}
/* psychological SVG icon set (js/icons.js) — inherits currentColor from the item */
.nav-item .ico .nico { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .92; }
.nav-item.active .ico .nico { opacity: 1; }
.tabbar .tab .t-ico .nico { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* dashboard quick-access icon chips (js/views.js miniCard/quickCard) */
.dash-ico { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 13px; font-size: 22px;
  background: linear-gradient(135deg, var(--primary-soft), var(--c-growth-soft)); color: var(--primary); }
.dash-ico.sm { width: 36px; height: 36px; border-radius: 10px; font-size: 18px; }
.dash-ico .nico { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dash-ico.sm .nico { width: 19px; height: 19px; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item:hover .ico { background: var(--primary-soft); transform: scale(1.05); }
.nav-item.active {
  background: linear-gradient(105deg, var(--primary), var(--c-insight, #a78bfa));
  color: #fff; box-shadow: 0 8px 20px rgba(124,140,255,.34);
}
.nav-item.active .ico { background: rgba(255,255,255,.24); }
.nav-item:active { transform: translateY(1px); }
.nav-spacer { flex: 1; min-height: 8px; }
.nav-foot { font-size: 11.5px; line-height: 1.4; color: var(--text-mute); padding: 12px; border-top: 1px solid var(--line); margin-top: 6px; }
[dir="rtl"] .nav-item .ico { margin: 0; }

.main { padding: 30px clamp(18px, 4vw, 48px) 80px; max-width: var(--maxw); width: 100%; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.topbar h1 { font-family: var(--serif); font-size: clamp(24px, 3vw, 34px); margin: 0; }
.topbar .sub { color: var(--text-dim); font-size: 14px; margin-top: 2px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-content: center; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #0d1020; }

/* mobile nav */
.mobile-top { display: none; }
/* Drawer is the mobile-only nav; hidden on desktop (the aside sidebar is shown).
   Without this base rule it renders a duplicate nav overlapping the sidebar >920px. */
.drawer { display: none; }

/* ===========================================================
   Reusable
   =========================================================== */
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, #fff 8%), var(--surface));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.card.pad-lg { padding: 28px; }
.card h3 { font-size: 16px; }
.card .muted { color: var(--text-dim); font-size: 14px; }
.card-title { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom: 14px; }
.card-title h3 { margin: 0; }

.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label { color: var(--text-mute); font-size: 12.5px; text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-size: 30px; font-weight: 800; font-family: var(--serif); }
.stat .delta { font-size: 12.5px; color: var(--text-dim); }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--line); }
.pill.good { background: rgba(86,211,100,.14); color: #8ef0a0; border-color: transparent; }
.pill.warn { background: rgba(255,180,84,.14); color: var(--warn); border-color: transparent; }
.pill.bad  { background: rgba(255,107,129,.14); color: var(--danger); border-color: transparent; }
.pill.info { background: rgba(124,140,255,.16); color: #aeb8ff; border-color: transparent; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14.5px;
  cursor: pointer; transition: .15s; white-space: nowrap;
}
.btn:hover { background: var(--surface-3); transform: translateY(-1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(135deg, var(--primary), #6a78ee); border-color: transparent; color: #fff;
  box-shadow: 0 8px 24px rgba(124,140,255,.3); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.accent { background: linear-gradient(135deg, var(--accent), #2fcfa6); border-color: transparent; color: #07241c; }
.btn.danger { background: transparent; color: var(--danger); border-color: rgba(255,107,129,.4); }
.btn.sm { padding: 7px 13px; font-size: 13px; }
.btn.block { width: 100%; }

.input, .textarea, select {
  width: 100%; padding: 12px 14px; border-radius: var(--r-md);
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  font-size: 15px; font-family: inherit; transition: .15s;
}
.input:focus, .textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124,140,255,.18); }
.textarea { resize: vertical; min-height: 96px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 7px; }
.field .hint { font-size: 12.5px; color: var(--text-mute); margin-top: 6px; }

.progressbar { height: 9px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progressbar > i { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .5s ease; }

.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }

.empty { text-align: center; padding: 48px 20px; color: var(--text-mute); }
.empty .ico { font-size: 44px; margin-bottom: 8px; }

/* ===========================================================
   Onboarding / centered flows
   =========================================================== */
.center-wrap { min-height: 100vh; display: grid; place-items: center; padding: 30px 16px; }
.flow-card { width: 100%; max-width: 560px; background: linear-gradient(180deg, var(--surface), var(--bg-soft));
  border: 1px solid var(--line); border-radius: var(--r-xl); padding: 38px; box-shadow: var(--shadow); }
.flow-card .step-dots { display: flex; gap: 7px; margin-bottom: 22px; }
.flow-card .step-dots i { height: 6px; flex: 1; border-radius: 999px; background: var(--surface-3); }
.flow-card .step-dots i.on { background: var(--primary); }
.flow-head { text-align: center; margin-bottom: 26px; }
.flow-head .emoji { font-size: 46px; }
.flow-head h2 { font-family: var(--serif); font-size: 28px; margin: 8px 0 6px; }
.flow-head p { color: var(--text-dim); margin: 0; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--bg); cursor: pointer; transition: .15s; font-size: 14.5px; display: flex; gap: 10px; align-items: center;
}
.choice:hover { border-color: var(--primary); }
.choice.sel { border-color: var(--primary); background: var(--primary-soft); }
.choice .ck { width: 18px; height: 18px; border-radius: 5px; border: 2px solid var(--text-mute); display: grid; place-content: center; flex: none; }
.choice.sel .ck { background: var(--primary); border-color: var(--primary); }

/* ===========================================================
   Quiz-funnel onboarding (first-run) + "Building your plan" reveal
   =========================================================== */
.flow-card.funnel { max-width: 520px; }
.onb-top { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.onb-back { width: 34px; height: 34px; flex: none; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-dim); font-size: 18px; line-height: 1; cursor: pointer; display: grid; place-items: center; transition: .15s; }
.onb-back:hover { border-color: var(--primary); color: var(--text); transform: translateX(-2px); }
.onb-back.sp { visibility: hidden; }
.onb-prog { flex: 1; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.onb-prog i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .45s var(--ease); }
.onb-count { font-size: 12px; font-weight: 700; color: var(--text-mute); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.onb-eyebrow { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--primary); background: var(--primary-soft); padding: 5px 11px; border-radius: 999px; margin-bottom: 10px; }
.onb-proof { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 14px; }
.onb-proof .op { font-size: 12.5px; font-weight: 600; color: var(--text-dim); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px; }
.onb-proof .op b { color: var(--text); font-weight: 800; }
.onb-trust { text-align: center; font-size: 12px; color: var(--text-mute); margin: 0 0 18px; line-height: 1.5; }

/* one-tap auto-advancing option cards */
.optlist { display: flex; flex-direction: column; gap: 10px; }
.optcard { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 15px; padding: 13px 15px; cursor: pointer;
  transition: transform .16s var(--ease), border-color .16s, background .16s, box-shadow .16s; }
.optcard:hover { border-color: var(--primary); background: var(--surface-3); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.optcard.sel { border-color: var(--primary); background: var(--primary-soft); }
.optcard .oc-ic { width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 24px; background: var(--surface); }
.optcard .oc-tx { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.optcard .oc-tx b { font-size: 15px; font-weight: 600; }
.optcard .oc-go { color: var(--text-mute); font-size: 18px; transition: transform .18s var(--ease), color .18s; }
.optcard:hover .oc-go { transform: translateX(4px); color: var(--primary); }

/* "Building your plan" reveal */
.flow-card.build { text-align: center; }
.build-ring { position: relative; width: 118px; height: 118px; margin: 6px auto 20px; }
.build-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.build-ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.build-ring .bg { stroke: var(--surface-3); }
.build-ring .fg { stroke: var(--primary); stroke-dasharray: 327; stroke-dashoffset: 327; animation: buildRing 2.7s var(--ease) forwards; }
.build-ring .build-emoji { position: absolute; inset: 0; display: grid; place-items: center; font-size: 42px; animation: buildPulse 1.5s ease-in-out infinite; }
.build-lines { list-style: none; padding: 0; margin: 6px 0 18px; display: flex; flex-direction: column; gap: 11px; }
.build-lines li { opacity: 0; color: var(--text-dim); font-size: 14px; animation: buildLine .5s var(--ease) forwards; }
.build-lines li::before { content: "✓"; color: var(--accent); font-weight: 800; margin-right: 8px; }
.build-lines li:nth-child(1) { animation-delay: .25s; }
.build-lines li:nth-child(2) { animation-delay: 1s; }
.build-lines li:nth-child(3) { animation-delay: 1.8s; }
.build-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.build-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); animation: buildBar 2.7s var(--ease) forwards; }
@keyframes buildRing { to { stroke-dashoffset: 30; } }
@keyframes buildBar { to { width: 100%; } }
@keyframes buildLine { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes buildPulse { 50% { transform: scale(1.12); } }

/* personalized plan-preview on the final onboarding step */
.plan-preview { text-align: left; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; margin-bottom: 14px;
  background: linear-gradient(160deg, var(--primary-soft), var(--surface-2)); animation: buildLine .45s var(--ease) both; }
.plan-preview .pp-badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--primary); background: var(--surface); border: 1px solid var(--line); padding: 5px 11px; border-radius: 999px; margin-bottom: 14px; }
.plan-preview .pp-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-mute); margin-bottom: 8px; }
.plan-preview .pp-focus { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.plan-preview .pp-chip { font-size: 12.5px; font-weight: 600; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
.plan-preview .pp-first { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.plan-preview .pp-first-ic { width: 42px; height: 42px; flex: none; border-radius: 11px; display: grid; place-items: center; font-size: 22px; background: var(--primary-soft); }
.plan-preview .pp-first-tx { min-width: 0; }
.plan-preview .pp-first-t { font-size: 14px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.plan-preview .pp-first-tag { font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); background: var(--c-growth-soft); padding: 2px 7px; border-radius: 5px; }
.plan-preview .pp-first-s { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.plan-preview .pp-inc { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text-dim); }
.plan-preview .pp-inc span { white-space: nowrap; }

/* persistent "your next step" guide bar (app shell) */
.guidebar-wrap { margin: 0 0 20px; }
.guidebar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 15px;
  background: linear-gradient(105deg, var(--primary-soft), var(--c-growth-soft)); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); animation: gbIn .35s var(--ease) both; }
.guidebar.hint { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-sm); animation: gbIn .35s var(--ease) both, gbPulse 2s ease-in-out infinite .4s; }
@keyframes gbPulse { 50% { box-shadow: 0 0 0 6px transparent, var(--shadow-sm); } }
.gb-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 8px; padding: 0 4px;
  font-size: 12.5px; color: var(--text-dim); }
.gb-hint b { color: var(--text); }
.gb-gotit { margin-left: auto; border: 1px solid var(--line); background: var(--surface-2); color: var(--primary);
  font-weight: 700; font-size: 12px; padding: 4px 12px; border-radius: 999px; cursor: pointer; }
.gb-gotit:hover { background: var(--primary-soft); border-color: var(--primary); }

/* journey-completion celebration */
.tour-backdrop.celebrate { overflow: hidden; }
.confetti-field { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.confetti { position: absolute; top: -24px; border-radius: 2px; opacity: .92;
  animation-name: confettiFall; animation-timing-function: linear; animation-iteration-count: 1; animation-fill-mode: forwards; }
@keyframes confettiFall {
  0% { transform: translateY(-24px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(102vh) rotate(600deg); opacity: .9; }
}
.celebrate-card { position: relative; z-index: 1; }
.celebrate-card .cel-emoji { font-size: 54px; animation: celPop .6s var(--ease) both; }
@keyframes celPop { 0% { transform: scale(0) rotate(-25deg); } 70% { transform: scale(1.2); } 100% { transform: scale(1) rotate(0); } }
.celebrate-card .cel-next { display: grid; gap: 8px; margin-bottom: 12px; }
.celebrate-card .cel-close { border: none; background: transparent; color: var(--text-mute); font-size: 13px; cursor: pointer; padding: 6px; }
.celebrate-card .cel-close:hover { color: var(--text); text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .confetti { display: none; } }

/* recurring "re-measure due" nudge (dashboard) */
.remeasure-nudge { display: flex; align-items: center; gap: 13px; margin-bottom: 18px; padding: 14px 16px; border-radius: 15px;
  background: linear-gradient(105deg, var(--c-confidence-soft), var(--surface-2)); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.remeasure-nudge .rn-ic { width: 42px; height: 42px; flex: none; border-radius: 12px; display: grid; place-items: center; font-size: 22px;
  background: var(--surface); }
.remeasure-nudge .rn-tx { flex: 1; min-width: 0; }
.remeasure-nudge .rn-t { font-size: 14.5px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.remeasure-nudge .rn-more { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; color: var(--c-confidence);
  background: var(--c-confidence-soft); padding: 2px 8px; border-radius: 999px; }
.remeasure-nudge .rn-s { font-size: 13px; color: var(--text-dim); margin-top: 2px; line-height: 1.45; }
.remeasure-nudge .rn-act { display: flex; align-items: center; gap: 8px; flex: none; }
.remeasure-nudge .rn-x { border: none; background: transparent; color: var(--text-mute); font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 8px 10px; border-radius: 9px; }
.remeasure-nudge .rn-x:hover { background: var(--surface); color: var(--text); }
@media (max-width: 620px) {
  .remeasure-nudge { flex-wrap: wrap; }
  .remeasure-nudge .rn-act { width: 100%; }
  .remeasure-nudge .rn-act .btn { flex: 1; justify-content: center; }
}
@keyframes gbIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.guidebar .gb-ic { width: 40px; height: 40px; flex: none; border-radius: 11px; display: grid; place-items: center; font-size: 21px; background: var(--surface); }
.guidebar .gb-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.guidebar .gb-lab { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--primary); }
.guidebar .gb-title { font-size: 14.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.guidebar .gb-cta { flex: none; white-space: nowrap; }
.guidebar .gb-x { border: none; background: transparent; color: var(--text-mute); font-size: 14px; cursor: pointer; padding: 7px; flex: none; border-radius: 8px; line-height: 1; }
.guidebar .gb-x:hover { background: var(--surface); color: var(--text); }
@media (max-width: 560px) {
  .guidebar { flex-wrap: wrap; }
  .guidebar .gb-tx { order: 2; flex-basis: calc(100% - 52px); }
  .guidebar .gb-cta { order: 3; flex: 1; justify-content: center; }
  .guidebar .gb-x { order: 4; }
}

/* ===========================================================
   Assessment / Likert
   =========================================================== */
.q-wrap { max-width: 680px; margin: 0 auto; }
.q-meta { display: flex; justify-content: space-between; color: var(--text-mute); font-size: 13px; margin-bottom: 10px; }
.q-text { font-family: var(--serif); font-size: 24px; margin: 14px 0 26px; }
.likert { display: grid; gap: 10px; }
.likert .opt {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg); cursor: pointer; transition: .14s;
}
.likert .opt:hover { border-color: var(--primary); transform: translateX(3px); }
.likert .opt.sel { border-color: var(--primary); background: var(--primary-soft); }
.likert .opt .dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--text-mute); flex: none; }
.likert .opt.sel .dot { border-color: var(--primary); background: var(--primary); box-shadow: 0 0 0 4px rgba(124,140,255,.25); }
.q-nav { display: flex; justify-content: space-between; margin-top: 28px; }

/* score rings & bars */
.trait { margin-bottom: 16px; }
.trait .row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; }
.trait .row .name { font-weight: 600; }
.trait .row .val { color: var(--text-dim); }
.scale { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.scale > i { display: block; height: 100%; border-radius: 999px; }

.ring-wrap { display: flex; align-items: center; gap: 18px; }
.ring { --p: 0; --c: var(--primary); width: 108px; height: 108px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0);
  display: grid; place-content: center; position: relative; }
.ring::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--surface); }
.ring .num { position: relative; font-size: 26px; font-weight: 800; font-family: var(--serif); }

/* ===========================================================
   Plan / tasks / lists
   =========================================================== */
.list { display: grid; gap: 10px; }
.row-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-soft); transition: .14s;
}
.row-item:hover { border-color: var(--surface-3); }
.row-item.done { opacity: .55; }
.row-item.done .ri-title { text-decoration: line-through; }
.check {
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--text-mute);
  flex: none; cursor: pointer; display: grid; place-content: center; transition: .14s; color: transparent; font-size: 14px;
}
.check.on { background: var(--accent); border-color: var(--accent); color: #07241c; }
.ri-body { flex: 1; }
.ri-title { font-weight: 600; font-size: 14.5px; }
.ri-sub { color: var(--text-mute); font-size: 12.5px; }

.day-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; background: var(--bg-soft); position: relative; }
.day-card.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.day-card.locked { opacity: .5; }
.day-card .dnum { font-size: 12px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .08em; }
.day-card .dfocus { font-weight: 700; font-family: var(--serif); margin: 4px 0 8px; }
.week-label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-mute); margin: 22px 0 12px; }

/* ===========================================================
   Coach chat
   =========================================================== */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 480px; }
.chat-log { flex: 1; overflow-y: auto; padding: 6px 4px 14px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 76%; padding: 13px 16px; border-radius: 18px; font-size: 14.5px; line-height: 1.5; }
.msg.bot { background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 5px; align-self: flex-start; }
.msg.user { background: linear-gradient(135deg, var(--primary), #6a78ee); color: #fff; border-bottom-right-radius: 5px; align-self: flex-end; }
.msg .who { font-size: 11px; opacity: .65; margin-bottom: 3px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { padding: 7px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13px; cursor: pointer; color: var(--text-dim); transition: .14s; }
.chip:hover { border-color: var(--primary); color: var(--text); }
.chat-input { display: flex; gap: 10px; margin-top: 12px; }

/* coach typing indicator */
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-mute); display: inline-block; animation: blink 1.2s infinite both; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* targeted exercises */
.exercise { border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px; background: var(--bg-soft); transition: .14s; }
.exercise.done { border-color: rgba(69,224,184,.4); }
.ex-steps { margin: 0; padding-left: 18px; font-size: 13.5px; color: var(--text-dim); }
.ex-steps li { margin-bottom: 4px; }
.ai-loading { display: flex; align-items: center; gap: 12px; color: var(--text-dim); padding: 8px 0; }
.spinner { width: 20px; height: 20px; border: 3px solid var(--surface-3); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toggle switch */
.switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--surface-3); border-radius: 26px; transition: .2s; }
.switch .slider::before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* print / PDF export */
@media print {
  body { background: #fff !important; color: #111 !important; }
  body::before { display: none; }
  .sidebar, .mobile-top, .topbar-actions, .drawer, .no-print, #toast { display: none !important; }
  .shell { display: block !important; }
  .main { max-width: 100% !important; padding: 0 !important; }
  .card { border: 1px solid #ccc !important; background: #fff !important; box-shadow: none !important; break-inside: avoid; }
  .card *, .muted, h1, h2, h3, h4, p, span, div { color: #111 !important; }
  .ring::before { background: #fff !important; }
  .scale, .progressbar { background: #eee !important; }
}

/* advisor module rows */
.module-row { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-soft); }
.module-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--surface-2); display: grid; place-content: center; font-size: 20px; flex: none; }

/* breathing pacer — designed orb with a soft halo + "alive" idle pulse */
.breath-stage { height: 260px; display: grid; place-items: center; margin: 8px 0; position: relative; overflow: hidden; }
.breath-stage::before { content: ""; position: absolute; width: 230px; height: 230px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124,140,255,.20), transparent 68%); animation: breathHalo 5.5s ease-in-out infinite; }
.breath-circle {
  width: 152px; height: 152px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 28%, rgba(158,172,255,.98), rgba(69,224,184,.78));
  display: grid; place-items: center; transform: scale(1);
  box-shadow: 0 12px 50px rgba(124,140,255,.5), inset 0 0 44px rgba(255,255,255,.28);
}
/* gentle breathing pulse only while idle — JS drives the scale while running */
.breath-circle:not(.running) { animation: breathIdle 5.5s ease-in-out infinite; }
.breath-circle::after { content: ""; position: absolute; inset: -16px; border-radius: 50%;
  border: 1.5px solid rgba(124,140,255,.32); }
.breath-circle:not(.running)::after { animation: breathRing 5.5s ease-in-out infinite; }
.breath-circle.running::after { opacity: .35; }
@keyframes breathIdle { 0%,100% { transform: scale(.92); } 50% { transform: scale(1.07); } }
@keyframes breathRing { 0%,100% { transform: scale(1); opacity: .55; } 50% { transform: scale(1.14); opacity: .12; } }
@keyframes breathHalo { 0%,100% { transform: scale(.88); opacity: .55; } 50% { transform: scale(1.12); opacity: 1; } }
.breath-inner { text-align: center; color: #0b1020; position: relative; z-index: 2; padding: 0 10px; }
.breath-phase { font-weight: 700; font-size: 15px; font-family: var(--serif); letter-spacing: .04em; opacity: .82; }
.breath-count { font-size: 34px; font-weight: 800; font-family: var(--serif); line-height: 1.1; }

/* meditation timer */
.med-display { font-size: 58px; font-weight: 800; font-family: var(--serif); letter-spacing: .02em; margin: 18px 0; }

/* habit heatmap */
.heatmap { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; }
.hm { width: 14px; height: 14px; border-radius: 3px; background: var(--surface-3); }
.hm.on { background: var(--accent); box-shadow: 0 0 6px rgba(69,224,184,.5); }

/* selected chip (distortions) */
.chip.sel-chip { background: var(--primary-soft); color: #fff; border-color: var(--primary); }

/* range input */
input[type=range] { accent-color: var(--primary); }

/* report document presentation */
.report-cover { border-top: 4px solid var(--primary); background-image: linear-gradient(135deg, var(--primary-soft), transparent 55%); }
.report-stats { display: flex; gap: 0; flex-wrap: wrap; margin-top: 16px; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.report-stats .rs { flex: 1; min-width: 110px; text-align: center; padding: 12px 8px; background: var(--surface); border-right: 1px solid var(--line); }
.report-stats .rs:last-child { border-right: none; }
.report-stats .v { display: block; font-size: 22px; font-weight: 800; font-family: var(--serif); }
.report-stats .l { display: block; font-size: 11px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .6px; margin-top: 2px; }
.report-toc { display: flex; flex-wrap: wrap; gap: 6px; }
.report-toc .pill { text-decoration: none; cursor: pointer; transition: .12s; }
.report-toc .pill:hover { border-color: var(--primary); color: var(--primary); }
.sev-head { font-weight: 700; font-size: 14px; margin: 18px 0 10px; padding-left: 10px; border-left: 3px solid var(--sv); }
.sev-head:first-of-type { margin-top: 4px; }
.rpt-section { scroll-margin-top: 20px; }

/* print: clean, paginated document */
@media print {
  body { background: #fff !important; color: #111 !important; }
  body::before, .sidebar, .mobile-top, .topbar-actions, .drawer, .toast, .chip-row, .chat-input { display: none !important; }
  .main { padding: 0 !important; max-width: 100% !important; }
  .card, .finding, .exercise, .row-item, .module-row { background: #fff !important; border-color: #ddd !important; box-shadow: none !important; break-inside: avoid; }
  .rpt-section, .finding { break-inside: avoid; }
  .report-cover { border-top-color: #444; background-image: none !important; }
  h1, h2, h3, h4, .ri-title, .q-text { color: #111 !important; }
  .muted, .ri-sub, p { color: #444 !important; }
  .progressbar i { background: #888 !important; }
  a { color: #111 !important; text-decoration: none; }
}

/* cheat codes */
.cheat summary { cursor: pointer; list-style: none; }
.cheat summary::-webkit-details-marker { display: none; }
.cheat .cheat-power { float: right; color: var(--c-confidence); font-size: 11px; letter-spacing: 1px; }
.cheat-script { background: var(--c-insight-soft); border-left: 3px solid var(--c-insight); border-radius: 8px;
  padding: 8px 12px; margin-top: 10px; font-style: italic; font-size: 13.5px; }
.cheat[open] summary .ri-title { color: var(--primary); }

/* psychometric strip + deep interpretation */
.pstrip { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.pchip { font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-dim); }
.interp { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-soft); padding: 10px 14px; }
.interp summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--primary); }
.interp[open] summary { margin-bottom: 6px; }
.interp p { font-size: 13.5px; line-height: 1.55; }

/* report findings */
.finding { padding: 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-soft); margin-bottom: 14px; }
.finding-issues { margin: 6px 0 10px; padding-left: 18px; }
.finding-issues li { font-size: 13px; color: var(--text-dim); margin-bottom: 4px; line-height: 1.45; }
.expected { background: rgba(69,224,184,.12); border: 1px solid rgba(69,224,184,.3); color: var(--text);
  font-size: 13px; padding: 8px 12px; border-radius: 8px; margin: 8px 0 10px; }
.finding-recs { display: flex; flex-wrap: wrap; gap: 8px; }

/* a11y: skip link */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 600; background: var(--primary); color: #fff;
  padding: 10px 16px; border-radius: 0 0 10px 0; font-weight: 600; }
.skip-link:focus { left: 0; }

/* collapsible nav groups */
.nav-toggle { display: flex; justify-content: space-between; align-items: center; cursor: pointer; user-select: none; }
.nav-toggle:hover { color: var(--primary); }
.nav-caret { font-size: 11px; opacity: .7; }

/* efficacy thumbs */
.thumbs { display: inline-flex; gap: 4px; align-items: center; }
.thumb { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px;
  cursor: pointer; font-size: 13px; transition: .12s; color: var(--text); }
.thumb:hover { border-color: var(--primary); transform: translateY(-1px); }
.thumb small { margin-left: 3px; color: var(--text-mute); font-size: 10px; }

/* app lock screen */
.lock-screen { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center;
  background: var(--bg); padding: 20px; }
.lock-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 38px 32px; max-width: 380px; width: 100%; text-align: center; box-shadow: var(--shadow); }

/* ============================================================
   REPORT & ACTION PLAN — redesigned for scannability & polish
   (works in light + dark; honors prefers-reduced-motion globally)
   ============================================================ */
.report-doc { max-width: 760px; margin: 0 auto; }

/* Cover — softer hero with rounded corners and lift */
.report-cover { border-top: none !important; border-radius: 22px;
  background-image: linear-gradient(135deg, var(--primary-soft), rgba(69,224,184,.10) 58%, transparent);
  box-shadow: 0 12px 34px rgba(40,55,75,.07); }
.report-cover .report-stats { border-radius: 16px; box-shadow: inset 0 0 0 1px var(--line); border: none; background: var(--surface); }
.report-cover .report-stats .rs { padding: 15px 8px; }
.report-cover .report-stats .v { font-size: 27px; line-height: 1; }
.report-cover h4 { font-size: 13px; letter-spacing: .03em; }

/* Section divider label — clearer, with an accent bar */
.week-label { font-size: 12.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  color: var(--text-dim); margin: 30px 0 14px; display: flex; align-items: center; gap: 10px; }
.week-label::before { content: ""; width: 4px; height: 18px; border-radius: 3px;
  background: linear-gradient(var(--c-growth), var(--primary)); flex: none; }

/* TOC pills */
.report-toc .pill { padding: 6px 12px; border-radius: 999px; font-weight: 600; }

/* Mobile: keep the report inside the viewport (no horizontal scroll) */
.shell > div { min-width: 0; }            /* let the content column shrink in the grid */
.ring-wrap > * { min-width: 0; }          /* let the text column beside the ring shrink */
@media (max-width: 560px) {
  .report-stats { flex-wrap: wrap; }
  .report-stats .rs { flex: 1 1 50%; min-width: 0; }   /* 2 stats per row instead of a rigid 4-up */
  .report-stats .rs:nth-child(2) { border-right: none; }
  .report-doc { width: 100%; }
  .report-doc .grid.cols-2 { grid-template-columns: 1fr; }
  .ring-wrap { flex-wrap: wrap; }
  /* long action buttons wrap their label instead of overflowing */
  .plan-step-acts .btn, .finding-recs .btn, .advice-actions .btn { white-space: normal; max-width: 100%; height: auto; }
  .main { overflow-x: clip; }   /* backstop: clip any residual sub-pixel overflow */
}

/* Severity group header → a labelled chip with a colour dot */
.sev-head { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700;
  letter-spacing: .02em; padding: 7px 14px 7px 12px; border-left: none; border-radius: 999px;
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--sv); color: var(--text); margin: 20px 0 12px; }
.sev-head::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--sv); flex: none; }

/* Finding card — elevated, scannable, with a colour rail kept from inline style */
.finding { padding: 18px 20px 16px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: 0 4px 16px rgba(40,55,75,.05);
  margin-bottom: 14px; transition: transform .2s var(--ease, ease), box-shadow .2s; }
.finding:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(40,55,75,.11); }
.finding h4 { font-size: 16px; line-height: 1.35; }
.finding > p { font-size: 14.5px; line-height: 1.65; }
.finding .pill { font-weight: 600; }
.finding-issues { list-style: none; margin: 8px 0 10px; padding: 0; }
.finding-issues li { position: relative; padding-left: 24px; font-size: 13.5px; color: var(--text-dim);
  margin-bottom: 6px; line-height: 1.5; }
.finding-issues li::before { content: "•"; position: absolute; left: 7px; top: -1px; color: var(--danger); font-size: 18px; line-height: 1.4; }
.finding .ri-sub { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-mute); margin-bottom: 4px; }

/* "Target / expected result" callout — make it pop as the takeaway */
.expected { background: linear-gradient(135deg, rgba(69,224,184,.16), rgba(124,140,255,.08));
  border: none; border-left: 4px solid var(--c-growth); border-radius: 10px;
  padding: 12px 14px; font-size: 13.5px; line-height: 1.55; color: var(--text); }

/* Recommendation buttons row */
.finding-recs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---- Action plan as a vertical timeline ---- */
.plan-steps { display: flex; flex-direction: column; gap: 0; margin-bottom: 6px; }
.plan-step { display: flex; gap: 16px; align-items: flex-start; padding: 4px 0 20px; position: relative; }
.plan-step:last-child { padding-bottom: 4px; }
/* connector line linking the numbered nodes */
.plan-step:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 38px; bottom: 0;
  width: 2px; background: linear-gradient(var(--c-growth), var(--line)); }
.plan-step-n { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 15px; color: #fff; background: linear-gradient(140deg, var(--c-growth), var(--primary));
  box-shadow: 0 4px 12px rgba(69,224,184,.3); position: relative; z-index: 1; }
.plan-step-body { flex: 1; min-width: 0; padding-top: 4px; }
.plan-step-title { font-weight: 700; font-size: 15px; margin-bottom: 2px; line-height: 1.4; }
.plan-step-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
[dir="rtl"] .plan-step { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .plan-step:not(:last-child)::before { left: auto; right: 17px; }
[dir="rtl"] .finding-issues li { padding-left: 0; padding-right: 24px; }
[dir="rtl"] .finding-issues li::before { left: auto; right: 7px; }
[dir="rtl"] .expected { border-left: none; border-right: 4px solid var(--c-growth); }

/* Daily Wisdom card */

/* ============================================================
   FORMAL ASSESSMENT REPORT — clinical-style document layout
   ============================================================ */
.doc-report { max-width: 840px; margin: 0 auto; }
.doc-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.doc-page {
  background: #fff; color: #1c2630; border: 1px solid var(--line);
  border-radius: 14px; padding: 40px 44px; box-shadow: 0 14px 40px rgba(40,55,75,.10);
}
[data-theme="dark"] .doc-page { background: #fdfcf9; }
.doc-head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; margin-bottom: 20px;
  border-bottom: 3px double #1c2630; }
.doc-head img { border-radius: 10px; }
.doc-brand { font-weight: 800; font-size: 14px; letter-spacing: .04em; color: #10b083; }
.doc-doctitle { font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: .02em; }
.doc-page h2 { font-family: var(--serif); font-size: 17px; margin: 26px 0 10px; padding-bottom: 5px;
  border-bottom: 1.5px solid #d8d4c8; color: #1c2630; }
.doc-page h3 { font-size: 14.5px; margin: 16px 0 8px; color: #1c2630; }
.doc-page p { font-size: 13.5px; line-height: 1.7; color: #333d49; margin: 0 0 10px; }
.doc-page .muted { color: #6b7684; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 8px 0 12px; }
.doc-table th, .doc-table td { border: 1px solid #ddd8cc; padding: 8px 10px; text-align: left; vertical-align: top; color: #333d49; }
.doc-table thead th { background: #f2efe6; font-weight: 700; color: #1c2630; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
.doc-table.slim th { background: #f7f5ee; width: 148px; font-weight: 600; color: #1c2630; }
.doc-finding { padding: 14px 16px; border: 1px solid #e4e0d4; border-left: 4px solid #10b083; border-radius: 10px; margin-bottom: 14px; background: #fcfbf7; }
.doc-finding h3 { margin: 0 0 10px; font-size: 15px; }
.doc-sev { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; vertical-align: 2px; }
.doc-sev.bad { background: #fde8ec; color: #c2334d; } .doc-sev.warn { background: #fdf1df; color: #b06c14; }
.doc-sev.info { background: #e8ecfd; color: #3b52c4; } .doc-sev.good { background: #e2f7ee; color: #157a56; }
.doc-evidence { margin: 0 0 10px; padding-left: 22px; }
.doc-evidence li { font-size: 12.5px; color: #4a5461; font-style: italic; margin-bottom: 4px; line-height: 1.5; }
.doc-notmeans { background: #f4f2ea; border-radius: 8px; padding: 8px 12px; font-size: 12.5px !important; }
.doc-phase { background: linear-gradient(90deg, rgba(16,176,131,.10), transparent); padding: 6px 10px; border-radius: 8px; }
.doc-sign { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-top: 30px; padding-top: 16px; border-top: 1px solid #ddd8cc; font-size: 12px; color: #333d49; }
.doc-sig-line { width: 220px; border-bottom: 1px solid #333d49; margin-bottom: 6px; }
[dir="rtl"] .doc-page { text-align: right; }
[dir="rtl"] .doc-table th, [dir="rtl"] .doc-table td { text-align: right; }
@media (max-width: 640px) { .doc-page { padding: 22px 16px; } .doc-table { display: block; overflow-x: auto; } }
@media print {
  .doc-actions, .sidebar, .topbar, .mobile-top, .crisis-fab, .sos-fab { display: none !important; }
  .doc-page { border: none; box-shadow: none; border-radius: 0; padding: 0; }
  .doc-report { max-width: none; }
  .doc-finding, .doc-table, .doc-page h2 { break-inside: avoid; }
}

/* In-app task reminder banner */
.task-alert {
  position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 90;
  width: min(560px, calc(100vw - 24px)); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c-growth);
  border-radius: 14px; padding: 12px 14px; box-shadow: 0 16px 44px rgba(40,55,75,.22);
  animation: taSlide .35s cubic-bezier(.22,1,.36,1) both;
}
@keyframes taSlide { from { opacity: 0; transform: translate(-50%, -14px); } to { opacity: 1; transform: translate(-50%, 0); } }
.task-alert .ta-body { display: flex; align-items: center; gap: 11px; min-width: 0; }
.task-alert .ta-ico { font-size: 24px; }
.task-alert .ta-title { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--c-growth); }
.task-alert .ta-task { font-weight: 600; font-size: 14.5px; }
.task-alert .ta-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.task-alert .ta-x { border: none; background: none; cursor: pointer; color: var(--text-mute); font-size: 15px; padding: 4px 6px; border-radius: 8px; }
.task-alert .ta-x:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 560px) { .task-alert { top: 8px; } }
@media print { .task-alert { display: none !important; } }

/* Life Goals */
.lg-stats { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.lg-stat { display: flex; flex-direction: column; align-items: center; min-width: 50px; }
.lg-stat .v { font-family: var(--serif); font-size: 20px; font-weight: 800; line-height: 1; }
.lg-stat .v.good { color: var(--good); } .lg-stat .v.info { color: var(--primary); }
.lg-stat .v.warn { color: var(--warn); } .lg-stat .v.bad { color: var(--danger); }
.lg-stat .l { font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: .04em; margin-top: 3px; }
.lg-card { border: 1px solid var(--line); border-left: 4px solid var(--lgc, var(--primary)); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 12px; background: var(--surface); box-shadow: 0 4px 14px rgba(40,55,75,.05); }
.lg-card.lg-done { opacity: .74; }
.lg-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.lg-head { display: flex; gap: 11px; align-items: flex-start; min-width: 0; }
.lg-emoji { font-size: 24px; flex: none; }
.lg-title { font-weight: 700; font-size: 15px; }
.lg-sub { font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }
.lg-why { font-style: italic; color: var(--text-dim); font-size: 13px; margin: 8px 0 0; }
.lg-prog { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; }
.lg-pct { font-size: 12px; font-weight: 700; min-width: 34px; text-align: right; }
.lg-actions:not(:empty) { margin-top: 10px; }
.lg-manage { margin-top: 10px; }
.lg-manage summary { cursor: pointer; font-size: 12.5px; color: var(--primary); font-weight: 600; }
.lg-sbtns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lg-sbtns .btn { font-size: 11.5px; }
.lg-history { margin-top: 6px; }
.lg-h-row { font-size: 12px; color: var(--text-dim); padding: 4px 0; border-top: 1px dashed var(--line); }
.lg-card.lg-primary { box-shadow: 0 8px 24px rgba(69,224,184,.18); border-color: var(--c-growth); }
.lg-chips { margin-top: 10px; font-size: 12px; }
.lg-chips-l { color: var(--text-mute); margin-right: 4px; }
.lg-chip { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); font-size: 11.5px; font-weight: 500;
  padding: 4px 10px; border-radius: 999px; cursor: pointer; margin: 3px 3px 0 0; transition: .15s; }
.lg-chip:hover { border-color: var(--primary); color: var(--primary); }
.lg-chip.done { color: var(--good); border-color: rgba(86,211,100,.4); background: transparent; }
.lg-traits { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lg-trait { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.lg-trait.weak { color: var(--danger); background: rgba(255,107,129,.12); }
.lg-trait.strong { color: var(--good); background: rgba(86,211,100,.12); }
.lg-trait.untested { color: var(--text-mute); background: var(--surface-2); }
.lg-trait a { text-decoration: none; }
.lg-today { margin-top: 10px; padding: 9px 12px; background: var(--primary-soft); border-radius: 10px; font-size: 12.5px; line-height: 1.5; }
.lg-today-l { font-weight: 700; }
.lg-outcome { margin-top: 8px; padding: 10px 12px; background: var(--bg-soft); border-radius: 10px; font-size: 12.5px; line-height: 1.55; color: var(--text-dim); }
[dir="rtl"] .lg-card { border-left: none; border-right: 4px solid var(--lgc, var(--primary)); }
[dir="rtl"] .lg-top, [dir="rtl"] .lg-head { flex-direction: row-reverse; text-align: right; }

/* Mobile bottom tab bar — 5 core tabs, shown on small screens only */
.tabbar { display: none; }
@media (max-width: 860px) {
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
    background: var(--surface); border-top: 1px solid var(--line);
    box-shadow: 0 -6px 20px rgba(0,0,0,.08);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .tabbar .tab {
    flex: 1; border: none; background: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 6px 2px; border-radius: 10px; color: var(--text-mute);
    font-size: 10.5px; font-weight: 600;
  }
  .tabbar .tab .t-ico { font-size: 20px; line-height: 1.1; }
  .tabbar .tab.active { color: var(--primary); background: var(--primary-soft); }
  .main { padding-bottom: 84px; }
  .crisis-fab { bottom: 74px; }
  .sos-fab { bottom: 132px; }
}
@media print { .tabbar { display: none !important; } }

/* Quick teaser result gauge (R14) */
.quick-gauge { width: 150px; height: 150px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; align-content: center; gap: 2px;
  background: radial-gradient(closest-side, var(--surface) 76%, transparent 77% 100%), conic-gradient(var(--qc) 0 75%, var(--surface-2) 0); border: 1px solid var(--line); }
.quick-num { font-family: var(--serif); font-size: 38px; font-weight: 800; line-height: 1; color: var(--qc); }
.quick-band { font-size: 13px; font-weight: 600; padding: 0 14px; }

/* My Journey — guided, progressively unlocked steps */
.jstep { display: flex; gap: 16px; align-items: flex-start; padding: 4px 0 20px; position: relative; }
.jstep:last-child { padding-bottom: 4px; }
.jstep:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 40px; bottom: 0; width: 2px; background: var(--line); }
.jstep.done:not(:last-child)::before { background: var(--c-growth); }
.jstep-n { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; position: relative; z-index: 1; background: var(--surface-2); color: var(--text-mute); border: 2px solid var(--line); }
.jstep.done .jstep-n { background: var(--c-growth); color: #04241a; border-color: var(--c-growth); }
.jstep.current .jstep-n { background: linear-gradient(140deg, var(--c-growth), var(--primary)); color: #fff; border-color: transparent; box-shadow: 0 4px 14px rgba(69,224,184,.4); animation: jpulse 2.2s infinite; }
@keyframes jpulse { 0%,100% { box-shadow: 0 4px 14px rgba(69,224,184,.4); } 50% { box-shadow: 0 4px 22px rgba(69,224,184,.7); } }
.jstep-body { flex: 1; min-width: 0; padding-top: 4px; }
.jstep-title { font-weight: 700; font-size: 15px; line-height: 1.4; }
.jstep-why { font-size: 13px; color: var(--text-dim); margin-top: 2px; }
.jstep.locked { opacity: .55; }
.jstep.locked .jstep-title, .jstep.locked .jstep-why { filter: grayscale(.4); }
[dir="rtl"] .jstep { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .jstep:not(:last-child)::before { left: auto; right: 17px; }
@media (prefers-reduced-motion: reduce) { .jstep.current .jstep-n { animation: none; } }

/* 60-second SOS reset fab (sits above the crisis fab) */
.sos-fab {
  position: fixed; right: 18px; bottom: 78px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 16px; border: none; border-radius: 999px; cursor: pointer;
  font-weight: 700; font-size: 14px; color: #04241a;
  background: linear-gradient(120deg, var(--c-growth, #45e0b8), #7fe6c4);
  box-shadow: 0 8px 22px rgba(69,224,184,.42);
  transition: transform .15s, box-shadow .15s;
}
.sos-fab:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(69,224,184,.55); }
.sos-fab:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (max-width: 560px) { .sos-fab span { display: none; } .sos-fab { padding: 12px; font-size: 18px; bottom: 74px; } }
@media print { .sos-fab { display: none; } }

/* My Scores dashboard rows */
.score-row { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.score-row:last-child { border-bottom: none; }
.score-id { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; }
.score-id .sc-emoji { font-size: 22px; flex: none; }
.score-id .sc-title { font-weight: 600; font-size: 14px; }
.score-id .sc-sub { font-size: 11.5px; color: var(--text-mute); margin-top: 1px; }
.score-val { font-family: var(--serif); font-weight: 700; font-size: 15px; min-width: 64px; text-align: right; }
.score-change { min-width: 96px; text-align: center; }
@media (max-width: 560px) { .score-change { min-width: 0; } .score-row { flex-wrap: wrap; } }
[dir="rtl"] .score-row { flex-direction: row-reverse; text-align: right; }

/* Premium tier cards */
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 880px; margin: 18px auto 0; align-items: start; }
@media (max-width: 720px) { .price-grid { grid-template-columns: 1fr; } }
.price-tier { position: relative; }
.price-tier.feat { border: 2px solid var(--c-growth); box-shadow: 0 14px 36px rgba(69,224,184,.14); }
.price-tier.pro { border: 1px solid var(--c-insight); }
.price-tier .tier-amt { font-family: var(--serif); font-size: 30px; font-weight: 700; margin: 0 0 12px; }
.price-tier .tier-amt small { font-size: 14px; font-weight: 500; color: var(--text-mute); }
.price-tier .tier-badge { position: absolute; top: -11px; left: 18px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 4px 11px; border-radius: 999px; background: linear-gradient(100deg, var(--c-growth), #7fe6c4); color: #062018; }
.price-tier .tier-badge.pro { background: linear-gradient(100deg, var(--c-insight), #c4b5fd); color: #1a0a2e; }
.price-tier .btn.block { width: 100%; justify-content: center; margin-top: 12px; }

/* Daily Wisdom card */
.wisdom-card {
  position: relative; border-radius: 22px; padding: 34px 30px 26px;
  background: linear-gradient(140deg, #10b083, #4361ee);
  color: #fff; box-shadow: 0 20px 50px rgba(40,55,75,.22); overflow: hidden;
  margin-bottom: 18px;
}
.wisdom-card.fact-card { background: linear-gradient(140deg, #7c3aed, #db2777); }
.wisdom-card .wc-mark { position: absolute; top: 2px; left: 18px; font-family: Georgia, serif; font-size: 120px; line-height: 1; color: rgba(255,255,255,.22); pointer-events: none; }
.wisdom-card.fact-card .wc-mark { font-family: inherit; font-size: 64px; top: 22px; left: 24px; }
.wisdom-card.fact-card .wc-text { font-family: Inter, system-ui, sans-serif; font-size: 21px; }
.wc-cat { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255,255,255,.92); background: rgba(255,255,255,.16); padding: 5px 12px; border-radius: 999px; margin-bottom: 14px; position: relative; }
.wc-text { font-family: Fraunces, Georgia, serif; font-size: 23px; line-height: 1.45; font-weight: 600; margin: 0 0 16px; position: relative; }
.wc-author { font-size: 14px; color: rgba(255,255,255,.9); font-style: italic; }
.wc-brand { display: flex; align-items: center; gap: 8px; margin-top: 20px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.22); font-weight: 700; font-size: 14px; }
.wc-brand img { border-radius: 7px; background: #fff; padding: 2px; }
.advice-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 14px; }
.advice-actions .btn { flex: 1; min-width: 130px; justify-content: center; }
.wc-socials { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.wc-soc { border: none; cursor: pointer; color: #fff; font-size: 12.5px; font-weight: 600; padding: 9px 14px; border-radius: 999px; transition: transform .15s, filter .15s; }
.wc-soc:hover { transform: translateY(-2px); filter: brightness(1.08); }
.advice-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* RTL support (Urdu) */
[dir="rtl"] body, [dir="rtl"] input, [dir="rtl"] textarea, [dir="rtl"] select, [dir="rtl"] button {
  font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, Inter, system-ui, sans-serif;
}
[dir="rtl"] .serif, [dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4 {
  font-family: "Noto Naskh Arabic", "Segoe UI", Tahoma, Fraunces, Georgia, serif;
  line-height: 1.5;
}
[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--line); }
[dir="rtl"] .nav-item .ico { margin-right: 0; margin-left: 10px; }
[dir="rtl"] .ri-body, [dir="rtl"] .card, [dir="rtl"] .finding,
[dir="rtl"] .q-text, [dir="rtl"] .flow-card, [dir="rtl"] .view { text-align: right; }
[dir="rtl"] .path-step, [dir="rtl"] .row-item, [dir="rtl"] .module-row { flex-direction: row-reverse; }
[dir="rtl"] .sec-head { padding-left: 0; padding-right: 2px; }
[dir="rtl"] .likert .opt { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .q-meta, [dir="rtl"] .q-nav, [dir="rtl"] .card-title, [dir="rtl"] .topbar { flex-direction: row-reverse; }
[dir="rtl"] .progressbar i { float: right; }
[dir="rtl"] .ex-steps, [dir="rtl"] .finding-issues { padding-right: 18px; padding-left: 0; }

/* mobile fit */
@media (max-width: 560px) {
  .topbar-actions .pill { display: none; }            /* level chip hides on tiny screens */
  .mem-grid { grid-template-columns: repeat(4, 46px); }
  .mem-tile { width: 46px; height: 46px; }
  .mood-row .mood { min-width: 56px; }
  .tour-card { padding: 24px 18px; }
  .likert .opt { padding: 10px 12px; }
}

/* guided tour */
.tour-backdrop { position: fixed; inset: 0; z-index: 200; background: rgba(6,8,16,.7); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px; }
.tour-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 32px 28px; max-width: 420px; width: 100%; text-align: center; box-shadow: var(--shadow); }
.tour-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-3); display: inline-block; transition: .2s; }
.tour-dot.on { background: var(--primary); transform: scale(1.3); }

/* memory grid game */
.mem-grid { display: grid; grid-template-columns: repeat(4, 56px); gap: 8px; justify-content: center; }
.mem-tile { width: 56px; height: 56px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line);
  cursor: pointer; transition: .12s; }
.mem-tile.lit { background: var(--c-insight); border-color: var(--c-insight); box-shadow: 0 0 14px var(--c-insight-soft); }
.mem-tile.picked { background: var(--primary); border-color: var(--primary); }
.mem-tile:hover { border-color: var(--primary); }

/* psychology-colored assessment sections */
.sec-head { display: flex; align-items: flex-start; gap: 12px; margin: 26px 0 12px; padding-left: 2px; }
.sec-head .sec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--sc); margin-top: 5px; flex: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--sc) 20%, transparent); }
.sec-title { font-size: 16px; font-weight: 700; color: var(--text); }
.sec-grid .card { border-top: 3px solid color-mix(in srgb, var(--sc) 65%, var(--line)); transition: .15s; }
.sec-grid .card:hover { border-top-color: var(--sc); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

/* scenario path steps */
.scenario:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.path-step { display: flex; gap: 14px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.path-step:last-child { border-bottom: none; }
.ps-num { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); color: var(--text-mute);
  display: grid; place-content: center; font-weight: 700; font-size: 14px; flex: none; }
.path-step.active .ps-num { background: var(--primary-soft); color: var(--primary); }
.path-step.done .ps-num { background: var(--accent); color: #06281f; }

/* today ritual */
.ritual-step { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--surface); margin-bottom: 12px; transition: .15s; }
.ritual-step.done { background: var(--bg-soft); border-color: rgba(69,224,184,.35); }
.rs-ico { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
  display: grid; place-content: center; font-weight: 700; font-size: 14px; flex: none; }
.ritual-step.done .rs-ico { background: var(--accent); color: #06281f; }

/* advisor role bar + cards */
.role-active { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line);
  border-left-width: 3px; border-radius: var(--r-md); background: var(--bg-soft); margin-bottom: 14px; }
.role-active-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-content: center; font-size: 20px; flex: none; }
.advisor { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px; background: var(--bg-soft); cursor: pointer; transition: .14s; }
.advisor:hover { border-color: var(--ac); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.advisor.sel { border-color: var(--ac); box-shadow: 0 0 0 1px var(--ac); background: var(--surface); }
.badge-role { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; white-space: nowrap; flex: none; }

/* problem solver wizard */
.steps-head { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.steps-head .s { font-size: 12.5px; color: var(--text-mute); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); }
.steps-head .s.on { color: #fff; background: var(--primary-soft); border-color: var(--primary); }
.steps-head .s.done { color: var(--accent); border-color: rgba(69,224,184,.4); }

/* mood selector */
.mood-row { display: flex; gap: 10px; justify-content: space-between; }
.mood {
  flex: 1; text-align: center; padding: 12px 6px; border: 1px solid var(--line);
  border-radius: var(--r-md); background: var(--bg); cursor: pointer; transition: .14s;
}
.mood:hover { transform: translateY(-3px); border-color: var(--primary); }
.mood.sel { border-color: var(--primary); background: var(--primary-soft); }
.mood .face { font-size: 30px; }
.mood .lab { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; }

/* toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(40px);
  background: var(--surface-3); border: 1px solid var(--line); color: var(--text); padding: 12px 20px;
  border-radius: var(--r-md); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .25s; z-index: 99; font-size: 14px; font-weight: 500; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* fade-in */
.view { animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* svg chart */
.spark, .linechart { width: 100%; display: block; }

/* badges grid */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.badge { text-align: center; padding: 16px 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-soft); }
.badge.locked { opacity: .35; filter: grayscale(1); }
.badge .b-ico { font-size: 30px; }
.badge .b-name { font-size: 12px; margin-top: 6px; color: var(--text-dim); }

/* ===========================================================
   Responsive
   =========================================================== */
@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .mobile-top { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px;
    border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg-soft); z-index: 30; }
  .mobile-top .brand { padding: 0; }
  .drawer { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.5); display: none; }
  .drawer.open { display: block; }
  .drawer .panel { width: 250px; height: 100%; background: var(--bg-soft); border-right: 1px solid var(--line); padding: 18px 14px; overflow-y: auto; }
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .quick-strip.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 18px; }
}
@media (max-width: 1080px) and (min-width: 921px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-3 { grid-template-columns: repeat(2, 1fr); }
  .cols-3 > :last-child { grid-column: span 2; }
}
.card.compact { padding: 12px 14px; }
.card.compact .ri-sub { min-height: 16px; }

/* ---- dashboard hierarchy & shared patterns ---- */
/* Secondary/at-a-glance cards read lighter so the accent action cards lead the eye. */
.card.flat { box-shadow: none; background: var(--surface); border-color: var(--line); }
.card.flat:hover { border-color: var(--line); }
/* Repeated "label left / action right" header row. */
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
/* The green "recommended next" accent banner, previously duplicated inline. */
.recommend-banner { margin-bottom: 18px; border-left: 4px solid var(--c-growth);
  background-image: linear-gradient(135deg, rgba(69,224,184,.14), rgba(124,140,255,.06)); }
.eyebrow-growth { text-transform: uppercase; letter-spacing: 1.5px; font-size: 11px; color: var(--c-growth); font-weight: 700; }
/* Compact progress ring for inline "at a glance" use (dashboard cards). */
.ring.sm { width: 72px; height: 72px; }
.ring.sm::before { inset: 8px; }
.ring.sm .num { font-size: 16px; }
.hamburger { background: none; border: 1px solid var(--line); color: var(--text); width: 40px; height: 40px; border-radius: 10px; font-size: 18px; cursor: pointer; }

/* Persistent crisis access — always one tap, on every screen, incl. mobile */
.crisis-fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 1200;
  display: inline-flex; align-items: center; gap: 7px;
  background: #e8556d; color: #fff; border: none;
  padding: 12px 16px; border-radius: 999px; font-size: 15px; font-weight: 700;
  cursor: pointer; box-shadow: 0 8px 24px rgba(232,85,109,.45);
  transition: transform .12s ease, box-shadow .12s ease;
}
.crisis-fab:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(232,85,109,.55); }
.crisis-fab:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@media (max-width: 560px) { .crisis-fab span { display: none; } .crisis-fab { padding: 13px; font-size: 19px; } }
@media print { .crisis-fab { display: none; } }

/* ===========================================================
   PSYCHE LAB — styles
   =========================================================== */
--plab-ink: #1a0a2e; /* dark ink color for blots */

.plab-hero { text-align: center; padding: 28px 20px 20px; }
.plab-test-card { transition: transform .15s; }
.plab-test-card:hover { transform: translateY(-2px); }

/* Progress bar */
.plab-progress-bar { height: 5px; background: var(--surface-2); border-radius: 10px; margin-bottom: 10px; }
.plab-progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--c-insight)); border-radius: 10px; transition: width .4s ease; }

/* Color swatch grid */
.plab-color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 4px; }
@media (max-width: 480px) { .plab-color-grid { grid-template-columns: repeat(4, 1fr); } }
.plab-color-swatch {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  cursor: pointer; padding: 8px 4px; border-radius: 12px; position: relative;
  border: 2px solid transparent; transition: all .15s; user-select: none;
}
.plab-color-swatch:hover { background: var(--surface-2); border-color: var(--line); }
.plab-color-swatch.picked { opacity: .55; pointer-events: none; }
.plab-color-swatch.first-pick { opacity: 1; }
.swatch-circle { width: 52px; height: 52px; border-radius: 50%; box-shadow: 0 2px 8px rgba(0,0,0,.25); transition: transform .15s; }
.plab-color-swatch:not(.picked):hover .swatch-circle { transform: scale(1.08); }
.swatch-name { font-size: 11px; color: var(--text-dim); font-weight: 500; }
.swatch-rank {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
  background: var(--surface-3); color: var(--text); font-size: 11px; font-weight: 700;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.plab-mini-swatch { display: inline-block; width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; }

/* Inkblot */
.plab-blot-container {
  display: flex; justify-content: center; align-items: center;
  margin: 0 auto 4px; max-width: 300px;
  color: var(--text); /* blot uses currentColor — inherits this */
}
[data-theme="light"] .plab-blot-container { color: #1a0a2e; }
.plab-blot-container svg { width: 100%; height: auto; filter: drop-shadow(0 4px 16px rgba(0,0,0,.3)); }

/* Options grid — shared for inkblot, word, tat */
.plab-opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
@media (max-width: 480px) { .plab-opt-grid { grid-template-columns: 1fr; } }
.plab-opt-btn {
  text-align: left; padding: 12px 14px; border-radius: 10px; font-size: 14px;
  line-height: 1.4; white-space: normal; height: auto;
  border: 2px solid var(--line); background: var(--surface);
  transition: all .15s; cursor: pointer;
}
.plab-opt-btn:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }

/* Word Vortex */
.plab-word-display { margin: 10px auto 0; }
.plab-word-text {
  font-size: clamp(40px, 8vw, 72px); font-weight: 800; letter-spacing: -2px;
  color: var(--primary); text-align: center; margin-bottom: 12px; line-height: 1;
  animation: plabWordPop .35s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes plabWordPop { from { opacity:0; transform: scale(.7); } to { opacity:1; transform: scale(1); } }
.plab-word-timer { height: 3px; background: var(--surface-2); border-radius: 10px; overflow: hidden; }
.plab-word-timer-fill {
  height: 100%; width: 100%; background: linear-gradient(90deg, var(--c-insight), var(--primary));
  border-radius: 10px; animation: plabTimerDrain 8s linear forwards;
}
@keyframes plabTimerDrain { from { width: 100%; } to { width: 0%; } }
.plab-word-opts { margin-top: 0; }

/* TAT scene */
.plab-scene-card { background: var(--surface-2); border-radius: 12px; padding: 16px; margin-bottom: 4px; border-left: 3px solid var(--c-insight); }
.plab-scene-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--c-insight); margin-bottom: 6px; }
.plab-scene-text { margin: 0; font-size: 15px; line-height: 1.65; font-style: italic; color: var(--text-dim); }
.plab-tat-opts { display: flex; flex-direction: column; gap: 10px; }
.plab-tat-opt {
  padding: 14px 16px; cursor: pointer; border: 2px solid var(--line);
  border-radius: 12px; transition: all .15s; font-size: 14px; line-height: 1.5;
}
.plab-tat-opt:hover { border-color: var(--primary); background: var(--primary-soft); }

/* Canvas */
.plab-canvas-wrap {
  border: 2px solid var(--line); border-radius: 12px; overflow: hidden;
  margin-bottom: 12px; background: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
.plab-canvas-wrap canvas { display: block; width: 100%; height: auto; }
.plab-canvas-controls { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Hidden Figures (bistable) — reuse blot container, give a touch more room */
.plab-figure-container { max-width: 260px; }
.plab-figure-container svg { filter: drop-shadow(0 4px 14px rgba(0,0,0,.18)); }

/* The Tap Test (Go/No-Go) */
.plab-tap-stage {
  display: flex; align-items: center; justify-content: center;
  min-height: 220px; margin: 6px 0 4px;
}
.plab-tap-circle {
  width: 168px; height: 168px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 22px; color: #fff; user-select: none;
  background: var(--surface-3); border: 3px solid var(--line);
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  transition: background .08s, transform .08s, border-color .08s;
  cursor: pointer;
}
.plab-tap-circle span { color: inherit; pointer-events: none; }
.plab-tap-circle.wait { background: #2b3145; border-color: #3a4256; color: #9aa3b8; }
.plab-tap-circle.go   { background: #2d9e6b; border-color: #45e0b8; transform: scale(1.06); }
.plab-tap-circle.nogo { background: #e63946; border-color: #ff6b81; transform: scale(1.06); }
.plab-tap-circle.done { background: #4361ee; border-color: #7c8cff; }
.plab-tap-meta { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 22px; }
.plab-tap-feedback { font-weight: 700; font-size: 14px; min-width: 70px; text-align: left; }
.plab-tap-stats {
  display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 12px;
  padding: 10px 12px; background: var(--surface-2); border-radius: 10px;
}
.plab-tap-stats > div { display: flex; flex-direction: column; }
.plab-tap-stats b { font-size: 17px; color: var(--text); }
.plab-tap-stats span { font-size: 11px; color: var(--text-mute); }

/* Science callout */
.plab-science { margin-top: 14px; }
.plab-science summary { font-size: 12px; color: var(--text-mute); cursor: pointer; user-select: none; }
.plab-science p { font-size: 12px; color: var(--text-mute); line-height: 1.6; margin: 8px 0 0; }

/* Results */
.plab-result-hero { text-align: center; padding: 24px 16px 20px; }
.plab-result-card { padding: 18px 20px; }
.plab-rc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.plab-rc-title { font-weight: 700; font-size: 16px; }
.plab-rc-sub { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.plab-finding { margin-bottom: 10px; }
.plab-finding:last-child { margin-bottom: 0; }
.plab-finding-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-mute); margin-bottom: 4px; }
.plab-finding p { margin: 0; font-size: 14px; line-height: 1.65; color: var(--text-dim); }
.plab-cite { font-size: 11px; color: var(--text-mute); margin-top: 10px; font-style: italic; }
.plab-verdict-card { border: 2px solid var(--c-insight); background: linear-gradient(135deg, rgba(192,132,252,.07), rgba(124,140,255,.05)); }
.plab-verdict-body p { margin: 0 0 12px; font-size: 14px; line-height: 1.7; color: var(--text-dim); }
.plab-verdict-body p:last-child { margin-bottom: 0; }
.plab-verdict-body strong { color: var(--text); }
.plab-verdict-body em { color: var(--c-insight); font-style: italic; }

/* Simple/Full navigation mode toggle */
.nav-mode-toggle {
  margin: 6px 10px 10px; padding: 7px 10px; border-radius: 8px;
  font-size: 11.5px; font-weight: 600; text-align: center; cursor: pointer;
  color: var(--muted); background: rgba(127,127,127,.08); border: 1px dashed var(--line);
  user-select: none;
}
.nav-mode-toggle:hover { color: var(--text); background: rgba(127,127,127,.14); }
.nav-mode-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav-lang { display: flex; align-items: center; gap: 7px; margin: 0 10px 12px; padding: 5px 9px;
  border-radius: 8px; background: rgba(127,127,127,.08); border: 1px solid var(--line); }
.nav-lang-ico { font-size: 14px; }
.nav-lang-sel { flex: 1; min-width: 0; background: transparent; border: none; color: var(--text);
  font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 2px; }
.nav-lang-sel:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ===========================================================
   MOTION LAYER — route-entrance animations & micro-interactions.
   The app fully re-renders on every state change, so entrance
   animations are gated behind `.anim-in`, a class that afterRender()
   adds to .main ONLY when the route just changed (never on same-route
   re-renders, so nothing replays when you tick a task or type).
   The global prefers-reduced-motion rule at the top of this file
   neutralizes all of it for reduced-motion users.
   =========================================================== */
@keyframes aIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes aBar { from { transform: scaleX(0); } }

/* staggered entrance: direct sections of the view… */
.anim-in .view > *:not(.grid) { animation: aIn .42s cubic-bezier(.22,1,.36,1) both; }
.anim-in .view > *:nth-child(2):not(.grid) { animation-delay: .05s; }
.anim-in .view > *:nth-child(3):not(.grid) { animation-delay: .10s; }
.anim-in .view > *:nth-child(4):not(.grid) { animation-delay: .15s; }
.anim-in .view > *:nth-child(5):not(.grid) { animation-delay: .20s; }
.anim-in .view > *:nth-child(6):not(.grid) { animation-delay: .25s; }
.anim-in .view > *:nth-child(n+7):not(.grid) { animation-delay: .30s; }
/* …and cards inside grids cascade individually */
.anim-in .grid > .card { animation: aIn .45s cubic-bezier(.22,1,.36,1) both; }
.anim-in .grid > .card:nth-child(2) { animation-delay: .06s; }
.anim-in .grid > .card:nth-child(3) { animation-delay: .12s; }
.anim-in .grid > .card:nth-child(4) { animation-delay: .18s; }
.anim-in .grid > .card:nth-child(5) { animation-delay: .24s; }
.anim-in .grid > .card:nth-child(6) { animation-delay: .30s; }
.anim-in .grid > .card:nth-child(n+7) { animation-delay: .36s; }
/* step lists (journey steps, plan steps, row items) walk in one by one */
.anim-in .jstep, .anim-in .row-item { animation: aIn .4s cubic-bezier(.22,1,.36,1) both; }
.anim-in .jstep:nth-child(2), .anim-in .row-item:nth-child(2) { animation-delay: .06s; }
.anim-in .jstep:nth-child(3), .anim-in .row-item:nth-child(3) { animation-delay: .12s; }
.anim-in .jstep:nth-child(4), .anim-in .row-item:nth-child(4) { animation-delay: .18s; }
.anim-in .jstep:nth-child(5), .anim-in .row-item:nth-child(5) { animation-delay: .24s; }
.anim-in .jstep:nth-child(6), .anim-in .row-item:nth-child(6) { animation-delay: .30s; }
.anim-in .jstep:nth-child(n+7), .anim-in .row-item:nth-child(n+7) { animation-delay: .36s; }
/* progress bars sweep to their value on entry */
.anim-in .progressbar > i { transform-origin: left center; animation: aBar .7s cubic-bezier(.22,1,.36,1) .25s both; }
[dir="rtl"] .anim-in .progressbar > i { transform-origin: right center; }

/* progress rings sweep from 0 → value (JS flips --p on route entry) */
@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }
.ring { transition: --p .9s cubic-bezier(.22,1,.36,1); }

/* micro-interactions: clickable cards lift, everything presses down */
.card[data-act] { transition: transform .18s cubic-bezier(.22,1,.36,1), box-shadow .18s, border-color .18s; }
.card[data-act]:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(0,0,0,.16); }
.card[data-act]:active { transform: translateY(-1px) scale(.985); }
.btn:active { transform: scale(.96); }
.check:active, .mood:active { transform: scale(.9); }

/* ===========================================================
   TABS + ANIMATED STEPS — used by Learn & Stories, Exercises,
   Behavior Lab, and the flat card libraries (NLP, Role-play).
   Tab switching is client-side (afterRender) so it's instant and
   re-triggers the reveal. All animation is neutralized for
   prefers-reduced-motion by the global rule at the top.
   =========================================================== */
.tabset { margin-bottom: 6px; }
.tab-btns { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 18px;
  border-bottom: 1px solid var(--line); }
.tab-btn { appearance: none; border: none; background: transparent; cursor: pointer; font-family: inherit;
  font-size: 13.5px; font-weight: 600; color: var(--text-dim); padding: 9px 15px; border-radius: 10px 10px 0 0;
  position: relative; transition: color .15s, background .15s; white-space: nowrap; }
.tab-btn:hover { color: var(--text); background: color-mix(in srgb, var(--primary) 7%, transparent); }
.tab-btn.active { color: var(--primary); }
.tab-btn.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.tab-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
@keyframes tabIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.tab-reveal { animation: tabIn .34s cubic-bezier(.22,1,.36,1) both; }

/* auto-fill card grid that also cascades on entry / tab switch */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.anim-in .card-grid > .card, .tab-reveal .card-grid > .card,
.anim-in .card-grid > .exercise, .tab-reveal .card-grid > .exercise { animation: aIn .45s cubic-bezier(.22,1,.36,1) both; }
.card-grid > .card:nth-child(2) { --d: .05s; } .card-grid > .card:nth-child(3) { --d: .10s; }
.card-grid > .card:nth-child(4) { --d: .15s; } .card-grid > .card:nth-child(5) { --d: .20s; }
.card-grid > .card:nth-child(6) { --d: .25s; } .card-grid > .card:nth-child(n+7) { --d: .30s; }
.anim-in .card-grid > .card, .tab-reveal .card-grid > .card { animation-delay: var(--d, 0s); }

/* ---- animated numbered steps: a vertical timeline (upgrades .ex-steps) ---- */
.ex-steps { list-style: none; counter-reset: step; margin: 12px 0 0; padding: 0;
  font-size: 13.5px; color: var(--text); position: relative; }
.ex-steps li { counter-increment: step; position: relative; padding: 0 0 15px 40px; line-height: 1.55; }
.ex-steps li:last-child { padding-bottom: 0; }
/* the connector line linking each badge to the next */
.ex-steps li::after { content: ""; position: absolute; left: 13px; top: 30px; bottom: 1px; width: 2px;
  background: color-mix(in srgb, var(--primary) 20%, transparent); }
.ex-steps li:last-child::after { display: none; }
/* the numbered badge */
.ex-steps li::before { content: counter(step); position: absolute; left: 0; top: 0; width: 28px; height: 28px;
  border-radius: 50%; display: grid; place-content: center; font-size: 12.5px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 3px 10px color-mix(in srgb, var(--primary) 35%, transparent); z-index: 1; }
[dir="rtl"] .ex-steps li { padding-left: 0; padding-right: 40px; }
[dir="rtl"] .ex-steps li::before { left: auto; right: 0; }
[dir="rtl"] .ex-steps li::after { left: auto; right: 13px; }
/* steps slide in one-by-one; badges pop, on route entry or tab switch */
@keyframes stepIn { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes badgePop { 0% { transform: scale(0); } 68% { transform: scale(1.18); } 100% { transform: scale(1); } }
.ex-steps li:nth-child(2) { --sd: .06s; } .ex-steps li:nth-child(3) { --sd: .12s; }
.ex-steps li:nth-child(4) { --sd: .18s; } .ex-steps li:nth-child(5) { --sd: .24s; }
.ex-steps li:nth-child(6) { --sd: .30s; } .ex-steps li:nth-child(n+7) { --sd: .36s; }
.anim-in .ex-steps li, .tab-reveal .ex-steps li { animation: stepIn .45s cubic-bezier(.22,1,.36,1) both; animation-delay: var(--sd, 0s); }
.anim-in .ex-steps li::before, .tab-reveal .ex-steps li::before { animation: badgePop .5s cubic-bezier(.34,1.56,.64,1) both; animation-delay: var(--sd, 0s); }

/* ---- shareable book insights: text + a compact share button per row ---- */
.ex-steps-share li { display: flex; align-items: flex-start; gap: 12px; }
.ex-steps-share .insight-txt { flex: 1; min-width: 0; }
.insight-share { flex: none; padding: 4px 10px; font-size: 13px; line-height: 1; align-self: center;
  opacity: .55; transition: opacity .15s, transform .15s, background .15s; }
.ex-steps-share li:hover .insight-share, .insight-share:focus-visible { opacity: 1; }
.insight-share:hover { transform: translateY(-1px); }

/* ===========================================================
   ✦ MODERN REFRESH LAYER (2026) ✦
   A cohesive visual upgrade applied on top of the base system:
   refined depth, a professional glass shell, crisper cards,
   buttons and chrome. Overrides visuals only — layout untouched.
   Neutralized for reduced-motion by the global rule at the top.
   =========================================================== */
:root {
  --r-md: 13px; --r-lg: 18px; --r-xl: 26px;
  /* layered, softer elevation — the SaaS-grade shadow */
  --shadow-sm: 0 1px 2px rgba(8,12,28,.20), 0 4px 14px rgba(8,12,28,.16);
  --shadow: 0 2px 4px rgba(8,12,28,.24), 0 18px 50px rgba(8,12,28,.42);
  --ease: cubic-bezier(.22,1,.36,1);
  --ring: color-mix(in srgb, var(--primary) 55%, transparent);
}
[data-theme="light"] {
  --shadow-sm: 0 1px 2px rgba(40,50,90,.06), 0 4px 16px rgba(40,50,90,.08);
  --shadow: 0 2px 6px rgba(40,50,90,.08), 0 20px 48px rgba(40,50,90,.14);
}

/* ---- Shell: refined sidebar with a rail-indicator active state ---- */
.sidebar { padding: 16px 12px; gap: 1px; backdrop-filter: saturate(1.05); }
.brand { padding: 8px 10px 16px; }
.brand .name { font-size: 20px; }
.nav-group-label { font-size: 10px; letter-spacing: .16em; padding: 16px 12px 5px; color: var(--text-mute); }
.nav-item { border-radius: 11px; padding: 9px 12px; font-size: 13.5px; font-weight: 550;
  transition: background .18s var(--ease), color .18s var(--ease), transform .12s var(--ease); }
.nav-item .ico { width: 26px; height: 26px; font-size: 15px; border-radius: 8px; transition: background .18s var(--ease), transform .18s var(--ease); }
.nav-item:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); color: var(--text); transform: none; }
.nav-item:hover .ico { transform: scale(1.08); }
.nav-item.active {
  background: color-mix(in srgb, var(--primary) 14%, transparent);
  color: var(--text); box-shadow: none;
}
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}
.nav-item.active .ico {
  background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 40%, transparent);
}
[dir="rtl"] .nav-item.active::before { left: auto; right: -12px; border-radius: 3px 0 0 3px; }

/* ---- Glassy sticky topbar ---- */
.main { padding-top: 22px; }
.topbar {
  position: sticky; top: 0; z-index: 20; margin: -22px calc(-1 * clamp(18px,4vw,48px)) 22px;
  padding: 16px clamp(18px,4vw,48px); background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.1); -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar h1 { font-size: clamp(21px, 2.6vw, 29px); letter-spacing: -.02em; }
.topbar .sub { font-size: 13px; margin-top: 3px; color: var(--text-mute); }
.avatar { width: 38px; height: 38px; box-shadow: var(--shadow-sm); font-size: 14px; }
.avatar:hover { transform: translateY(-1px); transition: transform .18s var(--ease); }

/* ---- Cards: crisper edges, hairline top highlight, gentle hover ---- */
.card {
  border-radius: var(--r-lg); padding: 20px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  box-shadow: var(--shadow-sm); position: relative;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
.card.pad-lg { padding: 26px; }
.card::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, #fff 12%, transparent), transparent);
  pointer-events: none;
}
[data-theme="light"] .card::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.9), transparent); }
.card-title { margin-bottom: 16px; }
.card-title h3 { font-size: 15.5px; letter-spacing: -.01em; }

/* section-accent cards (border-left) get a smoother look */
.card[style*="border-left"] { border-radius: var(--r-lg); }

/* ---- Stats: modern number blocks ---- */
.stat { gap: 5px; }
.stat .label { font-size: 11px; letter-spacing: .08em; }
.stat .value { font-size: 28px; letter-spacing: -.02em; }

/* ---- Pills: softer, professional ---- */
.pill { padding: 4px 10px; font-size: 12px; border-radius: 8px; font-weight: 600;
  background: color-mix(in srgb, var(--text) 6%, transparent); border-color: transparent; }
.pill.info { background: var(--c-focus-soft); color: var(--c-focus); }
.pill.good { background: var(--c-growth-soft); color: var(--c-growth); }
.pill.warn { background: var(--c-confidence-soft); color: var(--c-confidence); }
.pill.bad  { background: var(--c-alert-soft); color: var(--c-alert); }

/* ---- Buttons: crisper, tactile ---- */
.btn { border-radius: 11px; padding: 10px 17px; font-size: 14px; font-weight: 600; letter-spacing: -.01em;
  border: 1px solid color-mix(in srgb, var(--line) 90%, transparent);
  transition: background .16s var(--ease), transform .14s var(--ease), box-shadow .16s var(--ease), filter .16s; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--accent)));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 34%, transparent); }
.btn.primary:hover { box-shadow: 0 10px 26px color-mix(in srgb, var(--primary) 42%, transparent); }
.btn.accent { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 78%, var(--primary))); }
.btn.sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }

/* ---- Inputs: refined focus ring ---- */
.input, .textarea, select { border-radius: 11px; transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s; }
.input:focus, .textarea:focus, select:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }

/* ---- Section header accent (used across views via .card-title / week-label) ---- */
.week-label { color: var(--text); font-weight: 700; letter-spacing: .02em; }

/* ---- Page-entrance easing already exists; make card grids feel intentional ---- */
.view > .card, .view > .grid { margin-bottom: 0; }

/* ---- Scrollbars: slim & modern ---- */
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 18%, transparent) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text) 16%, transparent); border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text) 28%, transparent); background-clip: padding-box; }

/* ---- Bottom tabbar (mobile): frosted ---- */
.tabbar { backdrop-filter: blur(16px) saturate(1.1); -webkit-backdrop-filter: blur(16px) saturate(1.1); }

/* ---- Book Wisdom: skip offscreen card rendering (212-book grid stays fast on low-end devices) ---- */
.book-card { content-visibility: auto; contain-intrinsic-size: auto 210px; }
