/* Themes: light and warm only, no dark mode (issue #9). Chai is the default; pick another with THEME. */
:root {
  color-scheme: light;
  --bg: #faf6ef; --card: #fffdf9; --ink: #231d17; --muted: #6e6255; --line: #e8dfd2; --hero: #f3e6d6;
  --accent: #b4441a; --accent-ink: #fff; --accent-soft: #f6e2d6; --link: #b4441a;
  --ok: #2f7d45; --bad: #b42318; --wait: #8a5a00; --focus: #1d4ed8;
}
:root[data-theme="haldi"] {
  --bg: #fff9ec; --card: #fffef8; --ink: #2a2113; --muted: #6f5f43; --line: #efe2c2; --hero: #fcefc9;
  --accent: #e7a417; --accent-ink: #2a1c00; --accent-soft: #fbebc4; --link: #8a5a00; --focus: #7a3e00;
}
:root[data-theme="gulab"] {
  --bg: #fff6f4; --card: #fff; --ink: #2b1a1c; --muted: #735a5e; --line: #f1dcda; --hero: #fce6e8;
  --accent: #b8335a; --accent-ink: #fff; --accent-soft: #fbe1e6; --link: #b8335a; --bad: #a4161a;
}
:root[data-theme="mitti"] {
  --bg: #f6f1e7; --card: #fffcf6; --ink: #26211b; --muted: #6a6052; --line: #e3d9c6; --hero: #e9e3d2;
  --accent: #8c4f2b; --accent-ink: #fff; --accent-soft: #ecdccb; --link: #8c4f2b;
  --ok: #4e7a4a; --bad: #a4161a; --wait: #7a5300; --focus: #2f5d8a;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-x: hidden; }
a { color: var(--link); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: .4rem 0 .6rem; overflow-wrap: anywhere; }
p, li { max-width: 75ch; }

/* ---------- Page frame ---------- */
.wrap { width: 100%; max-width: 1440px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; }
.topline { border-bottom: 1px solid var(--line); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; display: inline-flex; gap: 8px; align-items: center; min-height: 44px; }
.brand::before { content: ""; width: 26px; height: 26px; border-radius: 8px; background: var(--accent); }
.inline { display: inline; margin: 0; font-size: .9rem; }
.link { background: none; border: 0; padding: 0; min-height: 44px; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.eyebrow { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--link); font-weight: 700; margin: 0; }
.muted-eyebrow { color: var(--muted); margin-top: 32px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; margin-left: auto; margin-right: auto; }
.back { color: var(--muted); font-size: .9rem; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.steps { color: var(--muted); padding-left: 1.2rem; }
.actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
label { font-size: .9rem; font-weight: 600; display: block; }
.input { display: block; width: 100%; min-height: 46px; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font: inherit; font-weight: 400; color: var(--ink); background: var(--card); }
.input:focus { border-color: var(--accent); }
.row2 { display: flex; gap: 12px; }
.row2 > * { flex: 1; min-width: 0; }
.card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--card); margin: 16px 0 0; }
.consent { margin: 0; }
.consent p { margin: 0 0 8px; font-size: .9rem; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin-top: 8px; min-height: 28px; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-family: inherit; font-size: 1rem; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.big { min-height: 56px; font-size: 1.1rem; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.err { color: var(--bad); font-size: .9rem; margin: 0; }
.err:empty { display: none; }
.st { font-size: .8rem; font-weight: 700; white-space: nowrap; }
.st.ready { color: var(--ok); } .st.busy { color: var(--link); } .st.fail { color: var(--bad); } .st.nf { color: var(--muted); } .st.wait { color: var(--wait); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- Landing ---------- */
.land { display: grid; gap: 32px; padding-top: 40px; padding-bottom: 56px; min-height: calc(100dvh - 73px); align-content: center; }
.land h1 { font-size: 2.1rem; }
.howto { display: grid; gap: 12px; list-style: none; padding: 0; margin: 0; }
.howto li { display: flex; gap: 14px; align-items: flex-start; margin: 0; max-width: none; }
.howto .n { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--link); display: grid; place-items: center; font-weight: 700; }
.howto p { margin: 2px 0 0; }


/* ---------- Dashboard ---------- */
.banner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--hero); border-color: transparent; margin-top: 0; }
.banner h1 { font-size: 1.3rem; margin: 0; }
.banner p { margin: 4px 0 0; }
.convs { list-style: none; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: 1fr; border: 1px solid var(--line); border-radius: 16px; background: var(--card); overflow: hidden; }
.convs li { margin: 0; max-width: none; }
.convs li + li { border-top: 1px solid var(--line); }
.conv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; min-height: 64px; height: 100%; color: var(--ink); text-decoration: none; }
.conv > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.conv .badges { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.empty { text-align: center; padding: 40px 16px; }
.empty .icon { font-size: 2rem; margin: 0; }
.empty p { margin-left: auto; margin-right: auto; }

/* ---------- New conversation + recorder ---------- */
.newg { display: grid; gap: 20px; }
.newg > * { min-width: 0; }
.tips ul { margin: 8px 0 0; padding-left: 1.2rem; }
.tips li { margin: 6px 0; }
.tips-toggle summary { cursor: pointer; font-weight: 600; min-height: 28px; }
.tips-panel { display: none; }
.recorder { display: flex; flex-direction: column; align-items: center; padding: 16px 0; max-width: 520px; margin: 0 auto; }
.mic { --level: 0; width: 170px; height: 170px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; margin-top: 16px;
  box-shadow: 0 0 0 calc(6px + var(--level) * 34px) color-mix(in srgb, var(--accent) 16%, transparent); transition: box-shadow .08s linear; }
.mic span { width: 104px; height: 104px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font-size: 40px; }
.mic.off { box-shadow: none; }
.mic.off span { background: var(--muted); }
.timer { font: 600 2.4rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 24px 0 4px; font-variant-numeric: tabular-nums; }
.recorder .err { max-width: 420px; margin-top: 12px; }
.actions-row { width: 100%; max-width: 420px; margin-top: 24px; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); margin: 16px auto; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .mic { transition: none; } }

/* ---------- Conversation ---------- */
.title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.convg { display: grid; }
.convg > * { min-width: 0; }
.fail-title { color: var(--bad); margin: 0; }
.turns { list-style: none; padding: 0; margin: 16px 0 0; }
.turns li { display: flex; gap: 12px; margin-top: 14px; }
.turns .t { width: 48px; flex: none; color: var(--muted); font: .75rem ui-monospace, monospace; padding-top: 3px; }
.turns p { margin: 0; overflow-wrap: anywhere; }
.who { font-size: .75rem; font-weight: 700; }
.who.a { color: var(--link); } .who.b { color: var(--ok); }
.transcript { margin-top: 20px; }
.transcript > summary { cursor: pointer; font-weight: 600; padding: 8px 0; min-height: 44px; }

