/* Consultant OS theme — GitHub-dark terminal aesthetic.
   #0D1117 bg · #161B22 cards · #30363D borders · #39D353 terminal green
   JetBrains Mono headings/labels · IBM Plex Sans body · mobile-first. */

:root {
  --bg: #0D1117;
  --surface: #161B22;
  --surface-2: #21262D;
  --border: #30363D;
  --border-hi: #484F58;
  --ink: #C9D1D9;
  --dim: #8B949E;

  --green: #39D353;
  --green-deep: #238636;
  --blue: #58A6FF;
  --red: #F85149;
  --gold: #D29922;
  --purple: #A371F7;

  --radius: 6px;
  --font: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --maxw: 640px;
  --tap: 44px; /* minimum touch target */

  /* Motion: quick, compositor-friendly (transform/opacity/box-shadow only). */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 110ms;
  --normal: 180ms;

  --shadow-1: 0 1px 2px rgba(1, 4, 9, 0.5);
  --shadow-2: 0 6px 20px rgba(1, 4, 9, 0.45);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.offline-banner {
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  padding: 7px 10px;
  background: var(--surface-2);
  border: 1px solid var(--gold);
  color: var(--gold);
  border-radius: var(--radius);
  margin-bottom: 10px;
  animation: bannerIn var(--normal) var(--ease);
}
@keyframes bannerIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
}

body {
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
  background-image:
    linear-gradient(rgba(48, 54, 61, 0.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(48, 54, 61, 0.28) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
  background-attachment: fixed;
}

.app { max-width: var(--maxw); margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 14px 0; }

#ptrIndicator {
  position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%;
  transform: translateX(-50%) translateY(0); opacity: 0; z-index: 100;
  font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--green);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 6px 12px; pointer-events: none; box-shadow: var(--shadow-2);
  transition: opacity var(--fast) var(--ease);
}
.hidden { display: none !important; }
.muted { color: var(--dim); }

/* ---- Focus (accessible, theme-matched — never removed without a visible replacement) ---- */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(57, 211, 83, 0.35);
  border-radius: var(--radius);
}
button, .btn, input, textarea, select { touch-action: manipulation; }

/* ---- Header ---- */
.header { display: flex; align-items: center; justify-content: space-between; padding: 8px 2px 14px; gap: 10px; }
.header h1 {
  font-family: var(--mono); font-size: 20px; margin: 0; font-weight: 700;
  letter-spacing: -0.02em; text-transform: uppercase; color: var(--green);
  text-shadow: 0 0 12px rgba(57, 211, 83, 0.45);
  display: flex; align-items: center;
  text-wrap: balance;
}
.header h1::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 999px;
  background: var(--green); box-shadow: 0 0 10px var(--green);
  margin-right: 9px; animation: pulse 1.6s ease-in-out infinite; flex: 0 0 auto;
}
@keyframes pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.55; transform: scale(1.15); } }
.header .date {
  font-family: var(--mono); font-size: 10px; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.2em; margin-top: 2px;
}

/* ---- KPI cards ---- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 6px; text-align: center; box-shadow: var(--shadow-1);
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.kpi .num { font-family: var(--mono); font-size: 26px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi:nth-child(1) .num { color: var(--green); }
.kpi:nth-child(2) .num { color: var(--blue); }
.kpi:nth-child(3) .num { color: var(--purple); }
.kpi .label {
  font-family: var(--mono); font-size: 9px; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.2em; margin-top: 4px;
}

/* ---- Section titles ---- */
.section-title {
  font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.2em;
  margin: 22px 2px 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
}

