/* ================================================================
   Dashboard styles for /app/*
   Extends style.css — reuses the same tokens (--void, --gold, fonts).
   Only block-specific styles live here.
   ================================================================ */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Extra bottom room so the fixed "I'm triggered" pill never floats on top
     of the last content. */
  padding: var(--s-7) var(--s-5) calc(var(--s-7) + 64px);
  max-width: 720px;
  width: 100%;
  /* Clip any horizontal overflow inside the dashboard itself, so a too-wide
     child can never make /app/home pan sideways on mobile. clip (not hidden)
     avoids turning the shell into a vertical scroll container. */
  overflow-x: clip;
  margin: 0 auto;
  position: relative;
  z-index: 1;            /* above the body::before aura */
}

.app-kicker {
  font-family: var(--body-font);
  font-size: var(--fs-xxs);
  font-weight: var(--fw-label);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--s-4);
}

.app-title {
  font-family: var(--heading-font);
  font-size: var(--fs-2xl);
  font-weight: 400;
  color: var(--text-primary);
  margin: 0 0 var(--s-4);
  line-height: 1.15;
}

.app-subtitle {
  font-family: var(--heading-font);
  font-style: italic;
  font-size: var(--fs-lg);
  color: var(--text-secondary);
  margin: 0 0 var(--s-6);
  line-height: 1.4;
}

.app-text {
  color: var(--text-secondary);
  font-size: var(--fs-md);
  line-height: 1.7;
  margin: 0 0 var(--s-5);
}

/* ────────── FORM ────────── */
.app-form {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  margin-top: var(--s-5);
}

.app-input {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-family: var(--body-font);
  font-size: var(--fs-md);
  font-weight: var(--fw-body);
  padding: 14px 18px;
  /* Full width with border-box so inputs / the journal textarea fill the column
     and never push past it. (Without this the textarea fell back to its tiny
     intrinsic cols width.) */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color 0.3s var(--ease-elegant);
}

.app-input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.app-input::placeholder {
  color: var(--text-muted);
}

/* ────────── PANELS ────────── */
.app-panel {
  /* Elevated card treatment from the v2 design system: a soft plum gradient
     and a hairline gold border, instead of a flat fill. */
  background: linear-gradient(160deg, var(--card-raised), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--r-lg, 16px);
  padding: var(--s-6);
  margin-bottom: var(--s-5);
}

.app-panel-title {
  font-family: var(--heading-font);
  font-size: var(--fs-xl);
  color: var(--text-primary);
  margin: 0 0 var(--s-3);
}

.app-panel-text {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: 1.6;
  margin: 0;
}

/* ────────── STATUS MESSAGES ────────── */
.app-status {
  font-family: var(--body-font);
  font-size: var(--fs-sm);
  padding: 12px 16px;
  border-radius: var(--r-sm);
  margin-top: var(--s-4);
  display: none;
}

.app-status.show { display: block; }

.app-status-success {
  background: rgba(212,186,122,0.08);
  border: 1px solid var(--border);
  color: var(--text-accent);
}

.app-status-error {
  background: rgba(184,116,122,0.12);
  border: 1px solid rgba(184,116,122,0.4);
  color: var(--rose);
}

/* ────────── APP HEADER ────────── */
.app-signout {
  font-family: var(--body-font);
  font-size: var(--fs-xs);
  font-weight: var(--fw-label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  white-space: nowrap;
  transition: color 0.3s var(--ease-elegant);
}
.app-signout:hover { color: var(--text-accent); }

/* The unified top nav (navigation.js) is position:fixed and shared with the
   public site, so dashboard pages just need top clearance under it. The old
   left-sidebar layout is gone. */
.app-shell { padding-top: calc(var(--s-8) + var(--s-5)); }
@media (max-width: 860px) {
  .app-shell { padding-top: calc(var(--s-7) + var(--s-5)); }
}

/* ────────── SIGIL ────────── */
.app-sigil {
  width: 80px;
  height: 80px;
  margin-bottom: var(--s-5);
  opacity: 0.85;
}

/* ────────── STREAK ────────── */
/* Quiet, earned, never alarming. A small gold mark + count, with an optional
   one-line note for milestones or a used freeze (see VOICE.md: warm, no guilt). */
.app-streak {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
}
.app-streak-flame {
  color: var(--gold-bright);
  font-size: var(--fs-md);
  text-shadow: 0 0 8px var(--gold-glow);
}
.app-streak-count {
  font-family: var(--accent-font, var(--body-font));
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-accent);
}
.app-streak-note {
  font-family: var(--heading-font);
  font-style: italic;
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-bottom: var(--s-3);
}

