/* ============================================================
   LIFE OS — STYLES
   Design language: black canvas, single warm-gold accent, editorial
   typography (Playfair for headers, Inter for UI). No emoji, no
   per-section colour soup, no decorative glow. Built for an
   ADHD/autistic user who needs minimal visual noise — every pixel
   has to earn its place.

   Sections in this file (search "===" to jump):
     RESET            – Box sizing + button defaults
     TOKENS           – CSS custom properties (colour/space/type)
     BASE             – body/typography/global state
     APP SHELL        – Container + header
     PROGRESS STRIP   – Level / XP / week points (always visible)
     DRAWER           – Slide-in left navigation
     VIEWS            – Each view is either active or hidden
     CARDS            – Reusable content blocks
     LISTS / TASKS    – Checkable items + list rows
     BUTTONS          – Primary / secondary / ghost / icon
     FORMS            – Inputs / textareas / selects
     STATS            – Mini dashboards (numbers + sub-labels)
     MODALS           – Settings + coach + (legacy) close patterns
     TOASTS           – Floating feedback
     CONFETTI         – Level-up reward (respects reduced-motion)
     RESPONSIVE       – Mobile-first; tablet+ tweaks
     ACCESSIBILITY    – Focus rings + reduced motion
     UTILITIES        – row / mt-X / hidden / etc
   ============================================================ */

/* === RESET === Minimal: box-sizing, zero margins, button reset.
   Anything beyond this gets handled in component rules. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
button { font: inherit; background: none; border: 0; cursor: pointer; color: inherit; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* === TOKENS === Single source of truth for colour, space, type.
   Edit one variable → it changes everywhere. */
:root {
  /* Surfaces — pure black canvas, gentle elevation in greys */
  --bg:           #000000;
  --bg-elev:      #08080a;
  --surface:      #0e0e10;
  --surface-2:    #14141a;
  --surface-3:    #1c1c22;
  --border:       rgba(255, 255, 255, 0.06);
  --border-mid:   rgba(255, 255, 255, 0.10);
  --border-strong:rgba(255, 255, 255, 0.18);

  /* Text — warm-white for primary, neutral greys for hierarchy */
  --text:         #f1efe9;
  --text-dim:     #9b9994;
  --text-faint:   #5a584f;

  /* Accent — single warm gold. Used sparingly for level, CTAs, success rings. */
  --accent:       #d4a857;
  --accent-soft:  rgba(212, 168, 87, 0.14);
  --accent-bright:#eac47e;

  /* Status — kept muted so they don't shout */
  --success:      #7ac484;
  --success-soft: rgba(122, 196, 132, 0.12);
  --warning:      #d49454;
  --warning-soft: rgba(212, 148, 84, 0.12);
  --danger:       #c45654;
  --danger-soft:  rgba(196, 86, 84, 0.12);

  /* Type scale */
  --fs-xs:  11px;
  --fs-sm:  12px;
  --fs-md:  14px;
  --fs-lg:  16px;
  --fs-xl:  18px;
  --fs-2xl: 22px;
  --fs-3xl: 28px;
  --fs-4xl: 36px;

  /* Spacing scale */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  24px;
  --sp-6:  32px;
  --sp-8:  48px;
  --sp-10: 64px;

  /* Borders + radii */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  14px;
  --radius-xl:  20px;

  /* Shadows — flat. One subtle drop only. */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.6);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.7);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 140ms;
  --dur-mid:  220ms;
  --dur-slow: 360ms;
}

/* === BASE === Body typography + canvas */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: var(--fs-md);
  line-height: 1.5;
  letter-spacing: -0.005em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Headings use editorial serif. The contrast vs Inter gives an
   "expensive notebook" feel without any decorative iconography. */
h1, h2, h3 {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

p { line-height: 1.55; }
strong { font-weight: 600; color: var(--text); }
em { font-style: italic; color: var(--accent); font-family: 'Playfair Display', Georgia, serif; }

/* === APP SHELL === Constrained column, comfortable on phone & desktop */
.app {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-4) calc(var(--sp-10) + env(safe-area-inset-bottom));
}

/* === HEADER === Three slots only: menu · title · settings. No clutter. */
.app-header {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
  padding: var(--sp-2) 0;
}
.app-title-block { text-align: center; }
.app-title {
  font-size: var(--fs-xl);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.app-subtitle {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 2px;
}

/* Hamburger menu icon — three lines, CSS-rendered (not an emoji) */
.hamburger {
  display: inline-block;
  position: relative;
  width: 16px;
  height: 12px;
}
.hamburger span {
  position: absolute;
  left: 0; right: 0;
  height: 1.5px;
  background: var(--text);
  border-radius: 2px;
  transition: background var(--dur-fast) var(--ease);
}
.hamburger span:nth-child(1) { top: 0; }
.hamburger span:nth-child(2) { top: 50%; transform: translateY(-50%); }
.hamburger span:nth-child(3) { bottom: 0; }
.icon-btn:hover .hamburger span { background: var(--accent-bright); }

/* Cog/gear icon — concentric circle + dots done in CSS */
.cog {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--text);
  border-radius: 50%;
  position: relative;
}
.cog::before, .cog::after {
  content: '';
  position: absolute;
  background: var(--text);
  border-radius: 1px;
}
.cog::before {
  width: 2px;
  height: 3px;
  left: 50%;
  top: -3px;
  transform: translateX(-50%);
  box-shadow:
    0 17px 0 var(--text),
    -8.5px 8.5px 0 var(--text),
    8.5px 8.5px 0 var(--text);
}
.cog::after {
  width: 4px;
  height: 4px;
  background: var(--bg);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.icon-btn:hover .cog { border-color: var(--accent-bright); }
.icon-btn:hover .cog::before { background: var(--accent-bright); box-shadow: 0 17px 0 var(--accent-bright), -8.5px 8.5px 0 var(--accent-bright), 8.5px 8.5px 0 var(--accent-bright); }

/* X close mark — two diagonal lines, CSS */
.x-mark {
  display: inline-block;
  position: relative;
  width: 14px;
  height: 14px;
}
.x-mark::before, .x-mark::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--text);
  border-radius: 1px;
}
.x-mark::before { transform: translateY(-50%) rotate(45deg); }
.x-mark::after  { transform: translateY(-50%) rotate(-45deg); }
.icon-btn:hover .x-mark::before, .icon-btn:hover .x-mark::after { background: var(--accent-bright); }

/* All icon buttons share size + invisible chrome */
.icon-btn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text);
  transition: background var(--dur-fast) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { background: var(--surface-3); }

/* === PROGRESS STRIP === Single row: Level | XP bar | weekly points.
   This is the only ambient gamification. Everything else lives in
   the Progress view. */
.progress-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--sp-5);
}
.progress-level { display: flex; flex-direction: column; gap: 2px; }
.progress-level-eyebrow {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.progress-level-num {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.progress-level-title {
  font-size: var(--fs-xs);
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.progress-xp {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
}
.progress-xp-bar {
  height: 3px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}
.progress-xp-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
  transition: width var(--dur-slow) var(--ease);
}
.progress-xp-label {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  letter-spacing: 0.04em;
}
.progress-points { text-align: right; line-height: 1.1; }
.progress-points-num {
  display: block;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text);
}
.progress-points-label {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* === DRAWER === Slide-in nav. Hidden by default; .open toggles transform.
   Scrim catches outside clicks. Trapped focus + Escape close in app.js. */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
}
.drawer.open { pointer-events: auto; }
.drawer-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity var(--dur-mid) var(--ease);
  cursor: pointer;
}
.drawer.open .drawer-scrim { opacity: 1; }
.drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(86vw, 320px);
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--sp-3) 0 var(--sp-4);
  transform: translateX(-100%);
  transition: transform var(--dur-mid) var(--ease);
  overflow-y: auto;
}
.drawer.open .drawer-panel { transform: translateX(0); }
.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--sp-2) var(--sp-4) var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.drawer-brand {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.drawer-section {
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--border);
}
.drawer-section:last-child { border-bottom: 0; }
.drawer-footer { margin-top: auto; }
.drawer-heading {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: var(--sp-2) var(--sp-3) var(--sp-3);
}
.drawer-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: var(--sp-3);
  text-align: left;
  border-radius: var(--radius-md);
  transition: background var(--dur-fast) var(--ease);
}
.drawer-item:hover { background: var(--surface-2); }
.drawer-item.active { background: var(--surface); }
.drawer-item.active .drawer-item-label { color: var(--accent); }
.drawer-item-label {
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text);
}
.drawer-item-sub {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

/* === VIEWS === Only one is active. Tied to drawer items via data-view. */
.main-content { min-height: 50vh; }
.view { display: none; }
.view.active { display: block; animation: viewFadeIn var(--dur-mid) var(--ease); }
@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* === SECTION HERO === Optional editorial intro for each view. */
.section-hero { margin-bottom: var(--sp-5); }
.section-hero h2 {
  font-size: var(--fs-3xl);
  margin-bottom: 6px;
}
.section-hero p {
  font-size: var(--fs-md);
  color: var(--text-dim);
  max-width: 56ch;
}

/* === CARDS === Universal content container. Flat, sharp borders. */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
}
.card-tight { padding: var(--sp-3); }
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.card-title {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
}
.card-title-large {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--text);
}

/* === HERO ACTION === The "Do Now" panel — visually dominant.
   This is where the user looks first when opening the app. */
.hero-action {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-elev) 100%);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-xl);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  position: relative;
  overflow: hidden;
}
.hero-action::before {
  /* Thin gold rule along the top — subtle but signals importance */
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}
.hero-action.done { border-color: rgba(122, 196, 132, 0.25); }
.hero-action.done::before { background: linear-gradient(90deg, transparent, var(--success), transparent); }

.hero-eyebrow {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: var(--sp-3);
  font-weight: 600;
}
.hero-action.done .hero-eyebrow { color: var(--success); }
.hero-text {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: var(--sp-3);
  letter-spacing: -0.015em;
}
.hero-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.hero-why {
  font-size: var(--fs-md);
  color: var(--text-dim);
  line-height: 1.6;
  padding: var(--sp-3) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--sp-3);
}
.hero-why strong { color: var(--text); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.hero-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: var(--fs-xs);
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.hero-tag.accent { color: var(--accent); border-color: rgba(212, 168, 87, 0.3); }
.hero-tag.success { color: var(--success); border-color: rgba(122, 196, 132, 0.3); }

/* === LIST ITEMS === Generic row for projects, contacts, sessions etc. */
.list-item {
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: 0; }
.list-item-title {
  font-size: var(--fs-md);
  font-weight: 500;
  margin-bottom: 4px;
}
.list-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  font-size: var(--fs-xs);
  color: var(--text-faint);
  letter-spacing: 0.02em;
}
.list-item-meta strong { color: var(--text-dim); font-weight: 500; }
.list-item-status {
  display: inline-flex;
  padding: 2px 8px;
  font-size: var(--fs-xs);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.list-item-status.active  { color: var(--accent);  background: var(--accent-soft); }
.list-item-status.waiting { color: var(--text-dim);background: var(--surface-2); }
.list-item-status.done    { color: var(--success); background: var(--success-soft); }
.list-item-status.urgent  { color: var(--danger);  background: var(--danger-soft); }

/* === TASK LIST === Checkable items (recurring family, follow-ups, etc). */
.task-list { display: flex; flex-direction: column; gap: var(--sp-1); }
.task-item {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-3);
  border-radius: var(--radius-md);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease);
}
.task-item:hover { background: var(--surface); }
.task-item.done { opacity: 0.55; }
.task-item.done .task-text { text-decoration: line-through; }

/* === TASK REWARD ANIMATION === Fires on the item itself, not a side toast.
   Gold border flash + scale pulse + floating +pts overlay. */
@keyframes taskComplete {
  0%   { background: var(--bg-elev);  box-shadow: none;                              transform: scale(1); }
  20%  { background: rgba(212,168,87,0.18); box-shadow: 0 0 0 2px var(--accent);    transform: scale(1.025); }
  55%  { background: rgba(212,168,87,0.10); box-shadow: 0 0 0 1.5px var(--accent);  transform: scale(1.012); }
  100% { background: var(--bg-elev);  box-shadow: none;                              transform: scale(1); }
}
.task-item.reward-flash {
  animation: taskComplete 0.55s var(--ease) forwards;
  pointer-events: none;
  position: relative;
}
@keyframes ptsFloat {
  0%   { opacity: 1;   transform: translateY(0) scale(1); }
  80%  { opacity: 0.9; transform: translateY(-18px) scale(1.05); }
  100% { opacity: 0;   transform: translateY(-26px) scale(0.9); }
}
.task-item.reward-flash::after {
  content: attr(data-pts);
  position: absolute;
  top: 6px; right: 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.04em;
  pointer-events: none;
  animation: ptsFloat 0.55s var(--ease) forwards;
}

.task-check {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--bg);
  transition: all var(--dur-fast) var(--ease);
  margin-top: 1px;
}
.task-check:hover { border-color: var(--accent); }
.task-check.checked {
  background: var(--accent);
  border-color: var(--accent);
}
.task-check.checked::before {
  content: '';
  width: 11px;
  height: 6px;
  border-left: 1.5px solid var(--bg);
  border-bottom: 1.5px solid var(--bg);
  transform: rotate(-45deg) translate(2px, -1px);
}
.task-body { flex: 1; min-width: 0; }
.task-text { font-size: var(--fs-md); color: var(--text); }
.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: 4px;
  font-size: var(--fs-xs);
  color: var(--text-faint);
}
.task-tag {
  display: inline-flex;
  padding: 2px 7px;
  background: var(--surface-2);
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.task-tag.points { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.task-del {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  transition: all var(--dur-fast) var(--ease);
}
.task-del:hover { color: var(--danger); background: var(--danger-soft); }

/* === BUTTONS === Two visual weights: primary (filled gold) + secondary (outlined).
   Plus ghost for tertiary actions. */
.btn-primary, .btn-secondary, .btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  font-size: var(--fs-md);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--dur-fast) var(--ease);
  white-space: nowrap;
  letter-spacing: 0.005em;
}
.btn-primary {
  background: var(--accent);
  color: #000;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-bright); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { background: var(--surface-3); color: var(--text-faint); cursor: not-allowed; }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-mid);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn-secondary:disabled { color: var(--text-faint); cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  padding: 8px 12px;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* Small button variant used inside list items */
.btn-sm { padding: 6px 10px; font-size: var(--fs-xs); }

/* === FORMS === Inputs match the dark surface, gold focus ring. */
.input, .textarea, .setting-input {
  width: 100%;
  background: var(--bg-elev);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: var(--fs-md);
  color: var(--text);
  transition: border-color var(--dur-fast) var(--ease);
}
.input:focus, .textarea:focus, .setting-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }

.add-row { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.add-row .input { flex: 1; min-width: 200px; }
.form-row { margin-bottom: var(--sp-3); }
.form-label, .setting-label {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--sp-2);
  font-weight: 600;
}
.setting-label.setting-inline {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-transform: none;
  letter-spacing: 0;
  font-size: var(--fs-md);
  color: var(--text);
  font-weight: 400;
  cursor: pointer;
  margin: 0;
}
.setting-label.setting-inline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.setting-hint {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  line-height: 1.5;
  margin-bottom: var(--sp-2);
}
.setting-group { padding: var(--sp-4) 0; border-bottom: 1px solid var(--border); }
.setting-group:last-child { border-bottom: 0; }
.setting-buttons { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* === STATS === Number grids for impact/finance dashboards. */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}
.stat-card {
  padding: var(--sp-3);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.stat-label {
  font-size: var(--fs-xs);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--sp-2);
}
.stat-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-2xl);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
  line-height: 1.1;
}
.stat-value.accent { color: var(--accent); }
.stat-value.success { color: var(--success); }
.stat-value.danger { color: var(--danger); }
.stat-sub { font-size: var(--fs-xs); color: var(--text-faint); }

/* Generic progress bar (used in business modules + finance) */
.progress-bar {
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
  margin: var(--sp-2) 0;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width var(--dur-slow) var(--ease);
}

/* === EMPTY === Placeholder for zero-state lists */
.empty {
  padding: var(--sp-5) var(--sp-3);
  text-align: center;
  color: var(--text-faint);
  font-size: var(--fs-sm);
  line-height: 1.6;
}

/* === MODULE CARDS === Business / ASE learning modules */
.module-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3);
  margin-bottom: var(--sp-2);
}
.module-card.locked { opacity: 0.5; }
.module-card.completed { border-color: rgba(122, 196, 132, 0.25); }
.module-week {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.module-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-lg);
  font-weight: 700;
  margin-bottom: var(--sp-2);
}

