:root {
  /* Dark is "Midnight": deep blue-black with three solid layers - the page,
     the bars and lists, and what sits on them - rather than see-through glass. */
  --bg: #0b0f17;
  --bg-2: rgba(160, 180, 220, .05);
  --bg-3: rgba(160, 180, 220, .085);
  --line: rgba(160, 180, 220, .10);
  --line-2: rgba(160, 180, 220, .20);
  --fg: #e8edf7;
  --fg-dim: #a3afc5;
  --fg-faint: #808ca4;
  --accent: #6ea8fe;
  --accent-rgb: 110, 168, 254;
  --accent-ink: #3f6ea8;
  --accent-dim: #3f6ea8;
  --good: #3ecf8e;
  --warn: #ffb648;
  --bad: #ff6b7a;
  --secret: #b9a2ff;
  --surface: #111725;      /* bars, lists, the composer */
  --raised: #18202f;       /* things that sit on them */
  --sheet: #141b29;        /* pop-ups */
  --field: #0f1521;        /* text boxes */
  --bubble-them: #1a2232;
  --bubble-them-line: rgba(160, 180, 220, .08);
  --bubble-mine: #1f3f78;
  --bubble-mine-line: transparent;
  --bubble-mine-fg: #e8edf7;
  --bubble-mine-dim: rgba(232, 237, 247, .65);
  --bubble-shadow: 0 1px 1px rgba(0, 0, 0, .35);
  --tick-read: #6ea8fe;
  --pill: #182030;
  /* The conversation screen (#73): header, pill text, composer and send. */
  --pill-fg: #9aa6bd;
  --head-bg: rgba(17, 23, 37, .94);
  --head-solid: #111725;
  --head-ic: #6ea8fe;
  --head-call: #3ecf8e;
  --head-line: rgba(255, 255, 255, .08);
  --bar-line: rgba(255, 255, 255, .06);
  --meta-fg: #8b97ad;
  --field-shadow: none;
  --send-bg: #6ea8fe;
  --send-fg: #06101f;
  --notice: rgba(255, 182, 72, .12);
  --notice-fg: #ffd48a;
  /* The wallpaper behind a conversation: on dark, faint brand-coloured dots. */
  --wall: #0a0e16;
  --wall-dot-1: rgba(110, 168, 254, .06);
  --wall-dot-2: rgba(167, 139, 250, .06);
  --wall-image:
    radial-gradient(circle at 20% 30%, var(--wall-dot-1) 0 1.5px, transparent 2px),
    radial-gradient(circle at 70% 60%, var(--wall-dot-2) 0 1.5px, transparent 2px),
    radial-gradient(circle at 45% 85%, var(--wall-dot-1) 0 2px, transparent 2.5px);
  --wall-size: 54px 54px;
  --brand-1: #6ea8fe;
  --brand-2: #a78bfa;
  --glass: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .018));
  --lift: inset 0 1px 0 rgba(255, 255, 255, .09), 0 30px 60px -32px rgba(0, 0, 0, .95);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

/* Light is its own set of steps, not an inversion: translucent white glass
   becomes translucent ink, borders gain weight, and the accent needs a darker
   step before it can carry text. Applied by a data-theme attribute the server
   stamps from a cookie, so there is no flash before the stylesheet lands. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-2: rgba(10, 20, 45, .035);
  --bg-3: rgba(10, 20, 45, .06);
  --line: rgba(10, 20, 45, .11);
  --line-2: rgba(10, 20, 45, .2);
  --fg: #0d1526;
  --fg-dim: #46536b;
  --fg-faint: #6b7a93;
  --good: #0a8f3c;
  --warn: #9a6400;
  --bad: #c0362f;
  --secret: #6d41c8;
  --glass: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .7));
  --lift: inset 0 1px 0 rgba(255, 255, 255, .9), 0 16px 34px -22px rgba(10, 20, 45, .4);
  --surface: transparent;
  --raised: rgba(10, 20, 45, .045);
  --sheet: linear-gradient(180deg, #fff, #f7f9fd);
  --field: #ffffff;
  --bubble-them: #ffffff;
  --bubble-them-line: transparent;
  --bubble-mine: #d4e4ff;
  --bubble-mine-line: transparent;
  --bubble-mine-fg: #111b21;
  --bubble-mine-dim: rgba(20, 26, 42, .55);
  --bubble-shadow: 0 1px .5px rgba(11, 20, 26, .13);
  --tick-read: #2f6fd6;
  --pill: #ffffff;
  --pill-fg: #54656f;
  --head-bg: rgba(255, 255, 255, .92);
  --head-solid: #fff;
  --head-ic: #2f6fd6;
  --head-call: #1d8f72;
  --head-line: rgba(0, 0, 0, .12);
  --bar-line: rgba(0, 0, 0, .08);
  --meta-fg: #667781;
  --field-shadow: 0 1px .5px rgba(11, 20, 26, .13);
  --send-bg: #2f6fd6;
  --send-fg: #fff;
  --notice: #fff4dc;
  --notice-fg: #8a5a00;
  /* On light, one quiet tone a shade off the bars, so white bubbles float
     (docs/light-wallpaper-mockup.html, w1). */
  --wall: #ebeef4;
  --wall-image: none;
  --wall-size: auto;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f6fb;
    --bg-2: rgba(10, 20, 45, .035);
    --bg-3: rgba(10, 20, 45, .06);
    --line: rgba(10, 20, 45, .11);
    --line-2: rgba(10, 20, 45, .2);
    --fg: #0d1526;
    --fg-dim: #46536b;
    --fg-faint: #6b7a93;
    --good: #0a8f3c;
    --warn: #9a6400;
    --bad: #c0362f;
    --secret: #6d41c8;
    --glass: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .7));
    --lift: inset 0 1px 0 rgba(255, 255, 255, .9), 0 16px 34px -22px rgba(10, 20, 45, .4);

    --surface: transparent;
    --raised: rgba(10, 20, 45, .045);
    --sheet: linear-gradient(180deg, #fff, #f7f9fd);
    --field: #ffffff;
    --bubble-them: #ffffff;
    --bubble-them-line: transparent;
    --bubble-mine: #d4e4ff;
    --bubble-mine-line: transparent;
    --bubble-mine-fg: #111b21;
    --bubble-mine-dim: rgba(20, 26, 42, .55);
    --bubble-shadow: 0 1px .5px rgba(11, 20, 26, .13);
    --tick-read: #2f6fd6;
    --pill: #ffffff;
    --pill-fg: #54656f;
    --head-bg: rgba(255, 255, 255, .92);
    --head-solid: #fff;
    --head-ic: #2f6fd6;
    --head-call: #1d8f72;
    --head-line: rgba(0, 0, 0, .12);
    --bar-line: rgba(0, 0, 0, .08);
    --meta-fg: #667781;
    --field-shadow: 0 1px .5px rgba(11, 20, 26, .13);
    --send-bg: #2f6fd6;
    --send-fg: #fff;
    --notice: #fff4dc;
    --notice-fg: #8a5a00;
    /* On light, one quiet tone a shade off the bars, so white bubbles float
       (docs/light-wallpaper-mockup.html, w1). */
    --wall: #ebeef4;
    --wall-image: none;
    --wall-size: auto;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--fg);
  font: 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* Ambient light rather than a flat fill: three soft colour washes over ink,
   fixed so they do not slide around while a timeline scrolls. */
body {
  background:
    radial-gradient(1100px 520px at 10% -14%, rgba(110, 168, 254, .07), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}

/* A trace of grain stops large dark areas reading as flat plastic. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* App shell: topbar keeps its natural height (it wraps on a phone) and the
   body below fills whatever is left. dvh tracks Safari's collapsing toolbar;
   vh is the fallback for browsers without it. */
body.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  /* The visible part of the screen, set by common.js: on an iPhone that
     excludes the keyboard, which 100dvh does not. */
  height: var(--app-h, 100dvh);
  overflow: hidden;
}
body.app > .topbar { flex: none; }
body.app > .shell,
body.app > .console,
body.app > .main,
body.app > #session-view,
body.app > .center-page { flex: 1; min-height: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: rgba(0, 0, 0, .34);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 9px 12px;
}
button {
  cursor: pointer;
  background: rgba(255, 255, 255, .055);
  white-space: nowrap;
  font-weight: 650;
  transition: background .14s, border-color .14s, transform .14s;
}
button:hover:not(:disabled) { background: rgba(255, 255, 255, .1); transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
input:focus, textarea:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--accent-dim); outline-offset: 1px; border-color: var(--accent-dim);
}
textarea { resize: vertical; font-family: var(--mono); font-size: 13px; }

.btn-primary {
  background: linear-gradient(180deg, #8ebbff, var(--accent));
  border-color: #7fb0ff;
  color: #06101f;
  font-weight: 700;
  box-shadow: 0 10px 24px -12px rgba(110, 168, 254, .95);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #a3c8ff, #7fb4ff); }
.btn-danger { color: #ffb3ba; border-color: rgba(255, 107, 122, .35); background: rgba(255, 107, 122, .09); }
.btn-danger:hover:not(:disabled) { background: rgba(255, 107, 122, .16); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--fg-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-3); color: var(--fg); }
.btn-sm { padding: 4px 8px; font-size: 12px; border-radius: 6px; }

.mono { font-family: var(--mono); }
.dim { color: var(--fg-dim); }
.faint { color: var(--fg-faint); }
.good-text { color: var(--good); }
.warn-text { color: var(--warn); }
.row { display: flex; gap: 10px; align-items: center; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- shell ---- */
.topbar {
  display: flex; align-items: center; gap: 13px;
  min-height: 56px; padding: 0 17px;
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), transparent);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 9px;
  background: linear-gradient(140deg, var(--brand-1), var(--brand-2));
  display: grid; place-items: center; font-size: 12px; color: #06101f; font-weight: 800;
  box-shadow: 0 6px 16px -7px rgba(110, 168, 254, .9);
  flex: none;
}
.badge {
  font-size: 11px; padding: 4px 9px; border-radius: 99px;
  border: 1px solid var(--line); color: var(--fg-dim); background: rgba(255, 255, 255, .04);
  text-transform: uppercase; letter-spacing: .05em; font-weight: 700; white-space: nowrap;
}
.badge-admin { color: #dcc4ff; border-color: rgba(167, 139, 250, .4); background: rgba(167, 139, 250, .13); }
.badge-good { color: #8df0c4; border-color: rgba(62, 207, 142, .35); background: rgba(62, 207, 142, .1); }
.badge-warn { color: #ffd089; border-color: rgba(255, 182, 72, .35); background: rgba(255, 182, 72, .1); }
.badge-bad { color: #ffb3ba; border-color: rgba(255, 107, 122, .35); background: rgba(255, 107, 122, .1); }
.badge-secret { color: #dcc4ff; border-color: rgba(167, 139, 250, .4); background: rgba(167, 139, 250, .13); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-faint); flex: none; }
.dot.on { background: var(--good); animation: beat 2.6s infinite; }
@keyframes beat {
  0% { box-shadow: 0 0 0 0 rgba(62, 207, 142, .5); }
  70% { box-shadow: 0 0 0 8px rgba(62, 207, 142, 0); }
  100% { box-shadow: 0 0 0 0 rgba(62, 207, 142, 0); }
}
.dot.off { background: var(--fg-faint); }

/* ---- cards / panels ---- */
.card { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--lift); }
.card-pad { padding: 16px; }
.panel-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--fg-faint); font-weight: 700; }

/* ---- console layout ---- */
/* minmax(0, …), not a bare 1fr: a 1fr track never shrinks below its longest
   unbreakable line, so one long message preview would widen the page. */
.console { display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: 0; }
.console.has-rail { grid-template-columns: 330px minmax(0, 1fr) 268px; }
.sidebar {
  border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .028), transparent);
}
.sidebar-head { padding: 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
/* Lists are flat rows, WhatsApp-style: a divider that starts after the
   avatar, the time on the first line, the preview and a count on the second. */
.device-list { overflow-y: auto; flex: 1; padding: 4px 0; display: flex; flex-direction: column; }
.device {
  position: relative; display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  padding: 9px 16px; border-radius: 0; border: 0; background: transparent; box-shadow: none;
}
.device + .device::before { content: ""; position: absolute; left: 76px; right: 0; top: 0; border-top: 1px solid var(--line); }
.device:hover { background: rgba(127, 127, 127, .06); transform: none; }
.device.active, .device.active:hover { background: var(--raised); }

/* What kind of device, as an icon, with a presence dot: which device is
   talking should be readable without reading. */
.device-av {
  width: 36px; height: 36px; border-radius: 11px; flex: none; position: relative;
  display: grid; place-items: center; font: 700 12px var(--mono); color: #0a1020;
  background: linear-gradient(140deg, var(--brand-1), var(--brand-2));
}
.device-av i {
  position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--good); border: 2.5px solid var(--bg);
}
.device-list .device-av { width: 48px; height: 48px; border-radius: 14px; }
.device-list .device-av i { right: -2px; bottom: -2px; width: 13px; height: 13px; }
.row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row-l1, .row-l2 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-l1 .chat-when, .row-l2 .device-unread, .row-l2 .row-left { margin-left: auto; }
/* The name keeps its room: the company chip gives way first. */
.row-l1 .device-name { flex: 0 1 auto; min-width: 0; }
.row-l1 .kind-chip, .row-l1 .badge { flex: 0 100 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-l2 { font-weight: 400; }
.device-unread {
  background: var(--good); color: var(--bg); font: 750 11.5px/20px var(--sans);
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; text-align: center; flex: none;
}
.device-name { font-weight: 650; font-size: 15px; }
.device-meta { font-size: 13px; color: var(--fg-faint); }
.row-left { font-size: 12px; color: var(--fg-faint); white-space: nowrap; flex: none; }
/* The agent badge sits on the name line and must never push the name out. */
.device .badge { font-size: 9px; padding: 1px 6px; flex: none; }

.sidebar-foot {
  border-top: 1px solid var(--line); padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.sidebar-foot #me { display: block; max-width: 100%; flex: 1; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.main-head { padding: 13px 17px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.dev-name-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
#dev-label { cursor: text; }
.btn-icon { padding: 3px 5px; line-height: 0; flex: none; }
.btn-icon:hover { color: var(--fg); }
.dev-label-input {
  font: 700 14px var(--sans); padding: 3px 8px; margin: -4px 0 -3px -9px;
  width: min(100%, 340px); min-width: 0;
}
.timeline {
  flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px;
  background: radial-gradient(900px 320px at 50% -14%, rgba(110, 168, 254, .06), transparent);
}
.composer {
  border-top: 1px solid var(--line); padding: 14px 18px; display: flex; flex-direction: column; gap: 10px;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .025));
}

/* ---- items ---- */
.item { max-width: min(760px, 92%); display: flex; flex-direction: column; gap: 6px; }
.item.mine { align-self: flex-end; align-items: flex-end; }
.item-head { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--fg-faint); font-family: var(--mono); }
.bubble {
  border: 1px solid var(--line); background: var(--glass); border-radius: 16px;
  padding: 13px 15px; width: 100%; overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .055);
}
.item.mine .bubble {
  background: linear-gradient(165deg, rgba(var(--accent-rgb), .18), rgba(var(--accent-rgb), .05));
  border-color: rgba(var(--accent-rgb), .32);
}
.bubble-title { font-weight: 700; font-size: 12px; margin-bottom: 6px; color: var(--fg-dim); }
.bubble pre {
  margin: 0; font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto;
}
.bubble.script { border-left: 2px solid var(--good); }
.bubble.secret {
  border-left: 2px solid var(--secret);
  background: linear-gradient(165deg, rgba(167, 139, 250, .15), rgba(167, 139, 250, .03));
}
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; }
/* Copy, Save, Delete and Details are in the message menu (msgmenu.js). */
.item.selectable { outline: none; }
.item.menu-on .bubble { box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .55); }
.item.selectable:focus-visible .bubble { box-shadow: 0 0 0 2px var(--accent); }
.item.selectable .bubble a, .item.selectable .bubble button { cursor: pointer; }
.item-actions:empty { display: none; }
.secret-cover { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.secret-cover .lock { font-size: 18px; }
/* Day dividers keep a long session legible. */
.day-divider {
  display: flex; align-items: center; gap: 14px; color: var(--fg-faint);
  font: 700 10.5px var(--sans); letter-spacing: .14em; text-transform: uppercase;
}
.day-divider::before, .day-divider::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.empty { margin: auto; text-align: center; color: var(--fg-faint); max-width: 420px; display: flex; flex-direction: column; gap: 10px; }

/* ---- pairing / modal ---- */
.modal-back {
  position: fixed; inset: 0; background: rgba(5, 8, 13, .76); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 50; padding: 20px;
}
.modal {
  width: 100%; max-width: 440px; border: 1px solid var(--line-2);
  border-radius: 20px; padding: 24px; max-height: 92dvh; overflow-y: auto;
  background: linear-gradient(180deg, rgba(22, 27, 38, .96), rgba(12, 15, 22, .97));
  box-shadow: var(--lift);
}
/* You › Language (#139): one choice per row, a tick on the one in use. */
.lang-list { display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; }
.lang-opt {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; border: 0; border-radius: 0;
  border-top: 1px solid var(--line); background: transparent; color: var(--fg); min-height: 0;
}
.lang-opt:first-child { border-top: 0; }
.lang-opt b { font-size: 15px; } .lang-opt small { font-size: 12.5px; margin-top: 2px; }
.lang-opt.on b, .lang-tick { color: var(--accent); }
.lang-tick { font-weight: 800; width: 16px; text-align: center; }
.lang-note { margin: 0; line-height: 1.45; }
.qr { background: #fff; padding: 10px; border-radius: 12px; display: block; width: 240px; height: 240px; margin: 0 auto; }
/* The code is the one thing on the page worth looking at. */
.paircode {
  font-family: var(--mono); font-size: 40px; font-weight: 800; letter-spacing: .13em;
  text-align: center; padding: 22px 12px; border-radius: 18px;
  background: linear-gradient(160deg, rgba(var(--accent-rgb), .16), rgba(167, 139, 250, .06) 60%, transparent);
  border: 1px solid rgba(var(--accent-rgb), .34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 24px 50px -30px rgba(var(--accent-rgb), .85);
  background-clip: padding-box;
}
.paircode-label {
  font: 700 11px var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); text-align: center; margin-bottom: 4px; opacity: .9;
}
.paircode-copy {
  display: inline-flex; align-items: center; gap: 7px; align-self: center; margin-top: 8px;
  padding: 7px 16px; border-radius: 999px; font: 600 13px var(--sans);
  color: var(--accent); background: rgba(var(--accent-rgb), .1); border: 1px solid rgba(var(--accent-rgb), .3);
  cursor: pointer;
}
.paircode-copy:hover { background: rgba(var(--accent-rgb), .18); }
.paircode-copy.done { color: var(--good); }
.countdown { font-family: var(--mono); font-size: 12px; color: var(--fg-dim); white-space: nowrap; }
.countdown.urgent { color: var(--warn); }

/* ---- centered single-purpose pages ---- */
.center-page { min-height: 100%; display: grid; place-items: center; padding: 24px; overflow-y: auto; }
.center-card {
  width: 100%; max-width: 560px; border: 1px solid var(--line); border-radius: 22px; padding: 30px;
  background: var(--glass); box-shadow: var(--lift); backdrop-filter: blur(18px);
}
.gbtn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 11px; font-weight: 600; background: #fff; color: #1f2328; border: none; border-radius: 8px;
}
.gbtn:hover { background: #f1f3f5; }
.code-input {
  font-family: var(--mono); font-size: 28px; font-weight: 700; text-align: center; letter-spacing: .16em;
  text-transform: uppercase; width: 100%; padding: 16px; border-radius: 14px;
}

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--fg-faint); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg-2);
}
td { padding: 9px 10px; border-bottom: 1px solid #1b212e; vertical-align: middle; }
tr:hover td { background: #141924; }
.table-wrap { overflow: auto; max-height: 60vh; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat-n { font-size: 26px; font-weight: 700; font-family: var(--mono); line-height: 1.1; }
.stat-l { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-faint); font-weight: 600; margin-top: 4px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab { background: transparent; border: none; border-bottom: 2px solid transparent; border-radius: 0; color: var(--fg-dim); padding: 9px 14px; font-weight: 600; }
.tab.active { color: var(--fg); border-bottom-color: var(--accent); }

.page { max-width: 1240px; margin: 0 auto; padding: 20px 16px 60px; }

/* ---- toasts / banners ---- */
.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; }
/* Solid, not see-through: a toast lands on top of whatever is there and has
   to be read in one glance. The tone is the edge, the words stay full colour. */
.toast {
  display: flex; align-items: flex-start; gap: 10px; width: max-content; max-width: min(440px, calc(100vw - 24px));
  background: var(--sheet); color: var(--fg); border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 11px 14px; font-size: 14px; line-height: 1.45;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .75), 0 0 0 1px rgba(0, 0, 0, .25); animation: pop .16s ease-out;
}
.toast.good { border-left-color: var(--good); }
.toast.bad { border-left-color: var(--bad); }
.toast.warn { border-left-color: var(--warn); }
.toast .toast-n { flex: none; margin-top: 1px; padding: 0 7px; border-radius: 999px; background: var(--raised); color: var(--fg-dim); font-size: 11.5px; font-weight: 650; line-height: 19px; }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

.banner { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg-3); font-size: 13px; }
.banner.bad { border-color: #4a2a2f; background: #241416; color: #ffc0c0; }
.banner.warn { border-color: #4e3c1d; background: #241c0f; color: #ffdfa8; }

/* A console tab left open across a deploy keeps running the JavaScript it
   loaded hours ago. Nothing looks wrong, which is the problem - a feature
   added since then is simply absent, and the operator blames the feature. */
.stale-bar {
  position: fixed; z-index: 80; left: 50%; transform: translateX(-50%);
  top: calc(12px + env(safe-area-inset-top, 0px)); width: min(440px, calc(100vw - 24px)); box-sizing: border-box;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 12px;
  border-radius: 16px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--sheet); box-shadow: var(--lift), 0 10px 30px -10px rgba(0, 0, 0, .45); color: var(--fg);
  animation: stale-in .25s ease-out;
}
.stale-bar.hidden { display: none; }
.stale-ic { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.stale-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.stale-text b { font-size: 14px; font-weight: 650; }
.stale-text small { font-size: 12px; color: var(--fg-dim); }
.stale-bar .btn-primary { flex: none; padding: 8px 16px; }
@keyframes stale-in { from { opacity: 0; transform: translate(-50%, -8px); } }
@media (prefers-reduced-motion: reduce) { .stale-bar { animation: none; } }

/* A call in trouble says so where the route usually is. */
.call-trouble { color: var(--warn, #f5b04a) !important; font-weight: 600; text-wrap: balance; }

/* ---- terminal agent ----
   An agent has no composer: it is asked for things from a fixed list rather
   than sent things. The list is the allowlist, so there is no field here to
   typo into. */
.agent-panel {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 17px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .025));
}
.agent-panel .btn-sm { font-size: 12.5px; padding: 7px 12px; }
.agent-apps { display: flex; flex-direction: column; gap: 6px; max-height: 190px; overflow-y: auto; }
.agent-app { display: flex; align-items: center; gap: 11px; padding: 8px 11px; border: 1px solid var(--line);
  border-radius: 10px; background: rgba(255, 255, 255, .03); }
.agent-app .meta { flex: 1; min-width: 0; }
.agent-app b { display: block; font-size: 13px; font-weight: 600; }
.agent-app small { font: 11px var(--mono); color: var(--fg-faint); }
/* An entry the machine cannot take is shown and explained rather than hidden:
   "why is it not there" is a worse question than "why is it greyed out". */
.agent-app.off { opacity: .5; }

/* ---- files ---- */
.file-card { display: flex; align-items: center; gap: 11px; min-width: 0; }
.file-ext {
  width: 38px; height: 44px; flex: none; border-radius: 6px; display: grid; place-items: end center;
  padding-bottom: 6px; font: 800 9px var(--sans); letter-spacing: .04em; text-transform: uppercase;
  color: var(--fg-dim); border: 1px solid var(--line-2);
  background: linear-gradient(170deg, rgba(var(--accent-rgb), .16), rgba(var(--accent-rgb), .04));
}
.file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-meta b { font-size: 13px; font-weight: 600; }
.file-meta small { font: 11px var(--mono); color: var(--fg-faint); overflow-wrap: anywhere; }
/* Download and delete: two matching icon buttons, the safe one in colour. */
.file-btns { display: flex; gap: 6px; flex: none; }
.file-btn {
  width: 36px; height: 36px; padding: 0; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--bg-3); color: var(--fg-dim); text-decoration: none; cursor: pointer;
}
.file-btn:hover:not(:disabled) { color: var(--fg); text-decoration: none; transform: none; }
.file-get { color: var(--accent); border-color: rgba(var(--accent-rgb), .35); background: rgba(var(--accent-rgb), .1); }
.file-get:hover { color: var(--accent); background: rgba(var(--accent-rgb), .18); }
/* A picture shows at its own size - never stretched - up to a cap, and opens
   full screen on a tap. */
.file-preview {
  display: block; width: fit-content; max-width: 100%; margin: 0 0 10px; padding: 0; line-height: 0;
  border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-3); cursor: zoom-in;
}
.file-preview:hover:not(:disabled) { transform: none; border-color: var(--line-2); }
.file-preview img { display: block; width: auto; height: auto; max-width: 100%; max-height: 240px; }

/* ---- a photo in a chat: the photo is the message ----
   No frame, card or name: rounded corners, and the time (and ticks) in a
   small dark pill on the photo. Name, size and Save are in the hold menu. */
.bubble.photo { padding: 0 !important; background: transparent !important; border: 0 !important; box-shadow: none !important; }
/* The cap is on the bubble: a percentage further in would not count when the
   bubble sizes itself to the picture, and leave a strip beside it. */
