/* Studio Marcela Inbox. Brand: noir + gold, Montserrat for work, Cormorant Garamond for the name.
   The dark band at the top is the one brand moment; the workspace below stays quiet and light so
   that long days of reading messages are easy on the eyes. */

@font-face { font-family: "Montserrat"; font-weight: 400; font-style: normal; font-display: swap; src: url("/static/fonts/montserrat-400.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 500; font-style: normal; font-display: swap; src: url("/static/fonts/montserrat-500.woff2") format("woff2"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-style: normal; font-display: swap; src: url("/static/fonts/montserrat-600.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 500; font-style: normal; font-display: swap; src: url("/static/fonts/cormorant-500.woff2") format("woff2"); }

:root {
  --noir: #0a0a0a;
  --gold: #c9a84c;
  --gold-deep: #7d6216;
  --ink: #16181b;
  --ink-2: #4a525a;
  --ink-3: #5f6770;
  --line: #e2e4e7;
  --bg: #f2f3f4;
  --surface: #ffffff;
  --assistant: #1c6b57;
  --assistant-bg: #e4f1ec;
  --wait: #a8520a;
  --wait-bg: #fdf1e1;
  --bad: #b3261e;
  --bad-bg: #fcebe9;
  --draft-bg: #fbf6e6;
  --instagram: #c13584;
  --messenger: #0a7cff;
  --sans: "Montserrat", "Liberation Sans", Arial, sans-serif;
  --serif: "Cormorant Garamond", "Liberation Serif", Georgia, serif;
  --r: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 14.5px/1.5 var(--sans); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
a { color: var(--gold-deep); }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--gold-deep); outline-offset: 2px; border-radius: 4px; }

/* ---------- top band ---------- */
.top { display: flex; align-items: center; gap: 1.75rem; padding: 0 1.25rem; min-height: 56px; background: var(--noir); color: #fff; }
.brand { display: flex; flex-direction: column; line-height: 1; text-decoration: none; padding: .35rem 0; }
.brand-top { font: 600 .56rem/1 var(--sans); letter-spacing: .42em; text-transform: uppercase; color: #fff; padding-left: .1em; }
.brand-name { font: 500 1.32rem/1.05 var(--serif); letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.menu { display: flex; gap: .25rem; align-self: stretch; }
.menu a { display: flex; align-items: center; padding: 0 .8rem; color: rgba(255, 255, 255, .72); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; border-top: 2px solid transparent; }
.menu a:hover { color: #fff; }
.menu a.on { color: #fff; border-bottom-color: var(--gold); }
.me { margin-left: auto; display: flex; align-items: center; gap: 1rem; color: rgba(255, 255, 255, .72); }
.me form { margin: 0; }
.me .who { color: #fff; font-weight: 500; }
.top button.plain { color: rgba(255, 255, 255, .72); }
.top button.plain:hover { color: #fff; }
.top :focus-visible { outline-color: var(--gold); }

/* ---------- controls ---------- */
button, select, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: var(--surface); border: 1px solid #c9cdd2; border-radius: 8px; padding: .5rem .9rem; font-weight: 500; }
button:hover { border-color: var(--ink-2); }
button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
button.primary:hover { background: #000; }
button.quiet { border-color: transparent; background: none; color: var(--ink-2); padding-left: .4rem; padding-right: .4rem; text-decoration: underline; text-decoration-color: #c9cdd2; text-underline-offset: 3px; }
button.quiet:hover { color: var(--ink); border-color: transparent; text-decoration-color: var(--ink); }
button.danger { color: var(--bad); }
button.plain { background: none; border: 0; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-weight: 500; }
button.armed { background: var(--bad); border-color: var(--bad); color: #fff; text-decoration: none; padding: .5rem .9rem; }
select, input[type=text], input[type=search], input[type=password], input[type=number], textarea { background: var(--surface); border: 1px solid #c9cdd2; border-radius: 8px; padding: .5rem .65rem; }
textarea { width: 100%; resize: vertical; line-height: 1.45; }
.hint { color: var(--ink-3); font-size: .9rem; }
.err { color: var(--bad); background: var(--bad-bg); border-radius: 8px; padding: .55rem .75rem; }
.done { color: var(--assistant); background: var(--assistant-bg); border-radius: 8px; padding: .55rem .75rem; }

/* ---------- login ---------- */
.card { max-width: 400px; margin: 9vh auto 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.75rem; }
.card.wide { max-width: 480px; margin-top: 5vh; }
.card h1 { font: 500 2rem/1.1 var(--serif); margin-bottom: .4rem; }
.card h2 { font-size: 1rem; font-weight: 600; margin: 1.4rem 0 .2rem; }
.card label { display: block; margin-top: 1rem; color: var(--ink-2); font-size: .9rem; font-weight: 500; }
.card input { display: block; width: 100%; margin-top: .3rem; padding: .7rem .75rem; }
.card input.code { font-size: 1.5rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.card button.primary { width: 100%; margin-top: 1.3rem; padding: .7rem; }
.card .err { margin-top: .8rem; }
.card p + p { margin-top: .6rem; }
form.below { margin-top: 1rem; }
.qr { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px; width: max-content; max-width: 100%; margin: .7rem auto; }
.qr svg { display: block; width: 220px; height: 220px; max-width: 100%; }
code { background: var(--bg); padding: .15rem .4rem; border-radius: 4px; word-break: break-all; font-size: .92em; }

/* ---------- inbox frame ---------- */
body.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.app main { flex: 1; min-height: 0; }
.shell { display: grid; grid-template-columns: 372px minmax(0, 1fr); height: 100%; }
.pane-list { display: flex; flex-direction: column; min-height: 0; background: var(--bg); border-right: 1px solid var(--line); }
.pane-thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--surface); }

/* filters */
.filters { padding: .85rem .85rem .6rem; border-bottom: 1px solid var(--line); }
.search { display: flex; gap: .5rem; }
.search input { flex: 1; min-width: 0; }
.search select { flex: none; max-width: 9.5rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .65rem; }
.tabs.minor { gap: .1rem .9rem; margin-top: .5rem; }
.tabs.minor .tab > span { padding: .1rem 0; border: 0; border-radius: 0; background: none; font-size: .84rem; color: var(--ink-3); border-bottom: 2px solid transparent; }
.tabs.minor .tab input:checked + span { background: none; color: var(--ink); border-bottom-color: var(--gold); }
.tab { position: relative; }
.tab input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tab > span { display: inline-flex; align-items: baseline; gap: .35rem; padding: .28rem .7rem; border-radius: 999px; border: 1px solid #c9cdd2; background: var(--surface); font-size: .86rem; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.tab input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.tab input:focus-visible + span { outline: 2px solid var(--gold-deep); outline-offset: 2px; }
.tab .n { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); }
.tab input:checked + span .n { color: var(--gold); }

/* conversation list */
.convs { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.conv { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: .75rem; align-items: start; padding: .75rem .85rem; border-bottom: 1px solid var(--line); border-left: 3px solid transparent; color: var(--ink-2); text-decoration: none; }
.conv:hover { background: #e9ebed; }
.conv.sel { background: var(--surface); border-left-color: var(--gold); }
.conv .body { display: flex; flex-direction: column; min-width: 0; gap: .1rem; }
.conv .line1 { display: flex; align-items: baseline; gap: .5rem; }
.conv .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 500; }
.conv .when { flex: none; font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.conv .prev { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.conv .you { color: var(--ink-3); }
.conv.unread .name { font-weight: 600; }
.conv.unread .prev { color: var(--ink); }
.conv .flags { display: flex; flex-wrap: wrap; gap: .3rem; }
.conv .flags:empty { display: none; }
.conv .when.hurry { color: var(--wait); font-weight: 600; }
.chip { display: inline-block; margin-top: .25rem; padding: .08rem .5rem; border-radius: 5px; font-size: .8rem; font-weight: 500; background: #e4e6e9; color: var(--ink-2); }
.chip.person { background: var(--wait-bg); color: var(--wait); font-weight: 600; }
.chip.draft { background: #f3e9c4; color: #5f4a0c; font-weight: 600; }
.chip.ai { background: var(--assistant-bg); color: var(--assistant); }
.chip.paused { background: #e4e6e9; color: var(--ink-2); }
.chip.test { background: none; border: 1px dashed #b5bac0; color: var(--ink-3); }
.empty { padding: 2rem 1.25rem; color: var(--ink-3); text-align: center; }
.more { padding: .8rem 1rem; color: var(--ink-3); font-size: .85rem; }

/* picture with the reply-window ring */
.av { position: relative; display: block; width: 44px; height: 44px; flex: none; }
.av.big { width: 52px; height: 52px; }
.av .ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring circle { fill: none; stroke-width: 2.6; }
.ring .track { stroke: #d8dbdf; }
.ring .left { stroke-linecap: round; }
.ring .left.ok { stroke: var(--assistant); }
.ring .left.soon { stroke: #d97706; }
.av img, .av .ini { position: absolute; inset: 5px; border-radius: 50%; }
.av img { width: calc(100% - 10px); height: calc(100% - 10px); object-fit: cover; }
.av .ini { display: grid; place-items: center; background: #dfe2e6; color: var(--ink-2); font-weight: 600; font-size: .8rem; letter-spacing: .02em; }
.av.big .ini { font-size: .95rem; }
.av .ch { position: absolute; right: -3px; bottom: -3px; width: 19px; height: 19px; border-radius: 50%; border: 2px solid var(--bg); display: grid; place-items: center; }
.av .ch svg { width: 13px; height: 13px; fill: none; stroke: #fff; stroke-width: 1.5; stroke-linejoin: round; }
.conv.sel .av .ch, .thead .av .ch { border-color: var(--surface); }
.ch.instagram { background: var(--instagram); }
.ch.messenger { background: var(--messenger); }
.ch.messenger svg { fill: #fff; stroke: none; }

/* ---------- thread ---------- */
.nothing { margin: auto; max-width: 30rem; padding: 2rem; text-align: center; color: var(--ink-3); }
.nothing .big { font: 500 1.7rem/1.2 var(--serif); color: var(--ink); margin-bottom: .6rem; }
.thead { display: flex; align-items: center; gap: .9rem; padding: .7rem 1.1rem; border-bottom: 1px solid var(--line); }
.thead .ident { min-width: 0; }
.thead h1 { font-size: 1.08rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thead .sub { color: var(--ink-3); font-size: .88rem; }
.thead .ident { flex: 1 1 0; }
.thead .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thead .window { flex: none; font-size: .86rem; font-weight: 500; max-width: 31rem; padding: .35rem .7rem; border-radius: 8px; }
.window.ok { color: var(--assistant); background: var(--assistant-bg); }
.window.soon { color: var(--wait); background: var(--wait-bg); }
.window.closed { color: var(--ink-2); background: #eceef0; }
.back, .details-toggle { display: none; }
.thread-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 312px; }
.col { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.scroller { flex: 1; overflow-y: auto; overscroll-behavior: contain; background: #f7f8f9; }
.msgs { display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.25rem 1.25rem; min-height: 100%; max-width: 60rem; margin: 0 auto; }
.day { align-self: center; margin: .9rem 0 .5rem; font-size: .8rem; font-weight: 500; color: var(--ink-3); }
.m { display: flex; flex-direction: column; max-width: min(78%, 40rem); margin-top: .35rem; }
.m.in { align-self: flex-start; align-items: flex-start; }
.m.out { align-self: flex-end; align-items: flex-end; }
.bub { position: relative; padding: .6rem .85rem; border-radius: 16px; overflow-wrap: anywhere; }
.bub p + p, .bub .att-img + p, .bub video + p, .bub audio + p { margin-top: .4rem; }
.text { white-space: pre-wrap; }
.lead-line { font-size: .8rem; color: #3f6f62; padding-bottom: .4rem; margin-bottom: .1rem; border-bottom: 1px solid rgba(28, 107, 87, .18); }
.m.in .bub { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.m.out .bub { border-bottom-right-radius: 5px; }
.m.out.staff .bub { background: var(--ink); color: #fff; }
.m.out.agent .bub { background: var(--assistant-bg); color: #0f3329; }
.m.out.external .bub { background: #e6e8eb; }
.m.out.draft .bub { background: var(--draft-bg); border: 1.5px dashed var(--gold-deep); color: var(--ink); }
.m.out.failed .bub { background: var(--bad-bg); color: var(--ink); border: 1px solid #f0c4c0; }
.m.in.gone .bub { background: none; border-style: dashed; }
.gone-text { color: var(--ink-3); font-style: italic; }
.m-head { font-size: .84rem; font-weight: 600; color: #5f4a0c; margin-bottom: .25rem; }
.m.draft .by { max-width: 26rem; text-align: right; }
.kind { font-size: .82rem; font-weight: 500; color: var(--ink-3); }
.quote { font-size: .86rem; color: var(--ink-3); border-left: 2px solid #c9cdd2; padding-left: .5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22rem; }
.m.out.staff .kind { color: rgba(255, 255, 255, .7); }
.by { margin-top: .2rem; font-size: .78rem; color: var(--ink-3); }
.react { position: absolute; left: .6rem; bottom: -.7rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0 .35rem; font-size: .85rem; }
.fail { margin-top: .25rem; font-size: .84rem; color: var(--bad); font-weight: 500; }
.draft-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; margin-top: .45rem; }
.draft-actions form { margin: 0; }
.draft-actions button { padding: .38rem .75rem; font-size: .9rem; }
.why { margin-top: .15rem; font-size: .82rem; color: var(--ink-2); max-width: 100%; }
.why summary { cursor: pointer; color: var(--ink-3); }
.why ul { margin: .3rem 0 .2rem; padding-left: 1.1rem; }
.why li { font-family: ui-monospace, "DejaVu Sans Mono", monospace; font-size: .78rem; overflow-wrap: anywhere; }
.m.note { align-self: stretch; max-width: none; align-items: center; }
.m.note .bub { background: #fff7cc; border-radius: 8px; color: #4d3f00; font-size: .92rem; max-width: 36rem; }
.att-img { display: block; }
.att-img img { display: block; max-width: min(100%, 300px); max-height: 340px; border-radius: 10px; }
.att-video { display: block; max-width: min(100%, 320px); max-height: 360px; border-radius: 10px; background: #000; }
.att-audio { display: block; max-width: 100%; }
.att-file { font-weight: 500; }
.m.out.staff .att-file { color: var(--gold); }
.att-note { font-size: .88rem; color: var(--ink-3); font-style: italic; }

/* the assistant's line: what it is doing here, and the button to take over or give back */
.ai-strip { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap; padding: .5rem 1.1rem; border-top: 1px solid var(--line); font-size: .9rem; font-weight: 500; }
.ai-strip p { flex: 1 1 14rem; min-width: 0; }
.ai-strip form { margin: 0; }
.ai-strip button { padding: .34rem .8rem; font-size: .88rem; }
.ai-strip.ai { background: var(--assistant-bg); color: #10453a; }
.ai-strip.person { background: var(--wait-bg); color: #7a3c06; }
.ai-strip.paused, .ai-strip.off { background: #eceef0; color: var(--ink-2); }

/* reply box */
.composer { padding: .7rem 1.1rem .9rem; border-top: 1px solid var(--line); background: var(--surface); }
.composer .mode { display: inline-flex; margin-bottom: .5rem; border: 1px solid #c9cdd2; border-radius: 8px; overflow: hidden; }
.composer .mode label { position: relative; cursor: pointer; }
.composer .mode input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.composer .mode span { display: block; padding: .3rem .8rem; font-size: .86rem; font-weight: 500; color: var(--ink-2); background: var(--surface); }
.composer .mode label + label span { border-left: 1px solid #c9cdd2; }
.composer .mode input:checked + span { background: var(--ink); color: #fff; }
.composer .mode input[value=note]:checked + span { background: #6b5a00; }
.composer .mode input:focus-visible + span { outline: 2px solid var(--gold-deep); outline-offset: -2px; }
.composer .row .hint { flex: 1; margin: 0; font-size: .8rem; }
.composer.is-note button.primary { background: #6b5a00; border-color: #6b5a00; }
.composer .err { margin-bottom: .55rem; }
.composer .editing { margin-bottom: .5rem; padding: .4rem .7rem; border-radius: 8px; background: var(--draft-bg); color: var(--gold-deep); font-size: .9rem; font-weight: 500; }
.composer textarea { min-height: 3.1rem; max-height: 40vh; }
.composer .row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .5rem; }
.choice { display: flex; align-items: flex-start; gap: .5rem; color: var(--ink-2); cursor: pointer; }
.choice input { margin: .25rem 0 0; accent-color: var(--ink); flex: none; }
.composer.is-note textarea { background: #fffbe0; border-color: #d6c765; }

/* side panel */
.side { overflow-y: auto; border-left: 1px solid var(--line); padding: .4rem 1.1rem 1.5rem; background: var(--surface); }
.side section { padding: .95rem 0; border-bottom: 1px solid var(--line); }
.side section:last-child { border-bottom: 0; }
.side h2 { font-size: .82rem; font-weight: 600; color: var(--ink-3); margin-bottom: .4rem; }
.side .state { font-weight: 500; }
.side form { margin: .55rem 0 0; }
.side .close { display: none; }
.side details.admin { padding: .95rem 0 0; }
.side details.admin summary { cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--ink-3); }
.side details.admin button { display: block; }
.side form.inline label { display: flex; align-items: center; justify-content: space-between; gap: .75rem; color: var(--ink-2); }
.side .actions { display: flex; flex-wrap: wrap; gap: .25rem .6rem; align-items: center; }
.side .actions form, .side .actions .state { margin-top: .55rem; }
.side .actions .state { width: 100%; }
.side .hint { margin-top: .6rem; }
.trail { list-style: none; margin: 0; padding: 0; font-size: .86rem; }
.trail li { padding: .4rem 0; border-top: 1px solid #eef0f2; display: grid; gap: .05rem; }
.trail li:first-child { border-top: 0; }
.trail .t { color: var(--ink-3); font-size: .78rem; font-variant-numeric: tabular-nums; }
.trail .d { color: var(--ink-3); overflow-wrap: anywhere; }

/* ---------- plain pages: settings, agents, activity ---------- */
.page { max-width: 46rem; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.page.wide { max-width: 72rem; }
.page h1 { font: 500 2.1rem/1.15 var(--serif); margin-bottom: .5rem; }
.page h2 { font-size: 1rem; font-weight: 600; margin-bottom: .6rem; }
.page .lead { color: var(--ink-2); max-width: 44rem; margin-bottom: 1.25rem; }
.page section, .page form.newagent { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.25rem; margin-top: 1rem; }
.page .choice + .choice { margin-top: .5rem; }
.page label { display: block; color: var(--ink-2); font-weight: 500; }
.page label.choice { display: flex; font-weight: 400; color: var(--ink); }
.page label input[type=number], .page label input[type=text], .page label select { display: block; margin-top: .3rem; }
.page label input[type=text] { width: min(100%, 24rem); }
.page .hint { margin-top: .5rem; }
.page fieldset { border: 0; padding: 0; margin: 1rem 0 0; }
.page fieldset:first-of-type { margin-top: 0; }
.page legend { padding: 0; font-weight: 500; margin-bottom: .2rem; }
.page fieldset label { margin-top: .5rem; font-size: .88rem; }
.page fieldset textarea { margin-top: .25rem; }
.page .savebar { position: sticky; bottom: 0; margin-top: 1rem; padding: .7rem 0; background: linear-gradient(to top, var(--bg) 70%, rgba(242, 243, 244, 0)); }
.page form.newagent label { margin-top: .8rem; }
.page form.newagent button { margin-top: 1rem; }
.page .done { margin-bottom: 1rem; }
.status table { width: 100%; border-collapse: collapse; }
.status th { text-align: left; font-weight: 500; color: var(--ink-2); padding: .5rem 1rem .5rem 0; vertical-align: top; width: 38%; border-top: 1px solid #eef0f2; }
.status td { padding: .5rem 0; border-top: 1px solid #eef0f2; }
.status tr:first-child th, .status tr:first-child td { border-top: 0; }
.status td.ok { color: var(--assistant); }
.status td.warn { color: var(--wait); }
.status td.bad { color: var(--bad); font-weight: 500; }
.page section > .actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.page section > .actions form { margin: 0; }
.page select { max-width: 100%; min-width: 0; }
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-top: 1rem; }
table.list th { text-align: left; font-size: .82rem; font-weight: 600; color: var(--ink-3); padding: .6rem .9rem; border-bottom: 1px solid var(--line); background: #fafafb; }
table.list td { padding: .6rem .9rem; border-top: 1px solid #eef0f2; vertical-align: top; overflow-wrap: anywhere; }
table.list tr.off td { color: var(--ink-3); }
table.list td.row-actions { white-space: nowrap; text-align: right; }
table.list td.row-actions form { display: inline; }
table.list td.row-actions button { padding-top: 0; padding-bottom: 0; }
.nowrap { white-space: nowrap; font-variant-numeric: tabular-nums; }
form.inline { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.page form.inline label { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; min-width: 0; }
.page form.inline select { margin-top: 0; }
.newkey { background: var(--draft-bg); border: 1px solid #e6d9a6; border-radius: var(--r); padding: .9rem 1.1rem; }
.newkey p + p { margin-top: .5rem; }
.newkey code { background: var(--surface); font-size: .95rem; padding: .3rem .5rem; }

/* ---------- narrower windows ---------- */
@media (max-width: 1240px) {
  .thread-body { grid-template-columns: minmax(0, 1fr); position: relative; }
  .side { display: none; position: absolute; inset: 0 0 0 auto; width: min(340px, 100%); z-index: 3; box-shadow: -12px 0 28px rgba(10, 10, 10, .12); }
  .pane-thread.side-open .side { display: block; }
  .pane-thread.side-open .thread-body::before { content: ""; position: absolute; inset: 0; z-index: 2; background: rgba(10, 10, 10, .28); }
  .side .close { display: block; margin: .5rem 0 0 auto; width: 44px; height: 44px; padding: 0; font-size: 1.5rem; line-height: 1; border-color: transparent; }
  .details-toggle { display: inline-block; margin-left: .25rem; flex: none; }
  .thead .window { max-width: 16rem; }
}
@media (max-width: 880px) {
  .top { gap: .9rem; padding: 0 .8rem; flex-wrap: wrap; }
  .menu { order: 3; width: 100%; overflow-x: auto; min-height: 40px; }
  .menu a { padding: 0 .7rem 0 0; margin-right: .7rem; }
  .me .who { display: none; }
  .shell { grid-template-columns: minmax(0, 1fr); }
  body.app.show-thread .pane-list { display: none; }
  body.app:not(.show-thread) .pane-thread { display: none; }
  .back { display: grid; place-items: center; width: 40px; height: 44px; margin-left: -.5rem; flex: none; font-size: 1.9rem; line-height: 1; text-decoration: none; color: var(--ink); }
  .tab > span { min-height: 40px; align-items: center; }
  .tabs.minor .tab > span { min-height: 40px; padding: 0 .1rem; }
  .composer .mode span { padding: .55rem .9rem; }
  .composer .keys { display: none; }
  .ai-strip { padding: .5rem .8rem; }
  .ai-strip button, .draft-actions button, .side button { min-height: 42px; }
  .top button.plain { min-height: 40px; }
  .thead { flex-wrap: wrap; gap: .5rem .6rem; padding: .55rem .8rem; }
  .thead .av.big { width: 40px; height: 40px; }
  .thead .window { order: 5; width: 100%; max-width: none; padding: .3rem .6rem; }
  .details-toggle { margin-left: 0; padding: .35rem .7rem; }
  .m { max-width: 88%; }
  .msgs { padding: .75rem .8rem 1rem; }
  .composer { padding: .6rem .8rem .75rem; }
  .composer .row { flex-wrap: wrap; }
  table.list, table.list tbody, table.list tr, table.list td { display: block; }
  table.list thead { display: none; }
  table.list tr { border-top: 1px solid var(--line); padding: .5rem 0; }
  table.list td { border: 0; padding: .15rem .9rem; }
  table.list td.row-actions { text-align: left; }
  .status th { width: auto; display: block; padding-bottom: 0; }
  .status td { display: block; border-top: 0; padding-top: .1rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .conv, button, .tab > span { transition: background-color .12s ease, border-color .12s ease, color .12s ease; }
}
