/* Headlamp Audio portal: design system. Mobile first (iPhone 6 = 375px, Pixel 6 = 412px and up).
   Matches joehagenmusic.com (black, white text, dark panels) with a yellow accent. Dark only, like the site. */

/* ---------- fonts (self-hosted, SIL Open Font License; see public/fonts/OFL.txt) ----------
   Manrope stands in for the website's Ata (body); Sora for its Jagerlay (headings). Both are variable fonts. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/manrope-latin-var.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Sora"; font-style: normal; font-weight: 100 800; font-display: swap; src: url("/fonts/sora-latin-var.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  color-scheme: dark;
  --bg: #000; --bg-2: #0b0b0b; --surface: #131313; --surface-2: #1b1b1b; --surface-3: #272727;
  --line: #2b2b2b; --line-strong: #3f3f3f;
  --text: #f5f5f5; --muted: #ababab; --subtle: #7a7a7a;
  --accent: #f5a623; --accent-hover: #ffba42; --accent-ink: #1a1100;
  --accent-soft: rgba(245, 166, 35, .14); --accent-line: rgba(245, 166, 35, .5);
  --ok: #52c98a; --ok-soft: rgba(82, 201, 138, .14);
  --bad: #ff6b5e; --bad-soft: rgba(255, 107, 94, .14);
  --info: #7aa7ff; --info-soft: rgba(122, 167, 255, .14);
  --warn: #ffcc66; --warn-soft: rgba(255, 204, 102, .14);
  --r-sm: 6px; --r: 10px; --r-lg: 16px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: "Sora", "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 60px;
  --shadow: 0 10px 34px rgba(0, 0, 0, .55);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 350 16px/1.5 var(--font);
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent); }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-family: var(--font-head); font-weight: 400; }
h1 { font-size: 24px; } h2 { font-size: 20px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- utilities ---------- */
.muted { color: var(--muted); } .subtle { color: var(--subtle); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.strong { font-weight: 700; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--s3); }
.stack-lg { display: flex; flex-direction: column; gap: var(--s4); }
.stack-sm { display: flex; flex-direction: column; gap: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.row-nowrap { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: var(--s3); } .mt-lg { margin-top: var(--s4); } .mb { margin-bottom: var(--s3); }
.pre { white-space: pre-wrap; }
@media (max-width: 719px) { .only-desktop { display: none !important; } }
@media (min-width: 720px) { .only-mobile { display: none !important; } }

/* ---------- icons ---------- */
.ic { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic-lg { width: 22px; height: 22px; } .ic-sm { width: 15px; height: 15px; } .ic-xl { width: 40px; height: 40px; }

/* ---------- header and footer ---------- */
.top { position: sticky; top: 0; z-index: 30; background: rgba(0, 0, 0, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; gap: var(--s3); max-width: 1240px; margin: 0 auto; padding: 6px var(--s4); min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-family: var(--font-head); font-weight: 500; letter-spacing: .09em; text-transform: uppercase; font-size: 13px; min-width: 0; }
.brand img { height: 30px; width: auto; }
.brand-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-links { display: none; gap: 2px; margin-left: var(--s3); }
.nav-link { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; border-radius: var(--r-sm); color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; background: none; border: 0; cursor: pointer; }
.nav-link:hover { color: var(--text); background: var(--surface-2); }
.nav-link[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
@media (min-width: 900px) { .nav-links { display: flex; } }
.foot { margin-top: var(--s6); padding: var(--s5) var(--s4) calc(var(--s5) + var(--safe-b)); border-top: 1px solid var(--line); color: var(--subtle); font-size: 12px; text-align: center; line-height: 1.7; }
.foot a { color: var(--muted); }
.foot .copy { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.foot .copy a { display: inline-flex; line-height: 0; }
.foot .copy img { width: 22px; height: 22px; border-radius: 50%; }
.has-tabbar .foot { padding-bottom: calc(var(--tabbar-h) + var(--s5) + var(--safe-b)); }
.page { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: var(--s4); }
.page-narrow { max-width: 960px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font-weight: 650; font-size: 15px; line-height: 1; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s; user-select: none; -webkit-user-select: none;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); border-color: transparent; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #04150c; }
.btn-danger { color: var(--bad); border-color: rgba(255, 107, 94, .4); background: transparent; }
.btn-danger:hover { background: var(--bad-soft); border-color: var(--bad); }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 14px; }
.btn-xs { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 44px; padding: 0; } .btn-sm.btn-icon { width: 38px; } .btn-xs.btn-icon { width: 32px; }
.btn-block { width: 100%; }
@media (pointer: coarse) { .btn-sm, .btn-xs { min-height: 44px; } .btn-xs.btn-icon, .btn-sm.btn-icon { width: 44px; } }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: inherit; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 650; color: var(--muted); }
.hint { font-size: 13px; color: var(--subtle); }
input[type="text"], input[type="email"], input[type="url"], input[type="number"], input[type="date"], input[type="search"], input[type="password"], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong);
  background: var(--bg-2); color: var(--text); font: inherit; font-size: 16px; /* 16px stops iOS zooming in */
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 92px; line-height: 1.45; }
input[type="file"] { width: 100%; padding: 10px; border: 1px dashed var(--line-strong); border-radius: var(--r-sm); background: var(--bg-2); color: var(--muted); font-size: 14px; min-height: 44px; }
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: var(--s3); }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } .form-grid.three { grid-template-columns: 1fr 1fr 1fr; } }
.check { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; padding: 8px 0; cursor: pointer; font-size: 15px; }
.check span { flex: 1; }
.switch { position: relative; flex: none; width: 46px; height: 28px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--surface-3); border-radius: 999px; transition: background .15s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(18px); background: var(--accent-ink); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-height: 48px; padding: 6px 0; }
.toggle-row .t { flex: 1; min-width: 0; }
.toggle-row .t small { display: block; color: var(--subtle); font-size: 13px; line-height: 1.35; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg button { min-height: 40px; padding: 0 14px; background: var(--bg-2); border: 0; border-right: 1px solid var(--line-strong); color: var(--muted); font-weight: 650; cursor: pointer; font-size: 14px; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* ---------- cards, pills, chips ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s4); min-width: 0; }
.card-flat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s3); }
.card-title { display: flex; align-items: center; gap: 8px; margin-bottom: var(--s3); }
.card-title h3 { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text); white-space: nowrap; line-height: 1.4; }
.pill-accent { background: var(--accent-soft); color: var(--accent); } .pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-bad { background: var(--bad-soft); color: var(--bad); } .pill-info { background: var(--info-soft); color: var(--info); } .pill-warn { background: var(--warn-soft); color: var(--warn); }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg-2); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip[aria-pressed="true"], .chip.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.chip-static { cursor: default; }
@media (pointer: coarse) { .chip { min-height: 40px; } }
.chips { display: flex; gap: var(--s2); flex-wrap: wrap; }
.chips-scroll { display: flex; gap: var(--s2); overflow-x: auto; padding-bottom: 4px; margin: 0 calc(var(--s4) * -1); padding-left: var(--s4); padding-right: var(--s4); scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips-scroll::-webkit-scrollbar { display: none; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 800; }
.badge-quiet { background: var(--surface-3); color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; flex: none; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3); color: var(--text); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; flex: none; text-transform: uppercase; }
.avatar-accent { background: var(--accent); color: var(--accent-ink); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--s4); font-size: 14px; }
.kv dt { color: var(--subtle); } .kv dd { margin: 0; min-width: 0; }
.divider { height: 1px; background: var(--line); margin: var(--s3) 0; border: 0; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s; }
.alert { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); border-radius: var(--r); border: 1px solid var(--line-strong); background: var(--surface-2); font-size: 14px; }
.alert .ic { margin-top: 2px; }
.alert-info { border-color: rgba(122, 167, 255, .4); background: var(--info-soft); } .alert-warn { border-color: rgba(255, 204, 102, .45); background: var(--warn-soft); }
.alert-bad { border-color: rgba(255, 107, 94, .5); background: var(--bad-soft); } .alert-ok { border-color: rgba(82, 201, 138, .45); background: var(--ok-soft); }