/* ---- Cards / list items ---- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 14px; margin-bottom: 8px; box-shadow: var(--shadow-1);
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.todo { display: flex; align-items: flex-start; gap: 12px; }
.todo .check {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 5px; padding: 0; font: inherit;
  border: 1px solid var(--border-hi); background: var(--surface-2);
  cursor: pointer; display: grid; place-items: center; margin-top: 1px;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.todo .check:hover { border-color: var(--green); }
.todo .check:active { transform: scale(0.88); }
.todo .check.done { background: var(--green-deep); border-color: var(--green); }
.todo .check.done::after {
  content: "✓"; color: #fff; font-size: 15px; font-weight: 700;
  animation: checkIn var(--normal) var(--ease);
}
@keyframes checkIn { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }
.todo .body { flex: 1; min-width: 0; cursor: pointer; }
.todo .title { font-weight: 500; font-size: 15px; word-wrap: break-word; }
.todo.done .title { color: var(--dim); text-decoration: line-through; }
.todo .meta { font-size: 12px; color: var(--dim); margin-top: 3px; word-wrap: break-word; overflow-wrap: break-word; }
.todo-actions { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto; }
.iconbtn {
  background: none; border: none; color: var(--dim); font-size: 17px; cursor: pointer;
  padding: 4px 8px; line-height: 1; min-width: 32px; min-height: 32px;
  border-radius: 5px; transition: color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.iconbtn:hover { color: var(--blue); background: var(--surface-2); }
.iconbtn:active { color: var(--blue); transform: scale(0.9); }
.del {
  color: var(--dim); background: none; border: none; font-size: 20px; line-height: 1;
  cursor: pointer; padding: 4px 8px; flex: 0 0 auto; min-width: 32px; min-height: 32px;
  border-radius: 5px; transition: color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.del:hover { color: var(--red); background: rgba(248, 81, 73, 0.1); }
.del:active { color: var(--red); transform: scale(0.9); }

/* ---- Roadmap tree ---- */
.goal-annual { margin-bottom: 16px; }
.goal-annual > .card { border-left: 3px solid var(--green); }
.goal-node .gn-head { display: flex; align-items: center; gap: 8px; }
.goal-node .gn-head .t { flex: 1; font-weight: 600; font-size: 15px; cursor: pointer; min-width: 0; word-wrap: break-word; }
.goal-annual > .card > .gn-head .t { font-family: var(--mono); letter-spacing: -0.01em; }
.gn-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.gn-actions .del { margin-left: auto; }
.gn-actions .chev { margin-left: auto; }
.gn-actions .gn-edit-wrap:last-child { margin-left: auto; }
.goal-monthly { margin: 8px 0 8px 12px; }
.goal-weekly { margin: 6px 0 6px 12px; }
.goal-monthly > div > .card { border-left: 3px solid var(--blue); padding: 11px 12px; }
.goal-weekly .card { border-left: 3px solid var(--border-hi); background: var(--surface-2); padding: 10px 12px; margin-bottom: 6px; }
.chip {
  font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--dim);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
  padding: 2px 8px; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
}
.chip.overdue { color: var(--red); border-color: var(--red); background: rgba(248, 81, 73, 0.1); }
.chip.stage-status.in_progress { color: var(--blue); border-color: var(--blue); background: rgba(88, 166, 255, 0.1); }
.chip.stage-status.completed { color: var(--green); border-color: var(--green); background: rgba(57, 211, 83, 0.1); }
.chip.goal-chip { white-space: normal; word-wrap: break-word; overflow-wrap: break-word; max-width: 100%; display: inline-block; }
.desc { font-size: 13px; color: var(--dim); margin-top: 5px; word-wrap: break-word; overflow-wrap: break-word; }
.desc.assignment { color: var(--ink); font-size: 13px; }
.desc.assignment::first-letter { color: var(--green); }

.chev {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px;
  color: var(--dim); width: 30px; height: 30px; flex: 0 0 auto; font-size: 12px;
  cursor: pointer; transition: transform var(--normal) var(--ease), border-color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.chev:hover { border-color: var(--border-hi); background: var(--surface); }
.chev.collapsed { transform: rotate(-90deg); }

.gn-edit-wrap { position: relative; }
.gn-edit-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 20;
  display: flex; flex-direction: column; gap: 2px; min-width: 150px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px; box-shadow: var(--shadow-2);
}
.gn-edit-menu button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--ink); font-family: var(--mono); font-size: 12px; padding: 8px 10px;
  border-radius: 5px; cursor: pointer; transition: background var(--fast) var(--ease);
}
.gn-edit-menu button:hover { background: var(--surface-2); }
.gn-edit-menu button.danger { color: var(--red); }

.progress-bar { height: 6px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin-top: 10px; }
.progress-bar span { display: block; height: 100%; background: var(--green); box-shadow: 0 0 8px rgba(57, 211, 83, 0.5); transition: width var(--normal) var(--ease); }

.status-dot {
  flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border-hi); background: var(--surface-2); cursor: pointer; padding: 0;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.status-dot:hover { border-color: var(--dim); }
