/* Cap and Coin — design system, rebuilt top-down (Step 158, 2026-09-08).

   Mobile-first. One overlay system (<sheet-panel>) for every modal /
   drawer / sheet: sticky header with a 44px close button that never
   scrolls away, body scroll lock, no horizontal overflow, safe-area
   aware. Navigation: 4 tabs + a full Menu page on phones; a grouped
   sidebar on desktop. Every loading state uses the branded GIF.

   Layout rules that keep phones honest:
   - .main has min-width:0 (a wide child must never stretch the page)
   - cards are NOT scroll containers; only .tbl-wrap / .kanban scroll
   - overlays use 100dvh (with a 100vh fallback) and env(safe-area-*)
   - every tappable control is >= 44px tall on touch screens          */

:root {
  --bg: #f3f4f9;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef0f6;
  --border: #e4e7ef;
  --border-2: #d3d7e3;
  --text: #171a24;
  --text-2: #5a6072;
  --text-3: #8d93a6;
  --accent: #4f46e5;
  --accent-strong: #4338ca;
  --accent-soft: #eceefe;
  --gold: #d6a028;
  --gold-soft: #fdf4dc;
  --green: #0e9f6e;
  --green-soft: #e3f7ef;
  --amber: #d97706;
  --amber-soft: #fdf3e3;
  --red: #dc2626;
  --red-soft: #fdeaea;
  --blue: #2563eb;
  --blue-soft: #e8f0fe;
  --ink: #191d2e;            /* sidebar / dark surfaces */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(23,26,36,.05), 0 4px 16px rgba(23,26,36,.06);
  --shadow-lg: 0 12px 40px rgba(23,26,36,.18);
  --sidebar-w: 248px;
  --topbar-h: 54px;
  --tabbar-h: 62px;
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px;  --sp-4: 16px;  --sp-5: 22px;  --sp-6: 30px;
  --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 15px; --fs-xl: 17px; --fs-2xl: 22px;
  --tap: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI",
          Roboto, Inter, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Scroll lock while a sheet is open (iOS-safe: body becomes fixed and
   the JS restores scrollY on close). */
html.sp-lock, html.sp-lock body { overflow: hidden; }
html.sp-lock body { position: fixed; width: 100%; }

#app { min-height: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.015em; overflow-wrap: anywhere; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }
img { max-width: 100%; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ================= layout ================= */
.shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: var(--sidebar-w); background: var(--ink); color: #c8cce0;
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0;
  padding: 16px 12px 14px; z-index: 40; overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 800;
  font-size: 16px; padding: 2px 8px 14px; letter-spacing: -0.01em; line-height: 1.1;
}
.brand-logo { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.brand-logo img { width: 100%; height: 100%; display: block; }
.nav-group { margin-top: 8px; }
.nav-group .lbl {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #7d84a3; padding: 0 12px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 6px 12px; border-radius: 10px;
  color: #b4b9d2; cursor: pointer; font-weight: 500; margin-bottom: 1px; user-select: none;
  border: none; background: none; width: 100%; font-size: 14px; text-align: left; min-height: 34px;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item .ico { width: 22px; text-align: center; font-size: 16px; flex: none; }
.nav-item .badge { margin-left: auto; }
.sidebar .spacer { flex: 1; }
.sidebar .whoami { padding: 12px 12px 4px; font-size: 12.5px; color: #8d93ad; border-top: 1px solid rgba(255,255,255,.08); margin-top: 10px; }
.sidebar .whoami b { color: #d5d9ec; display: block; font-size: 13.5px; }
.sidebar .whoami a { color: #a5b4fc; }
.sidebar-progress { margin: 8px 6px 0; padding: 10px 12px; background: rgba(255,255,255,.06); border-radius: 12px; }
.sidebar-progress .t { font-size: 12px; font-weight: 700; color: #e2e5f3; }
.sidebar-progress .bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); margin: 6px 0; overflow: hidden; }
.sidebar-progress .bar i { display: block; height: 100%; background: var(--gold); border-radius: 3px; }
.sidebar-progress .s { font-size: 11.5px; color: #a3a9c4; }
.sidebar-progress a { color: #fde68a; font-weight: 600; }

.main {
  flex: 1; min-width: 0; margin-left: var(--sidebar-w);
  padding: 26px 30px 60px; max-width: 1180px;
}

/* mobile top bar */
.topbar-m { display: none; }

/* page header */
.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 20px; gap: 12px; flex-wrap: wrap;
}
.topbar > div:first-child { min-width: 0; flex: 1 1 260px; }
.topbar .sub { color: var(--text-2); font-size: 13.5px; margin-top: 3px; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ================= components ================= */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px;
  min-width: 0;
}
.card + .card { margin-top: 16px; }
.card h2 { margin-bottom: 12px; }
.card.tint { background: var(--surface-2); box-shadow: none; }
.grid { display: grid; gap: 16px; min-width: 0; }
.grid > * { min-width: 0; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.split { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.grid.split-sm { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }

.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); min-width: 0;
}
.stat .label { font-size: 12px; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 2px; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.stat .hint { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.stat.stat-link { cursor: pointer; transition: border-color .1s, box-shadow .1s; }
.stat.stat-link:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.stat.stat-link .go { font-size: 16px; color: var(--accent); vertical-align: middle; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: var(--accent); color: #fff; border: none; padding: 9px 16px;
  border-radius: 11px; font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background .12s, box-shadow .12s; min-height: 40px; line-height: 1.2;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--accent-strong); text-decoration: none; }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-2); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--red); }
.btn.gold { background: var(--gold); color: #1c1608; }
.btn.gold:hover { background: #c8931f; }
.btn.ghost { background: transparent; color: var(--accent); border: none; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 9px; min-height: 34px; }
.btn.big { padding: 12px 20px; font-size: 15.5px; min-height: 48px; border-radius: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.full { width: 100%; }
.btn .ico { font-size: 1.1em; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  border-radius: 999px; padding: 3px 10px; white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; vertical-align: middle; line-height: 1.5;
}
.chip.wrap { white-space: normal; }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.blue { background: var(--blue-soft); color: var(--blue); }
.chip.accent { background: var(--accent-soft); color: var(--accent); }
.chip.gold { background: var(--gold-soft); color: #8a6414; }
.chip.gray { background: var(--surface-3); color: var(--text-2); }
/* Step 260: a placeholder is an example, not a value — Richard: "the lighter
   filled-in values may be misleading like state says IN". */
input::placeholder, textarea::placeholder { opacity: .5; font-style: italic; }
/* Step 261: Profile record rows (awards / volunteer work / work experience). */
.rec-section { padding: 10px 0 12px; border-top: 1px solid var(--border, #2a2f45); }
.rec-section:first-of-type { border-top: 0; padding-top: 4px; }
.rec-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.rec-row { display: grid; gap: 8px; align-items: start; padding: 6px 0; border-bottom: 1px dashed var(--border, #2a2f45); }
.rec-row:last-of-type { border-bottom: 0; }
.rec-row input, .rec-row textarea { min-width: 0; width: 100%; }
/* Step 262: names and details are one-line textareas that grow (v-autogrow),
   so a long value wraps instead of hiding past the right edge. */
.rec-row textarea.rec-text { resize: none; overflow: hidden; min-height: 40px; height: 40px; line-height: 1.35; }
.rec-num { font-weight: 700; color: var(--text-2); text-align: right; padding-top: 10px; font-variant-numeric: tabular-nums; }
.rec-row .rec-x { margin-top: 4px; }
.rec-labels { padding: 0 0 2px; border-bottom: 0; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.rec-labels span:first-child { text-align: right; }
.rec-awards          { grid-template-columns: 28px minmax(0, 2fr) 80px minmax(0, 3fr) auto; }
.rec-volunteer_work  { grid-template-columns: 28px minmax(0, 2fr) minmax(0, 1.4fr) 76px minmax(0, 3fr) auto; }
.rec-work_experience { grid-template-columns: 28px minmax(0, 2fr) minmax(0, 1.4fr) 120px minmax(0, 3fr) auto; }
@media (max-width: 720px) {
  .rec-labels { display: none; }
  .rec-awards, .rec-volunteer_work, .rec-work_experience { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rec-num { grid-column: 1; grid-row: 1; text-align: left; padding-top: 6px; }
  .rec-row .rec-x { grid-column: 2; grid-row: 1; justify-self: end; margin-top: 0; }
  .rec-row .rec-wide { grid-column: 1 / -1; }
}
/* Step 262: cards laid out by a grid are spaced by its gap — the extra
   top margin pushed the second card (Schools) below the first (Basics). */
.grid > .card + .card { margin-top: 0; }
/* Step 262: Profile gets more width on a wide screen for the record rows. */
.main:has(.profile-page) { max-width: 1440px; }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
}
.badge.accent { background: var(--accent); }

input[type=text], input[type=password], input[type=date], input[type=number],
input[type=email], input[type=search], input[type=url], select, textarea {
  font-family: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1.5px solid var(--border-2); border-radius: 11px; padding: 10px 12px; outline: none;
  width: 100%; transition: border-color .12s; min-height: 44px; -webkit-appearance: none; appearance: none;
}
select { background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' fill='none' stroke='%235a6072' stroke-width='1.8' stroke-linecap='round'/></svg>"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox], input[type=radio] { -webkit-appearance: auto; appearance: auto; min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }
input[type=range] { -webkit-appearance: auto; appearance: auto; min-height: 0; width: auto; border: none; padding: 0; background: transparent; }
label.field { display: block; margin-bottom: 12px; min-width: 0; }
label.field .lbl, .lbl { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.hint { font-size: 12px; color: var(--text-3); }
textarea { resize: vertical; min-height: 70px; line-height: 1.45; }
@media (min-width: 701px) {
  input[type=text], input[type=password], input[type=date], input[type=number],
  input[type=email], input[type=search], input[type=url], select, textarea { font-size: 14.5px; min-height: 40px; padding: 9px 12px; }
}

/* tables: the wrapper scrolls, never the card or the page */
.tbl-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none; white-space: nowrap;
}
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.rowlink { cursor: pointer; }
.tbl tr.rowlink:hover td { background: var(--surface-2); }

.empty { text-align: center; color: var(--text-3); padding: 34px 16px; font-size: 14px; }
.empty .big { font-size: 34px; margin-bottom: 8px; line-height: 1.1; }
.empty .title { color: var(--text); font-weight: 700; font-size: var(--fs-xl); }
.empty p { margin: 6px auto 0; max-width: 42ch; color: var(--text-2); font-size: var(--fs-md); }
.empty .cta { margin-top: var(--sp-4); display: flex; gap: var(--sp-2); justify-content: center; flex-wrap: wrap; }

/* loading states (branded GIF) */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 28px 12px; color: var(--text-2); font-size: 14px; text-align: center; }
.loading img { width: 96px; height: 96px; border-radius: 50%; }
.loading.sm { flex-direction: row; padding: 10px 0; gap: 10px; }
.loading.sm img { width: 36px; height: 36px; }
.loading.screen { min-height: 60vh; }
.loading .t { font-weight: 600; color: var(--text); }
.loading .s { font-size: 12.5px; color: var(--text-3); max-width: 40ch; }

/* toast */
.toasts { position: fixed; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 14px); left: 50%; transform: translateX(-50%);
  z-index: 1400; display: flex; flex-direction: column; gap: 8px; align-items: center; width: calc(100% - 24px); max-width: 480px; pointer-events: none; }
.toast { background: #23273a; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg); animation: pop .18s ease; max-width: 100%; text-align: center; pointer-events: none; /* Step 174: a stack of toasts must not block the pill under it */ }
.toast.error { background: var(--red); }
@keyframes pop { from { opacity: 0; transform: translateY(8px);} }
@media (min-width: 701px) { .toasts { bottom: 28px; } }

/* ================= sheet-panel (the ONE overlay) ================= */
.sp-backdrop {
  position: fixed; inset: 0; z-index: 1000; background: rgba(15,17,26,.5);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fade .15s ease; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
@keyframes fade { from { opacity: 0; } }
.sp {
  display: flex; flex-direction: column; background: var(--surface); color: var(--text);
  width: 100%; max-width: 560px; max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; min-width: 0;
  animation: pop .18s ease;
}
.sp.sm { max-width: 440px; }
.sp.lg { max-width: 760px; }
.sp.xl { max-width: 960px; }
.sp.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; height: 100vh; height: 100dvh; max-height: none;
  width: min(560px, 94vw); max-width: none; border-radius: 0; animation: slidein .18s ease;
}
.sp.drawer.lg { width: min(720px, 94vw); }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
.sp-head {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 20px;
  border-bottom: 1px solid var(--border); background: var(--surface); min-width: 0;
}
.sp-head .grab { display: none; }
.sp-titles { flex: 1; min-width: 0; }
.sp-titles h2 { font-size: 17px; line-height: 1.25; margin: 0; }
.sp-titles .sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; overflow-wrap: anywhere; }
.sp-close {
  flex: none; width: var(--tap); height: var(--tap); border-radius: 50%; border: none;
  background: var(--surface-3); color: var(--text); font-size: 18px; cursor: pointer;
  display: grid; place-items: center; font-weight: 700;
}
.sp-close:hover { background: var(--border); }
.sp-body {
  flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 16px 20px;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain; overflow-wrap: anywhere;
}
.sp-body > :last-child { margin-bottom: 0; }
.sp-foot {
  flex: none; display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 12px 20px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--border);
  background: var(--surface);
}
.sp-foot .spacer { flex: 1; }
.sp-foot .btn { flex: 1 1 auto; }
.sp-foot .btn.small { flex: 0 0 auto; }

/* phones: everything is a bottom sheet with a grab handle */
@media (max-width: 700px) {
  .sp-backdrop { align-items: flex-end; padding: 0; }
  .sp, .sp.sm, .sp.lg, .sp.xl, .sp.drawer, .sp.drawer.lg {
    position: relative; inset: auto; width: 100%; max-width: none; height: auto;
    max-height: calc(100vh - var(--safe-top) - 28px); max-height: calc(100dvh - var(--safe-top) - 28px);
    border-radius: 22px 22px 0 0; animation: sheetup .2s ease;
  }
  .sp.tall { height: calc(100dvh - var(--safe-top) - 28px); }
  @keyframes sheetup { from { transform: translateY(40px); opacity: .6; } }
  .sp-head { padding: 8px 10px 10px 18px; flex-wrap: wrap; }
  .sp-head .grab { display: block; width: 100%; order: -1; height: 14px; position: relative; }
  .sp-head .grab::after { content: ''; position: absolute; left: 50%; top: 4px; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: var(--border-2); }
  .sp-body { padding: 14px 18px; }
  .sp-foot { padding: 10px 14px calc(12px + var(--safe-bottom)); }
}

/* confirm dialog (rendered through sheet-panel) */
.confirm-msg { font-size: 15px; color: var(--text-2); line-height: 1.5; }

/* ================= menu page + guide ================= */
.menu-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.menu-tile {
  display: flex; gap: 12px; align-items: flex-start; text-align: left; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; cursor: pointer;
  box-shadow: var(--shadow); min-height: 74px; width: 100%; color: var(--text);
}
.menu-tile:hover { border-color: var(--accent); }
.menu-tile.active { border-color: var(--accent); background: var(--accent-soft); }
.menu-tile .ico { font-size: 24px; width: 32px; text-align: center; flex: none; line-height: 1.2; }
.menu-tile .t { min-width: 0; }
.menu-tile .t b { display: block; font-size: 15px; }
.menu-tile .t span { font-size: 12.5px; color: var(--text-2); display: block; margin-top: 2px; }
.menu-step { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; }
.menu-step .n { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; flex: none; }
.menu-step h2 { font-size: 15px; }
.menu-step .why { font-size: 12.5px; color: var(--text-2); }
@media (max-width: 420px) { .menu-grid { grid-template-columns: 1fr; } .menu-tile { min-height: 0; } }

.guide-nav { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.guide-nav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--text); min-height: 36px; }
.guide-nav a:hover { border-color: var(--accent); text-decoration: none; }
.guide-sec { scroll-margin-top: calc(var(--topbar-h) + 12px); }
.guide-sec .head { display: flex; gap: 12px; align-items: flex-start; }
.guide-sec .head .ico { font-size: 28px; line-height: 1.1; flex: none; }
.guide-sec ol, .guide-sec ul { margin: 8px 0 0 20px; padding: 0; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.guide-sec li { margin-bottom: 4px; }
.guide-gif { margin: 12px auto 0; display: block; max-width: 300px; width: 100%; border-radius: 22px; border: 6px solid #1c1f2e; box-shadow: var(--shadow-lg); background: #1c1f2e; }
.guide-gif.wide { max-width: 560px; border-radius: 12px; border-width: 4px; }
.guide-caption { text-align: center; font-size: 12.5px; color: var(--text-3); margin-top: 6px; }
.faq details { border-top: 1px solid var(--border); padding: 10px 0; }
.faq details:first-of-type { border-top: none; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 14.5px; list-style: none; display: flex; justify-content: space-between; gap: 10px; min-height: 28px; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--text-3); font-weight: 700; font-size: 18px; }
.faq details[open] summary::after { content: '–'; }
.faq p { margin: 8px 0 0; color: var(--text-2); font-size: 14px; }

/* ================= start wizard ================= */
.wiz { max-width: 640px; margin: 0 auto; }
.wiz-steps { display: flex; gap: 6px; margin-bottom: 18px; }
.wiz-steps i { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); display: block; }
.wiz-steps i.on { background: var(--accent); }
.wiz-steps i.done { background: var(--green); }
.wiz h1 { font-size: 24px; margin-bottom: 4px; }
.wiz .lead { color: var(--text-2); margin-bottom: 18px; font-size: 15px; }
.opt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  border: 1.5px solid var(--border-2); background: var(--surface); border-radius: 12px; padding: 12px 14px;
  cursor: pointer; min-height: 56px; color: var(--text); font: inherit;
}
.opt b { font-size: 15px; }
.opt span { font-size: 12.5px; color: var(--text-2); }
.opt.on { border-color: var(--accent); background: var(--accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  border: 1.5px solid var(--border-2); background: var(--surface); border-radius: 999px; padding: 8px 14px;
  font-size: 14px; font-weight: 600; cursor: pointer; min-height: 40px; color: var(--text);
}
.pick.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.wiz-foot { display: flex; gap: 10px; margin-top: 22px; align-items: center; flex-wrap: wrap; }
.wiz-foot .spacer { flex: 1; }
.wiz-foot .wiz-count { font-size: var(--fs-sm); }
.wiz-foot > a.muted { white-space: nowrap; }
/* Step 303: chip groups on the "What are you into?" screen */
.wiz-group .lbl { margin-top: 4px; }
.wiz .pick { min-height: 40px; }
/* Step 303: on a phone the Back / Next row sticks above the tab bar, so the
   button is never below the fold however long the screen gets. */
@media (max-width: 900px) {
  .wiz-foot {
    position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom)); z-index: 5;
    background: rgba(255,255,255,.94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border); margin: 18px -14px 0; padding: 10px 14px; flex-wrap: nowrap;
  }
  .wiz-foot .btn.big { min-height: 44px; padding-left: 16px; padding-right: 16px; white-space: nowrap; }
  .wiz-foot .btn.secondary { padding-left: 12px; padding-right: 12px; white-space: nowrap; }
  .wiz-foot .wiz-count { display: none; }
  .startstep .btn, .guide-sec .head .btn { min-height: 40px; }
}

/* first-run card + progress (dashboard / menu) */
.startcard { border-left: 4px solid var(--gold); }
.startstep { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); min-width: 0; }
.startstep:last-child { border-bottom: none; }
.startstep .num { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--accent-soft); color: var(--accent); }
.startstep.done .num { background: var(--green-soft); color: var(--green); }
.startstep.optional .num { background: transparent; border: 1.5px dashed var(--accent); }
.startstep .t { flex: 1; min-width: 0; }
.startstep .t .title { font-weight: 650; font-size: var(--fs-lg); }
.startstep.done .t .title { color: var(--text-3); text-decoration: line-through; }
.startstep .t .why { color: var(--text-2); font-size: var(--fs-sm); }
.startstep .btn { flex: none; }
.progress-bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--green); border-radius: 4px; transition: width .3s; }

/* ================= auth ================= */
.auth-wrap {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
  background: linear-gradient(160deg, #1e1b4b 0%, #312e81 45%, #4338ca 100%);
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bottom));
}
.auth-card { background: #fff; border-radius: 22px; padding: 30px 28px 24px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); }
.auth-card .brand-logo { width: 52px; height: 52px; border-radius: 14px; margin-bottom: 12px; }
.auth-card h1 { font-size: 22px; margin-bottom: 4px; }
.auth-card .sub { color: var(--text-2); font-size: 14px; margin-bottom: 18px; }
.auth-card .links { margin-top: 14px; display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; flex-wrap: wrap; }
.auth-card .links a { color: var(--text-2); }
.auth-card .links a.primary { color: var(--accent); font-weight: 600; }
.auth-err { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 9px 13px; font-size: 13.5px; margin-bottom: 12px; }
.pw-checks { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11.5px; margin: -4px 0 10px; }
.boot { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; background: var(--ink); color: #c7d2fe; }
.boot img { width: 140px; height: 140px; border-radius: 50%; }
.boot .t { margin-top: 10px; font-weight: 600; }

/* ================= dashboard ================= */
.hello { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.task-row { display: flex; align-items: flex-start; gap: 11px; padding: 10px 2px; border-bottom: 1px solid var(--border); min-width: 0; }
.task-row:last-child { border-bottom: none; }
.task-row input[type=checkbox] { width: 20px; height: 20px; margin-top: 1px; cursor: pointer; flex: none; }
.task-row .t { flex: 1; min-width: 0; }
.task-row .t .title { font-weight: 600; font-size: 14.5px; }
.task-row .t .meta { font-size: 12.5px; color: var(--text-3); margin-top: 1px; overflow-wrap: anywhere; }
.task-row.done .t .title { text-decoration: line-through; color: var(--text-3); font-weight: 500; }
.task-row.cal-link { cursor: pointer; border-radius: var(--radius-sm); }
.task-row.cal-link:hover { background: var(--surface-2); }
.dl-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--border); min-width: 0; }
.dl-row:last-child { border-bottom: none; }
.dl-row .name { flex: 1; font-weight: 600; font-size: 14.5px; min-width: 0; overflow-wrap: anywhere; }
.dl-row .name .muted { font-weight: 500; }
.dl-row.cal-link { cursor: pointer; border-radius: var(--radius-sm); }
.dl-row.cal-link:hover { background: var(--surface-2); }
.plan-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ================= matches ================= */
.match-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 10px; cursor: pointer;
  transition: border-color .12s; min-width: 0;
}
.match-card:hover { border-color: #c9cdf0; }
.match-card .head { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.match-card .title { font-weight: 700; font-size: 15.5px; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.match-card .provider { color: var(--text-2); font-size: 13px; margin-top: 1px; overflow-wrap: anywhere; }
.match-card .row2 { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.match-card .row2 .spacer { flex: 1; }
.money { font-weight: 800; font-size: 15.5px; color: var(--green); white-space: nowrap; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type=text], .filters input[type=search] { max-width: 300px; }
.filters select { width: auto; max-width: 260px; }
.filters .count { color: var(--text-3); font-size: 13px; }
.searchrow { display: flex; gap: 8px; margin-bottom: 12px; }
.searchrow input { flex: 1; min-width: 0; }
.searchrow .btn { flex: none; }
.check { display: inline-flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); cursor: pointer; user-select: none; min-height: 28px; }
.check input { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.kv { display: flex; gap: 8px; font-size: 14px; margin-bottom: 8px; min-width: 0; }
.kv .k { color: var(--text-3); min-width: 100px; font-weight: 600; flex: none; }
.kv .v { color: var(--text); overflow-wrap: anywhere; min-width: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.reason-list { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); font-size: 13.5px; }
.reason-list li { margin-bottom: 4px; overflow-wrap: anywhere; }
.reason-list .mark { font-weight: 700; margin-right: 6px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.muted { color: var(--text-3); font-size: 13px; }
code.url { background: var(--surface-2); border: 1px solid var(--border); padding: 6px 8px; border-radius: 8px; font-size: 12.5px; word-break: break-all; display: block; }
pre.box { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow: auto; margin: 0; }

/* ================= applications / kanban ================= */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(180px, 1fr)); gap: 12px; align-items: start; overflow-x: auto; width: 100%; padding-bottom: 6px; }
.kcol { background: var(--surface-3); border-radius: 12px; padding: 10px; min-height: 120px; min-width: 0; }
.kcol h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); padding: 2px 6px 8px; display: flex; justify-content: space-between; }
.kcol.dragover { outline: 2px dashed var(--accent); outline-offset: -2px; }
.kcard { background: #fff; border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.07); cursor: grab; border: 1px solid var(--border); font-size: 13.5px; min-width: 0; }
.kcard .nm { font-weight: 650; margin-bottom: 3px; overflow-wrap: anywhere; }
.kcard .meta { color: var(--text-3); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.kcard .bar { margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.kcard .bar .track { flex: 1; background: var(--surface-3); border-radius: 3px; height: 5px; overflow: hidden; }
.kcard .bar .track i { display: block; height: 100%; background: var(--accent); }
.kcard .bar .track i.done { background: var(--green); }
.kcard .bar span { font-size: 11px; color: var(--text-3); font-weight: 600; }
.status-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.status-tabs::-webkit-scrollbar { display: none; }
.status-tabs button { flex: none; border: 1px solid var(--border-2); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--text-2); min-height: 36px; cursor: pointer; }
.status-tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.app-row { display: flex; gap: 10px; align-items: center; padding: 12px 2px; border-bottom: 1px solid var(--border); cursor: pointer; min-width: 0; }
.app-row:last-child { border-bottom: none; }
.app-row .t { flex: 1; min-width: 0; }
.app-row .nm { font-weight: 650; overflow-wrap: anywhere; }
.app-row .meta { font-size: 12.5px; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 11px; padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: none; background: transparent; padding: 7px 14px; font-size: 13.5px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--text-2); min-height: 36px; white-space: nowrap; }
.seg button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.1); }

/* ================= calendar ================= */
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.cal-head h2 { flex: 1; text-align: center; min-width: 140px; font-size: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-3); padding: 4px 0; }
.cal-cell { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; min-height: 86px; min-width: 0; padding: 6px 7px; cursor: pointer; font-size: 12px; overflow: hidden; transition: border-color .1s; }
.cal-cell:hover { border-color: var(--accent); }
.cal-cell.out { opacity: .38; }
.cal-cell.today { border-color: var(--accent); border-width: 2px; }
.cal-cell.sel { background: var(--accent-soft); border-color: var(--accent); }
.cal-cell .d { font-weight: 700; font-size: 12.5px; margin-bottom: 3px; }
.cal-pill { border-radius: 6px; padding: 1.5px 6px; margin-bottom: 3px; font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-pill.task { background: var(--accent-soft); color: var(--accent); }
.cal-pill.task.done { background: var(--surface-3); color: var(--text-3); text-decoration: line-through; }
.cal-pill.deadline { background: var(--red-soft); color: var(--red); cursor: pointer; }
.cal-more { font-size: 11px; color: var(--text-3); font-weight: 600; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-week .cal-cell { min-height: 220px; }
.cal-week .cal-cell .d { font-size: 13px; }
.cal-week .cal-cell .d small { display: block; font-weight: 600; color: var(--text-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.cal-week .cal-pill { white-space: normal; line-height: 1.3; padding: 3px 7px; }
.cal-week .cal-empty { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.cal-sch { font-weight: 600; margin-right: 6px; }
.cal-cell .dots { display: none; gap: 3px; flex-wrap: wrap; }
.cal-cell .dot { width: 6px; height: 6px; border-radius: 50%; }
.dot.task { background: var(--accent); }
.dot.deadline { background: var(--red); }
@media (max-width: 720px) {
  .cal-week { grid-template-columns: 1fr; }
  .cal-week .cal-cell { min-height: 0; }
  .cal-week .cal-pill { display: block; }
  .cal-cell { min-height: 54px; padding: 4px; }
  .cal-grid .cal-pill, .cal-grid .cal-more { display: none; }
  .cal-cell .dots { display: flex; }
}

/* ================= essays ================= */
.essay-item { display: flex; align-items: center; gap: 12px; padding: 13px 2px; border-bottom: 1px solid var(--border); cursor: pointer; min-width: 0; }
.essay-item:hover { background: var(--surface-2); }
.essay-item:last-child { border-bottom: none; }
.essay-item .t { flex: 1; min-width: 0; }
.essay-item .title { font-weight: 650; overflow-wrap: anywhere; }
.essay-item .meta { font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.editor-head { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.editor-head input.title-in { font-size: 17px; font-weight: 700; border: none; background: transparent; padding: 4px 2px; flex: 1; min-width: 180px; border-radius: 0; min-height: 0; }
.editor-head input.title-in:focus { outline: none; border-bottom: 2px solid var(--accent); box-shadow: none; }
.editor-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.editor-wrap .ql-toolbar { border: none; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.editor-wrap .ql-container { border: none; font-size: 15.5px; font-family: Georgia, serif; }
.editor-wrap .ql-editor { min-height: 380px; line-height: 1.7; padding: 22px 26px; }
.editor-meta { display: flex; gap: 14px; align-items: center; color: var(--text-3); font-size: 13px; padding: 8px 4px; flex-wrap: wrap; }
.savedot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; margin-right: 5px; }
.savedot.dirty { background: var(--amber); }
.suggest-p { border: 1px solid var(--border); border-radius: 10px; padding: 10px 13px; margin-bottom: 9px; font-size: 13.5px; background: var(--surface-2); }
.suggest-p .hd { display: flex; justify-content: space-between; gap: 8px; font-weight: 650; margin-bottom: 3px; align-items: center; }
.suggest-p .bd { color: var(--text-2); max-height: 76px; overflow: hidden; }
.prompt-ro { background: var(--surface-2); border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: var(--fs-md); line-height: 1.5; white-space: pre-wrap; color: var(--text); }
.prompt-ro.empty { color: var(--text-3); font-style: italic; }
.research-box { border: 1px solid var(--accent-soft); background: var(--accent-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 8px; font-size: var(--fs-sm); }
.research-box ul { margin: 4px 0 0 18px; padding: 0; }
.research-box li { margin: 2px 0; }
.qa-item { margin-bottom: 10px; }
.qa-item .q { font-weight: 600; font-size: var(--fs-md); }
.qa-item .why { font-size: var(--fs-xs); color: var(--text-3); margin-bottom: 4px; }
.qa-item textarea { width: 100%; min-height: 56px; }
.draft-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.draft-choice button { text-align: left; padding: 10px 12px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; color: var(--text); }
.draft-choice button:hover { border-color: var(--accent); }
.draft-choice button.on { border-color: var(--accent); background: var(--accent-soft); }
.draft-choice .h { font-weight: 700; font-size: var(--fs-md); }
.draft-choice .d { font-size: var(--fs-xs); color: var(--text-2); margin-top: 2px; }
@media (max-width: 560px) { .draft-choice { grid-template-columns: 1fr; } }
.ai-out { font-size: 13.5px; line-height: 1.55; max-height: 420px; overflow: auto; }
.meter { height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--green); }
.meter i.out { background: var(--red); }
.erq-item { border-top: 1px solid var(--border); padding: 10px 0; }
.erq-item:first-of-type { border-top: none; }
.chip.chip-1w { max-width: 200px; }
.erq-item .chip { max-width: 260px; }
.sweep-box { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; background: var(--surface-2); }

/* ================= documents ================= */
.dropzone { border: 2px dashed #c6cbe0; border-radius: var(--radius); padding: 26px 16px; text-align: center; color: var(--text-2); cursor: pointer; background: var(--surface); transition: all .12s; font-size: 14px; }
.dropzone.hover { border-color: var(--accent); background: var(--accent-soft); }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 11px 2px; border-bottom: 1px solid var(--border); flex-wrap: wrap; min-width: 0; }
.doc-row:last-child { border-bottom: none; }
.doc-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); display: grid; place-items: center; font-size: 17px; flex: none; }
.doc-row .t { flex: 1; min-width: 160px; }
.doc-row .nm { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.doc-row .meta { font-size: 12.5px; color: var(--text-3); }
.doc-row .acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* ================= misc ================= */
.applicant-pick { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--border); padding: 7px 12px; border-radius: 11px; cursor: pointer; font-weight: 600; font-size: 14px; min-height: 40px; }
.applicant-pick.on { border-color: var(--accent); background: var(--accent-soft); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.viewas { font-size: 13px; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 10px; padding: 6px 12px; margin-bottom: var(--sp-2); cursor: default; }
.viewas .show-m { display: none; }
@media (max-width: 900px) { .viewas { cursor: pointer; } .viewas .show-m { display: inline; } }
.pickrow { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.pickrow::-webkit-scrollbar { display: none; }
.pickrow .applicant-pick { flex: none; }
.iconbtn { background: none; border: none; cursor: pointer; font-size: 17px; color: var(--text-3); padding: 6px; border-radius: 9px; min-width: 36px; min-height: 36px; display: inline-grid; place-items: center; }
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.flag-btn { white-space: nowrap; }
.beta-place { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.beta-place:last-child { border-bottom: none; }
.beta-place .ico { font-size: 20px; width: 28px; text-align: center; flex: none; }
.offline-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 1500; background: var(--amber); color: #fff; text-align: center; font-size: var(--fs-sm); font-weight: 600; padding: calc(5px + var(--safe-top)) 8px 5px; }
.notice { background: var(--gold-soft); border: 1px solid #f1dfae; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13.5px; color: #5c4408; }
.notice.info { background: var(--blue-soft); border-color: #c7d9fb; color: #1e3a8a; }
.footnote { margin: 28px 4px 8px; font-size: 11px; line-height: 1.6; color: var(--text-3); }
.footnote a { color: inherit; }
.stickybar { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom)); background: rgba(255,255,255,.94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-top: 1px solid var(--border); padding: 10px 0; margin: 14px -14px 0; padding-left: 14px; padding-right: 14px; display: flex; gap: 10px; align-items: center; z-index: 5; }

/* utilities */
.row { display: flex; align-items: center; gap: var(--sp-2); min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.row.between { justify-content: space-between; }
.row.gap-3 { gap: var(--sp-3); }
.row.gap-4 { gap: var(--sp-4); }
.stack > * + * { margin-top: var(--sp-3); }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.nowrap { white-space: nowrap; }
.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); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); } .mb-4 { margin-bottom: var(--sp-4); }
.section-label { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions.end { justify-content: flex-end; }
.text-right { text-align: right; }
.small { font-size: 12.5px; }
.hide-m { }
@media (min-width: 901px) { .only-m { display: none !important; } }

/* ================= AI-working overlay ================= */
.aiwork { position: fixed; inset: 0; z-index: 1300; background: rgba(15,17,26,.55); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; animation: pop .18s ease; padding: 16px; }
.aiwork-card { background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 22px 24px 20px; width: min(94vw, 400px); text-align: center; max-height: calc(100dvh - 32px); overflow: auto; }
.aiwork-card img.gif { width: 150px; height: 150px; border-radius: 50%; display: block; margin: 0 auto 6px; }
.aiwork-title { font-weight: 700; font-size: var(--fs-xl); margin-bottom: 10px; }
.aiwork-steps { text-align: left; display: inline-block; max-width: 100%; }
.aiwork-step { font-size: var(--fs-sm); color: var(--text-3); padding: 3px 0; display: flex; align-items: center; gap: 8px; transition: color .3s; }
.aiwork-step .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; border: 1.5px solid var(--border); background: transparent; }
.aiwork-step.done { color: var(--text-2); }
.aiwork-step.done .dot { background: var(--green); border-color: var(--green); }
.aiwork-step.now { color: var(--text); font-weight: 600; }
.aiwork-step.now .dot { border-color: var(--accent); background: var(--accent); animation: aiwork-pulse 1s ease-in-out infinite; }
@keyframes aiwork-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(79,70,229,.45); } 50% { box-shadow: 0 0 0 6px rgba(79,70,229,0); } }
.aiwork-note { margin-top: 12px; font-size: var(--fs-xs); color: var(--text-3); }
/* Step 170: progress against the measured duration + background option */
.aiwork-progress { height: 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin: 2px auto 8px; max-width: 320px; }
.aiwork-progress i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .25s linear; }
.aiwork-progress.slow i { background: var(--amber, #d97706); }
.aiwork-time { font-size: var(--fs-sm); color: var(--text-2); margin-bottom: 2px; }
.aiwork-rung { font-size: var(--fs-xs); color: var(--text-3); margin-bottom: 8px; }
.aiwork-bg { margin-top: 14px; }
.aiwork-hint { margin-top: 6px; font-size: var(--fs-xs); color: var(--text-3); }
.aiwork-pill { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 76px); z-index: 1250; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-lg); padding: 8px 14px; font-size: var(--fs-sm); display: flex; align-items: center; gap: 8px; cursor: pointer; max-width: 92vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aiwork-pill .spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: aiwork-spin .8s linear infinite; flex: none; }
@keyframes aiwork-spin { to { transform: rotate(360deg); } }
@media (min-width: 701px) { .aiwork-pill { bottom: 92px; } }
.aiwork-card:has(.aiwork-debug) { width: min(96vw, 720px); }
.aiwork-debug { margin-top: 14px; text-align: left; background: #14172a; color: #d7dbea; border-radius: 10px; padding: 10px 12px; max-height: 260px; overflow: auto; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.aiwork-debug .hd { color: #9aa3c7; margin-bottom: 6px; }
.aiwork-debug .ev { display: grid; grid-template-columns: 52px 64px 1fr; gap: 8px; padding: 1px 0; }
.aiwork-debug .ev .t { color: #7f88ad; }
.aiwork-debug .ev .st { color: #a5b4fc; }
.aiwork-debug .ev.api .st { color: #f0b429; }
.aiwork-debug .ev.ladder .st { color: #34d399; }
.aiwork-debug .ev.error .d, .aiwork-debug .ev.error .st { color: #f87171; }
.aiwork-debug .ev.done .st { color: #34d399; }
.aiwork-debug .ev .d { word-break: break-word; }

/* ---- Step 174: coach notes in the editor ---- */
.editor-stage { position: relative; }
.editor-wrap .coach-mark { border-radius: 3px; padding: 1px 0; cursor: pointer; transition: background .15s, box-shadow .15s; }
.editor-wrap .coach-mark[data-kind="cut"] { background: rgba(220, 38, 38, .16); box-shadow: inset 0 -2px 0 0 rgba(220, 38, 38, .55); }
.editor-wrap .coach-mark[data-kind="shorten"], .editor-wrap .coach-mark[data-kind="change"] { background: rgba(245, 158, 11, .22); box-shadow: inset 0 -2px 0 0 rgba(217, 119, 6, .6); }
.editor-wrap .coach-mark[data-kind="good"] { background: rgba(14, 159, 110, .16); box-shadow: inset 0 -2px 0 0 rgba(14, 159, 110, .55); }
.editor-wrap .coach-mark:hover { filter: brightness(.94); }
.editor-stage.marks-hidden .coach-mark { background: transparent; box-shadow: none; cursor: text; }
.coach-pop { position: absolute; z-index: 30; width: min(360px, 100%); background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: 13.5px; line-height: 1.5; font-family: var(--font); }
.coach-pop.cut { border-left-color: var(--red); }
.coach-pop.shorten, .coach-pop.change { border-left-color: var(--amber); }
.coach-pop.good { border-left-color: var(--green); }
.coach-pop .hd { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; font-size: 12px; flex-wrap: wrap; }
.coach-pop .body { white-space: pre-line; }
.coach-pop .sug { margin-top: 6px; padding: 6px 8px; background: var(--surface-2); border-radius: 6px; font-family: Georgia, serif; }
.coach-pop .dirs { margin: 6px 0 0 16px; padding: 0; }
.coach-pop .dirs li { margin: 3px 0; }
.coach-pop .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.coach-pop .acts a { font-size: 12px; }
.coach-meta a { color: var(--text-2); }
.coach-scores { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.coach-top { margin: 0 0 8px 18px; padding: 0; font-size: 13px; }
.coach-top li { margin: 2px 0; }
.coach-legend { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--text-3); margin: 4px 0 6px; flex-wrap: wrap; }
.coach-legend .k { padding: 1px 7px; border-radius: 999px; color: var(--text); }
.coach-legend .k.cut { background: rgba(220, 38, 38, .16); }
.coach-legend .k.shorten, .coach-legend .k.change { background: rgba(245, 158, 11, .22); }
.coach-legend .k.good { background: rgba(14, 159, 110, .16); }
.coach-item { border-left: 3px solid var(--border); padding: 6px 8px; margin: 4px 0; border-radius: 4px; cursor: pointer; font-size: 13px; background: var(--surface); }
.coach-item:hover { background: var(--surface-2); }
.coach-item.cut { border-left-color: var(--red); }
.coach-item.shorten, .coach-item.change { border-left-color: var(--amber); }
.coach-item.good { border-left-color: var(--green); }
.coach-item.done, .coach-item.unplaced { opacity: .6; cursor: default; }
.coach-item .q { font-family: Georgia, serif; color: var(--text-2); margin-bottom: 2px; }
.draft-banner { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 8px; font-size: var(--fs-sm); }
.draft-banner .acts { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
/* Step 174: the pill lists every background run */
.aiwork-pill.ready { border-color: var(--green); }
.aiwork-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.aiwork-row:last-child { border-bottom: none; }
.aiwork-row .ico { width: 22px; text-align: center; flex: none; }
.aiwork-row .ico .spin { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: aiwork-spin .8s linear infinite; }
.aiwork-row .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.aiwork-row .t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aiwork-row .t span { font-size: 12px; color: var(--text-3); }
@media (max-width: 700px) { .coach-pop { left: 0 !important; width: 100%; } }

/* ================= phone layout (<= 900px) ================= */
.tabbar { display: none; }
@media (max-width: 900px) {
  .sidebar { display: none; }
  .hide-m { display: none !important; }
  .topbar-m {
    display: flex; align-items: center; gap: 8px; position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    height: calc(var(--topbar-h) + var(--safe-top)); padding: var(--safe-top) 8px 0 14px;
    background: rgba(255,255,255,.92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
  }
  .topbar-m .brand-logo { width: 28px; height: 28px; }
  .topbar-m .title { flex: 1; min-width: 0; font-weight: 800; font-size: 16px; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-m .title small { display: block; font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
  .topbar-m .ib { width: var(--tap); height: var(--tap); border-radius: 50%; border: none; background: transparent; display: grid; place-items: center; font-size: 18px; color: var(--text-2); cursor: pointer; }
  .topbar-m .ib:active { background: var(--surface-3); }
  .topbar-m .ib.who { background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; width: 34px; height: 34px; }
  .main { margin-left: 0; padding: calc(var(--topbar-h) + var(--safe-top) + 14px) 14px calc(var(--tabbar-h) + var(--safe-bottom) + 24px); max-width: none; }
  .topbar { margin-bottom: 14px; }
  .topbar .actions .btn { min-height: 40px; }
  .grid.cols-2, .grid.split, .grid.split-sm { grid-template-columns: minmax(0, 1fr); }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card .grid.cols-2, .card .grid.cols-3, .card .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 14px 14px; }
  .card h2 { font-size: 16px; }
  .kanban { display: flex; overflow-x: auto; }
  .kcol { min-width: 78vw; max-width: 320px; flex: none; }
  .filters input[type=text], .filters input[type=search] { max-width: none; }
  .filters select { width: 100%; max-width: none; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: rgba(255,255,255,.94); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); height: calc(var(--tabbar-h) + var(--safe-bottom));
    padding: 4px 2px var(--safe-bottom);
  }
  .tabbar button {
    flex: 1; border: none; background: none; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 2px; font-size: 10.5px; font-weight: 600; color: var(--text-3);
    cursor: pointer; padding: 2px 0; min-width: 0; position: relative; -webkit-tap-highlight-color: transparent;
  }
  .tabbar button.active { color: var(--accent); }
  .tabbar .ico { font-size: 22px; line-height: 1.1; }
  .tabbar .badge { position: absolute; top: 2px; right: calc(50% - 22px); }
  .tabbar button.active::before { content: ''; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  h1 { font-size: 20px; }
  .hello { font-size: 21px; }
  .empty { padding: 24px 10px; }
  .editor-wrap .ql-editor { padding: 16px 14px; min-height: 280px; }
  .kv { flex-direction: column; gap: 2px; }
  .kv .k { min-width: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
  .actions .btn { flex: 1 1 auto; }
  .actions .btn.small { flex: 0 1 auto; }
  .sidebar-progress { display: none; }
}
@media (max-width: 380px) {
  .main { padding-left: 11px; padding-right: 11px; }
  .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .tabbar button { font-size: 10px; }
  .card { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .sp, .sp-backdrop, .toast, .aiwork, .aiwork-step.now .dot { animation: none !important; }
}

/* Step 301: GPU health page */
.gpu-cards { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.gpu-two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.gpu-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: baseline; }
.gpu-who { font-size: 13px; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.gpu-meter-row { display: grid; grid-template-columns: 74px 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; margin: 4px 0; }
.gpu-meter { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; }
.gpu-meter > div { height: 100%; border-radius: 4px; background: var(--accent); }
.gpu-legend { gap: 14px; font-size: 12.5px; color: var(--text-2); }
.gpu-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: baseline; }
.gpu-chart { display: flex; align-items: flex-end; gap: 2px; height: 140px; padding-top: 8px; border-bottom: 1px solid var(--border-2); overflow-x: auto; }
.gpu-chart.small { height: 100px; }
.gpu-col { flex: 1 1 0; min-width: 10px; display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; cursor: default; }
.gpu-col:hover .gpu-stack { opacity: .8; }
.gpu-stack { display: flex; flex-direction: column-reverse; gap: 2px; }
.gpu-seg { border-radius: 0; }
.gpu-stack .gpu-seg:last-child { border-radius: 4px 4px 0 0; }
.gpu-x { font-size: 10px; color: var(--text-2); text-align: center; margin-top: 3px; white-space: nowrap; overflow: hidden; }
.gpu-tip { font-size: 12.5px; min-height: 18px; margin-top: 4px; }
@media (max-width: 700px) { .gpu-cards, .gpu-two { grid-template-columns: 1fr; } .gpu-chart.small .gpu-x { font-size: 8px; } }