/* ────────── DAILY ORACLE ────────── */
/* Today's pull. The lit/ sigil art already carries its own glow, so the disc
   stays a plain framed medallion (no extra drop-shadow). */
.app-oracle {
  background: linear-gradient(160deg, var(--card-raised), var(--card));
  border-color: var(--border);
}
.app-oracle-head {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  margin: var(--s-3) 0 var(--s-4);
}
.app-oracle-sigil {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  object-fit: contain;
}
.app-oracle-name { margin-bottom: 0; }
.app-oracle-reflection {
  font-family: var(--heading-font);
  font-style: italic;
  font-size: var(--fs-lg);
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: var(--s-4);
}

/* ────────── TYPE HEADER ────────── */
.app-type-head {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  margin-bottom: var(--s-5);
}

.app-type-head .app-sigil {
  margin-bottom: 0;
  flex-shrink: 0;
}

.app-type-head .app-title { margin-bottom: var(--s-2); }
.app-type-head .app-subtitle { margin-bottom: 0; }

/* ────────── ROUTINE BLOCKS ────────── */
.app-routine-block {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-5);
  margin-bottom: var(--s-3);
}

.app-routine-time {
  font-family: var(--body-font);
  font-size: var(--fs-xxs);
  font-weight: var(--fw-label);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-accent);
  margin: 0 0 var(--s-1);
}

.app-routine-title {
  font-family: var(--heading-font);
  font-size: var(--fs-xl);
  font-weight: 400;
  color: var(--text-primary);
  margin: 0 0 var(--s-2);
}

.app-routine-body {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: 1.65;
  margin: 0;
}

/* ────────── JOURNAL ENTRIES ────────── */
.app-entry {
  border-left: 2px solid var(--border);
  padding: var(--s-2) 0 var(--s-2) var(--s-4);
  margin-bottom: var(--s-5);
}

.app-entry-date {
  font-family: var(--body-font);
  font-size: var(--fs-xs);
  font-weight: var(--fw-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--s-2);
}

.app-entry-body {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: 1.65;
  margin: 0;
  white-space: pre-wrap;
}

/* ────────── TOOLS ────────── */
.app-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  margin-bottom: var(--s-6);
}

.app-tool-link {
  font-family: var(--body-font);
  font-size: var(--fs-xs);
  font-weight: var(--fw-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-accent);
  text-decoration: none;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  transition: border-color 0.3s var(--ease-elegant);
}

.app-tool-link:hover { border-color: var(--gold-dim); }

.app-mini-label {
  font-family: var(--body-font);
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  margin-bottom: calc(-1 * var(--s-2));
}

/* ────────── DECODER RESULT ────────── */
.app-decode-result {
  margin-top: var(--s-6);
}

.app-decode-head {
  font-family: var(--heading-font);
  font-size: var(--fs-lg);
  color: var(--text-accent);
  margin: var(--s-5) 0 var(--s-2);
}

.app-decode-body {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: 1.7;
  margin: 0 0 var(--s-3);
}

/* ────────── TRIGGERED FAB + MODAL ────────── */
.app-triggered-fab {
  position: fixed;
  bottom: var(--s-5);
  right: var(--s-5);
  z-index: 40;
  background: linear-gradient(135deg, rgba(184,116,122,0.22), rgba(184,116,122,0.10));
  border: 1px solid rgba(184,116,122,0.5);
  color: var(--rose);
  font-family: var(--body-font);
  font-size: var(--fs-xs);
  font-weight: var(--fw-label);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 20px;
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: all 0.3s var(--ease-elegant);
}

.app-triggered-fab:hover { background: rgba(184,116,122,0.28); }

/* Coach has a sticky composer at the bottom; float the FAB above it. */
.app-triggered-fab--lifted { bottom: 92px; }

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 5, 8, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4);
}