.status-dot:active { transform: scale(0.85); }
.status-dot.in_progress { background: var(--blue); border-color: var(--blue); box-shadow: 0 0 8px rgba(88, 166, 255, 0.5); }
.status-dot.completed { background: var(--green); border-color: var(--green); box-shadow: 0 0 8px rgba(57, 211, 83, 0.5); }
.status-dot.mastered { background: var(--purple); border-color: var(--purple); box-shadow: 0 0 8px rgba(163, 113, 247, 0.5); }
.item-completed .t, .item-mastered .t { text-decoration: line-through; color: var(--dim); }
.stage-inactive { opacity: 0.55; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--green-deep); color: #fff; border: 1px solid rgba(240, 246, 252, 0.1);
  border-radius: var(--radius); padding: 12px 16px; min-height: var(--tap);
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; cursor: pointer; width: 100%;
  box-shadow: var(--shadow-1);
  transition: transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease),
              filter var(--fast) var(--ease), background var(--fast) var(--ease), opacity var(--fast) var(--ease);
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(35, 134, 54, 0.35); }
.btn:active { filter: brightness(1.15); transform: translateY(0) scale(0.98); box-shadow: var(--shadow-1); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; box-shadow: none; }
.btn.secondary { background: var(--surface-2); color: var(--ink); border-color: var(--border-hi); }
.btn.secondary:hover { box-shadow: 0 4px 14px rgba(1, 4, 9, 0.4); }
.btn.small, .btn.ghost {
  width: auto; padding: 7px 11px; min-height: 34px; font-size: 11px; border-radius: 5px;
}
.btn.ghost { background: transparent; color: var(--green); border: 1px solid var(--green-deep); box-shadow: none; }
.btn.ghost:hover { background: rgba(57, 211, 83, 0.08); box-shadow: none; }
.btn.ghost.danger { color: var(--red); border-color: var(--red); }
.btn.ghost.danger:hover { background: rgba(248, 81, 73, 0.08); }
.btn.ghost.active { background: rgba(248, 81, 73, 0.12); }
#speakToggleBtn.active { background: rgba(57, 211, 83, 0.12); }

.sched-edit { position: relative; }
.sched-edit-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 20;
  display: flex; flex-direction: column; gap: 6px; min-width: 150px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px; box-shadow: var(--shadow-2);
}
.sched-edit-menu .btn { width: 100%; }
.btn.cyan { background: transparent; color: var(--blue); border: 1px solid var(--blue); box-shadow: none; }
.btn.cyan:hover { background: rgba(88, 166, 255, 0.08); box-shadow: none; }
.btn.pink { background: transparent; color: var(--purple); border: 1px solid var(--purple); box-shadow: none; }
.btn.pink:hover { background: rgba(163, 113, 247, 0.08); box-shadow: none; }

/* ---- Forms / inputs ---- */
input, textarea, select {
  width: 100%; background: var(--bg); color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 13px;
  font-size: 16px; /* prevents iOS zoom-on-focus */
  font-family: var(--font); margin-bottom: 12px; min-height: var(--tap);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
textarea { min-height: 80px; resize: vertical; }
input:hover, textarea:hover, select:hover { border-color: var(--border-hi); }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(57, 211, 83, 0.15);
}
select { color-scheme: dark; }
label {
  font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.18em; display: block; margin-bottom: 6px;
}

/* ---- Bottom nav ---- */
.nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(13, 17, 23, 0.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around;
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 50;
}
.nav button {
  background: none; border: none; color: var(--dim);
  font-family: var(--mono); font-size: 9px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.12em;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  cursor: pointer; flex: 1; padding: 6px 0; min-height: var(--tap);
  transition: color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.nav button:active { transform: scale(0.94); }
.nav button .ico { font-size: 20px; filter: grayscale(1) opacity(0.6); transition: filter var(--fast) var(--ease), transform var(--fast) var(--ease); }
.nav button.active { color: var(--green); }
.nav button.active .ico { filter: none; transform: translateY(-1px); }

/* ---- Lock screen ---- */
.lock {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
}
.lock .logo { font-size: 46px; margin-bottom: 10px; filter: drop-shadow(0 0 14px rgba(57, 211, 83, 0.4)); }
.lock h2 {
  margin: 0 0 6px; font-family: var(--mono); font-size: 22px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--green);
  text-shadow: 0 0 12px rgba(57, 211, 83, 0.45);
}
.lock p { color: var(--dim); margin: 0 0 26px; font-size: 14px; }
.lock .form { width: 100%; max-width: 320px; }
.lock input {
  text-align: center; font-family: var(--mono); font-size: 24px; font-weight: 700;
  letter-spacing: 0.35em; background: var(--surface);
}
.error { color: var(--red); font-size: 13px; font-family: var(--mono); min-height: 20px; margin-bottom: 8px; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(1, 4, 9, 0.72);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
  animation: backdropIn var(--normal) var(--ease);
  overscroll-behavior: contain;
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-bottom: none;
  border-radius: 12px 12px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  width: 100%; max-width: var(--maxw); max-height: 88vh; max-height: 88dvh; overflow-y: auto;
  box-shadow: 0 -8px 32px rgba(1, 4, 9, 0.5);
  animation: modalIn var(--normal) var(--ease);
  overscroll-behavior: contain;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
.modal h3 {
  margin: 0 0 16px; font-family: var(--mono); font-size: 15px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--green);
}
.modal .actions { display: flex; gap: 10px; margin-top: 8px; }