/* ---------- accordions (folded sections) ---------- */
details.acc { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); min-width: 0; }
details.acc > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 var(--s4); cursor: pointer; font-weight: 700; user-select: none; -webkit-user-select: none; border-radius: var(--r); }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary:hover { background: var(--surface-2); }
details.acc > summary .acc-t { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
details.acc > summary .acc-sub { color: var(--subtle); font-weight: 500; font-size: 13px; }
details.acc > summary .chev { transition: transform .15s; color: var(--muted); }
details.acc[open] > summary .chev { transform: rotate(180deg); }
details.acc[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom: 1px solid var(--line); }
.acc-b { padding: var(--s4); }
.acc-stack { display: flex; flex-direction: column; gap: var(--s3); }
details.acc.flat { background: transparent; border-color: transparent; }
details.acc.flat > summary { min-height: 44px; padding: 0 var(--s2); color: var(--muted); }
details.acc.flat > .acc-b { padding: var(--s2); }
details.acc.flat[open] > summary { border-bottom: 0; }

/* ---------- layout: project list + content ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-items: start; }
@media (min-width: 900px) { .layout { grid-template-columns: 276px minmax(0, 1fr); } }
.rail { display: none; }
@media (min-width: 900px) { .rail { display: flex; flex-direction: column; gap: var(--s2); position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto; } }
.proj-item { display: block; width: 100%; text-align: left; padding: var(--s3); border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; }
.proj-item:hover { border-color: var(--line-strong); }
.proj-item[aria-current="true"] { border-color: var(--accent-line); background: var(--accent-soft); }
.proj-item .t { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.proj-item .s { font-size: 12px; color: var(--muted); margin-top: 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.proj-switch { min-width: 0; max-width: 100%; }
@media (min-width: 900px) { .proj-switch { display: none; } }

/* ---------- project header ---------- */
.proj-head { display: flex; flex-direction: column; gap: var(--s3); }
.proj-head h1 { font-size: 22px; overflow-wrap: anywhere; }
.meta-row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; overflow-x: auto; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.steps li { flex: 1 0 auto; min-width: 0; padding: 7px 12px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg-2); font-size: 12.5px; font-weight: 650; color: var(--subtle); white-space: nowrap; }
.steps li.done { color: var(--ok); border-color: rgba(82, 201, 138, .4); }
.steps li.cur { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (max-width: 719px) { .steps li:not(.cur) { display: none; } .steps li.cur { flex: 1; } .steps { margin: 0; } }
.tip { border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--r); padding: var(--s3) var(--s4); }
.tip h4 { color: var(--accent); margin-bottom: 4px; font-size: 15px; }
.tip p { font-size: 14px; color: var(--text); margin-bottom: var(--s3); }

