/* CoatFlow Crew: the ad platform's light theme approach. One light theme, every text colour at 4.5:1 or better on
   its background (accent text #b7410e on white is 5.6:1; white text sits only on #c4511e or darker). Mobile
   first: one column at 375 px with no sideways scroll, more columns from 760 px. Tokens first. */
:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --sunk: #efede8;
  --ink: #1c1b19;
  --muted: #57534e;
  --line: #d6d3ce;
  --line-strong: #8f8a84;
  --accent: #b7410e;
  --accent-ink: #ffffff;
  --accent-deep: #8f3613;
  --accent-soft: #fbeee7;
  --amber: #f1a032;
  --ok: #1f6f43;
  --ok-soft: #e7f4ec;
  --warn: #8a5a00;
  --warn-soft: #fbf1dc;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --focus: #1d4ed8;
  --font-head: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --fs-display: clamp(32px, 7vw, 52px);
  --fs-title: clamp(26px, 5vw, 32px);
  --fs-heading: 21px;
  --fs-body: 16px;
  --fs-small: 14px;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;
  --r-sm: 6px;
  --radius: 10px;
  --r-lg: 16px;
  --r-pill: 999px;
  --e1: 0 1px 2px rgba(28, 27, 25, 0.06), 0 4px 16px rgba(28, 27, 25, 0.06);
  --e2: 0 2px 6px rgba(28, 27, 25, 0.08), 0 14px 40px rgba(28, 27, 25, 0.14);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 150ms;
  --t-med: 220ms;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: var(--fs-body)/1.55 var(--font-body); overflow-wrap: break-word; min-height: 100vh; display: flex; flex-direction: column; }
img, svg, video { max-width: 100%; }
h1, h2, h3, .h3 { line-height: 1.15; margin: 0 0 var(--s3); font-family: var(--font-head); letter-spacing: -0.01em; }
h1 { font-size: var(--fs-title); font-weight: 800; }
h2 { font-size: var(--fs-heading); font-weight: 750; }
h3, .h3 { font-size: 17px; font-weight: 700; }
p { margin: 0 0 var(--s3); }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 8px; }
.hidden { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } }

/* ---- header, nav, footer ---- */
/* The header scrolls away on a phone (its nav wraps to two rows there) and stays in view from 760 px. */
.top { background: var(--surface); border-bottom: 1px solid var(--line); z-index: 5; padding: var(--s2) var(--s4); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 44px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font: 800 19px/1 var(--font-head); letter-spacing: -0.01em; color: var(--ink); text-decoration: none; min-height: 44px; }
.logo svg { width: 28px; height: 28px; flex: 0 0 auto; }
.logo span b { color: var(--accent); font-weight: 800; }
.who { display: flex; gap: var(--s2); align-items: center; font-size: var(--fs-small); color: var(--muted); min-width: 0; }
.who .who-name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 420px) { .who .who-name { display: none; } }
.nav { display: flex; flex-wrap: wrap; gap: 2px var(--s1); margin: var(--s1) calc(var(--s2) * -1) 0; }
.nav:empty { display: none; }
.nav a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 var(--s2); border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; border-bottom: 3px solid transparent; }
.nav a:hover { background: var(--sunk); }
.nav a[aria-current="page"] { border-bottom-color: var(--accent); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.count-pill { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-size: 13px; font-weight: 700; }
.foot { margin-top: auto; border-top: 1px solid var(--line); background: var(--surface); padding: var(--s4); font-size: var(--fs-small); color: var(--muted); }
.foot-inner { max-width: 1120px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); justify-content: space-between; }
.foot p { margin: 0; }
@media (min-width: 760px) {
  .top { padding: var(--s2) var(--s5); }
  .top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; column-gap: var(--s5); position: sticky; top: 0; }
  .top-row { display: contents; }
  .logo { grid-column: 1; grid-row: 1; }
  .nav { grid-column: 2; grid-row: 1; margin: 0; }
  .who { grid-column: 3; grid-row: 1; }
}

main { width: 100%; max-width: 1120px; margin: 0 auto; padding: var(--s5) var(--s4) var(--s8); flex: 1 0 auto; }
@media (min-width: 760px) { main { padding: var(--s6) var(--s5) var(--s8); } }
.page { display: grid; gap: var(--s5); }
.narrow { max-width: 640px; }
.page-head p { margin: 0; color: var(--muted); }