/* The class sets display:flex, which would otherwise override the [hidden]
   attribute's display:none. Make hidden win so the modal stays closed. */
.app-modal[hidden] { display: none; }

.app-modal-card {
  position: relative;
  background: var(--card-raised);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--s-6);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.app-modal-close {
  position: absolute;
  top: var(--s-3);
  right: var(--s-4);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.app-modal-close:hover { color: var(--text-primary); }

.app-modal-reading {
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--heading-font);
  font-size: var(--fs-lg);
  font-style: italic;
  line-height: 1.55;
  white-space: pre-wrap;
}

/* ────────── FAMILY MAP ────────── */
.app-people {
  margin-top: var(--s-6);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.app-person {
  background: var(--card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--s-5);
}

.app-person-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-3);
}

.app-person-name {
  font-family: var(--heading-font);
  font-size: var(--fs-xl);
  color: var(--text-primary);
  display: block;
}

.app-person-rel {
  font-family: var(--body-font);
  font-size: var(--fs-xs);
  font-weight: var(--fw-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-top: var(--s-1);
}

.app-person-del {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--body-font);
  font-size: var(--fs-xs);
  cursor: pointer;
  flex-shrink: 0;
}
.app-person-del:hover { color: var(--rose); }

.app-person-read {
  margin-top: var(--s-4);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-accent);
  font-family: var(--body-font);
  font-size: var(--fs-xs);
  font-weight: var(--fw-label);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  transition: border-color 0.3s var(--ease-elegant);
}
.app-person-read:hover:not(:disabled) { border-color: var(--gold-dim); }
.app-person-read:disabled { opacity: 0.5; cursor: default; }

.app-person-reading {
  margin-top: var(--s-4);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ────────── PROGRAM PROGRESS ────────── */
.app-progress {
  margin: var(--s-5) 0 var(--s-6);
}

.app-progress-bar {
  height: 6px;
  background: var(--border-subtle);
  border-radius: var(--r-pill);
  overflow: hidden;
}

.app-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: var(--r-pill);
  transition: width 0.6s var(--ease-elegant);
}

.app-progress-label {
  font-family: var(--body-font);
  font-size: var(--fs-xs);
  font-weight: var(--fw-label);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: var(--s-3) 0 0;
}

/* ────────── COACH CHAT ────────── */
.app-coach-shell { min-height: 100vh; }

.app-thread {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin: var(--s-5) 0;
  min-height: 200px;
}

.app-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  line-height: 1.6;
  white-space: pre-wrap;
}