/* ---------- tabs (desktop) and bottom bar (phone) ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 16px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab.glow { animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { background: var(--accent-soft); color: var(--accent); } }
.tabbar { display: none; }
@media (max-width: 719px) {
  .tabs { display: none; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: rgba(10, 10, 10, .96);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
  }
  .tabbar button { flex: 1; min-width: 0; min-height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; background: none; border: 0; color: var(--subtle); font-size: 11px; font-weight: 700; cursor: pointer; position: relative; padding: 4px 0; }
  .tabbar button[aria-selected="true"] { color: var(--accent); }
  .tabbar button .badge { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; height: 17px; font-size: 10px; padding: 0 4px; }
  .tabbar button.glow .ic { animation: glow-ic 1.4s ease-in-out infinite; }
  @keyframes glow-ic { 50% { color: var(--accent); transform: scale(1.18); } }
  .has-tabbar .page { padding-bottom: calc(var(--tabbar-h) + var(--s5) + var(--safe-b)); }
}

/* ---------- dialogs, sheets, toasts, menus ---------- */
dialog.dlg { border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: var(--surface); color: var(--text); padding: 0; width: min(600px, calc(100vw - 24px)); max-height: 92vh; max-height: 92dvh; box-shadow: var(--shadow); overflow: hidden; }
dialog.dlg[open] { display: flex; flex-direction: column; }
dialog.dlg::backdrop { background: rgba(0, 0, 0, .72); }
dialog.dlg.wide { width: min(820px, calc(100vw - 24px)); }
.dlg-h { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); border-bottom: 1px solid var(--line); }
.dlg-h h3 { flex: 1; font-size: 17px; }
.dlg-b { padding: var(--s4); overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.dlg-f { display: flex; gap: var(--s2); justify-content: flex-end; flex-wrap: wrap; padding: var(--s3) var(--s4) calc(var(--s3) + var(--safe-b)); border-top: 1px solid var(--line); }
@media (max-width: 639px) {
  dialog.dlg, dialog.dlg.wide { margin: auto 0 0; width: 100%; max-width: 100%; border-radius: var(--r-lg) var(--r-lg) 0 0; border-bottom: 0; animation: sheet-up .2s ease-out; }
  .dlg-f .btn { flex: 1; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--s4) + var(--safe-b)); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: var(--s2); pointer-events: none; padding: 0 var(--s4); }
.has-tabbar .toasts { bottom: calc(var(--tabbar-h) + var(--s3) + var(--safe-b)); }
@media (min-width: 720px) { .has-tabbar .toasts { bottom: var(--s4); } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 480px; padding: 12px 16px; border-radius: var(--r); background: var(--surface-3); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: 14px; font-weight: 600; animation: toast-in .2s ease-out; }
.toast.ok { border-color: rgba(82, 201, 138, .5); } .toast.ok .ic { color: var(--ok); } .toast.bad { border-color: rgba(255, 107, 94, .6); } .toast.bad .ic { color: var(--bad); }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }
.menu { position: fixed; z-index: 150; min-width: 200px; max-width: calc(100vw - 16px); background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--text); font-size: 15px; font-weight: 600; text-align: left; border-radius: var(--r-sm); cursor: pointer; text-decoration: none; width: 100%; }
.menu button:hover, .menu a:hover { background: var(--surface-3); }
.menu .danger { color: var(--bad); } .menu hr { border: 0; height: 1px; background: var(--line); margin: 4px 0; width: 100%; }
.menu .menu-h { padding: 8px 12px; font-size: 12px; color: var(--subtle); }

/* ---------- empty / loading ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s2); padding: var(--s6) var(--s4); color: var(--muted); }
.empty .ic { color: var(--subtle); } .empty h3 { color: var(--text); }
.skel { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: skel 1.3s linear infinite; border-radius: var(--r-sm); height: 16px; }
@keyframes skel { to { background-position: -200% 0; } }

/* ---------- project list / dashboard cards ---------- */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { padding: var(--s3) var(--s4); border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.stat b { display: block; font-size: 26px; line-height: 1.15; } .stat span { font-size: 13px; color: var(--muted); }
.cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.pcard { display: flex; flex-direction: column; gap: var(--s3); }
.pcard h3 { font-size: 17px; } .pcard .counts { display: flex; gap: var(--s3); flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pcard .counts span { display: inline-flex; align-items: center; gap: 5px; }
.attn { display: flex; gap: var(--s3); align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; text-decoration: none; color: inherit; }
.attn:first-child { border-top: 0; }
.attn .ic { margin-top: 2px; }
.sev-high .ic { color: var(--bad); } .sev-medium .ic { color: var(--warn); } .sev-low .ic { color: var(--info); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--subtle); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; border-top: 0; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- player ---------- */
.player-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-items: start; }
@media (min-width: 1040px) { .player-grid { grid-template-columns: minmax(0, 1fr) 390px; } .side-sticky { position: sticky; top: 72px; } }
.wave-wrap { position: relative; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.wave-scroll { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.wave-inner { position: relative; min-width: 100%; }
canvas.wave { display: block; width: 100%; height: 112px; touch-action: pan-y; cursor: pointer; user-select: none; -webkit-user-select: none; }
@media (min-width: 720px) { canvas.wave { height: 140px; } }
.marks { position: relative; height: 22px; border-top: 1px solid var(--line); }
.mark { position: absolute; top: 2px; width: 14px; height: 18px; margin-left: -7px; background: none; border: 0; padding: 0; cursor: pointer; }
.mark::after { content: ""; position: absolute; left: 2px; top: 3px; width: 10px; height: 12px; background: var(--accent); clip-path: polygon(0 0, 100% 0, 50% 100%); }
.mark.done::after { background: var(--subtle); opacity: .6; } .mark.imp::after { background: var(--bad); }
.rbar { position: absolute; top: 8px; height: 6px; background: var(--accent); border-radius: 3px; border: 0; padding: 0; cursor: pointer; opacity: .85; min-width: 6px; }
.rbar.done { background: var(--subtle); opacity: .5; }
.playbar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.playbar .time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; min-width: 88px; }
.play-btn { width: 56px; height: 56px; border-radius: 50%; padding: 0; flex: none; }
.play-btn .ic { width: 24px; height: 24px; }
.mini-player { position: sticky; top: 56px; z-index: 20; background: rgba(0, 0, 0, .94); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); margin: 0 calc(var(--s4) * -1); padding: 8px var(--s4); border-bottom: 1px solid var(--line); }
@media (min-width: 720px) { .mini-player { position: static; margin: 0; padding: 0; border: 0; background: none; backdrop-filter: none; } }
.metric { display: inline-flex; flex-direction: column; padding: 6px 12px; border-radius: var(--r-sm); background: var(--bg-2); border: 1px solid var(--line); min-width: 78px; }
.metric b { font-size: 15px; font-variant-numeric: tabular-nums; } .metric span { font-size: 11px; color: var(--subtle); text-transform: uppercase; letter-spacing: .05em; }
.ab { display: flex; gap: var(--s2); }
.ab .btn { flex: 1; }
.ab .btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- comments ---------- */
.comment { display: flex; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.comment:first-child { border-top: 0; }
.comment.reply { margin-left: 22px; padding-left: var(--s3); border-left: 2px solid var(--line); border-top: 0; }
.comment.active { background: var(--accent-soft); margin: 0 calc(var(--s3) * -1); padding-left: var(--s3); padding-right: var(--s3); border-radius: var(--r-sm); }
.comment.done .c-body { opacity: .6; text-decoration: line-through; }
.c-main { flex: 1; min-width: 0; }
.c-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.c-meta strong { color: var(--text); }
.c-body { margin-top: 4px; white-space: pre-wrap; }
.c-actions { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 4px; margin-left: -8px; }
.ts-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); font-weight: 700; font-size: 12.5px; cursor: pointer; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: capitalize; }
.flag-on { color: var(--bad); }