.item .bubble.photo, .item.chat .bubble.photo { width: fit-content; max-width: min(260px, 100%); }
.bubble.photo .file-preview { margin: 0; border: 0; border-radius: 14px; max-width: 100%; background: var(--bg-3); box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.bubble.photo .file-preview img { max-width: 100%; max-height: 320px; }
/* No tail: the photo's own corners are the shape. */
.item.chat:has(> .bubble.photo)::before { display: none; }
.item.chat > .bubble.photo { border-radius: 14px; }
/* Loading: the photo's place with a soft shimmer, no spinner. */
.bubble.photo .file-preview.loading { min-width: 200px; min-height: 150px; }
.bubble.photo .file-preview.loading img { opacity: 0; }
.bubble.photo .file-preview.loading::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .09) 50%, transparent 70%) var(--bg-3);
  background-size: 220% 100%; animation: photo-shimmer 1.3s linear infinite;
}
.bubble.photo .file-preview { position: relative; }
@keyframes photo-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.photo-gone {
  width: 236px; max-width: 100%; height: 120px; border-radius: 14px; background: var(--bubble-them, var(--bg-3));
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--fg-faint); font-size: 13px; line-height: 1.3; text-align: center;
}
.item.chat .bubble.photo > .bubble-foot {
  position: absolute; right: 6px; bottom: 6px; margin: 0; padding: 3px 7px; border-radius: 999px; line-height: 1;
  color: #fff !important; background: rgba(0, 0, 0, .42); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); pointer-events: none;
}
.item.chat .bubble.photo .bubble-foot .ticks { color: #fff !important; }
.item.chat .bubble.photo .bubble-foot .ticks.read { color: #7cc4ff !important; }
.bubble.photo .item-more { top: 6px; right: 6px; border-radius: 50%; color: #fff; background: rgba(0, 0, 0, .42) !important; }

/* ---- picture preview (lightbox) ---- */
html.lb-open, html.lb-open body { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column;
  background: #06080c; color: #fff; animation: lb-in .14s ease-out;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
@keyframes lb-in { from { opacity: 0; } }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px; flex: none; }
.lb-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 10px; }
.lb-name { font-size: 14px; font-weight: 600; min-width: 0; }
.lb-count { font: 12px var(--mono); opacity: .6; flex: none; }
/* A picture is shown on its own: who sent it and when, faint; no name or download. */
.lb-byline { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.25; }
.lb-who { font-size: 14px; font-weight: 600; opacity: .9; }
.lb-who:empty { display: none; }
.lb-when { font-size: 12px; opacity: .55; }
.lightbox:not(.lb-document) .lb-name, .lightbox:not(.lb-document) .lb-count, .lightbox:not(.lb-document) a.lb-btn { display: none; }
.lightbox.lb-document .lb-byline, .lightbox.lb-document .lb-dots { display: none; }
.lightbox .lb-bar, .lightbox .lb-nav, .lightbox .lb-dots { transition: opacity .18s; }
/* A tap on the picture: only the picture. */
.lightbox.lb-bare .lb-bar, .lightbox.lb-bare .lb-nav, .lightbox.lb-bare .lb-dots { opacity: 0; pointer-events: none; }
.lb-dots { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.lb-dots:empty { display: none; }
.lb-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .35); }
.lb-dots i.on { background: #fff; }
.lb-btn {
  width: 40px; height: 40px; padding: 0; display: grid; place-items: center; flex: none; border: 0; border-radius: 11px;
  color: #fff !important; background: rgba(255, 255, 255, .1) !important; cursor: pointer; text-decoration: none;
}
.lb-btn:hover { background: rgba(255, 255, 255, .18) !important; }
.lb-stage {
  flex: 1; min-height: 0; position: relative; display: flex; align-items: center; justify-content: center;
  padding: 4px 12px 16px; touch-action: none; overflow: hidden;
}
/* Fits the screen, but is never enlarged past its own pixels. */
.lb-img {
  max-width: 100%; max-height: calc(100dvh - 96px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  height: auto; object-fit: contain; border-radius: 6px; user-select: none; -webkit-user-drag: none;
  -webkit-touch-callout: none; cursor: zoom-in; transform-origin: center; will-change: transform;
}
.lightbox.lb-zoomed .lb-img { cursor: grab; border-radius: 0; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  color: #fff !important; background: rgba(255, 255, 255, .12) !important; cursor: pointer;
}
.lb-nav:hover:not(:disabled) { transform: translateY(-50%); background: rgba(255, 255, 255, .22) !important; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }

/* ---- keep a session longer ----
   The header countdown is a button; its menu offers how long to keep the
   pairing, each with the time that works out to. */
.extend-wrap { position: relative; flex: none; }
.extend-btn { padding: 5px 9px; border-radius: 9px; }
.extend-btn:hover:not(:disabled) { background: var(--bg-3); transform: none; }
.extend-btn .countdown { pointer-events: none; }
.extend-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: 260px;
  display: flex; flex-direction: column; gap: 2px; padding: 8px;
  border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--lift);
  background: linear-gradient(180deg, rgba(22, 27, 38, .98), rgba(12, 15, 22, .99));
}
.extend-head { font: 700 10.5px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--fg-faint); padding: 4px 8px 6px; }
.extend-opt {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; font-size: 13px;
}
.extend-opt:hover:not(:disabled), .extend-opt:focus-visible { background: var(--bg-3); transform: none; }
.extend-opt span { font-size: 12px; }
#friend-menu { width: min(270px, calc(100vw - 24px)); }
.extend-note { padding: 6px 8px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.pair-keep select { flex: none; width: auto; min-width: 120px; }

/* ---- file cards: type colours, and the name as the way in ---- */
.file-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 11px; padding: 0; margin: 0;
  background: transparent !important; border: 0; text-align: left; color: inherit; font: inherit; min-height: 0;
}
.file-main.can-open { cursor: pointer; }
.file-main.can-open:hover b { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.file-main:hover:not(:disabled) { transform: none; }
.file-ext[data-family="pdf"] { color: #ff8a8a; background: linear-gradient(170deg, rgba(255, 90, 90, .22), rgba(255, 90, 90, .05)); }
.file-ext[data-family="doc"] { color: #8ab4ff; background: linear-gradient(170deg, rgba(60, 120, 255, .24), rgba(60, 120, 255, .05)); }
.file-ext[data-family="xls"] { color: #6fe0a5; background: linear-gradient(170deg, rgba(40, 180, 110, .24), rgba(40, 180, 110, .05)); }
.file-ext[data-family="ppt"] { color: #ffb37a; background: linear-gradient(170deg, rgba(255, 140, 60, .24), rgba(255, 140, 60, .05)); }
.file-ext[data-family="img"] { color: #d6a8ff; background: linear-gradient(170deg, rgba(170, 110, 255, .22), rgba(170, 110, 255, .05)); }

/* ---- document preview ----
   PDFs, Word, Excel, slides and text open in the preview frame, on white
   "paper" in either theme - that is what a document looks like, and what its
   author designed for. */
.lightbox.lb-document .lb-stage { padding: 0; align-items: stretch; touch-action: auto; }
.lb-doc { flex: 1; width: 100%; height: 100%; overflow: auto; overscroll-behavior: contain; padding: 6px 16px 40px; outline: none; touch-action: pan-x pan-y; }
.lb-page { transform-origin: 0 0; }
/* Zoom: out, the level (a tap goes back to 100%), in - for documents only. */
.lightbox:not(.lb-document) .lb-zoom { display: none; }
.lb-zoom-level {
  min-width: 52px; height: 40px; padding: 0 6px; border: 0; border-radius: 11px; flex: none; cursor: pointer;
  font: 600 12px var(--mono); font-variant-numeric: tabular-nums; color: #c7cdd8 !important; background: transparent !important;
}
.lb-zoom-level:hover { color: #fff !important; }
.lb-btn.lb-zoom:disabled { opacity: .35; cursor: default; }
.lb-loading, .lb-failed { color: #c7cdd8; text-align: center; padding: 18vh 20px; font-size: 14px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.lb-failed b { color: #fff; font-size: 15px; }
.lb-failed span { max-width: 48ch; }
.doc-note { color: #9aa3b2; font-size: 12px; text-align: center; margin: 14px auto 0; max-width: 70ch; }

.doc-paper {
  max-width: 820px; margin: 0 auto; padding: 48px 56px; border-radius: 4px; background: #fff; color: #1d2229;
  font: 15px/1.6 var(--sans); box-shadow: 0 10px 40px rgba(0, 0, 0, .45); overflow-wrap: anywhere; white-space: pre-wrap;
}
.doc-paper p { margin: 0 0 .55em; }
.doc-paper h2, .doc-paper h3, .doc-paper h4, .doc-paper h5, .doc-paper h6 { margin: 1.1em 0 .45em; line-height: 1.25; color: #10151c; }
.doc-paper h2 { font-size: 1.7em; } .doc-paper h3 { font-size: 1.35em; } .doc-paper h4 { font-size: 1.15em; }
.doc-paper h5, .doc-paper h6 { font-size: 1em; }
.doc-li { position: relative; }
.doc-li::before { content: "•"; position: absolute; margin-left: -1em; color: #5b6472; }
.doc-link { color: #1a56db; text-decoration: underline; }
.doc-img { max-width: 100%; height: auto; display: inline-block; vertical-align: middle; }
.doc-table-wrap { overflow-x: auto; margin: .6em 0 1em; }
.doc-table { border-collapse: collapse; font-size: .92em; white-space: normal; }
.doc-table td { border: 1px solid #c9ced6; padding: 5px 8px; vertical-align: top; }
.doc-table td p { margin: 0; }

.pdf-pages { display: flex; flex-direction: column; gap: 16px; max-width: 900px; margin: 0 auto; }
.pdf-page { position: relative; width: 100%; background: #fff; box-shadow: 0 10px 40px rgba(0, 0, 0, .45); }
.pdf-canvas { display: block; width: 100%; height: 100%; }
.pdf-fail { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; color: #5b6472; font-size: 13px; text-align: center; }
.pdf-n {
  position: absolute; right: 8px; bottom: 8px; font: 600 11px var(--mono); color: #fff;
  background: rgba(10, 14, 22, .6); padding: 2px 7px; border-radius: 999px;
}

.sheet-tabs { display: flex; gap: 4px; overflow-x: auto; padding: 2px 0 10px; position: sticky; left: 0; }
.sheet-tab {
  flex: none; padding: 6px 12px; border-radius: 8px; font: 600 12.5px var(--sans); min-height: 0;
  background: rgba(255, 255, 255, .08) !important; color: #c7cdd8 !important; border: 1px solid transparent;
}
.sheet-tab[aria-selected="true"] { background: #fff !important; color: #1d2229 !important; }
.sheet-wrap { overflow: auto; max-height: calc(100dvh - 150px); border-radius: 6px; background: #fff; box-shadow: 0 10px 40px rgba(0, 0, 0, .45); }
table.sheet { border-collapse: separate; border-spacing: 0; font: 12.5px var(--sans); color: #1d2229; }
table.sheet th, table.sheet td { border-right: 1px solid #e3e6eb; border-bottom: 1px solid #e3e6eb; padding: 4px 8px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
table.sheet thead th { position: sticky; top: 0; z-index: 2; background: #f3f5f8; color: #5b6472; font-weight: 600; text-align: center; }
table.sheet tbody th { position: sticky; left: 0; z-index: 1; background: #f3f5f8; color: #5b6472; font-weight: 500; text-align: right; }
table.sheet th.corner { left: 0; z-index: 3; }
table.sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }

.slide {
  max-width: 820px; margin: 0 auto 14px; padding: 26px 30px 22px; border-radius: 6px; background: #fff; color: #1d2229;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .45); font-size: 15px; line-height: 1.5;
}
.slide p { margin: 0 0 .4em; }
.slide p:nth-of-type(1) { font-size: 1.35em; font-weight: 700; color: #10151c; }
.slide .faint { color: #8a93a2; font-size: .9em; font-weight: 400; }
.slide-n { display: block; font: 700 10.5px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: #8a93a2; margin-bottom: 10px; }

.doc-text {
  max-width: 1000px; margin: 0 auto; padding: 18px 20px; border-radius: 6px; background: #0f131a; color: #dfe4ec;
  border: 1px solid rgba(255, 255, 255, .1); font: 12.5px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}
.doc-picture { display: flex; justify-content: center; }
.doc-picture img { max-width: 100%; height: auto; background: repeating-conic-gradient(#e9ecf1 0 25%, #fff 0 50%) 0 0 / 16px 16px; }

/* End session: a word on a wide screen, a power icon on a phone. */

/* Dragging a file over the conversation: it will be attached, not sent. */
.dropping { position: relative; }
.dropping::after {
  content: "Drop to attach  ·  you can review before sending"; position: absolute; inset: 10px; z-index: 30;
  pointer-events: none; display: grid; place-items: center; border-radius: 16px; font-weight: 700; color: var(--fg);
  border: 2px dashed rgba(var(--accent-rgb), .7); background: rgba(var(--accent-rgb), .12);
  backdrop-filter: blur(2px); text-align: center; padding: 20px;
}

/* ---- attachment tray ----
   Staged files, each a chip. Nothing in here has left the machine yet. */
.att-tray { display: flex; flex-wrap: wrap; gap: 8px; max-height: 172px; overflow-y: auto; }
.att-chip {
  position: relative; display: flex; align-items: center; gap: 9px; overflow: hidden;
  width: 236px; max-width: 100%; padding: 6px 6px 6px 6px; border-radius: 11px;
  border: 1px solid var(--line-2); background: var(--bg-3);
}
.att-thumb {
  width: 38px; height: 38px; flex: none; border-radius: 7px; object-fit: cover;
  border: 1px solid var(--line);
}
.att-ext {
  display: grid; place-items: center; font: 800 9px var(--sans); letter-spacing: .04em; text-transform: uppercase;
  color: var(--fg-dim); background: linear-gradient(170deg, rgba(var(--accent-rgb), .18), rgba(var(--accent-rgb), .04));
}
.att-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.att-meta b { font-size: 12.5px; font-weight: 600; }
.att-meta small { font: 11px var(--mono); color: var(--fg-faint); }
.att-remove {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border-radius: 7px;
  background: transparent; border: 0; color: var(--fg-faint); cursor: pointer;
}
.att-remove:hover { color: var(--fg); background: var(--line); }
.att-chip.bad { border-color: var(--bad); }
.att-chip.bad small { color: var(--bad); }
.att-chip.failed { border-color: var(--warn); }
.att-chip.failed small { color: var(--warn); }
.att-chip.uploading small { color: var(--accent); }
.att-progress {
  position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
  background: var(--accent); transform-origin: left; transform: scaleX(var(--p, 0)); transition: transform .15s;
}

/* ---- capability grants ----
   A chip is a live grant with its remaining days on it. Clicking one takes it
   back, so it reads as something held rather than a label. */
.chip-grant {
  font: 700 9.5px var(--sans); letter-spacing: .08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--bg-3); color: var(--fg-dim);
}
.chip-grant.on { color: #8df0c4; border-color: rgba(62, 207, 142, .4); background: rgba(62, 207, 142, .1); }
/* Break-glass reads as a warning, because that is what it is. */
.chip-grant.brk { color: #ffb3ba; border-color: rgba(255, 107, 122, .4); background: rgba(255, 107, 122, .1); }

@media (max-width: 1100px) {
  .console.has-rail { grid-template-columns: 330px minmax(0, 1fr); }
}

@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  /* The list and the conversation take turns filling the screen, as in any
     messenger: tap a row to open it, the back arrow to return (app.js). */
  .console, .console.has-rail { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr; }
  .place.console > .main { display: none; }
  .place.console.show-detail > .sidebar { display: none; }
  .place.console.show-detail > .main { display: flex; }
  .sidebar { border-right: none; }
  .device-list { max-height: none; }
  .mobile-only { display: inline-flex !important; }

  /* Wrap is the safety net: the console bar fits on one row, the admin bar
     has more controls than a phone can hold and spills onto a second. */
  .topbar { gap: 4px 8px; padding: 6px 10px; padding-top: calc(6px + env(safe-area-inset-top)); min-height: 46px; flex-wrap: wrap; }
  .topbar .brand { font-size: 14px; }
  /* Measured at 390px: the bar was already full, and the lockup needs 23px it
     does not have. Both names go and the two marks stay - the tenant logo
     still leads, which is the part that has to survive. Same trade the remote
     session header already made, and the one the countdown and #me make. */
  .topbar .co-name, .topbar .brand-wordmark, .topbar .brand-name { display: none; }
  .topbar .brand.co { gap: 7px; }
  .topbar .co-rule { height: 14px; }
  .topbar .co-mark { width: 14px; height: 14px; }
  /* The wide logo has no text to drop, so it gives up width instead. */
  .topbar .brand-logo.wide { height: 22px; max-width: 124px; }
  /* Who you are signed in as does not earn a whole row on a phone; the admin
     console still shows it, and Sign out is right there. */
  .topbar #me { display: none; }
  #ws-status .faint { display: none; }

  /* Long labels do not fit; the short form lives in data-short. */
  .countdown { font-size: 0; }
  .countdown::after { content: attr(data-short); font-size: 11px; font-family: var(--mono); }

  .main-head { padding: 10px 12px; gap: 8px; flex-wrap: nowrap; }
  /* The Admin link already says "admin"; the duplicate badge, the rename
     button and the byte counts all lose to screen space here. */
  #role-badge, .item-head .bytes, #refreshed { display: none; }
  .timeline { padding: 12px; gap: 12px; }
  .item { max-width: 100%; }
  .bubble pre { max-height: 300px; font-size: 12px; }

  .composer { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 6px; }
  /* The fingerprint is a hover away on a desktop; on a phone it is noise. */
  .file-sha { display: none; }

  .subtab { padding: 9px 10px; font-size: 12.5px; }
  .subtabs { padding: 0 10px; }
  .lb-nav { width: 38px; height: 38px; }
  .lb-doc { padding: 4px 8px 32px; }
  .doc-paper { padding: 22px 18px; font-size: 14px; }
  .slide { padding: 18px 16px; }
  .extend-menu { width: min(260px, calc(100vw - 24px)); }

  .center-page { padding: 16px; align-items: start; padding-top: max(16px, 6dvh); }
  .center-card { padding: 20px 18px; }
  .code-input { font-size: 22px; letter-spacing: .12em; padding: 12px; }
  .paircode { font-size: 24px; letter-spacing: .08em; padding: 10px; }
  .modal { padding: 16px; border-radius: 14px; }

  .page { padding: 14px 12px 48px; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; }
  .stat { padding: 11px; }
  .stat-n { font-size: 21px; }
  .table-wrap { max-height: none; }
  th, td { white-space: nowrap; }
  .tabs { overflow-x: auto; }

  /* Bottom-anchored toasts sit right on top of the composer and the send
     button on a phone; drop them in from the top instead. */
  .toasts { bottom: auto; top: calc(58px + env(safe-area-inset-top)); }
  .toast { animation: pop-top .16s ease-out; }
}

@keyframes pop-top { from { opacity: 0; transform: translateY(-6px); } }


/* Touch targets: 32px is fine with a mouse, not with a thumb. */
@media (pointer: coarse) {
  button, select { min-height: 40px; }
  .btn-sm { min-height: 34px; padding: 7px 11px; }
  .tab { min-height: 42px; }
  .device { padding: 10px 16px; }
  .device-list .device-av, .device-list .pav { width: 52px; height: 52px; }
  .device + .device::before { left: 80px; }
  /* On a phone the list is its own screen: nothing stays "selected". */
  .device-list .device.active, :root[data-theme="light"] .device-list .device.active,
  :root:not([data-theme="dark"]) .device-list .device.active { background: transparent; }
  .device-name { font-size: 16.5px; }
  .chat-preview, .device-meta { font-size: 14.5px; }
  .item-actions button { min-height: 34px; }
}

.mobile-only { display: none; }

/* ---- utilities ----
   The CSP forbids inline style attributes (style-src 'self'), so every
   one-off spacing/size tweak in the markup lives here instead. */
.m0 { margin: 0; }
.g0 { gap: 0; } .g1 { gap: 1px; } .g5 { gap: 5px; } .g6 { gap: 6px; } .g8 { gap: 8px; }
.g10 { gap: 10px; } .g12 { gap: 12px; } .g14 { gap: 14px; } .g16 { gap: 16px; } .g18 { gap: 18px; }
.pad-h { padding: 0 18px; }
.pad10 { padding: 10px; }
.divider-top { border-top: 1px solid var(--line); padding-top: 14px; }

.t11 { font-size: 11px; } .t12 { font-size: 12px; } .t13 { font-size: 13px; }
.t17 { font-size: 17px; } .t18 { font-size: 18px; } .t28 { font-size: 28px; }
.t32 { font-size: 32px; } .t34 { font-size: 34px; }

.center { text-align: center; }
.jc { justify-content: center; }
.min0 { min-width: 0; min-height: 0; }
.fit { width: auto; }
.vh100 { height: 100vh; height: 100dvh; }
.clip { display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w200 { max-width: 200px; } .w220 { max-width: 220px; } .w320 { max-width: 320px; }
.dashed-btn { text-align: center; padding: 9px; border: 1px dashed var(--line-2); border-radius: 8px; }

/* ---- per-tenant branding ----
   Colours come from /brand.css; this is the shape of the mark itself. */
.tenant-tag { font-family: var(--mono); font-size: 11px; color: var(--fg-faint); }

/* Links inside a handed-over payload: visible, and never wide enough to push
   the bubble past the screen on a phone. */
.bubble a { color: var(--accent); text-decoration: underline; word-break: break-all; }
.bubble a:hover { color: var(--fg); }

/* The second door on the login page: same shape as the Google button so both
   read as equal choices, in the app's own colours rather than Google's. */
.gbtn-secondary { background: var(--bg-3); color: var(--fg); border: 1px solid var(--line-2); }
.gbtn-secondary:hover { background: #1f2636; border-color: var(--accent-dim); }

/* ---- per-tenant resources (remote side) ----
   Standard company links, rendered from tenants.json. Public: they show
   before any session exists. */
.resources { display: grid; gap: 10px; }
.resource {
  display: flex; gap: 13px; align-items: center; padding: 14px 15px; border-radius: 15px;
  border: 1px solid var(--line); background: var(--glass); text-decoration: none; color: inherit;
  transition: transform .14s, border-color .14s, box-shadow .14s;
}
.resource:hover {
  transform: translateY(-2px); border-color: var(--line-2); text-decoration: none;
  box-shadow: 0 20px 40px -28px rgba(0, 0, 0, .95);
}
.resource-ic {
  width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none;
  color: var(--fg); background: linear-gradient(150deg, rgba(var(--accent-rgb), .3), rgba(167, 139, 250, .16));
  border: 1px solid rgba(var(--accent-rgb), .28);
}
.resource b { display: block; font-size: 14px; color: var(--fg); }
.resource small { display: block; font-size: 12.5px; color: var(--fg-faint); margin-top: 2px; }
.resource-go { color: var(--fg-faint); flex: none; }
.resource.primary {
  border-color: rgba(var(--accent-rgb), .45);
  background: linear-gradient(120deg, rgba(var(--accent-rgb), .17), rgba(167, 139, 250, .06) 70%, transparent);
}
.resource.primary .resource-ic {
  background: linear-gradient(150deg, rgba(var(--accent-rgb), .75), var(--accent)); color: #06101f;
  border-color: transparent; box-shadow: 0 10px 22px -11px rgba(var(--accent-rgb), .9);
}

/* ---- quick send (operator side) ---- */
.rail { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0;
        background: linear-gradient(180deg, rgba(255, 255, 255, .028), transparent); }
.rail-head { padding: 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.rail-list { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.snippet {
  display: flex; gap: 11px; align-items: center; padding: 11px; border-radius: 12px; width: 100%;
  border: 1px solid var(--line); background: var(--glass); text-align: left;
}
.snippet:hover { border-color: rgba(110, 168, 254, .4); transform: translateX(-2px); }
.snippet-ic {
  width: 33px; height: 33px; border-radius: 10px; display: grid; place-items: center; flex: none;
  color: #8df0c4; background: linear-gradient(150deg, rgba(62, 207, 142, .28), rgba(62, 207, 142, .1));
  border: 1px solid rgba(62, 207, 142, .26);
}
.snippet-ic.secret {
  color: #dcc4ff; background: linear-gradient(150deg, rgba(167, 139, 250, .3), rgba(167, 139, 250, .1));
  border-color: rgba(167, 139, 250, .3);
}
.snippet b { display: block; font-size: 12.5px; font-weight: 650; }
.snippet small {
  display: block; font: 10.5px var(--mono); color: var(--fg-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rail-foot { padding: 13px; border-top: 1px solid var(--line); }

/* ---- segmented control ----
   All three payload kinds visible at once: the choice decides whether the
   payload is destroyed on read, which is too important for a dropdown. */
.seg { display: inline-flex; background: rgba(0, 0, 0, .38); border: 1px solid var(--line-2);
       border-radius: 11px; padding: 3.5px; gap: 3px; }
.seg button {
  background: transparent; border: 0; color: var(--fg-dim); font: 650 12.5px var(--sans);
  padding: 7px 13px; border-radius: 8px; min-height: 0;
}
.seg button:hover:not(:disabled) { transform: none; background: rgba(255, 255, 255, .05); }
.seg button[aria-pressed="true"] {
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .06));
  color: var(--fg); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14);
}
.seg button[aria-pressed="true"][data-kind="secret"] {
  background: linear-gradient(180deg, rgba(167, 139, 250, .38), rgba(167, 139, 250, .16)); color: #eaddff;
}
.seg button[aria-pressed="true"][data-kind="script"] {
  background: linear-gradient(180deg, rgba(62, 207, 142, .32), rgba(62, 207, 142, .13)); color: #a9f3cf;
}

/* ---- waiting state on the remote ---- */
.waiting-row { display: flex; align-items: center; gap: 14px; }
.ring { position: relative; width: 56px; height: 56px; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 11px var(--mono); color: var(--fg-dim); }

@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .rail { display: none; }
  .resource { padding: 11px 12px; }
  .resource-ic { width: 34px; height: 34px; border-radius: 11px; }
  .paircode { font-size: 29px; padding: 16px 10px; }
  .center-card { padding: 20px 18px; border-radius: 18px; }
  .seg button { padding: 8px 11px; font-size: 12px; }
}

/* ---- sub tabs (conversation / resources on the remote) ---- */
.subtabs { display: flex; gap: 3px; padding: 0 16px; border-bottom: 1px solid var(--line); flex: none; }
/* The same tabs inside a modal, which supplies its own padding. */
.subtabs.flush { padding: 0; }
/* The command a remote machine has to run. Selectable, scrollable, and never
   wrapped - a line break in a pasted shell command is its own support call. */
.howto { display: flex; align-items: center; gap: 8px; background: rgba(0, 0, 0, .34);
  border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 10px; }
.howto-cmd { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 12px; color: var(--fg); }
.howto-cmd::-webkit-scrollbar { height: 5px; }
.subtab {
  background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--fg-faint);
  font: 650 13px var(--sans); padding: 12px 12px; border-radius: 0;
}
.subtab:hover:not(:disabled) { background: transparent; color: var(--fg); transform: none; }
.subtab[aria-pressed="true"] { color: var(--fg); border-bottom-color: var(--accent); }

/* ---- admin: posture, controls, activity ---- */
.finding { display: flex; gap: 14px; align-items: flex-start; padding: 15px 17px; border-bottom: 1px solid rgba(255, 255, 255, .045); }
.finding:last-child { border-bottom: 0; }
.finding-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.finding b { display: block; font-size: 14px; }
.finding p { margin: 3px 0 0; font-size: 13px; color: var(--fg-dim); max-width: 70ch; }
/* status never travels alone: colour + icon + word */
.lvl { display: inline-flex; align-items: center; gap: 6px; font: 650 12px var(--sans); white-space: nowrap; }
.lvl-good    { color: #5ddc84; } .finding-ic.good    { background: rgba(12, 163, 12, .12);  color: #5ddc84; border: 1px solid rgba(12, 163, 12, .26); }
.lvl-warning { color: #fab219; } .finding-ic.warning { background: rgba(250, 178, 25, .12); color: #fab219; border: 1px solid rgba(250, 178, 25, .26); }
.lvl-serious { color: #ec835a; } .finding-ic.serious { background: rgba(236, 131, 90, .12); color: #ec835a; border: 1px solid rgba(236, 131, 90, .26); }
.lvl-critical{ color: #ff8a8a; } .finding-ic.critical{ background: rgba(208, 59, 59, .14);  color: #ff8a8a; border: 1px solid rgba(208, 59, 59, .3); }

.facets { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.facet { background: rgba(0, 0, 0, .22); border: 1px solid var(--line); border-radius: 15px; padding: 15px; }
.facet h4 { margin: 0; font-size: 13px; }
.facet .cap { font: 11px var(--mono); color: var(--fg-faint); margin: 2px 0 12px; }
.plot { display: flex; align-items: flex-end; gap: 2px; height: 74px; }
.plot .bar { flex: 1; background: #3987e5; border-radius: 4px 4px 0 0; min-height: 2px; }
.plot .bar:hover { filter: brightness(1.35); }
.plot .bar.peak { background: #5aa0f0; }
.facet .axis { display: flex; justify-content: space-between; font: 10px var(--mono); color: var(--fg-faint);
               margin-top: 7px; border-top: 1px solid var(--line); padding-top: 6px; }

.tenant-card { display: flex; gap: 15px; align-items: flex-start; padding: 16px 17px; }
.tenant-card dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; margin: 9px 0 0; font-size: 13px; align-items: baseline; }
.tenant-card dt { color: var(--fg-faint); font: 11.5px var(--mono); white-space: nowrap; }
.tenant-card dd { margin: 0; }

/* ---- link payload: a card with a real target, not a line of text ---- */
.link-card {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 13px;
  border: 1px solid rgba(255, 182, 72, .3); background: linear-gradient(140deg, rgba(255, 182, 72, .12), transparent 70%);
  text-decoration: none; color: inherit; min-height: 44px;
}
.link-card:hover { border-color: rgba(255, 182, 72, .5); text-decoration: none; }
.link-host { font: 700 13.5px var(--sans); color: var(--fg); flex: none; }
.link-path { font: 12px var(--mono); color: var(--fg-faint); flex: 1; min-width: 0; }
.link-open { font: 650 12.5px var(--sans); color: #ffd089; flex: none; }

/* ---- command palette ---- */
.palette-back {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: start center;
  padding: 12vh 20px 20px; background: rgba(4, 6, 11, .66); backdrop-filter: blur(4px);
}
.palette {
  width: 100%; max-width: 560px; border: 1px solid var(--line-2); border-radius: 18px; overflow: hidden;
  background: linear-gradient(180deg, rgba(22, 27, 38, .98), rgba(12, 15, 22, .99));
  box-shadow: var(--lift); display: flex; flex-direction: column; max-height: 70dvh;
}
.palette-input {
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent;
  padding: 17px 19px; font-size: 16px; width: 100%;
}
.palette-input:focus { outline: none; border-color: var(--line); }
.palette-list { overflow-y: auto; padding: 8px; flex: 1; }
.palette-group {
  font: 700 10.5px var(--sans); letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg-faint); padding: 11px 11px 6px;
}
.palette-item {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 10px 11px;
  font-weight: 500;
}
.palette-item.on {
  background: linear-gradient(120deg, rgba(var(--accent-rgb), .2), rgba(167, 139, 250, .06));
  border-color: rgba(var(--accent-rgb), .36);
}
.palette-item:hover:not(:disabled) { transform: none; }
.palette-item-hint { font: 11.5px var(--mono); color: var(--fg-faint); max-width: 45%; }
.palette-empty { padding: 22px 12px; text-align: center; color: var(--fg-faint); font-size: 13.5px; }
.palette-hint {
  display: flex; gap: 16px; padding: 10px 19px; border-top: 1px solid var(--line);
  font: 11px var(--mono); color: var(--fg-faint);
}
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) { .palette-back { padding-top: 6vh; } }



/* ---- light theme: flat selectors, because relaxed CSS nesting is too
   new to depend on in a tool people open on whatever browser is to hand ---- */
:root[data-theme="light"] body { background: radial-gradient(1100px 580px at 10% -12%, rgba(var(--accent-rgb), .13), transparent 62%), radial-gradient(900px 480px at 90% -6%, rgba(167, 139, 250, .1), transparent 58%), var(--bg); }
:root[data-theme="light"] body::after { opacity: .018; }
:root[data-theme="light"] button { background: rgba(10, 20, 45, .05); }
:root[data-theme="light"] button:hover:not(:disabled) { background: rgba(10, 20, 45, .09); }
:root[data-theme="light"] input, :root[data-theme="light"] textarea, :root[data-theme="light"] select { background: #fff; }
:root[data-theme="light"] .topbar { background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .62)); }
:root[data-theme="light"] .sidebar, :root[data-theme="light"] .rail { background: linear-gradient(180deg, rgba(10, 20, 45, .022), transparent); }
:root[data-theme="light"] .bubble pre { color: #16203a; }
:root[data-theme="light"] .modal, :root[data-theme="light"] .palette { background: linear-gradient(180deg, #fff, #f7f9fd); }
:root[data-theme="light"] .extend-menu { background: #fff; }
:root[data-theme="light"] .file-ext[data-family="pdf"] { color: #b42323; }
:root[data-theme="light"] .file-ext[data-family="doc"] { color: #1f4fbf; }
:root[data-theme="light"] .file-ext[data-family="xls"] { color: #147a45; }
:root[data-theme="light"] .file-ext[data-family="ppt"] { color: #b4571b; }
:root[data-theme="light"] .file-ext[data-family="img"] { color: #6c3fc4; }
:root[data-theme="light"] .extend-opt { background: transparent; }
:root[data-theme="light"] .palette-back { background: rgba(20, 28, 48, .4); }
:root[data-theme="light"] .paircode { color: #0d1526; }
:root[data-theme="light"] .toast { background: #fff; color: var(--fg); box-shadow: 0 14px 34px -14px rgba(10, 20, 45, .35); }
:root[data-theme="light"] .badge-good { color: #0a6e30; background: rgba(10, 143, 60, .12); border-color: rgba(10, 143, 60, .3); }
:root[data-theme="light"] .badge-warn { color: #7d5200; background: rgba(154, 100, 0, .12); border-color: rgba(154, 100, 0, .3); }
:root[data-theme="light"] .badge-bad { color: #9c2b25; background: rgba(192, 54, 47, .12); border-color: rgba(192, 54, 47, .3); }
:root[data-theme="light"] .badge-admin, :root[data-theme="light"] .badge-secret { color: #553098; background: rgba(109, 65, 200, .12); border-color: rgba(109, 65, 200, .3); }
:root[data-theme="light"] .lvl-good { color: #0a6e30; }
:root[data-theme="light"] .lvl-warning { color: #7d5200; }
:root[data-theme="light"] .lvl-serious { color: #9c4a21; }
:root[data-theme="light"] .lvl-critical { color: #9c2b25; }
:root[data-theme="light"] .finding-ic.good { background: rgba(10, 143, 60, .1); color: #0a6e30; border-color: rgba(10, 143, 60, .25); }
:root[data-theme="light"] .finding-ic.warning { background: rgba(154, 100, 0, .1); color: #7d5200; border-color: rgba(154, 100, 0, .25); }
:root[data-theme="light"] .finding-ic.serious { background: rgba(156, 74, 33, .1); color: #9c4a21; border-color: rgba(156, 74, 33, .25); }
:root[data-theme="light"] .finding-ic.critical { background: rgba(192, 54, 47, .1); color: #9c2b25; border-color: rgba(192, 54, 47, .25); }
:root[data-theme="light"] .snippet-ic { color: #0a6e30; background: rgba(10, 143, 60, .12); border-color: rgba(10, 143, 60, .26); }
:root[data-theme="light"] .snippet-ic.secret { color: #553098; background: rgba(109, 65, 200, .12); border-color: rgba(109, 65, 200, .26); }
:root[data-theme="light"] .resource-ic { color: var(--accent-ink); }
:root[data-theme="light"] .link-host { color: var(--fg); }
:root[data-theme="light"] .link-open { color: #7d5200; }
:root[data-theme="light"] .device-av i { border-color: #fff; }
:root[data-theme="light"] .device, :root[data-theme="light"] .hbtn, :root[data-theme="light"] .pill-btn, :root[data-theme="light"] .plus-opt { background: transparent; }
:root[data-theme="light"] .device:hover:not(:disabled), :root[data-theme="light"] .hbtn:hover:not(:disabled) { background: rgba(10, 20, 45, .05); }
:root[data-theme="light"] .device.active { background: rgba(var(--accent-rgb), .12); }
:root[data-theme="light"] .hbtn-plus, :root[data-theme="light"] .hbtn-plus:hover:not(:disabled) { color: #fff; background: linear-gradient(140deg, var(--accent), var(--accent-ink)); }
:root[data-theme="light"] tbody tr:hover td { background: rgba(10, 20, 45, .03); }
:root[data-theme="light"] td { border-bottom-color: rgba(10, 20, 45, .07); }
:root[data-theme="light"] a { color: var(--accent-ink); }
:root[data-theme="light"] .btn-primary { color: #fff; background: linear-gradient(180deg, var(--accent), var(--accent-ink)); border-color: var(--accent-ink); }
:root[data-theme="light"] .paircode-label { color: var(--accent-ink); }
:root[data-theme="light"] .tab.active { color: var(--accent-ink); border-bottom-color: var(--accent-ink); }
:root[data-theme="light"] .subtab[aria-pressed="true"] { color: var(--fg); border-bottom-color: var(--accent-ink); }
:root[data-theme="light"] .subtab, :root[data-theme="light"] .subtab:hover:not(:disabled) { background: transparent; }
:root[data-theme="light"] .seg { background: rgba(10, 20, 45, .05); border-color: rgba(10, 20, 45, .1); }
:root[data-theme="light"] .seg button { background: transparent; }
:root[data-theme="light"] .seg button[aria-pressed="true"] { background: #fff; color: var(--fg); box-shadow: 0 1px 3px rgba(10, 20, 45, .14); }
:root[data-theme="light"] .file-get { color: var(--accent-ink); background: rgba(var(--accent-rgb), .1); }
:root[data-theme="light"] .seg button[aria-pressed="true"][data-kind="secret"] { background: #efe7ff; color: #5b34c7; }
:root[data-theme="light"] .seg button[aria-pressed="true"][data-kind="script"] { background: #e3f7ee; color: #12734a; }
:root[data-theme="light"] .seg button[aria-pressed="true"][data-kind="command"] { background: #ffe9ec; color: #b4233a; }
:root[data-theme="light"] .resource b, :root[data-theme="light"] .snippet b, :root[data-theme="light"] .device-name { color: var(--fg); }
:root[data-theme="light"] .qr { box-shadow: 0 16px 34px -22px rgba(10, 20, 45, .5); }

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) body { background: radial-gradient(1100px 580px at 10% -12%, rgba(var(--accent-rgb), .13), transparent 62%), radial-gradient(900px 480px at 90% -6%, rgba(167, 139, 250, .1), transparent 58%), var(--bg); }
  :root:not([data-theme="dark"]) body::after { opacity: .018; }
  :root:not([data-theme="dark"]) button { background: rgba(10, 20, 45, .05); }
  :root:not([data-theme="dark"]) button:hover:not(:disabled) { background: rgba(10, 20, 45, .09); }
  :root:not([data-theme="dark"]) .device, :root:not([data-theme="dark"]) .hbtn,
  :root:not([data-theme="dark"]) .pill-btn, :root:not([data-theme="dark"]) .plus-opt { background: transparent; }
  :root:not([data-theme="dark"]) .device:hover:not(:disabled), :root:not([data-theme="dark"]) .hbtn:hover:not(:disabled) { background: rgba(10, 20, 45, .05); }
  :root:not([data-theme="dark"]) .device.active { background: rgba(var(--accent-rgb), .12); }
  :root:not([data-theme="dark"]) .hbtn-plus, :root:not([data-theme="dark"]) .hbtn-plus:hover:not(:disabled) { color: #fff; background: linear-gradient(140deg, var(--accent), var(--accent-ink)); }
  :root:not([data-theme="dark"]) input, :root:not([data-theme="dark"]) textarea, :root:not([data-theme="dark"]) select { background: #fff; }
  :root:not([data-theme="dark"]) .topbar { background: linear-gradient(180deg, rgba(255, 255, 255, .92), rgba(255, 255, 255, .62)); }
  :root:not([data-theme="dark"]) .sidebar, :root:not([data-theme="dark"]) .rail { background: linear-gradient(180deg, rgba(10, 20, 45, .022), transparent); }
  :root:not([data-theme="dark"]) .bubble pre { color: #16203a; }
  :root:not([data-theme="dark"]) .modal, :root:not([data-theme="dark"]) .palette { background: linear-gradient(180deg, #fff, #f7f9fd); }
  :root:not([data-theme="dark"]) .extend-menu { background: #fff; }
  :root:not([data-theme="dark"]) .file-ext[data-family="pdf"] { color: #b42323; }
  :root:not([data-theme="dark"]) .file-ext[data-family="doc"] { color: #1f4fbf; }
  :root:not([data-theme="dark"]) .file-ext[data-family="xls"] { color: #147a45; }
  :root:not([data-theme="dark"]) .file-ext[data-family="ppt"] { color: #b4571b; }
  :root:not([data-theme="dark"]) .file-ext[data-family="img"] { color: #6c3fc4; }
  :root:not([data-theme="dark"]) .extend-opt { background: transparent; }
  :root:not([data-theme="dark"]) .palette-back { background: rgba(20, 28, 48, .4); }
  :root:not([data-theme="dark"]) .paircode { color: #0d1526; }
  :root:not([data-theme="dark"]) .toast { background: #fff; color: var(--fg); box-shadow: 0 14px 34px -14px rgba(10, 20, 45, .35); }
  :root:not([data-theme="dark"]) .badge-good { color: #0a6e30; background: rgba(10, 143, 60, .12); border-color: rgba(10, 143, 60, .3); }
  :root:not([data-theme="dark"]) .badge-warn { color: #7d5200; background: rgba(154, 100, 0, .12); border-color: rgba(154, 100, 0, .3); }
  :root:not([data-theme="dark"]) .badge-bad { color: #9c2b25; background: rgba(192, 54, 47, .12); border-color: rgba(192, 54, 47, .3); }
  :root:not([data-theme="dark"]) .badge-admin, :root:not([data-theme="dark"]) .badge-secret { color: #553098; background: rgba(109, 65, 200, .12); border-color: rgba(109, 65, 200, .3); }
  :root:not([data-theme="dark"]) .lvl-good { color: #0a6e30; }
  :root:not([data-theme="dark"]) .lvl-warning { color: #7d5200; }
  :root:not([data-theme="dark"]) .lvl-serious { color: #9c4a21; }
  :root:not([data-theme="dark"]) .lvl-critical { color: #9c2b25; }
  :root:not([data-theme="dark"]) .finding-ic.good { background: rgba(10, 143, 60, .1); color: #0a6e30; border-color: rgba(10, 143, 60, .25); }
  :root:not([data-theme="dark"]) .finding-ic.warning { background: rgba(154, 100, 0, .1); color: #7d5200; border-color: rgba(154, 100, 0, .25); }
  :root:not([data-theme="dark"]) .finding-ic.serious { background: rgba(156, 74, 33, .1); color: #9c4a21; border-color: rgba(156, 74, 33, .25); }
  :root:not([data-theme="dark"]) .finding-ic.critical { background: rgba(192, 54, 47, .1); color: #9c2b25; border-color: rgba(192, 54, 47, .25); }
  :root:not([data-theme="dark"]) .snippet-ic { color: #0a6e30; background: rgba(10, 143, 60, .12); border-color: rgba(10, 143, 60, .26); }
  :root:not([data-theme="dark"]) .snippet-ic.secret { color: #553098; background: rgba(109, 65, 200, .12); border-color: rgba(109, 65, 200, .26); }
  :root:not([data-theme="dark"]) .resource-ic { color: var(--accent-ink); }
  :root:not([data-theme="dark"]) .link-host { color: var(--fg); }
  :root:not([data-theme="dark"]) .link-open { color: #7d5200; }
  :root:not([data-theme="dark"]) .device-av i { border-color: #fff; }
  :root:not([data-theme="dark"]) tbody tr:hover td { background: rgba(10, 20, 45, .03); }
  :root:not([data-theme="dark"]) td { border-bottom-color: rgba(10, 20, 45, .07); }
  :root:not([data-theme="dark"]) a { color: var(--accent-ink); }
  :root:not([data-theme="dark"]) .btn-primary { color: #fff; background: linear-gradient(180deg, var(--accent), var(--accent-ink)); border-color: var(--accent-ink); }
  :root:not([data-theme="dark"]) .paircode-label { color: var(--accent-ink); }
  :root:not([data-theme="dark"]) .tab.active { color: var(--accent-ink); border-bottom-color: var(--accent-ink); }
  :root:not([data-theme="dark"]) .subtab[aria-pressed="true"] { color: var(--fg); border-bottom-color: var(--accent-ink); }
  :root:not([data-theme="dark"]) .subtab, :root:not([data-theme="dark"]) .subtab:hover:not(:disabled) { background: transparent; }
  :root:not([data-theme="dark"]) .seg { background: rgba(10, 20, 45, .05); border-color: rgba(10, 20, 45, .1); }
  :root:not([data-theme="dark"]) .seg button { background: transparent; }
  :root:not([data-theme="dark"]) .seg button[aria-pressed="true"] { background: #fff; color: var(--fg); box-shadow: 0 1px 3px rgba(10, 20, 45, .14); }
  :root:not([data-theme="dark"]) .file-get { color: var(--accent-ink); background: rgba(var(--accent-rgb), .1); }
  :root:not([data-theme="dark"]) .seg button[aria-pressed="true"][data-kind="secret"] { background: #efe7ff; color: #5b34c7; }
  :root:not([data-theme="dark"]) .seg button[aria-pressed="true"][data-kind="script"] { background: #e3f7ee; color: #12734a; }
  :root:not([data-theme="dark"]) .seg button[aria-pressed="true"][data-kind="command"] { background: #ffe9ec; color: #b4233a; }
  :root:not([data-theme="dark"]) .resource b, :root:not([data-theme="dark"]) .snippet b, :root:not([data-theme="dark"]) .device-name { color: var(--fg); }
  :root:not([data-theme="dark"]) .qr { box-shadow: 0 16px 34px -22px rgba(10, 20, 45, .5); }
}

/* ---- brand wordmark ----
   Self-hosted rather than fetched from Google: the CSP stays 'self' only, and
   no visitor's address is handed to a third party just to draw a logo.
   One variable file covers the whole weight range. */
@font-face {
  font-family: 'Brand Sans';
  src: url('/fonts/montserrat.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

.brand-logo { width: 28px; height: 28px; border-radius: 0; object-fit: contain; flex: none; display: block; }
.brand-name { white-space: nowrap; }
/* A tenant that ships a wordmark gets its own face and spacing. */
.brand-wordmark {
  font-family: 'Brand Sans', var(--sans);
  font-weight: 400;
  letter-spacing: -.4px;
  white-space: nowrap;
}
.brand-wordmark strong { font-weight: 700; }
.center-card .brand-logo, .brand.t18 .brand-logo { width: 40px; height: 40px; }

/* ---- co-brand lockup ----
   Tenant first, product second. The hairline is what keeps them from reading
   as two companies sharing a title bar: it gives the eye a stop, so the second
   half is understood as a label rather than another owner. The mark is in
   the product's blue, as on the app icon. */
.brand.co { gap: 10px; }
.co-rule { width: 1px; height: 17px; background: var(--line-2); flex: none; }
.co-product { display: flex; align-items: center; gap: 6px; color: var(--accent); flex: none; }
.co-mark { width: 15px; height: 15px; display: block; flex: none; }
.co-mark path {
  fill: none; stroke: currentColor; stroke-width: 9;
  stroke-linecap: round; stroke-linejoin: round;
}
.co-name { font-size: 12px; font-weight: 600; color: var(--fg-dim); white-space: nowrap; }
/* The cards have room, so everything steps up with the tenant logo. */
.center-card .co-rule, .brand.t18 .co-rule { height: 24px; }
.center-card .co-mark, .brand.t18 .co-mark { width: 19px; height: 19px; }
.center-card .co-name, .brand.t18 .co-name { font-size: 13px; }

/* ---- wide tenant logos ----
   A horizontal lockup already spells the company name, so it replaces the
   text wordmark and keeps its own aspect instead of being squeezed square.
   max-width is the safety net: a very long lockup must not push the rest of
   the topbar onto a second row. */
.brand-logo.wide { width: auto; height: 26px; max-width: 190px; }
.center-card .brand-logo.wide, .brand.t18 .brand-logo.wide { width: auto; height: 38px; max-width: 260px; }

/* Both variants ship in the markup because the theme can be the operating
   system's choice, which the server never sees. Default to the dark-surface
   artwork and swap only where the page is actually light. */
.brand-logo.for-light { display: none; }
:root[data-theme="light"] .brand-logo.for-light { display: block; }
:root[data-theme="light"] .brand-logo.for-dark { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .brand-logo.for-light { display: block; }
  :root:not([data-theme="dark"]) .brand-logo.for-dark { display: none; }
}

.center-card .brand-wordmark, .brand.t18 .brand-wordmark { font-size: 1.5rem; }
.center-card .brand, .brand.t18 { gap: 12px; }
.topbar .brand-wordmark { font-size: 1.05rem; }

/* ---- Markdown in a message bubble ----------------------------------------------- */
.md {
  font-size: 14px; line-height: 1.55; overflow-wrap: anywhere;
  max-height: 520px; overflow: auto;
}
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md .md-table, .md .md-pre { margin: 0 0 10px; }
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { margin: 14px 0 6px; line-height: 1.3; font-weight: 700; }
.md h1 { font-size: 19px; }
.md h2 { font-size: 17px; }
.md h3 { font-size: 15px; }
.md h4, .md h5, .md h6 { font-size: 14px; color: var(--fg-dim); }
.md ul, .md ol { padding-left: 22px; }
.md li { margin: 2px 0; }
.md li > ul, .md li > ol { margin: 2px 0; }
.md li.md-task { list-style: none; margin-left: -20px; }
.md li.md-task > input { margin: 0 7px 0 0; vertical-align: -1px; width: auto; }
.md a { color: var(--accent); }
.md code {
  font-family: var(--mono); font-size: 12.5px; padding: 1px 5px; border-radius: 5px;
  background: var(--bg-3); border: 1px solid var(--line);
}
.md .md-pre {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5; white-space: pre;
  overflow: auto; max-height: 360px; padding: 10px 12px; border-radius: 10px;
  background: rgba(0, 0, 0, .28); border: 1px solid var(--line);
}
.md .md-pre code { padding: 0; border: 0; background: none; font-size: inherit; }
.md blockquote {
  padding: 2px 0 2px 12px; border-left: 3px solid var(--line-2); color: var(--fg-dim);
}
.md hr { border: 0; border-top: 1px solid var(--line-2); margin: 12px 0; }
.md .md-table { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 13px; }
.md th, .md td { border: 1px solid var(--line-2); padding: 5px 9px; text-align: left; vertical-align: top; }
.md th { background: var(--bg-3); font-weight: 700; }
.md .md-center { text-align: center; }
.md .md-right { text-align: right; }
:root[data-theme="light"] .md .md-pre { background: rgba(10, 20, 45, .045); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .md .md-pre { background: rgba(10, 20, 45, .045); }
}
@media (max-width: 640px) {
  .md { font-size: 14.5px; max-height: 420px; }
}

/* ---- end-to-end lock chip and voice calls ----------------------------------------
   The chip carries the safety code; amber until the two people have compared
   it, green after. A call is a card in the corner on a computer and the whole
   screen on a phone, like any phone call. */
.e2e-chip {
  display: inline-flex; align-items: center; gap: 5px; flex: none; min-height: 0;
  font: 650 11.5px var(--mono); letter-spacing: .04em; padding: 4px 9px; border-radius: 999px;
  color: var(--fg-dim); background: var(--bg-3); border: 1px solid var(--line-2);
}
.e2e-chip[data-tone="good"] { color: var(--good); border-color: rgba(62, 207, 142, .45); background: rgba(62, 207, 142, .1); }
.e2e-chip[data-tone="warn"] { color: var(--warn); border-color: rgba(255, 182, 72, .45); background: rgba(255, 182, 72, .1); }
.e2e-chip[data-tone="bad"] { color: var(--bad); border-color: rgba(255, 107, 122, .45); background: rgba(255, 107, 122, .1); }
.e2e-chip svg { flex: none; }
.call-btn { padding: 7px; border-radius: 11px; color: var(--good); }
.call-btn:disabled { color: var(--fg-faint); }

.sas-box {
  border: 1px solid rgba(62, 207, 142, .35); background: rgba(62, 207, 142, .06);
  border-radius: 14px; padding: 12px 16px; text-align: center;
}
.sas-box small { display: block; color: var(--fg-dim); font-size: 12px; }
.sas { font: 750 30px var(--mono); letter-spacing: .14em; color: var(--fg); padding: 4px 0; }
.verify-modal { max-width: 420px; }

.call-sheet {
  /* Top right, clear of the composer and its Send button. */
  position: fixed; right: 20px; top: 76px; z-index: 250; width: 320px;
  animation: pop-top .18s ease-out;
}
.call-card {
  border: 1px solid var(--line-2); border-radius: 22px; padding: 22px 18px 18px; text-align: center;
  background: radial-gradient(320px 220px at 50% 0%, rgba(var(--accent-rgb), .2), transparent 72%), var(--bg);
  box-shadow: var(--lift), 0 24px 60px -20px rgba(0, 0, 0, .7);
  display: flex; flex-direction: column; gap: 18px;
}
.call-sheet[data-state="active"] .call-card { border-color: rgba(62, 207, 142, .45); }
.call-who { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.call-av {
  width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; margin-bottom: 6px;
  font: 800 21px var(--sans); color: #0a1020; background: linear-gradient(140deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 0 0 8px rgba(var(--accent-rgb), .1);
}
.call-sheet[data-state="incoming"] .call-av, .call-sheet[data-state="outgoing"] .call-av { animation: call-pulse 1.6s ease-in-out infinite; }
@keyframes call-pulse {
  50% { box-shadow: 0 0 0 16px rgba(var(--accent-rgb), .06); }
}
.call-name { margin: 0; font-size: 17px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-status { font-size: 13px; color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.call-sheet[data-state="active"] .call-status { font-family: var(--mono); color: var(--fg); }
.call-sas { margin-top: 10px; padding: 7px 14px; border-radius: 12px; border: 1px solid rgba(62, 207, 142, .3); background: rgba(62, 207, 142, .06); }
.call-sas small { display: block; font-size: 10.5px; color: var(--fg-dim); letter-spacing: .06em; text-transform: uppercase; }
.call-sas-code { font: 750 19px var(--mono); letter-spacing: .14em; }
.call-bg-note { display: flex; align-items: flex-start; gap: 8px; max-width: 300px; margin: 14px 0 0; padding: 10px 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--warn, #f5b04a) 35%, transparent); background: color-mix(in srgb, var(--warn, #f5b04a) 8%, transparent); color: var(--fg-dim); font-size: 12.5px; line-height: 1.45; text-align: left; }
.call-bg-note svg { flex: none; margin-top: 2px; color: var(--warn, #f5b04a); }
.call-bg-note.hidden { display: none; }
.call-lock { display: flex; align-items: center; gap: 5px; margin-top: 8px; font-size: 11.5px; color: var(--fg-faint); }
.call-acts { display: flex; justify-content: center; gap: 30px; }
.call-act { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.call-act span { font-size: 11.5px; color: var(--fg-dim); }
.call-round {
  width: 56px; height: 56px; min-height: 56px; border-radius: 50%; padding: 0; display: grid; place-items: center;
  background: var(--bg-3); border: 1px solid var(--line-2); color: var(--fg);
}
.call-round.call-end { background: #e5484d; border-color: #e5484d; color: #fff; }
.call-round.call-ok { background: #2bb673; border-color: #2bb673; color: #fff; }
.call-round.call-on { background: var(--fg); color: var(--bg); }
.call-round.call-end:hover:not(:disabled) { background: #d13b40; }
.call-round.call-ok:hover:not(:disabled) { background: #22a165; }
.call-audio { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* A call in the conversation is one line, centred, not a bubble. */
.item.call-item { align-self: center; max-width: 100%; }
.call-line {
  display: flex; align-items: center; gap: 9px; font-size: 13px; padding: 7px 14px 7px 8px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2);
}
.call-line-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--good); background: rgba(62, 207, 142, .13); }
.call-line-ic.missed { color: var(--bad); background: rgba(255, 107, 122, .12); }
.call-line-text { min-width: 0; }

@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  /* A phone call takes the phone. */
  .call-sheet { inset: 0; width: auto; }
  .call-card {
    height: 100%; border: 0; border-radius: 0; justify-content: space-between;
    padding: calc(56px + env(safe-area-inset-top)) 22px calc(40px + env(safe-area-inset-bottom));
  }
  .call-av { width: 92px; height: 92px; border-radius: 28px; font-size: 30px; }
  .call-name { font-size: 22px; margin-top: 10px; }
  .call-status { font-size: 15px; }
  .call-sas-code { font-size: 22px; }
  .call-acts { gap: 54px; }
  .call-round { width: 66px; height: 66px; min-height: 66px; }
  html.call-open, html.call-open body { overflow: hidden; }
  /* The safety code is a tap away on the lock; the header has no room for it. */
}

/* ---- friends (/people, /f/:token) ------------------------------------------ */
/* A person's avatar: initials on a colour fixed by their id. Round, where a
   device's is a rounded square, so a person never looks like a machine. */
.pav {
  width: 36px; height: 36px; border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center; font: 700 12.5px var(--sans); color: #fff; letter-spacing: .02em;
}
.pav i {
  position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--good); border: 2.5px solid var(--bg);
}
.pav.lg { width: 64px; height: 64px; font-size: 21px; margin: 0 auto; }
.pav.c1 { background: linear-gradient(140deg, #f08a5d, #d9485f); }
.pav.c2 { background: linear-gradient(140deg, #3ecf8e, #1d8f72); }
.pav.c3 { background: linear-gradient(140deg, #a78bfa, #6d4fd8); }
.pav.c4 { background: linear-gradient(140deg, #f5b544, #d98a1c); }
.pav.c5 { background: linear-gradient(140deg, #5aa9ff, #2f6fd6); }
.pav.c6 { background: linear-gradient(140deg, #f472b6, #c2417f); }

.kind-chip {
  font: 700 9.5px var(--sans); letter-spacing: .06em; text-transform: uppercase; flex: none;
  padding: 2px 7px; border-radius: 999px; color: var(--fg-dim); border: 1px solid var(--line-2);
}
.kind-chip.staff { color: var(--accent); border-color: rgba(var(--accent-rgb), .45); background: rgba(var(--accent-rgb), .1); }

.notify-card { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 11px 12px; border-radius: 12px;
  border: 1px solid rgba(var(--accent-rgb), .35); background: rgba(var(--accent-rgb), .08); }
.notify-btn { padding: 7px; border-radius: 11px; }
/* Devices in Spanish (#143, screen 8): the one line that says it is still English. */
.en-note { display: none; gap: 10px; align-items: flex-start; margin: 10px 12px 0; padding: 10px 12px; border-radius: 12px;
  border: 1px solid rgba(var(--accent-rgb), .35); background: rgba(var(--accent-rgb), .08); }
:root:not(:lang(en)) .en-note { display: flex; }
.en-note b { display: block; font-size: 13.5px; }
.en-note small { color: var(--fg-dim); font-size: 12.5px; }
.en-note [data-icon] { color: var(--accent); flex: none; margin-top: 1px; }
.notify-btn[data-state="on"] { color: var(--accent); }
.reqcard {
  display: flex; gap: 11px; align-items: flex-start; padding: 11px; border-radius: 12px;
  border: 1px dashed rgba(var(--accent-rgb), .45); background: rgba(var(--accent-rgb), .06);
}
.reqcard small { font-size: 11.5px; }

.people-welcome { max-width: 440px; }
.people-starts { margin-top: 6px; text-align: left; }
.bigbtn {
  display: flex; align-items: center; gap: 12px; padding: 13px; border-radius: 13px; width: 100%;
  border: 1px solid var(--line-2); background: var(--bg-3); color: var(--fg); font-size: 13.5px; text-align: left;
  white-space: normal;
}
.bigbtn > span:last-child { min-width: 0; }
.bigbtn:hover { border-color: rgba(var(--accent-rgb), .55); transform: none; }
.bigbtn .ic {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: rgba(var(--accent-rgb), .16); font-size: 16px;
}
.bigbtn small { display: block; color: var(--fg-faint); font-size: 11.5px; margin-top: 2px; line-height: 1.4; }

.friends-since {
  align-self: center; text-align: center; font-size: 12px; color: var(--fg-faint);
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); max-width: 92%;
}

.linkbox {
  font-size: 12px; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--line-2);
  color: var(--fg-dim); word-break: break-all; user-select: all;
}
.wa-btn {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  background: #25d366; color: #062b14; font-weight: 650; border-radius: 10px; padding: 7px 12px;
}
.wa-btn:hover { background: #2fe072; }
.pending-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); font-size: 13px;
}
.pending-row small { font-size: 11px; }
#add-modal .modal { max-height: 88dvh; overflow-y: auto; }

.invite-card .center { text-align: center; align-items: center; }
.invite-card .gbtn, .invite-card #accept { width: 100%; }



/* ---- the app: Chats and Devices on one page (app.html, app.js) -------------
   A rail on the left on a computer; tabs along the bottom on a phone. */
.shell { display: flex; min-height: 0; }
.shell-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.shell-main > .place { flex: 1; min-height: 0; }
.appnav {
  width: 76px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: calc(14px + env(safe-area-inset-top)) 0 14px; border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), transparent);
}
.nav-brand { margin-bottom: 12px; min-height: 28px; display: grid; place-items: center; }
.nav-logo { width: 34px; height: 34px; border-radius: 10px; display: block; }
.nav-logo.bare { width: 36px; height: 36px; border-radius: 0; }
.nav-btn {
  position: relative; width: 60px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 0 6px; border-radius: 14px; color: var(--fg-faint); font-size: 11px; font-weight: 650;
}
.nav-btn:hover { color: var(--fg); background: rgba(127, 127, 127, .09); text-decoration: none; }
.nav-btn[aria-current="page"] { color: var(--accent); background: rgba(var(--accent-rgb), .14); }
.nav-ic { display: grid; place-items: center; height: 26px; }
.nav-badge {
  position: absolute; top: 1px; left: calc(50% + 6px); font: 700 10px/1.5 var(--sans); font-style: normal;
  min-width: 18px; padding: 0 5px; border-radius: 999px; text-align: center;
  background: var(--accent); color: #06101f;
}
.nav-badge.nav-warn { background: var(--warn); }
.nav-gap { flex: 1; }
.nav-av { width: 28px; height: 28px; font-size: 10.5px; }
.nav-btn[aria-current="page"] .nav-av { box-shadow: 0 0 0 2px var(--accent); }

.place-title { margin: 0; font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
.place-act { padding: 6px; border-radius: 10px; color: var(--accent); }
.ws-chip { font: 650 11px var(--sans); color: var(--warn); white-space: nowrap; }
.list-search { width: 100%; padding: 8px 12px; border-radius: 10px; font-size: 13px; }
.back-btn { display: none; padding: 6px; margin-left: -6px; }

/* ---- Chats: the list ---- */
.device-list .pav { width: 48px; height: 48px; font-size: 16px; }
.pav.biz { border-radius: 28%; }
.chat-preview { font-size: 13.5px; color: var(--fg-dim); }
.chat-row-item.unread .chat-preview { color: var(--fg); }
.chat-preview.missed { color: var(--bad); }
.chat-when { font-size: 12px; font-weight: 400; color: var(--fg-faint); white-space: nowrap; flex: none; }
.device.unread .chat-when { color: var(--good); font-weight: 650; }
/* The company a staff friend speaks for, small enough to leave the name room. */
.device .kind-chip { font-size: 9px; padding: 1px 6px; border-color: transparent; }
.device-list .reqcard { margin: 6px 10px; }

/* Header buttons: round, the + filled. */
.hbtn {
  width: 36px; height: 36px; padding: 0; border-radius: 50%; border: 0; flex: none;
  display: grid; place-items: center; color: var(--fg-dim); background: transparent;
}
.hbtn:hover:not(:disabled) { color: var(--fg); background: rgba(127, 127, 127, .1); transform: none; }
.hbtn-plus, .hbtn-plus:hover:not(:disabled) { color: #06101f; background: linear-gradient(140deg, var(--accent), var(--brand-2)); }
.hbtn-plus:hover:not(:disabled) { filter: brightness(1.08); }
#friend-meta.is-online { color: var(--good); }

/* ---- Chats: bubbles ----
   Just the message, with its time and ticks inside; kind, size and the exact
   receipt show when it is tapped (items.js). Devices keep the full header. */
.chat-timeline { gap: 6px; padding: 16px 20px; }
.chat-timeline .day-divider { margin: 8px 0 4px; }
.chat-timeline .friends-since { margin-bottom: 6px; }
.item.chat { max-width: min(580px, 80%); gap: 3px; }
.item.chat .bubble {
  width: auto; max-width: 100%; padding: 7px 11px 5px; border-radius: 18px 18px 18px 6px;
}
.item.chat.mine .bubble { border-radius: 18px 18px 6px 18px; }
.item.chat .bubble pre { font-family: var(--sans); font-size: 14.5px; line-height: 1.45; }
.item.chat .bubble-title { font-size: 12px; margin-bottom: 3px; }
.item.chat .item-actions { margin-top: 7px; }
.item.chat .secret-cover { font-size: 13px; gap: 8px; }
/* The bubble's title already says "🔒 Secret". */
.item.chat .secret-cover .lock { display: none; }
.bubble-foot { display: flex; justify-content: flex-end; align-items: center; gap: 4px; margin-top: 2px; font-size: 10.5px; color: var(--fg-faint); white-space: nowrap; }
.ticks { letter-spacing: -.18em; padding-right: .18em; }
.ticks.read { color: var(--accent); }

/* ---- Chats: writing ----
   One pill - the text, the paperclip (the + sheet) and the camera inside it -
   and a round send. Devices share it (composer.js). */
.composer.chat-composer { position: relative; gap: 8px; padding: 10px 14px; }
.chat-row { display: flex; align-items: flex-end; gap: 8px; }
.pill-field {
  flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 2px; padding: 0 6px 0 0;
  border-radius: 22px; background: var(--field); border: 1px solid var(--line-2);
}
.pill-field:focus-within { border-color: rgba(var(--accent-rgb), .55); }
/* The box grows in whole lines, up to half the space above the keyboard
   (--app-h, common.js) and never past 12; then it scrolls (#202). Its top and
   bottom room is margin, not padding, so a scrolled box shows no sliver of
   the line above. */
.chat-row textarea {
  flex: 1; min-width: 0; resize: none; height: 1lh; min-height: 1lh;
  max-height: min(12lh, max(4lh, round(down, var(--app-h, 100dvh) / 2 - 20px, 1lh)));
  margin: 10px 0; padding: 0 6px 0 15px; border-radius: 0; font: 15px/22px var(--sans);
  border: 0; background: transparent; box-shadow: none; outline: none;
}
@supports not (height: round(down, 10px, 1px)) {
  .chat-row textarea { max-height: min(12lh, max(4lh, calc(var(--app-h, 100dvh) / 2 - 20px))); }
}
.chat-row textarea:focus { box-shadow: none; border: 0; }
.pill-btn {
  width: 40px; height: 40px; margin-bottom: 1px; padding: 0; border: 0; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: var(--fg-dim); background: transparent;
}
.pill-btn:hover:not(:disabled) { color: var(--fg); background: rgba(127, 127, 127, .1); transform: none; }
.pill-btn.open { color: var(--accent); }
/* On a phone the pill holds only the text, with the whole width; one round +
   on its left opens the sheet, which turns it into a × (#201). A computer
   keeps the paperclip in the pill. */
.composer .chat-row > .pill-btn.side-plus {
  width: 38px; height: 38px; margin-bottom: 3px; border-radius: 50%;
  background: var(--bg-3); color: var(--fg-dim);
}
.chat-row > .side-plus svg { transition: transform .15s ease; }
.composer .chat-row > .pill-btn.side-plus.open, .composer .chat-row > .pill-btn.side-plus.open:hover:not(:disabled) { background: var(--accent); color: #fff; }
.chat-row > .side-plus.open svg { transform: rotate(45deg); }
.composer.touch .pill-field { padding-right: 0; }
.composer.touch .chat-row textarea { padding-right: 14px; }
.chat-composer[data-rec] .chat-row > .side-plus { display: none; }
/* Photos, Camera, File, Secret: four across on a phone, as the mockup's s8. */
.composer.touch .plus-sheet { grid-template-columns: repeat(4, 1fr); }
/* The camera is for phones; a computer picks a photo from the + sheet. */
@media (hover: hover) and (pointer: fine) {
  .plus-opt[data-opt="camera"] { display: none; }
}
@supports (field-sizing: content) {
  .chat-row textarea { field-sizing: content; height: auto; }
}
.round-btn { width: 42px; height: 42px; min-height: 42px; border-radius: 50%; padding: 0; display: grid; place-items: center; flex: none; }
.round-btn:hover:not(:disabled) { transform: none; }
.send-btn { width: 44px; height: 44px; background: linear-gradient(140deg, var(--accent), #4f8be8); border-color: transparent; color: #06101f; opacity: .55; }
.send-btn.ready { opacity: 1; }
.send-btn:hover:not(:disabled) { background: linear-gradient(140deg, var(--accent), #4f8be8); filter: brightness(1.08); }
.send-btn[data-kind="secret"] { background: #8b6cf0; color: #fff; }
.send-btn[data-kind="command"] { background: var(--bad); color: #fff; }

/* ---- Chats: recording a voice note (#95) ----
   With nothing typed the send button is a mic. Held, it goes red and the pill
   becomes the recorder: a dot, the time, the live waveform and "slide to
   cancel", with the lock above the button. Hands-free, the pill has trash and
   the button is a red ■ Done; the review (#115) has the note's player, the
   chips above and Delete and Record more under it, and the button sends. */
.send-btn .ic-mic, .send-btn .ic-done, .send-btn.mic .ic-send, .send-btn.mic.rec-send .ic-mic, .send-btn.mic.rec-done :is(.ic-mic, .ic-send) { display: none; }
.send-btn.mic .ic-mic, .send-btn.mic.rec-send .ic-send, .send-btn.mic.rec-done .ic-done { display: block; }
:root .round-btn.send-btn.rec-done, :root .round-btn.send-btn.rec-done:hover:not(:disabled) { background: #e0443a; color: #fff; }
.send-btn.mic { opacity: 1; }
:root .round-btn.send-btn.rec, :root .round-btn.send-btn.rec:hover:not(:disabled) {
  background: #e0443a; color: #fff; transform: scale(1.25); box-shadow: 0 0 0 10px rgba(224, 68, 58, .18);
  transition: transform .15s ease, box-shadow .15s ease;
}
.send-btn.mic { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.chat-composer[data-rec] .chat-row > .pill-field { display: none; }
.rec-field {
  flex: 1; min-width: 0; height: 44px; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 14px;
  border-radius: 22px; background: var(--field); border: 1px solid var(--line-2); overflow: hidden;
}
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #e0443a; flex: none; animation: rec-blink 1s ease-in-out infinite; }
@keyframes rec-blink { 50% { opacity: .25; } }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 15px; min-width: 34px; }
.rec-wave { flex: 1; min-width: 0; height: 24px; display: flex; align-items: center; justify-content: flex-end; gap: 2px; overflow: hidden; }
.rec-wave i { width: 3px; height: 3px; flex: none; border-radius: 2px; background: var(--accent); transition: height .05s linear; }
.rec-cancel { display: inline-flex; align-items: center; gap: 2px; color: var(--fg-dim); font-size: 13.5px; white-space: nowrap; flex: none; padding-right: 6px; }
.rec-cancel svg { transform: rotate(180deg); }
.rec-trash { color: var(--bad); }
.chat-composer[data-rec="hold"] .rec-trash { display: none; }
/* The review (#112, #115): the bar becomes the note's own player before Send. */
.rec-review { display: none; flex: 1; min-width: 0; }
.chat-composer[data-rec="review"] :is(.rec-trash, .rec-dot, .rec-time, .rec-wave, .rec-cancel) { display: none; }
.chat-composer[data-rec="review"] .rec-review { display: block; }
.rec-review .vn-row { padding: 0; }
.rec-review .vn-play { width: 32px; height: 32px; min-height: 32px; }
.rec-review .vn-body { flex-direction: row; align-items: center; gap: 8px; }
.rec-review .vn-track { flex: 1; min-width: 0; }
.rec-review .vn-meta { flex: none; }
.chat-composer[data-rec="hold"] .rec-field { padding-left: 16px; }
.chat-composer[data-rec="locked"] .rec-cancel { display: none; }
.rec-acts { display: flex; gap: 8px; padding: 0 2px; }
.rec-acts .btn-sm { display: inline-flex; align-items: center; gap: 6px; }
.rec-acts .rec-del { color: var(--bad); }
.rec-lock {
  position: absolute; right: 16px; bottom: 74px; width: 40px; height: 70px; border-radius: 20px; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 11px 0;
  background: var(--field); color: var(--fg-dim); box-shadow: 0 2px 8px rgba(0, 0, 0, .25); border: 1px solid var(--line-2);
}
.rec-lock svg:last-child { transform: rotate(-90deg); animation: rec-nudge 1.2s ease-in-out infinite; }
@keyframes rec-nudge { 50% { translate: 0 -4px; } }
/* What a voice note is (#99): chips above the locked bar, the same choice in
   Contact info, and the More… sheet with the three dials. */
.rec-modes { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 2px; }
.rec-mode {
  display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; color: var(--fg-dim); font-size: 13px; font-weight: 500;
}
.rec-mode:hover:not(:disabled) { transform: none; color: var(--fg); }
:root .rec-mode.on, :root .rec-mode.on:hover:not(:disabled) { background: rgba(167, 139, 250, .16); border-color: rgba(167, 139, 250, .5); color: var(--secret); font-weight: 650; }
.vseg { display: flex; flex-wrap: wrap; gap: 6px; }
.vseg-opt {
  min-height: 32px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2);
  background: transparent; color: var(--fg-dim); font-size: 13.5px;
}
.vseg-opt:hover:not(:disabled) { transform: none; color: var(--fg); }
:root .vseg-opt.on, :root .vseg-opt.on:hover:not(:disabled) { background: rgba(167, 139, 250, .16); border-color: rgba(167, 139, 250, .5); color: var(--secret); font-weight: 650; }
.timing-dial { display: flex; flex-direction: column; gap: 7px; }
.timing-dial b { font-size: 13.5px; }
.timing-summary { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(167, 139, 250, .1); color: var(--fg); font-size: 14px; }
.contact-voice { align-self: stretch; text-align: left; padding: 12px 0 2px; border-top: 1px solid var(--line); }
.contact-voice small { line-height: 1.45; }
/* The voice note bubble (#96): play, a waveform to scrub (a range input lies
   over it), the length or position, and the speed after the first play. */
.bubble.vn { min-width: 230px; width: min(320px, 100%); }
.vn-row { display: flex; align-items: center; gap: 10px; padding: 2px 0; }
.vn-play {
  width: 38px; height: 38px; min-height: 38px; padding: 0; border: 0; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--accent); color: #06101f;
}
:root .vn-play, :root .vn-play:hover:not(:disabled) { background: var(--accent); }
:root .item:not(.mine) .vn-play, :root .item:not(.mine) .vn-play:hover:not(:disabled) { background: var(--good); }
.vn-play:hover:not(:disabled) { filter: brightness(1.08); transform: none; }
.vn-play svg { fill: currentColor; }
.vn-row[data-state="playing"] .vn-play svg { fill: none; }
.vn-row[data-state="loading"] .vn-play { opacity: .6; }
/* Played and unplayed (#102): their note is green until you play it, grey after; a dot
   says not yet. Your own says when it was played. A green mic in the list, too. */
:root .item:not(.mine) .vn-row.played .vn-play, :root .item:not(.mine) .vn-row.played .vn-play:hover:not(:disabled) { background: var(--fg-faint); }
/* The mini player (#103): under the header while the note that is on is out of sight. */
.voice-mini {
  display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-bottom: 1px solid var(--line);
  background: var(--bg-2); flex: none;
}
.voice-mini.hidden { display: none; }
/* Screen recording (#108): the iPhone app says so; the note waits until it stops. */
.capture-note {
  display: flex; align-items: center; gap: 10px; margin: 8px 12px 0; padding: 9px 14px; border-radius: 12px; flex: none;
  background: #182030; color: #fff; font-size: 14px; border: 1px solid var(--line-2); box-shadow: 0 10px 30px -10px rgba(0,0,0,.5);
}
.capture-note.hidden { display: none; }
.capture-ic { display: inline-flex; color: #ff9d6c; }
.vm-play {
  width: 30px; height: 30px; min-height: 30px; padding: 0; border: 0; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--good); color: #06101f;
}
:root .vm-play, :root .vm-play:hover:not(:disabled) { background: var(--good); transform: none; }
.vm-play svg { fill: currentColor; }
.vm-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.vm-what { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.vm-then { font-size: 12px; }
.vm-speed, .vm-x {
  min-height: 28px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent;
  color: var(--fg-dim); font-size: 12.5px; font-weight: 600; flex: none;
}
.vm-speed:hover:not(:disabled), .vm-x:hover:not(:disabled) { transform: none; color: var(--fg); }
.vn-np { width: 8px; height: 8px; border-radius: 50%; background: var(--good); flex: none; }
.vn-played { color: var(--fg-dim); font-size: 12px; }
.pv-mic { display: inline-flex; vertical-align: -2px; margin-right: 3px; color: var(--fg-faint); }
.pv-mic.new { color: var(--good); }
.vn-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.vn-track { position: relative; height: 26px; display: flex; align-items: center; }
.vn-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 24px; overflow: hidden; }
.vn-wave i { flex: 1 1 0; max-width: 3px; min-width: 2px; border-radius: 2px; background: var(--fg-faint); }
.vn-wave i.on { background: var(--accent); }
.item:not(.mine) .vn-wave i.on { background: var(--good); }
.vn-seek {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer;
  -webkit-appearance: none; appearance: none; background: transparent; border: 0; box-shadow: none; touch-action: pan-y;
}
.vn-seek:focus-visible { opacity: .35; outline: 2px solid var(--accent); }
.vn-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.vn-speed {
  min-height: 0; padding: 1px 7px; border: 0; border-radius: 10px; font: 650 11px/1.4 var(--sans);
  background: rgba(127, 127, 127, .16); color: var(--fg-dim);
}
.item.pending { opacity: .7; pointer-events: none; }
/* Once and timed voice notes (#100): the timer under the waveform, the sealed
   card a Once note arrives as, and the line a destroyed note leaves. */
/* On a narrow bubble the timer takes a line of its own rather than being cut. */
.vn-timer { color: var(--secret); font-weight: 600; min-width: 0; }
/* A note in a changed voice (#107): said on both ends. */
.vn-fx { display: inline-flex; align-items: center; gap: 3px; color: var(--secret); font-weight: 600; font-size: 11.5px; }
.vn-sealed .vn-fx { font-size: 12px; }
/* The disguise sheet: four voices, a strength, a listen first. */
.fx-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.fx-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; }
.fx-opt small { font-size: 11px; opacity: .75; font-weight: 400; }
.fx-range { gap: 10px; }
.fx-range input { flex: 1; accent-color: var(--secret); }
.fx-range small { color: var(--fg-dim); }
.fx-listen { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; }
.fx-preview:empty { display: none; }
.fx-pro { background: rgba(167, 139, 250, .16); color: var(--secret); }
@media (max-width: 420px) { .fx-opts { grid-template-columns: repeat(2, 1fr); } }
.vn-meta { min-width: 0; flex-wrap: wrap; row-gap: 1px; }
.vn-seek:disabled { cursor: default; }
.vn-sealed {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 4px 2px 2px 0; border: 0; background: transparent;
  color: inherit; text-align: left; font: inherit;
}
.vn-sealed:hover:not(:disabled) { transform: none; background: transparent; }
:root .vn-sealed, :root .vn-sealed:hover:not(:disabled) { background: transparent; }
.vn-sealed .secret-what { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vn-sealed .secret-what b { font-size: 14.5px; }
.vn-sealed .vn-timer { font-size: 12.5px; }
.bubble.vn-sealed-bubble { min-width: 230px; }
.bubble.vn-gone { font-style: italic; color: var(--fg-dim); }
.vn-gone-line { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
/* Send again (#101): under your own note that is gone, from this device's copy. */
.item.chat .bubble.deleted { flex-wrap: wrap; }
.vn-again-at { display: block; font-size: 12.5px; font-style: normal; color: var(--fg-dim); }
.vn-again {
  display: flex; width: fit-content; align-items: center; gap: 6px; margin-top: 6px; padding: 5px 11px; border-radius: 999px;
  border: 1px solid rgba(167, 139, 250, .5); background: rgba(167, 139, 250, .12); color: var(--secret);
  font: inherit; font-size: 13px; font-style: normal; font-weight: 600;
}
.vn-again:hover:not(:disabled) { transform: none; background: rgba(167, 139, 250, .2); }
.vn-again.off, .vn-again:disabled { border-color: var(--line); background: transparent; color: var(--fg-dim); font-weight: 500; cursor: default; opacity: 1; }
.resend-sheet { width: min(420px, 100%); }
.resend-preview { padding: 8px 10px; border-radius: 14px; background: rgba(127, 127, 127, .1); }

.chat-hint { padding-left: 16px; }
.chat-hint:empty { display: none; }
.secret-bar {
  display: flex; align-items: center; gap: 8px; padding: 5px 5px 5px 11px; border-radius: 14px;
  border: 1px solid rgba(167, 139, 250, .45); background: rgba(167, 139, 250, .1);
}
.secret-tag { font-weight: 700; font-size: 12.5px; color: var(--secret); white-space: nowrap; }
.secret-bar input { padding: 6px 10px; font-size: 13px; min-width: 0; }
.chat-composer[data-kind="secret"] .pill-field { border-color: rgba(167, 139, 250, .6); }

/* The + sheet: round icons in a grid, as on WhatsApp. */
.plus-sheet {
  position: absolute; left: 10px; bottom: calc(100% + 6px); z-index: 30;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 6px; padding: 16px 10px 12px;
  width: min(340px, calc(100% - 20px)); border-radius: 20px; border: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--bg-3), var(--bg-3)), var(--bg); box-shadow: var(--lift), 0 22px 50px -18px rgba(0, 0, 0, .6);
  animation: pop .14s ease-out;
}
.plus-opt {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 2px;
  border-radius: 14px; background: transparent; border: 0; color: var(--fg);
  text-align: center; white-space: normal;
}
.plus-opt:hover:not(:disabled) { transform: none; background: transparent; }
.plus-opt:hover:not(:disabled) .oi { filter: brightness(1.1); }
.plus-opt:focus-visible { outline: none; box-shadow: none; }
.plus-opt:focus-visible .oi { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.plus-opt b { font-size: 12.5px; font-weight: 600; }
.plus-opt small { display: none; }
.oi { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.oi-camera { background: linear-gradient(140deg, #f08a5d, #d9485f); }
.oi-photo { background: linear-gradient(140deg, #f472b6, #c2417f); }
.oi-file { background: linear-gradient(140deg, #5aa9ff, #2f6fd6); }
.oi-secret { background: linear-gradient(140deg, #a78bfa, #6d4fd8); }
.oi-call { background: linear-gradient(140deg, #3ecf8e, #1d8f72); }
.oi-script { background: linear-gradient(140deg, #3ecf8e, #1d8f72); }
.oi-link { background: linear-gradient(140deg, #f5b544, #d98a1c); }
.oi-command { background: linear-gradient(140deg, #ff7a88, #d63c4f); }
/* A device conversation's + has more in it: four across. */
.plus-sheet.five { grid-template-columns: repeat(4, 1fr); width: min(380px, calc(100% - 20px)); }

/* ---- device conversations, laid out like Chats ----
   The chip above the box says what is being written when it is not a plain
   message; its colour follows the kind, as the + sheet's icons do. */
.mode-bar[class] { border-color: var(--mode-line, rgba(167, 139, 250, .45)); background: var(--mode-bg, rgba(167, 139, 250, .1)); }
.mode-bar .secret-tag { color: var(--mode-fg, var(--secret)); }
.chat-composer[data-kind="script"] { --mode-line: rgba(62, 207, 142, .45); --mode-bg: rgba(62, 207, 142, .1); --mode-fg: var(--good); }
.chat-composer[data-kind="link"] { --mode-line: rgba(245, 181, 68, .45); --mode-bg: rgba(245, 181, 68, .1); --mode-fg: var(--warn); }
.chat-composer[data-kind="command"] { --mode-line: rgba(255, 107, 122, .5); --mode-bg: rgba(255, 107, 122, .1); --mode-fg: var(--bad); }
.chat-composer[data-kind="script"] .chat-row textarea,
.chat-composer[data-kind="command"] .chat-row textarea { font: 13px/20px var(--mono); }
.chat-composer[data-kind="script"] .pill-field,
.chat-composer[data-kind="command"] .pill-field { border-radius: 16px; }
.chat-composer[data-kind="command"] .pill-field { border-color: rgba(255, 107, 122, .55); }
/* What a script or a command printed reads as code, even in a bubble. */
.item.chat .bubble.script pre, .item.chat .bubble.job pre { font: 12.5px/1.55 var(--mono); }
.head-name { display: flex; align-items: center; gap: 8px; min-width: 0; }
.head-name .e2e-chip { padding: 1px 7px; font-size: 11px; }
.head-name .e2e-chip svg { width: 11px; height: 11px; }
.main-head .device-av > .dot { position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border: 2.5px solid var(--surface); }
.main-head .device-av > .dot.off { display: none; }
.ws-status { display: inline-flex; align-items: center; gap: 5px; }
.ws-status .dot { width: 7px; height: 7px; }
.menu-btn { font-size: 18px; line-height: 1; padding: 4px 10px; }
.head-menu { width: min(290px, calc(100vw - 24px)); }
.head-menu .extend-opt { flex-direction: column; align-items: flex-start; gap: 2px; white-space: normal; }
.head-menu .extend-opt span { line-height: 1.35; }
.head-menu .menu-theme { flex-direction: row; align-items: center; justify-content: space-between; cursor: default; }
.head-menu .menu-theme:hover { background: transparent; }
.head-menu .menu-theme .seg button { padding: 4px 8px; font-size: 12px; }
.menu-rule { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
.menu-bad b { color: var(--bad); }

/* ---- You ---- */
.you-place { overflow-y: auto; }
.you-wrap { max-width: 560px; margin: 0 auto; padding: 34px 20px 44px; display: flex; flex-direction: column; gap: 18px; }
.you-head { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.you-head .pav.lg { width: 76px; height: 76px; font-size: 26px; margin: 0 0 8px; }
.you-head #me { max-width: 100%; overflow-wrap: anywhere; }
.you-head .row { margin-top: 6px; }
.kind-chip.admin { color: #dcc4ff; border-color: rgba(167, 139, 250, .4); background: rgba(167, 139, 250, .13); }
.you-group { border: 1px solid var(--line); border-radius: 16px; background: var(--glass); overflow: hidden; }
.you-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; width: 100%;
  text-align: left; border: 0; border-radius: 0; background: transparent; color: var(--fg); font-size: 14px;
}
.you-group > .you-row:not(.hidden) ~ .you-row { border-top: 1px solid var(--line); }
.you-what { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.you-what b { font-size: 14px; font-weight: 600; }
.you-what small { font-size: 12px; color: var(--fg-faint); line-height: 1.4; }
.you-cap { margin: 0; padding: 12px 16px 2px; font-size: 12px; font-weight: 600; color: var(--fg-faint); text-transform: uppercase; letter-spacing: .04em; }
.you-link:hover:not(:disabled) { background: rgba(127, 127, 127, .07); transform: none; text-decoration: none; }
.you-go { color: var(--fg-faint); font-size: 22px; line-height: 1; }
.you-row .btn-sm { min-width: 64px; }
.open-link-row { flex-direction: column; align-items: stretch; gap: 10px; }
.open-link-row .btn-sm { align-self: flex-start; }
.you-brand { justify-content: center; opacity: .9; }
.you-signout { align-self: center; min-width: 200px; padding: 10px 20px; }
.you-delete { align-self: center; color: var(--fg-dim); }
kbd { padding: 3px 8px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--bg-3); }

/* ---- a call, minimized: a green bar across the top ---- */
.call-card { position: relative; }
.call-min { position: absolute; top: 10px; left: 10px; padding: 6px; border-radius: 10px; }
.call-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; flex: none;
  background: #12784f; color: #fff; border-bottom: 1px solid rgba(62, 207, 142, .5);
}
.call-bar-back {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 4px 6px;
  background: transparent; border: 0; color: inherit; text-align: left;
}
.call-bar-back:hover:not(:disabled) { background: rgba(255, 255, 255, .08); transform: none; }
.call-bar-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.call-bar-time { font-family: var(--mono); font-size: 12.5px; }
.call-bar-go { font-weight: 750; font-size: 12.5px; flex: none; }
.call-bar-end { width: 34px; height: 34px; min-height: 34px; border-radius: 50%; padding: 0; display: grid; place-items: center; flex: none; background: #e5484d; border-color: #e5484d; color: #fff; }
.call-bar-end:hover:not(:disabled) { background: #d13b40; transform: none; }

@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  /* Tabs along the bottom, out of the way inside a conversation. */
  .shell { flex-direction: column; }
  .appnav {
    order: 2; width: auto; flex-direction: row; justify-content: space-around; gap: 0;
    /* Only part of the home-bar inset: the labels clear it, and the space under them matches the space above. */
    padding: 4px 6px max(4px, calc(env(safe-area-inset-bottom) - 20px)); border-right: 0; border-top: 1px solid var(--line);
    background: linear-gradient(180deg, var(--bg-2), var(--bg-2)), var(--bg);
  }
  .nav-brand, .nav-gap, .nav-admin { display: none; }
  .nav-btn { flex: 1; width: auto; max-width: 120px; padding: 5px 0 3px; border-radius: 12px; }
  .nav-btn[aria-current="page"] { background: transparent; }
  body.in-detail .appnav { display: none; }

  .back-btn { display: inline-flex; }
  .place-title { font-size: 24px; }
  .sidebar-head { padding-top: calc(12px + env(safe-area-inset-top)); }
  .main-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .you-wrap { padding-top: calc(24px + env(safe-area-inset-top)); }
  .call-bar { padding-top: calc(6px + env(safe-area-inset-top)); }
  .call-bar ~ .place .sidebar-head, .call-bar ~ .place .main-head, .call-bar ~ .place .you-wrap { padding-top: 10px; }
  .call-min { top: calc(12px + env(safe-area-inset-top)); left: 12px; }

  .chat-timeline { padding: 12px; }
  .item.chat { max-width: 78%; }
  /* The chat composer is its own row of three; the console composer's grid stays off it. */
  .composer.chat-composer {
    display: flex; flex-direction: column; align-items: stretch; gap: 6px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  }
  .chat-row textarea { font-size: 16px; line-height: 23px; }
  /* With the keyboard up there is no home bar to keep clear of. */
  body.kb-open .composer { padding-bottom: 8px; }
  .chat-hint { display: none; }
  .plus-sheet { left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); width: auto; }
  /* Sideways, the notch is on one side: the app stays clear of it (#164). */
  .shell { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}
/* A phone on its side: bubbles no wider than about two thirds of the long screen. */
@media (max-height: 500px) and (pointer: coarse) and (orientation: landscape) {
  .item.chat { max-width: 70%; }
}

/* Typing on a touch screen means the keyboard is up, whatever the detection says. */
@media (max-width: 760px) and (pointer: coarse), (max-height: 500px) and (pointer: coarse) {
  .composer:focus-within { padding-bottom: 8px; }
}

/* Pop-ups sit in the part of the screen you can see (--app-h, common.js):
   with a phone keyboard up, that is the part above it, not behind it. */
.modal-back { bottom: auto; height: var(--app-h, 100%); }
.modal, #add-modal .modal { max-height: calc(var(--app-h, 100dvh) - 24px); }
body.kb-open .modal-back { place-items: start center; padding: 12px; }

/* iOS zooms the page in whenever a focused field is under 16px. Smaller
   sizes set on a class (the chat search, the secret label) used to win over
   a plain element rule, so this one is last and has to win. */
@media (pointer: coarse) {
  input:not(.code-input), select, textarea, .dev-label-input { font-size: 16px !important; }
}

/* ---- profile photos ---- */
.pav > img, .call-av > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.call-av { position: relative; }
.pav.has-photo, .call-av.has-photo { color: transparent; background: var(--bg-3); }
/* The online dot sits on top of the photo, not under it. */
.pav > i { z-index: 1; }
.pav.xl { width: 88px; height: 88px; font-size: 30px; }
.you-photo { position: relative; padding: 0; border: 0; background: none; border-radius: 50%; margin: 0 0 8px; cursor: pointer; }
.you-photo .pav.lg { margin: 0; }
.you-photo-edit {
  position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; color: var(--fg); background: var(--bg); border: 1px solid var(--line-2);
}
.you-photo:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.profile-photo-row { display: flex; align-items: center; gap: 16px; }
.profile-colors { display: flex; gap: 10px; flex-wrap: wrap; }
.pav.swatch { width: 34px; height: 34px; min-height: 34px; flex: none; border: 0; padding: 0; cursor: pointer; }
.pav.swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.jend { justify-content: flex-end; }

/* Admin sits in the app's shell: the rail stays put, the page scrolls. */
.admin-main { display: block; overflow-y: auto; }
.admin-main > .topbar { background: linear-gradient(180deg, rgba(255, 255, 255, .05), transparent), var(--bg); }

/* Sign-in on a chat-only site (data-mode="chat", set by the server). */
body:not([data-mode="chat"]) .chat-only,
body[data-mode="chat"] .full-only { display: none !important; }
.device-help summary { cursor: pointer; }
.device-help p { margin-top: 6px; line-height: 1.5; }

/* ---- other ways to sign in (chat sites) ----
   Each company's button follows its own guidelines: Apple's is black with a
   white mark, Microsoft's and Facebook's are white with their coloured marks. */
.gbtn { text-decoration: none; box-shadow: inset 0 0 0 1px rgba(10, 20, 45, .14); }
.gbtn:hover { text-decoration: none; }
.gbtn-apple { background: #000; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
.gbtn-apple:hover { background: #1a1a1a; }
.or-rule { display: flex; align-items: center; gap: 10px; color: var(--fg-faint); font-size: 12px; margin-top: 4px; }
.or-rule::before, .or-rule::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.email-link-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.email-link-row .btn-sm { white-space: nowrap; }
/* A grid item grows to its widest content unless told otherwise; the email
   row on the sign-in card was pushing the card past a phone's edge. */
.center-page { grid-template-columns: minmax(0, 1fr); }
.center-card { min-width: 0; }

/* ---- Midnight: solid layers ----
   Every colour here comes from the tokens at the top, so light keeps its own
   look (its tokens reproduce it) and dark gets the Midnight layers. */
.appnav, .sidebar, .main-head, .composer, .admin-main > .topbar { background: var(--surface); }
.timeline { background: var(--bg); }
input, select, textarea { background: var(--field); }
button { background: var(--raised); }
.modal, .palette, .extend-menu { background: var(--sheet); }
.bubble { background: var(--bubble-them); border-color: var(--bubble-them-line); box-shadow: none; }
.item.mine .bubble { border-color: rgba(var(--accent-rgb), .3); }

/* In a chat, your own messages are solid blue with white text, so yours and
   theirs are told apart at a glance rather than by a faint tint. */
.item.chat.mine .bubble:not(.secret) { background: var(--bubble-mine); border-color: var(--bubble-mine-line); color: var(--bubble-mine-fg); }
.item.chat.mine .bubble:not(.secret) pre,
.item.chat.mine .bubble:not(.secret) .md { color: var(--bubble-mine-fg); }
.item.chat.mine .bubble:not(.secret) a { color: var(--bubble-mine-fg); text-decoration: underline; }
.item.chat.mine .bubble:not(.secret) .bubble-foot,
.item.chat.mine .bubble:not(.secret) .bubble-title,
.item.chat.mine .bubble:not(.secret) .ticks.read { color: var(--bubble-mine-fg); }
.item.chat.mine .bubble:not(.secret) .btn-sm { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .28); color: var(--bubble-mine-fg); }
/* Sealed secrets keep their violet edge, so they never look like a message. */
.item.chat .bubble.secret { background: rgba(167, 139, 250, .12); border: 1px solid rgba(167, 139, 250, .38); }
.theme-choice { display: flex; }
#profile-theme .theme-choice button { flex: 1; }
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) { .you-row #theme-slot .theme-choice button { padding: 7px 9px; } }

/* ---- Conversations, WhatsApp-style (chats, the console, the device page) ----
   A wallpaper (dots on dark, one plain tone on light); 10px bubbles with a soft shadow and a tail on the first
   of a run; the time tucked into the last line; date pills and an amber
   privacy chip. Runs are worked out by CSS alone, so live messages join them. */
.chat-timeline {
  gap: 2px; background-color: var(--wall);
  background-image: var(--wall-image);
  background-size: var(--wall-size);
  scrollbar-color: var(--line-2) transparent;
}
.chat-timeline .item.chat { position: relative; align-self: flex-start; align-items: flex-start; }
.chat-timeline .item.chat.mine { align-self: flex-end; align-items: flex-end; }
.item.chat .bubble {
  border-radius: 10px; border-color: transparent; box-shadow: var(--bubble-shadow); padding: 6px 9px 5px 10px;
}
.item.chat .bubble pre, .item.chat .bubble .md { font-size: 15px; line-height: 1.38; }
.item.chat.menu-on .bubble { box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .55), var(--bubble-shadow); }
.item.chat.selectable:focus-visible .bubble { box-shadow: 0 0 0 2px var(--accent); }

/* A new speaker starts a run: a little more air, a square corner and a tail. */
.item.chat:not(.mine) + .item.chat.mine,
.item.chat.mine + .item.chat:not(.mine) { margin-top: 6px; }
.item.chat::before {
  content: ""; position: absolute; top: 0; width: 0; height: 0; border-style: solid;
  left: -8px; border-width: 0 9px 11px 0; border-color: transparent var(--bubble-them) transparent transparent;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .12));
}
.item.chat.mine::before { left: auto; right: -8px; border-width: 0 0 11px 9px; border-color: transparent transparent transparent var(--bubble-mine); }
.item.chat:not(.mine) > .bubble { border-top-left-radius: 2px; }
.item.chat.mine > .bubble { border-top-right-radius: 2px; }
.item.chat:not(.mine) + .item.chat:not(.mine)::before,
.item.chat.mine + .item.chat.mine::before,
.item.chat:has(> .bubble.secret)::before { display: none; }
.item.chat:not(.mine) + .item.chat:not(.mine) > .bubble,
.item.chat.mine + .item.chat.mine > .bubble { border-radius: 10px; }

/* The time and ticks sit on the last line when it has room (items.js). */
.bubble.tucked { position: relative; }
/* A file's caption (#158): under the photo or the card, as wide as they are. */
.file-caption { margin: 4px 0 0; padding: 0 2px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.bubble.photo.captioned .file-caption { width: 0; min-width: 100%; box-sizing: border-box; padding: 2px 6px 2px; }
.item.chat .bubble.photo.captioned > .bubble-foot { right: 9px; bottom: 4px; padding: 0; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--fg-faint) !important; }
.item.chat .bubble.photo.captioned .bubble-foot .ticks { color: inherit !important; }
.item.chat .bubble.photo.captioned .bubble-foot .ticks.read { color: var(--accent) !important; }
.bubble.tucked .foot-gap { display: inline-block; width: 52px; height: 1px; }
.item.mine .bubble.tucked .foot-gap { width: 72px; }
.bubble.tucked > .bubble-foot { position: absolute; right: 9px; bottom: 4px; margin: 0; }
.bubble-foot { font-size: 11px; }
.item.chat .ticks.read,
.item.chat.mine .bubble:not(.secret) .ticks.read { color: var(--tick-read); }

.chat-timeline .day-divider {
  align-self: center; margin: 10px 0 6px; padding: 5px 12px; border-radius: 9px;
  font: 650 12px var(--sans); letter-spacing: .02em; color: var(--fg-dim);
  background: var(--pill); box-shadow: var(--bubble-shadow);
}
.chat-timeline .day-divider::before, .chat-timeline .day-divider::after { display: none; }
.chat-timeline .friends-since {
  display: flex; align-items: center; justify-content: center; gap: 5px; border: 0; border-radius: 9px;
  padding: 7px 12px; font-size: 12.5px; color: var(--notice-fg); background: var(--notice); box-shadow: var(--bubble-shadow);
}
.chat-timeline .friends-since svg { flex: none; }
.chat-timeline .call-item { align-self: center; margin: 6px 0; }

/* ---- Secrets in a conversation ----
   Sealed: what opening costs, and the two ways to open it. Open: the value in
   a password-style box with the eye and Copy at its edge. Hidden: dots.
   Spent: an ordinary bubble with a grey label - a record, not a secret. */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.item.chat .secret-lbl { display: flex; align-items: center; gap: 6px; color: var(--secret); font-size: 12.5px; font-weight: 650; }
.item.chat .bubble.secret.gone { background: var(--bubble-them); border-color: transparent; }
.item.chat.mine .bubble.secret.gone { background: var(--bubble-mine); color: var(--bubble-mine-fg); }
.item.chat .bubble.gone .secret-lbl { color: var(--fg-faint); }
.item.chat.mine .bubble.gone .secret-lbl, .item.chat.mine .bubble.gone .secret-sub { color: var(--bubble-mine-dim); }
.secret-sub { font-size: 13px; color: var(--fg-dim); margin-top: 2px; }
.secret-sub.warn { color: var(--notice-fg); }
.item.chat .bubble.secret .item-actions.keep { margin-top: 8px; }
.item.chat .bubble.secret .item-actions.keep .btn-sm { display: inline-flex; align-items: center; gap: 6px; }
.sv {
  display: flex; align-items: center; gap: 6px; margin: 4px 0 4px; padding: 6px 6px 6px 12px; border-radius: 9px;
  background: rgba(0, 0, 0, .32); min-width: 220px;
}
.sv .secret-body { flex: 1; min-width: 0; }
.item.chat .sv pre { font: 15px/1.4 var(--mono); color: var(--fg); letter-spacing: .02em; white-space: pre-wrap; word-break: break-all; max-height: 200px; }
.sv-dots { flex: 1; color: var(--secret); font: 15px var(--mono); letter-spacing: .14em; overflow: hidden; white-space: nowrap; }
.sv-btn {
  position: relative; width: 34px; height: 34px; padding: 0; border-radius: 8px; flex: none; border: 0;
  display: grid; place-items: center; color: var(--fg); background: rgba(255, 255, 255, .08);
}
.sv-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .16); transform: none; }
:root[data-theme="light"] .sv { background: rgba(10, 20, 45, .06); }
:root[data-theme="light"] .sv-btn { background: rgba(10, 20, 45, .07); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .sv { background: rgba(10, 20, 45, .06); }
  :root:not([data-theme="dark"]) .sv-btn { background: rgba(10, 20, 45, .07); }
}

/* ---- Call screens, WhatsApp-style ----
   The person large and round (a device square), rings while it rings, a glow
   once connected, a green encrypted chip, the safety code as a small pill and
   the mic warning as one line. A phone gives the call the whole screen. */
.call-card {
  background: radial-gradient(120% 70% at 50% 0%, rgba(var(--accent-rgb), .28), transparent 60%),
    radial-gradient(90% 60% at 50% 100%, rgba(167, 139, 250, .22), transparent 60%), var(--bg);
}
.call-sheet[data-state="active"] .call-card { border-color: var(--line-2); }
.call-av {
  width: 76px; height: 76px; border-radius: 50%; margin: 14px 0 12px; font: 750 26px var(--sans); color: #fff;
  box-shadow: none; animation: none;
}
.call-av.sq { border-radius: 24px; color: #0a1020; }
.call-av.c1 { background: linear-gradient(140deg, #f08a5d, #d9485f); }
.call-av.c2 { background: linear-gradient(140deg, #3ecf8e, #1d8f72); }
.call-av.c3 { background: linear-gradient(140deg, #a78bfa, #6d4fd8); }
.call-av.c4 { background: linear-gradient(140deg, #f5b544, #d98a1c); }
.call-av.c5 { background: linear-gradient(140deg, #5aa9ff, #2f6fd6); }
.call-av.c6 { background: linear-gradient(140deg, #f472b6, #c2417f); }
.call-av::before, .call-av::after {
  content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 1.5px solid rgba(var(--accent-rgb), .35);
  pointer-events: none; opacity: 0;
}
.call-av::after { inset: -20px; border-color: rgba(var(--accent-rgb), .16); }
.call-av.sq::before { border-radius: 32px; }
.call-av.sq::after { border-radius: 40px; }
.call-sheet[data-state="incoming"] .call-av, .call-sheet[data-state="outgoing"] .call-av { animation: none; }
.call-sheet[data-state="incoming"] .call-av::before, .call-sheet[data-state="incoming"] .call-av::after,
.call-sheet[data-state="outgoing"] .call-av::before, .call-sheet[data-state="outgoing"] .call-av::after { animation: call-ring 2s ease-out infinite; }
.call-sheet[data-state="incoming"] .call-av::after, .call-sheet[data-state="outgoing"] .call-av::after { animation-delay: .5s; }
@keyframes call-ring {
  0% { opacity: 0; transform: scale(.9); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.12); }
}
/* Connected: the rings settle into a glow. */
.call-sheet[data-state="active"] .call-av { box-shadow: 0 0 0 8px rgba(var(--accent-rgb), .1), 0 0 44px 4px rgba(var(--accent-rgb), .35); }
.call-name { font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
.call-sheet[data-state="active"] .call-status { font: 500 16px var(--mono); }
.call-lock {
  margin-top: 10px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--good); background: rgba(62, 207, 142, .12);
}
.call-lock .call-trouble { font-weight: 600; }
.call-lock:has(.call-trouble) { background: rgba(255, 182, 72, .12); color: var(--warn); border-radius: 12px; padding: 7px 12px; max-width: 300px; }
.call-bg-note span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-sas {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; padding: 5px 14px 5px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(0, 0, 0, .3);
}
.call-sas small { font: 650 10.5px var(--sans); letter-spacing: .04em; color: var(--accent); }
.call-sas-code { font: 650 16px var(--mono); letter-spacing: .12em; }
.call-bg-note {
  align-items: center; max-width: none; margin: 14px 0 0; padding: 8px 12px; border: 0; border-radius: 10px;
  background: rgba(255, 182, 72, .1); color: var(--notice-fg); font-size: 12.5px; line-height: 1.35;
}
.call-bg-note svg { margin-top: 0; }
.call-round { width: 60px; height: 60px; min-height: 60px; border: 0; background: rgba(255, 255, 255, .1); }
.call-round.call-end { background: #ff5a6b; }
.call-round.call-ok { background: var(--good); color: #05140c; }
.call-sheet[data-state="incoming"] .call-round.call-ok { animation: call-answer 1.6s ease-in-out infinite; }
@keyframes call-answer {
  0%, 100% { box-shadow: 0 0 0 0 rgba(62, 207, 142, .35), 0 0 0 0 rgba(62, 207, 142, .15); }
  50% { box-shadow: 0 0 0 10px rgba(62, 207, 142, .18), 0 0 0 22px rgba(62, 207, 142, .08); }
}
/* The call buttons keep their colours in both themes (#128): the light theme's
   rule for every button outranks a two-class selector, so these carry :root. */
:root .call-round.call-end, :root .call-round.call-end:hover:not(:disabled) { background: #ff5a6b; color: #fff; }
:root .call-round.call-ok, :root .call-round.call-ok:hover:not(:disabled) { background: var(--good); color: #05140c; }
:root .call-round.call-on, :root .call-round.call-on:hover:not(:disabled) { background: var(--fg); color: var(--bg); }
/* Light: the plain ones are white discs with an edge, as on a phone's call screen. */
:root[data-theme="light"] .call-round:not(.call-end):not(.call-ok):not(.call-on) { background: #fff; color: #0d1526; box-shadow: 0 0 0 1px rgba(10, 20, 45, .1), 0 4px 14px -6px rgba(10, 20, 45, .35); }
:root[data-theme="light"] .call-act span { color: #2c3850; }
:root[data-theme="light"] .call-round.call-end { background: #e5484d; }
:root[data-theme="light"] .call-sas { background: rgba(255, 255, 255, .85); }
:root[data-theme="light"] .call-sas small, :root[data-theme="light"] .sas-compare { color: #2459b8; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .call-round:not(.call-end):not(.call-ok):not(.call-on) { background: #fff; color: #0d1526; box-shadow: 0 0 0 1px rgba(10, 20, 45, .1), 0 4px 14px -6px rgba(10, 20, 45, .35); }
  :root:not([data-theme="dark"]) .call-act span { color: #2c3850; }
  :root:not([data-theme="dark"]) .call-round.call-end { background: #e5484d; }
  :root:not([data-theme="dark"]) .call-sas { background: rgba(255, 255, 255, .85); }
  :root:not([data-theme="dark"]) .call-sas small, :root:not([data-theme="dark"]) .sas-compare { color: #2459b8; }
}
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .call-card { justify-content: flex-start; }
  .call-who { flex: 1; }
  .call-av { width: 124px; height: 124px; margin: 40px 0 22px; font-size: 42px; }
  .call-av.sq { border-radius: 34px; }
  .call-av::before { inset: -14px; }
  .call-av::after { inset: -30px; }
  .call-av.sq::before { border-radius: 44px; }
  .call-av.sq::after { border-radius: 56px; }
  .call-name { font-size: 28px; }
  .call-sheet[data-state="active"] .call-status { font-size: 18px; }
  /* The warning sits just above the buttons, as one line. */
  .call-bg-note { margin-top: auto; margin-bottom: 18px; }
  .call-round { width: 68px; height: 68px; min-height: 68px; }
}

/* ---- You, WhatsApp-style ----
   Your card on top; settings in four groups, each row with a coloured icon;
   switches for what is on or off; the version at the foot. */
.you-wrap { gap: 14px; padding-top: 22px; }
.you-title { margin-bottom: 2px; }
.you-card { display: flex; align-items: center; gap: 14px; padding: 4px 4px 8px; }
.you-card .you-photo { margin: 0; flex: none; }
.you-card .pav.lg { width: 68px; height: 68px; font-size: 22px; }
.you-photo-edit { width: 24px; height: 24px; color: #06101f; background: var(--accent); border: 2px solid var(--bg); }
.you-who {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 4px 6px; border: 0; border-radius: 12px; background: transparent; color: var(--fg); text-align: left;
}
.you-who:hover:not(:disabled) { background: rgba(127, 127, 127, .07); transform: none; }
.you-who b { font-size: 19px; font-weight: 700; max-width: 100%; }
.you-who #me { font-size: 13px; color: var(--fg-dim); font-weight: 400; max-width: 100%; }
.you-who .row { margin-top: 3px; }
.you-who .you-handle { font-size: 13.5px; color: var(--fg); font-weight: 600; max-width: 100%; }
.you-who .you-nudge { font-size: 12.5px; color: var(--accent); font-weight: 600; margin-top: 2px; }
.you-group { background: var(--surface); border-radius: 14px; }
.you-row { padding: 10px 14px 10px 12px; }
.yi { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none; color: #fff; }
.yi-blue { background: linear-gradient(140deg, #5aa9ff, #2f6fd6); }
.yi-violet { background: linear-gradient(140deg, #a78bfa, #6d4fd8); }
.yi-green { background: linear-gradient(140deg, #3ecf8e, #1d8f72); }
.yi-amber { background: linear-gradient(140deg, #f5b544, #d98a1c); }
.yi-pink { background: linear-gradient(140deg, #f472b6, #c2417f); }
.yi-grey { background: #4a5670; }
.yi-red { background: linear-gradient(140deg, #ff7a88, #d63c4f); }
.you-what b { font-size: 15px; font-weight: 550; }
.you-what small { font-weight: 400; }
/* On a phone the theme picker takes its own line under the words. */
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .you-row:has(#theme-slot) { flex-wrap: wrap; }
  .you-row #theme-slot { flex-basis: 100%; padding-left: 44px; }
  .you-row #theme-slot .theme-choice { width: 100%; }
  .you-row #theme-slot .theme-choice button { flex: 1; }
}
.you-danger .you-what b { color: #ff7a88; }
.open-link-row { padding-left: 56px; }
.you-session { white-space: normal; }
.ws-inline { display: inline-flex; align-items: center; gap: 5px; vertical-align: -1px; }
.you-session .countdown { font-size: 11.5px; }
.you-version { margin: 0; text-align: center; font-size: 11.5px; color: var(--fg-faint); }

/* Switches: the same buttons as before (aria-pressed says on or off), drawn
   as a switch. Notifications that need something first keep their words. */
.you-row button.switch.switch {
  position: relative; flex: none; width: 46px; min-width: 46px; height: 28px; min-height: 28px; padding: 0;
  border: 0; border-radius: 14px; font-size: 0; color: transparent; background: rgba(127, 127, 127, .32); box-shadow: none;
  transition: background .15s ease;
}
.you-row button.switch.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: left .15s ease;
}
.you-row button.switch.switch[aria-pressed="true"] { background: var(--good); }
.you-row button.switch.switch[aria-pressed="true"]::after { left: 21px; }
.you-row button.switch.switch:hover:not(:disabled) { transform: none; filter: brightness(1.08); }
.you-row button.switch.switch[data-state="blocked"], .you-row button.switch.switch[data-state="install"] {
  width: auto; min-width: 64px; height: auto; padding: 6px 12px; border-radius: 10px; font-size: 12.5px; color: var(--fg);
  background: var(--raised);
}
.you-row button.switch.switch[data-state="blocked"]::after, .you-row button.switch.switch[data-state="install"]::after { display: none; }
:root[data-theme="light"] .you-group { background: #fff; }
:root[data-theme="light"] .you-row.you-link, :root[data-theme="light"] .you-who, :root[data-theme="light"] .you-photo { background: transparent; }
:root[data-theme="light"] .you-row.you-link:hover:not(:disabled), :root[data-theme="light"] .you-who:hover:not(:disabled) { background: rgba(10, 20, 45, .04); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .you-group { background: #fff; }
  :root:not([data-theme="dark"]) .you-row.you-link, :root:not([data-theme="dark"]) .you-who, :root:not([data-theme="dark"]) .you-photo { background: transparent; }
  :root:not([data-theme="dark"]) .you-row.you-link:hover:not(:disabled), :root:not([data-theme="dark"]) .you-who:hover:not(:disabled) { background: rgba(10, 20, 45, .04); }
}

/* ---- acting on a message (msgmenu.js) ----
   Press and hold on a phone: the bubble lifts out of a dimmed timeline and a
   sheet comes up. On a computer a ⌄ shows on hover and opens a menu in place. */
.bubble { position: relative; }
.item-more {
  position: absolute; top: 3px; right: 3px; z-index: 2; width: 26px; height: 22px; padding: 0;
  display: none; place-items: center; border: 0; border-radius: 0 8px 0 12px; color: var(--fg-dim);
  background: radial-gradient(circle at 70% 30%, var(--bubble-them) 55%, transparent 80%);
}
.item.mine .item-more { background: radial-gradient(circle at 70% 30%, var(--bubble-mine) 55%, transparent 80%); }
.item-more:hover:not(:disabled) { transform: none; color: var(--fg); }
@media (hover: hover) and (pointer: fine) {
  .item.selectable:hover .item-more, .item.menu-on .item-more { display: grid; }
}
/* A finger held on a bubble is a request for the menu, not for the page's own text selection. */
@media (hover: none), (pointer: coarse) {
  .item.selectable, .item.selectable .bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .item.selectable.pressing .bubble { transform: scale(.98); transition: transform .3s ease; }
}

.mm-layer { position: fixed; inset: 0; z-index: 400; }
.mm-back { position: absolute; inset: 0; }
.mm-layer.sheet .mm-back { background: rgba(4, 8, 16, .55); }
.mm-lift { position: static; }
.mm-ghost { position: fixed; margin: 0; pointer-events: none; box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .6), 0 16px 34px -12px rgba(0, 0, 0, .8) !important; transition: top .18s ease-out; }
.mm {
  position: fixed; min-width: 220px; max-width: min(340px, calc(100vw - 16px)); max-height: calc(100dvh - 16px); overflow: auto;
  border-radius: 14px; border: 1px solid var(--line-2); background: var(--sheet); color: var(--fg);
  box-shadow: var(--lift), 0 22px 50px -18px rgba(0, 0, 0, .7); animation: pop .12s ease-out;
}
/* Placed next to the held message by msgmenu.js. Nothing in the layer can be
   selected: on iOS the same hold would otherwise start a text selection. */
.mm-layer.sheet .mm { max-width: none; border-radius: 18px; }
.mm-layer, .mm-layer * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.mm-details dd { -webkit-user-select: text; user-select: text; }
.mm-head {
  display: flex; justify-content: space-between; gap: 12px; padding: 10px 14px 8px; border-bottom: 1px solid var(--line);
  font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--fg-faint);
}
.mm-head span + span { letter-spacing: 0; text-transform: none; font: 500 11.5px var(--mono); }
.mm-item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 11px 16px; min-height: 46px;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--fg);
  font-size: 15px; font-weight: 550; text-align: left;
}
.mm-item:last-child { border-bottom: 0; }
.mm-item svg { color: var(--fg-dim); flex: none; }
.mm-item:hover:not(:disabled), .mm-item:focus-visible { transform: none; background: rgba(var(--accent-rgb), .1); outline: none; box-shadow: none; }
.mm-item.bad, .mm-item.bad svg { color: var(--bad); }
.mm-label { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mm-label small { font: 11.5px var(--mono); font-weight: 400; color: var(--fg-faint); }
.mm-layer.pop .mm-item { padding: 8px 14px; min-height: 38px; font-size: 14px; }
.mm-layer.pop .mm-label small { display: none; }
.mm-details { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; padding: 4px 16px 12px 50px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.mm-details dt { color: var(--fg-faint); }
.mm-details dd { margin: 0; font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .mm-item, :root:not([data-theme="dark"]) .item-more { background-color: transparent; }
  :root:not([data-theme="dark"]) .mm { background: #fff; }
  :root:not([data-theme="dark"]) .mm-layer.sheet .mm-back { background: rgba(10, 20, 40, .35); }
}
:root[data-theme="light"] .mm-item, :root[data-theme="light"] .item-more { background-color: transparent; }
:root[data-theme="light"] .mm { background: #fff; }
:root[data-theme="light"] .mm-layer.sheet .mm-back { background: rgba(10, 20, 40, .35); }
.mm-lift::before { display: none; }

/* ---- Chats: search, filters and the + menu ----
   On a computer the search field sits under the title. On a phone it waits
   until the list is pulled down or the magnifier is tapped (chats.js). */
.search-bar { display: flex; align-items: center; gap: 10px; }
.search-field {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  border-radius: 10px; background: var(--field); border: 1px solid var(--line-2);
}
.search-field:focus-within { border-color: rgba(var(--accent-rgb), .6); }
.search-field input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 0; font-size: 13.5px; box-shadow: none; outline: none; }
.search-ic { display: grid; color: var(--fg-faint); }
.search-cancel { display: none; border: 0; background: transparent; color: var(--accent); font-weight: 600; padding: 6px 0; }
.search-cancel:hover:not(:disabled) { transform: none; background: transparent; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chips .chip {
  padding: 5px 12px; border-radius: 999px; border: 0; font-size: 12.5px; font-weight: 600;
  background: var(--bg-3); color: var(--fg-dim);
}
.filter-chips .chip:hover:not(:disabled) { transform: none; color: var(--fg); }
.filter-chips .chip[aria-pressed="true"] { background: rgba(62, 207, 142, .16); color: var(--good); }
.device-name .hl { color: var(--accent); }
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .chats-place:not(.searching) #chat-search-bar, .chats-place:not(.searching) #chat-filters { display: none; }
  .chats-place.searching .search-cancel { display: block; }
  .chats-place.searching #chat-find { color: var(--accent); }
  .search-field input { font-size: 16px; } /* iOS zooms into anything smaller */
}

.hmenu { width: 240px; }
.hmenu .extend-opt { align-items: center; justify-content: flex-start; gap: 11px; font-size: 14px; white-space: nowrap; }
.hmenu .extend-opt b { font-weight: 550; }
.hmenu .extend-opt small { margin-left: auto; }
.hm-ic { display: grid; color: var(--fg-dim); }

/* "Get notified" is a one-time banner over the list. */
.notify-card { flex-direction: row; align-items: center; gap: 10px; margin-top: 0; padding: 9px 10px 9px 12px; }
.notify-card p { line-height: 1.35; }
.notify-ic { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; color: #06101f; background: linear-gradient(140deg, var(--accent), #a78bfa); }
.notify-x { padding: 5px; color: var(--fg-faint); }
/* "Reserve your handle": the same card, and only when "Get notified" isn't up. */
#notify-card:not(.hidden) ~ .handle-card { display: none; }
.handle-ic { font-size: 18px; font-weight: 800; }
.handle-go { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; padding: 0; border: 0; background: transparent !important; text-align: left; white-space: normal; color: var(--fg); }
.handle-go:hover:not(:disabled) { transform: none; }
.handle-go b { font-size: 13.5px; }
.handle-go small { font-size: 12.5px; font-weight: 400; color: var(--fg-dim); line-height: 1.35; }

#newchat-list { gap: 0; max-height: min(60vh, 420px); overflow: auto; margin: 0 -8px; }
#newchat-list > .btn-primary { margin: 8px; }
.scan-video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; background: #000; }
:root[data-theme="light"] .search-cancel, :root[data-theme="light"] .notify-x { background: transparent; }
:root[data-theme="light"] .filter-chips .chip { background: rgba(10, 20, 45, .06); }
:root[data-theme="light"] .filter-chips .chip[aria-pressed="true"] { background: rgba(30, 160, 100, .14); color: #137a4b; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .search-cancel, :root:not([data-theme="dark"]) .notify-x { background: transparent; }
  :root:not([data-theme="dark"]) .filter-chips .chip { background: rgba(10, 20, 45, .06); }
  :root:not([data-theme="dark"]) .filter-chips .chip[aria-pressed="true"] { background: rgba(30, 160, 100, .14); color: #137a4b; }
}

/* ---- a call folded away (call.js) ----
   On a computer: a small card bottom-right that can be dragged. On a phone:
   the green bar across the top, "tap to return", with the timer. */
.call-sheet.mini { top: auto; right: 24px; bottom: 104px; width: 232px; animation: pop .16s ease-out; cursor: grab; touch-action: none; }
.call-sheet.mini.dragging { cursor: grabbing; }
.call-sheet.mini .call-card { padding: 14px 12px 12px; gap: 12px; }
.call-sheet.mini .call-av { width: 52px; height: 52px; margin: 2px 0 6px; font-size: 18px; }
.call-sheet.mini .call-av::before, .call-sheet.mini .call-av::after { display: none; }
.call-sheet.mini .call-name { font-size: 15px; }
.call-sheet.mini[data-state="active"] .call-status { font-size: 14px; }
.call-sheet.mini .call-lock, .call-sheet.mini .call-bg-note { display: none; }
.call-sheet.mini .call-sas { margin-top: 6px; }
.call-sheet.mini .call-acts { gap: 22px; }
.call-sheet.mini .call-round { width: 46px; height: 46px; min-height: 46px; }
.call-sheet.mini .call-act span { font-size: 11px; }
.call-sheet.mini .call-min svg { transform: rotate(180deg); }
.call-sheet.mini .call-card::before {
  content: ""; position: absolute; top: 6px; left: 50%; width: 34px; height: 4px; margin-left: -17px;
  border-radius: 99px; background: var(--line-2);
}
.call-bar-back { gap: 8px; }
.call-bar-text b { font-weight: 700; }
.call-bar-go { font-weight: 500; opacity: .8; }
.call-bar-time { margin-left: auto; font: 650 13px var(--mono); flex: none; }

/* Call ended: the length, then Call again or Back to chat. */
.call-ended { display: flex; flex-direction: column; align-items: stretch; gap: 10px; width: min(280px, 100%); margin: 0 auto; }
.call-pill { padding: 12px 22px; border-radius: 999px; font-size: 15px; font-weight: 650; }
.call-pill:not(.btn-primary) { background: rgba(255, 255, 255, .1); border: 0; color: var(--fg); }
.call-sheet[data-state="ended"] .call-av { opacity: .85; }
.call-sheet[data-state="ended"] .call-status { font-size: 15px; color: var(--fg-dim); }
.call-sheet[data-state="ended"] .call-lock { color: var(--fg-faint); background: rgba(255, 255, 255, .06); }
:root[data-theme="light"] .call-pill:not(.btn-primary) { background: rgba(10, 20, 45, .08); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .call-pill:not(.btn-primary) { background: rgba(10, 20, 45, .08); }
}
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .call-acts:has(.call-act:nth-child(3)) { gap: 30px; }
  .call-ended { margin-bottom: 10px; }
}

/* ---- Profile as its own screen; your QR; the blocked list ----
   On a phone the profile takes the screen, with Back and Save in its header;
   on a computer it is a panel. */
.screen { padding: 0; gap: 0; width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); overflow: hidden; }
.screen-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.screen-head strong { font-size: 16px; }
.screen-close { padding: 6px; }
.screen-body { padding: 20px 18px 22px; overflow: auto; }
.profile-photo { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.profile-av-wrap { position: relative; }
.profile-av-wrap .pav.xl { width: 112px; height: 112px; font-size: 38px; }
.profile-cam {
  position: absolute; right: 2px; bottom: 2px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: #06101f; border: 3px solid var(--bg); cursor: pointer;
}
.link-btn { border: 0; background: transparent; padding: 4px 2px; color: var(--accent); font-weight: 650; font-size: 14px; }
.link-btn:hover:not(:disabled) { transform: none; background: transparent; text-decoration: underline; }
.link-btn.faint { color: var(--fg-faint); }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld > span, .fld > label { font-size: 12px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-faint); }
/* @handle: the @ sits inside the field; green when free, red when not. */
.handle-in { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; background: var(--field); }
.handle-in:focus-within { outline: 2px solid var(--accent-dim); outline-offset: 1px; }
.handle-in .at { padding: 0 2px 0 12px; color: var(--fg-faint); font-weight: 600; }
.handle-in input { flex: 1; min-width: 0; border: 0; background: transparent; padding-left: 2px; outline: none; }
.handle-in input:read-only { color: var(--fg-dim); }
.handle-in.ok { border-color: var(--good); }
.handle-in.bad { border-color: var(--bad); }
.fld small.handle-msg.good { color: var(--good); }
.fld small.handle-msg.bad { color: var(--bad); }
.handle-sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.handle-sugg:empty { display: none; }
.handle-idea { padding: 5px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--accent); background: rgba(var(--accent-rgb), .1) !important; border-color: rgba(var(--accent-rgb), .3); }
.fld small { font-size: 12px; color: var(--fg-faint); line-height: 1.4; }
.ro-field { padding: 9px 12px; border-radius: 10px; border: 1px dashed var(--line-2); color: var(--fg-dim); font-size: 13.5px; overflow-wrap: anywhere; }
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .screen-back { padding: 0; place-items: stretch; }
  .screen { width: 100%; max-height: none; height: 100%; border-radius: 0; border: 0; }
  .screen-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .screen-body { flex: 1; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}

.you-card .you-qr { margin-left: auto; flex: none; color: var(--accent); }
.qr-box { width: min(360px, calc(100vw - 24px)); }
.qr-img { width: 100%; max-width: 260px; height: auto; aspect-ratio: 1; align-self: center; border-radius: 14px; background: #fff; padding: 8px; }
.qr-img:not([src]) { visibility: hidden; }

.blocked-row { display: flex; align-items: center; gap: 11px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.blocked-row:last-child { border-bottom: 0; }
.blocked-row .pav { width: 38px; height: 38px; font-size: 13px; flex: none; }

/* Your last message in the list carries its ticks. */
.chat-preview .ticks { margin-right: 4px; font-size: 12px; color: var(--fg-faint); }
.chat-preview .ticks.read { color: var(--accent); }
:root[data-theme="light"] .link-btn { background: transparent; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .link-btn { background: transparent; } }

/* ---- pin, mute, archive, select (#30) ---- */
.extend-menu.left { left: 0; right: auto; }
.hmenu .extend-opt.sep { margin-top: 5px; position: relative; }
.hmenu .extend-opt.sep::before { content: ""; position: absolute; left: 8px; right: 8px; top: -4px; border-top: 1px solid var(--line); }
.hmenu .extend-opt.bad, .hmenu .extend-opt.bad .hm-ic { color: var(--bad); }
.hmenu .extend-opt:disabled { opacity: .45; }
.hmenu .extend-opt small.truncate { max-width: 90px; }
/* A switch, for the friend ⋯'s Mute and Pin. */
.sw { margin-left: auto; width: 34px; height: 20px; flex: none; border-radius: 99px; background: var(--bg-3); border: 1px solid var(--line-2); position: relative; transition: background .15s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--fg-dim); transition: transform .15s, background .15s; }
[aria-checked="true"] > .sw { background: var(--good); border-color: transparent; }
[aria-checked="true"] > .sw::after { transform: translateX(14px); background: #fff; }

.row-flag { display: grid; color: var(--fg-faint); flex: none; }
.device-unread.muted { background: var(--fg-faint); }
.device-unread.dot { min-width: 12px; width: 12px; height: 12px; padding: 0; align-self: center; }
.chat-row-item.menu-on { background: var(--bg-3); }

.archived-row .archived-ic { width: 44px; height: 30px; flex: none; display: grid; place-items: center; color: var(--fg-dim); }
.archived-row .device-name { font-weight: 600; font-size: 14.5px; }
.archived-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px 0; }
.archived-note { margin: 2px 14px 8px; }

/* Select chats: a tick on each row, and what to do in a bar at the bottom. */
.chat-row-item .pick { width: 22px; height: 22px; flex: none; align-self: center; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; color: var(--bg); }
.chat-row-item .pick.on { background: var(--good); border-color: var(--good); }
.chat-row-item.picked { background: rgba(62, 207, 142, .08); }
.select-bar { display: flex; align-items: center; gap: 4px; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--bg); flex: none; }
.select-bar.hidden { display: none; }
/* Cancel and the count on one line, the four actions shared out on the next. */
.select-bar { flex-wrap: wrap; row-gap: 6px; }
#sel-count { flex: 1 0 calc(100% - 90px); white-space: nowrap; }
.sel-act { flex: 1 1 20%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px; border: 0; background: transparent; color: var(--fg); }
.sel-act small { font-size: 11px; }
.sel-act.bad { color: var(--bad); }
.sel-act:disabled { opacity: .35; }
.sel-act span { display: grid; }
.chats-place.selecting #chat-search-bar, .chats-place.selecting #chat-filters { pointer-events: none; opacity: .4; }

.contact-card { align-items: center; text-align: center; width: min(360px, calc(100vw - 32px)); }
.contact-card > .row:first-child { align-self: stretch; }
.contact-card .contact-av { width: 88px; height: 88px; font-size: 30px; }
.contact-handle, .inviter-handle { margin-top: -8px; font-size: 14px; font-weight: 600; color: var(--accent); }
.contact-handle:empty { display: none; }
.contact-card > .row.g8 { align-self: stretch; }
.contact-facts { align-self: stretch; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; text-align: left; font-size: 13.5px; }
.contact-facts dt { color: var(--fg-faint); }
.contact-facts dd { margin: 0; text-align: right; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 4px; max-height: 50vh; overflow: auto; }
.media-tile { padding: 0; border: 0; aspect-ratio: 1; overflow: hidden; border-radius: 8px; background: var(--bg-3); min-height: 0; }
.media-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-file { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 9px; background: transparent; text-align: left; color: var(--fg); }
.media-file:hover:not(:disabled) { background: var(--bg-3); transform: none; }
#media-files { max-height: 40vh; overflow: auto; }
.item.flash .bubble { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .7); } 100% { box-shadow: 0 0 0 3px transparent; } }
:root[data-theme="light"] .sel-act, :root[data-theme="light"] .media-file { background: transparent; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .sel-act, :root:not([data-theme="dark"]) .media-file { background: transparent; }
}
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  /* The bar takes the tab bar's place while choosing. */
  .select-bar { padding-bottom: max(8px, calc(env(safe-area-inset-bottom) - 20px)); }
  body:has(.chats-place.selecting:not(.hidden)) .appnav { display: none; }
}

/* ---- the Calls tab (#31) ---- */
.calls-place { min-height: 0; overflow: hidden; }
.calls-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; max-width: 680px; margin: 0 auto; width: 100%; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.calls-list { flex: 1; min-height: 0; overflow-y: auto; max-height: none; }
.calls-sect { padding: 14px 16px 4px; font: 700 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--fg-faint); }
.call-row { padding: 0 8px 0 0; }
.calls-sect + .call-row::before { display: none; }
.call-open { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; padding: 9px 0 9px 16px; border: 0; background: transparent; text-align: left; color: inherit; font: inherit; min-height: 0; }
.call-open:hover:not(:disabled) { transform: none; }
.call-row.missed .device-name, .call-row.missed .call-dir { color: var(--bad); }
.call-dir { margin-right: 5px; font-weight: 700; }
.call-back { color: var(--accent); flex: none; }
.call-dev { display: grid; place-items: center; color: var(--fg-dim); background: var(--bg-3); }
.calls-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 60px 20px; color: var(--fg-faint); text-align: center; }
.nav-badge.nav-missed { background: var(--bad); color: #fff; }
:root[data-theme="light"] .call-open { background: transparent; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .call-open { background: transparent; } }
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .calls-wrap { border: 0; max-width: none; }
}

/* ---- searching what was said (#32) ---- */
.c-find { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.c-find.hidden { display: none; }
.c-find .search-field { flex: 1; min-width: 0; }
.c-find-ic { display: grid; color: var(--fg-faint); }
#c-find-n { white-space: nowrap; }
.msg-hit .chat-preview .hl { color: var(--accent); }
.chat-preview .hl { color: var(--accent); }
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) { #c-find-q { font-size: 16px; } }

/* ---- deleted for both (#33) ---- */
.item.chat .bubble.deleted, .item.chat.mine .bubble.deleted { display: flex; align-items: baseline; gap: 10px; padding: 6px 10px; font-style: italic; color: var(--fg-faint); background: var(--bg-2); border: 1px solid var(--line-2); box-shadow: none; }
.bubble.deleted::before, .bubble.deleted::after { display: none; }
.del-text { display: inline-flex; align-items: center; gap: 6px; }
.bubble.deleted .bubble-foot { position: static; font-style: normal; }

/* ---- comparing the safety code on a friend call (#34) ---- */
.sas-compare { margin-left: 2px; padding: 3px 10px; min-height: 0; border-radius: 99px; border: 0; background: rgba(var(--accent-rgb), .18); color: var(--accent); font: 650 12px var(--sans); }
.sas-compare:hover:not(:disabled) { transform: none; background: rgba(var(--accent-rgb), .28); }
.call-sas.ok { border-color: rgba(62, 207, 142, .5); background: rgba(62, 207, 142, .12); }
.call-sas.ok small { color: var(--good); }
.sas-ask { margin-top: 12px; padding: 14px 16px; border-radius: 16px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line-2); max-width: 320px; text-align: center; }
.sas-ask.hidden { display: none; }
.sas-big { font: 750 34px var(--mono); letter-spacing: .16em; }
.sas-how { margin: 6px 0 12px; font-size: 13px; color: var(--fg-dim); line-height: 1.4; }
.sas-ask .row { justify-content: center; }
.sas-no { color: var(--bad); }
:root[data-theme="light"] .sas-compare { background: rgba(var(--accent-rgb), .14); }
:root[data-theme="light"] .sas-ask { background: rgba(255, 255, 255, .8); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .sas-compare { background: rgba(var(--accent-rgb), .14); }
  :root:not([data-theme="dark"]) .sas-ask { background: rgba(255, 255, 255, .8); }
}

/* ---- editing a message (#59) ---- */
.edit-bar { display: flex; align-items: center; gap: 10px; padding: 6px 4px 8px; }
.edit-bar.hidden { display: none; }
.edit-bar-line { width: 3px; align-self: stretch; border-radius: 2px; background: var(--accent); flex: none; }
#c-edit-title { font-size: 12.5px; color: var(--accent); font-weight: 650; }
#c-edit-orig { font-size: 13px; color: var(--fg-dim); }
.send-btn .ic-save { display: none; }
.chat-composer.editing .send-btn .ic-send { display: none; }
.chat-composer.editing .send-btn .ic-save { display: block; }
.chat-composer.editing .send-btn { background: linear-gradient(140deg, var(--good), #22a877); }
.chat-composer.editing #c-plus { display: none; }
.item.chat.editing .bubble { box-shadow: 0 0 0 2px rgba(var(--accent-rgb), .7); }
.bubble-foot .edited { font-style: italic; margin-right: 4px; }
/* "edited" makes the footer longer; the gap it tucks into grows to match. */
.bubble.tucked.was-edited .foot-gap { width: 96px; }
.item.mine .bubble.tucked.was-edited .foot-gap { width: 116px; }

/* #29 Devices: device ⋯ with icons, Devices list ⋯, search in session, quick send sheet */
.dev-hmenu { width: min(270px, calc(100vw - 24px)); }
.dev-hmenu .extend-opt small.truncate { max-width: 110px; }
#devices-more { flex: none; }
.d-find-ic { display: grid; color: var(--fg-faint); }
#d-find-n { white-space: nowrap; }
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) { #d-find-q { font-size: 16px; } }
.quick-list { display: flex; flex-direction: column; gap: 4px; max-height: min(60vh, 420px); overflow-y: auto; }
#quick-filter { font-size: 16px; }
.dev-hmenu .extend-opt b { flex: none; }
.dev-hmenu .extend-opt small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* No keyboard on a phone, so no ⌘K there. */
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) { #palette-btn { display: none; } }

/* #62 Show message preview: a sub-row under Notifications */
.you-subrow { padding-left: 56px !important; }

/* #65 Account and security; Delete account one level down */
.account-quiet { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 0 4px; text-align: center; }
.account-quiet small { font-size: 12px; color: var(--fg-faint); }
.danger-link, .danger-link:hover:not(:disabled) { color: var(--bad); }
.delete-warn { text-align: center; }
.delete-warn h3 { margin: 0 0 4px; font-size: 19px; }
.delete-warn p { margin: 0; color: var(--fg-dim); font-size: 13.5px; }
.delete-big { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 10px; background: rgba(240, 112, 122, .14); color: var(--bad); }
.delete-gone { margin: 0; padding: 12px 14px 4px 32px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-2); }
.delete-gone li { margin: 0 0 8px; color: var(--fg-dim); font-size: 13.5px; }
.delete-gone b { color: var(--fg); font-weight: 600; }
#delete-email { font-size: 16px; }
#delete-go { width: 100%; height: 46px; font-weight: 700; }
#delete-go:not(:disabled) { background: var(--bad); color: #1b0508; border-color: transparent; }
#delete-go:disabled { opacity: .45; }
.banner.good { border-color: rgba(62, 207, 142, .35); background: rgba(62, 207, 142, .1); color: var(--fg); }
.you-row.flash-row { animation: flash 1.6s ease-out; }

/* #66 The send button keeps its colour in every theme: the light theme's
   ":root[...] button" rule (0,2,1) would otherwise paint it grey. Hover
   keeps the kind's own colour too. */
:root .round-btn.send-btn, :root .round-btn.send-btn:hover:not(:disabled) { background: linear-gradient(140deg, var(--accent), #4f8be8); }
:root .round-btn.send-btn[data-kind="secret"], :root .round-btn.send-btn[data-kind="secret"]:hover:not(:disabled) { background: #8b6cf0; }
:root .round-btn.send-btn[data-kind="command"], :root .round-btn.send-btn[data-kind="command"]:hover:not(:disabled) { background: var(--bad); }
:root .chat-composer.editing .round-btn.send-btn, :root .chat-composer.editing .round-btn.send-btn:hover:not(:disabled) { background: linear-gradient(140deg, var(--good), #22a877); }

/* #57 Inside the iPhone app the web view runs its own long-press text
   selection (handles, Copy / Look Up) even where the rules above say no,
   unless selection is off for the whole page. Text fields keep it, so
   typing, the cursor and paste still work, and so does Details' text. */
html.ios-app, html.ios-app body, html.ios-app body * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.ios-app input, html.ios-app textarea, html.ios-app [contenteditable], html.ios-app [contenteditable] *, html.ios-app .mm-details dd {
  -webkit-user-select: text; user-select: text; -webkit-touch-callout: default;
}

/* ---- replying and swiping (#71, #72) ----
   A reply opens with a quote of the message it answers: whose it was, in
   their colour, and a line of it. The same quote sits over the box while the
   reply is being written. On a phone a message is swiped right to reply and
   left for its info (msgmenu.js). A tap on a quote goes to the message, lit
   up the way search does it (.item.flash). */
.quote {
  display: flex; align-items: stretch; width: 100%; min-width: 0; margin: 0 0 5px; padding: 0; overflow: hidden;
  border: 0; border-radius: 7px; background: rgba(127, 127, 127, .16); color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.quote:hover:not(:disabled) { transform: none; background: rgba(127, 127, 127, .22); }
.quote-bar { width: 3px; flex: none; background: var(--good); }
.quote.mine .quote-bar { background: var(--accent); }
.quote.gone .quote-bar { background: var(--fg-faint); }
.quote.gone { cursor: default; }
.quote-q { display: flex; flex-direction: column; flex: 1; min-width: 0; padding: 4px 8px 5px; }
.quote-q b { font-size: 12.5px; font-weight: 650; color: var(--good); }
.quote.mine .quote-q b { color: var(--accent); }
.quote.gone .quote-q b { color: var(--fg-faint); }
.quote-q span { font-size: 13px; color: var(--fg-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote.gone .quote-q span { font-style: italic; }
.quote-thumb { width: 40px; height: 40px; object-fit: cover; flex: none; }
.bubble.photo .quote { width: auto; margin: 0 0 3px; }
.reply-bar #c-reply-who { font-size: 12.5px; color: var(--accent); font-weight: 650; }
.reply-bar #c-reply-text { font-size: 13px; color: var(--fg-dim); }
.reply-thumb { width: 38px; height: 38px; border-radius: 6px; object-fit: cover; flex: none; }
.reply-thumb.hidden { display: none; }

/* Sideways is the swipe's, all the way down: a bubble's own pre scrolls
   sideways, and would otherwise take the gesture as a scroll of its own. */
@media (hover: none), (pointer: coarse) {
  .timeline .item, .timeline .item * { touch-action: pan-y; }
}
.item.swiping { position: relative; }
.swipe-cue {
  position: absolute; top: 50%; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(127, 127, 127, .22); color: var(--fg); pointer-events: none; opacity: 0; transition: background .12s, color .12s, transform .12s;
}
.swipe-cue.locked { background: var(--accent); color: #06101f; transform: scale(1.08); }

/* Message info: a sheet from the bottom with the message, then its facts. */
.mi {
  position: fixed; left: 0; right: 0; bottom: 0; width: min(100%, 520px); margin: 0 auto; max-height: 86dvh; overflow: auto;
  padding: 8px 0 calc(14px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; border: 1px solid var(--line-2); border-bottom: 0;
  background: var(--sheet); color: var(--fg); box-shadow: 0 -18px 40px -18px rgba(0, 0, 0, .6); animation: mi-rise .18s ease-out;
}
@keyframes mi-rise { from { transform: translateY(30px); opacity: .5; } }
.mi:focus { outline: none; }
.mi-grab { display: block; width: 38px; height: 5px; margin: 0 auto 6px; border-radius: 3px; background: var(--line-2); }
.mi-top { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; padding: 0 10px 8px; border-bottom: 1px solid var(--line); }
.mi-top b { grid-column: 2; text-align: center; font-size: 16px; }
.mi-done { grid-column: 3; justify-self: end; padding: 6px 8px; border: 0; background: none; color: var(--accent); font-size: 15px; font-weight: 650; }
.mi-done:hover:not(:disabled) { transform: none; }
.mi-preview {
  display: flex; flex-direction: column; max-height: 36dvh; overflow: hidden; padding: 16px 14px; border-bottom: 1px solid var(--line);
  background-color: var(--wall); background-image: var(--wall-image); background-size: var(--wall-size); pointer-events: none;
}
.mi-preview .bubble { max-width: 85%; }
.mi-facts { margin: 0; }
.mi-fact { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.mi-fact:last-child { border-bottom: 0; }
.mi-fact dt { font-weight: 600; flex: none; }
.mi-fact dd { margin: 0; color: var(--fg-dim); text-align: right; overflow-wrap: anywhere; -webkit-user-select: text; user-select: text; }
.mi-fact.mono dd { font: 12px var(--mono); }
/* Info in a chat: the ticks a person knows, before Read and Sent (#83). */
.mi-fact .mi-tick { display: inline-block; width: 24px; font-weight: 400; color: var(--fg-faint); }
.mi-fact .mi-tick.read { color: var(--tick-read); }
:root[data-theme="light"] :is(.mi, .cf-group, .cf-cancel) { background: #fff; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) :is(.mi, .cf-group, .cf-cancel) { background: #fff; }
}

/* Swipe left: round buttons beside the message, which act only on a tap (#86).
   They come in with the drag itself, so no animation of their own (#92).
   The :not(#_) outranks the themes' fill for every button. */
.swipe-acts { position: absolute; top: 50%; display: flex; gap: 8px; z-index: 2; transform: translateY(-50%); }
.timeline .swipe-act:not(#_) {
  width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: rgba(127, 127, 127, .18); color: var(--fg-dim); transform: none;
}
.timeline .swipe-act.bad:not(#_) { background: rgba(211, 58, 58, .14); color: var(--bad); }

/* A question from the bottom, iOS style: the answers in one group, Cancel apart (#86). */
.cf { position: fixed; left: 8px; right: 8px; bottom: calc(10px + env(safe-area-inset-bottom)); width: min(calc(100% - 16px), 420px); margin: 0 auto; animation: mi-rise .18s ease-out; }
.cf:focus { outline: none; }
.cf-group, .cf-cancel { background: var(--sheet); border-radius: 14px; }
.cf-group { display: flex; flex-direction: column; overflow: hidden; text-align: center; }
.cf-title { padding: 16px 20px 4px; font-size: 15px; }
.cf-note { margin: 0; padding: 0 20px 14px; font-size: 13.5px; color: var(--fg-dim); }
.cf :is(.cf-act, .cf-cancel):not(#_) {
  width: 100%; padding: 15px; border: 0; border-radius: 0; background: transparent; font: 500 17px var(--sans); color: var(--head-ic); transform: none;
}
.cf .cf-act:not(#_) { border-top: 1px solid var(--line); }
.cf .cf-act.bad:not(#_) { color: var(--bad); font-weight: 600; }
.cf .cf-cancel:not(#_) { margin-top: 8px; border-radius: 14px; font-weight: 600; background: var(--sheet); }
:root[data-theme="light"] .cf .cf-cancel:not(#_) { background: #fff; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .cf .cf-cancel:not(#_) { background: #fff; }
}

/* ---- the conversation screen, polished (#73, docs/chat-polish-mockup.html) ----
   Layers instead of lines: a white (or midnight) header over the wallpaper
   with a hairline under it and bare icons; bubbles without strokes; small
   metadata the phone may not enlarge; compact secret and deleted lines; a
   photo inset in its bubble; a borderless pill and a solid send. */
/* The header and the composer part from the wallpaper by a hairline shadow,
   not a border (#75, W1, W3). */
.main-head {
  position: relative; z-index: 2;
  background: var(--head-bg); border-bottom: 0; box-shadow: 0 .5px 0 var(--head-line);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
}
.main-head :where(.back-btn, .call-btn, #friend-menu-btn, .menu-btn) {
  padding: 6px; border: 0; border-radius: 50%; background: transparent; box-shadow: none; color: var(--head-ic);
}
/* One box for every header button, whatever class it came with: .btn-icon
   has line-height 0 while .btn-sm keeps its text line box, so the handset
   and the ⋯ sat 3px apart. A grid of a fixed size centres the icon itself. */
.main-head :is(.back-btn, .call-btn, #friend-menu-btn, .menu-btn) {
  display: grid; place-items: center; width: 36px; height: 36px; min-height: 0; padding: 0; line-height: 0; flex: none;
}
.main-head :is(.back-btn, .call-btn, #friend-menu-btn, .menu-btn) svg { display: block; }
.main-head .back-btn { width: 28px; margin-left: 0; border-radius: 10px; }
/* The box above outranks .back-btn's display: none; on computers the list is
   beside the conversation, so there is nothing to go back to (#82). */
@media (min-width: 761px) and (min-height: 501px), (min-width: 761px) and (pointer: fine), (min-width: 761px) and (pointer: none) { .main-head .back-btn:not(#_) { display: none; } }
.main-head .extend-wrap { display: flex; align-items: center; }
.main-head .call-btn { color: var(--head-call); }
.main-head .call-btn:disabled { color: var(--fg-faint); }
.main-head :is(.back-btn, .call-btn, #friend-menu-btn, .menu-btn) svg { width: 22px; height: 22px; stroke-width: 2; }
/* The mockup's header (#sB, #sC): name, avatar and its online dot. */
.main-head :is(#friend-name, #dev-label, #op-name) { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.main-head .pav { width: 38px; height: 38px; font-size: 13px; }
.main-head .pav > i { right: -2px; bottom: -2px; border: 2px solid var(--head-solid); }
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .main-head { padding-left: 4px; padding-right: 10px; padding-bottom: 8px; gap: 10px; }
}
/* Bare in every theme: the light themes' button fill (chosen, or from the
   system) is stronger than the rule above. A touch also leaves :hover stuck
   on a phone, which painted grey discs. */
:root .main-head :is(.back-btn, .call-btn, #friend-menu-btn, .menu-btn):not(#_) { background: transparent; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .main-head :where(.back-btn, .call-btn, #friend-menu-btn, .menu-btn):hover:not(:disabled),
  :root .main-head :is(.back-btn, .call-btn, #friend-menu-btn, .menu-btn):not(#_):hover:not(:disabled) { background: rgba(127, 127, 127, .12); }
}
#friend-meta, #dev-meta, #op-label { font-size: 12.5px; color: var(--meta-fg); }
#friend-meta .on, #dev-meta .on, #op-label .on, #op-label .ws-status:has(.dot.on) > span:last-child { color: var(--head-call); }
/* typing… stands in for a list row's preview while they type (#81). */
.device .row-l2 .typing { color: var(--head-call); font-style: italic; }

.chat-timeline .day-divider { font: 500 12.5px var(--sans); letter-spacing: 0; text-transform: none; color: var(--pill-fg); padding: 4px 10px; border-radius: 8px; }
/* The iPhone enlarges small text in the web view; the metadata keeps its size. */
.bubble-foot, .day-divider, #friend-meta { -webkit-text-size-adjust: none; text-size-adjust: none; }

/* Sealed secret: one row - a lock disc, "Secret" and what opening means. */
.item.chat .secret-row { display: flex; align-items: center; gap: 10px; padding: 3px 2px 1px 0; color: inherit; font-size: inherit; font-weight: 400; }
.secret-disc { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; color: #6d4fd8; background: rgba(109, 79, 216, .14); }
.secret-what { display: flex; flex-direction: column; min-width: 0; }
.secret-what b { font-size: 14.5px; font-weight: 650; }
.secret-what small { font-size: 13px; color: var(--fg-faint); }
.item.chat.mine .bubble.secret.sealed { background: var(--bubble-mine); border: 0; color: var(--bubble-mine-fg); }
.item.chat.mine .bubble.secret.sealed .secret-what small { color: var(--bubble-mine-dim); }
.item.chat .bubble.secret.sealed .item-actions.keep .btn-sm { font-size: 13px; }
:root:not([data-theme="light"]) .secret-disc { color: #b9a2ff; background: rgba(167, 139, 250, .18); }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .secret-disc { color: #6d4fd8; background: rgba(109, 79, 216, .14); }
}

/* Deleted: one grey italic line in an ordinary bubble. */
.item.chat .bubble.deleted { background: var(--bubble-them); border: 0; box-shadow: var(--bubble-shadow); font-size: 15.5px; }
.item.chat.mine .bubble.deleted { background: var(--bubble-mine); }
.item.chat.mine .bubble.deleted .del-text { color: var(--bubble-mine-dim); }

/* A photo sits 3px inside its bubble, the time in a small translucent pill
   that reads on a white screenshot as on a dark picture (#84, F4). */
.item.chat .bubble.photo { padding: 3px !important; border-radius: 12px; background: var(--bubble-them) !important; box-shadow: var(--bubble-shadow) !important; }
.item.chat.mine .bubble.photo { background: var(--bubble-mine) !important; }
.item.chat .bubble.photo .file-preview { border-radius: 10px; box-shadow: none; overflow: hidden; }
.item.chat .bubble.photo .file-preview img { border-radius: 10px; }
.item.chat .bubble.photo > .bubble-foot {
  right: 8px; bottom: 7px; z-index: 2; padding: 2px 6px; border-radius: 10px; font-size: 11px; text-shadow: none;
  background: rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.item.chat .bubble.photo .photo-gone { background: var(--bg-3); border-radius: 10px; }

/* Writing: a borderless pill with a hairline shadow, a solid send. */
.pill-field { border-color: transparent; box-shadow: var(--field-shadow); }
.pill-field:focus-within { border-color: transparent; box-shadow: var(--field-shadow), 0 0 0 1.5px rgba(var(--accent-rgb), .45); }
.send-btn, .send-btn.ready { opacity: 1; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
:root .round-btn.send-btn, :root .round-btn.send-btn:hover:not(:disabled) { background: var(--send-bg); color: var(--send-fg); }
/* A secret or a command keeps its own colour, with a white icon. */
:root .round-btn.send-btn:is([data-kind="secret"], [data-kind="command"]) { color: #fff; }
.send-btn .ic-send { margin-left: -2px; }
.chat-composer .reply-bar {
  padding: 6px 6px 6px 0; border-radius: 12px; background: var(--field); box-shadow: var(--field-shadow);
}
.chat-composer .reply-bar .edit-bar-line { border-radius: 0 2px 2px 0; }

/* ---- computers and device pages (#75, docs/chat-polish-mockup.html #sD #sE) ---- */
.composer.chat-composer { border-top: 0; box-shadow: 0 -1px 0 var(--bar-line); }
@media (min-width: 761px) and (min-height: 501px), (min-width: 761px) and (pointer: fine), (min-width: 761px) and (pointer: none) {
  .composer.chat-composer { padding: 8px 16px 10px; }
  /* Gutters, and bubbles no wider than reads well; a photo keeps its own cap. */
  .chat-timeline { padding: 12px 63px; }
  .item.chat { max-width: 65%; }
  .main-head .pav { width: 40px; height: 40px; font-size: 13px; }
  .main-head { padding: 10px 16px; gap: 12px; }
  /* On /r a full-screen window doesn't stretch a message across it. */
  body.app > #session-view > .main-head, body.app > #session-view > .main { width: 100%; max-width: 980px; margin: 0 auto; }
}

/* Select messages (#87): a tick at the left of every message, a light wash on
   the ticked ones, the header counts and a bar takes the composer's place. The
   messages make room on the left and stretch, so the ticks line up and the
   wash spans the row. */
.msel-head, .msel-bar { display: none; }
.msg-selecting .main-head { position: relative; }
.msg-selecting .msel-head {
  display: flex; position: absolute; inset: 0; z-index: 5; align-items: center; gap: 10px;
  padding: inherit; background: var(--head-solid); font-size: 17px;
}
.msel-x:not(#_) { color: var(--accent); background: transparent; }
.msg-selecting .chat-composer:not(#_) { display: none; }
.msg-selecting .msel-bar {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: 8px 22px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--head-solid);
}
.msel-act:not(#_) {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 8px;
  border: 0; background: transparent; color: var(--accent); box-shadow: none;
}
.msel-act small { font-size: 11px; }
.msel-act.bad:not(#_) { color: var(--bad); }
.msel-act:disabled { opacity: .35; }
.msel-why { flex: 1; text-align: center; visibility: hidden; }
.msel-why.on { visibility: visible; }
.msg-selecting .chat-timeline { padding-left: 56px; isolation: isolate; }
.msg-selecting .chat-timeline .item.chat { align-self: stretch; max-width: none; }
.msg-selecting .chat-timeline .item.chat > .bubble { max-width: min(580px, 80%); }
.msg-selecting .chat-timeline .item[data-id]:not(.msel-no) { cursor: pointer; }
.msg-selecting .item-more { display: none; }
/* A call line can be ticked too (#119): it stays centred, its tick at the edge with the others. */
.msg-selecting .chat-timeline .item.call-item { align-self: stretch; align-items: center; position: relative; }
.msel-tick {
  position: absolute; left: -44px; top: 50%; transform: translateY(-50%); width: 24px; height: 24px;
  border-radius: 50%; border: 2px solid var(--line-2); background: var(--bg); color: #fff; display: grid; place-items: center;
}
.msel-tick.on { background: var(--accent); border-color: var(--accent); }
.msg-selecting .item.msel-on::after {
  content: ""; position: absolute; z-index: -1; inset: -1px -20px -1px -56px; background: rgba(var(--accent-rgb), .1); pointer-events: none;
}

/* Chats rows swiped on a phone (#88): the row slides, coloured buttons fill
   the gap it leaves, WhatsApp's colours. A full swipe gives the first one the
   whole gap. */
.device-list { position: relative; }
.row-acts { position: absolute; display: flex; overflow: hidden; z-index: 0; }
.row-acts.left { right: 0; }
.row-acts.right { left: 0; }
.row-acts.left.all { flex-direction: row-reverse; }
.row-acts.all .row-act:not(:first-child) { flex-basis: 0; flex-grow: 0; padding: 0; }
.row-act:not(#_) {
  flex: 1 1 76px; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 0; border: 0; border-radius: 0; box-shadow: none; overflow: hidden; white-space: nowrap;
  color: #fff; font-size: 12px; font-weight: 600; background: #8696a0; transition: flex-grow .15s ease-out;
}
.row-act.unread:not(#_) { background: #2f6fd6; }
.row-act.pin:not(#_) { background: #6d4fd8; }
.row-act.mute:not(#_) { background: #8696a0; }
.row-act.archive:not(#_) { background: #1d8f72; }
.row-act.delete:not(#_) { background: #d33a3a; }
.chat-row-item.swiping, .chat-row-item.acts-open { z-index: 1; background: var(--bg); }
.chat-row-item.swiping::before, .chat-row-item.acts-open::before { display: none; }

.toast-act:not(#_) {
  flex: none; margin: -3px -4px -3px 6px; padding: 3px 8px; border: 0; border-radius: 8px; box-shadow: none;
  background: transparent; color: var(--accent); font-weight: 650; font-size: 14px;
}

/* ---- groups (#41) ----------------------------------------------------------- */
/* Two of its people stacked make a group, as on the mockup; its photo when it has one. */
.gav { width: 40px; height: 40px; flex: none; position: relative; display: block; border-radius: 50%; }
.gav > .pav { position: absolute; width: 64%; height: 64%; font-size: 10px; border: 2px solid var(--bg); box-sizing: border-box; }
.gav > .pav:nth-child(1) { left: 0; top: 0; }
.gav > .pav:nth-child(2) { right: 0; bottom: 0; }
.gav.one { display: grid; place-items: center; color: #06101f; background: linear-gradient(140deg, var(--accent), #6d4fd8); }
.device-list .gav { width: 48px; height: 48px; }
.device-list .gav > .pav { width: 31px; height: 31px; font-size: 11px; }
@media (pointer: coarse) {
  .device-list .gav { width: 52px; height: 52px; }
  .device-list .gav > .pav { width: 34px; height: 34px; }
}
.pv-from { font-weight: 600; color: var(--fg-dim); }

/* What happened in the group: centred, small, a line of its own. */
.item.sys-item { align-self: center; max-width: 88%; text-align: center; }
.sys-line {
  display: inline-block; padding: 5px 12px; border-radius: 9px; font-size: 12px; line-height: 1.4;
  background: var(--bg-3); color: var(--fg-dim);
}
/* Who said it, in their colour, above the first of their messages in a row. */
.bubble-from { display: block; font-size: 12.5px; font-weight: 650; margin-bottom: 2px; }
.bubble-from.c1 { color: #ef7a5a; }
.bubble-from.c2 { color: #34b886; }
.bubble-from.c3 { color: #9a80f5; }
.bubble-from.c4 { color: #e39a2c; }
.bubble-from.c5 { color: #4f98f5; }
.bubble-from.c6 { color: #e65fa0; }
:root[data-theme="light"] .bubble-from.c1 { color: #c4472a; }
:root[data-theme="light"] .bubble-from.c2 { color: #157a5a; }
:root[data-theme="light"] .bubble-from.c3 { color: #5b3fc4; }
:root[data-theme="light"] .bubble-from.c4 { color: #a8640c; }
:root[data-theme="light"] .bubble-from.c5 { color: #2161c4; }
:root[data-theme="light"] .bubble-from.c6 { color: #b02f70; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .bubble-from.c1 { color: #c4472a; }
  :root:not([data-theme="dark"]) .bubble-from.c2 { color: #157a5a; }
  :root:not([data-theme="dark"]) .bubble-from.c3 { color: #5b3fc4; }
  :root:not([data-theme="dark"]) .bubble-from.c4 { color: #a8640c; }
  :root:not([data-theme="dark"]) .bubble-from.c5 { color: #2161c4; }
  :root:not([data-theme="dark"]) .bubble-from.c6 { color: #b02f70; }
}

/* A group has no secrets, and no contact card, removal or block. */
#friend-view.is-group .plus-opt[data-opt="secret"],
#friend-view.is-group #fm-info,
#friend-view.is-group #remove-friend,
#friend-view.is-group #block-friend { display: none; }
/* Once you left, what was said stays readable; the box gives way to a line saying why. */
.c-left { display: none; text-align: center; padding: 14px 16px; border-top: 1px solid var(--line); }
#friend-view.group-left .c-left { display: block; }
#friend-view.group-left #c-composer { display: none; }

/* New group */
.newgroup { max-height: min(640px, 90vh); }
.newgroup .ng-list { overflow-y: auto; min-height: 120px; max-height: 46vh; }
.ng-row:disabled { opacity: .5; cursor: default; }
.ng-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ng-chips.hidden { display: none; }
.ng-chip:not(#_) {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 999px;
  background: var(--bg-3); border: 1px solid var(--line); color: var(--fg); font-size: 13px; min-height: 0; box-shadow: none;
}
.ng-chip .pav { width: 24px; height: 24px; font-size: 9.5px; }
.ng-photo:not(#_) {
  width: 64px; height: 64px; flex: none; border-radius: 50%; padding: 0; overflow: hidden;
  display: grid; place-items: center; border: 1.5px dashed var(--line-2); background: var(--bg-2); color: var(--fg-dim); box-shadow: none;
}
.ng-photo.has-photo:not(#_) { border-style: solid; }
.ng-photo img { width: 100%; height: 100%; object-fit: cover; }
#ng-first { resize: vertical; min-height: 54px; }

/* Group info and the group's ⋯ (#42) */
#friend-view:not(.is-group) .gonly { display: none; }
#friend-view.is-group .main-head .col.grow { cursor: pointer; }
.ghead { align-items: center; text-align: center; gap: 4px; }
.ghead > .pav, .ghead > .gav { width: 88px; height: 88px; font-size: 30px; margin-bottom: 6px; }
.ghead > .gav > .pav { width: 56px; height: 56px; font-size: 18px; border-width: 3px; }
.ghead > strong { font-size: 19px; }
.ghead .ng-photo:not(#_) { width: 88px; height: 88px; }
#ginfo-name-in { width: 100%; text-align: center; font-size: 16px; }
.ginfo-form-btns { align-self: stretch; }
.gacts { display: flex; justify-content: center; gap: 10px; }
.gacts > button:not(#_) {
  flex: 1; max-width: 96px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface, var(--bg-2)); color: var(--accent); font-size: 12.5px; box-shadow: none;
}
.gacts .r { display: grid; place-items: center; }
.gmember .pav { width: 36px; height: 36px; font-size: 12px; }
.gmember:disabled { opacity: 1; cursor: default; }
.grole { flex: none; font-size: 11.5px; font-weight: 600; color: var(--good); padding: 2px 8px; border-radius: 999px; background: rgba(62, 207, 142, .12); }
#ginfo-whoadds:disabled { opacity: 1; cursor: default; }

/* Mentions, typing and read by in a group (#43) */
.mention { color: var(--accent); font-weight: 600; }
.mention.atme { padding: 0 3px; border-radius: 5px; background: rgba(var(--accent-rgb), .18); }
.item.chat.mine .mention { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.row-at {
  flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--good); color: #062b14; font-size: 12px; font-weight: 700;
}
.mpop-anchor { position: relative; height: 0; z-index: 6; }
.mpop {
  position: absolute; left: 12px; right: 12px; bottom: 6px; max-width: 420px; padding: 6px; border-radius: 14px;
  border: 1px solid var(--line-2); background: linear-gradient(var(--raised), var(--raised)), var(--bg); box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.mpop-head { padding: 4px 8px 6px; }
.mpop-row:not(#_) {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 10px;
  background: transparent; color: var(--fg); text-align: left; box-shadow: none; min-height: 0;
}
.mpop-row.on:not(#_), .mpop-row:hover:not(#_) { background: var(--bg-3); transform: none; }
.mpop-row .pav { width: 30px; height: 30px; font-size: 11px; }
.mpop-row small { font-size: 12px; }
.mi-sect { padding: 12px 18px 4px; font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-faint); }
.mi-sect:empty { padding: 6px 0 0; border-bottom: 1px solid var(--line); }

/* A group call (#45, #46, screen 5): a tile per person, a green edge on whoever is speaking, you along the bottom. */
.call-btn.live { background: rgba(62, 207, 142, .14); }
.gcall-sheet { width: 400px; }
.gcall-card { gap: 12px; padding: 16px 14px 16px; text-align: left; }
.gcall-head { display: flex; align-items: center; gap: 10px; }
.gcall-gav { flex: none; display: grid; place-items: center; }
.gcall-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.gcall-title { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcall-status { color: var(--good); font-size: 12.5px; }
.gcall-time { font: 500 15px var(--mono); font-variant-numeric: tabular-nums; }
.gcall-code {
  align-self: center; display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 999px;
  border: 1px solid rgba(62, 207, 142, .3); background: rgba(62, 207, 142, .06); color: var(--fg-dim); font-size: 11px;
  letter-spacing: .05em; text-transform: uppercase;
}
.gcall-code.hidden { display: none; }
.gcall-code-val { font: 750 15px var(--mono); letter-spacing: .12em; color: var(--fg); text-transform: none; }
.gcall-grid { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(118px, auto); gap: 8px; }
.gcall-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-width: 0;
  padding: 12px 8px 26px; border-radius: 18px; background: var(--bg-3); border: 2px solid transparent; transition: border-color .15s;
}
.gcall-tile .gcall-av { width: 56px; height: 56px; font-size: 19px; }
.gcall-tile b { font-size: 13.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcall-st { position: absolute; left: 10px; bottom: 8px; display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--fg-dim); }
.gcall-st.muted { color: #ff7a88; }
.gcall-tile.speaking { border-color: var(--good); }
.gcall-tile.waiting { border: 1.5px dashed var(--line-2); background: transparent; }
.gcall-tile.waiting .gcall-av { opacity: .5; }
.gcall-tile.waiting b { color: var(--fg-faint); }
.gcall-grid[data-count="0"] { display: none; }
.gcall-tile.me { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 0 16px; min-height: 70px; }
.gcall-tile.me .gcall-av { width: 42px; height: 42px; font-size: 15px; }
.gcall-tile.me .gcall-st { position: static; margin-left: auto; }
.gcall-acts { gap: 26px; }
/* The bar offering a call you are not on: no Leave button, the whole bar joins. */
#gcall-bar .call-bar-end.hidden { display: none; }
#gcall-bar .call-bar-back svg { flex: none; }
@media (max-width: 760px), (max-height: 500px) and (pointer: coarse) {
  .gcall-sheet { width: auto; }
  .gcall-card { padding: calc(14px + env(safe-area-inset-top)) 12px calc(26px + env(safe-area-inset-bottom)); justify-content: flex-start; }
  .gcall-grid { flex: 1; grid-auto-rows: minmax(0, 1fr); }
  .gcall-grid[data-count="0"] { display: grid; }
  .gcall-tile.me { min-height: 80px; }
  .gcall-tile .gcall-av { width: 64px; height: 64px; font-size: 22px; }
  .gcall-acts { padding-top: 6px; }
}

/* A call on a phone on its side (R11, screen 8): the person on the left, the buttons on the right in reach of the thumb. */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .call-card {
    flex-direction: row; align-items: center; justify-content: space-between; gap: 24px;
    padding: calc(12px + env(safe-area-inset-top)) calc(28px + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(56px + env(safe-area-inset-left));
  }
  .call-who { flex: 1; }
  .call-av { width: 72px; height: 72px; border-radius: 22px; font-size: 24px; }
  .call-name { margin-top: 4px; }
  .call-acts { display: grid; grid-template-columns: repeat(2, auto); gap: 14px 30px; flex: none; }
  .call-round { width: 58px; height: 58px; min-height: 58px; }
  .call-min { left: calc(12px + env(safe-area-inset-left)); }
  /* A group call: the people in rows of up to four on the left, the buttons on the right. */
  .gcall-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto minmax(0, 1fr) auto; align-items: stretch; gap: 8px 20px;
    padding: calc(10px + env(safe-area-inset-top)) calc(20px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left)); }
  .gcall-card > * { grid-column: 1; }
  .gcall-card > .gcall-acts { grid-column: 2; grid-row: 1 / -1; align-self: center; }
  .gcall-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); }
  .gcall-tile .gcall-av { width: 48px; height: 48px; font-size: 17px; }
  .gcall-tile.me { min-height: 52px; }
}

/* A group call ringing (#47, screen 15): the group large, who is calling, who is in. */
.gring-kind { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg-dim); margin-bottom: 8px; }
.gring-av { display: grid; place-items: center; margin: 4px 0 6px; }
.gring-av > .pav { width: 76px; height: 76px; font-size: 26px; }
.gring-av > .gav { transform: scale(1.9); margin: 18px 0; }
.gring-in { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 8px; font-size: 12.5px; color: var(--fg-dim); }
.gring-in .pav { width: 24px; height: 24px; font-size: 9px; margin-right: -8px; border: 2px solid var(--bg); }
.gring-in > span:not(.pav) { margin-left: 12px; }

/* ---- accounts on this device (#51, screens 8 and 11) ---- */
.nav-av.stack { box-shadow: 3px 3px 0 0 var(--bg), 3px 3px 0 1.5px var(--line-2); }
.nav-btn[aria-current="page"] .nav-av.stack { box-shadow: 0 0 0 2px var(--accent), 4px 4px 0 1px var(--bg), 4px 4px 0 2.5px var(--line-2); }
.nav-badge.nav-acc { background: var(--accent); color: #06101f; }
.nav-warn:not(.hidden) ~ .nav-acc { display: none; }
.acc-back { position: fixed; inset: 0; z-index: 260; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; }
.acc-back.hidden { display: none; }
.acc-sheet {
  width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 6px; padding: 10px 14px calc(18px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0; border-top: 1px solid var(--line-2); background: var(--bg); box-shadow: var(--lift);
  animation: pop-top .18s ease-out;
}
.acc-grab { align-self: center; width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); margin-bottom: 6px; }
.acc-sheet h4 { margin: 0 4px 4px; font-size: 15px; }
.acc-list { display: flex; flex-direction: column; gap: 2px; }
.acc-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: 14px; border: 0;
  background: transparent; color: var(--fg); text-align: left; min-height: 0;
}
.acc-row:hover:not(:disabled) { background: var(--bg-2); transform: none; }
.acc-row.on { background: var(--bg-3); }
.acc-av { width: 44px; height: 44px; font-size: 15px; flex: none; }
.acc-who { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.acc-who b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-who small { color: var(--fg-dim); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.acc-site { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: rgba(var(--accent-rgb), .14); color: var(--accent); }
.acc-site.work { background: rgba(245, 181, 68, .14); color: var(--warn, #f5b544); }
.acc-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #06101f; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.acc-ck { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #06101f; display: grid; place-items: center; }
.acc-remove { font-size: 12.5px; font-weight: 650; color: var(--bad, #ff6b7a); }
.acc-add { color: var(--accent); }
.acc-add b { color: var(--accent); }
.acc-add:disabled { opacity: .55; }
.acc-plus { width: 44px; height: 44px; border-radius: 50%; border: 1.5px dashed var(--line-2); display: grid; place-items: center; flex: none; }
.acc-foot { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }
.acc-acts { display: flex; justify-content: space-between; gap: 8px; padding: 2px 4px; }
.acc-ask { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.acc-ask p { margin: 0; font-size: 13px; color: var(--fg-dim); line-height: 1.45; }
.acc-ask .row { justify-content: flex-end; }
/* A call for another account on this device (#54): a card at the top that rings. */
.acc-ring {
  position: fixed; z-index: 300; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(420px, calc(100vw - 24px)); display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 18px; border: 1px solid var(--line-2); background: var(--bg); box-shadow: var(--lift); animation: pop-top .18s ease-out;
}
.acc-ring .acc-av { width: 40px; height: 40px; flex: none; }
.acc-ring-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.acc-ring-text small { color: var(--fg-dim); font-size: 12px; }
.acc-ring-text b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-ring-acts { display: flex; gap: 10px; flex: none; }
.acc-ring .call-round { width: 44px; height: 44px; min-height: 44px; }
.call-acct { font-size: 12px; color: var(--fg-dim); margin-top: -4px; }
/* A computer: a small window beside the rail, by You (screen 11). */
@media (min-width: 761px) and (min-height: 501px), (min-width: 761px) and (pointer: fine), (min-width: 761px) and (pointer: none) {
  .acc-back { background: transparent; align-items: flex-end; justify-content: flex-start; }
  .acc-sheet { width: 340px; margin: 0 0 60px 80px; border-radius: 16px; border: 1px solid var(--line-2); padding: 8px 8px 10px; box-shadow: 0 20px 40px -14px rgba(0, 0, 0, .7); }
  .acc-grab { display: none; }
  .acc-sheet h4 { margin: 4px 8px 4px; }
}
.add-note { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; border: 1px solid rgba(var(--accent-rgb), .35); background: rgba(var(--accent-rgb), .08); color: var(--fg-dim); font-size: 13px; line-height: 1.45; }
/* An invite link with several accounts here: which one accepts (#52). */
#accept-as small { font-weight: 400; opacity: .75; }
.add-note b { color: var(--fg); font-size: 15px; }

/* ---- invite codes on the sign-in page (#124) ---- */
.code-card { padding: 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-3); }
.code-row { display: flex; gap: 8px; }
.code-row .code-input { flex: 1; min-width: 0; }
.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; letter-spacing: .12em; text-transform: uppercase; text-align: center; }
.code-card .mono { overflow-wrap: anywhere; }
.code-who { display: flex; align-items: center; gap: 12px; }
.code-initials { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff; background: linear-gradient(135deg, #5b8def, #7a5cf0); }
.code-show { align-self: flex-start; font-size: 18px; letter-spacing: .12em; padding: 4px 10px; border-radius: 8px; border: 1px dashed var(--line-2); }
.have-code summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.have-code .code-input { margin-top: 8px; width: 100%; box-sizing: border-box; }
.have-code p { margin-top: 6px; }
.bad-text { color: var(--bad); }
/* the inviter's side (#125) */
.code-give .code-show { font-size: 17px; }
#invite-out .code-give { padding-top: 4px; }
/* Invite a friend (#194, i2): the code as big as the link, in a dashed box, with the Apple line. */
#invite-out .invite-codebox { padding: 12px; border: 1.5px dashed var(--accent); border-radius: 12px; }
#invite-out .invite-codebox .code-show { font-size: 26px; font-weight: 700; padding: 6px 12px; }
.apple-hint { padding: 10px 12px; border: 1.5px dashed var(--accent); border-radius: 12px; color: var(--fg-dim); line-height: 1.4; }
.apple-hint .link-btn { padding: 0; font-size: 12px; }
.apple-line { align-items: flex-start; color: var(--fg-dim); line-height: 1.4; }
.apple-line .apple-ic { flex: none; margin-top: 1px; color: var(--fg); }
.pending-row .give-code { flex: none; }

/* ---- admin: the closed beta's applications (#136) ---- */
.beta-note { display: block; max-width: 280px; white-space: pre-wrap; }
.beta-dialog { max-width: 540px; }
.beta-dialog .t18 { font-size: 18px; }
.beta-dialog .end { justify-content: flex-end; }
.beta-code { align-items: baseline; padding: 12px 14px; border-radius: 12px; background: var(--raised); }
.beta-code b { font-size: 20px; letter-spacing: .08em; }
.beta-msg { margin: 0; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line-2); color: var(--fg-dim); font: 13px/1.55 var(--sans); white-space: pre-wrap; }

/* ---- the closed beta's strip (#134): public pages of a chat site only ---- */
.beta-strip { display: none; }
[data-mode="chat"] > .beta-strip {
  display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 12px;
  padding: 9px max(16px, env(safe-area-inset-left)); padding-top: calc(9px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--accent) 13%, var(--bg));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  color: var(--fg); font-size: 13.5px; line-height: 1.4; text-align: center;
}
.beta-strip b { color: var(--accent); }
.beta-strip a { color: var(--accent); font-weight: 650; text-decoration: none; white-space: nowrap; }
@media (max-width: 600px) { .beta-strip .wide-only { display: none; } }

/* ---- protected documents (#150, #151) ---- */
/* The Protect sheet (screen 1), over the send preview it opens from (#160). */
.pr-back { z-index: 450; }
.pr-sheet .pr-row { padding: 10px 2px; border-top: 1px solid var(--line); }
.pr-sheet .pr-row b { display: flex; align-items: center; gap: 8px; }
.pr-sheet .pr-row.pr-off { opacity: .5; }
/* Opens and Gone after (#152). */
.pr-limits { padding: 10px 2px 2px; border-top: 1px solid var(--line); }
.pr-limits.pr-off { opacity: .5; }
.pr-limit { display: flex; flex-direction: column; gap: 6px; }
.pr-hint:empty { display: none; }
.pr-ic { flex: none; display: grid; place-items: center; color: var(--secret); }
.pr-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--bg-3); }
.pr-file .grow { min-width: 0; }
.pr-pro { padding: 0 2px 4px 34px; }
.pr-honest {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4;
  background: rgba(255, 179, 71, .1); border: 1px solid rgba(255, 179, 71, .35); color: var(--fg);
}
.pr-honest svg { flex: none; margin-top: 2px; color: var(--warn); }
/* What the watermark says (#169, docs/watermark-text-mockup.html screens 1, 2, 5). */
.pr-mark-edit { display: flex; min-width: 0; max-width: 100%; padding: 0; border: 0; background: none; color: var(--accent); font-size: 12.5px; text-align: left; cursor: pointer; }
.pr-mark-edit:disabled { color: var(--fg-faint); cursor: default; }
.wm-back { z-index: 460; }
.wm-sheet { max-height: min(92dvh, 760px); overflow: auto; }
.wm-title { text-align: center; margin-right: 56px; }
.wm-opts { border-top: 1px solid var(--line); }
.wm-opt { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--fg); text-align: left; cursor: pointer; }
.wm-opt b { font-size: 14.5px; }
.wm-radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; box-sizing: border-box; }
.wm-opt.on .wm-radio { border: 6px solid var(--secret); }
.wm-own { padding-left: 32px; }
.wm-own.pr-off { opacity: .55; }
.wm-input { font-size: 16px; padding: 9px 12px; border-radius: 10px; }
.wm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wm-chip { padding: 3px 10px; border-radius: 99px; border: 0; background: var(--bg-3); color: var(--fg-dim); font-size: 12.5px; cursor: pointer; }
.wm-warn { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; font-size: 12.5px; line-height: 1.4; background: rgba(255, 179, 71, .12); color: var(--warn); }
.wm-warn svg { flex: none; margin-top: 1px; }
.wm-prev { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--bg-3); }
/* A page as the reader gets it: the line and the time, faint and diagonal, as the server draws them. */
.wm-page { width: 96px; height: 124px; flex: none; position: relative; overflow: hidden; border-radius: 3px; background: #fff; }
.wm-tiles { position: absolute; inset: -40px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 26px 10px; place-items: center; transform: rotate(-28deg);
  color: rgba(90, 90, 90, .5); font-size: 8.5px; line-height: 1.25; text-align: center; }
.wm-tiles em { display: block; font-style: normal; font-size: .8em; }
/* The bubble (screens 2, 3). */
.prot-line { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--secret); }
.prot-sub { margin-top: 2px; font-size: 12px; color: var(--fg-dim); }
.prot-acts { display: flex; gap: 6px; margin-top: 6px; }
.prot-note { margin-top: 4px; font-size: 12px; color: var(--fg-faint); }
.bubble a.prot-open-app, .bubble a.prot-open-app:hover { display: inline-block; align-self: flex-start; margin-top: 8px; color: #06101f; text-decoration: none; word-break: normal; }
.prot-note.warn { color: var(--warn); font-weight: 600; }
.act-sheet { max-height: min(86vh, 720px); overflow-y: auto; }
.act-who { color: var(--fg-dim); letter-spacing: .04em; text-transform: uppercase; }
.act-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-top: 1px solid var(--line); }
.act-row svg { flex: none; color: var(--fg-dim); }
.act-row.warn svg, .act-row.warn b { color: var(--warn); }
.act-row b { font-size: 14px; font-weight: 600; }
.act-pages { padding-top: 10px; border-top: 1px solid var(--line); }
.act-page { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; }
.act-pn { color: var(--fg-dim); }
.act-bar { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.act-bar i { display: block; height: 100%; background: var(--secret); border-radius: 3px; }
.act-pt { color: var(--fg-dim); font-variant-numeric: tabular-nums; }
.prot-recall { display: inline-flex; align-items: center; gap: 5px; color: var(--bad); }
.bubble.doc-recalled .prot-line { margin-top: 0; font-style: italic; font-weight: 500; }
.file-card.protected.gone { opacity: .6; }
.bubble.doc-gone .prot-line { color: var(--fg-dim); }
/* The viewer (screen 4): its tag, the pages-read strip, and nothing to take. */
.lb-protag { display: none; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; color: #d9ccff; background: rgba(167, 139, 250, .22); }
.lightbox.lb-protected .lb-protag { display: inline-flex; }
.lightbox.lb-protected a.lb-btn { display: none; }
.lightbox.lb-protected .lb-page { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.lightbox.lb-protected canvas { pointer-events: none; }
.lb-foot { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 10px 16px 14px; font-size: 13px; color: rgba(255, 255, 255, .8); }
.prot-progress { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .15); overflow: hidden; }
.prot-progress i { display: block; height: 100%; width: 0; background: var(--secret); transition: width .2s; }
/* The viewer on a phone on its side (R3): one slim bar with the byline beside the name, the reading strip a corner pill. */
@media (orientation: landscape) and (max-height: 500px) {
  .lb-bar { padding: 4px 10px; gap: 6px; }
  .lb-btn { width: 34px; height: 34px; }
  .lb-byline { flex-direction: row; align-items: baseline; gap: 8px; }
  .lb-stage { padding: 0 8px 6px; }
  .lb-img { max-height: calc(100dvh - 50px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  .lb-foot { position: absolute; right: calc(12px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom));
    flex-direction: row; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 99px; font-size: 12px;
    background: rgba(12, 15, 22, .82); max-width: 60%; }
  .lb-foot .prot-progress { width: 70px; flex: none; }
  .lb-foot:empty { display: none; }
}
/* A printout of a protected document comes out blank (P8). */
@media print {
  html.lb-protected body * { visibility: hidden !important; }
}

/* ---- the send preview (#159, docs/attach-preview-mockup.html) ---- */
html.sp-on, html.sp-on body { overflow: hidden; }
.sp-back { position: fixed; inset: 0; z-index: 400; background: #0b0e14; color: #e9edf5; display: flex; }
.sp-box { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.sp-top { display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px; }
.sp-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; visibility: hidden; }
.sp-count { position: absolute; left: 50%; transform: translateX(-50%); font-size: 14px; font-weight: 600; color: #aab4c5; }
.sp-tb { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #e9edf5; background: rgba(255, 255, 255, .08); border: 0; padding: 0; flex: none; }
.sp-tb:hover { background: rgba(255, 255, 255, .16); }
.sp-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 4px 0; }
.sp-view { display: block; max-width: 100%; max-height: 100%; object-fit: contain; min-height: 0; }
.sp-badge { display: grid; place-items: center; width: 96px; height: 120px; border-radius: 10px; background: #1d2330; color: #aab4c5; font: 700 15px var(--mono); text-transform: uppercase; max-height: none; }
.sp-badge[data-family="pdf"] { color: #ff8a8a; background: #3a1f26; }
.sp-badge[data-family="doc"] { color: #8ab4ff; background: #1c2a48; }
.sp-badge[data-family="xls"] { color: #6fe0a5; background: #173528; }
.sp-badge[data-family="ppt"] { color: #ffb37a; background: #3a2a1c; }
.sp-badge[data-family="zip"], .sp-badge[data-family="bin"] { color: #e3c06b; background: #33301f; }
/* A PDF's first page (#160): paper on the dark stage. */
.sp-view.sp-page { flex: 0 1 auto; max-height: calc(100% - 64px); background: #fff; border-radius: 4px; box-shadow: 0 6px 24px rgba(0, 0, 0, .45); }
.sp-timg.sp-page { object-fit: cover; object-position: top; background: #fff; }
.sp-shield.on { color: #fff; background: var(--secret); }
.sp-prot { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 14px; background: rgba(167, 139, 250, .18); color: #c9b8ff; font-size: 13px; font-weight: 600; }
.sp-meta { margin: 0; text-align: center; color: #aab4c5; font-size: 13px; display: flex; flex-direction: column; max-width: 90%; }
.sp-meta b { color: #e9edf5; font-size: 15px; }
.sp-strip { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; flex: none; }
.sp-thumb, .sp-add { width: 52px; height: 52px; border-radius: 8px; flex: none; padding: 0; border: 0; overflow: hidden; background: #1d2330; opacity: .7; }
.sp-thumb.on { opacity: 1; outline: 2px solid #6ea8fe; outline-offset: 1px; }
.sp-timg { width: 100%; height: 100%; object-fit: cover; display: grid; place-items: center; font: 700 10px var(--mono); color: #aab4c5; text-transform: uppercase; }
.sp-add { opacity: 1; background: transparent; border: 1.5px dashed #5b667a; color: #aab4c5; display: grid; place-items: center; }
.sp-quote { margin: 0 12px 6px; padding: 6px 10px; border-left: 3px solid #6ea8fe; background: rgba(255, 255, 255, .07); border-radius: 6px; font-size: 13px; color: #c5ccd9; display: flex; flex-direction: column; min-width: 0; }
.sp-quote b { color: #6ea8fe; font-size: 12.5px; }
.sp-to { padding: 0 14px 6px; font-size: 13px; color: #aab4c5; }
.sp-to b { color: #e9edf5; font-weight: 600; }
.sp-bot { display: flex; align-items: flex-end; gap: 8px; padding: 6px 10px 12px; }
.sp-caption { flex: 1; min-height: 44px; max-height: 120px; resize: none; border-radius: 22px; border: 0; background: #1d2330; color: #e9edf5; padding: 11px 16px; font: 16px/1.35 var(--sans); }
.sp-caption::placeholder { color: #8996ab; }
.sp-caption:focus { outline: 2px solid rgba(110, 168, 254, .5); }
.sp-send { position: relative; width: 50px; height: 50px; border-radius: 50%; border: 0; padding: 0; background: #2f6fd6; color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 4px 14px rgba(47, 111, 214, .5); }
.sp-send:hover { background: #3b7be4; }
.sp-n { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 10px; background: #fff; color: #2f6fd6; font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }
.sp-keys { display: none; margin: 0; padding: 0 14px 12px; color: #7c879c; font-size: 12px; }
.sp-ask-back { position: absolute; inset: 0; z-index: 2; background: rgba(0, 0, 0, .5); display: flex; flex-direction: column; justify-content: flex-end; padding: 10px; }
.sp-ask { display: flex; flex-direction: column; gap: 8px; }
.sp-ask-grp { background: #fff; color: #111b21; border-radius: 14px; overflow: hidden; text-align: center; }
.sp-ask-grp b { display: block; padding: 14px 16px 4px; font-size: 15px; }
.sp-ask-grp p { margin: 0; padding: 0 16px 12px; color: #667781; font-size: 13px; }
.sp-ask-act, .sp-ask-keep { display: block; width: 100%; padding: 13px 16px; border: 0; background: #fff; font-size: 17px; color: #2f6fd6; }
.sp-ask-act { border-top: .5px solid rgba(0, 0, 0, .1); }
.sp-ask-act.bad { color: #d33a3a; }
.sp-ask-keep { border-radius: 14px; font-weight: 600; }
/* On a computer, a dialog in the middle (screen 7). */
/* A box on a computer; a phone on its side keeps the full screen (#165). */
@media (min-width: 700px) and (min-height: 501px), (min-width: 700px) and (pointer: fine), (min-width: 700px) and (pointer: none) {
  .sp-back { background: rgba(4, 8, 16, .6); align-items: center; justify-content: center; padding: 24px; }
  .sp-box { flex: none; width: min(560px, 100%); max-height: min(760px, 100%); background: #151b2b; border: 1px solid #2a3350; border-radius: 16px; overflow: hidden; padding: 0; }
  .sp-top { border-bottom: 1px solid #222b45; padding: 10px 12px 10px 16px; }
  .sp-title { visibility: visible; order: -1; }
  .sp-count { position: static; transform: none; }
  .sp-tb { width: 34px; height: 34px; border-radius: 8px; background: none; color: #aab4c5; }
  .sp-shield.on { color: #fff; background: var(--secret); }
  .sp-close { order: 3; }
  .sp-stage { flex: none; height: min(46vh, 380px); background: #0b0e14; padding: 12px; }
  .sp-view { border-radius: 6px; }
  .sp-send { width: 44px; height: 44px; }
  .sp-caption { min-height: 40px; font-size: 14px; padding: 10px 14px; }
  .sp-keys { display: block; }
  .sp-ask-back { justify-content: center; align-items: center; }
  .sp-ask { width: 320px; }
}

/* A phone on its side (R10, screen 8): the photo or page on the left; the strip, "To", caption and Send on the right. */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  .sp-box { display: grid; grid-template-columns: minmax(0, 1fr) minmax(250px, 38%); grid-template-rows: auto 1fr auto auto auto; column-gap: 12px; }
  .sp-box > * { grid-column: 2; min-width: 0; }
  .sp-box > .sp-stage { grid-column: 1; grid-row: 1 / -1; padding: 8px 0 8px 8px; }
  .sp-top { grid-row: 1; padding: 8px 8px 4px 0; }
  .sp-count { position: static; transform: none; flex: 1; }
  .sp-strip { grid-row: 2; align-self: end; padding: 6px 8px 6px 0; }
  .sp-thumb, .sp-add { width: 44px; height: 44px; }
  .sp-quote { grid-row: 3; margin: 0 8px 6px 0; }
  .sp-to { grid-row: 4; padding: 0 8px 6px 2px; }
  .sp-bot { grid-row: 5; padding: 4px 8px 10px 0; }
  .sp-caption { max-height: 76px; min-height: 40px; padding: 9px 14px; }
  .sp-send { width: 44px; height: 44px; }
  .sp-keys { display: none; }
  .sp-box > .sp-ask-back { grid-column: 1 / -1; grid-row: 1 / -1; justify-content: center; align-items: center; }
  .sp-ask { width: min(340px, 100%); }
}

/* ---- files on their way (#161, docs/attach-preview-mockup.html screen 5) ---- */
.item.up-item { opacity: 1; pointer-events: auto; }
.up-item .bubble.sending { position: relative; }
.up-item:not(.up-failed) .file-preview img, .up-item:not(.up-failed) .file-main { opacity: .75; }
.up-preview { display: block; padding: 0; }
/* The ring fills as the bytes go; --p is set from the upload's progress. */
.up-ring {
  --p: 0; flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 360deg), rgba(255, 255, 255, .18) 0);
  -webkit-mask: radial-gradient(circle, transparent 11px, #000 12px); mask: radial-gradient(circle, transparent 11px, #000 12px);
}
.up-preview .up-ring { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -24px 0 0 -24px; background-color: rgba(0, 0, 0, .35);
  -webkit-mask: radial-gradient(circle, transparent 17px, #000 18px); mask: radial-gradient(circle, transparent 17px, #000 18px); }
.up-foot { font-size: 11.5px; opacity: .8; }
.up-fail { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; padding: 6px 4px 2px; border-top: 1px solid rgba(255, 255, 255, .12); }
.up-why { display: inline-flex; align-items: center; gap: 6px; color: #ffb4a8; font-size: 13px; font-weight: 600; flex: 1 1 160px; min-width: 0; }
.up-why svg { flex: none; }
.up-acts { display: inline-flex; gap: 6px; }
.up-acts .btn-sm { padding: 4px 10px; }
:root[data-theme="light"] .up-why { color: #b42323; }
/* In the send preview: a file that cannot go (A14). */
.sp-bad { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 14px; background: rgba(255, 90, 90, .16); color: #ffb4a8; font-size: 13px; font-weight: 600; }
.sp-thumb.bad { outline: 2px solid #e5484d; outline-offset: 1px; }
.sp-thumb.bad.on { outline-color: #ff8a8a; }
.sp-send:disabled { background: #3a4253; box-shadow: none; cursor: not-allowed; }

/* ---- guest links: Invite a guest (#173, docs/guest-links-mockup.html H1-H5, D1) ---- */
.gl-back { z-index: 455; }
.gl-back.gl-sub { z-index: 465; }
.gl-head { gap: 6px; }
.gl-backbtn { font-size: 20px; line-height: 1; padding: 4px 10px; }
.gl-private { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; background: color-mix(in srgb, var(--accent) 10%, transparent); }
.gl-private svg { flex: none; margin-top: 2px; color: var(--accent); }
.gl-way { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-3); color: var(--fg); text-align: left; cursor: pointer; }
.gl-way b { font-size: 14.5px; }
.gl-sec { margin: 4px 0 0; font-size: 11.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--fg-faint); }
.gl-input { font-size: 16px; padding: 9px 12px; border-radius: 10px; }
.gl-mark { color: var(--warn); font-size: 12.5px; }
.gl-mark:empty { display: none; }
.gl-sees { width: 100%; border: 0; background: none; color: var(--fg); text-align: left; cursor: pointer; }
.gl-label-box { padding-left: 32px; }
.gl-ready { display: flex; gap: 18px; align-items: flex-start; }
.gl-digits { display: flex; gap: 8px; }
.gl-digits span { width: 46px; height: 54px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-3); font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gl-copy-code { align-self: flex-start; }
.gl-shares { display: flex; flex-wrap: wrap; gap: 10px; }
.gl-share { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 64px; padding: 0; border: 0; background: none; color: var(--fg-dim); cursor: pointer; }
.gl-share-ic { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-3); color: var(--fg); }
.gl-wa .gl-share-ic { background: #25d366; color: #fff; }
.gl-sms .gl-share-ic { background: #34c759; color: #fff; }
.gl-qrbtn .gl-share-ic { background: var(--accent); color: #06101f; }
.gl-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: none; width: 168px; }
.gl-qr-img { width: 160px; height: 160px; border-radius: 12px; background: #fff; display: grid; place-items: center; }
.gl-qr-img img { width: 148px; height: 148px; image-rendering: pixelated; }
.gl-qr small { max-width: 168px; color: var(--fg-faint); }
@media (max-width: 760px) {
  .gl-ready { flex-direction: column; align-items: stretch; }
  .gl-qr { align-self: center; }
}
@media (min-width: 761px) { .gl-sheet:has(.gl-ready) { max-width: 600px; } }
.gl-pro-tag { align-self: flex-start; }
.gl-pro-title { font-size: 19px; }
.gl-pro-line { display: flex; align-items: center; gap: 12px; padding: 8px 2px; border-top: 1px solid var(--line); font-size: 14px; }

/* ---- the guest's page (#174, G1-G3) ---- */
.gp-card { max-width: 440px; }
.gp-av { align-self: center; }
.gp-av-neutral { background: var(--bg-3) !important; color: var(--fg-dim); }
.gp-title { font-size: 21px; line-height: 1.25; }
.gp-door-why { font-size: 14px; line-height: 1.45; }
.gp-facts { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.gp-facts svg { vertical-align: -2px; }
.gp-code { display: flex; justify-content: center; gap: 10px; }
.gp-digit { width: 52px; height: 60px; padding: 0; text-align: center; font-size: 26px; font-weight: 700; border-radius: 12px; font-variant-numeric: tabular-nums; }
.gp-code.bad .gp-digit { border-color: var(--bad); color: var(--bad); }
.gp-wrong { padding: 10px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.4; background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--fg); }
.gp-go { min-height: 48px; font-size: 16px; }
.gp-door-ic { align-self: center; width: 60px; height: 60px; display: grid; place-items: center; border-radius: 50%; background: var(--bg-3); color: var(--fg-dim); }
#gp-door[data-door="mine"] .gp-door-ic { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.gp-door-title { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-dim); }
#gp-door[data-door="mine"] .gp-door-title { font-size: 19px; letter-spacing: 0; text-transform: none; color: var(--fg); }
.gp-lang { padding: 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
:lang(en) .gp-lang[data-lang="en"], :lang(es) .gp-lang[data-lang="es"] { text-decoration: none; font-weight: 650; color: var(--fg-dim); }

/* ---- a guest's chat (#176, G4, G4b) ---- */
/* One chat: no tabs, no list, nowhere to go back to. */
body[data-kind="guest"] .appnav,
body[data-kind="guest"] .chats-place > .sidebar,
body[data-kind="guest"] .back-btn,
body[data-kind="guest"] :is(#fm-ginfo, #fm-gadd, #fm-pin, #fm-archive, #remove-friend, #fm-leave, #block-friend) { display: none !important; }
body[data-kind="guest"] .chats-place.console { grid-template-columns: minmax(0, 1fr); }
body[data-kind="guest"] .chats-place > .main { display: flex; }
.guest-bar { display: flex; align-items: center; gap: 8px; padding: 7px 14px; font-size: 12.5px; color: var(--fg-dim); background: var(--bg-2); border-bottom: 1px solid var(--line); }
.guest-bar-ic { display: inline-flex; color: var(--accent); }
.pav-neutral { display: inline-grid; place-items: center; background: var(--bg-3) !important; color: var(--fg-dim); }
.only-secret #c-secret-x { display: none; }
.guest-over { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.guest-over.hidden { display: none; }
.guest-over .center-card { max-width: 440px; }

/* ---- the host's side of a guest (#177, H6-H8) ---- */
.pav-guest { outline: 1.5px dashed var(--accent); outline-offset: 2px; }
.guest-chip { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.link-chip { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.link-row .pav-neutral { font-weight: 700; }
#friend-menu .gtonly { display: none; }
#friend-view.is-guest #friend-menu .gtonly { display: flex; }
#friend-view.is-guest :is(#remove-friend, #fm-pin, #fm-archive) { display: none; }
/* A guest chat whose link has calls off (#179): no way to start one, on either side. */
#friend-view.no-calls #c-call-btn, body:has(#friend-view.no-calls) #contact-call { display: none !important; }
.guest-ios .guest-ios-steps { font-weight: 600; }
/* Notifications, offered to a guest inside their chat (#178). */
.notify-card.in-chat { margin: 8px 12px 0; }
/* Keep it (#181). */
.guest-keep { flex: none; padding: 3px 10px; font-size: 12px; }
/* You > Guest links (#182, H10). */
.glp-av { width: 36px; height: 36px; flex: none; display: inline-grid; place-items: center; border-radius: 50%; font-size: 13px; font-weight: 700; color: var(--fg-dim); background: var(--raised); }
.glp-side { align-items: flex-end; }
.glp-chip.glp-live { color: var(--good); }
.glp-chip.glp-waiting { color: var(--warn); }
.glp-chip.glp-kept { color: var(--accent); }
.glp-chip:is(.glp-blocked, .glp-locked) { color: var(--bad); }
.glp-line { white-space: normal; }
.keep-sheet .gbtn { width: 100%; justify-content: center; }
.keep-sheet .keep-av { align-self: center; }

/* ---- the welcome, once after the first sign-in (#208) ---- */
body.welcoming { overflow: hidden; }
.welcome {
  position: fixed; inset: 0; z-index: 90; height: var(--app-h, 100%); overflow-y: auto; background: var(--bg);
  padding: calc(14px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}
.wel-card { max-width: 440px; min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; }
.wel-step { flex: 1; gap: 12px; }
.wel-steps { display: flex; gap: 6px; margin: 4px 0 6px; }
.wel-steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--bg-3); }
.wel-steps i.on { background: var(--accent); }
.wel-top { display: flex; justify-content: space-between; align-items: center; min-height: 30px; color: var(--fg-faint); font-size: 13px; }
.wel-step h2 { margin: 4px 0 0; font-size: 26px; line-height: 1.2; text-wrap: balance; }
.wel-lead { margin: 0 0 6px; color: var(--fg-dim); font-size: 15px; }
.wel-step > input { font-size: 17px; padding: 12px 14px; border-radius: 12px; }
.wel-step .handle-in input { font-size: 17px; padding-top: 12px; padding-bottom: 12px; }
.wel-why { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: rgba(255, 182, 72, .12); color: var(--warn); font-size: 13.5px; }
.wel-why svg { flex: none; margin-top: 1px; }
.wel-seen { margin-top: 6px; font-size: 12px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--fg-faint); }
.wel-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); }
.wel-row .pav { width: 44px; height: 44px; font-size: 15px; }
.wel-row small, .wel-next-row small, .wel-opt small { color: var(--fg-dim); font-size: 12.5px; }
.wel-hint { margin: 0; color: var(--fg-faint); font-size: 13px; display: flex; gap: 6px; align-items: flex-start; }
.wel-hint svg { flex: none; margin-top: 2px; }
.wel-hint.center { justify-content: center; text-align: center; }
.wel-opt { display: flex; gap: 12px; align-items: center; margin-top: 6px; padding: 12px 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.welcome button.wel-switch { flex: none; border: 0; background: transparent; padding: 6px 0 6px 6px; }
.wel-switch .sw { display: block; margin-left: 0; width: 46px; height: 28px; }
.wel-step .handle-msg { font-size: 13px; color: var(--fg-dim); }
.wel-step .handle-msg.good { color: var(--good); }
.wel-step .handle-msg.bad { color: var(--bad); }
.wel-switch .sw::after { top: 3px; left: 3px; width: 20px; height: 20px; }
.wel-switch[aria-checked="true"] > .sw::after { transform: translateX(18px); }
.wel-photo { display: flex; justify-content: center; margin: 8px 0 4px; }
.wel-av-wrap { position: relative; }
.wel-av-wrap .pav.xl { width: 132px; height: 132px; font-size: 44px; }
.welcome button.wel-cam { position: absolute; right: 0; bottom: 4px; width: 42px; height: 42px; border-radius: 50%; padding: 0; display: grid; place-items: center; background: var(--accent); color: #fff; border: 3px solid var(--bg); }
.wel-colors { justify-content: center; }
.wel-set { margin-top: 28px !important; }
.wel-me { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px; border-radius: 16px; background: var(--bg-2); border: 1px solid var(--line); }
.wel-me .pav.lg { width: 84px; height: 84px; font-size: 28px; margin-bottom: 6px; }
.wel-me b { font-size: 19px; }
.wel-me small { color: var(--fg-dim); }
.welcome button.wel-next-row { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: transparent; color: var(--fg); font-size: 15px; }
.wel-next-row .pav, .wel-plus { width: 38px; height: 38px; flex: none; }
.wel-plus { display: grid; place-items: center; border-radius: 50%; background: var(--good); color: #fff; }
.wel-go { height: 50px; border-radius: 14px; font-size: 16px; margin-top: 12px; }