.app-bubble-user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(212,186,122,0.16), rgba(212,186,122,0.06));
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.app-bubble-assistant {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.app-bubble-pending::after {
  content: '…';
  color: var(--text-muted);
}

.app-coach-form {
  display: flex;
  gap: var(--s-3);
  align-items: flex-end;
  position: sticky;
  bottom: var(--s-4);
  background: var(--void);
  padding-top: var(--s-3);
}

.app-coach-form .app-input { flex: 1; }
.app-coach-form .begin-btn { padding: 14px 24px; white-space: nowrap; }

/* ────────── MIRROR LETTER ────────── */
.app-letter {
  margin-top: var(--s-6);
  padding-top: var(--s-6);
  border-top: 1px solid var(--border-subtle);
}

.app-letter p {
  font-family: var(--heading-font);
  font-size: var(--fs-lg);
  line-height: 1.7;
  color: var(--text-primary);
  margin: 0 0 var(--s-5);
}

.app-letter p:first-child::first-letter {
  font-size: 3.4em;
  float: left;
  line-height: 0.8;
  padding: 6px 10px 0 0;
  color: var(--text-accent);
}

/* ────────── LOADING STATES ────────── */
.app-loading {
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  font-family: var(--heading-font);
  font-size: var(--fs-lg);
  padding: var(--s-8) 0;
}

/* ── Phase 4: upgrade modal (reuses .app-modal / .app-modal-card) ── */
.app-upgrade-card {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 1px var(--gold-dim), 0 12px 48px var(--gold-glow);
  max-width: 460px;
}
.app-upgrade-actions {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.app-upgrade-actions .begin-btn { width: 100%; text-align: center; }
.app-upgrade-compare {
  display: block;
  text-align: center;
  margin-top: var(--s-4);
  font-family: var(--body-font);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  text-decoration: none;
}
.app-upgrade-compare:hover { color: var(--text-accent); }

/* ────────── TOOL IDENTITY (accent + glyph) ────────── */
/* Each tool carries a colour family — gold (daily ritual), amethyst (depth &
   time), rose (people) — and an astral glyph, so tools read at a glance both
   in the home hub and on their own pages. .tool-accent-* sets --tool; every
   other rule reads from it, so recolouring or reskinning is a one-line change.
   See app/tools.js for the registry that fills these. */
.tool-accent-gold     { --tool: var(--gold); }
.tool-accent-amethyst { --tool: var(--amethyst); }
.tool-accent-rose     { --tool: var(--rose); }

.tool-glyph {
  flex: none;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: var(--r-pill);
  color: var(--tool);
  border: 1px solid color-mix(in srgb, var(--tool) 42%, transparent);
  background: color-mix(in srgb, var(--tool) 9%, transparent);
}
.tool-glyph svg { width: 28px; height: 28px; display: block; }

/* Tool head: the identity block at the top of each tool page. */
.tool-head {
  display: flex;
  gap: var(--s-4);
  align-items: center;
  margin-bottom: var(--s-5);
}
.tool-head .app-kicker { color: var(--tool); }
.tool-head .app-title { margin: 2px 0 4px; }
.tool-blurb { color: var(--text-secondary); font-size: var(--fs-sm); margin: 0; }

/* Home hub: the "where to next" map of every tool. */
.tool-hub {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--s-3);
  margin-top: var(--s-4);
}
.tool-card {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: border-color .25s var(--ease-elegant), background .25s var(--ease-elegant), transform .25s var(--ease-elegant);
}
.tool-card:hover {
  border-color: color-mix(in srgb, var(--tool) 55%, transparent);
  background: color-mix(in srgb, var(--tool) 7%, transparent);
  transform: translateY(-2px);
}
.tool-card .tool-glyph { width: 42px; height: 42px; }
.tool-card .tool-glyph svg { width: 22px; height: 22px; }
.tool-card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tool-card-name { color: var(--text-primary); font-family: var(--heading-font); font-size: var(--fs-md); line-height: 1.15; }
.tool-card-blurb { color: var(--text-muted); font-size: var(--fs-xs); line-height: 1.3; }

/* Family groups on the home hub: each colour family gets its own labelled row
   so the nine tools read as three small neighbourhoods, and the label is tinted
   to the family colour (set by .tool-accent-* → --tool). */
.tool-hub-groups { margin-top: var(--s-4); }
.tool-family + .tool-family { margin-top: var(--s-5); }
.tool-family-label { color: var(--tool); margin-bottom: 0; }
.tool-family .tool-hub { margin-top: var(--s-2); }

/* "Try free" tag on a gated tool card: same quiet language as the nav, so the
   hub itself shows what has a free taste instead of hiding it until a wall. */
.tool-tryfree {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--accent-font);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tool);
  border: 1px solid color-mix(in srgb, var(--tool) 45%, transparent);
  border-radius: 999px;
  padding: 1px 7px;
  line-height: 1.5;
  vertical-align: middle;
}

/* End-of-flow pointer: where to go after finishing with a tool. */
.tool-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--s-6);
  color: var(--tool);
  text-decoration: none;
  font-family: var(--accent-font);
  font-size: var(--fs-xs);
  letter-spacing: .12em;
  text-transform: uppercase;
  transition: gap .2s var(--ease-elegant);
}
.tool-next:hover { gap: 13px; }
.tool-next-label { color: var(--text-muted); }

/* ────────── MOBILE ────────── */
@media (max-width: 600px) {
  .app-shell { padding: var(--s-6) var(--s-4) calc(var(--s-6) + 72px); }
  /* Let the type header wrap instead of forcing a wide row. */
  .app-type-head { flex-wrap: wrap; gap: var(--s-4); }
  /* Long words / pasted links in journal entries must wrap, not widen the page. */
  .app-entry-body, .app-panel-text, .app-text { overflow-wrap: break-word; }
  /* Tighten the tool hub so the dashboard is less of a long scroll. */
  .tool-card { padding: var(--s-3); }
  .tool-family + .tool-family { margin-top: var(--s-4); }
}