/* ---- Empty states ---- */
.empty { text-align: center; color: var(--dim); padding: 34px 16px; font-size: 14px; }
.empty .big { font-size: 36px; margin-bottom: 10px; filter: grayscale(0.4); }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: calc(92px + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%) translateY(6px);
  background: var(--surface-2); border: 1px solid var(--green-deep); color: var(--ink);
  padding: 10px 16px; border-radius: var(--radius);
  font-family: var(--mono); font-size: 12px; z-index: 200;
  opacity: 0; transition: opacity var(--normal) var(--ease), transform var(--normal) var(--ease);
  pointer-events: none; max-width: 90vw; box-shadow: var(--shadow-2);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spinner {
  width: 22px; height: 22px; border: 3px solid var(--border);
  border-top-color: var(--green); border-radius: 50%;
  animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.center-load { display: grid; place-items: center; padding: 44px; }

/* ---- AI review checklists ---- */
.bd-tree { margin-top: 8px; }
.bd-month { margin-bottom: 14px; }
.bd-week { margin: 4px 0 4px 16px; }
.bd-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 0;
  font-size: 14px; cursor: pointer; min-height: 36px;
}
.bd-row input { width: 20px; height: 20px; margin: 0; flex: 0 0 auto; min-height: 0; accent-color: var(--green); }
.bd-todo { margin-left: 16px; color: var(--dim); }

/* ---- Today's Schedule ---- */
/* Compact rows (everything except the current block) — small, muted, quick
   context for what's before/after, not competing with the NOW block. */