/* === MODALS === Settings + Coach. Pinned to centre on desktop, full-bleed on phone. */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: var(--sp-4);
  animation: modalFadeIn var(--dur-mid) var(--ease);
}
@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
}
.modal-coach { max-width: 560px; }
.modal-header {
  padding: var(--sp-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 {
  font-size: var(--fs-xl);
  font-weight: 700;
}
.modal-body {
  padding: var(--sp-4);
  overflow-y: auto;
}

/* Coach 1-on-1 message blocks */
.coach-message {
  padding: var(--sp-3);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-3);
  font-size: var(--fs-md);
  line-height: 1.55;
}
.coach-message.from-manager { background: var(--surface); border-left: 2px solid var(--accent); }
.coach-message.from-you { background: var(--bg-elev); border-left: 2px solid var(--border-strong); }
.coach-message strong { color: var(--accent); margin-right: 4px; }
.coach-message.from-you strong { color: var(--text-dim); }
.coach-input-row { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.coach-input-row .input { flex: 1; }
.coach-loading {
  color: var(--text-faint);
  font-size: var(--fs-md);
  padding: var(--sp-2) 0;
}
.coach-loading::after {
  content: '...';
  animation: dots 1.2s steps(3, end) infinite;
}
@keyframes dots { 0%,20% {content:'.'} 40% {content:'..'} 60%,100% {content:'...'} }

/* === COACH BUBBLE === Highlight card used in Do Now / smart action panels. */
.coach-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  line-height: 1.55;
}

/* === TOASTS === Floating completion feedback. Auto-dismiss after 3s. */
.toast-container {
  position: fixed;
  bottom: calc(var(--sp-4) + env(safe-area-inset-bottom));
  right: var(--sp-4);
  left: var(--sp-4);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-2);
  z-index: 400;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  color: var(--text);
  max-width: 360px;
  box-shadow: var(--shadow-md);
  animation: toastIn var(--dur-mid) var(--ease) forwards, toastOut var(--dur-mid) var(--ease) 2.8s forwards;
  pointer-events: auto;
}
.toast.success  { border-left: 2px solid var(--success); }
.toast.danger   { border-left: 2px solid var(--danger); }
.toast.warning  { border-left: 2px solid var(--warning); }
.toast.level-up { border-left: 2px solid var(--accent); background: linear-gradient(180deg, var(--surface), var(--bg-elev)); }
.toast-icon {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-lg);
  color: var(--accent);
}
.toast.success .toast-icon { color: var(--success); }
.toast.danger  .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast-message { flex: 1; line-height: 1.4; }
.toast-points {
  color: var(--accent);
  font-weight: 600;
  font-size: var(--fs-sm);
  letter-spacing: 0.02em;
}
@keyframes toastIn  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

/* === CONFETTI === Sparing visual flourish only on level up.
   Respects reduced-motion via the @media block below. */
.confetti {
  position: fixed;
  pointer-events: none;
  z-index: 350;
}

/* === RESPONSIVE === Mobile-first; widen breathing room on tablet+ */
@media (min-width: 640px) {
  .app { padding: var(--sp-5) var(--sp-5) var(--sp-10); }
  .progress-strip { padding: var(--sp-4) var(--sp-5); }
  .hero-action { padding: var(--sp-6); }
  .hero-text { font-size: var(--fs-4xl); }
  .section-hero h2 { font-size: var(--fs-4xl); }
}
@media (max-width: 480px) {
  .progress-level-title { display: none; }
  .progress-strip { gap: var(--sp-3); padding: var(--sp-3); }
}

/* === ACCESSIBILITY === Focus visibility + reduced motion. */
button:focus-visible,
.input:focus-visible,
.textarea:focus-visible,
.setting-input:focus-visible,
.drawer-item:focus-visible,
.task-check:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .confetti { display: none !important; }
}

/* === UTILITIES === Single-purpose helpers used inline */
.row         { display: flex; gap: var(--sp-2); align-items: center; }
.row-wrap    { flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.flex-1      { flex: 1; min-width: 0; }
.mt-1        { margin-top: var(--sp-1); }
.mt-2        { margin-top: var(--sp-2); }
.mt-3        { margin-top: var(--sp-3); }
.mt-4        { margin-top: var(--sp-4); }
.mt-5        { margin-top: var(--sp-5); }
.mb-2        { margin-bottom: var(--sp-2); }
.mb-3        { margin-bottom: var(--sp-3); }
.mb-4        { margin-bottom: var(--sp-4); }
.text-dim    { color: var(--text-dim); }
.text-faint  { color: var(--text-faint); font-size: var(--fs-sm); }
.text-accent { color: var(--accent); }
.hidden      { display: none !important; }

/* ============================================================
   AUDITORS — Tab bar, brief, audit tasks, persona panels, chat
   ============================================================ */

/* === TAB BAR === */
.auditors-tabs {
  display: flex;
  gap: var(--sp-1);
  overflow-x: auto;
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-4);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.auditors-tabs::-webkit-scrollbar { display: none; }

.auditors-tab {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: var(--fs-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  position: relative;
}
.auditors-tab:hover {
  border-color: var(--border-mid);
  color: var(--text);
}
.auditors-tab.active {
  background: var(--bg-elev);
  border-color: var(--accent);
  color: var(--text);
}
.auditors-tab .tab-emoji { font-size: 15px; }
.auditors-tab .tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
  position: absolute;
  top: 6px;
  right: 6px;
}

/* === DAILY BRIEF === */
.brief-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--fs-md);
  line-height: 1.55;
  margin-bottom: var(--sp-4);
  color: var(--text-dim);
}