/* ---- surfaces ---- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); box-shadow: var(--e1); }
@media (min-width: 760px) { .panel { padding: var(--s5); } }
.panel > h2:first-child { margin-bottom: var(--s2); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: var(--s3) 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); font: inherit; font-weight: 650; font-size: 15px; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; min-height: 44px; transition: background-color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn:active { transform: translateY(1px); }
.btn .icon { width: 18px; height: 18px; }
.btn-lg { font-size: 17px; padding: 14px 22px; min-height: 52px; border-radius: 12px; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--sunk); border-color: var(--ink); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--accent); padding: 6px 10px; }
.btn-quiet:hover { background: var(--accent-soft); border-color: transparent; }
.btn-small { font-size: 14px; padding: 6px 12px; }
.btn[disabled] { background: var(--sunk); border-color: var(--line); color: var(--muted); cursor: default; }
.btn[aria-busy="true"] { cursor: progress; }
.actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

/* ---- forms ---- */
form.stack, .stack { display: grid; gap: var(--s4); }
.field { display: grid; gap: var(--s1); }
.field > label, .group > legend { font-weight: 650; font-size: 15px; }
.optional { font-weight: 500; color: var(--muted); }
.hint { color: var(--muted); font-size: var(--fs-small); margin: 0; }
.count { color: var(--muted); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
input[type="text"], input[type="email"], input[type="url"], input[type="tel"], input[type="number"], input[type="search"], input[type="date"], input[type="month"], select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 9px 11px; width: 100%; min-height: 44px;
}
input::placeholder, textarea::placeholder { color: #6b6560; }
textarea { min-height: 96px; resize: vertical; }
.group { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: var(--s2); }
.group > legend { padding: 0; margin-bottom: var(--s1); }
.choices { display: flex; flex-wrap: wrap; gap: var(--s2); }
.choice { display: inline-flex; align-items: center; gap: var(--s2); padding: 10px 14px; min-height: 44px; border: 1px solid var(--line-strong); border-radius: var(--r-pill); background: var(--surface); cursor: pointer; font-size: 15px; }
.choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: 0 0 auto; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.check { display: flex; gap: var(--s3); align-items: flex-start; font-size: 16px; cursor: pointer; }
.check input { margin-top: 3px; width: 20px; height: 20px; accent-color: var(--accent); flex: 0 0 auto; }

/* ---- chips, notices, toasts ---- */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 2px 9px; border-radius: var(--r-pill); background: var(--sunk); color: var(--ink); border: 1px solid var(--line); white-space: nowrap; }
.chip-accent { background: var(--accent-soft); border-color: #e9c3b0; color: var(--accent-deep); }
.notice { border-radius: 8px; padding: 10px 14px; margin: 0; font-size: 15px; }
.notice strong { display: block; }
.notice-bad { background: var(--bad-soft); color: #7a1610; border: 1px solid #f2b8b1; }
.notice-warn { background: var(--warn-soft); color: #5c3c00; border: 1px solid #ecd59e; }
.notice-info { background: var(--sunk); color: var(--ink); border: 1px solid var(--line); }
.notice-ok { background: var(--ok-soft); color: #154d2f; border: 1px solid #b9dcc7; }
.toasts { position: fixed; right: var(--s4); bottom: var(--s4); left: var(--s4); display: grid; justify-items: end; gap: var(--s2); z-index: 20; pointer-events: none; }
.toast { background: var(--ink); color: #ffffff; padding: 10px 14px; border-radius: 8px; box-shadow: var(--e2); font-size: 15px; max-width: 420px; pointer-events: auto; }
.toast-bad { background: #7a1610; }
.icon { width: 20px; height: 20px; flex: 0 0 auto; display: inline-block; vertical-align: -0.2em; }

/* ---- empty states and loading ---- */
.empty-state { display: grid; justify-items: center; text-align: center; gap: var(--s3); padding: var(--s6) var(--s4); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface); }
.empty-state .icon { width: 40px; height: 40px; color: var(--accent); }
.empty-state h2 { margin: 0; }
.empty-state p { margin: 0; color: var(--muted); max-width: 42ch; }
.skeleton { display: block; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--sunk) 0%, #f7f6f3 50%, var(--sunk) 100%); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; }
.skeleton-line { height: 14px; margin: 10px 0; }
.skeleton-title { height: 32px; width: 45%; margin: 4px 0 18px; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* ---- levels, badges, people ---- */
.level-meter { display: grid; gap: var(--s2); }
.level-head { display: flex; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; font-size: 15px; }
.level-track { font-weight: 700; }
.level-word { color: var(--muted); }
.level-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s1); }
.level-steps li { display: flex; align-items: center; gap: 6px; padding: 8px; border-radius: var(--r-sm); background: var(--sunk); border: 1px solid var(--line); font-size: 13px; color: var(--muted); min-width: 0; }
.level-steps li[data-done="true"] { background: var(--ok-soft); border-color: #b9dcc7; color: #154d2f; font-weight: 650; }
.level-steps .tick { width: 16px; height: 16px; color: var(--ok); }
.tick-empty { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-strong); flex: 0 0 auto; }
.badge-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line-strong); font-size: 14px; font-weight: 600; color: var(--ink); }
.badge-chip .icon { width: 16px; height: 16px; color: var(--accent); }
.badge-chip.is-revoked { border-style: dashed; color: var(--muted); }
.badge-chip.is-revoked .icon { color: var(--muted); }
.badge-note { font-weight: 500; }
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-deep); font: 800 15px/1 var(--font-head); flex: 0 0 auto; border: 1px solid #e9c3b0; }

/* ---- the landing page ---- */
.landing { display: grid; gap: var(--s7); }
.hero { display: grid; gap: var(--s5); }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin: 0; }
.display { font: 850 var(--fs-display)/1.02 var(--font-head); letter-spacing: -0.025em; margin: 0; max-width: 16ch; }
.lead { font-size: 18px; color: var(--muted); max-width: 60ch; margin: 0; }
.doors { display: grid; gap: var(--s4); }
@media (min-width: 760px) { .doors { grid-template-columns: 1fr 1fr; } }
.door { position: relative; display: grid; gap: var(--s3); align-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--e1); overflow: hidden; }
.door h2 { font-size: clamp(22px, 4.2vw, 28px); font-weight: 800; letter-spacing: -0.015em; margin: 0; }
.door p { margin: 0; }
.door-who { font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.door .actions { margin-top: var(--s2); }
/* Two floor samples as the doors' pictures (decorative): a flake broadcast and a glossy solid coat. */
.swatch { height: 72px; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: var(--s1); }
.swatch-flake {
  background-color: #9a948b;
  background-image:
    radial-gradient(circle at 12% 30%, #f6f5f2 0 3px, transparent 3.5px), radial-gradient(circle at 34% 70%, #2b2a28 0 3px, transparent 3.5px),
    radial-gradient(circle at 58% 22%, #c4511e 0 2.5px, transparent 3px), radial-gradient(circle at 76% 64%, #f6f5f2 0 2.5px, transparent 3px),
    radial-gradient(circle at 90% 34%, #57534e 0 3px, transparent 3.5px), radial-gradient(circle at 46% 46%, #d6d3ce 0 2px, transparent 2.5px),
    radial-gradient(circle at 22% 84%, #f1a032 0 2px, transparent 2.5px), radial-gradient(circle at 66% 88%, #2b2a28 0 2px, transparent 2.5px);
  background-size: 46px 38px;
}
.swatch-solid { background: linear-gradient(115deg, #2f3d47 0%, #4b5d69 38%, #8fa3ad 46%, #4b5d69 54%, #2f3d47 100%); }
.section-head { display: grid; gap: var(--s1); margin-bottom: var(--s4); }
.section-head h2 { margin: 0; font-size: clamp(22px, 4vw, 26px); }
.section-head p { margin: 0; color: var(--muted); }
.two-col { display: grid; gap: var(--s4); }
@media (min-width: 760px) { .two-col { grid-template-columns: 1fr 1fr; } }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); counter-reset: step; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 36px 1fr; gap: var(--s3); align-items: start; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 15px; }
.steps strong { display: block; }
.levels { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
@media (min-width: 760px) { .levels { grid-template-columns: repeat(3, 1fr); } }
.levels li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); display: grid; gap: var(--s2); align-content: start; }
.levels .level-n { font-size: 13px; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; text-transform: uppercase; }
.levels strong { font: 800 19px/1.2 var(--font-head); }
.levels p { margin: 0; color: var(--muted); }
.course-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
@media (min-width: 760px) { .course-list { grid-template-columns: 1fr 1fr; } }
.course-list a { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; min-height: 56px; }
.course-list a:hover { border-color: var(--line-strong); box-shadow: var(--e1); }
.course-list .course-title { font-weight: 650; }
.course-list .icon { color: var(--accent); }
.promises { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
@media (min-width: 760px) { .promises { grid-template-columns: repeat(3, 1fr); } }
.promises li { display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-weight: 650; }
.promises .icon { color: var(--ok); width: 24px; height: 24px; }

/* ---- sign-in and welcome ---- */
.auth-card { max-width: 520px; margin: 0 auto; width: 100%; }
.terms-box { max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4); background: var(--bg); font-size: 15px; }
.terms-box h3 { font-size: 16px; margin: var(--s3) 0 var(--s1); }
.terms-box h3:first-child { margin-top: 0; }
.terms-box p, .terms-box ul { margin: 0 0 var(--s2); }
.terms-box ul { padding-left: 1.2em; }

/* ---- inbox and outbox ---- */
.notice-list > li { display: grid; gap: var(--s1); }
.notice-row { display: flex; justify-content: space-between; gap: var(--s3); align-items: baseline; flex-wrap: wrap; }
.notice-row .when { color: var(--muted); font-size: 13px; white-space: nowrap; }
.is-unread .notice-title { font-weight: 750; }
.new-tag { display: inline-block; margin-right: var(--s1); padding: 1px 7px; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; vertical-align: 2px; }
.mail-text { white-space: pre-wrap; margin: 0; font: inherit; font-size: 15px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm); padding: var(--s3); }

dialog { border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s5); max-width: min(640px, calc(100vw - 32px)); width: 100%; color: var(--ink); background: var(--surface); box-shadow: var(--e2); }
dialog::backdrop { background: rgba(28, 27, 25, 0.45); }
@media (max-width: 640px) {
  dialog { margin: auto 0 0; max-width: 100vw; width: 100vw; max-height: 88vh; border-radius: var(--r-lg) var(--r-lg) 0 0; padding: var(--s5) var(--s4) calc(var(--s5) + env(safe-area-inset-bottom)); }
}