/* ---------- to-dos ---------- */
.todo { display: flex; align-items: flex-start; gap: var(--s3); padding: 10px 0; border-top: 1px solid var(--line); }
.todo:first-child { border-top: 0; }
.todo .check-box { width: 26px; height: 26px; margin-top: 1px; border: 2px solid var(--line-strong); border-radius: 7px; background: var(--bg-2); cursor: pointer; flex: none; display: flex; align-items: center; justify-content: center; color: transparent; padding: 0; }
.todo .check-box:hover { border-color: var(--accent); }
.todo .check-box.on { background: var(--ok); border-color: var(--ok); color: #04150c; }
.todo-main { flex: 1; min-width: 0; }
.todo-title { cursor: pointer; }
.todo-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.folder-row { display: flex; align-items: center; gap: var(--s2); min-height: 48px; padding: 0 4px; font-weight: 700; cursor: pointer; border-top: 1px solid var(--line); }
.folder-kids { margin-left: 14px; padding-left: 12px; border-left: 2px solid var(--line); }
.add-row { display: flex; gap: var(--s2); padding: var(--s3) 0 0; flex-wrap: wrap; }
.add-row input { flex: 1; min-width: 160px; }

/* ---------- messages ---------- */
.msgs { display: flex; flex-direction: column; gap: var(--s3); }
.bubble-wrap { display: flex; flex-direction: column; max-width: 88%; }
.bubble-wrap.mine { align-self: flex-end; align-items: flex-end; }
.bubble { background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 10px 14px; }
.mine .bubble { background: var(--accent-soft); border-color: var(--accent-line); border-radius: 16px 16px 4px 16px; }
.bubble.pinned { border-color: var(--warn); }
.bubble .who { font-size: 12px; color: var(--muted); margin-bottom: 2px; font-weight: 650; }
.bubble .txt { white-space: pre-wrap; }
.bubble .when { font-size: 11.5px; color: var(--subtle); margin-top: 4px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px; margin: 6px 6px 0 0; border-radius: var(--r-sm); background: var(--bg-2); border: 1px solid var(--line-strong); color: var(--text); text-decoration: none; font-size: 14px; max-width: 100%; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.unread-line { display: flex; align-items: center; gap: var(--s3); color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.unread-line::before, .unread-line::after { content: ""; flex: 1; height: 1px; background: var(--accent-line); }
.composer { display: flex; gap: var(--s2); align-items: flex-end; }
.composer textarea { min-height: 44px; max-height: 160px; resize: none; }
.composer-bar { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 15; background: rgba(0, 0, 0, .95); padding: var(--s2) 0; margin-top: var(--s3); border-top: 1px solid var(--line); }
@media (min-width: 720px) { .composer-bar { bottom: 0; } }

/* ---------- files ---------- */
.drop { border: 2px dashed var(--line-strong); border-radius: var(--r); padding: var(--s5) var(--s4); text-align: center; color: var(--muted); background: var(--bg-2); cursor: pointer; }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.drop .ic { margin: 0 auto 6px; color: var(--accent); }
.fileline { display: flex; align-items: center; gap: var(--s3); padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.fileline:first-child { border-top: 0; }
.fileline .ico { color: var(--muted); }
.fileline .nm { flex: 1; min-width: 140px; overflow-wrap: anywhere; font-weight: 600; }
.queue-item { padding: 10px 0; border-top: 1px solid var(--line); }
.queue-item:first-child { border-top: 0; }

/* ---------- timeline / activity ---------- */
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: flex; gap: var(--s3); padding: 8px 0; font-size: 14px; border-top: 1px solid var(--line); }
.tl li:first-child { border-top: 0; }
.tl .when { margin-left: auto; color: var(--subtle); font-size: 12px; white-space: nowrap; padding-left: 8px; }
.ms { display: flex; align-items: center; gap: var(--s3); padding: 10px 0; border-top: 1px solid var(--line); }
.ms:first-child { border-top: 0; }
.ms.overdue .due { color: var(--bad); font-weight: 700; }

/* ---------- login + guest page ---------- */
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: var(--s5) var(--s4); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .brand-big { display: flex; flex-direction: column; align-items: center; gap: var(--s3); margin-bottom: var(--s5); text-align: center; }
.auth-card .brand-big img { height: 56px; }
.auth-card .brand-big b { letter-spacing: .12em; text-transform: uppercase; font-size: 15px; }

.preview-banner { position: sticky; top: 56px; z-index: 25; display: flex; align-items: center; gap: var(--s3); padding: 8px var(--s4); background: var(--info); color: #06142e; font-weight: 700; font-size: 14px; }
.preview-banner button { background: #06142e; color: #fff; border: 0; border-radius: var(--r-sm); min-height: 36px; padding: 0 14px; font-weight: 700; cursor: pointer; }

/* ---------- additions ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-items: start; }
@media (min-width: 960px) { .two-col { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.pulse { animation: pulse 1s ease-in-out 3; outline: 3px solid var(--accent); outline-offset: 3px; border-radius: var(--r); }
@keyframes pulse { 50% { outline-color: transparent; } }
.reply-box textarea { min-height: 64px; }
.menu-h { padding: 8px 12px; font-size: 12px; color: var(--subtle); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.tabbar .tb { position: relative; }
.proj-head > .stack, .proj-head .tip { margin: 0; }
.side-sticky { min-width: 0; }
.attn-list { display: flex; flex-direction: column; }
@media (max-width: 719px) { h1 { font-size: 21px; } .page { padding: var(--s3); } .chips-scroll { margin: 0 calc(var(--s3) * -1); padding-left: var(--s3); padding-right: var(--s3); } .mini-player { margin: 0 calc(var(--s3) * -1); padding: 8px var(--s3); } }
.stack > .card-title, .stack-lg > .card-title { margin-bottom: 0; }
.proj-switch .sw-name { display: none; max-width: 150px; }
@media (min-width: 420px) { .proj-switch .sw-name { display: inline; } }
@media (max-width: 719px) { .brand-text { font-size: 12px; letter-spacing: .07em; } .top-in { gap: var(--s2); } .proj-switch { padding: 0 10px; } }

.proj-head.compact { padding: 10px 12px; gap: 8px; }
.proj-head.compact h1 { font-size: 17px; }
@media (max-width: 719px) { .actions-row > .btn:not(.btn-icon) { flex: 1 1 40%; } }

/* ---------- touch targets (checked at 375px and 412px) ---------- */
.btn-icon { flex: none; }
.check-box { position: relative; width: 28px; height: 28px; border: 2px solid var(--line-strong); border-radius: 8px; background: var(--bg-2); cursor: pointer; flex: none; display: inline-flex; align-items: center; justify-content: center; color: transparent; padding: 0; }
.check-box::after { content: ""; position: absolute; inset: -10px; }
.check-box:hover { border-color: var(--accent); }
.check-box.on { background: var(--ok); border-color: var(--ok); color: #04150c; }
span.check-box::after { display: none; }
.ts-chip { position: relative; min-height: 28px; }
.ts-chip::after { content: ""; position: absolute; inset: -9px -5px; }
.marks { height: 30px; }
.mark { top: 0; width: 30px; height: 30px; margin-left: -15px; }
.mark::after { left: 10px; top: 8px; }
.rbar { top: 10px; height: 10px; }
.rbar::after { content: ""; position: absolute; inset: -10px 0; }
@media (pointer: coarse) { .chip { min-height: 44px; } }

/* ---------- robustness fixes found by the phone audit ---------- */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; margin: -1px !important; border: 0 !important; overflow: hidden !important; clip: rect(0 0 0 0) !important; white-space: nowrap !important; }
.preview-banner button { min-height: 44px; }
.file-chip { min-height: 44px; }
.chip { min-width: 44px; justify-content: center; }
html, body { overflow-x: clip; }

/* ---------- upload helper ---------- */
.helper-row { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: var(--r); background: var(--bg-2); }