.auditors-group {
  margin-bottom: var(--sp-4);
}
.auditors-group-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) 0 var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-2);
}

/* === AUDIT TASK === Expandable row */
.audit-task {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--sp-2);
  overflow: hidden;
  transition: border-color var(--dur-fast) var(--ease);
}
.audit-task:hover { border-color: var(--border-mid); }
.audit-task.done  { opacity: 0.55; }

.audit-task-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3);
  cursor: pointer;
  user-select: none;
}
.audit-task-check {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
  color: transparent;
  font-size: 11px;
}
.audit-task-check.checked {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.audit-task-title {
  flex: 1;
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: 1.4;
}
.audit-task.done .audit-task-title {
  text-decoration: line-through;
  color: var(--text-faint);
}
.audit-task-badges {
  display: flex;
  gap: var(--sp-1);
  align-items: center;
  flex-shrink: 0;
}
.audit-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 100px;
  line-height: 1.5;
  white-space: nowrap;
}
.audit-task-expand {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 11px;
  transition: transform var(--dur-fast) var(--ease);
}
.audit-task.expanded .audit-task-expand { transform: rotate(180deg); }

.audit-task-body {
  display: none;
  padding: 0 var(--sp-3) var(--sp-3) calc(var(--sp-3) + 28px);
  font-size: var(--fs-sm);
  color: var(--text-dim);
  line-height: 1.6;
  border-top: 1px solid var(--border);
}
.audit-task.expanded .audit-task-body { display: block; }

.audit-task-meta {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  flex-wrap: wrap;
}
.audit-task-jump {
  margin-top: var(--sp-2);
}
.audit-task-jump a {
  color: var(--accent);
  font-size: var(--fs-xs);
  text-decoration: none;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.audit-task-jump a:hover { text-decoration: underline; }

/* === PERSONA PANEL === */
.persona-panel {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.persona-header {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
}
.persona-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.persona-info { flex: 1; min-width: 0; }
.persona-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.2;
}
.persona-role {
  font-size: var(--fs-sm);
  color: var(--text-faint);
  margin-top: 2px;
}
.persona-tagline {
  font-size: var(--fs-sm);
  color: var(--text-dim);
  margin-top: var(--sp-2);
  line-height: 1.5;
}
.persona-status {
  font-size: var(--fs-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--surface-2);
  color: var(--text-faint);
  flex-shrink: 0;
}
.persona-status.active {
  background: rgba(122, 196, 132, 0.15);
  color: var(--success);
}

/* === ACTIVITY TRACKER (Joy) === */
.activity-tracker {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-3) var(--sp-4);
}
.activity-tracker-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: var(--sp-2);
}
.activity-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1);
}
.activity-btn {
  font-size: var(--fs-xs);
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.activity-btn:hover { border-color: var(--border-mid); color: var(--text); }
.activity-btn.active { border-color: #7ec8a8; color: #7ec8a8; background: rgba(126,200,168,0.12); }

.wife-contact-reminder {
  margin-top: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  background: rgba(212,168,87,0.10);
  border: 1px solid rgba(212,168,87,0.25);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-dim);
}

/* === CHAT === */
.persona-chat {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  max-height: 420px;
  overflow-y: auto;
  padding: var(--sp-1) 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.chat-bubble {
  max-width: 88%;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--surface-2);
  border: 1px solid var(--border-mid);
  color: var(--text);
}
.chat-bubble.assistant {
  align-self: flex-start;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-left-width: 2px;
}
.chat-bubble-meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

.persona-typing {
  align-self: flex-start;
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  color: var(--text-faint);
}
.persona-typing::after {
  content: '...';
  animation: dots 1.2s steps(3, end) infinite;
}

.persona-input-row {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-end;
}
.persona-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: vertical;
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: var(--fs-sm);
  font-family: inherit;
  line-height: 1.5;
}
.persona-input:focus {
  outline: none;
  border-color: var(--border-strong);
}
.persona-chat-actions {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.persona-empty {
  padding: var(--sp-5) var(--sp-3);
  text-align: center;
  color: var(--text-faint);
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.persona-empty-cta {
  margin-top: var(--sp-3);
}
