/* Rapticore Support inbox. Palette follows the Customer Hub console:
   navy frame, Rapticore gold for the main action, sky blue for selection. */
:root {
  color-scheme: light;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --navy: #0e1830;
  --navy-2: #1b2a4a;
  --gold: #ffaa32;
  --gold-hover: #e8901a;
  --sky: #2c7cc0;
  --sky-soft: #eef6fd;
  --sky-line: #b6d7f4;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --text: #142033;
  --muted: #5b6b84;
  --line: #e1e6ee;
  --line-strong: #cfd7e3;
  --bubble-customer: #f1f4f8;
  --bubble-ai: #eef6fd;
  --bubble-staff: #1b2a4a;
  --bubble-staff-text: #f4f7fc;
  --note-bg: #fff7e3;
  --note-line: #f1d48b;
  --note-text: #6b4e05;
  --ok: #0f7a55;
  --ok-soft: #e1f5ec;
  --warn: #9a5b00;
  --warn-soft: #fff1d6;
  --danger: #b42318;
  --shadow: 0 1px 2px rgb(14 24 48 / 6%), 0 4px 16px rgb(14 24 48 / 6%);
  --radius: .6rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b1222;
    --surface: #111a2e;
    --surface-2: #16213a;
    --text: #e6ebf3;
    --muted: #9aa8bf;
    --line: #223050;
    --line-strong: #2d3d60;
    --sky: #68ade7;
    --sky-soft: #15294a;
    --sky-line: #24497a;
    --bubble-customer: #1a2540;
    --bubble-ai: #15294a;
    --bubble-staff: #2c4a7a;
    --note-bg: #2b2412;
    --note-line: #5c4a1a;
    --note-text: #f1d48b;
    --ok: #4fd1a1;
    --ok-soft: #10362a;
    --warn: #ffc356;
    --warn-soft: #3a2a0c;
    --danger: #ff8a80;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; display: flex; flex-direction: column; }
h1, h2, p { margin: 0; }
button, select, textarea, input, .button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; }
kbd {
  font: 600 .75rem/1 var(--font); padding: .15rem .35rem; border-radius: .3rem;
  border: 1px solid var(--line-strong); background: var(--surface); box-shadow: 0 1px 0 var(--line-strong);
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Buttons */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .45rem .85rem; border: 1px solid var(--line-strong); border-radius: .45rem;
  background: var(--surface); font-size: .875rem; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
button:hover:not(:disabled) { background: var(--surface-2); border-color: var(--sky-line); }
button:disabled { cursor: not-allowed; opacity: .5; }
.primary { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.primary:hover:not(:disabled) { background: var(--gold-hover); border-color: var(--gold-hover); }
.ghost { background: transparent; border-color: rgb(255 255 255 / 22%); color: #e6ebf3; }
.ghost:hover:not(:disabled) { background: rgb(255 255 255 / 10%); border-color: rgb(255 255 255 / 35%); }
.icon { padding: .4rem; border-color: transparent; background: transparent; color: var(--muted); }
.icon svg { width: 1.15rem; height: 1.15rem; }
.icon:hover:not(:disabled) { color: var(--text); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 5; flex: none;
  display: flex; align-items: center; gap: 1rem; min-height: 3.5rem; padding: .5rem 1rem;
  background: var(--navy); color: #edeae5;
}
/* As in the Customer Hub header: the lockup on navy, then the product name in muted text. */
.brand { display: flex; align-items: center; gap: .7rem; color: #edeae5; text-decoration: none; }
.lockup { height: 1.15rem; width: auto; display: block; }
.product { color: #9aa5bd; font-size: .875rem; padding-left: .7rem; border-left: 1px solid rgb(237 234 229 / 22%); }
.queue-picker { margin-left: .5rem; }
.queue-picker select { background: var(--navy-2); color: #fff; border-color: rgb(255 255 255 / 18%); }
.account { margin-left: auto; display: flex; align-items: center; gap: .65rem; font-size: .85rem; }
.who { display: grid; line-height: 1.25; }
.who small { color: #9aa8bf; font-size: .75rem; }
.avatar {
  display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
  background: var(--gold); color: var(--navy); font-weight: 700; font-size: .8rem;
}

.select { position: relative; display: inline-block; min-width: 0; }
.select::after {
  content: ""; position: absolute; pointer-events: none; right: .75rem; top: 42%;
  width: .4rem; height: .4rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg); opacity: .7;
}
select {
  appearance: none; max-width: 16rem; padding: .4rem 2rem .4rem .7rem; font-size: .875rem; font-weight: 600;
  border: 1px solid var(--line-strong); border-radius: .45rem; background: var(--surface); cursor: pointer;
}

main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.loading { margin: 3rem auto; color: var(--muted); }

/* Sign-in */
.signin {
  width: min(26rem, calc(100% - 2rem)); margin: 12vh auto auto; padding: 2.25rem 2rem;
  display: grid; justify-items: center; gap: .85rem; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: .9rem; box-shadow: var(--shadow);
}
.signin-lockup { height: 1.9rem; width: auto; margin-bottom: .75rem; color: #14213c; }
@media (prefers-color-scheme: dark) { .signin-lockup { color: #edeae5; } }
.signin h1 { font-size: 1.5rem; letter-spacing: -.02em; }
.signin p { color: var(--muted); font-size: .95rem; }
.signin .signin-error {
  width: 100%; padding: .6rem .75rem; border-radius: .45rem; text-align: left;
  background: var(--warn-soft); color: var(--warn); font-size: .875rem;
}
.google { margin-top: .5rem; width: 100%; padding: .65rem 1rem; font-size: .95rem; }
.google svg { width: 1.2rem; height: 1.2rem; }

/* Inbox layout: two panes that each scroll */
.inbox { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(18rem, 24rem) minmax(0, 1fr); }
.queue-panel {
  min-height: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--surface);
}
.queue-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .75rem .75rem .5rem; }
.tabs, .compose-tabs { display: inline-flex; padding: .2rem; gap: .15rem; border-radius: .5rem; background: var(--surface-2); border: 1px solid var(--line); }
.tabs button, .compose-tabs button { padding: .3rem .75rem; border: 0; border-radius: .35rem; background: transparent; color: var(--muted); }
.tabs button:hover:not(:disabled), .compose-tabs button:hover:not(:disabled) { background: transparent; color: var(--text); }
.tabs [aria-selected="true"], .compose-tabs [aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.compose-tabs { justify-self: start; }
.compose-tabs [data-mode="notes"][aria-selected="true"] { background: var(--note-bg); color: var(--note-text); }
.search { position: relative; display: block; margin: 0 .75rem .5rem; }
.search svg { position: absolute; left: .65rem; top: 50%; width: 1rem; height: 1rem; transform: translateY(-50%); color: var(--muted); }
.search input {
  width: 100%; padding: .45rem .7rem .45rem 2.1rem; border: 1px solid var(--line); border-radius: .45rem;
  background: var(--surface-2); font-size: .875rem;
}
.search input:focus { background: var(--surface); border-color: var(--sky-line); outline: none; box-shadow: 0 0 0 3px var(--sky-soft); }
.queue-summary { padding: 0 1rem .4rem; color: var(--muted); font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.queue-summary:empty { display: none; }
.threads { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 0 .5rem .5rem; }
.thread {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: .2rem .5rem; width: 100%;
  padding: .65rem .75rem .65rem 1.1rem; margin-bottom: .15rem; text-align: left;
  border: 1px solid transparent; border-radius: .5rem; background: transparent; font-weight: 400; white-space: normal;
}
.thread:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.thread[aria-current="true"] { background: var(--sky-soft); border-color: var(--sky-line); }
.thread.attention::before {
  content: ""; position: absolute; left: .3rem; top: 50%; margin-top: -.2rem; width: .4rem; height: .4rem; border-radius: 50%; background: var(--gold);
}
.thread-preview {
  grid-column: 1 / -1; font-size: .9rem; color: var(--text); overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere;
}
.thread.attention .thread-preview { font-weight: 600; }
.thread-meta { display: flex; align-items: center; gap: .4rem; min-width: 0; font-size: .75rem; color: var(--muted); }
.thread-time { font-size: .75rem; color: var(--muted); }
.queue-empty { padding: 2rem 1rem; text-align: center; color: var(--muted); font-size: .9rem; }
.more { margin: .25rem .75rem .75rem; }

.pill {
  display: inline-flex; align-items: center; gap: .3rem; padding: .05rem .5rem; border-radius: 1rem;
  font-size: .72rem; font-weight: 700; letter-spacing: .01em; background: var(--sky-soft); color: var(--sky);
}
.pill::before { content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; }
.pill[data-status="queued"], .pill[data-status="pending"] { background: var(--warn-soft); color: var(--warn); }
.pill[data-status="human"] { background: var(--ok-soft); color: var(--ok); }
.pill[data-status="closed"] { background: var(--surface-2); color: var(--muted); }
.tag { font-size: .72rem; font-weight: 600; padding: 0 .4rem; border-radius: .3rem; border: 1px solid var(--line-strong); color: var(--muted); }
.tag.you { border-color: var(--sky-line); color: var(--sky); }

/* Conversation */
.thread-panel { min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.empty { margin: auto; display: grid; justify-items: center; gap: .5rem; padding: 2rem; text-align: center; color: var(--muted); }
.empty svg { width: 3rem; height: 3rem; opacity: .5; }
.empty .hint { font-size: .8rem; }
.conversation { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.conversation-head {
  flex: none; display: flex; align-items: center; gap: .75rem; padding: .75rem 1.25rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.back { display: none; }
.title { flex: 1; min-width: 0; }
.title h2 { font-size: 1rem; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title p { display: flex; align-items: center; gap: .5rem; margin-top: .15rem; font-size: .8rem; color: var(--muted); }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }

.timeline { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 1.25rem; display: flex; flex-direction: column; gap: .9rem; }
.day { align-self: center; font-size: .72rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.entry { display: grid; gap: .25rem; max-width: min(44rem, 85%); }
.entry header { display: flex; align-items: baseline; gap: .5rem; font-size: .78rem; color: var(--muted); }
.entry header strong { color: var(--text); font-weight: 650; }
.bubble { padding: .65rem .85rem; border-radius: .85rem; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .925rem; }
.entry.customer { align-self: flex-start; }
.entry.customer .bubble { background: var(--bubble-customer); border-top-left-radius: .25rem; }
.entry.assistant { align-self: flex-start; }
.entry.assistant .bubble { background: var(--bubble-ai); border: 1px solid var(--sky-line); border-top-left-radius: .25rem; }
.entry.staff { align-self: flex-end; justify-items: end; }
.entry.staff .bubble { background: var(--bubble-staff); color: var(--bubble-staff-text); border-top-right-radius: .25rem; }
.entry.note { align-self: stretch; max-width: none; }
.entry.note .bubble { background: var(--note-bg); border: 1px dashed var(--note-line); color: var(--text); border-radius: .5rem; }
.entry.note header strong { color: var(--note-text); }
.ai-badge { font-size: .65rem; font-weight: 800; padding: 0 .3rem; border-radius: .25rem; background: var(--sky); color: #fff; }
.sources { display: flex; flex-wrap: wrap; gap: .35rem; }
.source { font-size: .75rem; padding: .1rem .5rem; border-radius: 1rem; border: 1px solid var(--sky-line); color: var(--sky); background: var(--surface); }
.event { align-self: center; font-size: .78rem; color: var(--muted); }

/* Composer */
.composer { flex: none; display: grid; gap: .5rem; padding: .75rem 1.25rem 1rem; background: var(--surface); border-top: 1px solid var(--line); }
.composer textarea {
  width: 100%; min-height: 4.5rem; max-height: 16rem; resize: none; padding: .65rem .8rem;
  border: 1px solid var(--line-strong); border-radius: .55rem; background: var(--surface); font-size: .925rem; line-height: 1.5;
}
.composer textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-soft); }
.composer.private-note textarea { background: var(--note-bg); border-color: var(--note-line); }
.composer.private-note textarea:focus { box-shadow: 0 0 0 3px rgb(241 212 139 / 35%); }
.composer textarea:disabled { background: var(--surface-2); cursor: not-allowed; }
.compose-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.compose-foot small { color: var(--muted); font-size: .8rem; }
.compose-right { display: flex; align-items: center; gap: .75rem; }
.counter.near { color: var(--warn); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 1.25rem; z-index: 10; transform: translateX(-50%);
  max-width: min(32rem, calc(100% - 2rem)); padding: .65rem 1rem; border-radius: .55rem;
  background: var(--navy); color: #fff; font-size: .875rem; box-shadow: 0 8px 24px rgb(14 24 48 / 25%);
}
.toast.error { background: var(--danger); }

/* Phones and narrow windows: one pane at a time */
@media (max-width: 52rem) {
  .inbox { grid-template-columns: 1fr; }
  .inbox.showing-thread .queue-panel { display: none; }
  .inbox:not(.showing-thread) .thread-panel { display: none; }
  .back { display: inline-flex; }
  .who { display: none; }
  .queue-picker { margin-left: 0; }
  select { max-width: 9.5rem; }
  .product { display: none; }
  .lockup { height: .95rem; }
  .conversation-head { padding: .6rem .75rem; flex-wrap: wrap; }
  .timeline { padding: 1rem .75rem; }
  .composer { padding: .6rem .75rem .75rem; }
  .entry { max-width: 92%; }
  .hint { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise .18s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translate(-50%, .5rem); } }
}

/* Section navigation (in the top bar) */
.nav { display: flex; align-items: stretch; align-self: stretch; gap: .25rem; margin-left: .75rem; }
.nav a {
  display: flex; align-items: center; gap: .4rem; padding: 0 .75rem; color: #9aa5bd; text-decoration: none;
  font-size: .875rem; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.nav a:hover { color: #edeae5; }
.nav a[aria-current="page"] { color: #fff; border-bottom-color: var(--gold); }
.count { min-width: 1.25rem; padding: 0 .35rem; border-radius: 1rem; background: var(--gold); color: var(--navy); font-size: .7rem; font-weight: 800; text-align: center; line-height: 1.25rem; }

/* Customer context in a conversation */
.customer-bar {
  flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem 1rem; padding: .5rem 1.25rem;
  background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: .8rem; color: var(--muted);
}
.customer-bar:empty { display: none; }
.customer-bar strong { color: var(--text); font-weight: 600; }
.customer-bar code { font-size: .75rem; }
.history { display: inline-flex; flex-wrap: wrap; gap: .35rem; }
.history button { padding: .1rem .5rem; font-size: .75rem; font-weight: 500; border-radius: 1rem; max-width: 18rem; overflow: hidden; text-overflow: ellipsis; }

/* Pages (Products, Integrate) */
.page { flex: 1; min-height: 0; overflow-y: auto; padding: 1.75rem clamp(1rem, 4vw, 3rem) 4rem; }
.page > * { max-width: 68rem; margin-inline: auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.5rem; letter-spacing: -.02em; }
.page-head p { color: var(--muted); margin-top: .25rem; max-width: 46rem; }
.page h2 { font-size: 1.05rem; letter-spacing: -.01em; margin-bottom: .35rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; padding: .05rem .3rem; border-radius: .3rem; background: var(--surface-2); border: 1px solid var(--line); }
pre code { display: block; padding: 0; border: 0; background: none; font-size: .8rem; line-height: 1.55; white-space: pre; }

.platform { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 1rem; background: var(--surface); border: 1px solid var(--line); font-size: .8rem; }
.chip b { font-weight: 650; }
.dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--muted); }
.dot.dot-ok { background: var(--ok); }
.dot.dot-warn { background: var(--gold); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 30rem), 1fr)); gap: 1rem; }
.card { display: grid; gap: .9rem; padding: 1.1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.card-head h2 { margin: 0; }
.card-head p { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.stat { padding: .55rem .65rem; border-radius: .5rem; background: var(--surface-2); }
.stat b { display: block; font-size: 1.25rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: .72rem; color: var(--muted); }
.stat.alert b { color: var(--warn); }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; margin: 0; font-size: .8rem; }
.meta dt { color: var(--muted); }
.meta dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.signers { display: grid; gap: .4rem; }
.signer { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; padding: .5rem .65rem; border: 1px dashed var(--line-strong); border-radius: .5rem; font-size: .8rem; }
.card-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.card.add { text-decoration: none; place-content: center; justify-items: center; text-align: center; border-style: dashed; box-shadow: none; color: var(--muted); min-height: 12rem; }

/* Integrate */
.flow { list-style: none; padding: 0; margin: 0 auto 1.5rem; display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; counter-reset: flow; }
.flow li { position: relative; display: grid; gap: .2rem; padding: .8rem .9rem; background: var(--surface); border: 1px solid var(--line); border-radius: .6rem; font-size: .8rem; color: var(--muted); }
.flow li strong { color: var(--text); font-size: .9rem; }
.flow li:not(:last-child)::after { content: "→"; position: absolute; right: -.7rem; top: 50%; transform: translateY(-50%); color: var(--gold); font-weight: 800; }
.integration-form, .step { padding: 1.25rem; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; }
.step > p, .lead { color: var(--muted); font-size: .9rem; margin-bottom: .75rem; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem 1.25rem; }
.fields label, .pem { display: grid; gap: .3rem; font-size: .85rem; font-weight: 600; }
.fields small { font-weight: 400; color: var(--muted); font-size: .75rem; }
.fields input, .pem textarea {
  font: inherit; font-weight: 400; padding: .5rem .65rem; border: 1px solid var(--line-strong); border-radius: .45rem; background: var(--surface);
}
.pem textarea { font-family: ui-monospace, Menlo, monospace; font-size: .75rem; resize: vertical; margin-top: .75rem; }
.fields input:focus, .pem textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px var(--sky-soft); }
.fields input:not(:placeholder-shown):invalid { border-color: var(--danger); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.note { font-size: .8rem; color: var(--ok); }
.warn { margin-top: .75rem; padding: .55rem .75rem; border-radius: .45rem; background: var(--warn-soft); color: var(--warn); font-size: .8rem; }
.small { font-size: .8rem; color: var(--muted); margin-top: .6rem; }
.alt { margin-top: .75rem; font-size: .85rem; }
.alt summary { cursor: pointer; color: var(--sky); font-weight: 600; }
.alt pre { position: relative; margin: .5rem 0 0; padding: .75rem; border-radius: .5rem; background: var(--navy); color: #e6ebf3; overflow-x: auto; }
.code { position: relative; }
.code pre { margin: 0; padding: .9rem 1rem; border-radius: .55rem; background: var(--navy); color: #e6ebf3; overflow-x: auto; }
.copy { position: absolute; top: .5rem; right: .5rem; padding: .2rem .55rem; font-size: .72rem; background: rgb(255 255 255 / 10%); border-color: rgb(255 255 255 / 20%); color: #e6ebf3; }
.copy:hover:not(:disabled) { background: rgb(255 255 255 / 18%); border-color: rgb(255 255 255 / 30%); }
.code-tabs { margin-bottom: .5rem; }
.code-tabs button { padding: .25rem .7rem; }
.checklist { margin: 0; padding-left: 1.2rem; display: grid; gap: .35rem; font-size: .9rem; }

@media (max-width: 52rem) {
  .nav { margin-left: 0; }
  .nav a { padding: 0 .45rem; font-size: .8rem; }
  .flow, .fields { grid-template-columns: 1fr; }
  .flow li:not(:last-child)::after { content: "↓"; right: 50%; top: auto; bottom: -.95rem; transform: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .page-head { flex-direction: column; }
  .account .avatar { display: none; }
}

.card.add h2 { color: var(--text); }
.card.add:hover { border-color: var(--gold); color: var(--text); }

/* Saved replies: picker in the composer */
.composer { position: relative; }
.composer { grid-template-columns: minmax(0, 1fr); }
.composer > * { grid-column: 1; }
.composer > .compose-tabs { grid-row: 1; }
.saved-picker { grid-row: 1; justify-self: end; position: relative; }
.ghost-light { background: transparent; border-color: var(--line); color: var(--muted); padding: .3rem .7rem; }
.ghost-light:hover:not(:disabled) { color: var(--text); }
.saved-menu {
  position: absolute; right: 0; bottom: calc(100% + .4rem); z-index: 6; width: min(26rem, 80vw); max-height: 22rem;
  display: flex; flex-direction: column; gap: .4rem; padding: .5rem; border-radius: .6rem;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgb(14 24 48 / 18%);
}
.saved-menu input { padding: .4rem .6rem; border: 1px solid var(--line); border-radius: .4rem; background: var(--surface-2); font-size: .85rem; }
.saved-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.saved-list button {
  display: grid; gap: .1rem; width: 100%; text-align: left; padding: .45rem .55rem; border: 0; border-radius: .4rem;
  background: transparent; font-weight: 400; white-space: normal;
}
.saved-list button:hover, .saved-list button:focus-visible, .saved-list button.active { background: var(--sky-soft); }
.saved-list strong { font-size: .85rem; }
.saved-list span { font-size: .75rem; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.saved-manage { font-size: .78rem; color: var(--sky); padding: .2rem .4rem; }
.reply-index .none, .saved-list .none { padding: .5rem; font-size: .8rem; color: var(--muted); }

/* Saved replies page */
.replies-layout { display: grid; grid-template-columns: minmax(14rem, 20rem) 1fr; gap: 1rem; align-items: start; }
.reply-index { list-style: none; margin: 0; padding: .4rem; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; }
.reply-index button { display: grid; gap: .1rem; width: 100%; text-align: left; border: 1px solid transparent; background: transparent; font-weight: 400; white-space: normal; }
.reply-index button[aria-current="true"] { background: var(--sky-soft); border-color: var(--sky-line); }
.reply-index strong { font-size: .875rem; }
.reply-index span { font-size: .75rem; color: var(--muted); }
.reply-form { display: grid; gap: .8rem; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; }
.reply-form label { display: grid; gap: .3rem; font-size: .85rem; font-weight: 600; }
.reply-form input, .reply-form textarea { font: inherit; font-weight: 400; padding: .5rem .65rem; border: 1px solid var(--line-strong); border-radius: .45rem; background: var(--surface); }
.reply-form textarea { resize: vertical; line-height: 1.5; }
.empty-note { padding: 2rem; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: .75rem; }
.danger { color: var(--danger); margin-left: auto; }
.thread-who { font-size: .78rem; color: var(--muted); grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-who strong { color: var(--text); font-weight: 600; }
@media (max-width: 52rem) {
  .replies-layout { grid-template-columns: 1fr; }
}

/* Team */
.team-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(18rem, 1fr); gap: 1rem; align-items: start; }
.team-list { padding: .4rem; }
.members { list-style: none; margin: 0; padding: 0; }
.member { display: grid; grid-template-columns: 2.2rem 1fr auto; align-items: center; gap: .75rem; padding: .65rem .6rem; border-bottom: 1px solid var(--line); }
.member:last-child { border-bottom: 0; }
.member .avatar { width: 2.2rem; height: 2.2rem; }
.member-who { display: grid; min-width: 0; font-size: .875rem; }
.member-who small { color: var(--muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-actions { display: flex; gap: .35rem; align-items: center; }
.member-actions button { padding: .25rem .6rem; font-size: .78rem; }
.tag.admin { border-color: var(--gold); color: var(--warn); }
.tag.host { border-color: var(--sky-line); color: var(--sky); }
.roles, .queues { border: 1px solid var(--line); border-radius: .5rem; padding: .6rem .8rem; margin: 0; display: grid; gap: .4rem; }
.roles legend, .queues legend { font-size: .85rem; font-weight: 600; padding: 0 .3rem; }
.roles label, .queues label { display: flex; align-items: center; gap: .5rem; font-weight: 400; font-size: .875rem; }
.roles small { color: var(--muted); }
.queue-checks { display: grid; gap: .3rem; padding-left: 1.4rem; }
@media (max-width: 52rem) { .team-layout { grid-template-columns: 1fr; } }