/* "Your app" (issue #4) */
.app { margin-top: 20px; }
.app-title { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.05rem; margin: 0 0 10px; }
.app .steps { list-style: none; padding: 0; margin: 0 0 8px; color: var(--ink); }
.app .steps li { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; }
.app .dot { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 12px; margin-top: 2px; border: 2px solid var(--line); color: var(--muted); }
.app .done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.app .now .dot { border-color: var(--accent); border-top-color: transparent; animation: spin 1s linear infinite; }
.app .failed .dot { background: var(--bad); border-color: var(--bad); color: #fff; }
.app .you .dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.app .waiting .lab { color: var(--muted); }
.app .lab small { display: block; color: var(--muted); font-size: .8rem; }
@media (prefers-reduced-motion: reduce) { .app .now .dot { animation: none; } }
.plan { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 10px 0; }
.plan .chrome { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); padding: 4px 10px; border-bottom: 1px solid var(--line); background: var(--bg); }
.plan .chrome a { display: inline-flex; align-items: center; min-height: 36px; }
.plan iframe { display: block; width: 100%; height: 60vh; min-height: 360px; border: 0; background: #fff; }
.decide { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: start; }
.decide > :only-child, .decide .changes[open] { grid-column: 1 / -1; }
.approve-form { margin: 0; }
.approve-form .btn, .changes summary { width: 100%; }
.changes summary { list-style: none; }
.changes summary::-webkit-details-marker { display: none; }
.changes[open] summary { margin-bottom: 10px; }
.link-card { display: block; border: 1px solid var(--ok); border-radius: 12px; padding: 12px; margin: 10px 0; color: var(--ink); overflow-wrap: anywhere; text-decoration: none; background: color-mix(in srgb, var(--ok) 10%, var(--card)); }
.note { border-radius: 10px; background: var(--accent-soft); padding: 10px 12px; font-size: .9rem; margin: 10px 0; }
.rounds { font-size: .85rem; color: var(--muted); }
dialog.confirm { border: 1px solid var(--line); border-radius: 16px; background: var(--card); color: var(--ink); max-width: 420px; width: calc(100% - 32px); padding: 18px; }
dialog.confirm::backdrop { background: rgba(35, 29, 23, .35); }

/* ---------- Tablet 640–1199px ---------- */
@media (min-width: 640px) {
  .wrap { padding-left: 32px; padding-right: 32px; }
  .convs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; border: 0; background: none; overflow: visible; border-radius: 0; }
  .convs li + li { border-top: 0; }
  .conv { flex-direction: column; align-items: stretch; justify-content: space-between; min-height: 132px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
  .conv .badges { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
  .decide { grid-template-columns: 1fr 1fr; }
  .plan iframe { height: 520px; }
}

/* ---------- Desktop ≥1200px (designed at 1920px) ---------- */
@media (min-width: 1200px) {
  .wrap { padding-left: 48px; padding-right: 48px; }
  h1 { font-size: 2rem; }
  .land { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; gap: 72px; }
  .land h1 { font-size: 3rem; max-width: 16ch; }
  .convs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .newg { grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 48px; align-items: start; }
  .tips-toggle { display: none; }
  .tips-panel { display: block; position: sticky; top: 24px; }
  .recording .newg { grid-template-columns: minmax(0, 1fr); }
  .convg { grid-template-columns: minmax(0, 1.7fr) minmax(380px, 1fr); gap: 32px; align-items: start; }
  .convg .plan iframe { height: max(640px, calc(100dvh - 420px)); }
  .txpanel { position: sticky; top: 24px; max-height: calc(100dvh - 48px); overflow: auto; }
}
/* While recording, the recorder stands alone on every size. */
.recording .tips-panel, .recording .tips-toggle { display: none !important; }

/* ---------- Publish to live (issue #15) ---------- */
.topnav { display: flex; align-items: center; gap: 14px; }
@media (max-width: 639px) { .topnav .inline .muted, .topnav .inline .sep { display: none; } }
.row-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; margin: 6px 0; }
.row-actions > * { flex: 1 1 100%; }
.row-actions form { margin: 0; } .row-actions form .btn, .row-actions > .btn { width: 100%; }
.publish summary { list-style: none; width: 100%; }
.publish summary::-webkit-details-marker { display: none; }
.publish[open] summary { margin-bottom: 4px; }
.publish .addr { color: var(--ink); overflow-wrap: anywhere; }
.note.bad { background: color-mix(in srgb, var(--bad) 10%, var(--card)); border-left: 4px solid var(--bad); }
.spinner.sm { width: 18px; height: 18px; margin: 0 6px 0 0; display: inline-block; vertical-align: -3px; border-width: 3px; }
@media (min-width: 640px) { .row-actions > * { flex: 1 1 0; } .publish[open] { flex-basis: 100%; } }

/* ---------- Admin portal (issue #15). Mobile first: bottom tabs; tablet: icon rail; desktop: sidebar. ---------- */
body.admin { background: #f3eee6; }
.ap { --side: #1f1a15; --side-2: #2c251f; --side-ink: #e8dfd2; --side-mute: #a39686; --canvas: #f3eee6; --panel: #fffdf9; --row: #faf6ef;
  --ok-soft: color-mix(in srgb, var(--ok) 12%, #fff); --wait-soft: color-mix(in srgb, var(--wait) 14%, #fff); --bad-soft: color-mix(in srgb, var(--bad) 10%, #fff);
  display: grid; grid-template-columns: 1fr; min-height: 100dvh; background: var(--canvas); font-size: 14px; }
.ap * { min-width: 0; }
.ap a { color: var(--link); }
.ap h1 { font-size: 22px; margin: 0; line-height: 1.25; }
.ap h2 { font-size: 15px; margin: 0; }
.ap .muted { color: var(--muted); } .ap .small { font-size: 13px; }
.ap-side { position: sticky; bottom: 0; order: 2; z-index: 5; display: flex; background: var(--side); color: var(--side-ink); padding: 4px 6px; border-top: 1px solid #3a3129; }
.ap-brand, .ap-sec, .ap-me, .ap-side .ext { display: none; }
.ap-chip { font-size: 10px; letter-spacing: .14em; background: var(--accent); color: #fff; padding: 2px 7px; border-radius: 4px; }
.ap-nav { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; border-radius: 8px; color: var(--side-ink) !important; text-decoration: none; font-size: 11px; font-weight: 500; }
.ap-nav:hover, .ap-nav.on { background: var(--side-2); color: #fff !important; }
.ap-nav.on::before { content: ""; position: absolute; left: 25%; right: 25%; top: -4px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
.ap-nav svg { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; }
.ap-nav .n { position: absolute; top: 4px; right: calc(50% - 24px); background: var(--accent); color: #fff; font-style: normal; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 0 6px; }
.ap-out { background: none; border: 0; padding: 0; color: var(--side-mute); font: inherit; font-size: 12px; text-decoration: underline; cursor: pointer; min-height: 44px; }
.av { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.av.lg { width: 56px; height: 56px; font-size: 20px; }
.ap-main { display: flex; flex-direction: column; }
.ap-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; background: var(--side); color: var(--side-ink); }
.ap-menu { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.ap-menu::before { content: ""; width: 24px; height: 24px; border-radius: 6px; background: var(--accent); }
.crumb { display: none; gap: 8px; align-items: center; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb a { color: var(--muted); text-decoration: none; } .crumb b { color: var(--ink); }
.ap-search { order: 3; width: 100%; margin: 0; position: relative; }
.ap-search input { width: 100%; min-height: 44px; padding: 0 12px 0 34px; border-radius: 8px; border: 1px solid #3a3129; background: var(--side-2); color: #fff; font: inherit; }
.ap-search::before { content: "⌕"; position: absolute; left: 12px; top: 10px; color: var(--side-mute); font-size: 16px; }
.env { font-size: 11px; font-weight: 700; color: var(--ok); background: var(--ok-soft); border-radius: 4px; padding: 3px 8px; letter-spacing: .06em; margin-left: auto; }
.ap-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.ap-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ap-title p { margin: 4px 0 0; color: var(--muted); }
.ap-note { margin: 0; padding: 10px 14px; border-radius: 8px; border-left: 4px solid var(--ok); background: var(--ok-soft); }
.ap-note.warn { border-color: var(--wait); background: var(--wait-soft); } .ap-note.bad { border-color: var(--bad); background: var(--bad-soft); }
.ap-empty { padding: 24px 16px; margin: 0; color: var(--muted); text-align: center; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 2px; }
.kpi small { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.kpi b { font-size: 22px; line-height: 1.2; }
.kpi span { font-size: 12px; color: var(--muted); } .kpi span.up { color: var(--ok); } .kpi span.warn { color: var(--wait); font-weight: 600; }
.kpi.hl { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.panel-h { display: flex; align-items: center; gap: 8px 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-h h2 { margin-right: auto; }
.panel-b { padding: 16px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; background: var(--canvas); max-width: 100%; }
.seg a { flex: none; padding: 0 12px; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 13px; border-right: 1px solid var(--line); white-space: nowrap; }
.seg a:last-child { border-right: 0; } .seg a.on { background: var(--panel); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.seg i { font-style: normal; font-size: 11px; color: var(--muted); }
.tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; width: 100%; }
.tools .tool[type="search"] { flex: 1 1 160px; }
.tool { min-height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font: inherit; font-size: 13px; color: var(--ink); }
.ap table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ap thead { display: none; }
.ap tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.ap tbody tr:last-child { border-bottom: 0; }
.ap td { display: block; padding: 0; vertical-align: middle; }
.ap td.hm { display: none; } .ap td.full { grid-column: 1 / -1; }
.ap td .sub { display: block; font-size: 12px; color: var(--muted); }
.ap td b, .ap td .mono { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; }
.mono-cell a { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12.5px; word-break: break-all; }
.who { display: flex; gap: 10px; align-items: center; }
.ap .dot { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.ap .dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.d-ok { color: var(--ok); } .d-wait { color: var(--wait); } .d-bad { color: var(--bad); } .d-off { color: #7d7368; } .d-acc { color: var(--accent); } .d-prev { color: #6a5f8a; }
.age { font-size: 12px; } .age.old { color: var(--bad); font-weight: 700; }
.acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.acts > *, .acts form { flex: 1 1 auto; margin: 0; } .acts form .b2, .acts > .b2 { width: 100%; }
.b2 { min-height: 44px; padding: 0 12px; border-radius: 7px; font: 600 13px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; border: 1px solid var(--line); background: var(--panel); color: var(--ink) !important; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; text-decoration: none; }
.b2.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink) !important; }
.b2.ok { background: var(--ok); border-color: var(--ok); color: #fff !important; }
.b2.bad { color: var(--bad) !important; border-color: color-mix(in srgb, var(--bad) 35%, #fff); }
.b2.bad.fill { background: var(--bad); color: #fff !important; border-color: var(--bad); }
.b2.off, .b2:disabled { opacity: .5; cursor: default; }
.lnk { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; min-height: 44px; display: inline-flex; align-items: center; }
.inl { display: inline; margin: 0; }
.rej { position: relative; }
.rej summary { list-style: none; width: 100%; } .rej summary::-webkit-details-marker { display: none; }
.rej-pop { display: grid; gap: 6px; margin-top: 8px; padding: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.12); }
.rej-pop label, .field label { font-weight: 600; font-size: 12.5px; }
.ap textarea, .ap input[type=text], .ap input[type=email], .ap input[type=password] { width: 100%; font: inherit; font-size: 14px; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; min-height: 44px; color: var(--ink); }
.ap textarea { min-height: 90px; }
.hint { font-size: 12px; color: var(--muted); }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.pager span:first-child { margin-right: auto; }
.props { display: grid; grid-template-columns: 110px 1fr; margin: 0 0 14px; }
.props dt, .props dd { padding: 9px 0; border-bottom: 1px solid var(--line); margin: 0; }
.props dt { color: var(--muted); font-size: 12.5px; } .props dd { overflow-wrap: anywhere; }
.props > :nth-last-child(-n+2) { border-bottom: 0; }
.props .sub { display: block; font-size: 12px; color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.ap .stack { display: grid; gap: 16px; margin: 0; }
.idhead { display: flex; gap: 14px; align-items: center; } .idhead p { margin: 2px 0 0; }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.tl li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.tl li::after { content: ""; position: absolute; left: 7.5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.tl li:last-child::after { display: none; }
.tl small { display: block; color: var(--muted); }
.txl { display: grid; gap: 10px; max-height: 70dvh; overflow: auto; }
.turn { display: grid; grid-template-columns: 72px 1fr; gap: 10px; font-size: 14px; }
.turn b { font-size: 12px; color: var(--accent); padding-top: 2px; } .turn.b-side b { color: #6a5f8a; }
.turn time { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.bar { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--wait-soft); border: 1px solid color-mix(in srgb, var(--wait) 30%, #fff); border-radius: 10px; flex-wrap: wrap; }
.dz { border-color: color-mix(in srgb, var(--bad) 25%, #fff); } .dz .panel-h { background: color-mix(in srgb, var(--bad) 5%, #fff); border-radius: 10px 10px 0 0; }
.dz-row { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.dz-row:first-child { padding-top: 0; } .dz-row:last-child { border-bottom: 0; padding-bottom: 0; }
.dz-row p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.del summary { list-style: none; } .del summary::-webkit-details-marker { display: none; }
.del-form { display: grid; gap: 8px; margin-top: 10px; }
dialog.ap-dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--ink); max-width: 440px; width: calc(100% - 32px); padding: 20px; font-size: 15px; }
dialog.ap-dialog::backdrop { background: rgba(31, 26, 21, .45); }
dialog.ap-dialog p { margin: 0 0 16px; }
dialog.ap-dialog .acts { justify-content: flex-end; }

@media (min-width: 640px) {
  .ap { grid-template-columns: 68px minmax(0, 1fr); }
  .ap-side { position: sticky; top: 0; bottom: auto; order: 0; height: 100dvh; flex-direction: column; align-items: center; gap: 4px; padding: 16px 10px; border-top: 0; }
  .ap-brand { display: flex; align-items: center; padding: 6px 0 16px; }
  .ap-brand::before { content: ""; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); }
  .ap-brand span { display: none; }
  .ap-side a.ext { display: flex; }
  .ap-nav { flex: none; width: 48px; min-height: 44px; font-size: 0; }
  .ap-nav span { display: none; }
  .ap-nav .n { top: 2px; right: -4px; font-size: 10px; }
  .ap-nav.on::before { left: -10px; right: auto; top: 10px; bottom: 10px; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  .ap-me { display: flex; margin-top: auto; padding-top: 12px; border-top: 1px solid #3a3129; }
  .ap-me div { display: none; }
  .ap-head { flex-wrap: nowrap; height: 60px; padding: 0 20px; background: var(--panel); color: var(--ink); border-bottom: 1px solid var(--line); }
  .ap-menu { display: none; }
  .crumb { display: flex; }
  .ap-search { order: 0; width: 240px; margin-left: auto; }
  .ap-search input { min-height: 40px; background: var(--canvas); border-color: var(--line); color: var(--ink); }
  .ap-search::before { top: 8px; color: var(--muted); }
  .env { margin-left: 0; }
  .ap-body { padding: 24px 20px 40px; gap: 18px; }
  .kpis { gap: 12px; } .kpi b { font-size: 26px; }
  .ap thead { display: table-header-group; }
  .ap tr { display: table-row; padding: 0; }
  .ap tbody tr:hover td { background: #fbf4ea; }
  .ap th { text-align: left; background: var(--row); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 16px; white-space: nowrap; border-bottom: 1px solid var(--line); }
  .ap td { display: table-cell; padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .ap tbody tr:last-child td { border-bottom: 0; }
  .ap td.hm { display: table-cell; }
  .ap td.t-hide, .ap th.t-hide { display: none; }
  .acts { flex-wrap: wrap; justify-content: flex-end; }
  .acts > *, .acts form { flex: none; }
  .acts form .b2, .acts > .b2 { width: auto; }
  .tools { width: auto; }
  .rej-pop { position: absolute; right: 0; z-index: 10; width: 320px; text-align: left; }
  .dz-row { flex-direction: row; justify-content: space-between; align-items: center; }
  .dz-row.col { flex-direction: column; align-items: stretch; }
  .note-cell { max-width: 260px; }
}
@media (min-width: 1200px) {
  .ap { grid-template-columns: 232px minmax(0, 1fr); }
  .ap-side { align-items: stretch; padding: 16px 12px; }
  .ap-brand { gap: 8px; padding: 6px 4px 18px; font-weight: 700; font-size: 14px; white-space: nowrap; }
  .ap-brand span { display: inline; }
  .ap-sec { display: block; font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--side-mute); padding: 14px 10px 6px; }
  .ap-nav { width: auto; flex-direction: row; justify-content: flex-start; gap: 10px; padding: 0 10px; font-size: 14px; }
  .ap-nav span { display: inline; }
  .ap-nav .n { position: static; margin-left: auto; font-size: 11px; padding: 1px 8px; }
  .ap-nav.on::before { left: -12px; }
  .ap-me { gap: 10px; align-items: center; padding: 14px 8px 0; }
  .ap-me div { display: block; }
  .ap-head { padding: 0 28px; }
  .ap-search { width: 320px; }
  .ap-body { padding: 24px 28px 40px; }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ap td.t-hide, .ap th.t-hide { display: table-cell; }
  .acts { flex-wrap: nowrap; }
  .split { grid-template-columns: 340px minmax(0, 1fr); gap: 18px; }
  .split.r { grid-template-columns: minmax(0, 1fr) 380px; }
}

/* ---------- Idea check questions (issue #14) ---------- */
.questions { border: 1px solid var(--line); border-left: 4px solid var(--wait); border-radius: 12px; padding: 14px 16px; margin: 12px 0; background: var(--card); }
.questions ol { margin: 6px 0 4px; padding-left: 1.3rem; } .questions li { margin: 4px 0; overflow-wrap: anywhere; }
.ap .qh { font-size: 13px; margin: 14px 0 6px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ap .checks { list-style: none; margin: 0; padding: 0; } .ap .checks li { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; overflow-wrap: anywhere; }
.ap .checks li:last-child { border-bottom: 0; } .ap .checks .sub { display: block; font-size: 12px; color: var(--muted); }
.ap .qa ol { margin: 4px 0; padding-left: 1.2rem; font-size: 13px; } .ap .qa .sub { font-size: 12px; color: var(--muted); margin: 0 0 8px; overflow-wrap: anywhere; }
.setup-checks span { display: inline-block; margin: 0 8px 4px 0; font-size: 12.5px; }

/* ---------- Phone app card (issue #26) ---------- */
.appcol > .card:first-child { margin-top: 16px; }
.phone .ph-q { font-weight: 600; margin: 0 0 10px; }
.phone .dev { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.phone .dev button { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 12px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.phone .dev button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.phone .dev svg { width: 26px; height: 26px; flex: none; }
.phone .dev small { display: block; color: var(--muted); font-size: 12.5px; }
.ic-android { fill: var(--ok); } .ic-apple { fill: var(--ink); }
.phone .nojs { font-size: 1rem; margin: 14px 0 6px; }
.phone .btn.big { min-height: 54px; font-size: 1.05rem; }
.phone .dl { margin: 4px 0 6px; }
.phone .facts { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 4px 0 0; }
.phone .steps { margin: 14px 0 8px; padding-left: 1.4rem; display: grid; gap: 8px; }
.phone .warn { border-left: 3px solid var(--wait); background: color-mix(in srgb, var(--wait) 12%, var(--card)); border-radius: 0 10px 10px 0; padding: 8px 12px; margin: 10px 0; }
.phone .fp summary { cursor: pointer; color: var(--link); font-size: .9rem; }
.phone .fp code { display: block; margin-top: 6px; font: 12.5px ui-monospace, "SF Mono", Menlo, monospace; overflow-wrap: anywhere; background: var(--hero); padding: 8px 10px; border-radius: 8px; }
.phone .ios-note { background: var(--hero); border-radius: 14px; padding: 12px 14px; }
.phone [hidden] { display: none !important; }

/* ---------- Admin sign-in (issue #30) ---------- */
.ap-login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(ellipse at 20% 0%, #2c251f 0%, #1f1a15 60%); }
.ap-login-box { width: 100%; max-width: 380px; background: #fffdf9; color: #231d17; border-radius: 18px; padding: 28px 24px; box-shadow: 0 30px 60px rgba(0, 0, 0, .35); }
.ap-login-box .ap-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 18px; }
.ap-login-box .ap-chip { font-size: 10px; font-weight: 800; letter-spacing: .08em; background: #b4441a; color: #fff; border-radius: 6px; padding: 2px 7px; }
.ap-login-box h1 { font-size: 22px; margin: 0 0 4px; }
.ap-login-box label { display: block; font-weight: 600; font-size: 14px; margin: 12px 0 6px; }
.ap-login-box input { width: 100%; min-height: 46px; border: 1px solid #e8dfd2; border-radius: 12px; padding: 10px 12px; font: inherit; background: #fff; }
.ap-login-box .b2.pri { width: 100%; min-height: 48px; margin-top: 18px; border: 0; border-radius: 12px; background: #b4441a; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.ap-login-box .ap-note { margin: 10px 0 0; }

/* ---------- Phone preview before the build (issue #34) ---------- */
.phone .chrome { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); margin: 8px 0 6px; }
.phone .phone-frame { width: 320px; max-width: 100%; margin: 0 auto 10px; border: 9px solid #1d1b20; border-radius: 34px; overflow: hidden; background: #fff; box-shadow: 0 12px 30px rgba(0, 0, 0, .15); }
.phone .phone-frame iframe { display: block; width: 100%; height: 600px; border: 0; }
.phone .decide { margin-top: 6px; }
.phone .rounds { font-size: .85rem; color: var(--muted); margin: 8px 0 0; }
.phone .phone-approve { margin: 0; } .phone .phone-approve .btn, .phone .changes summary { width: 100%; }

/* ---------- Community (issue #37) ---------- */
/* Look: specs/community-ui/FE-preview.html. Pictures are inline SVG coloured by theme tokens; motion stops with reduce-motion. */
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: .92rem; }
.top { flex-wrap: nowrap; }
.cm-nav { display: flex; gap: 4px; margin-right: auto; margin-left: 8px; }
.cm-nav a { color: var(--muted); text-decoration: none; font-weight: 600; padding: 8px 12px; border-radius: 10px; min-height: 40px; display: inline-flex; align-items: center; }
.cm-nav a.on { color: var(--ink); background: var(--accent-soft); }
.topnav .inline { display: inline-flex; align-items: center; gap: 6px; }
.cm-av { flex: none; width: 32px; height: 32px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: .85rem; background: var(--accent-soft); color: var(--link); }
.cm-av.lg { width: 46px; height: 46px; font-size: 1.1rem; }
.cm-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--hero); color: var(--ink); white-space: nowrap; }
.cm-pill.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.cm-pill.bad { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.livedot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: cm-live 1.8s infinite; }
@keyframes cm-live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
.cm-tabbar { display: none; }
@media (max-width: 699px) {
  .cm-nav, .cm-start, .cm-uname, .topnav .sep { display: none; }
  .cm-tabbar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--card); border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); }
  .cm-tabbar a { display: grid; justify-items: center; gap: 2px; font-size: .75rem; font-weight: 600; color: var(--muted); text-decoration: none; padding: 4px; }
  .cm-tabbar a.on { color: var(--link); }
  .cm-tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .cm-tabbar .cm-tmic { color: var(--ink); }
  .cm-tabbar .cm-tmic span { width: 52px; height: 52px; margin-top: -24px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 40%, transparent); }
  body:has(.cm-tabbar) main { padding-bottom: 104px; }
}

/* Home */
main.cm { padding-top: 0; }
.cm-hero { background: var(--hero); border-bottom: 1px solid var(--line); }
.cm-hero-in { display: grid; gap: 28px; padding-top: 36px; padding-bottom: 36px; align-items: center; }
.cm-hero h1 { font-size: clamp(1.9rem, 4.4vw, 3.4rem); line-height: 1.08; letter-spacing: -.02em; margin: 10px 0 14px; text-wrap: balance; }
.cm-lead { font-size: 1.1rem; color: var(--muted); margin: 0; max-width: 46ch; }
.cm-count { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 22px 0 0; }
.cm-count b { color: var(--ink); }
.cm-stack { display: flex; } .cm-stack .cm-av { border: 2px solid var(--hero); margin-left: -8px; animation: cm-bob 4s infinite ease-in-out; } .cm-stack .cm-av:first-child { margin-left: 0; }
.cm-stack .cm-av:nth-child(2) { animation-delay: .5s; } .cm-stack .cm-av:nth-child(3) { animation-delay: 1s; } .cm-stack .cm-av:nth-child(4) { animation-delay: 1.5s; }
@keyframes cm-bob { 50% { transform: translateY(-3px); } }

/* Hero picture */
.cm-scene { position: relative; max-width: 520px; width: 100%; margin: 0 auto; aspect-ratio: 520 / 420; }
.cm-ill { position: absolute; inset: 0; width: 100%; height: 100%; }
.cm-ill .f-ink { fill: var(--ink); } .cm-ill .o85 { opacity: .85; } .f-acc { fill: var(--accent); } .f-card { fill: var(--card); } .f-soft { fill: var(--accent-soft); }
.f-line { fill: var(--line); } .f-muted { fill: var(--muted); } .f-bulb { fill: #f2c14e; } .f-haldi { fill: #e7a417; } .f-skin1 { fill: #c98b62; } .f-skin2 { fill: #8d5a3b; }
.f-hair1 { fill: #2a1d16; } .f-hair2 { fill: #3a2418; } .f-wood { fill: #6d4a30; } .f-chai { fill: #b77a45; } .f-board { fill: #c9a27a; }
.s-ink { stroke: var(--ink); stroke-width: 1.5; } .s-acc { stroke: var(--accent); } .s-muted { stroke: var(--muted); } .w { stroke-width: 2.5; fill: none; stroke-linecap: round; }
.s-bulb { stroke: #f2c14e; stroke-width: 3; stroke-linecap: round; }
.s-steam path { stroke: var(--muted); stroke-width: 2; fill: none; stroke-linecap: round; }
.cm-bub { position: absolute; margin: 0; font-size: .88rem; line-height: 1.4; padding: 9px 13px; max-width: 46%; border-radius: 18px; background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--ink) 10%, transparent); }
.cm-bub small { display: block; font-size: .72rem; font-weight: 700; opacity: .75; }
.cm-bub.cm-fr { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.cm-bub.cm-b1 { left: 0; top: 11%; } .cm-bub.cm-b2 { left: 30%; top: 25%; } .cm-bub.cm-b3 { left: 2%; top: 39%; }
.cm-mphone { position: absolute; right: 3%; top: 12%; width: 25%; aspect-ratio: 9 / 17; border-radius: 20px; border: 6px solid var(--ink); background: var(--card); padding: 14px 9px;
  display: grid; gap: 7px; align-content: start; box-shadow: 0 14px 30px color-mix(in srgb, var(--ink) 22%, transparent); transform: rotate(3deg); }
.cm-mphone i { display: block; border-radius: 6px; transform-origin: left; }
.cm-mphone .cm-ln { height: 8px; width: 70%; background: var(--accent); } .cm-mphone .cm-rw { height: 22px; background: var(--hero); border: 1px solid var(--line); }
.cm-made { position: absolute; right: 0; bottom: 6%; margin: 0; padding: 9px 14px; border-radius: 14px; background: var(--card); border: 1px dashed var(--accent); font-weight: 700; font-size: .9rem; }
.typing { display: inline-flex; gap: 4px; } .typing i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .4; animation: cm-dot 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cm-dot { 50% { opacity: 1; transform: translateY(-3px); } }
/* One 12-second loop: talk, idea, phone fills, "App made". At rest (reduce motion) everything shows. */
.cm-bub.say { animation: cm-say 12s infinite both; } .cm-bub.cm-b2 { animation-delay: 1.6s; } .cm-bub.cm-b3 { animation-delay: 3.2s; }
@keyframes cm-say { 0% { opacity: 0; transform: translateY(10px) scale(.92); } 4%, 78% { opacity: 1; transform: none; } 86%, 100% { opacity: 0; transform: translateY(-6px); } }
.cm-mphone { animation: cm-rise 12s infinite both; }
@keyframes cm-rise { 0%, 30% { opacity: 0; transform: translateY(24px) rotate(6deg); } 38%, 88% { opacity: 1; transform: rotate(3deg); } 96%, 100% { opacity: 0; transform: translateY(-10px) rotate(3deg); } }
.cm-mphone i { animation: cm-fill 12s infinite both; } .cm-mphone i:nth-child(3) { animation-delay: .3s; } .cm-mphone i:nth-child(4) { animation-delay: .6s; } .cm-mphone i:nth-child(5) { animation-delay: .9s; }
@keyframes cm-fill { 0%, 40% { transform: scaleX(0); } 48%, 100% { transform: scaleX(1); } }
.cm-made { animation: cm-pop 12s infinite both; }
@keyframes cm-pop { 0%, 58% { opacity: 0; transform: scale(.6); } 63% { opacity: 1; transform: scale(1.08); } 66%, 88% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; } }
.bulb { transform-box: fill-box; transform-origin: center; animation: cm-glow 12s infinite both; }
@keyframes cm-glow { 0%, 22% { opacity: 0; transform: scale(.5); } 28%, 88% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; } }
.nod { transform-box: fill-box; transform-origin: 50% 90%; animation: cm-nod 3s infinite ease-in-out; } .nod.n2 { animation-delay: 1.5s; }
@keyframes cm-nod { 30% { transform: rotate(-4deg); } 60% { transform: rotate(3deg); } }
.s-steam path { animation: cm-steam 2.6s infinite ease-in-out; } .s-steam .s2 { animation-delay: 1.3s; }
@keyframes cm-steam { 0% { opacity: 0; transform: translateY(6px); } 40% { opacity: .7; } 100% { opacity: 0; transform: translateY(-14px); } }

/* How it works */
.cm-how { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 12px; }
.cm-how li { display: flex; gap: 14px; align-items: flex-start; margin: 0; max-width: none; }
.cm-pic { flex: none; width: 64px; height: 64px; border-radius: 16px; background: var(--hero); display: grid; place-items: center; }
.cm-pic svg { width: 46px; height: 46px; overflow: visible; }
.wave { animation: cm-wave 1.6s infinite; } .wave.w2 { animation-delay: .4s; }
@keyframes cm-wave { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
.grow { transform-box: fill-box; transform-origin: left; animation: cm-grow 3s infinite both; } .grow.g2 { animation-delay: .4s; } .grow.g3 { animation-delay: .8s; }
@keyframes cm-grow { 0% { transform: scaleX(0); } 30%, 100% { transform: scaleX(1); } }
.sway { transform-box: fill-box; transform-origin: 50% 0; animation: cm-sway 3s infinite ease-in-out; }
@keyframes cm-sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }

/* Feed */
.cm-feedhead { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; justify-content: space-between; margin: 36px 0 16px; }
.cm-feedhead h2 { margin: 2px 0 0; font-size: 1.5rem; }
.cm-search { display: flex; gap: 8px; width: 100%; max-width: 420px; }
.cm-search .input { margin: 0; }
.cm-feed { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; grid-template-columns: 1fr; }
.cm-feed li { margin: 0; max-width: none; }
.cm-app { display: flex; flex-direction: column; gap: 10px; height: 100%; margin: 0; color: var(--ink); text-decoration: none; overflow: hidden; transition: transform .15s, box-shadow .15s; animation: cm-in .5s both; }
.cm-app:hover, .cm-app:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 22px color-mix(in srgb, var(--ink) 9%, transparent); }
@keyframes cm-in { from { opacity: .3; transform: translateY(10px); } }
.cm-app h3 { margin: 4px 0 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.cm-solves { margin: 0; font-size: .95rem; overflow-wrap: anywhere; }
.cm-solves b { color: var(--muted); font-weight: 600; }
.cm-by { display: flex; gap: 10px; align-items: center; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); font-size: .88rem; color: var(--muted); }
.cm-by .cm-pill { margin-left: auto; }
.cm-cover { position: relative; display: block; aspect-ratio: 16 / 8; margin: -16px -16px 0; overflow: hidden; background: var(--tone);
  background-image: radial-gradient(circle at 85% 20%, rgba(255, 255, 255, .3) 0 18%, transparent 19%), repeating-linear-gradient(135deg, transparent 0 14px, rgba(255, 255, 255, .09) 14px 15px); }
.t0 { --tone: #b4441a; } .t1 { --tone: #c77d1e; } .t2 { --tone: #8c4f2b; } .t3 { --tone: #b8335a; } .t4 { --tone: #4e7a4a; } .t5 { --tone: #a0612f; } .t6 { --tone: #2f6b5e; } .t7 { --tone: #7a4b8c; }
.cm-cover .cm-live { position: absolute; top: 10px; left: 10px; display: inline-flex; gap: 6px; align-items: center; background: #fffdf9; color: #2f7d45; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.cm-cp { position: absolute; left: 50%; bottom: -30%; width: 30%; aspect-ratio: 9 / 15; translate: -50% 0; border-radius: 16px; border: 5px solid #231d17; background: #fffdf9;
  padding: 10px 7px; display: grid; gap: 5px; align-content: start; transition: transform .3s; }
.cm-cp .g { font-size: 1.5rem; line-height: 1; text-align: center; margin-bottom: 2px; }
.cm-cp i { display: block; height: 7px; border-radius: 4px; background: #e8dfd2; } .cm-cp i.cm-hi { background: var(--tone); width: 60%; }
.cm-app:hover .cm-cp, .cm-app:focus-visible .cm-cp { transform: translateY(-12%) rotate(-3deg); }
.cm-more { text-align: center; margin: 24px 0 0; max-width: none; }
.cm-none { text-align: center; padding: 32px 16px; }
.cm-band { display: grid; gap: 12px; align-items: center; margin-top: 40px; background: var(--accent-soft); border-color: transparent; }
.cm-band h2 { margin: 0; font-size: 1.3rem; } .cm-band p { margin: 4px 0 0; }

/* App page */
.cm-apppage { display: grid; gap: 24px; padding-top: 20px; }
.cm-apppage h1 { font-size: clamp(1.7rem, 3.4vw, 2.6rem); margin: 6px 0; }
.cm-tags { display: flex; gap: 8px; margin: 8px 0 0; }
.cm-quote { font-size: 1.2rem; line-height: 1.45; margin: 18px 0; padding: 18px 20px; border-left: 4px solid var(--accent); background: var(--card); border-radius: 0 14px 14px 0; overflow-wrap: anywhere; }
.cm-quote small { display: block; font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.cm-maker { display: flex; gap: 12px; align-items: center; }
.cm .addr { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; overflow-wrap: anywhere; background: var(--hero); padding: 8px 10px; border-radius: 10px; }
.cm-side { display: grid; gap: 12px; margin: 0; align-content: start; }
.cm-side .btn { width: 100%; }
.cm-side p { margin: 0; }
.cm-phone { position: relative; overflow: hidden; width: 210px; max-width: 100%; margin: 0 auto 4px; aspect-ratio: 9 / 18; border-radius: 30px; border: 8px solid var(--ink);
  background: var(--bg); padding: 70px 12px 16px; display: grid; gap: 8px; align-content: start; }
.cm-phone i { display: block; border-radius: 8px; }
.cm-phone .cm-ln { height: 10px; background: var(--line); } .cm-phone .cm-ln.cm-hi { width: 60%; background: var(--tone); }
.cm-phone .cm-rw { height: 34px; background: var(--card); border: 1px solid var(--line); }
.cm-notif { position: absolute; left: 8px; right: 8px; top: 8px; background: var(--ink); color: var(--card); border-radius: 12px; padding: 8px 10px; font-size: .75rem; animation: cm-notif 6s infinite both; }
.cm-notif b { display: block; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cm-notif span { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 8px; background: var(--tone); color: #fff; font-weight: 700; animation: cm-tap 6s infinite both; }
@keyframes cm-notif { 0%, 10% { transform: translateY(-130%); } 18%, 70% { transform: none; } 80%, 100% { transform: translateY(-130%); } }
@keyframes cm-tap { 45% { transform: none; } 50% { transform: scale(.88); } 55% { transform: none; } }
.cm-phone .tick { animation: cm-tick 6s infinite both; }
@keyframes cm-tick { 0%, 52% { background: var(--card); } 56%, 100% { background: color-mix(in srgb, var(--ok) 18%, var(--card)); } }

/* Owner: share card */
.cm-share { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.cm-sh { font-size: 1rem; margin: 0 0 4px; }
.cm-state { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.cm-icons { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cm-icons legend { font-size: .9rem; font-weight: 600; margin-bottom: 6px; }
.cm-icons label { position: relative; display: block; }
.cm-icons input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.cm-icons label > span[aria-hidden] { display: grid; place-items: center; width: 44px; height: 44px; font-size: 1.35rem; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); }
.cm-icons input:checked + span { border: 2px solid var(--accent); background: var(--accent-soft); }
.cm-icons input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (max-width: 539px) {
  .cm-bub { font-size: .72rem; padding: 6px 9px; max-width: 54%; border-radius: 14px; }
  .cm-bub small { font-size: .64rem; }
  .cm-bub.cm-b1 { top: 8%; } .cm-bub.cm-b2 { left: 22%; top: 25%; } .cm-bub.cm-b3 { top: 42%; }
  .cm-made { font-size: .78rem; padding: 6px 10px; }
}
@media (min-width: 640px) {
  .cm-feed { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cm-how { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cm-band { grid-template-columns: 1fr auto; padding: 24px 28px; }
}
@media (min-width: 960px) {
  .cm-hero-in { grid-template-columns: 1.2fr 1fr; padding-top: 60px; padding-bottom: 60px; }
  .cm-apppage { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
}
@media (min-width: 1100px) { .cm-feed { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1600px) { .cm-feed { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) {
  .cm *, .cm-tabbar *, .cm-share * { animation: none !important; transition: none !important; }
  .cm-scene .cm-bub, .cm-mphone, .cm-made, .bulb { opacity: 1 !important; transform: none !important; }
  .cm-notif { transform: none !important; }
}

/* ---------- Sign in / sign up (issue #40) ---------- */
/* Look: specs/auth-pages/FE-preview.html. Reuses the #37 picture parts and colours. */
.au-hd { display: flex; justify-content: space-between; align-items: center; padding-top: 14px; padding-bottom: 14px; }
.au-back { color: var(--muted); font-weight: 600; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
main.au { display: grid; gap: 20px; padding-top: 0; }
.au-form { width: 100%; max-width: 460px; margin: 0 auto; align-self: center; }
.au-form h1 { font-size: clamp(1.75rem, 3.6vw, 2.5rem); line-height: 1.1; letter-spacing: -.02em; margin: 22px 0 6px; }
.au-lead { color: var(--muted); margin: 0 0 22px; }
.au-sw { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: var(--hero); border-radius: 999px; padding: 4px; }
.au-sw::before { content: ""; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: var(--card);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ink) 12%, transparent); animation: au-pill-in .35s cubic-bezier(.2, .8, .2, 1) both; }
.au-sw.up::before { transform: translateX(100%); animation-name: au-pill-up; }
@keyframes au-pill-in { from { transform: translateX(100%); } to { transform: none; } }
@keyframes au-pill-up { from { transform: none; } to { transform: translateX(100%); } }
.au-sw a { position: relative; z-index: 1; text-align: center; padding: 10px 12px; min-height: 44px; border-radius: 999px; font-weight: 700; color: var(--muted); text-decoration: none; }
.au-sw a[aria-current="page"] { color: var(--ink); }
.au-fm { display: grid; gap: 16px; }
.au-f { display: grid; gap: 6px; font-size: .95rem; }
.au-fi { position: relative; display: block; }
.au-fi svg { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; translate: 0 -50%; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; transition: stroke .2s; }
.au-fi .input { margin: 0; min-height: 52px; border-width: 1.5px; border-radius: 14px; padding-left: 46px; transition: border-color .2s, box-shadow .2s; }
.au-fi .input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.au-fi:focus-within svg { stroke: var(--accent); }
.au-fi .au-pw { padding-right: 72px; }
.au-eye { position: absolute; right: 6px; top: 50%; translate: 0 -50%; min-height: 40px; padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--link); font: inherit; font-size: .9rem; font-weight: 700; cursor: pointer; }
.au-hint { display: flex; gap: 6px; align-items: center; margin: -6px 0 0; font-size: .9rem; color: var(--muted); transition: color .2s; }
.au-ck { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 11px; color: transparent; transition: all .2s; }
.au-hint.ok { color: var(--ok); } .au-hint.ok .au-ck { background: var(--ok); border-color: var(--ok); color: #fff; transform: scale(1.1); }
.au-btn { width: 100%; min-height: 54px; border-radius: 14px; font-size: 1.05rem; font-weight: 700; box-shadow: 0 8px 18px color-mix(in srgb, var(--accent) 28%, transparent); transition: transform .15s, box-shadow .15s; }
.au-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 34%, transparent); }
.au-btn:active { transform: translateY(1px); }
.au-btn:disabled { opacity: .85; cursor: progress; transform: none; }
.au-spin { display: none; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, var(--accent-ink) 35%, transparent); border-top-color: var(--accent-ink); animation: spin .8s linear infinite; }
.au-btn.busy .au-spin { display: block; }
.au-err:not(:empty) { padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--bad) 10%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); font-size: .95rem; animation: au-slide .35s ease-out; }
.au-has-err .au-fm { animation: au-shake .4s .1s; }
@keyframes au-slide { from { opacity: 0; transform: translateY(-8px); } }
@keyframes au-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.au-trust { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 0; font-size: .88rem; color: var(--muted); max-width: none; }
.au-trust svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--ok); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.au-alt { text-align: center; color: var(--muted); margin: 18px auto 0; }

/* Picture panel */
.au-side { order: -1; position: relative; min-height: 170px; border-radius: 24px; background: var(--hero); overflow: hidden; }
.au-big { position: absolute; left: 18px; top: 18px; margin: 0; font-size: 1.4rem; font-weight: 800; line-height: 1.05; letter-spacing: -.02em; }
.au-big span { color: var(--link); }
.au-ill { position: absolute; right: -20px; bottom: 0; width: 250px; height: auto; }
.au-ill .s-wave { stroke: var(--accent); stroke-width: 14; stroke-linecap: round; }
.au-wave { transform-box: fill-box; transform-origin: 20% 90%; animation: au-wave 2.4s infinite ease-in-out; }
@keyframes au-wave { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-14deg); } 20%, 40% { transform: rotate(10deg); } }
.au-join, .au-bub, .au-ph, .au-made, .au-fl { display: none; }
.au-join { position: absolute; left: 28px; right: 28px; top: 200px; margin: 0; gap: 10px; align-items: center; font-size: .9rem; color: var(--muted); }
.au-join b { color: var(--ink); }
.au-join .cm-av { border-color: var(--hero); background: var(--card); }
.au-bub { position: absolute; margin: 0; max-width: 230px; padding: 9px 13px; border-radius: 18px; font-size: .9rem; line-height: 1.4; background: var(--card); border: 1px solid var(--line); box-shadow: 0 6px 16px color-mix(in srgb, var(--ink) 10%, transparent); }
.au-bub small { display: block; font-size: .7rem; font-weight: 700; opacity: .75; }
.au-fr { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.au-b1 { left: 8%; top: 40%; } .au-b2 { left: 26%; top: 54%; }
.au-ph { position: absolute; right: 10%; top: 16%; width: 120px; aspect-ratio: 9 / 17; border-radius: 20px; border: 6px solid var(--ink); background: var(--card); padding: 12px 8px; gap: 7px; align-content: start;
  box-shadow: 0 14px 30px color-mix(in srgb, var(--ink) 22%, transparent); transform: rotate(3deg); }
.au-ph i { display: flex; align-items: center; gap: 5px; border-radius: 6px; transform-origin: left; font-style: normal; }
.au-ph .cm-ln { height: 8px; width: 70%; background: var(--accent); }
.au-ph .cm-rw { height: 22px; padding: 0 6px; font-size: .58rem; font-weight: 700; background: var(--hero); border: 1px solid var(--line); }
.au-ph .cm-rw b { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: none; animation: cm-live 1.8s infinite; }
.au-made { position: absolute; right: 6%; top: 58%; margin: 0; padding: 9px 14px; border-radius: 14px; background: var(--card); border: 1px dashed var(--accent); font-weight: 700; font-size: .9rem; }
.au-fl { position: absolute; border: 2px solid var(--hero); background: var(--card); animation: au-float 6s infinite ease-in-out; }
.au-fl1 { left: 62%; top: 8%; } .au-fl2 { left: 8%; top: 70%; animation-delay: -2s; } .au-fl3 { right: 4%; top: 6%; animation-delay: -4s; }
@keyframes au-float { 50% { transform: translateY(-10px) rotate(4deg); } }
/* The 12-second story on Create account: talk, phone fills in, "App made". */
.au-bub.say { animation: cm-say 12s infinite both; } .au-b2.say { animation-delay: 1.6s; }
.au-rise { animation: au-rise 12s infinite both; }
@keyframes au-rise { 0%, 24% { opacity: 0; transform: translateY(24px) rotate(6deg); } 32%, 88% { opacity: 1; transform: rotate(3deg); } 96%, 100% { opacity: 0; } }
.au-rise i { animation: au-fill 12s infinite both; } .au-rise i:nth-child(3) { animation-delay: .3s; } .au-rise i:nth-child(4) { animation-delay: .6s; }
@keyframes au-fill { 0%, 34% { transform: scaleX(0); } 42%, 100% { transform: scaleX(1); } }
.au-rise ~ .au-made { animation: au-pop 12s infinite both; }
@keyframes au-pop { 0%, 50% { opacity: 0; transform: scale(.6); } 55% { opacity: 1; transform: scale(1.08); } 58%, 88% { opacity: 1; transform: none; } 96%, 100% { opacity: 0; } }
@media (min-width: 900px) {
  main.au { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 48px; align-items: stretch; min-height: calc(100dvh - 140px); padding-bottom: 56px; }
  .au-side { order: 0; min-height: 560px; }
  .au-big { left: 28px; top: 26px; font-size: clamp(1.75rem, 3.2vw, 2.5rem); }
  .au-ill { left: 50%; right: auto; width: min(100%, 560px); translate: -50% 0; }
  .au-join { display: flex; } .au-bub, .au-made { display: block; } .au-ph, .au-fl { display: grid; }
}
@media (prefers-reduced-motion: reduce) {
  .au *, .au *::before, .au-sw::before { animation: none !important; transition: none !important; }
}

/* ---------- Solo recording (issue #43) ---------- */
/* Look: specs/solo-recording/FE-preview.html. The radios decide which fields show; works without JS. */
.mode-pick { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-opt { position: relative; display: block; font-weight: 400; }
.mode-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.mode-opt > span { display: flex; gap: 12px; align-items: center; height: 100%; padding: 14px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--card);
  transition: border-color .2s, box-shadow .2s, transform .15s; }
.mode-opt:hover > span { transform: translateY(-1px); }
.mode-opt input:checked + span { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); background: color-mix(in srgb, var(--accent-soft) 45%, var(--card)); }
.mode-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.mode-opt svg { flex: none; width: 46px; height: 46px; }
.mode-opt b { display: block; } .mode-opt small { color: var(--muted); font-size: .82rem; }
#setup:has(input[name="mode"][value="solo"]:checked) .duo-only,
#setup:has(input[name="mode"][value="duo"]:checked) .solo-only { display: none; }
#setup:has(input[name="mode"][value="solo"]:checked) .row2 { display: block; }
@media (max-width: 479px) { .mode-opt > span { flex-direction: column; align-items: flex-start; gap: 6px; } }

.guide { width: 100%; max-width: 520px; margin: 18px 0 6px; border-radius: 18px; background: var(--ink); color: var(--card); padding: 18px 20px; }
.g-k { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; opacity: .7; font-weight: 700; }
.g-q { font-size: 1.3rem; line-height: 1.3; font-weight: 700; margin: 6px 0 12px; min-height: 2.6em; max-width: none; }
.g-q.in { animation: g-in .4s ease-out; }
@keyframes g-in { from { opacity: 0; transform: translateY(8px); } }
.g-bar { height: 4px; border-radius: 4px; background: color-mix(in srgb, var(--card) 20%, transparent); overflow: hidden; }
.g-bar i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .25s linear; }
.g-row { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.g-dots { display: flex; gap: 6px; } .g-dots i { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--card) 30%, transparent); }
.g-dots i.on { background: var(--accent); }
#g-next { font: inherit; font-size: .9rem; font-weight: 700; color: var(--card); background: color-mix(in srgb, var(--card) 14%, transparent); border: 0; border-radius: 10px; padding: 8px 12px; min-height: 40px; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .g-q.in { animation: none; } .g-bar i, .mode-opt > span { transition: none; } }

/* Issue #57: admin page card (owner only). */
.admincard .envsw { display: inline-flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.admincard .envsw [aria-pressed="true"] { background: var(--ink); color: var(--card); border-color: var(--ink); }
.admincard .pwrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.admincard .pw { flex: 1 1 180px; min-width: 0; overflow-wrap: anywhere; font: 14px ui-monospace, monospace; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; }
