/* ============================================================
   THE IVY REVIEW®: App shell + component kit
   Product UI (logged in), not a marketing page. Mobile-first.
   Layout: fixed top bar; bottom tab bar on phones (<=720px);
   left sidebar on wider screens (>720px). Component kit is the
   shared vocabulary every feature reuses: .btn .card .list-row
   .field/.input/.select .pill .empty-state .skeleton .toast
   .badge .stat. Tokens come from tokens.css.
   Banned (per brief): gradient text, default glassmorphism,
   side-stripe accent borders, over-rounded cards.
   ============================================================ */

*{box-sizing:border-box;margin:0;padding:0}
html{
  -webkit-text-size-adjust:100%;
  /* WCAG 2.4.11 (focus not obscured): reserve room for the fixed top bar and
     bottom tab bar so a keyboard-focused element scrolled into view doesn't
     land underneath them. */
  scroll-padding-top:calc(var(--topbar-h) + var(--safe-t) + 12px);
  scroll-padding-bottom:calc(var(--nav-h) + var(--safe-b) + 12px);
}
body{
  font-family:var(--font-body);
  font-size:16px;line-height:1.6;
  color:var(--ink);background:var(--navy-050);
  -webkit-font-smoothing:antialiased;
  touch-action:manipulation;
  min-height:100dvh;
}
img,svg{max-width:100%;display:block}
button{font:inherit;color:inherit;touch-action:manipulation;cursor:pointer;background:none;border:none}
a{color:var(--navy-700);text-decoration:none}
h1,h2,h3,h4{font-family:var(--font-display);font-weight:400;line-height:1.15;color:var(--navy-900);letter-spacing:.004em}
sup.rm{font-size:.5em;vertical-align:super;letter-spacing:0}

/* Visible focus everywhere (WCAG 2.2). --focus-ring (not --brass) is used here:
   plain --brass drops to 2.84:1 on navy-050 / 2.95:1 on paper, both common
   surfaces, which fails the 3:1 non-text contrast a focus indicator needs. */
:focus-visible{outline:2px solid var(--focus-ring);outline-offset:2px;border-radius:2px}
::selection{background:var(--navy-100);color:var(--navy-900)}

.skip-link{
  position:fixed;left:8px;top:-48px;z-index:var(--z-toast);
  background:var(--navy-900);color:var(--white);padding:.6rem 1rem;border-radius:var(--radius-input);
  transition:top var(--dur-1) var(--ease-swift);
}
.skip-link:focus{top:calc(8px + var(--safe-t))}

/* ============ Top bar ============ */
.topbar{
  position:fixed;top:0;left:0;right:0;z-index:var(--z-topbar);
  height:calc(var(--topbar-h) + var(--safe-t));
  padding:var(--safe-t) max(1rem,var(--safe-r)) 0 max(1rem,var(--safe-l));
  display:flex;align-items:center;justify-content:space-between;gap:1rem;
  background:var(--navy-900);color:var(--white);
  border-bottom:1px solid var(--line-navy);
}
.topbar-brand{
  font-family:var(--font-display);font-size:1.12rem;letter-spacing:.01em;
  color:var(--white);white-space:nowrap;
}
.topbar-brand:hover{color:var(--brass-bright)}