.sched-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; margin-bottom: 6px; box-shadow: var(--shadow-1);
  transition: border-color var(--fast) var(--ease), box-shadow var(--normal) var(--ease);
}
.sched-row.compact { opacity: 0.6; padding: 7px 12px; }
.sched-row.compact .sched-label { font-size: 13px; font-weight: 500; }
.sched-time {
  flex: 0 0 auto; font-family: var(--mono); font-size: 11px; font-weight: 500;
  min-width: 88px; color: var(--blue); font-variant-numeric: tabular-nums;
}
.sched-time .muted { color: var(--dim); }
.sched-body { flex: 1; min-width: 0; cursor: pointer; }
.sched-label { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sched-body .meta { font-size: 12px; color: var(--dim); margin-top: 2px; word-wrap: break-word; overflow-wrap: break-word; }

/* The current block — this is the whole point of the screen. Big, bold,
   centered, unmissable. */
.sched-row.now {
  flex-direction: column; align-items: stretch; text-align: center;
  border-color: var(--green); border-width: 2px; padding: 36px 20px;
  box-shadow: 0 0 0 1px var(--green), 0 0 24px rgba(57, 211, 83, 0.22);
  scroll-margin: 16px;
}
.sched-row.now .sched-time {
  min-width: 0; font-size: 15px; margin-bottom: 10px; text-align: center;
}
.sched-row.now .sched-body { cursor: pointer; }
.sched-row.now .sched-label {
  justify-content: center; color: var(--green); font-size: 32px; font-weight: 700;
  text-shadow: 0 0 14px rgba(57, 211, 83, 0.35); text-wrap: balance;
}
.sched-row.now .sched-body .meta { font-size: 15px; margin-top: 8px; }
.sched-row.now .del { position: absolute; margin-left: auto; }
.sched-row.now { position: relative; }
.sched-row.now .del { top: 10px; right: 12px; }

/* ---- Journal card ---- */
.journal-card { cursor: pointer; border-left: 3px solid var(--blue); }
.jrow { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.jrow:last-child { border-bottom: none; }
.jk {
  font-family: var(--mono); font-size: 9px; font-weight: 500; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.14em; flex: 0 0 38%; align-self: center;
}
.jv { flex: 1; min-width: 0; word-wrap: break-word; }

/* ---- Coach chat ---- */
.chat-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 8px; min-height: 55vh; }
.bubble {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 13px; max-width: 90%; font-size: 14px; line-height: 1.5; word-wrap: break-word;
  animation: bubbleIn var(--normal) var(--ease);
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.bubble.me { align-self: flex-end; background: var(--green-deep); border-color: var(--green-deep); color: #fff; border-bottom-right-radius: 3px; }
.bubble.coach { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 3px; }
.bubble.coach b { color: var(--green); }
.bubble.thinking { display: grid; place-items: center; min-width: 60px; }
.chat-bar {
  position: fixed; left: 0; right: 0; bottom: calc(64px + env(safe-area-inset-bottom));
  display: flex; gap: 8px; padding: 10px 14px;
  background: rgba(13, 17, 23, 0.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border); z-index: 40;
  max-width: var(--maxw); margin: 0 auto;
}
.chat-bar input { margin: 0; flex: 1; background: var(--surface); }
.chat-bar .btn { width: auto; padding: 12px 16px; }
#view-coach { padding-bottom: 76px; }

/* ---- Diary ---- */
.rec-panel { text-align: center; }
.rec-btn {
  width: 88px; height: 88px; border-radius: 50%;
  border: 2px solid var(--green); background: var(--surface-2); color: var(--ink);
  font-size: 36px; cursor: pointer; margin: 8px auto 12px;
  display: grid; place-items: center;
  box-shadow: 0 0 18px rgba(57, 211, 83, 0.25);
  transition: filter var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.rec-btn:hover { transform: translateY(-1px); box-shadow: 0 0 24px rgba(57, 211, 83, 0.35); }
.rec-btn:active { filter: brightness(1.2); transform: scale(0.96); }
.rec-btn.recording {
  border-color: var(--red); background: rgba(248, 81, 73, 0.12);
  box-shadow: 0 0 18px rgba(248, 81, 73, 0.4); animation: recpulse 1.2s ease-in-out infinite;
}
@keyframes recpulse {
  0%,100% { box-shadow: 0 0 18px rgba(248, 81, 73, 0.4); }
  50% { box-shadow: 0 0 30px rgba(248, 81, 73, 0.65); }
}
.rec-status { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--dim); margin-bottom: 4px; }
.rec-timer { font-family: var(--mono); font-size: 28px; font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; }
.diary-day { margin-bottom: 18px; }
.diary-day .day-label {
  font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.16em; margin: 0 2px 8px;
}
.diary-entry {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--green-deep);
  border-radius: var(--radius); padding: 11px 13px; margin-bottom: 8px; box-shadow: var(--shadow-1);
  transition: border-color var(--fast) var(--ease);
}
.diary-entry .txt { font-size: 14px; white-space: pre-wrap; word-wrap: break-word; cursor: pointer; }
.diary-entry .stamp {
  font-family: var(--mono); font-size: 10px; color: var(--dim); letter-spacing: 0.08em;
  margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center;
}

/* ---- Done tab stats ---- */
.stats-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 18px; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 8px; text-align: center; box-shadow: var(--shadow-1);
}
.stat-tile .num { font-family: var(--mono); font-size: 22px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-tile:nth-child(1) .num { color: var(--green); }
.stat-tile:nth-child(2) .num { color: var(--blue); }
.stat-tile:nth-child(3) .num { color: var(--gold); }
.stat-tile:nth-child(4) .num { color: var(--purple); }
.stat-tile .label {
  font-family: var(--mono); font-size: 9px; color: var(--dim);
  text-transform: uppercase; letter-spacing: 0.16em; margin-top: 4px;
}

/* ---- Weekly progress bar (homepage) ---- */
/* Deliberately narrow and centered — a glance, not a dashboard. */
.week-progress { display: flex; flex-direction: column; align-items: center; margin: 4px 0 18px; }
.week-bar {
  display: flex; width: 100%; max-width: 220px; height: 8px;
  border-radius: 999px; overflow: hidden; border: 1px solid var(--border);
  background: var(--surface-2);
}
.week-bar.empty-bar { background: var(--surface-2); }
.wb-done { background: var(--green); box-shadow: 0 0 8px rgba(57, 211, 83, 0.5); transition: width var(--normal) var(--ease); }
.wb-left { background: var(--red); opacity: 0.65; transition: width var(--normal) var(--ease); }
.week-bar-label {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  margin-top: 7px; letter-spacing: 0.06em; font-variant-numeric: tabular-nums;
}

/* ---- Week / Done day groups (used by the Done tab's date-grouped lists) ---- */
.day-group { margin-bottom: 16px; }
.day-head { display: flex; align-items: center; justify-content: space-between; margin: 0 2px 8px; gap: 8px; }
.day-name {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  display: flex; align-items: center; gap: 8px;
}
.day-empty { color: var(--dim); font-size: 13px; padding: 2px 4px 6px; }

/* ---- Scrollbar (desktop) ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; transition: background var(--fast) var(--ease); }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }
