:root {
  --bg: #EEF1F6;
  --surface: #FFFFFF;
  --ink: #0F1729;
  --ink-2: #2B3446;
  --muted: #5B6475;
  --line: #E6E9F0;
  --line-2: #D9DEE8;
  --field: #C9D0DC;
  --accent: #3D5AFE;
  --accent-ink: #2A43C9;
  --accent-soft: #3D5AFE14;
  --honest: #FF7A1A;
  --honest-ink: #C2410C;
  --honest-bg: #FFF3E8;
  --honest-line: #FFD2AE;
  --danger: #B42318;
  --dark-card: #0F1729;
  --dark-muted: #B8C0D0;
  --radius: 20px;
  --font-display: 'Bricolage Grotesque', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 76px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); }
a:hover { color: #1E3399; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

.shell { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; }
.screen { min-height: 100dvh; display: flex; flex-direction: column; gap: 16px; padding: calc(env(safe-area-inset-top, 0px) + 28px) 20px calc(28px + var(--safe-b)); }
.screen.with-nav { padding-bottom: calc(var(--nav-h) + 24px + var(--safe-b)); }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }

h1, h2, h3 { margin: 0; font-family: var(--font-display); letter-spacing: -0.02em; }
h1 { font-size: 30px; font-weight: 700; line-height: 1.1; }
h1.xl { font-size: 34px; line-height: 1.08; letter-spacing: -0.025em; }
h2 { font-size: 19px; font-weight: 700; }
p { margin: 0; }
.lead { font-size: 16px; line-height: 1.45; color: var(--muted); }
.meta { font-size: 13px; font-weight: 500; color: var(--muted); }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }

.card { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.card.list { padding: 6px 16px; }
.card.dark { background: var(--dark-card); color: #fff; }
.card.dark .meta, .card.dark .sub { color: var(--dark-muted); }
.card.honest { background: var(--honest-bg); border: 1.5px solid var(--honest-line); }
.card.soft { background: #E3E7EF; }
.honest-label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--honest-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--honest); flex: none; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px; border-radius: 16px; border: 0; font-size: 16px; font-weight: 600; text-decoration: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: #3049E0; color: #fff; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.outline { background: var(--surface); border: 1.5px solid var(--field); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--accent-ink); padding: 0 8px; min-height: 44px; }
.btn.danger { background: transparent; color: var(--danger); }
.btn.block { width: 100%; min-height: 56px; font-size: 17px; }
.btn.small { min-height: 44px; font-size: 15px; border-radius: 14px; padding: 0 14px; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink); flex: none; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin: -10px 0; font-size: 15px; font-weight: 600; color: var(--ink); text-decoration: none; background: none; border: 0; padding: 0; }

.progress-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.progress-bar span { height: 4px; border-radius: 2px; background: var(--line-2); }
.progress-bar span.on { background: var(--accent); }

.choice { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 72px; padding: 14px 16px; text-align: left; border-radius: 16px; border: 2px solid var(--line-2); background: var(--surface); }
.choice[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.radio { flex: none; display: flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #8A94A6; background: #fff; }
.choice[aria-pressed="true"] .radio { border-color: var(--accent); background: var(--accent); }
.radio::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.choice-title { font-size: 17px; font-weight: 600; }
.choice-sub { font-size: 14px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1.5px solid var(--field); background: var(--surface); font-size: 15px; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.dark[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
.chips.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.chips.grid5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.chips.grid3 .chip, .chips.grid5 .chip { border-radius: 14px; padding: 0 6px; }

label.field-label, legend { font-size: 15px; font-weight: 600; padding: 0; }
fieldset { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 10px; }
legend { margin-bottom: 10px; }
.input { width: 100%; height: 52px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--field); background: var(--surface); font-size: 16px; }
textarea.input { height: auto; min-height: 96px; padding: 12px 16px; line-height: 1.45; resize: vertical; }
.input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px #3D5AFE33; }
input[type=range] { width: 100%; height: 28px; margin: 0; accent-color: var(--accent); }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.4; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--accent); }

.task { display: flex; align-items: flex-start; gap: 12px; min-height: 52px; padding: 11px 0; border-top: 1px solid var(--line); cursor: pointer; }
.task:first-of-type { border-top: 0; }
.task input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; accent-color: var(--accent); }
.task-text { font-size: 16px; font-weight: 500; }
.task.done .task-text { color: var(--muted); text-decoration: line-through; }
.task-meta { font-size: 13px; font-weight: 500; color: var(--muted); }
.task-meta.warn { color: var(--honest-ink); }
.list-link { display: flex; justify-content: space-between; align-items: center; min-height: 48px; border-top: 1px solid var(--line); font-size: 15px; font-weight: 600; text-decoration: none; color: var(--ink); }

.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat-num { font-size: 22px; font-weight: 700; display: block; }
.stat-label { font-size: 13px; color: var(--dark-muted); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { background: var(--surface); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.tiles.four .tile { border-radius: 14px; padding: 10px 10px 8px; }
.tile-num { font-family: var(--font-display); font-size: 30px; font-weight: 700; }
.tiles.four .tile-num { font-size: 24px; }
.tile-label { font-size: 13px; color: var(--muted); }

.bubble-row { display: flex; gap: 10px; align-items: flex-start; }
.avatar { flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; }
.bubble { max-width: 86%; padding: 12px 14px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.coach { align-self: flex-start; background: var(--surface); border-radius: 18px 18px 18px 6px; }
.bubble.me { align-self: flex-end; background: var(--ink); color: #fff; border-radius: 18px 18px 6px 18px; max-width: 82%; }
.bubble.pushback { border: 1.5px solid var(--honest-line); }
.bubble .tag { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--honest-ink); margin-bottom: 6px; }
.bubble .voice-tag { display: block; font-size: 11px; opacity: 0.7; margin-top: 4px; }
.draft { align-self: flex-start; width: 92%; display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: 18px 18px 18px 6px; border: 1.5px solid var(--line-2); background: var(--surface); }
.draft-title { font-size: 15px; font-weight: 600; }
.draft-body { font-size: 14px; line-height: 1.5; color: var(--ink-2); white-space: pre-wrap; margin: 0; }

.chat-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: calc(env(safe-area-inset-top, 0px) + 16px) 20px 12px; background: var(--surface); border-bottom: 1px solid #DDE2EA; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 12px; }
.composer { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 2; display: flex; align-items: center; gap: 8px; padding: 8px 16px 12px; background: linear-gradient(transparent, var(--bg) 30%); }
.composer-box { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 0 6px 0 16px; border-radius: 26px; border: 1.5px solid var(--field); background: var(--surface); }
.composer-box input { flex: 1; width: 0; min-width: 0; height: 48px; border: 0; outline: none; background: transparent; font-size: 16px; }
.send { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.mic { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.mic.recording { background: var(--honest); color: #fff; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px #FF7A1A33; } }
.rec-bar { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--honest-ink); }
.typing { align-self: flex-start; display: flex; gap: 4px; padding: 14px; background: var(--surface); border-radius: 18px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #8A94A6; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 50% { opacity: 0.25; } }

.pill { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; }
.pill .pd { width: 6px; height: 6px; border-radius: 50%; }
.stage-Found { background: #E6E9F0; color: #2B3446; } .stage-Found .pd { background: #8A94A6; }
.stage-Contacted { background: #3D5AFE1F; color: var(--ink); } .stage-Contacted .pd { background: var(--accent); }
.stage-Applied { background: var(--ink); color: #fff; } .stage-Applied .pd { background: #fff; }
.stage-Interview { background: #FFE2CC; color: #8A2E06; } .stage-Interview .pd { background: var(--honest); }
.stage-Offer { background: #D7F5E4; color: #0B5D35; } .stage-Offer .pd { background: #12A35A; }
.stage-Closed { background: #F1F2F5; color: #5B6475; } .stage-Closed .pd { background: #A0A8B8; }
.opp { display: flex; flex-direction: column; gap: 6px; width: 100%; padding: 14px 16px; border: 0; border-radius: 18px; background: var(--surface); text-align: left; }
.opp-name { font-size: 16px; font-weight: 600; }
.opp-sub { font-size: 13px; color: var(--muted); }
.opp-next { font-size: 14px; }

.sheet-backdrop { position: fixed; inset: 0; background: #0F172966; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: 100%; max-width: 480px; max-height: 92dvh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 20px 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }

.bars { display: grid; gap: 14px; align-items: end; height: 110px; }
.bar-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; height: 100%; }
.bar { width: 100%; border-radius: 8px; background: var(--accent); min-height: 4px; }
.bar.partial { border: 2px dashed var(--accent); background: #fff; }
.bar-labels { display: grid; gap: 14px; font-size: 12px; color: var(--muted); text-align: center; }
.target-track { display: grid; gap: 6px; }
.target-track span { height: 8px; border-radius: 4px; background: #39425A; }
.target-track span.on { background: var(--honest); }

.switch { flex: none; display: flex; align-items: center; width: 52px; height: 32px; padding: 3px; border-radius: 16px; background: #8A94A6; border: 0; transition: background 0.15s; }
.switch[aria-checked="true"] { background: var(--accent); justify-content: flex-end; }
.switch::after { content: ''; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px #0F17294D; }
.memory { margin: 0; white-space: pre-wrap; font-size: 14px; line-height: 1.5; color: var(--ink-2); font-family: var(--font-body); max-height: 220px; overflow-y: auto; }

.nav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 5; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); height: calc(var(--nav-h) + var(--safe-b)); padding: 6px 8px calc(10px + var(--safe-b)); background: var(--surface); border-top: 1px solid #DDE2EA; }
.nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; text-decoration: none; font-size: 12px; font-weight: 600; color: var(--muted); }
.nav a[aria-current="page"] { color: var(--accent); }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 16px; background: #E3E7EF; font-size: 14px; line-height: 1.4; }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + var(--safe-b)); transform: translateX(-50%) translateY(20px); max-width: 440px; width: calc(100% - 40px); padding: 12px 16px; border-radius: 14px; background: var(--ink); color: #fff; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 30; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.error { color: var(--danger); font-size: 14px; }
.center { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 14px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 6px; border-top: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
.prose h2 { margin-top: 8px; }
.prose p, .prose li { font-size: 15px; line-height: 1.55; color: var(--ink-2); }
.prose ul { margin: 0; padding-left: 20px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Desktop: from 900px wide the bottom tab bar becomes a sidebar, content gets room, sheets become dialogs.
   Below 900px nothing changes, so phones keep the mobile-first layout. */
@media (min-width: 900px) {
  :root { --nav-h: 0px; --side-w: 232px; }
  .shell { max-width: none; }
  .screen { max-width: 600px; margin: 0 auto; padding: 56px 32px; }
  .screen.center { max-width: none; }

  .shell:has(.nav) { padding-left: var(--side-w); }
  .screen.with-nav { max-width: 880px; padding: 48px 48px 56px; }
  .nav { top: 0; bottom: 0; left: 0; transform: none; width: var(--side-w); max-width: none; height: 100dvh; display: flex; flex-direction: column; gap: 4px; padding: 28px 16px; border-top: 0; border-right: 1px solid #DDE2EA; }
  .nav::before { content: 'Milo'; font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: -0.01em; color: var(--ink); padding: 0 12px 20px; }
  .nav a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; font-size: 15px; }
  .nav a:hover { background: var(--bg); color: var(--ink); }
  .nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-ink); }

  h1 { font-size: 34px; }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stack-sm:has(> .opp) { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opp, .choice, .chip, .list-link, a.card { transition: box-shadow 0.15s, border-color 0.15s; }
  .opp:hover, a.card:hover { box-shadow: 0 2px 12px #0F172914; }
  .choice:hover { border-color: var(--field); }
  .chip:hover { border-color: var(--ink-2); }

  .chat-head { padding: 20px 48px 16px; }
  .chat-head, .chat-log, .composer { width: 100%; }
  .chat-log, .composer { max-width: 880px; margin: 0 auto; padding-left: 48px; padding-right: 48px; }
  .composer { bottom: 0; padding-bottom: 24px; }
  .bubble, .draft { max-width: 70%; }
  .bubble.me { max-width: 66%; }

  .sheet-backdrop { align-items: center; padding: 24px; }
  .sheet { max-width: 560px; max-height: 85dvh; border-radius: 24px; padding: 28px; box-shadow: 0 24px 64px #0F172933; }
  .toast { bottom: 28px; }
}