/* User menu */
.usermenu{position:relative}
.usermenu-btn{
  display:inline-flex;align-items:center;gap:.5rem;
  padding:.3rem .5rem;border-radius:999px;min-height:40px;
  color:var(--on-navy);
}
.usermenu-btn:hover{background:rgba(255,255,255,.08)}
.avatar{
  width:30px;height:30px;border-radius:50%;flex:none;
  display:grid;place-items:center;
  background:var(--brass);color:var(--navy-950);
  font-size:.78rem;font-weight:700;letter-spacing:.02em;
}
.usermenu-name{font-size:.9rem;font-weight:500;color:var(--white);max-width:9rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.usermenu-btn .chev{color:var(--on-navy-dim)}
.usermenu-pop{
  position:absolute;top:calc(100% + 8px);right:0;z-index:var(--z-dropdown);
  min-width:230px;background:var(--white);color:var(--ink);
  border:1px solid var(--line);border-radius:var(--radius-card);
  box-shadow:var(--shadow-pop);overflow:hidden;padding:.35rem;
}
.usermenu-id{display:flex;flex-direction:column;gap:.1rem;padding:.6rem .7rem;border-bottom:1px solid var(--line);margin-bottom:.3rem}
.usermenu-id-name{font-weight:600;font-size:.92rem}
.usermenu-id-email{font-size:.8rem;color:var(--ink-soft);overflow:hidden;text-overflow:ellipsis}
.usermenu-item{
  display:block;width:100%;text-align:left;
  padding:.6rem .7rem;border-radius:var(--radius-input);
  font-size:.92rem;color:var(--ink);
}
.usermenu-item:hover{background:var(--navy-050)}
.usermenu-danger{color:var(--error)}
.usermenu-danger:hover{background:#fbece9}

/* ============ Layout: view + nav ============ */
.view{
  min-height:100dvh;
  padding:calc(var(--topbar-h) + var(--safe-t) + 1.1rem) max(1rem,var(--safe-r)) calc(var(--nav-h) + var(--safe-b) + 1.5rem) max(1rem,var(--safe-l));
  max-width:920px;margin-inline:auto;
}
body:not(.is-authed) .view{padding-bottom:2rem}

/* Bottom tab bar (phones, default) */
.app-nav{
  position:fixed;left:0;right:0;bottom:0;z-index:var(--z-appnav);
  background:var(--white);border-top:1px solid var(--line);
  padding-bottom:var(--safe-b);
}
.appnav-list{
  list-style:none;display:flex;
  gap:0;align-items:stretch;
  overflow-x:auto;overflow-y:hidden;
  -webkit-overflow-scrolling:touch;scrollbar-width:none;
}
.appnav-list::-webkit-scrollbar{display:none}
/* Phones: a single row of tabs that scrolls horizontally. This keeps the bar
   exactly one --nav-h tall no matter how many sections exist, so the view's
   bottom padding (reserved for one row) is always correct. Each tab holds a
   fixed slice so ~4 are visible at a time and the rest scroll into view. */
.appnav-item{flex:0 0 auto}
.appnav-link{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.2rem;
  width:24vw;max-width:6rem;min-width:4.4rem;
  min-height:var(--nav-h);padding:.5rem .25rem;
  color:var(--ink-soft);font-size:.66rem;font-weight:500;letter-spacing:.01em;
  text-align:center;
}
.appnav-icon{display:grid;place-items:center}
.appnav-icon svg{width:22px;height:22px}
.appnav-link:hover{color:var(--navy-800)}
.appnav-link[aria-current="page"]{color:var(--navy-900);font-weight:600}
.appnav-link[aria-current="page"] .appnav-icon{color:var(--brass-deep)}
.appnav-label{line-height:1.1}

/* ============ Wider screens: left sidebar ============ */
@media (min-width:721px){
  .app-nav{
    top:calc(var(--topbar-h) + var(--safe-t));bottom:0;right:auto;
    width:var(--sidebar-w);
    border-top:none;border-right:1px solid var(--line);
    padding:1rem .75rem calc(1rem + var(--safe-b));
    overflow-y:auto;
  }
  .appnav-list{display:grid;grid-template-columns:1fr;gap:.15rem;overflow:visible}
  .appnav-item{flex:initial}
  .appnav-link{
    flex-direction:row;justify-content:flex-start;gap:.85rem;
    width:auto;max-width:none;min-width:0;
    min-height:44px;padding:.6rem .8rem;border-radius:var(--radius-input);
    font-size:.94rem;text-align:left;
  }
  .appnav-icon svg{width:20px;height:20px}
  .appnav-link:hover{background:var(--navy-050)}
  .appnav-link[aria-current="page"]{background:var(--navy-050)}
  .view{
    margin-left:var(--sidebar-w);max-width:none;
    padding-left:max(2rem,var(--safe-l));padding-right:max(2rem,var(--safe-r));
    padding-bottom:calc(var(--safe-b) + 2rem);
  }
  .view > *{max-width:860px;margin-inline:auto}
}

/* ============ Page header (features use this) ============ */
.page-head{margin-bottom:1.4rem}
.page-head h1{font-size:clamp(1.6rem,4vw,2.1rem)}
.page-head .page-sub{margin-top:.35rem;color:var(--ink-soft);font-size:.96rem}
.eyebrow{
  display:inline-flex;align-items:center;gap:.6rem;
  font-size:.7rem;font-weight:600;letter-spacing:.2em;text-transform:uppercase;
  color:var(--brass-deep);margin-bottom:.6rem;
}

/* ============ Buttons ============ */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:.5rem;
  min-height:44px;padding:.6rem 1.15rem;
  font-size:.94rem;font-weight:600;letter-spacing:.01em;
  border-radius:var(--radius-input);border:1px solid transparent;
  color:var(--navy-900);background:var(--white);
  transition:background var(--dur-1) var(--ease-swift),border-color var(--dur-1),color var(--dur-1),transform var(--dur-1);
}
.btn:hover{transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn:disabled{opacity:.55;cursor:not-allowed;transform:none}
.btn-primary{background:var(--navy-900);color:var(--white);border-color:var(--navy-900)}
.btn-primary:hover{background:var(--navy-800)}
.btn-ghost{background:transparent;border-color:var(--line);color:var(--navy-800)}
.btn-ghost:hover{background:var(--navy-050);border-color:var(--navy-100)}
.btn-danger{background:transparent;border-color:var(--line);color:var(--error)}
.btn-danger:hover{background:#fbece9;border-color:#f0cfc8}
.btn-block{width:100%}
.btn-sm{min-height:36px;padding:.4rem .8rem;font-size:.86rem}

.linkish{
  display:inline-block;color:var(--navy-700);font-weight:500;font-size:.9rem;
  text-decoration:underline;text-underline-offset:3px;text-decoration-thickness:1px;
  padding:.3rem 0;background:none;border:none;
}
.linkish:hover{color:var(--brass-deep)}

/* ============ Cards ============ */
.card{
  background:var(--white);border:1px solid var(--line);
  border-radius:var(--radius-card);padding:1.15rem 1.2rem;
  box-shadow:var(--shadow-1);
}
.card + .card{margin-top:.9rem}
.card-head{display:flex;align-items:baseline;justify-content:space-between;gap:1rem;margin-bottom:.6rem}
.card-head h2,.card-head h3{font-size:1.15rem}
.card-title{font-family:var(--font-display);font-size:1.15rem;color:var(--navy-900)}

/* ============ List rows ============ */
.list{display:flex;flex-direction:column;gap:.5rem}
.list-row{
  display:flex;align-items:center;gap:.9rem;
  background:var(--white);border:1px solid var(--line);
  border-radius:var(--radius-card);padding:.85rem 1rem;
  min-height:56px;
  transition:border-color var(--dur-1),box-shadow var(--dur-1);
}
a.list-row:hover,.list-row.is-link:hover{border-color:var(--navy-100);box-shadow:var(--shadow-1)}
.list-row-main{flex:1;min-width:0}
.list-row-title{font-weight:600;color:var(--navy-900);overflow:hidden;text-overflow:ellipsis}
.list-row-sub{font-size:.85rem;color:var(--ink-soft);margin-top:.15rem}
.list-row-end{flex:none;color:var(--ink-soft);font-size:.85rem;display:flex;align-items:center;gap:.5rem}

/* ============ Fields ============ */
.field{margin-bottom:1rem}
.field-label{display:block;font-size:.85rem;font-weight:600;color:var(--navy-800);margin-bottom:.35rem}
.field-hint{font-size:.8rem;color:var(--ink-soft);margin-top:.3rem}
.input,.select,textarea.input{
  width:100%;min-height:44px;padding:.6rem .75rem;
  font:inherit;font-size:.95rem;color:var(--ink);
  background:var(--white);border:1px solid var(--line);
  border-radius:var(--radius-input);
  transition:border-color var(--dur-1),box-shadow var(--dur-1);
}
textarea.input{min-height:120px;resize:vertical;line-height:1.55}
.input:focus,.select:focus,textarea.input:focus{
  outline:none;border-color:var(--focus-ring);
  box-shadow:0 0 0 3px rgba(141,124,79,.18);
}
.input::placeholder{color:#6B7280}  /* was #8a97ab (2.96:1 on white, fails 4.5:1); 4.83:1 now */
.select{appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2341506B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right .7rem center;padding-right:2.2rem}
.field-check{display:flex;align-items:flex-start;gap:.6rem}
.check{width:24px;height:24px;flex:none;margin-top:.05rem;accent-color:var(--navy-800)}  /* 2.5.8: >=24x24 target (was 20x20) */
.check-label{font-size:.9rem;color:var(--ink-soft);line-height:1.5}
.check-label a{text-decoration:underline;text-underline-offset:2px}
.form-error{color:var(--error);font-size:.88rem;margin:.2rem 0 .8rem;min-height:1.1em}

/* ============ Pills / badges ============ */
.pill{
  display:inline-flex;align-items:center;gap:.4rem;
  padding:.28rem .7rem;border-radius:999px;
  font-size:.76rem;font-weight:600;letter-spacing:.02em;
  background:var(--navy-050);color:var(--navy-800);border:1px solid var(--line);
}
.pill-brass{background:#f6f1e5;color:var(--brass-deep);border-color:#e6dcc4}
.pill-success{background:#e7f2eb;color:var(--success);border-color:#c8e3d3}
.pill-error{background:#fbece9;color:var(--error);border-color:#f0cfc8}
.pill-muted{background:transparent;color:var(--ink-soft)}
.badge{
  display:inline-grid;place-items:center;min-width:20px;height:20px;padding:0 .35rem;
  border-radius:999px;background:var(--brass);color:var(--navy-950);
  font-size:.72rem;font-weight:700;
}

/* ============ Stat tiles ============ */
.stat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.8rem}
.stat{
  background:var(--white);border:1px solid var(--line);
  border-radius:var(--radius-card);padding:1rem 1.1rem;box-shadow:var(--shadow-1);
}
.stat-value{font-family:var(--font-display);font-size:1.9rem;color:var(--navy-900);line-height:1}
.stat-label{margin-top:.4rem;font-size:.8rem;color:var(--ink-soft);letter-spacing:.02em}

/* ============ Empty state ============ */
.empty-state{
  text-align:center;padding:3rem 1.2rem;max-width:32rem;margin-inline:auto;
  color:var(--ink-soft);
}
.empty-state h2{font-size:1.35rem;margin-bottom:.5rem}
.empty-state p{margin:0 auto 1.1rem;max-width:38ch}

/* ============ Skeleton loader ============ */
.skeleton{
  border-radius:var(--radius-input);
  background:linear-gradient(100deg,var(--navy-050) 30%,#e9eef6 50%,var(--navy-050) 70%);
  background-size:200% 100%;
  animation:sk 1.3s var(--ease-swift) infinite;
}
.skeleton-row{height:56px;margin-bottom:.6rem}
@keyframes sk{from{background-position:200% 0}to{background-position:-200% 0}}

/* ============ Toasts ============ */
.toast-host{
  position:fixed;left:50%;transform:translateX(-50%);
  bottom:calc(var(--nav-h) + var(--safe-b) + 12px);z-index:var(--z-toast);
  display:flex;flex-direction:column;gap:.5rem;align-items:center;
  width:max-content;max-width:min(92vw,26rem);pointer-events:none;
}
@media (min-width:721px){.toast-host{bottom:calc(var(--safe-b) + 18px)}}
.toast{
  pointer-events:auto;
  padding:.7rem 1rem;border-radius:var(--radius-input);
  background:var(--navy-900);color:var(--white);
  font-size:.9rem;box-shadow:var(--shadow-pop);
  opacity:0;transform:translateY(8px);
  transition:opacity var(--dur-1) var(--ease-swift),transform var(--dur-1) var(--ease-swift);
}
.toast.is-in{opacity:1;transform:translateY(0)}
.toast-success{background:var(--success)}
.toast-error{background:var(--error)}

/* ============ Auth views ============ */
.auth{max-width:26rem;margin:1rem auto 0;display:flex;flex-direction:column;align-items:center}
.auth-brand{margin:.5rem 0 1.4rem;text-align:center}
.auth-wordmark{font-family:var(--font-display);font-size:1.5rem;color:var(--navy-900)}
.auth-card{width:100%;padding:1.5rem 1.4rem}
.auth-head{margin-bottom:1.2rem}
.auth-title{font-size:1.5rem}
.auth-sub{margin-top:.4rem;color:var(--ink-soft);font-size:.92rem}
.auth-copy{color:var(--ink-soft);font-size:.95rem;line-height:1.6}
.auth-form{margin-top:.4rem}
.auth-links{display:flex;flex-wrap:wrap;justify-content:space-between;gap:.6rem;margin-top:1.1rem}
.auth-foot{margin-top:1.4rem;font-size:.78rem;color:var(--ink-soft);text-align:center}

/* ============ Motion preferences ============ */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms!important;animation-iteration-count:1!important;transition-duration:.001ms!important;scroll-behavior:auto!important}
  .skeleton{animation:none;background:var(--navy-050)}
}

/* ============================================================
   FEATURE: essays  (scoped block, appended by app/js/features/essays.js)
   Reuses .card/.btn/.field/.pill/.list-row/.page-head/.empty-state
   where possible; the rules below cover only what the essay
   workspace adds: the "you write" callout, meta chips, the editor
   action bar + word count, and the founder note thread.
   ============================================================ */
.essay-backlink{display:inline-flex;align-items:center;gap:.3rem;text-decoration:none;margin-bottom:.9rem}
.essay-backlink svg{width:18px;height:18px}
.essay-chev{display:inline-flex;color:var(--ink-soft)}

.essay-note{
  background:var(--paper);border:1px solid var(--line);
  border-radius:var(--radius-card);padding:.9rem 1.05rem;margin-bottom:1.2rem;
}
.essay-note .eyebrow{margin-bottom:.35rem}
.essay-note p{color:var(--ink-soft);font-size:.9rem;line-height:1.55;margin:0}

.essay-meta{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;margin:.1rem 0 1.2rem}
.essay-meta .muted{color:var(--ink-soft);font-size:.82rem}

.essay-wordcount{font-size:.8rem;color:var(--ink-soft);margin-top:.35rem}

.essay-actions{display:flex;flex-wrap:wrap;align-items:center;gap:.7rem;margin:1.3rem 0 .4rem}
.essay-actions .save-state{font-size:.82rem;color:var(--ink-soft);margin-left:auto}
.essay-actions .save-state.is-dirty{color:var(--brass-deep)}

/* Founder <-> student note thread */
.essay-thread{display:flex;flex-direction:column;gap:.7rem;margin:.3rem 0 1.1rem}
.essay-bubble{
  background:var(--white);border:1px solid var(--line);
  border-radius:var(--radius-card);padding:.75rem .9rem;box-shadow:var(--shadow-1);
}
.essay-bubble.is-founder{background:var(--navy-050);border-color:var(--navy-100)}
.essay-bubble-head{display:flex;align-items:baseline;justify-content:space-between;gap:.8rem;margin-bottom:.3rem}
.essay-bubble-who{font-size:.82rem;font-weight:700;letter-spacing:.02em;color:var(--navy-800)}
.essay-bubble.is-founder .essay-bubble-who{color:var(--brass-deep)}
.essay-bubble-when{font-size:.76rem;color:var(--ink-soft);white-space:nowrap}
.essay-bubble-body{font-size:.92rem;line-height:1.55;color:var(--ink);white-space:pre-wrap;word-break:break-word}

.essay-composer{margin-top:1rem;padding-top:1rem;border-top:1px solid var(--line)}
.essay-composer .field{margin-bottom:.7rem}

/* ============================================================
   FEATURE: messages  (app/js/features/messages.js)
   The founder message thread. All classes are .msg-* scoped and
   reuse the kit above (.btn .input .empty-state .page-head .skeleton).
   Appended here per the file-ownership rule (feature CSS lives in a
   single clearly marked block). Bubbles stay square-ish to match the
   calm Oxford brand: no pill-round, no gradient, no glass.
   ============================================================ */
.messages{display:flex;flex-direction:column}
.msg-thread{
  display:flex;flex-direction:column;gap:.5rem;
  min-height:38vh;                     /* keep the composer near the bottom on short threads */
  padding-bottom:.4rem;
}
.msg-thread[aria-busy="true"]{gap:.6rem}

/* Day divider: a small centred label pill, not a card. */
.msg-day{
  align-self:center;margin:.7rem 0 .3rem;
  padding:.2rem .7rem;border-radius:999px;
  font-size:.7rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;
  color:var(--ink-soft);background:var(--navy-100);
}

/* Message rows: a flex column, each row aligns its bubble left/right. */
.msg-row{display:flex;gap:.5rem;align-items:flex-end;width:100%}
.msg-row-mine{justify-content:flex-end}
.msg-row-founder{justify-content:flex-start}

.msg-avatar{
  width:30px;height:30px;flex:none;border-radius:50%;
  display:grid;place-items:center;align-self:flex-end;margin-bottom:2px;
  background:var(--navy-900);color:var(--brass-bright);
}

.msg-bubble{
  max-width:min(86%,44ch);
  padding:.55rem .8rem;
  border-radius:var(--radius-card);      /* 8px: on-brand, clearly a bubble not a pill */
  box-shadow:var(--shadow-1);
  position:relative;
}
.msg-row-founder .msg-bubble{
  background:var(--white);border:1px solid var(--line);color:var(--ink);
  border-bottom-left-radius:3px;         /* squared tail toward the avatar */
}
.msg-row-mine .msg-bubble{
  background:var(--navy-900);border:1px solid var(--navy-900);color:var(--white);
  border-bottom-right-radius:3px;
}

.msg-author{
  display:block;margin-bottom:.15rem;
  font-size:.72rem;font-weight:700;letter-spacing:.02em;color:var(--brass-deep);
}
.msg-text{margin:0;font-size:.95rem;line-height:1.5;white-space:pre-wrap;overflow-wrap:anywhere}
.msg-time{
  display:block;margin-top:.3rem;
  font-size:.68rem;letter-spacing:.02em;color:var(--ink-soft);text-align:right;
}
.msg-row-mine .msg-time{color:var(--on-navy-dim)}

/* Optimistic + failed states on the student's own bubble. */
.msg-row-mine.is-pending .msg-bubble{opacity:.72}
.msg-row-mine.is-failed .msg-bubble{background:#7a2417;border-color:#7a2417}
.msg-failed-label{color:#fff}
.msg-retry{
  color:#fff;background:none;border:none;padding:0;
  font:inherit;font-size:.68rem;font-weight:700;
  text-decoration:underline;text-underline-offset:2px;cursor:pointer;
  display:inline-flex;align-items:center;min-height:24px;  /* 2.5.8: text is .68rem (~11px) alone would be a <24px target */
}
.msg-retry:hover{color:var(--brass-bright)}

/* Composer: sticky to the bottom so it reads as a real "send" affordance while
   the history scrolls behind it. Its background matches the app surface so older
   messages are masked as they pass under it. */
.msg-composer{
  position:sticky;
  bottom:calc(var(--nav-h) + var(--safe-b) + .5rem);
  z-index:5;
  display:flex;gap:.55rem;align-items:flex-end;
  margin-top:.4rem;padding-top:.7rem;
  background:var(--navy-050);
  border-top:1px solid var(--line);
}
textarea.msg-input{
  flex:1 1 auto;
  min-height:44px;height:44px;max-height:40vh;
  resize:none;line-height:1.5;overflow-y:auto;
}
.msg-send{flex:none;align-self:flex-end}
.msg-send svg{transform:translateX(-1px)}

@media (min-width:721px){
  .msg-composer{bottom:calc(var(--safe-b) + .75rem)}
}

/* Screen-reader-only author prefix inside each bubble. */
.msg-sr-only{
  position:absolute;width:1px;height:1px;padding:0;margin:-1px;
  overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;
}

/* ============================================================
   FEATURE: documents (the document vault). Scoped .doc-* classes,
   appended by app/js/features/documents.js. Everything else reuses
   the shared kit (.card .field .list-row .pill .empty-state .btn).
   ============================================================ */
/* Add-document form */
.doc-form-grid{display:grid;gap:1rem;grid-template-columns:1fr}
.doc-form-grid .field{margin-bottom:0}
@media (min-width:560px){
  .doc-form-grid{grid-template-columns:1fr 1fr}
  .doc-form-grid .field-name{grid-column:1 / -1}
}
.doc-form-actions{margin-top:1.1rem;display:flex;justify-content:flex-end}
@media (max-width:559px){.doc-form-actions .btn{width:100%}}
/* Honest "file storage coming soon" attach control */
.doc-attach{
  display:flex;align-items:flex-start;gap:.8rem;flex-wrap:wrap;
  margin-top:1.1rem;padding:.9rem 1rem;
  background:var(--navy-050);border:1px dashed var(--line);border-radius:var(--radius-card);
}
.doc-attach-icon{flex:none;color:var(--navy-700)}
.doc-attach-text{flex:1;min-width:13rem;font-size:.85rem;color:var(--ink-soft);line-height:1.5}
.doc-attach-text strong{color:var(--navy-800);font-weight:600}
.doc-attach .btn{flex:none;align-self:center}
/* List section head */
.doc-sec-head{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;margin:1.7rem 0 .8rem}
.doc-sec-head h2{font-size:1.2rem}
/* Rows */
.doc-list{list-style:none}
.doc-row{gap:.85rem}
.doc-ico{
  flex:none;width:40px;height:40px;border-radius:10px;
  display:grid;place-items:center;
  background:var(--navy-050);color:var(--navy-700);border:1px solid var(--line);
}
.doc-ico svg{width:20px;height:20px}
.doc-row-end{flex-wrap:wrap;justify-content:flex-end;gap:.55rem}
/* Loading shimmer wrapper keeps skeleton rows spaced under the head */
.doc-loading{margin-top:1.7rem}

/* ============================================================
   FEATURE: home (dashboard). Scoped .home-*/.ql-* classes,
   appended by app/js/features/home.js. Reuses the shared kit
   (.card .stat .pill .list .btn .empty-state); the classes below
   only add the dashboard's grids, the deadline hero, quick-link
   tiles, capacity tiles and inline empty rows. No banned patterns:
   no gradient text, no glass, no side-stripe borders, no over-
   rounded corners.
   ============================================================ */
.home-stack{display:flex;flex-direction:column;gap:1.5rem}
.home-section-head{display:flex;align-items:baseline;justify-content:space-between;gap:1rem;margin-bottom:.7rem}
.home-section-head h2{font-size:1.15rem}
.home-actions{margin-top:1rem;display:flex;flex-wrap:wrap;gap:.6rem}

/* Deadline hero (a normal card body, just a two-column layout) */
.home-hero{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:1rem 1.5rem}
.home-hero-main{flex:1 1 16rem;min-width:0}
.home-hero-title{font-family:var(--font-display);font-size:1.3rem;color:var(--navy-900);margin-top:.5rem;line-height:1.2}
.home-hero-detail{color:var(--ink-soft);font-size:.92rem;margin-top:.4rem;line-height:1.55}
.home-hero-side{flex:none;text-align:right;min-width:5rem}
.home-hero-count{font-family:var(--font-display);font-size:2.4rem;line-height:1;color:var(--navy-900)}
.home-hero-count-label{font-size:.76rem;color:var(--ink-soft);margin-top:.35rem;letter-spacing:.02em}
.home-hero.is-overdue .home-hero-count{color:var(--error)}

/* Quick links */
.home-quicklinks{display:grid;grid-template-columns:repeat(2,1fr);gap:.7rem}
@media (min-width:560px){.home-quicklinks{grid-template-columns:repeat(3,1fr)}}
.home-quicklink{
  display:flex;flex-direction:column;gap:.4rem;min-height:88px;
  background:var(--white);border:1px solid var(--line);
  border-radius:var(--radius-card);padding:.9rem 1rem;box-shadow:var(--shadow-1);
  color:var(--navy-900);
  transition:border-color var(--dur-1),box-shadow var(--dur-1),transform var(--dur-1);
}
.home-quicklink:hover{border-color:var(--navy-100);box-shadow:var(--shadow-2);transform:translateY(-1px)}
.home-quicklink .ql-icon{color:var(--brass-deep)}
.home-quicklink .ql-icon svg{width:22px;height:22px}
.home-quicklink .ql-label{font-weight:600;font-size:.96rem}
.home-quicklink .ql-sub{font-size:.78rem;color:var(--ink-soft);line-height:1.4}

/* Growth snapshot teaser */
.home-cap-intro{color:var(--ink-soft);font-size:.92rem;line-height:1.55;margin-bottom:.9rem;max-width:52ch}
.home-cap-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:.7rem}
@media (min-width:560px){.home-cap-grid{grid-template-columns:repeat(4,1fr)}}
.home-cap{background:var(--white);border:1px solid var(--line);border-radius:var(--radius-card);padding:.9rem .95rem;box-shadow:var(--shadow-1)}
.home-cap-name{font-family:var(--font-display);font-size:1.1rem;color:var(--navy-900)}
.home-cap-desc{font-size:.78rem;color:var(--ink-soft);margin-top:.3rem;line-height:1.45}
.home-cap-state{margin-top:.7rem}

/* Inline empty rows (inside a card or under a section heading) */
.home-inline-empty{padding:.4rem 0 .2rem}
.home-inline-empty-title{font-weight:600;color:var(--navy-900)}
.home-inline-empty-body{color:var(--ink-soft);font-size:.9rem;margin-top:.25rem;line-height:1.55;max-width:48ch}

/* ============================================================
   FEATURE: roadmap  (app/js/features/roadmap.js)
   The signature screen. Scoped .rm-* classes appended by the
   roadmap feature; everything else reuses the shared kit above
   (.card .list-row .pill .field .btn .stat .empty-state .skeleton).
   Adds only the Nine Decisions journey, the milestone tracker and
   the reach/match/safe shortlist. No gradient text, no glass, no
   side-stripe borders, no over-rounded corners.
   ============================================================ */

/* Section rhythm */
.rm-section{margin-top:1.8rem}
.stat-grid + .rm-section{margin-top:1.6rem}
.rm-section-head{display:flex;align-items:baseline;justify-content:space-between;gap:1rem;margin-bottom:.75rem}
.rm-section-head h2{font-size:1.28rem}
.rm-section-count{font-size:.82rem;color:var(--ink-soft);white-space:nowrap}
.rm-addbar{margin-bottom:.9rem}

/* ---- The Nine Decisions: a connected vertical journey ---- */
.rm-journey{list-style:none;display:flex;flex-direction:column}
.rm-step{position:relative;display:flex;gap:.95rem;padding-bottom:1.15rem}
.rm-step:last-child{padding-bottom:0}
/* connector line between nodes */
.rm-step::before{content:"";position:absolute;left:17px;top:38px;bottom:2px;width:2px;background:var(--line)}
.rm-step:last-child::before{display:none}
.rm-step.is-done::before{background:var(--brass)}
.rm-step-toggle{
  flex:none;width:36px;height:36px;border-radius:50%;
  display:grid;place-items:center;
  border:2px solid var(--line);background:var(--white);color:var(--ink-soft);
  font-family:var(--font-display);font-size:1rem;line-height:1;
  transition:border-color var(--dur-1) var(--ease-swift),background var(--dur-1) var(--ease-swift),color var(--dur-1);
}
.rm-step-toggle:hover{border-color:var(--navy-100)}
.rm-step.is-done .rm-step-toggle{background:var(--brass);border-color:var(--brass);color:var(--navy-950)}
.rm-step-body{flex:1;min-width:0;padding-top:.2rem}
.rm-step-title{font-size:1.03rem;color:var(--navy-900);margin-bottom:.2rem}
.rm-step.is-done .rm-step-title{color:var(--ink-soft)}
.rm-step-desc{font-size:.9rem;color:var(--ink-soft);line-height:1.55}
.rm-note{margin-top:.6rem}
.rm-note summary{
  display:inline-block;list-style:none;cursor:pointer;
  font-size:.82rem;font-weight:500;color:var(--navy-700);
  padding:.25rem 0;text-underline-offset:3px;
}
.rm-note summary::-webkit-details-marker{display:none}
.rm-note summary:hover{color:var(--brass-deep);text-decoration:underline}
.rm-note textarea{margin-top:.45rem}

/* ---- Milestone rows + due emphasis ---- */
.rm-row-end{flex-wrap:wrap;justify-content:flex-end;gap:.55rem}
.rm-due-soon{color:var(--error);font-weight:600}
.rm-rowbtn{padding:.45rem .35rem;font-size:.84rem;color:var(--navy-700)}
.rm-rowbtn:hover{color:var(--brass-deep);text-decoration:underline}
.rm-danger,.rm-danger:hover{color:var(--error)}

/* ---- Inline add / edit forms ---- */
.rm-form{display:grid;gap:.8rem}
.rm-form .field{margin-bottom:0}
.rm-form-actions{display:flex;gap:.55rem;flex-wrap:wrap;margin-top:.2rem}
/* Milestone form widens on roomier screens: name / date / status across a row */
@media (min-width:600px){
  .rm-form-mstone{grid-template-columns:1fr 10rem 12rem;align-items:end}
  .rm-form-mstone .rm-form-actions{grid-column:1 / -1}
}

/* ============================================================
   SHARED CLASSES for the new sections (fees, sessions, support,
   notifications). Added to the shared kit (not a feature block)
   because more than one feature reuses them and the file-ownership
   rule keeps css/app.css single-owned. Same discipline as above:
   no gradient text, no default glass, no side-stripe accent borders,
   no over-rounded corners. Everything reuses the tokens.
   ============================================================ */

/* Fees: a fee line presented as a calm card, plus the pay row that
   carries the label + server-derived amount + action. Amounts are
   ALWAYS rendered from server values; the client never computes them. */
.fee-card{
  background:var(--white);border:1px solid var(--line);
  border-radius:var(--radius-card);padding:1.05rem 1.15rem;box-shadow:var(--shadow-1);
}
.fee-card + .fee-card{margin-top:.9rem}
.fee-card-head{display:flex;align-items:baseline;justify-content:space-between;gap:1rem;margin-bottom:.35rem}
.fee-card-title{font-family:var(--font-display);font-size:1.1rem;color:var(--navy-900)}
.fee-card-desc{font-size:.88rem;color:var(--ink-soft);line-height:1.55}

/* Pay row: line item + amount + optional trailing control. Used in a fee
   schedule and in a receipt. The amount is a display of a server value. */
.pay-row{
  display:flex;align-items:center;gap:.9rem;
  padding:.7rem 0;border-bottom:1px solid var(--line);
}
.pay-row:last-child{border-bottom:none}
.pay-row-main{flex:1;min-width:0}
.pay-row-label{font-weight:600;color:var(--navy-900)}
.pay-row-sub{font-size:.82rem;color:var(--ink-soft);margin-top:.15rem}
.pay-row-amount{flex:none;font-family:var(--font-display);font-size:1.05rem;color:var(--navy-900);white-space:nowrap}
.pay-row-end{flex:none;display:flex;align-items:center;gap:.6rem}
.pay-total{display:flex;align-items:baseline;justify-content:space-between;gap:1rem;margin-top:.9rem;padding-top:.9rem;border-top:1px solid var(--line)}
.pay-total-label{font-weight:600;color:var(--navy-800)}
.pay-total-amount{font-family:var(--font-display);font-size:1.3rem;color:var(--navy-900)}

/* Receipt: a confirmed-payment block. Square, quiet, on-brand. */
.receipt{
  background:var(--paper);border:1px solid var(--line);
  border-radius:var(--radius-card);padding:1.1rem 1.2rem;box-shadow:var(--shadow-1);
}
.receipt-head{display:flex;align-items:center;gap:.6rem;margin-bottom:.6rem}
.receipt-head .pill{margin-left:auto}
.receipt-title{font-family:var(--font-display);font-size:1.1rem;color:var(--navy-900)}
.receipt-meta{font-size:.82rem;color:var(--ink-soft);margin-top:.5rem;line-height:1.55}

/* Thread: a generic support/conversation stack (distinct from the founder
   .msg-thread; used by support tickets and similar). Bubbles stay square-ish. */
.thread{display:flex;flex-direction:column;gap:.7rem;margin:.3rem 0 1.1rem}
.thread-bubble{
  background:var(--white);border:1px solid var(--line);
  border-radius:var(--radius-card);padding:.75rem .9rem;box-shadow:var(--shadow-1);
}
.thread-bubble.is-mine{background:var(--navy-050);border-color:var(--navy-100)}
.thread-bubble-head{display:flex;align-items:baseline;justify-content:space-between;gap:.8rem;margin-bottom:.3rem}
.thread-bubble-who{font-size:.8rem;font-weight:700;letter-spacing:.02em;color:var(--navy-800)}
.thread-bubble-when{font-size:.74rem;color:var(--ink-soft);white-space:nowrap}
.thread-bubble-body{font-size:.92rem;line-height:1.55;color:var(--ink);white-space:pre-wrap;overflow-wrap:anywhere}

/* Notifications: a feed row. Unread carries a quiet brass dot; nothing loud. */
.notif{
  display:flex;align-items:flex-start;gap:.85rem;
  background:var(--white);border:1px solid var(--line);
  border-radius:var(--radius-card);padding:.85rem 1rem;
  min-height:56px;transition:border-color var(--dur-1),box-shadow var(--dur-1);
}
a.notif:hover,.notif.is-link:hover{border-color:var(--navy-100);box-shadow:var(--shadow-1)}
.notif.is-unread{background:var(--navy-050)}
.notif-dot{flex:none;width:9px;height:9px;border-radius:50%;margin-top:.5rem;background:transparent}
.notif.is-unread .notif-dot{background:var(--brass)}
.notif-main{flex:1;min-width:0}
.notif-title{font-weight:600;color:var(--navy-900)}
.notif.is-unread .notif-title{color:var(--navy-900)}
.notif-body{font-size:.88rem;color:var(--ink-soft);margin-top:.2rem;line-height:1.5;overflow-wrap:anywhere}
.notif-when{font-size:.76rem;color:var(--ink-soft);margin-top:.3rem}
.notif-end{flex:none;color:var(--ink-soft)}

/* Help topic: a collapsible support topic (details/summary). No marker chrome. */
.help-topic{
  background:var(--white);border:1px solid var(--line);
  border-radius:var(--radius-card);box-shadow:var(--shadow-1);
  padding:.2rem .3rem;
}
.help-topic + .help-topic{margin-top:.6rem}
.help-topic > summary{
  display:flex;align-items:center;gap:.6rem;cursor:pointer;list-style:none;
  padding:.75rem .85rem;font-weight:600;color:var(--navy-900);
  border-radius:var(--radius-input);
}
.help-topic > summary::-webkit-details-marker{display:none}
.help-topic > summary::after{
  content:"";flex:none;margin-left:auto;width:16px;height:16px;
  background:no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2341506B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  transition:transform var(--dur-1) var(--ease-swift);
}
.help-topic[open] > summary::after{transform:rotate(180deg)}
.help-topic > summary:hover{background:var(--navy-050)}
.help-topic-body{padding:.2rem .85rem 1rem;color:var(--ink-soft);font-size:.92rem;line-height:1.6}

/* Topbar notification bell (a quiet affordance; opens the notifications feed). */
.topbar-actions{display:flex;align-items:center;gap:.35rem}
.topbar-bell{
  position:relative;display:inline-grid;place-items:center;
  width:40px;height:40px;border-radius:999px;color:var(--on-navy);
}
.topbar-bell:hover{background:rgba(255,255,255,.08);color:var(--white)}
.topbar-bell svg{width:22px;height:22px}
.topbar-bell .badge{
  position:absolute;top:4px;right:4px;min-width:16px;height:16px;
  font-size:.62rem;padding:0 .25rem;border:2px solid var(--navy-900);
}

/* A single left-aligned auth link row (parent sign-in under the student form). */
.auth-links-single{justify-content:flex-start;margin-top:.4rem}

/* ---- Shortlist groups (reach / match / safe) ---- */
.rm-groups{display:grid;gap:1.1rem}
@media (min-width:760px){.rm-groups{grid-template-columns:repeat(3,1fr);align-items:start}}
.rm-group-title{
  display:flex;align-items:center;gap:.5rem;margin-bottom:.6rem;
  font-size:.74rem;font-weight:700;letter-spacing:.12em;text-transform:uppercase;color:var(--ink-soft);
}
.rm-group-n{
  display:inline-grid;place-items:center;min-width:20px;height:20px;padding:0 .35rem;
  border-radius:999px;background:var(--navy-050);color:var(--navy-800);
  font-size:.72rem;font-weight:700;letter-spacing:0;border:1px solid var(--line);
}
.rm-group-empty{font-size:.86rem;color:var(--ink-soft);padding:.2rem 0}
.rm-school{align-items:flex-start}
.rm-fit{white-space:normal;line-height:1.5;margin-top:.25rem}
.rm-school-actions{display:flex;gap:.9rem;margin-top:.55rem}

/* Data saver / low-bandwidth mode (Settings toggle sets html[data-saver="on"]).
   Suppress motion and non-essential media to save bandwidth and battery. */
html[data-saver="on"] *,
html[data-saver="on"] *::before,
html[data-saver="on"] *::after{
  animation-duration:0s !important;
  animation-iteration-count:1 !important;
  transition-duration:0s !important;
}
html[data-saver="on"] .skeleton{animation:none !important;background:var(--navy-050)}
html[data-saver="on"] [data-heavy],
html[data-saver="on"] img[data-optional]{display:none !important}
