/* Roster chat app. Apple interface standards (Apple HIG and Emil Kowalski's apple-design, emil-design-eng and
   gestures skills, MIT): system font, Apple neutrals and system blue, translucent materials with content scrolling
   underneath, springs and strong ease-out curves under 300ms, press feedback on everything. House rules kept:
   no pill shapes, no emojis, no em dashes. */

:root {
  --font-head: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --bg: #ffffff; --bg2: #f5f5f7; --surface: #ffffff; --line: rgba(60,60,67,.18); --line-soft: rgba(60,60,67,.1);
  --fg: #1d1d1f; --fg2: #424245; --fg3: #6e6e73;
  --accent: #0071e3; --accent-hover: #0077ed; --accent-text: #0066cc; --accent-dim: rgba(0,113,227,.14);
  --accent-wash: #eef5fe; --accent-highlight: #d6e8fc;
  --ok: #248a3d; --bad: #d70015; --bad-field: #ff6961; --notice-bg: #fff4d6; --notice-fg: #6b4e00;
  --ink: #1d1d1f; --ink-hover: #333336;
  --bubble: #e9e9eb;
  --select: rgba(0,0,0,.06);
  --shadow: 0 1px 3px rgba(0,0,0,.05), 0 10px 30px -12px rgba(0,0,0,.16);
  --shadow-lg: 0 30px 80px -30px rgba(0,0,0,.4);
  --shadow-accent: 0 10px 24px -12px rgba(0,113,227,.6);
  --chrome: rgba(255,255,255,.72);
  --chrome-edge: rgba(0,0,0,.08);
  /* Motion: strong ease-out for UI, the iOS drawer curve for sheets, ease-in-out for on-screen moves. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --ease: var(--ease-out);
  --side: 300px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --bg2: #161617; --surface: #1c1c1e; --line: rgba(235,235,245,.14); --line-soft: rgba(235,235,245,.08);
    --fg: #f5f5f7; --fg2: rgba(235,235,245,.78); --fg3: rgba(235,235,245,.56);
    --accent-text: #2997ff; --accent-dim: rgba(41,151,255,.24); --accent-wash: #0b1f36; --accent-highlight: #12345a;
    --ok: #30d158; --bad: #ff453a; --bad-field: #ff6961; --notice-bg: rgba(255,214,10,.1); --notice-fg: #ffd60a;
    --ink: #f5f5f7; --ink-hover: #e3e3e8;
    --bubble: #2c2c2e;
    --select: rgba(255,255,255,.08);
    --shadow: 0 1px 3px rgba(0,0,0,.5), 0 10px 30px -12px rgba(0,0,0,.8);
    --chrome: rgba(22,22,23,.72);
    --chrome-edge: rgba(255,255,255,.08);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 400 1.0625rem/1.47 var(--font-body);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-optical-sizing: auto;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; margin: 0; letter-spacing: -0.015em; line-height: 1.12; }
h1 { font-size: 2rem; letter-spacing: -0.022em; line-height: 1.08; }
h2 { font-size: 1.375rem; letter-spacing: -0.016em; font-weight: 650; }
h3 { font-size: 1.0625rem; letter-spacing: -0.01em; font-weight: 600; }
p { margin: 0 0 .75em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--fg3); }
.small { font-size: .8125rem; letter-spacing: .01em; }
.eyebrow { font: 600 .8125rem/1.2 var(--font-body); letter-spacing: 0; color: var(--accent-text); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: 0 1.25rem; border-radius: 12px; border: 1px solid transparent;
  font: 590 1.0625rem/1 var(--font-body); letter-spacing: -0.01em; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  touch-action: manipulation; user-select: none;
  transition: background .15s ease, border-color .15s ease, box-shadow .2s var(--ease-out), transform .16s var(--ease-out), color .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible, .field:focus-visible, .seg button:focus-visible, .tabs button:focus-visible, .switch input:focus-visible + span { outline: none; box-shadow: 0 0 0 4px var(--accent-dim); border-color: var(--accent); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ink { background: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--fg); }
.btn-danger { background: transparent; border-color: var(--line); color: var(--bad); }
.btn-sm { min-height: 38px; padding: 0 .9rem; font-size: .9375rem; border-radius: 10px; }
.btn-xs { min-height: 34px; padding: 0 .7rem; font-size: .8125rem; border-radius: 8px; }
.btn .arrow { transition: transform .2s var(--ease); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; font-weight: 500; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--fg2); }
.icon-btn, .link-btn, .tabs button, .seg button, .mention-pop button, .m-work summary, .faces, .ch-title { touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform .16s var(--ease-out), background .12s ease, color .12s ease; }
.icon-btn:active, .seg button:active, .tabs button:active, .mention-pop button:active, .ch-title:active, .faces:active { transform: scale(.96); }
.suggest .btn:active, .tpl:active, .pack:active, .page-card:active { transform: scale(.985); }

/* ---------- fields ---------- */
.label { display: block; font: 600 .75rem/1.2 var(--font-body); letter-spacing: .02em; text-transform: uppercase; color: var(--fg3); margin: 0 0 .45rem; }
.field {
  width: 100%; min-height: 46px; padding: .65rem .9rem; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); transition: border-color .15s ease, box-shadow .2s var(--ease-out); font-size: 1.0625rem;
}
textarea.field { resize: vertical; line-height: 1.5; }
select.field { appearance: none; padding-right: 2.4rem; background-image: linear-gradient(45deg, transparent 50%, var(--fg3) 50%), linear-gradient(135deg, var(--fg3) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; }
.field.bad { border-color: var(--bad-field); }
.hint { font-size: .8125rem; color: var(--fg3); margin-top: .4rem; letter-spacing: .01em; }
.err { font-size: .875rem; color: var(--bad); margin-top: .5rem; }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 1rem; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }

/* square switch, never a capsule */
.switch { position: relative; display: inline-flex; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { width: 46px; height: 28px; border-radius: 7px; background: var(--line); border: 1.5px solid transparent; transition: background .2s var(--ease); position: relative; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 5px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .25s cubic-bezier(.3,1.3,.5,1); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

/* segmented: 10px segments, never capsules */
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; background: var(--surface); flex-wrap: wrap; }
.seg button { min-height: 40px; padding: 0 1rem; border: 0; border-radius: 7px; background: transparent; cursor: pointer; color: var(--fg2); font-weight: 500; touch-action: manipulation; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

/* text tabs with a 2px accent underline */
.tabs { display: flex; gap: 1.5rem; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: .85rem 0; min-height: 44px; cursor: pointer; color: var(--fg3); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }

/* ---------- cards and markers ---------- */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: 18px; padding: 1.35rem; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.card-head h3 { display: flex; align-items: center; gap: .5rem; }
.tag { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .5rem; border-radius: 6px; background: var(--bg2); color: var(--fg2); font-size: .75rem; font-weight: 600; letter-spacing: .01em; }
.tag-blue { background: var(--accent-dim); color: var(--accent-text); }
.mark { display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: var(--fg3); flex: none; }
.status { display: inline-flex; align-items: center; gap: .45rem; font-size: .8125rem; font-weight: 600; letter-spacing: .01em; color: var(--fg3); }
.status.ok, .status.running { color: var(--ok); } .status.ok .mark, .status.running .mark { background: var(--ok); }
.status.error { color: var(--bad); } .status.error .mark { background: var(--bad); }
.status.queued, .status.working { color: var(--accent-text); } .status.queued .mark, .status.working .mark { background: var(--accent); }
.avatar { width: 40px; height: 40px; border-radius: 10px; display: inline-grid; place-items: center; color: #fff; font: 650 .95rem/1 var(--font-head); letter-spacing: -0.02em; flex: none; }
.avatar.lg { width: 52px; height: 52px; border-radius: 12px; font-size: 1.15rem; }
.avatar.sm { width: 28px; height: 28px; border-radius: 7px; font-size: .72rem; }
.avatar[data-ink] { color: var(--bg); }
.notice { background: var(--notice-bg); color: var(--notice-fg); border-radius: 10px; padding: .8rem 1rem; font-size: .9375rem; display: flex; gap: .6rem; align-items: flex-start; }
.notice code { background: rgba(0,0,0,.06); padding: .05rem .3rem; border-radius: 4px; }
.squares { list-style: none; padding: 0; margin: 0; }
.squares li { position: relative; padding-left: 1.2rem; margin: .45rem 0; }
.squares li::before { content: ""; position: absolute; left: 0; top: .62em; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }

/* ---------- app shell: rail of conversations, a stage, a details column ---------- */
.app { height: 100dvh; display: grid; grid-template-columns: 1fr; overflow: hidden; }
.rail, .stage, .details { min-width: 0; min-height: 0; }
.app[data-screen="list"] .stage, .app[data-screen="list"] .details { display: none; }
.app[data-screen="main"] .rail { display: none; }
@media (min-width: 900px) {
  .app { grid-template-columns: var(--side) minmax(0, 1fr); }
  .app.with-details { grid-template-columns: var(--side) minmax(0, 1fr) 340px; }
  .app[data-screen] .rail { display: flex; }
  .app[data-screen] .stage { display: block; }
}
.rail { display: flex; flex-direction: column; background: var(--bg2); border-right: 1px solid var(--line); height: 100dvh; padding-top: env(safe-area-inset-top); }
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .85rem .75rem .6rem 1rem; }
.rail-head .brand { min-width: 0; padding: 0; font-size: 1.05rem; }
.rail-head .brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { display: flex; align-items: center; gap: .6rem; font: 700 1.2rem/1 var(--font-head); letter-spacing: -0.03em; color: var(--fg); text-decoration: none !important; padding: .25rem .5rem; }
.brand svg { flex: none; }
.rail-scroll { flex: 1; overflow-y: auto; padding: 0 .5rem 1rem; overscroll-behavior: contain; }
.rail-sec { display: flex; align-items: center; justify-content: space-between; padding: 1rem .5rem .3rem .6rem; font: 700 .8125rem/1.2 var(--font-body); letter-spacing: 0; color: var(--fg3); }
.rail-empty { font-size: .8125rem; color: var(--fg3); padding: .25rem .6rem; margin: 0; }
.ri { position: relative; display: grid; grid-template-columns: 36px minmax(0, 1fr) 8px; gap: .7rem; align-items: center; padding: .55rem .6rem; border-radius: 12px; color: var(--fg); text-decoration: none !important; min-height: 58px; transition: background .12s ease, transform .16s var(--ease-out); touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.ri .avatar.sm, .ri .hash { width: 36px; height: 36px; border-radius: 10px; }
.ri:active { transform: scale(.98); }
.ri[aria-current="page"] { background: var(--select); }
.ri-icon { position: relative; display: grid; place-items: center; }
.ri-paused { position: absolute; right: -2px; bottom: -2px; width: 9px; height: 9px; border-radius: 3px; background: var(--fg3); border: 2px solid var(--bg2); }
.ri-main { min-width: 0; display: grid; gap: .05rem; }
.ri-top { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.ri-top strong { font-weight: 600; font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ri-top time { font-size: .72rem; color: var(--fg3); flex: none; font-variant-numeric: tabular-nums; }
.ri-prev { font-size: .8125rem; color: var(--fg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.ri-dot { width: 7px; height: 7px; border-radius: 2px; }
.ri.new .ri-dot { background: var(--accent); }
.ri.new .ri-top strong, .ri.new .ri-prev { color: var(--fg); }
.ri.new .ri-top strong { font-weight: 700; }
.rail-cta { display: grid; gap: .15rem; margin: .25rem .25rem; padding: .85rem .9rem; border-radius: 12px; border: 1.5px dashed var(--line); color: var(--fg); text-decoration: none !important; }
.rail-cta span { font-size: .8125rem; color: var(--fg3); }
.rail-foot { display: grid; gap: .1rem; padding: .5rem .5rem calc(.6rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.rail-foot a { display: flex; align-items: center; gap: .7rem; min-height: 42px; padding: 0 .65rem; border-radius: 10px; color: var(--fg2); font-weight: 500; text-decoration: none; font-size: .9375rem; }
.rail-foot a[aria-current="page"] { background: var(--accent-wash); color: var(--accent-text); }
.hash { width: 32px; height: 32px; border-radius: 9px; display: inline-grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--fg2); font: 600 1.05rem/1 var(--font-head); flex: none; }
.hash.lg { width: 56px; height: 56px; border-radius: 14px; font-size: 1.6rem; }
.icon-btn.xs { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.xs svg { width: 15px; height: 15px; }

.stage { height: 100dvh; overflow: hidden; background: var(--bg); }
.page { height: 100dvh; overflow-y: auto; overscroll-behavior: contain; }
.page > .wrap { max-width: 1080px; margin: 0 auto; padding: 1.25rem 16px calc(3rem + env(safe-area-inset-bottom)); }
.page-top { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: .5rem; padding: calc(.4rem + env(safe-area-inset-top)) 8px .4rem; min-height: 52px; background: var(--chrome); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); border-bottom: 1px solid var(--line-soft); }
.page-top strong { font-family: var(--font-head); font-weight: 650; letter-spacing: -0.01em; }
@media (min-width: 900px) { .page-top { display: none; } .page > .wrap { padding: 2rem 2.25rem 3rem; } }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head h1 { margin-top: .35rem; }
.page-head p { margin: .35rem 0 0; color: var(--fg2); }
.hide-sm { display: none; }
@media (min-width: 640px) { .hide-sm { display: inline; } }

/* ---------- bots home ---------- */
.bot-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .bot-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .bot-grid { grid-template-columns: repeat(3, 1fr); } }
.bot-card { display: flex; flex-direction: column; gap: .9rem; color: inherit; text-decoration: none !important; transition: border-color .15s, box-shadow .2s var(--ease), transform .1s ease-out; cursor: pointer; }
.bot-card:active { transform: scale(.985); }
.bot-card .top { display: flex; gap: .85rem; align-items: center; }
.bot-card .top div { min-width: 0; }
.bot-card h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-card .role { color: var(--fg2); font-size: .9375rem; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; margin: 0; }
.bot-card .meta { display: flex; justify-content: space-between; gap: .5rem; padding-top: .8rem; border-top: 1px solid var(--line-soft); font-size: .8125rem; color: var(--fg3); }
.bot-card .next { color: var(--fg2); font-weight: 500; }
.summary { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin: -0.5rem 0 1.5rem; font-size: .9375rem; color: var(--fg2); }
.summary strong { color: var(--fg); font-weight: 600; }
.hero-empty {
  position: relative; overflow: hidden; border-radius: 16px; padding: 2.25rem 1.5rem; background: #0a0a0a; color: #fff; margin-bottom: 1.5rem;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 32px 32px;
}
.hero-empty::after { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; top: -260px; background: radial-gradient(closest-side, rgba(59,111,212,.35), transparent); pointer-events: none; }
.hero-empty h1 { font-size: 2.25rem; line-height: 1.05; letter-spacing: -0.035em; max-width: 18ch; position: relative; z-index: 1; }
.hero-empty p { color: rgba(255,255,255,.74); max-width: 52ch; margin-top: .75rem; position: relative; z-index: 1; }
.hero-empty .eyebrow { color: #5a8ae6; }
.tpl-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .tpl-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .tpl-grid { grid-template-columns: repeat(3, 1fr); } }
.tpl { display: flex; flex-direction: column; gap: .7rem; text-align: left; cursor: pointer; text-decoration: none !important; transition: border-color .15s, box-shadow .2s var(--ease), transform .1s ease-out; color: inherit; font: inherit; }
.tpl:active { transform: scale(.985); }
.tpl p { color: var(--fg2); font-size: .9375rem; margin: 0; flex: 1; }
.tpl .foot { font-size: .8125rem; color: var(--fg3); display: flex; justify-content: space-between; align-items: center; }
.tpl.blank { border-style: dashed; }

/* ---------- builder ---------- */
.builder { display: grid; gap: 1rem; max-width: 820px; }
.builder .card > h2 { margin-bottom: .25rem; }
.builder .sub { color: var(--fg2); font-size: .9375rem; margin-bottom: 1.1rem; }
.swatches { display: flex; gap: .5rem; flex-wrap: wrap; }
.swatches button { width: 40px; height: 40px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.swatches button[aria-pressed="true"] { border-color: var(--bg); box-shadow: 0 0 0 2px var(--accent); }
.models { display: grid; gap: .6rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .models { grid-template-columns: repeat(3, 1fr); } }
.model { text-align: left; padding: .9rem 1rem; border-radius: 10px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.model strong { display: block; font-family: var(--font-head); font-weight: 650; letter-spacing: -0.01em; }
.model span { display: block; font-size: .8125rem; color: var(--fg2); margin-top: .2rem; line-height: 1.4; }
.model em { display: block; font-style: normal; font-size: .75rem; color: var(--fg3); margin-top: .45rem; font-variant-numeric: tabular-nums; }
.model[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); box-shadow: 0 0 0 3px var(--accent-dim); }
.skill { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: .85rem 0; border-top: 1px solid var(--line-soft); }
.skill:first-of-type { border-top: 0; padding-top: 0; }
.skill strong { display: block; font-weight: 600; }
.skill span { display: block; font-size: .875rem; color: var(--fg2); }
.routine, .dest { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: var(--bg); }
.routine + .routine, .dest + .dest { margin-top: .75rem; }
.routine-head { display: flex; gap: .75rem; align-items: center; margin-bottom: .75rem; }
.routine-head .field { flex: 1; }
.when { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: .75rem; }
.when .field { width: auto; flex: 1 1 140px; }
.copy-row { display: flex; gap: .5rem; }
.copy-row .field { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8125rem; flex: 1; min-width: 0; }
.mates label { display: flex; gap: .75rem; align-items: center; padding: .6rem 0; cursor: pointer; }
.mates input { width: 20px; height: 20px; accent-color: var(--accent); }
.savebar {
  position: sticky; bottom: calc(.75rem + env(safe-area-inset-bottom)); z-index: 10; display: flex; gap: .75rem; justify-content: flex-end; align-items: center;
  padding: .75rem; margin-top: .5rem; border-radius: 14px; background: var(--chrome); border: 1px solid var(--line);
  backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); box-shadow: var(--shadow);
}
.savebar .err { margin: 0 auto 0 .25rem; }
@media (min-width: 900px) { .savebar { bottom: 1rem; } }

/* ---------- conversation ---------- */
.convo { height: 100dvh; position: relative; overflow: hidden; --head-h: 64px; --dock-h: 96px; }
.convo-head {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: .5rem; padding: calc(.5rem + env(safe-area-inset-top)) .75rem .5rem .5rem; min-height: 60px;
  background: var(--chrome); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 1px 0 transparent; transition: box-shadow .2s ease;
}
.convo-head.edge { box-shadow: 0 1px 0 var(--chrome-edge); }
.convo-head .back { flex: none; }
@media (min-width: 900px) { .convo-head .back { display: none; } .convo-head { padding-left: 1.25rem; } }
.ch-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: .7rem; background: none; border: 0; padding: .25rem; border-radius: 10px; text-align: left; cursor: pointer; color: inherit; }
.ch-text { min-width: 0; }
.ch-text h1 { font-size: 1.0625rem; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-text p { margin: .1rem 0 0; font-size: .8125rem; color: var(--fg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: .35rem; }
.ch-text p .status { font-size: .8125rem; }
.ch-text .sep { color: var(--line); }
.ch-actions { display: flex; align-items: center; gap: .35rem; flex: none; }
.ch-actions .btn-sm { min-height: 38px; gap: .4rem; padding: 0 .75rem; }
.faces { display: none; align-items: center; background: none; border: 0; padding: 0 .35rem 0 0; cursor: pointer; }
@media (min-width: 640px) { .faces { display: inline-flex; } }
.faces .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--bg); }
.faces .avatar:first-child { margin-left: 0; }
.faces .more { margin-left: .35rem; font-size: .75rem; color: var(--fg3); font-weight: 600; }
.avatar.xs { width: 24px; height: 24px; border-radius: 6px; font-size: .62rem; }
.avatar { box-shadow: inset 0 0 0 1px rgba(255,255,255,.14); }
.avatar.person { background: var(--bg2); color: var(--fg2); box-shadow: inset 0 0 0 1px var(--line); }

.feed { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: var(--head-h) 0 var(--dock-h); scroll-padding: var(--head-h) 0 var(--dock-h); }
.feed-inner { max-width: 860px; margin: 0 auto; padding: 1rem 16px 1.25rem; display: flex; flex-direction: column; gap: .2rem; min-height: 100%; }
.older { text-align: center; padding: .25rem 0 1rem; }
.day { display: flex; align-items: center; gap: .75rem; margin: 1.1rem 0 .6rem; color: var(--fg3); font-size: .75rem; font-weight: 600; letter-spacing: .04em; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }
.sys { text-align: center; margin: .6rem 0; font-size: .8125rem; color: var(--fg3); }
.sys > span { display: inline-block; max-width: 92%; }
.sys.routing { margin: .9rem 0 .4rem; }

.m { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: .65rem; margin-top: .9rem; transition: opacity .22s var(--ease-out), transform .22s var(--ease-out); }
@starting-style { .settled .m:not(.me) { opacity: 0; transform: translateY(8px) scale(.99); } }
.m.cont { margin-top: .25rem; }
.m.cont .m-av { visibility: hidden; height: 0; }
.m.cont .m-head { display: none; }
.m-col { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.m-head { display: flex; align-items: baseline; gap: .5rem; margin: 0 0 .3rem .1rem; flex-wrap: wrap; min-width: 0; }
.m-head strong { font-weight: 650; font-size: .9375rem; font-family: var(--font-head); letter-spacing: -0.01em; }
.m-role { font-size: .75rem; color: var(--fg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.m-head time, .m-meta time { font-size: .72rem; color: var(--fg3); font-variant-numeric: tabular-nums; }
.m-head .tag { padding: .1rem .4rem; font-size: .7rem; }
.bubble { max-width: min(680px, 100%); padding: .6rem .9rem; border-radius: 6px 18px 18px 18px; overflow-wrap: anywhere; font-size: 1.0625rem; line-height: 1.47; letter-spacing: -0.01em; }
.bubble .md > :last-child, .bubble.md > :last-child { margin-bottom: 0; }
.m.bot .bubble { background: var(--bubble); }
.m.person .bubble { background: var(--surface); border: 1px solid var(--line); }
.m.failed .bubble { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); color: var(--bad); }
.m.me { display: flex; flex-direction: column; align-items: flex-end; grid-template-columns: none; }
.m.me .bubble { background: var(--accent); color: #fff; border-radius: 18px 18px 6px 18px; max-width: min(560px, 86%); }
.m.me .bubble a { color: #fff; text-decoration: underline; }
.m.me .bubble code { background: rgba(255,255,255,.18); }
.m.me .bubble .mention { background: rgba(255,255,255,.2); color: #fff; }
.m.me .md ul > li::before { background: #fff; }
.m-meta { margin: .2rem .15rem 0; }
.m.me.cont .m-meta { display: none; }
.m-label { font-size: .75rem; color: var(--fg3); font-weight: 600; margin-bottom: .25rem; }
.mention { color: var(--accent-text); background: var(--accent-dim); padding: 0 .2rem; border-radius: 4px; font-weight: 600; }
.m-work { margin: .35rem 0 0 .1rem; font-size: .8125rem; color: var(--fg3); }
.m-work summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: .4rem; min-height: 28px; letter-spacing: .01em; }
.m-work summary::-webkit-details-marker { display: none; }
.m-work summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .2s var(--ease); margin-right: .1rem; }
.m-work[open] summary::before { transform: rotate(45deg); }
.m-work .steps { margin: .4rem 0 .5rem; }
.m.pending .bubble { min-width: 160px; }
.m.pending .md:empty { display: none; }
.m.pending .steps:empty { display: none; }

.convo-empty { margin: auto; text-align: center; max-width: 480px; padding: 2.5rem 0; display: grid; justify-items: center; gap: .6rem; }
.convo-empty h2 { margin-top: .4rem; font-size: 1.375rem; letter-spacing: -0.025em; }
.convo-empty p { color: var(--fg2); margin: 0; }
.suggest { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; width: 100%; }
.suggest button { text-align: left; justify-content: flex-start; white-space: normal; min-height: 44px; line-height: 1.35; padding: .6rem 1rem; font-weight: 500; font-size: .9375rem; }

.dock {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; padding: .55rem 12px calc(.6rem + env(safe-area-inset-bottom));
  background: var(--chrome); backdrop-filter: blur(24px) saturate(180%); -webkit-backdrop-filter: blur(24px) saturate(180%);
  box-shadow: 0 -1px 0 transparent; transition: box-shadow .2s ease;
}
.dock.edge { box-shadow: 0 -1px 0 var(--chrome-edge); }
.composer { position: relative; max-width: 860px; margin: 0 auto; display: flex; gap: .5rem; align-items: flex-end; padding: .3rem .3rem .3rem .95rem; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); transition: border-color .15s ease, box-shadow .2s var(--ease-out); }
.composer:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-dim); }
.composer textarea { flex: 1; resize: none; overflow-y: auto; scrollbar-width: thin; border: 0; outline: none; background: transparent; min-height: 40px; max-height: 200px; padding: .5rem 0; line-height: 1.45; font-size: 1rem; }
.composer .send { flex: none; width: 38px; height: 38px; border-radius: 13px; border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; transition: background .15s ease, transform .16s var(--ease-out), opacity .15s ease; touch-action: manipulation; }
.composer:not(.has-text) .send { opacity: .45; }
.composer .send:active { transform: scale(.94); }
.composer .stop { min-height: 40px; gap: .4rem; color: var(--bad); }
.dock-hint { max-width: 860px; margin: .4rem auto 0; font-size: .75rem; color: var(--fg3); padding: 0 .25rem; letter-spacing: .01em; }
.dock-hint b { font-weight: 600; color: var(--fg2); }
.mention-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); background: var(--bg); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: .35rem; z-index: 10; max-height: 300px; overflow-y: auto; transform-origin: bottom left; transition: opacity .15s var(--ease-out), transform .15s var(--ease-out); }
@starting-style { .mention-pop { opacity: 0; transform: scale(.97) translateY(4px); } }
.mention-pop button { display: grid; grid-template-columns: 24px auto minmax(0, 1fr); gap: .6rem; align-items: center; width: 100%; min-height: 44px; padding: .3rem .6rem; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; }
.mention-pop button strong { font-weight: 600; }
.mention-pop button span:last-child { font-size: .8125rem; color: var(--fg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* details column (desktop) and sheet (phones) */
.details { display: none; flex-direction: column; height: 100dvh; border-left: 1px solid var(--line); background: var(--bg); }
@media (min-width: 900px) { .app.with-details .details:not([hidden]) { display: flex; } }
.details-head { display: flex; align-items: center; justify-content: space-between; padding: .6rem .75rem .6rem 1.1rem; min-height: 60px; border-bottom: 1px solid var(--line-soft); }
.details-head strong { font-family: var(--font-head); font-weight: 650; }
.details-body { flex: 1; overflow-y: auto; padding: .25rem 1.1rem 2rem; }
.dsec { padding: 1rem 0; border-top: 1px solid var(--line-soft); }
.dsec:first-child { border-top: 0; }
.dsec .label { margin-bottom: .55rem; }
.dsec-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.dsec-head .label { margin: 0; }
.dsec .hint { margin-top: .5rem; }
.dsec-danger { display: flex; gap: .5rem; flex-wrap: wrap; }
.inline-edit { display: flex; gap: .5rem; align-items: center; }
.inline-edit .field { flex: 1; min-width: 0; min-height: 42px; padding: .5rem .75rem; }
.person-row { display: flex; align-items: center; gap: .65rem; padding: .4rem 0; }
.person-row .grow { flex: 1; min-width: 0; color: inherit; text-decoration: none !important; }
.person-row .grow strong { display: block; font-weight: 600; font-size: .9375rem; }
.person-row .grow span { display: block; font-size: .8125rem; color: var(--fg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bot-card-lite { display: flex; gap: .85rem; align-items: center; }
.bot-card-lite h3 { font-size: 1.125rem; }
.bot-card-lite p { margin: .15rem 0 0; color: var(--fg2); font-size: .9rem; line-height: 1.4; }
.kv.tight { margin-bottom: .75rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.faces-row { display: flex; flex-wrap: wrap; gap: .4rem .9rem; margin-top: 1rem; font-size: .875rem; color: var(--fg2); }
.faces-row span { display: inline-flex; align-items: center; gap: .4rem; }
.prefix-field { display: flex; align-items: center; gap: .4rem; }
.prefix-field span { font: 600 1.1rem/1 var(--font-head); color: var(--fg3); }

.steps { list-style: none; margin: 0 0 .6rem; padding: 0; display: grid; gap: .3rem; }
.steps li { display: flex; gap: .5rem; align-items: baseline; font-size: .8125rem; color: var(--fg3); letter-spacing: .01em; min-width: 0; }
.steps li .mark { position: relative; top: -1px; background: var(--accent); }
.steps li.bad .mark { background: var(--bad); }
.steps li span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sources { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.sources a { font-size: .75rem; padding: .25rem .55rem; border-radius: 6px; background: var(--bg2); color: var(--fg2); max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live { display: inline-flex; gap: .5rem; align-items: center; font-size: .8125rem; color: var(--accent-text); font-weight: 600; letter-spacing: .01em; }
.live i { width: 7px; height: 7px; border-radius: 2px; background: var(--accent); animation: blink 1s var(--ease) infinite; }
@keyframes blink { 50% { opacity: .25; } }
.list-row { display: flex; gap: .75rem; align-items: center; padding: .65rem 0; border-top: 1px solid var(--line-soft); min-width: 0; }
.list-row:first-child { border-top: 0; padding-top: 0; }
.list-row.as-btn { width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow strong { display: block; font-weight: 600; font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .grow span { display: block; font-size: .8125rem; color: var(--fg3); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mem { padding: .65rem 0; border-top: 1px solid var(--line-soft); display: flex; gap: .35rem; align-items: flex-start; }
.mem:first-child { border-top: 0; padding-top: 0; }
.mem div { flex: 1; min-width: 0; }
.mem strong { font-size: .875rem; font-weight: 600; display: block; }
.mem p { font-size: .8125rem; color: var(--fg2); margin: .15rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.empty-line { color: var(--fg3); font-size: .875rem; margin: 0; }

/* pages bots built */
.page-card { width: min(680px, 100%); margin-top: .5rem; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface); }
.page-frame { position: relative; height: 320px; overflow: hidden; background: #fff; border-bottom: 1px solid var(--line); }
.page-frame iframe { position: absolute; top: 0; left: 0; width: 200%; height: 200%; border: 0; transform: scale(.5); transform-origin: 0 0; pointer-events: none; }
.page-bar { display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; }
.page-bar .grow { flex: 1; min-width: 0; }
.page-bar strong { display: block; font-weight: 600; font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-bar .grow span { display: block; font-size: .75rem; color: var(--fg3); }
.page-bar .btn-xs { flex: none; }

/* hiring: team packs */
.pack-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 720px) { .pack-grid { grid-template-columns: repeat(2, 1fr); } }
.pack { display: flex; flex-direction: column; gap: .6rem; text-align: left; cursor: pointer; font: inherit; color: inherit; transition: border-color .15s, box-shadow .2s var(--ease), transform .1s ease-out; background: linear-gradient(180deg, var(--accent-wash), var(--surface) 70%); }
.pack:active { transform: scale(.985); }
.pack[disabled] { opacity: .6; pointer-events: none; }
.pack-faces { display: flex; }
.pack-faces .avatar { margin-left: -8px; box-shadow: 0 0 0 2.5px var(--surface); }
.pack-faces .avatar:first-child { margin-left: 0; }
.pack p { color: var(--fg2); font-size: .9375rem; margin: 0; flex: 1; }
.pack .foot { font-size: .8125rem; color: var(--fg3); display: flex; justify-content: space-between; align-items: center; }

/* builder extras */
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .875rem !important; }
.param-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px minmax(0, 1.4fr) 44px; gap: .45rem; margin-bottom: .45rem; align-items: center; }
.param-row.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 44px; }
@media (max-width: 560px) { .param-row { grid-template-columns: minmax(0, 1fr) 96px 44px; } .param-row > input:nth-child(3) { grid-column: 1 / 3; grid-row: 2; } .param-row .icon-btn { grid-row: 1; grid-column: 3; } }

/* team brain */
.note-form { display: grid; gap: .6rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line-soft); }
.note-form button { justify-self: end; }
.doc-ico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--bg2); color: var(--fg2); flex: none; }
.hit { padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .5rem; }
.hit-head { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .25rem; }
.hit p { margin: 0; font-size: .875rem; color: var(--fg2); white-space: pre-wrap; }

/* ---------- activity ---------- */
.runs { padding: 0; overflow: hidden; }
.run-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: .85rem 1.25rem; border-top: 1px solid var(--line-soft); cursor: pointer; width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; color: inherit; font: inherit; transition: background .12s; }
.run-row:first-child { border-top: 0; }
.run-row .what strong { font-weight: 600; font-size: .9375rem; }
.run-row .what span { display: block; font-size: .8125rem; color: var(--fg3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.run-row .right { text-align: right; font-size: .8125rem; color: var(--fg3); display: grid; gap: .2rem; justify-items: end; }
.audit-row { display: flex; gap: .75rem; padding: .8rem 1.25rem; border-top: 1px solid var(--line-soft); font-size: .9375rem; }
.audit-row:first-child { border-top: 0; }
.audit-row .when { color: var(--fg3); font-size: .8125rem; margin: 0 0 0 auto; white-space: nowrap; display: block; }
.filters { display: flex; gap: .75rem; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1rem; }
.filters .field { width: auto; min-width: 200px; }

/* ---------- settings ---------- */
.settings { display: grid; gap: 1rem; max-width: 820px; }
.bars { display: grid; gap: .6rem; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem .75rem; font-size: .875rem; }
.bar .track { grid-column: 1 / -1; height: 8px; border-radius: 3px; background: var(--bg2); overflow: hidden; }
.bar .fill { height: 100%; border-radius: 3px; background: var(--accent); }
.stat-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.25rem; }
@media (min-width: 640px) { .stat-row { grid-template-columns: repeat(4, 1fr); } }
.stat strong { display: block; font: 650 1.5rem/1.1 var(--font-head); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: .8125rem; color: var(--fg3); }

/* ---------- sheet ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.32); z-index: 50; opacity: 0; transition: opacity .3s var(--ease-drawer); }
.scrim.on { opacity: 1; }
.sheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--bg); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-lg); border: 1px solid var(--line-soft);
  transform: translateY(100%); will-change: transform; padding-bottom: env(safe-area-inset-bottom);
}
.sheet .grab { padding: .6rem 0 .2rem; display: grid; place-items: center; cursor: grab; touch-action: none; }
.sheet .grab i { width: 38px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet .sheet-head { display: flex; align-items: center; gap: .75rem; padding: .25rem 1.25rem 1rem; border-bottom: 1px solid var(--line-soft); }
.sheet .sheet-head h2 { flex: 1; min-width: 0; font-size: 1.125rem; }
.sheet .sheet-body { overflow-y: auto; padding: 1.25rem; overscroll-behavior: contain; }
@media (min-width: 900px) {
  .sheet { left: auto; top: 0; width: 560px; max-height: none; border-radius: 20px 0 0 20px; transform: translateX(100%); }
  .sheet .grab { display: none; }
  .sheet .sheet-head { padding-top: 1.25rem; }
}
.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: .9rem 1rem; margin-bottom: 1.25rem; }
.kv div span { display: block; font-size: .72rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--fg3); margin-bottom: .15rem; }
.kv div strong { font-weight: 500; font-variant-numeric: tabular-nums; font-size: .9375rem; }
.block { margin-top: 1.25rem; }
.block > .label { margin-bottom: .6rem; }
pre.raw { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg2); border-radius: 10px; padding: .9rem 1rem; font: .8125rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; max-height: 260px; overflow-y: auto; }
.dialog-body p { color: var(--fg2); }
.dialog-actions { display: flex; gap: .75rem; justify-content: flex-end; margin-top: 1.25rem; flex-wrap: wrap; }

/* ---------- markdown output ---------- */
.md h1, .md h2, .md h3, .md h4 { font-size: 1.0625rem; margin: 1em 0 .4em; }
.md ul, .md ol { padding-left: 1.25rem; margin: 0 0 .75em; }
.md li { margin: .25rem 0; }
.md ul { list-style: none; padding-left: 1.15rem; }
.md ul > li { position: relative; }
.md ul > li::before { content: ""; position: absolute; left: -1.05rem; top: .62em; width: 6px; height: 6px; border-radius: 2px; background: var(--accent); }
.md code { font: .875em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--bg2); padding: .1rem .3rem; border-radius: 4px; }
.md pre { background: var(--bg2); padding: .8rem 1rem; border-radius: 10px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 .75em; padding-left: .9rem; border-left: 2px solid var(--accent); color: var(--fg2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }
.md strong { font-weight: 600; }

/* ---------- auth ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 960px) { .auth { grid-template-columns: 1.1fr 1fr; } }
.auth-hero {
  position: relative; overflow: hidden; background: #0a0a0a; color: #fff; padding: calc(2rem + env(safe-area-inset-top)) 16px 2.5rem;
  background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 32px 32px; display: flex; flex-direction: column;
}
.auth-hero::after { content: ""; position: absolute; width: 760px; height: 760px; left: -200px; bottom: -420px; background: radial-gradient(closest-side, rgba(59,111,212,.32), transparent); pointer-events: none; }
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero .brand { color: #fff; padding: 0; }
.auth-hero h1 { font-size: 2.25rem; line-height: 1.05; letter-spacing: -0.035em; margin: 2.5rem 0 1rem; max-width: 15ch; }
.auth-hero h1 em { font-style: normal; color: #5a8ae6; }
.auth-hero p { color: rgba(255,255,255,.74); max-width: 46ch; }
.auth-hero .squares { color: rgba(255,255,255,.74); margin-top: 1.25rem; max-width: 46ch; }
.auth-hero .squares li::before { background: #5a8ae6; }
@media (min-width: 960px) { .auth-hero { padding: 3rem 3.5rem; } .auth-hero h1 { font-size: 3.25rem; margin-top: auto; } .auth-hero .foot { margin-top: auto; } }
.auth-hero .foot { font-size: .8125rem; color: rgba(255,255,255,.5); margin-top: 2rem; }
.auth-form { display: grid; place-items: center; padding: 2rem 16px calc(2rem + env(safe-area-inset-bottom)); }
.auth-form form { width: 100%; max-width: 400px; }
.auth-form .tabs { margin-bottom: 1.5rem; }
.auth-form h2 { margin-bottom: .35rem; font-size: 1.5rem; letter-spacing: -0.025em; }
.auth-form .lead { color: var(--fg2); margin-bottom: 1.5rem; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(6rem + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; z-index: 60; background: var(--ink); color: var(--bg); padding: .75rem 1.1rem; border-radius: 10px; font-weight: 500; font-size: .9375rem; box-shadow: var(--shadow); transition: opacity .2s var(--ease), transform .25s var(--ease); pointer-events: none; max-width: calc(100vw - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--bad); color: #fff; }
@media (min-width: 900px) { .toast { bottom: 6.5rem; left: calc(50% + var(--side) / 2); } }

.spinner { width: 18px; height: 18px; border-radius: 4px; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; min-height: 40vh; color: var(--fg3); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media (prefers-reduced-transparency: reduce) { .page-top, .convo-head, .dock, .savebar { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; } }
@media (prefers-contrast: more) { :root { --line: #8a8a8a; --line-soft: #b0b0b0; --fg3: #474747; } .page-top, .convo-head, .dock, .savebar { background: var(--bg); backdrop-filter: none; } .convo-head { box-shadow: 0 1px 0 var(--line); } .dock { box-shadow: 0 -1px 0 var(--line); } }


/* Hover states only on devices with a real pointer. */
@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration: underline; text-underline-offset: 3px; }
  .btn-primary:hover { background: var(--accent-hover); box-shadow: var(--shadow-accent); }
  .btn-ink:hover { background: var(--ink-hover); }
  .btn-ghost:hover { background: var(--bg2); }
  .btn-danger:hover { border-color: var(--bad); }
  .btn:hover .arrow { transform: translateX(3px); }
  .link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
  .icon-btn:hover { background: var(--select); color: var(--fg); }
  .field:hover { border-color: color-mix(in srgb, var(--line) 50%, var(--fg3)); }
  .ri:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); }
  .rail-cta:hover { border-color: var(--accent); }
  .rail-foot a:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); color: var(--fg); }
  .bot-card:hover { border-color: color-mix(in srgb, var(--line) 40%, var(--accent)); box-shadow: var(--shadow); }
  .tpl:hover { border-color: color-mix(in srgb, var(--line) 40%, var(--accent)); box-shadow: var(--shadow); }
  .ch-title:hover { background: color-mix(in srgb, var(--fg) 4%, transparent); }
  .m-work summary:hover { color: var(--fg2); }
  .composer .send:hover { background: var(--accent-hover); }
  .mention-pop button[aria-selected="true"], .mention-pop button:hover { background: var(--accent-wash); }
  .sources a:hover { color: var(--accent-text); text-decoration: none; }
  .pack:hover { border-color: color-mix(in srgb, var(--line) 40%, var(--accent)); box-shadow: var(--shadow); }
  .run-row:hover { background: var(--bg2); }
}
