/* axork AI. Colors are the tokens below: change --accent to rebrand. */

:root {
  --bg: #EEF1F6;
  --sidebar: #E3E8F1;
  --surface: #FFFFFF;
  --ink: #172036;
  --muted: #5A6478;
  --faint: #838CA0;
  --line: #D3D9E4;
  --hover: rgba(23, 32, 54, 0.06);
  --accent: #2E46F0;
  --accent-ink: #FFFFFF;
  --accent-soft: #DDE2FF;
  --bubble: #DCE2EE;
  --danger: #C93434;
  --ok: #1E9A57;
  --shadow: 0 1px 2px rgba(23, 32, 54, 0.05), 0 10px 30px -14px rgba(23, 32, 54, 0.25);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --chrome-h: 56px;
  --sidebar-w: 256px;

  --display: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --text: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10162A;
    --sidebar: #0B1022;
    --surface: #182037;
    --ink: #E7EBF5;
    --muted: #9AA4BB;
    --faint: #6E7891;
    --line: #283252;
    --hover: rgba(231, 235, 245, 0.07);
    --accent: #8392FF;
    --accent-ink: #0E1430;
    --accent-soft: #252F5C;
    --bubble: #232C48;
    --danger: #F06A6A;
    --ok: #3CC47C;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }

.glyph, .avatar-ai {
  flex: none;
  background: url("favicon.svg") center / cover no-repeat;
}

.primary {
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  padding: 10px 16px;
}
.primary:disabled { opacity: 0.6; cursor: default; }
.ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 7px 14px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.ghost:hover { border-color: var(--faint); }
.wide { width: 100%; }
.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ===================================================================== frame */

.shell {
  height: calc(100 * var(--vh, 1vh));
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}
.shell.collapsed { grid-template-columns: minmax(0, 1fr); }
.shell.collapsed .sidebar { display: none; }

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  padding: 10px 10px 0;
}

.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 10px 6px; }

.mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font: 800 20px/1 var(--display);
  letter-spacing: -0.02em;
  border-radius: 10px;
}
.mark-name { text-transform: uppercase; }
.mark .glyph { width: 28px; height: 28px; border-radius: 9px; }

.new-chat {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 9px 12px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
}
.new-chat:hover { border-color: var(--faint); }
.new-chat svg { color: var(--accent); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--faint);
}
.search:focus-within { border-color: var(--faint); color: var(--muted); }
.search svg { width: 17px; height: 17px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; padding: 8px 0; font-size: 14.5px; }
.search input::placeholder { color: var(--faint); }

.chat-list { flex: 1; overflow-y: auto; margin: 0 -4px; padding: 0 4px 12px; }

.group-label {
  margin: 14px 10px 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--faint);
}

.chat-item { display: flex; align-items: center; border-radius: 10px; }
.chat-item:hover, .chat-item.active { background: var(--hover); }
.chat-item.active { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.chat-item a {
  flex: 1;
  min-width: 0;
  padding: 8px 4px 8px 10px;
  color: inherit;
  text-decoration: none;
  font-size: 14.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 10px;
}
.chat-item .icon-btn { width: 30px; height: 30px; opacity: 0; }
.chat-item:hover .icon-btn, .chat-item.active .icon-btn, .chat-item .icon-btn:focus-visible { opacity: 1; }
.list-empty { margin: 16px 10px; font-size: 14px; color: var(--faint); }

.side-foot { border-top: 1px solid var(--line); margin: 0 -10px; padding: 10px; flex: none; }

.account-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  padding: 8px;
  text-align: left;
}
.account-btn:hover { background: var(--hover); }
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
}
.who { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.who b, .who small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who b { font-weight: 600; font-size: 14.5px; }
.who small { color: var(--muted); font-size: 12.5px; }

.guest-card { padding: 4px 4px 2px; }
.guest-card p { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.guest-card p b { color: var(--ink); font-weight: 600; }
.meter { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin: 0 0 12px; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.guest-actions { display: flex; gap: 8px; }
.guest-actions .primary { flex: 1.3; padding: 9px 8px; font-size: 14px; white-space: nowrap; }
.guest-actions .ghost { flex: 1; justify-content: center; border-radius: 12px; padding: 9px 8px; white-space: nowrap; }

.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(10, 14, 30, 0.45); }

.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 56px;
  padding: 10px 12px;
}
.topbar #open-sidebar { display: none; }
.collapsed .topbar #open-sidebar { display: inline-grid; }
.topbar #new-chat-top { display: none; }
.collapsed .topbar #new-chat-top { display: inline-grid; }

.chat-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding-left: 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ===================================================================== conversation */

.thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.column { max-width: 800px; margin: 0 auto; padding: 8px 24px 28px; }

/* Before the first message, the greeting and message box sit in the middle of the screen. */
.main.empty .thread { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; overflow: visible; }
.main.empty .column { width: 100%; padding-bottom: 20px; }
.main.empty .dock { flex: 1 1 0; }
.main:not(.empty) .welcome, .main:not(.empty) .suggestions { display: none; }

.welcome { text-align: center; }
.greeting {
  margin: 0;
  font: 800 clamp(34px, calc(5.5 * var(--vw, 1vw)), 52px)/1.05 var(--display);
  font-variation-settings: "opsz" 96;
  letter-spacing: -0.035em;
}
.caret {
  display: inline-block;
  width: 0.09em;
  height: 0.78em;
  margin-left: 0.08em;
  vertical-align: -0.04em;
  background: var(--accent);
  border-radius: 0.015em;
  animation: blink 1.1s steps(1) infinite;
}
.welcome-sub { margin: 12px 0 0; font-size: 18px; color: var(--muted); }

.messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 30px; }

.msg-user {
  align-self: flex-end;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
/* A one-word prompt is a pill; long prompts wrap at 75% of the column. */
.msg-user .bubble {
  width: fit-content;
  max-width: 75%;
  box-sizing: border-box;
  background: var(--bubble);
  padding: 10px 16px;
  border-radius: 22px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}
.msg-user .bubble:not(:only-child) { border-bottom-right-radius: 8px; }
.msg-user.drop-here .bubble { outline: 2px dashed var(--accent); outline-offset: 3px; }
.msg-user .msg-files { max-width: 75%; }

.msg-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 240px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13.5px;
}
.file-pill span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-pill.more { padding: 6px 12px; color: var(--muted); }
.thumb {
  display: block;
  width: 88px;
  height: 88px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: zoom-in;
}

.ext {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 700 9.5px/1 var(--text);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.ext[data-kind="pdf"] { background: color-mix(in srgb, #E2483D 16%, var(--surface)); color: #C8372D; }
.ext[data-kind="sheet"] { background: color-mix(in srgb, #1E9A57 16%, var(--surface)); color: #18834A; }
.ext[data-kind="slides"] { background: color-mix(in srgb, #E07A1F 18%, var(--surface)); color: #B9600F; }
.ext[data-kind="code"] { background: var(--hover); color: var(--muted); }

.msg-ai { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; }
.avatar-ai { width: 28px; height: 28px; border-radius: 9px; margin-top: 1px; }
.model-label { margin: 2px 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }

.body { overflow-wrap: anywhere; }
.body > :first-child { margin-top: 0; }
.body > :last-child { margin-bottom: 0; }
.body p, .body ul, .body ol, .body blockquote, .body .code, .body .table-wrap { margin: 0 0 0.8em; }
.body ul, .body ol { padding-left: 1.4em; }
.body ul { list-style: disc; }
.body ol { list-style: decimal; }
.body li { margin: 0.25em 0; }
.body h3, .body h4, .body h5, .body h6 { margin: 1.1em 0 0.4em; line-height: 1.3; font-weight: 600; }
.body h3 { font-size: 1.2em; }
.body h4 { font-size: 1.07em; }
.body h5, .body h6 { font-size: 1em; }
.body strong { font-weight: 600; }
.body a { color: var(--accent); text-underline-offset: 3px; }
.body hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.body blockquote { border-left: 3px solid var(--line); padding-left: 14px; color: var(--muted); }
.body code { font: 0.88em/1.4 var(--mono); background: var(--accent-soft); padding: 0.12em 0.35em; border-radius: 6px; }
.body .code { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.code-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 6px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}
.copy-code { border: 0; border-radius: 8px; background: transparent; color: var(--muted); padding: 3px 8px; font-size: 12.5px; font-weight: 600; }
.copy-code:hover { background: var(--hover); color: var(--ink); }
.body pre { margin: 0; padding: 12px 14px; overflow-x: auto; }
.body pre code { background: none; padding: 0; font-size: 0.86em; line-height: 1.6; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.body table { border-collapse: collapse; width: 100%; font-size: 0.94em; }
.body th, .body td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.body th { background: var(--hover); font-weight: 600; }
.body tr:last-child td { border-bottom: 0; }

.body.streaming > :last-child::after,
.body.streaming:empty::after {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 1em;
  margin-left: 3px;
  vertical-align: -0.15em;
  background: var(--accent);
  border-radius: 2px;
  animation: blink 1s steps(1) infinite;
}

.status-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14.5px; min-height: 26px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: hop 1.2s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }

.ai-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 10px; margin-top: 4px; }
.ai-images figure { margin: 0; position: relative; }
.ai-images img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: zoom-in;
}

.actions { display: flex; gap: 2px; margin: 8px 0 0 -8px; }
.act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--faint);
  padding: 5px 8px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.act:hover { background: var(--hover); color: var(--ink); }
.act svg { width: 16px; height: 16px; }
.stopped-note { margin-top: 6px; font-size: 13px; color: var(--faint); }

.card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.card p { margin: 0; flex: 1 1 240px; }
.card .detail { flex-basis: 100%; order: 5; font: 12.5px/1.5 var(--mono); color: var(--muted); }
.card.error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.card.notice { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.card-actions { display: flex; gap: 8px; }
.card-actions .primary { padding: 8px 14px; font-size: 14px; }

/* ===================================================================== message box */

.dock { padding: 0 16px calc(12px + env(safe-area-inset-bottom)); }

.drift-card {
  max-width: 768px;
  margin: 0 auto 10px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
  box-shadow: var(--shadow);
}
.drift-note { margin: 0 0 6px; font-weight: 600; font-size: 14px; }
.drift-summary { margin: 0 0 8px; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.drift-ask { margin: 0 0 10px; font-size: 13.5px; }
.drift-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.drift-actions .primary, .drift-actions .ghost { padding: 7px 12px; font-size: 13.5px; border-radius: 12px; }

.composer {
  max-width: 768px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 10px 10px 8px 14px;
  transition: border-color 0.15s ease;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }

.composer textarea {
  display: block;
  width: 100%;
  max-height: 240px;
  padding: 6px 4px 8px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: 16px;   /* 16px keeps iPhones from zooming in on tap */
  line-height: 1.5;
}
.composer textarea::placeholder { color: var(--faint); }

.composer-bar { display: flex; align-items: center; gap: 4px; }
.attach { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); }

.picker { position: relative; }
.picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: calc(52 * var(--vw, 1vw));
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 6px 8px 6px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.picker-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.picker-btn:hover, .picker-btn[aria-expanded="true"] { background: var(--hover); color: var(--ink); }
.picker-btn svg { width: 16px; height: 16px; }

.tray-count { margin-left: auto; padding: 0 6px; font-size: 12.5px; color: var(--faint); white-space: nowrap; }
.tray-count.over { color: var(--danger); }

.send {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
}
.send:disabled { background: var(--line); color: var(--faint); cursor: default; }
.send .i-stop { display: none; }
.send.stop .i-send { display: none; }
.send.stop .i-stop { display: block; }
.send .i-stop rect { fill: currentColor; stroke: none; }
.composer-bar .send { margin-left: 4px; }
.tray-count:empty + .send { margin-left: auto; }

.tray { display: flex; flex-wrap: wrap; gap: 8px; max-height: 196px; overflow-y: auto; padding: 2px 0 10px; }
.att {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 224px;
  padding: 6px 4px 6px 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
}
.att .ext { width: 36px; height: 36px; border-radius: 9px; font-size: 10px; }
.att img { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; }
.att-name { display: block; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-meta { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att.failed { border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.att.failed .att-meta { color: var(--danger); }
.att .icon-btn { width: 26px; height: 26px; border-radius: 8px; }
.att .icon-btn svg { width: 15px; height: 15px; }
.att-bar { position: absolute; left: 0; bottom: 0; height: 2px; background: var(--accent); transition: width 0.2s ease; }
.att > span { min-width: 0; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att > span small { display: block; font-size: 12px; font-weight: 400; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.att.failed > span small { color: var(--danger); }
.att.busy::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 40%; background: var(--accent); animation: att-busy 1.2s ease-in-out infinite; }
@keyframes att-busy { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .att.busy::after { animation: none; width: 100%; opacity: 0.5; } }
.send.queue { background: color-mix(in srgb, var(--accent) 82%, var(--ink)); }

.suggestions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 768px; margin: 14px auto 0; }
.suggestion {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  padding: 8px 14px;
  font-size: 14px;
  color: var(--muted);
}
.suggestion:hover { background: var(--surface); color: var(--ink); }

.hint { max-width: 768px; margin: 8px auto 0; text-align: center; font-size: 12.5px; color: var(--faint); min-height: 1.4em; }
.hint .link { font-size: inherit; }

/* ===================================================================== menus, dialogs, toasts */

.menu {
  position: fixed;
  z-index: 60;
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.menu > button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: transparent;
  padding: 8px 10px;
  font-size: 14.5px;
  text-align: left;
}
.menu > button:hover, .menu > button:focus-visible { background: var(--hover); }
.menu > button.danger { color: var(--danger); }
.menu svg { width: 17px; height: 17px; }

.model-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  top: auto;
  width: min(360px, calc(calc(100 * var(--vw, 1vw)) - 32px));
  max-height: min(calc(70 * var(--vh, 1vh)), 520px);
  overflow-y: auto;
}
.model-menu.down { top: calc(100% + 10px); bottom: auto; }
.model-option {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 20px;
  gap: 2px 10px !important;
  align-items: start !important;
  padding: 10px 12px !important;
}
.model-option .m-name { font-weight: 600; font-size: 14.5px; }
.model-option .m-desc { grid-column: 1; font-size: 13px; color: var(--muted); line-height: 1.4; }
.model-option .m-tags { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.model-option .m-check { grid-column: 2; grid-row: 1; color: var(--accent); visibility: hidden; }
.model-option[aria-checked="true"] .m-check { visibility: visible; }
.model-option.locked { opacity: 0.6; }
.tag {
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--hover);
  color: var(--muted);
}
.tag.adv { background: var(--accent-soft); color: var(--accent); }
.menu-section { margin: 8px 12px 4px; font-size: 12.5px; font-weight: 600; color: var(--faint); }

.dialog {
  width: min(400px, calc(calc(100 * var(--vw, 1vw)) - 32px));
  border: 0;
  border-radius: 22px;
  padding: 30px 28px 24px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.dialog::backdrop, .lightbox::backdrop { background: rgba(8, 12, 28, 0.55); }
.auth { display: flex; flex-direction: column; gap: 14px; }
.auth h2 { margin: 4px 0 0; font: 800 26px/1.15 var(--display); letter-spacing: -0.02em; }
.auth-sub { margin: -6px 0 4px; color: var(--muted); font-size: 15px; }
.glyph.big { width: 40px; height: 40px; border-radius: 12px; }
.dialog-close { position: absolute; top: 14px; right: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13.5px; font-weight: 600; }
.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  padding: 11px 12px;
  font-size: 16px;
  outline: 0;
}
.field input:focus { border-color: var(--accent); }
.auth-error { margin: 0; min-height: 1.2em; color: var(--danger); font-size: 14px; }
.auth-error:empty { display: none; }
.auth .primary { padding: 12px 16px; font-size: 15px; }
.auth-switch { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }

.lightbox {
  max-width: calc(94 * var(--vw, 1vw));
  max-height: calc(94 * var(--vh, 1vh));
  border: 0;
  border-radius: 18px;
  padding: 10px;
  background: var(--surface);
}
.lightbox img { display: block; max-width: calc(calc(94 * var(--vw, 1vw)) - 20px); max-height: calc(calc(94 * var(--vh, 1vh)) - 80px); border-radius: 12px; margin: 0 auto; }
.lightbox-bar { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 2px 2px; }

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, rgba(8, 12, 28, 0.35));
}
.drop-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 48px;
  border: 2px dashed var(--accent);
  border-radius: 22px;
  background: var(--surface);
  text-align: center;
}
.drop-card svg { width: 36px; height: 36px; color: var(--accent); }
.drop-card p { margin: 6px 0 0; font-size: 18px; font-weight: 600; }
.drop-card small { color: var(--muted); }

.toasts {
  position: fixed;
  left: 50%;
  top: calc(16px + env(safe-area-inset-top));
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(calc(100 * var(--vw, 1vw)) - 32px);
  pointer-events: none;
}
.toast {
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  box-shadow: var(--shadow);
}

/* ===================================================================== sign-in */

.providers { display: flex; flex-direction: column; gap: 8px; }
.provider-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
}
.provider-btn:hover { border-color: var(--faint); background: var(--bg); }
.provider-btn img { width: 20px; height: 20px; object-fit: contain; }
.provider-btn.busy { opacity: 0.7; pointer-events: none; }

.or { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.email-form { display: flex; flex-direction: column; gap: 12px; }

.check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
.auth-fine { margin: -4px 0 0; font-size: 13px; color: var(--faint); text-align: center; }
.construct-copy { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.5; text-align: center; }

.switch-row, .sec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.switch-row span, .sec-row span { display: flex; flex-direction: column; gap: 3px; }
.switch-row b, .sec-row b { font-weight: 600; font-size: 15px; }
.switch-row small, .sec-row small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.switch-row { cursor: pointer; }
.switch-row input {
  appearance: none;
  flex: none;
  position: relative;
  width: 44px;
  height: 26px;
  margin: 0;
  border-radius: 99px;
  background: var(--line);
  cursor: pointer;
  transition: background 0.15s ease;
}
.switch-row input::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.switch-row input:checked { background: var(--accent); }
.switch-row input:checked::after { transform: translateX(18px); }
.sec-row .ghost:disabled { opacity: 0.5; cursor: default; }

.dialog-back { position: absolute; top: 14px; left: 14px; }
.dialog-back:not([hidden]) ~ h2 { margin-top: 28px; }
.auth-step { display: flex; flex-direction: column; gap: 12px; }
.who-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  font-size: 14.5px;
}
.who-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.link.center { align-self: center; font-size: 14px; }
.ghost.wide { justify-content: center; border-radius: 12px; padding: 11px 16px; font-size: 15px; }

.wide-dialog { width: min(560px, calc(calc(100 * var(--vw, 1vw)) - 24px)); max-height: calc(calc(100 * var(--vh, 1vh)) - 32px); overflow-y: auto; }
.sec-block { padding: 16px 0 6px; border-top: 1px solid var(--line); }
.sec-block h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.sec-note { margin: 0 0 12px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.sec-head .ghost:disabled { opacity: 0.5; cursor: default; }
.pw-form { display: flex; flex-direction: column; gap: 12px; }
.pw-form .primary { align-self: flex-start; }

.mail-list { list-style: none; margin: 6px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mail-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-family: var(--mono); font-size: 14px; }
.mail-list .tag { font-family: var(--text); }
.device-list { list-style: none; margin: 0; padding: 0; }
.device {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.device:last-child { border-bottom: 0; }
.device-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.device-info b { font-weight: 600; font-size: 14.5px; }
.device-info small { font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.device .ghost { flex: none; }

/* ---------- new-password helper */

.pw-meter { display: none; margin-top: -4px; font-size: 13px; }
.pw-meter.active { display: block; }
.pw-bar { display: inline-flex; gap: 4px; vertical-align: middle; }
.pw-bar i { width: 34px; height: 5px; border-radius: 99px; background: var(--line); }
.pw-bar i.on.s1 { background: var(--danger); }
.pw-bar i.on.s2 { background: #D98A12; }
.pw-bar i.on.s3 { background: color-mix(in srgb, var(--ok) 70%, var(--accent)); }
.pw-bar i.on.s4 { background: var(--ok); }
.pw-label { margin-left: 8px; font-weight: 600; color: var(--muted); }
.pw-rules { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 12px; text-align: left; }
.pw-rules li { color: var(--muted); padding-left: 20px; position: relative; }
.pw-rules li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.42em;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--faint);
}
.pw-rules li.met { color: var(--ink); }
.pw-rules li.met::before { border-color: var(--ok); background: var(--ok); }
.pw-server { margin: 6px 0 0; color: var(--danger); font-weight: 500; }
.pw-server:empty { display: none; }

/* ---------- the code page */

body.verify-page { overflow: auto; }
.verify {
  min-height: calc(100 * var(--vh, 1vh));
  min-height: calc(100 * var(--vh, 1vh));
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px calc(40px + env(safe-area-inset-bottom));
}
.verify .mark { align-self: flex-start; margin: 0 0 auto; }
.verify-card {
  width: min(440px, 100%);
  margin: 40px 0 auto;
  padding: 34px 30px 26px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.verify-card h1 { margin: 0; font: 800 28px/1.15 var(--display); letter-spacing: -0.025em; }
.verify-sub { margin: 10px 0 26px; color: var(--muted); font-size: 15.5px; line-height: 1.5; overflow-wrap: anywhere; }
.verify-sub b { color: var(--ink); font-weight: 600; font-family: var(--mono); font-size: 0.95em; letter-spacing: 0.01em; }

.code-boxes { display: flex; justify-content: center; gap: 8px; margin: 0; padding: 0; border: 0; }
.code-boxes input {
  width: 48px;
  height: 58px;
  padding: 0;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  text-align: center;
  font: 600 24px/1 var(--mono);
  outline: 0;
  caret-color: var(--accent);
}
.code-boxes input:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.code-boxes input:disabled { opacity: 0.55; }
.code-gap { width: 8px; }

.code-msg { min-height: 1.45em; margin: 14px 0 12px; font-size: 14.5px; font-weight: 500; color: var(--danger); }
.form-card { text-align: left; }
.form-card h1, .form-card .verify-sub, .form-card .step-count { text-align: center; }
.form-card form { display: flex; flex-direction: column; gap: 12px; }
.form-card .code-msg { margin: 2px 0 0; min-height: 1.4em; }
.form-card .skip { margin-top: 4px; }
.step-count { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--accent); }
.step-count:empty { display: none; }
.at-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  padding-left: 12px;
  font-size: 16px !important;
  font-weight: 400 !important;
}
.at-input:focus-within { border-color: var(--accent); }
.at-input span { color: var(--muted); }
.at-input input { flex: 1; min-width: 0; border: 0 !important; background: transparent !important; padding-left: 4px !important; }
.code-msg[data-kind="ok"] { color: var(--ok); }
#code-form .check { justify-content: center; margin-bottom: 16px; }
#code-form .primary { padding: 12px 16px; font-size: 15px; }
.verify-meta { margin: 16px 0 6px; font-size: 13px; color: var(--faint); }
.verify-actions { display: flex; justify-content: center; align-items: center; gap: 12px; font-size: 14px; }
.verify-actions .link:disabled { color: var(--faint); text-decoration: none; cursor: default; }
.link.muted { color: var(--muted); }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }

@media (max-width: 420px) {
  .verify-card { padding: 28px 18px 22px; border-radius: 20px; }
  .code-boxes { gap: 6px; }
  .code-boxes input { width: 42px; height: 52px; font-size: 22px; }
  .code-gap { width: 4px; }
}

/* ===================================================================== phones and small windows */

@media (max-width: 860px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .shell.collapsed .sidebar { display: flex; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: min(calc(86 * var(--vw, 1vw)), 320px);
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }
  .shell.drawer-open .sidebar { transform: none; }
  .topbar #open-sidebar, .topbar #new-chat-top { display: inline-grid; }
  .chat-item .icon-btn { opacity: 1; }
  .column { padding: 8px 16px 24px; }
  .dock { padding: 0 10px calc(10px + env(safe-area-inset-bottom)); }
  .main.empty .dock { flex: 0 0 auto; }
  .main.empty .thread { flex: 1 1 auto; justify-content: center; }
  .att { width: calc(50% - 4px); min-width: 150px; }
  .msg-ai { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .msg-ai .avatar-ai { display: none; }
}

@media (min-width: 861px) {
  #close-sidebar { display: inline-grid; }
}

@keyframes blink { 50% { opacity: 0; } }
@keyframes hop { 0%, 70%, 100% { opacity: 0.35; transform: none; } 35% { opacity: 1; transform: translateY(-3px); } }

@media (prefers-reduced-motion: reduce) {
  .caret, .dots i, .body.streaming > :last-child::after, .body.streaming:empty::after { animation: none !important; }
  .sidebar, .composer, .att-bar, .switch-row input, .switch-row input::after { transition: none !important; }
}

/* ===================================================================== plans and owner pages */

body.page { overflow: auto; }
.page-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--chrome-h);
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 40;
}
.page-top .mark { font-size: 18px; }
.page-main { width: min(1120px, 100%); margin: 0 auto; padding: 16px 20px 64px; }
body.page.drive-page, body.page.vault-page, body.page.settings-page {
  min-height: calc(100 * var(--vh, 1vh));
  display: flex;
  flex-direction: column;
}
body.page.drive-page .page-main,
body.page.vault-page .page-main,
body.page.settings-page .page-main { flex: 1; width: min(1120px, 100%); }
.page-title { margin: 28px 0 8px; text-align: center; font: 800 clamp(30px, calc(5 * var(--vw, 1vw)), 44px)/1.08 var(--display); letter-spacing: -0.03em; }
.page-sub { margin: 0 auto 28px; max-width: 620px; text-align: center; color: var(--muted); }
.page-title.left, .page-sub.left { text-align: left; margin-left: 0; max-width: none; }
.eyebrow { margin: 0 0 2px; font-size: 13px; font-weight: 600; color: var(--accent); }
.fine { color: var(--faint); font-size: 13px; text-align: center; margin: 14px 0 0; }
.btn-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.primary.soft { background: var(--accent-soft); color: var(--accent); }
.ghost.danger { color: var(--danger); }
.ghost.tiny { padding: 4px 10px; font-size: 13px; }
.ghost.wide, .primary.wide { width: 100%; justify-content: center; }
.paypal { border-radius: 12px; padding: 9px 14px; }

.banner { margin: 0 auto 16px; max-width: 720px; padding: 12px 16px; border-radius: 14px; font-weight: 500;
  background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ink); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.banner[data-kind="error"] { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }

.usage-panel, .panel {
  margin: 0 0 24px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.usage-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.usage-head h2 { margin: 0; font: 800 26px/1.15 var(--display); letter-spacing: -0.02em; }
.usage-sub { margin: 4px 0 0; color: var(--muted); }
.usage-manage { display: flex; gap: 8px; flex-wrap: wrap; }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 28px; margin-top: 18px; }
.meter-row { min-width: 0; }
.meter-label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 6px; }
.meter-label span { color: var(--muted); }
.meter.big { height: 10px; margin: 0; }
.meter i[data-level="high"] { background: var(--danger); }
.meter-note { grid-column: 1 / -1; margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px 20px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}
.plan-card.highlight { border: 2px solid var(--accent); padding: 21px 19px 19px; box-shadow: var(--shadow); }
.plan-card.current { background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.plan-flag { position: absolute; top: -12px; left: 18px; padding: 3px 10px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 600; }
.plan-card h3 { margin: 0; font: 800 22px/1.2 var(--display); }
.plan-tag { margin: 4px 0 14px; color: var(--muted); font-size: 14px; min-height: 2.9em; }
.plan-price { margin: 0 0 16px; display: flex; align-items: baseline; gap: 6px; }
.plan-price b { font: 800 36px/1 var(--display); letter-spacing: -0.03em; }
.plan-price span { color: var(--muted); font-size: 14px; }
.plan-actions { display: flex; flex-direction: column; gap: 8px; min-height: 44px; margin-bottom: 16px; }
.plan-state { margin: 0; padding: 10px 0; text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); }
.plan-card ul { margin: 0; padding: 14px 0 0; list-style: none; border-top: 1px solid var(--line); display: grid; gap: 9px; font-size: 14.5px; }
.plan-card li { position: relative; padding-left: 24px; }
.plan-card li::before { content: ""; position: absolute; left: 2px; top: 6px; width: 12px; height: 7px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }

.credits-section { margin-top: 48px; }
.credits-section h2 { margin: 0 0 6px; text-align: center; font: 800 28px/1.2 var(--display); letter-spacing: -0.02em; }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; max-width: 820px; margin: 0 auto; }
.pack-card { padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.pack-credits { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pack-credits b { font: 800 24px/1 var(--display); }
.pack-price { margin: 0 0 10px; color: var(--muted); }
.pack-actions { display: flex; gap: 8px; }
.pack-actions > * { flex: 1; justify-content: center; }
.credits-section .switch-row { max-width: 820px; margin: 18px auto 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }

/* owner */
.wide-main { width: min(1240px, 100%); }
.owner-nav { display: flex; gap: 18px; font-size: 14px; font-weight: 500; }
.owner-nav a { color: var(--muted); text-decoration: none; }
.owner-nav a:hover { color: var(--ink); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi { padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.kpi p { margin: 0 0 6px; color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi b { display: block; font: 800 26px/1.1 var(--display); letter-spacing: -0.02em; }
.kpi small { color: var(--faint); font-size: 12.5px; }
.panel h2 { margin: 0 0 12px; font: 800 20px/1.2 var(--display); }
.panel h3 { margin: 18px 0 8px; font-size: 15px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }
.panel-actions { display: flex; gap: 8px; }
.legend { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 10px; }
.key.rev { background: var(--accent); }
.key.cost { background: var(--faint); }
.chart svg { width: 100%; height: auto; display: block; stroke: none; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .tick { fill: var(--faint); stroke: none; font-size: 11px; font-weight: 400; font-family: var(--text); }
.chart .bar.rev { fill: var(--accent); }
.chart .bar.cost { fill: var(--faint); }
.plan-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { padding: 6px 14px; border-radius: 99px; background: var(--hover); font-size: 14px; }
.search-box { display: flex; gap: 8px; }
.search-box input { width: min(320px, calc(60 * var(--vw, 1vw))); padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data td small { display: block; color: var(--faint); font-size: 12.5px; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .bad { color: var(--danger); }
table.data .empty { text-align: center; color: var(--faint); padding: 24px; }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .ghost + .ghost { margin-left: 6px; }
table.edit input { width: 100%; min-width: 72px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); text-align: inherit; }
table.edit td.num input { text-align: right; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.json-box { width: 100%; min-height: 420px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font: 13px/1.5 var(--mono); }

@media (max-width: 980px) {
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .owner-nav { display: none; }
}
@media (max-width: 600px) {
  .plan-grid, .two-col { grid-template-columns: 1fr; }
  .plan-tag { min-height: 0; }
  .usage-panel, .panel { padding: 18px 16px; }
  .page-top .ghost { padding: 6px 12px; }
}

/* ===================================================================== sections: mail and messages */

.side-apps { display: grid; gap: 2px; margin: 0 0 10px; }
.side-apps a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px;
  color: var(--ink); text-decoration: none; font-size: 14.5px; font-weight: 500;
}
.side-apps a:hover { background: var(--hover); }
.side-apps svg { width: 18px; height: 18px; color: var(--muted); }
.side-apps b { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 12px; text-align: center; }

.mail-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 99px; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 500;
}
.mail-toggle svg { width: 17px; height: 17px; }
.mail-toggle:hover { color: var(--ink); border-color: var(--faint); }
.mail-toggle[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
@media (max-width: 560px) { .mail-toggle span { display: none; } .mail-toggle { padding: 0 9px; } }

.app-nav {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--hover);
  overflow-x: auto;
  max-width: min(720px, 100%);
  scrollbar-width: none;
}
.app-nav::-webkit-scrollbar { display: none; }
.app-nav a {
  flex: none;
  padding: 6px 12px;
  border-radius: 9px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}
.app-nav a:hover { color: var(--ink); }
.app-nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

body.mail-page { display: flex; flex-direction: column; height: calc(100 * var(--vh, 1vh)); overflow: hidden; }
.mail-page .banner { margin: 0 16px 12px; max-width: none; }
.mail-intro { flex: 1; overflow: auto; display: flex; justify-content: center; padding: 8px 16px 40px; }
.intro-card { width: min(520px, 100%); margin-top: 24px; height: max-content; }
.intro-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); margin-bottom: 14px; }
.intro-icon svg { width: 28px; height: 28px; }
.intro-address { margin: -8px 0 20px; font: 600 20px/1.3 var(--mono); color: var(--accent); overflow-wrap: anywhere; }
.intro-actions { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.intro-sync { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.intro-sync p { width: 100%; margin: 6px 0 0; }
.intro-points { margin: 24px 0 0; padding: 18px 0 0; border-top: 1px solid var(--line); list-style: none; text-align: left; display: grid; gap: 10px; color: var(--muted); font-size: 14.5px; }
.intro-points li { padding-left: 22px; position: relative; }
.intro-points li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 10px; height: 6px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }

.page-tools { display: flex; align-items: center; gap: 8px; }
.mail-page { background: var(--bg); }
.mail-app {
  flex: 1; min-height: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr) minmax(300px, 380px);
  margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; background: var(--surface); overflow: hidden;
}
.mail-app.ai-out { grid-template-columns: 240px minmax(0, 1fr); }
.mail-app.ai-out .mail-ai { display: none; }
.mail-side { padding: 16px 12px; border-right: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; gap: 14px; background: var(--sidebar); }
.mail-side .primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.mail-side .primary svg { width: 17px; height: 17px; }
.folders { display: grid; gap: 2px; }
.folder { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; text-align: left; font-size: 14.5px; }
.folder svg { width: 18px; height: 18px; color: var(--muted); }
.folder:hover { background: var(--hover); }
.folder.active { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-weight: 600; }
.folder b { margin-left: auto; font-size: 12.5px; color: var(--accent); }
.side-block { border-top: 1px solid var(--line); padding-top: 12px; }
.side-label { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.side-note { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.addr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.addr-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; }
.addr-list .addr { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.addr-list .link { font-size: 12px; }
.alias-form { display: flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.alias-form input { width: 92px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 13px; }
.sync-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.mail-stream { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); }
.stream-bar { display: flex; align-items: center; gap: 8px; padding: 10px 10px 0; }
.mail-search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; margin: 0; padding: 0 12px; border-radius: 12px; background: var(--hover); color: var(--faint); }
.mail-search input { flex: 1; min-width: 0; padding: 9px 0; border: 0; background: transparent; outline: 0; }
.density { display: flex; flex: none; padding: 3px; border-radius: 10px; background: var(--hover); }
.density button { border: 0; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 5px 8px; border-radius: 8px; }
.density button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.ai-toggle { display: none; }
.ai-away { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.ai-away .link { font-size: 12.5px; }
.mail-split { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.msg-list { list-style: none; margin: 0; padding: 8px 6px 12px; overflow: auto; flex: 1; min-height: 0; }
.mail-stream.open .msg-list { flex: 0 1 40%; }
.msg-row { width: 100%; display: grid; gap: 2px; padding: 10px 12px; border: 0; border-radius: 12px; background: none; text-align: left; }
.msg-row:hover { background: var(--hover); }
.msg-row.active { background: var(--accent-soft); }
.row-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.row-top b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-top time, .row-top .row-meta { flex: none; color: var(--faint); font-size: 12.5px; }
.row-top .row-meta time { color: inherit; }
.row-subject { display: flex; align-items: center; gap: 4px; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row-subject svg { width: 14px; height: 14px; color: var(--faint); }
.row-snippet { font-size: 13px; color: var(--muted); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.msg-row.unread b, .msg-row.unread .row-subject { font-weight: 700; }
.msg-row.unread .row-top b::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
.row-chips { display: none; }
.row-chip { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 1px 7px; border-radius: 99px; background: var(--hover); color: var(--muted); font-size: 11.5px; }
.list-empty { padding: 40px 12px; text-align: center; color: var(--faint); font-size: 14px; }


.mail-read { overflow: auto; padding: 18px 26px 30px; min-width: 0; min-height: 0; }
.mail-stream.open .mail-read { flex: 1 1 60%; border-top: 1px solid var(--line); }
.mail-stream:not(.open) .mail-read { display: none; }
.read-empty { height: 100%; display: grid; place-content: center; text-align: center; color: var(--muted); max-width: 360px; margin: 0 auto; }
.read-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.read-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.back-btn { display: none; }
#read h1 { margin: 0 0 14px; font: 700 23px/1.25 var(--display); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.read-meta { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.read-meta .avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.read-meta div { flex: 1; min-width: 0; display: grid; }
.read-meta b { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.read-meta small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.read-meta time { flex: none; color: var(--faint); font-size: 13px; }
.read-files, .c-files { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; font-size: 13.5px; max-width: 100%; }
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip small { color: var(--faint); }
.file-chip svg { width: 16px; height: 16px; color: var(--accent); }
.read-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.6; }
.read-html { width: 100%; min-height: calc(60 * var(--vh, 1vh)); border: 1px solid var(--line); border-radius: 12px; background: #fff; }

dialog.compose { width: min(640px, calc(100% - 24px)); padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.compose.small { width: min(440px, calc(100% - 24px)); }
dialog.compose.gmail-dialog { width: min(680px, calc(100% - 24px)); max-height: calc(100% - 48px); overflow: hidden; display: flex; flex-direction: column; }
dialog.compose::backdrop { background: rgba(10, 14, 30, 0.45); }
dialog.compose form { display: flex; flex-direction: column; padding: 18px 20px 16px; gap: 2px; }
dialog.compose form.gmail-compose { padding: 0; gap: 0; max-height: calc(100vh - 80px); min-height: 480px; }
dialog.compose .gmc-body { min-height: 220px; }
dialog.compose .gmc-head { padding: 12px 12px 10px 16px; margin: 0; border-bottom: 1px solid var(--line); gap: 6px; }
dialog.compose .gmc-head h2 { font: 600 16px/1.2 var(--text); }
.compose-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.compose-head h2 { margin: 0; font: 700 20px/1.2 var(--display); }
.c-row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.c-row span { width: 64px; flex: none; color: var(--muted); font-size: 14px; }
.c-row input, .c-row select { flex: 1; min-width: 0; padding: 10px 0; border: 0; background: transparent; outline: 0; }
#c-text { margin-top: 10px; padding: 10px 0; border: 0; background: transparent; resize: vertical; outline: 0; font-size: 15px; line-height: 1.55; }
.compose-foot { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.compose-foot .primary { margin-left: auto; }
.attach-label { cursor: pointer; }
dialog.compose .field { display: grid; gap: 4px; margin-top: 10px; font-size: 14px; font-weight: 500; }
dialog.compose .field input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }

.mail-ai {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background:
    radial-gradient(120% 72% at 50% -18%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 58%),
    var(--sidebar);
}
.ai-head { display: flex; align-items: flex-start; gap: 8px; padding: 14px 12px 8px; }
.ai-head div { flex: 1; min-width: 0; display: grid; }
.ai-head b { font: 700 16px/1.2 var(--display); }
.ai-head small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-close { display: none; }
.ai-log { list-style: none; margin: 0; padding: 8px 12px 12px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.ai-msg { max-width: 100%; }
.ai-bub { padding: 8px 10px; border-radius: 12px; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.ai-msg.user { align-self: flex-end; max-width: 92%; }
.ai-msg.user .ai-bub { background: var(--accent-soft); white-space: pre-wrap; }
.ai-msg.assistant .ai-bub { background: var(--surface); border: 1px solid var(--line); }
.ai-msg.assistant .ai-bub > :first-child { margin-top: 0; }
.ai-msg.assistant .ai-bub > :last-child { margin-bottom: 0; }
.ai-msg.note { align-self: center; color: var(--faint); font-size: 12.5px; text-align: center; }
.ai-form { display: flex; flex: none; gap: 8px; align-items: flex-end; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.ai-form textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 120px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); resize: none; outline: 0; }
.ai-form textarea:focus { border-color: var(--accent); }
.ai-form .primary { flex: none; }
/* The chat dock bubble sits on the bottom-right corner of this page. */
body.mail-page .ai-form { padding-right: 76px; }
.ai-scrim { display: none; }
body.mail-assistant-page { height: 100%; overflow: hidden; background:
  radial-gradient(120% 72% at 50% -18%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 58%),
  var(--bg); }
body.mail-assistant-page .mail-ai { height: 100%; background: transparent; }
body.mail-assistant-page .ai-close { display: none; }

@media (max-width: 1179px) {
  .mail-app, .mail-app.ai-out { grid-template-columns: 220px minmax(0, 1fr); }
  .mail-ai {
    position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100%); z-index: 30;
    border-left: 1px solid var(--line); transform: translateX(105%);
  }
  .mail-app.ai-open:not(.ai-out) .mail-ai { transform: none; }
  .mail-app.ai-open:not(.ai-out) .ai-scrim { display: block; position: fixed; inset: 0; z-index: 29; border: 0; background: rgba(10, 14, 30, 0.4); }
  .ai-toggle, .ai-close { display: inline-grid; }
  .mail-app.ai-out .mail-ai { display: none; }
}
@media (max-width: 800px) {
  .mail-stream.open .mail-read { display: none; }
  body.reading .mail-read { display: block; position: fixed; inset: 0; z-index: 24; background: var(--surface); padding: 14px 18px 30px; border-top: 0; }
  body.reading .back-btn { display: inline-grid; }
  .density button { padding: 5px 6px; }
}
@media (max-width: 680px) {
  .app-nav a { padding: 6px 10px; }
  .page-top > .ghost, .page-tools .ghost { display: none; }
  .mail-app, .mail-app.ai-out { grid-template-columns: 1fr; margin: 0; border-radius: 0; border-width: 1px 0 0; }
  .mail-side { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; gap: 8px; }
  .mail-side .side-block { display: none; }
  .mail-side .primary { width: auto; }
  .folders { display: flex; overflow-x: auto; }
  .folder { white-space: nowrap; }
  .stream-bar { flex-wrap: wrap; }
  .density { order: 3; }
  .density-fovea .msg-row, .mail-app[data-density="fovea"] .msg-row { grid-template-columns: minmax(72px, 34%) minmax(0, 1fr) auto; }
}

/* messages */
.msgr { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px minmax(0, 1fr) auto; margin: 0;
  border: 0; border-top: 1px solid var(--line); border-radius: 0; background: var(--surface); overflow: hidden; }
.msgr-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--sidebar); }
.msgr-side-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px; }
.msgr-side-head h1 { margin: 0; font: 800 20px/1.2 var(--display); }
.tiny-primary { padding: 6px 14px; font-size: 14px; border-radius: 10px; }
.conv-list { list-style: none; margin: 0; padding: 4px 6px; overflow: auto; flex: 1; }
.contacts-block { padding: 12px 14px 14px; max-height: 45%; overflow: auto; }
.add-contact { display: flex; gap: 6px; margin: 8px 0 10px; }
.add-contact input, .add-contact select { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 13.5px; }
.people, .decisions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.people li, .decisions li { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.people li > span:first-child, .decisions li > span:first-child { flex: 1; min-width: 0; display: grid; }
.people small, .decisions small { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.msgr-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.conv { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.conv-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.conv-title { flex: 1; min-width: 140px; display: grid; }
.conv-title h2 { margin: 0; font: 700 18px/1.25 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-title small { color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--hover); }
.tabs button { border: 0; padding: 6px 12px; border-radius: 9px; background: none; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.consent-bar { padding: 8px 16px; font-size: 13px; background: var(--hover); color: var(--muted); border-bottom: 1px solid var(--line); }
.consent-bar[data-on="true"] { background: var(--accent-soft); color: var(--accent); }
.bubbles { list-style: none; margin: 0; padding: 16px; flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: min(680px, 88%); padding: 10px 14px; border-radius: 16px; background: var(--bubble); align-self: flex-start; }
.bubble.mine { align-self: flex-end; background: var(--accent-soft); }
.bubble.ai { background: transparent; border: 1px solid var(--line); max-width: min(760px, 96%); }
.bubble.snippet { border-left: 3px solid var(--accent); }
.bubble.private { outline: 1px dashed var(--faint); }
.bubble.system { align-self: center; background: none; padding: 2px 8px; color: var(--faint); font-size: 12.5px; text-align: center; }
.bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.system p { white-space: normal; }
.bubble .md > :first-child { margin-top: 0; }
.bubble .md > :last-child { margin-bottom: 0; }
.bubble.thinking .md::after { content: "Thinking…"; color: var(--faint); }
.b-meta { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; font-size: 12.5px; }
.b-meta b { font-weight: 600; }
.b-meta small { color: var(--faint); }
.b-meta time { margin-left: auto; color: var(--faint); }
button.file-chip { background: var(--surface); cursor: pointer; }
.conv-compose { border-top: 1px solid var(--line); padding: 10px 16px 12px; }
.targets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-bottom: 8px; }
.targets .check { font-size: 13.5px; }
.targets select { margin-left: auto; padding: 5px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); font-size: 13px; }
.compose-line { display: flex; align-items: flex-end; gap: 8px; }
.compose-line textarea { flex: 1; min-height: 42px; max-height: 180px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); resize: none; outline: 0; }
.compose-line textarea:focus { border-color: var(--accent); }
.compose-attach { flex: none; width: 40px; height: 40px; color: var(--muted); }
.compose-files { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.compose-file { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 12.5px; }
.compose-file.error { border-color: var(--danger); color: var(--danger); }
.compose-file button { border: 0; background: none; color: var(--faint); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.msgr-scope { display: flex; gap: 4px; padding: 0 12px 10px; }
.msgr-scope-btn { flex: 1; height: 32px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg); color: var(--muted); font: 600 12.5px var(--text); cursor: pointer; }
.msgr-scope-btn[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.msg-row.space b::before { content: none; }
.call-ring { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.call-ring p { margin: 0; flex: 1; font-size: 14px; }
.file-chip.media { flex-direction: column; align-items: stretch; padding: 6px; max-width: min(320px, 100%); }
.file-chip.media img, .file-chip.media video, .dw-media img { display: block; max-width: 100%; max-height: 280px; border-radius: 10px; }
.dw-media { display: block; max-width: min(280px, 100%); }
.space-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.space-link { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--bg); }
.space-link:hover { border-color: var(--accent); }
.space-link small { color: var(--muted); font-size: 12.5px; }
.ax-call { position: fixed; right: 16px; bottom: 88px; z-index: 10050; width: min(360px, calc(100vw - 24px)); border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.ax-call[hidden] { display: none; }
.ax-call-stage { position: relative; aspect-ratio: 4 / 3; background: #10162A; }
.ax-call-remote, .ax-call-local { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #10162A; }
.ax-call-local { width: 28%; height: auto; inset: auto 10px 10px auto; border-radius: 10px; border: 2px solid rgba(255,255,255,0.35); aspect-ratio: 3 / 4; }
.ax-call-label { position: absolute; left: 10px; top: 10px; margin: 0; padding: 4px 8px; border-radius: 8px; background: rgba(0,0,0,0.45); color: #fff; font: 600 12.5px var(--text); }
.ax-call-lock { position: absolute; left: 10px; bottom: 10px; margin: 0; padding: 4px 8px; border-radius: 8px; background: rgba(0,0,0,0.45); color: #dff5e6; font: 600 11.5px var(--text); }
.ax-call-bar { display: flex; gap: 8px; justify-content: center; padding: 10px; background: var(--surface); }
.ax-call-btn { min-width: 64px; height: 36px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg); color: var(--ink); font: 600 13px var(--text); cursor: pointer; }
.ax-call-btn[aria-pressed="false"] { opacity: 0.65; }
.ax-call-btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.msgr-info { width: 300px; border-left: 1px solid var(--line); padding: 4px 14px 14px; overflow: auto; }
.msgr-info .side-block.first { border-top: 0; }
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--hover); }
.segmented button { flex: 1; border: 0; padding: 7px; border-radius: 9px; background: none; font-weight: 600; font-size: 14px; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
#agree[aria-pressed="true"] { color: var(--ok); }
#disagree[aria-pressed="true"] { color: var(--danger); }
.pick-people { border: 0; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; max-height: 280px; overflow: auto; }
.pick-people small { color: var(--faint); }
.pick-list { margin-top: 8px; }
.pick-btn { justify-content: space-between; border-radius: 12px; }
.pick-btn small { color: var(--faint); }
dialog.viewer { width: min(900px, calc(100% - 24px)); height: min(calc(80 * var(--vh, 1vh)), 900px); }
dialog.viewer[open] { display: flex; flex-direction: column; }
.viewer-head { padding: 12px 16px; margin: 0; }
#viewer-frame { flex: 1; width: 100%; border: 0; border-top: 1px solid var(--line); background: #fff; }
.share-link { font-size: 12.5px; margin-left: 4px; }

@media (max-width: 1100px) {
  .msgr-info { position: fixed; top: 0; right: 0; bottom: 0; z-index: 25; background: var(--surface); box-shadow: var(--shadow); }
}
@media (max-width: 760px) {
  .msgr { grid-template-columns: 1fr; margin: 0; border-radius: 0; border-width: 1px 0 0; }
  .msgr-main { display: none; }
  body.reading .msgr-main { display: flex; position: fixed; inset: 0; z-index: 20; background: var(--surface); }
  body.reading .back-btn { display: inline-grid; }
  .msgr-info { width: 100%; }
  .tabs { order: 3; width: 100%; }
  .tabs button { flex: 1; }
}

/* billing badges and alerts */
.managed-badge { display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600;
  background: var(--hover); color: var(--muted); }
.managed-badge[data-provider="stripe"] { background: color-mix(in srgb, #635BFF 16%, var(--surface)); color: #635BFF; }
.managed-badge[data-provider="paypal"] { background: color-mix(in srgb, #0070E0 14%, var(--surface)); color: #1E6FC8; }
.managed-badge[data-provider="apple"] { background: var(--ink); color: var(--surface); }
.managed-badge[data-provider="google"] { background: color-mix(in srgb, #1E8E3E 14%, var(--surface)); color: #1E8E3E; }
.managed-badge[data-provider="huawei"] { background: color-mix(in srgb, #CF0A2C 12%, var(--surface)); color: #CF0A2C; }
.store-note { margin: 16px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--hover); font-size: 14px; color: var(--muted); }
.alert-bar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 6; width: min(720px, calc(100% - 32px));
  display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 16px; border-radius: 14px; font-size: 14px;
  background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); box-shadow: var(--shadow); }
.alert-bar[data-kind="switched"], .alert-bar[data-kind="ending"] { background: var(--accent-soft); border-color: transparent; }
.alert-bar span { flex: 1; }

/* ------------------------------------------------------------------ privacy and security settings */
.settings-main { width: min(860px, 100%); }
.page-title.left { text-align: left; margin: 16px 0 8px; font: 600 22px/1.2 var(--display); letter-spacing: -0.03em; }
.settings-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.settings-nav a { padding: 6px 12px; border-radius: 99px; background: var(--hover); color: var(--muted); font-size: 13.5px; text-decoration: none; }
.settings-nav a:hover { color: var(--ink); }
.settings-main .panel { scroll-margin-top: 16px; }
.settings-main .field { margin: 10px 0; }
.settings-main .field select, .settings-main .field input, .settings-main textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--ink); font: inherit; }
.settings-main .switch-row, .settings-main .sec-row { padding: 12px 0; border-top: 1px solid var(--line); }
.settings-main .sec-row { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.settings-main select { font: inherit; }
.profile-row { display: flex; gap: 16px; align-items: flex-start; }
.grow { flex: 1; min-width: 0; }
.avatar.big-avatar { width: 72px; height: 72px; font-size: 28px; border: 0; cursor: pointer; background-size: cover; background-position: center; }
.avatar.has-pic { background-color: var(--line); background-size: cover; background-position: center; color: transparent; }
.avatar.online { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ok); }
.name-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; }
.tier-table { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; font-size: 13.5px; }
.tier-table .t-row { display: grid; grid-template-columns: 1.4fr repeat(5, minmax(0, 1fr)); }
.tier-table .t-row > * { padding: 8px 10px; border-top: 1px solid var(--line); text-align: center; }
.tier-table .t-row:first-child > * { border-top: 0; background: var(--hover); font-weight: 600; color: var(--muted); }
.tier-table .t-row > :first-child { text-align: left; font-weight: 600; }
.tier-table .yes { color: var(--ok); }
.tier-table .no { color: var(--faint); }
.radio-set { border: 0; padding: 0; margin: 6px 0 14px; display: grid; gap: 8px; }
.radio-set legend { font-weight: 600; margin-bottom: 6px; }
.radio-set .check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.radio-set .check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio-set .check span { display: grid; gap: 2px; }
.radio-set small { color: var(--muted); font-size: 13px; }
.json-box.short { width: 100%; min-height: 90px; font-family: var(--text); }
.totp-setup { display: flex; gap: 18px; align-items: flex-start; padding: 14px; margin: 6px 0 10px; border-radius: 14px; background: var(--hover); flex-wrap: wrap; }
.totp-setup img { background: #fff; border-radius: 10px; padding: 6px; }
.mono-key { font-family: var(--mono); font-size: 15px; letter-spacing: 0.05em; word-break: break-all; }
.codes-box { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 18px; padding: 14px; margin: 8px 0; border: 1px dashed var(--line);
  border-radius: 14px; font-family: var(--mono); font-size: 15px; }
.codes-box p { grid-column: 1 / -1; margin: 0 0 4px; font-family: var(--text); font-size: 13.5px; color: var(--muted); }
.device-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.device-list li { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 14px; }
.danger, .ghost.danger { color: var(--danger); }
.danger-link { color: var(--danger) !important; }
.primary.danger-btn { background: var(--danger); color: #fff; }
.danger-row b { color: var(--danger); }
.delete-form { display: grid; gap: 4px; max-width: 420px; padding: 14px; margin-top: 8px; border-radius: 14px;
  background: color-mix(in srgb, var(--danger) 7%, var(--surface)); }
.panel.panic { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.panel.panic p { color: var(--muted); }

/* the app-lock cover */
.lock-cover { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.lock-card { width: min(360px, 100%); padding: 28px 24px; border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); text-align: center; display: grid; gap: 10px; justify-items: center; }
.lock-card h2 { margin: 6px 0 0; font: 800 22px/1.2 var(--display); }
.lock-card p { margin: 0; color: var(--muted); }
.lock-card .glyph { width: 40px; height: 40px; }
body.is-locked > :not(.lock-cover) { visibility: hidden; }

/* ------------------------------------------------------------------ messages: requests, profiles, privacy */
.req-link { display: flex; justify-content: space-between; align-items: center; margin: 2px 10px 4px; padding: 8px 12px; border: 0; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.req-link b { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: 12px; text-align: center; }
.req-view { display: flex; flex-direction: column; min-height: 0; height: 100%; overflow: auto; }
.req-view .conv-title small { white-space: normal; }
.req-list { list-style: none; margin: 0; padding: 14px 16px; display: grid; gap: 10px; }
.req-card { padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); display: grid; gap: 6px; }
.req-card.spam { background: color-mix(in srgb, var(--danger) 5%, var(--surface)); }
.req-top { display: grid; }
.req-top small { color: var(--faint); font-size: 12.5px; }
.req-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.req-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.ghost.primary-ish { color: var(--accent); border-color: var(--accent); }
.quarantine { margin: 0 16px 16px; }
.quarantine summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: 6px 0; }
.quarantine .req-list { padding: 8px 0 0; }
.warn-line { margin: 0; padding: 6px 10px; border-radius: 10px; font-size: 13px; color: var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, transparent); overflow-wrap: anywhere; }
.warn-line small { display: block; color: var(--muted); }
.bubble .warn-line { margin-bottom: 6px; }
.fav-label { margin-top: 10px; }
.people li.person { gap: 8px; }
.person-btn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0; border: 0; background: none; color: inherit;
  font: inherit; text-align: left; cursor: pointer; }
.person-btn:disabled { cursor: default; }
.person-btn > span:last-child { display: grid; min-width: 0; }
.person-btn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-btn .avatar { width: 28px; height: 28px; font-size: 13px; }
.star { color: #E0A100; }
.mini-icon { font-size: 11px; margin-left: 4px; opacity: 0.75; }
.request-bar { background: var(--accent-soft); color: var(--accent); }
.ttl { color: var(--faint); font-size: 11.5px; }
.seen-mark { display: block; margin-top: 4px; text-align: right; color: var(--faint); font-size: 11.5px; }
.fwd-btn { margin-left: auto; padding: 1px 8px !important; font-size: 11.5px !important; opacity: 0; transition: opacity 0.15s; }
.bubble:hover .fwd-btn, .bubble:focus-within .fwd-btn { opacity: 1; }
@media (hover: none) { .fwd-btn { opacity: 0.7; } }
.risky-link { color: var(--danger); text-decoration: line-through; overflow-wrap: anywhere; }
.bubble a { color: var(--accent); overflow-wrap: anywhere; }
.locked-msg { color: var(--muted); font-style: italic; }
.bubble.filtered > :not(.filtered-cover) { display: none; }
.filtered-cover { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; font-style: italic; cursor: pointer; padding: 0; }
.link-card { display: flex; gap: 10px; margin-top: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); max-width: 420px; }
.link-card img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; }
.link-card span { display: grid; gap: 2px; min-width: 0; }
.link-card small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.msgr-info .field { display: grid; gap: 4px; margin: 6px 0 10px; font-size: 13px; }
.msgr-info .field span { font-weight: 600; }
.msgr-info select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; }
.msgr-info .switch-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 8px 0; }
.msgr-info .switch-row b { font-size: 13.5px; }
.msgr-info .switch-row small { font-size: 12px; }
.ask-form { display: grid; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.ask-form input, .ask-form textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; resize: vertical; }
.ask-form .side-label, .ask-form .side-note { margin: 0; }
#profile-dialog .profile-row { margin: 10px 0 14px; }
#profile-dialog .avatar.big-avatar { cursor: default; }
.pf-handle { margin: 0 0 4px; font-weight: 600; }
#pf-bio { margin: 6px 0 0; }
#pf-form select, #pf-form input[type="text"], #pf-form #pf-nick { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; }
#pf-form .check { display: flex; gap: 8px; align-items: center; margin: 10px 0; font-size: 14px; }
#pf-form .side-note { margin: 4px 0 12px; }
@media (max-width: 640px) {
  .name-grid { grid-template-columns: 1fr; }
  .tier-table { font-size: 12px; }
  .tier-table .t-row { grid-template-columns: 1.2fr repeat(5, minmax(0, 1fr)); }
  .tier-table .t-row > * { padding: 6px 4px; }
  .settings-main .sec-row { flex-direction: column; align-items: stretch; }
  .profile-row { flex-direction: column; }
}

#profile-dialog, #fwd-dialog { padding: 18px 20px 16px; }
#profile-dialog form { padding: 0; }
.name-grid #save-profile { align-self: end; justify-self: start; margin-bottom: 10px; }
.name-grid .wide-cell { align-self: center; }
.msgr-info .danger-link { font-size: 13.5px; text-decoration: none; padding: 4px 0; }
.msgr-info .danger-link:hover { text-decoration: underline; }

.mail-warning { margin: 10px 0; padding: 10px 14px; border-radius: 12px; color: var(--danger);
  background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); font-size: 14px; }
.mail-warning p { margin: 2px 0; overflow-wrap: anywhere; }
.mail-warning small { display: block; color: var(--muted); }
.privacy-note { margin: 6px 0 10px; }
.file-chip.risky { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.read-files .warn-line { margin-top: 4px; }
.html-tools { display: flex; gap: 14px; flex-wrap: wrap; }
.c-noforward { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
#burner-form select { flex: 1; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
.tag.lite { background: color-mix(in srgb, var(--ok) 15%, var(--surface)); color: var(--ok); }

/* legal pages */
.page-main.legal { width: min(820px, 100%); line-height: 1.65; }
.legal h1 { font: 800 34px/1.15 var(--display); margin: 18px 0 6px; }
.legal h2 { font: 700 21px/1.3 var(--display); margin: 34px 0 8px; scroll-margin-top: 16px; }
.legal h3 { margin: 0 0 6px; font-size: 16px; }
.legal ul { padding-left: 22px; }
.legal li { margin: 6px 0; }
.legal-meta { color: var(--muted); }
.legal-toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 6px; }
.legal-toc a { padding: 5px 11px; border-radius: 99px; background: var(--hover); color: var(--muted); font-size: 13px; text-decoration: none; }
.plan-terms { display: grid; gap: 12px; }
.plan-term { padding: 14px 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.plan-term ul { margin: 0; }

.terms-dialog { padding: 20px 22px; }
.t-money { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.t-money div { display: grid; padding: 10px 12px; border-radius: 12px; background: var(--hover); }
.t-money small { color: var(--muted); font-size: 12px; }
.t-money b { font: 700 17px/1.3 var(--display); }
.t-list { margin: 4px 0 10px; padding-left: 20px; font-size: 14px; color: var(--muted); max-height: 220px; overflow: auto; }
.t-list li { margin: 3px 0; }
.t-agree { display: flex; gap: 8px; align-items: flex-start; margin: 10px 0; font-size: 14px; }
.t-actions { display: flex; justify-content: flex-end; gap: 8px; }

.alert-bar[data-kind="credits"] { background: var(--accent-soft); border-color: transparent; }
.alert-bar[data-kind="credits_high"] { background: color-mix(in srgb, #E0A100 16%, var(--surface)); border-color: color-mix(in srgb, #E0A100 40%, transparent); }
.buy-dialog { padding: 18px 20px; }
.buy-packs { display: grid; gap: 8px; margin: 12px 0; }
.buy-pack { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; }
.buy-pack b { flex: 1; }
.buy-pack span { color: var(--muted); }
.buy-or { text-align: center; margin: 6px 0 0; }

.att.in-drive { opacity: 0.6; border-style: dashed; }
.att.in-drive .att-meta { color: var(--accent); }
.file-pill.drive-card { text-decoration: none; color: inherit; border: 1px dashed var(--accent); }
.file-pill.drive-card small { display: block; color: var(--accent); font-size: 11px; }

/* drive */
.drive-main { width: min(900px, 100%); }
.drive-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.drive-upload { cursor: pointer; display: inline-flex; align-items: center; }
.drive-meter { margin: 14px 0 4px; }
.drop-zone { display: none; margin: 12px 0; padding: 28px; border: 2px dashed var(--accent); border-radius: 18px; text-align: center; color: var(--accent); }
.drop-zone.on { display: block; }
.drive-list { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 8px; }
.drive-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); flex-wrap: wrap; }
.drive-row.busy { opacity: 0.7; }
.d-name { flex: 1; min-width: 180px; display: grid; }
.d-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-name small { color: var(--muted); font-size: 12.5px; }
.d-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.c-files .in-drive { opacity: 0.7; border-style: dashed; }

.chat-credit { display: flex; align-items: center; gap: 12px; margin: 0 auto 8px; width: min(760px, calc(100% - 32px)); padding: 10px 12px 10px 16px;
  border-radius: 14px; font-size: 14px; background: color-mix(in srgb, #E0A100 14%, var(--surface)); border: 1px solid color-mix(in srgb, #E0A100 40%, transparent); }
.chat-credit span { flex: 1; }
.chat-credit[data-level="95"], .chat-credit[data-level="100"] { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.buy-presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin: 10px 0; }
.buy-presets button { display: grid; padding: 8px; border-radius: 12px; font-weight: 700; }
.buy-presets small { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.buy-amount input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; }
.buy-quote { font-weight: 600; margin: 8px 0; }
.buy-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }

.topup-row, .auto-row { max-width: 820px; margin: 14px auto 0; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.topup-row .field input, .auto-fields input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; width: 100%; }
.topup-actions { display: flex; gap: 8px; margin: 8px 0; }
.auto-fields { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; margin-top: 8px; }
@media (max-width: 560px) { .auto-fields { grid-template-columns: 1fr; } }
.theme { position: relative; margin-left: auto; }
.theme-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 268px;
  padding: 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 40;
}
.theme-auto { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.theme-range { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.theme-range input[type="range"] { flex: 1; height: 14px; margin: 0; -webkit-appearance: none; appearance: none; border: 1px solid var(--line);
  border-radius: 999px; background: var(--tint-track, linear-gradient(90deg, #FFFFFF 0%, #F4F4F6 50%, #2A2A2E 50%, #141416 100%)); cursor: pointer; }
.theme-range input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--accent); background: var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); }
.theme-range input[type="range"]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--accent);
  background: var(--surface); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); }
.theme-range input[type="range"]::-moz-range-track { background: transparent; }
.theme-range input[type="range"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.theme-range input[type="range"]:disabled { opacity: 0.55; }
.tint-pick { margin-top: 10px; }
.theme-note { margin: 10px 0 0; font-size: 12px; color: var(--faint); line-height: 1.4; }
.theme { margin-left: 0; } .topbar .theme + .icon-btn { margin-left: 0; }

/* owner: fraud, pool, audit */
.fraud-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.fraud-item { padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.fraud-item.sev-3 { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); background: color-mix(in srgb, var(--danger) 5%, var(--surface)); }
.fraud-item p { margin: 6px 0; }
.f-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.f-top time { margin-left: auto; color: var(--faint); font-size: 12.5px; }
.f-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pool-balance { font-size: 18px; margin: 8px 0 12px; }
.gov-forms { display: grid; gap: 8px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 140px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; }
.tag.danger { background: color-mix(in srgb, var(--danger) 15%, var(--surface)); color: var(--danger); }
.notice-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 auto 8px; width: min(760px, calc(100% - 32px)); padding: 10px 14px;
  border-radius: 14px; background: var(--accent-soft); font-size: 14px; }
.notice-bar span { flex: 1; }
.notice-bar.warn { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }

/* organization */
.org-main { width: min(1000px, 100%); }
.seat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin: 8px 0 12px; }
.seat { display: grid; padding: 12px 14px; border-radius: 14px; background: var(--hover); }
.seat span { color: var(--muted); font-size: 13.5px; }
.add-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; align-items: end; }
.add-grid .primary { margin-bottom: 10px; }
.org-main td select, .org-main td input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; font-size: 13.5px; max-width: 130px; }
.org-main td small { display: block; }
.backup-pick { margin: 0; flex-direction: row; align-items: center; gap: 8px; }
.backup-pick select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); }
@media (max-width: 720px) { .add-grid { grid-template-columns: 1fr; } }

/* libraries */
.lib-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 10px 0 4px; }
.lib-bar button { min-width: 0; padding: 7px 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: .01em; cursor: pointer; }
.lib-bar button:hover { color: var(--ink); border-color: var(--faint); }
.lib-bar button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.env-stage { flex: 1; min-height: 0; overflow: auto; padding: 28px 30px 12px; }
.env-card { max-width: 640px; margin: 0 auto; }
.env-card h2 { margin: 0 0 10px; font: 600 clamp(26px, 3vw, 36px)/1.15 var(--display); letter-spacing: -.03em; }
.env-card p { margin: 0 0 16px; color: var(--muted); max-width: 46em; }
.env-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.env-note, .env-stats { margin: 0; color: var(--muted); font-size: 13.5px; }
.env-stats { display: grid; gap: 8px; list-style: none; padding: 0; max-width: 420px; }
.env-stats li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.env-stats b { color: var(--ink); font-weight: 600; }
.main.env-open .thread { visibility: hidden; position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.main.env-open .workspace-apps { display: none; }
.main.env-open .env-stage { display: block; }

.libs { position: relative; display: grid; gap: 6px; margin: 4px 0 8px; }
.lib-switch { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.lib-switch span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-switch svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: none; }
.lib-menu { position: absolute; top: 44px; left: 0; right: 0; z-index: 30; display: grid; padding: 6px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow); max-height: 340px; overflow: auto; }
.lib-menu button { display: flex; justify-content: space-between; padding: 8px 10px; border: 0; border-radius: 9px; background: none; color: var(--ink);
  font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.lib-menu button:hover, .lib-menu button.on { background: var(--hover); }
.lib-menu button.on { font-weight: 700; }
.lib-menu button.new { color: var(--accent); }
.lib-menu button.danger { color: var(--danger); }
.lib-menu small { color: var(--faint); }
.lib-filter { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--hover); }
.lib-filter button { flex: 1; border: 0; padding: 4px 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.lib-filter button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.task-add { display: flex; gap: 4px; }
.task-add input { flex: 1; min-width: 0; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; }
.task-item { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 10px; border-radius: 10px; font-size: 14px; }
.task-item:hover { background: var(--hover); }
.task-title { flex: 1; min-width: 0; display: grid; overflow: hidden; }
.task-title small, .lib-tag { color: var(--faint); font-size: 11.5px; }
.lib-tag { display: block; }
.task-check { flex: none; width: 16px; height: 16px; border: 2px solid var(--faint); border-radius: 5px; background: none; cursor: pointer; padding: 0; }
.task-item.doing .task-check { border-color: var(--accent); background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); }
.task-item.done .task-check { border-color: var(--ok); background: var(--ok); }
.task-item.done .task-title { color: var(--faint); text-decoration: line-through; }
.libs, .libs * { box-sizing: border-box; }
.libs { min-width: 0; max-width: 100%; }
.lib-switch, .lib-filter, .task-add { max-width: 100%; }
.libs { grid-template-columns: minmax(0, 1fr); width: 100%; }
.lib-filter button { min-width: 0; }
.task-add input { width: 0; }

/* vault */
.vault-main { width: min(1100px, 100%); }
.vault-head-actions { display: flex; gap: 8px; align-items: center; }
.vault-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 8px; }
.vault-tools input, .vault-tools select { padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; }
.vault-tools input { flex: 1; min-width: 200px; }
.view-toggle { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--hover); }
.view-toggle button { border: 0; background: none; padding: 6px 8px; border-radius: 9px; color: var(--muted); cursor: pointer; display: grid; place-items: center; }
.view-toggle button[aria-pressed="true"] { background: var(--surface); color: var(--ink); }
.view-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.type-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.type-chips button { display: inline-flex; gap: 6px; align-items: center; padding: 5px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface);
  color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer; }
.type-chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.type-chips small { color: var(--faint); }
.vault-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 8px;
  border-radius: 12px; background: var(--sidebar); }
.vault-bar .check { display: flex; gap: 6px; align-items: center; margin-right: auto; font-size: 14px; }
.vault-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.vault-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.vault-item.picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.v-thumb { flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: var(--hover); cursor: pointer; display: grid; place-items: center; }
.v-thumb img { width: 100%; height: 100%; object-fit: cover; }
.v-icon { font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: 0.03em; }
.v-icon.t-pdf { color: #D64545; } .v-icon.t-sheet { color: #1E9A57; } .v-icon.t-doc { color: #2E6BF0; } .v-icon.t-audio { color: #A048D6; } .v-icon.t-code { color: #C27C0E; }
.v-name { flex: 1; min-width: 0; display: grid; }
.v-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-name small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-actions { display: flex; gap: 6px; }
.vault-list.grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.vault-list.grid .vault-item { position: relative; flex-direction: column; align-items: stretch; padding: 8px; }
.vault-list.grid .v-thumb { width: 100%; height: 140px; }
.vault-list.grid .v-icon { font-size: 22px; }
.vault-list.grid .v-check { position: absolute; top: 12px; left: 12px; z-index: 1; }
.vault-list.grid .v-actions { justify-content: space-between; }
#v-viewer { width: min(1000px, calc(100% - 24px)); }
#v-viewer img { display: block; max-width: 100%; max-height: calc(80 * var(--vh, 1vh)); margin: 0 auto; }
@media (max-width: 640px) { .vault-item .v-actions { display: none; } .vault-list.grid .v-actions { display: flex; } }

/* account menu */
.account-row { display: flex; align-items: center; gap: 4px; }
.account-row .account-btn { flex: 1; min-width: 0; }
.account-btn .tier { color: var(--muted); font-weight: 500; }
.account-btn .chev { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; flex: none; }
.account-menu { position: fixed; z-index: 60; width: min(360px, calc(calc(100 * var(--vw, 1vw)) - 16px)); max-height: calc(calc(100 * var(--vh, 1vh)) - 90px); overflow: auto; padding: 10px;
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 72%, transparent); box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.35); -webkit-backdrop-filter: blur(22px) saturate(1.35);
  transform-origin: 16px 100%; animation: am-bloom 0.22s ease; }
@keyframes am-bloom {
  from { opacity: 0; transform: translateY(12px) scale(0.94); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .account-menu { animation: none; } }
.account-menu .am-email { margin: 6px 10px 6px; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.account-menu .am-card { margin: 4px 4px 10px; padding: 12px; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--surface) 55%, transparent); }
.account-menu .am-tier { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 8px; padding: 3px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.account-menu .am-meter { display: grid; gap: 4px; margin: 8px 0 0; }
.account-menu .am-meter span { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); }
.account-menu .am-bar { display: block; height: 6px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.account-menu .am-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); }
.account-menu .am-label { margin: 8px 10px 4px; color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.account-menu .am-idents { display: grid; gap: 4px; margin: 0 4px 8px; }
.account-menu .am-idents button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--ink); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.account-menu .am-idents button.on { border-color: var(--accent); background: var(--accent-soft); }
.account-menu .am-idents small { margin-left: auto; color: var(--faint); font-size: 11.5px; }
.account-menu .am-audit { list-style: none; margin: 0 4px 8px; padding: 0; display: grid; gap: 4px; max-height: 120px; overflow: auto; }
.account-menu .am-audit li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 8px; color: var(--muted); font-size: 12.5px; }
.account-menu .am-audit time { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.account-menu .am-token { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; padding: 8px 10px; border-radius: 10px; background: var(--hover); font-size: 13px; }
.account-menu .am-token code { flex: 1; font-family: var(--mono); font-size: 12.5px; }
.account-menu .am-token .ghost { width: auto; flex: none; padding: 4px 10px; }
.account-menu a, .account-menu > button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--ink); font: inherit; font-size: 14.5px; text-decoration: none; text-align: left; cursor: pointer; }
.account-menu a:hover, .account-menu > button:hover, .account-menu a:focus-visible, .account-menu > button:focus-visible { background: var(--hover); outline: 0; }
.account-menu svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; flex: none; }
.account-menu span { flex: 1; }
.account-menu kbd, .account-menu .am-val { color: var(--faint); font: inherit; font-size: 12.5px; }
.account-menu .am-chev { width: 16px; height: 16px; color: var(--faint); transition: transform 0.15s; }
.account-menu button.open .am-chev { transform: rotate(90deg); }
.account-menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.am-sub { display: grid; padding: 2px 0 4px 40px; max-height: 260px; overflow: auto; }
.am-sub a, .am-sub button { padding: 6px 10px; border: 0; border-radius: 8px; background: none; color: var(--muted); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; text-decoration: none; }
.am-sub a:hover, .am-sub button:hover { background: var(--hover); color: var(--ink); }
.am-sub button.on { color: var(--accent); font-weight: 600; }
.skill-btn.on { color: var(--accent); }

/* settings */
.usage-meters { display: grid; gap: 14px; margin: 10px 0 14px; }
.meter-row { display: grid; gap: 5px; }
.meter-top { display: flex; justify-content: space-between; font-size: 14px; }
.meter-top span, .meter-row small { color: var(--muted); }
.pace { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, #E0A100 14%, var(--surface)); font-size: 14px; }
.mem-list { margin: 10px 0; }
.mem-list li > span:first-child b { font-weight: 500; }
.skill-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 8px; }
.skill-item { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; }
.skill-item p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.skill-form { display: grid; gap: 8px; margin-top: 8px; }
.skill-form input, .skill-form textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; }
#connectors .sec-row, #plugins .switch-row { padding: 10px 0; border-top: 1px solid var(--line); }

/* help center */
.help-search { width: 100%; box-sizing: border-box; margin: 14px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); font-size: 15px; }
.help-steps { padding-left: 22px; }
.help-steps li { margin: 8px 0; }
.faq details { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); margin: 8px 0; padding: 0 14px; }
.faq summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
.faq details p { margin: 0 0 12px; color: var(--muted); }
.support-form { display: grid; gap: 4px; max-width: 560px; }
.support-form .field { display: grid; gap: 4px; margin-top: 10px; font-size: 14px; font-weight: 500; }
.support-form input, .support-form select, .support-form textarea, dialog.compose select, dialog.compose textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; }
.support-form .compose-foot .side-note { margin: 0; }
.report-link { background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 6px; }
.report-link:hover { color: var(--ink); text-decoration: underline; }
#reports .fine, #reports blockquote { text-align: left; }
#reports blockquote { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--line); background: var(--hover); border-radius: 6px; }
#reports .f-acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
#reports .fine a { color: var(--accent, inherit); }

/* share sheet (bottom sheet on phones, centered card on larger screens) */
dialog.share-sheet { width: min(440px, calc(100% - 24px)); padding: 10px 20px 22px; border: 0; border-radius: 28px; background: var(--bg); color: var(--ink); box-shadow: var(--shadow); box-sizing: border-box; }
dialog.share-sheet::backdrop { background: rgba(10, 14, 30, 0.45); }
.sheet-grip { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 6px; }
.sheet-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; margin-bottom: 14px; }
.sheet-head h2 { margin: 0; text-align: center; font: 600 18px/1.2 var(--display, inherit); }
.sheet-close { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.sheet-close svg, .sheet-chip svg, .sheet-opt svg, .sheet-go svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sheet-chip { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-radius: 18px; background: var(--hover); font-size: 16px; }
.sheet-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sheet-label { margin: 22px 0 8px 14px; color: var(--muted); font-size: 15px; }
.sheet-options { border-radius: 18px; background: var(--surface); overflow: hidden; }
.sheet-opt { display: flex; align-items: center; gap: 14px; width: 100%; padding: 16px 18px; border: 0; background: none; color: var(--ink); font: inherit; font-size: 16px; text-align: left; cursor: pointer; }
.sheet-opt + .sheet-opt { position: relative; }
.sheet-opt + .sheet-opt::before { content: ""; position: absolute; top: 0; left: 54px; right: 18px; height: 1px; background: var(--line); }
.sheet-opt span { flex: 1; }
.sheet-opt i { display: none; color: var(--accent, #2f5bff); }
.sheet-opt.on i { display: block; }
.sheet-opt:focus-visible { outline: 2px solid var(--accent, #2f5bff); outline-offset: -2px; }
.sheet-note { margin: 10px 14px 0; color: var(--muted); font-size: 14px; min-height: 1.2em; }
.sheet-extra { margin: 10px 14px 0; font-size: 13px; color: var(--muted); }
.sheet-url { display: flex; gap: 8px; margin-top: 12px; }
.sheet-url input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 13px; }
.sheet-go { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 26px; padding: 17px; border: 0; border-radius: 99px; background: var(--ink); color: var(--bg); font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; }
.sheet-go[hidden] { display: none; }
.sheet-go:disabled { opacity: 0.6; }
@media (max-width: 600px) {
  dialog.share-sheet { width: 100%; max-width: 100%; margin: auto 0 0; border-radius: 28px 28px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
}
.share-chat-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 99px; margin-left: auto; }
.share-chat-btn[hidden] { display: none; }
.share-chat-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.share-chat-btn + .theme { margin-left: 0; }
.perm-box { margin: 10px 0 0; padding: 6px 12px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.perm-box legend { padding: 0 6px; font-size: 13px; font-weight: 600; }
.perm-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; font-size: 14px; cursor: pointer; }
.perm-row + .perm-row, #share-members .perm-row:first-child { border-top: 1px solid var(--line); }
.perm-row input { width: 18px; height: 18px; accent-color: var(--accent, #2f5bff); }
.perm-row input:disabled + span { color: var(--muted); }
.perm-all span { font-weight: 600; }
.perm-warn { margin: 8px 2px; padding: 9px 11px; border-radius: 12px; background: color-mix(in srgb, #f5a524 14%, var(--surface)); font-size: 12.5px; line-height: 1.45; color: var(--ink); }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }
.invites { margin: 4px 0 10px; }
.invite-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.invite-card { display: grid; gap: 4px; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--accent, #2f5bff) 40%, var(--line)); border-radius: 14px; background: var(--surface); }
.invite-card small { color: var(--muted); font-size: 12.5px; }
.ghost.tiny.primary-ish { background: var(--accent, #2f5bff); color: #fff; border-color: transparent; }

/* public shared-chat page */
.shared-main { max-width: 780px; }
.shared-head { padding: 18px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.shared-kind { margin: 0; color: var(--muted); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.shared-head h1 { margin: 6px 0 4px; font: 800 30px/1.15 var(--display); overflow-wrap: anywhere; }
.shared-thread { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.s-msg { display: grid; gap: 6px; min-width: 0; }
.s-msg.user { justify-items: end; }
.s-msg.user .s-body { max-width: 85%; padding: 10px 14px; border-radius: 18px; background: var(--hover); white-space: pre-wrap; overflow-wrap: anywhere; }
.s-msg.assistant .s-body { line-height: 1.6; overflow-wrap: anywhere; }
.s-msg.assistant .s-body pre { overflow-x: auto; }
.s-msg.system { justify-items: center; }
.s-msg.system .s-body { color: var(--muted); font-size: 13px; text-align: center; }
.s-author { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.s-img { max-width: min(100%, 420px); border-radius: 14px; }
.shared-foot { margin: 30px 0 40px; padding-top: 18px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.share-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.share-item { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.share-item span { flex: 1; min-width: 0; display: grid; }
.share-item small { color: var(--muted); font-size: 12.5px; }
.share-item.revoked, .share-item.expired { opacity: 0.6; }

/* ===== chat extras (same look: tokens, radii and chips as the rest of the chat) ===== */
.actions { flex-wrap: wrap; }
.act.fb-thumb[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.user-acts { display: flex; justify-content: flex-end; gap: 2px; margin-top: -4px; opacity: 0.38; transition: opacity 0.15s; }
.msg-user:hover .user-acts, .msg-user:focus-within .user-acts { opacity: 1; }
@media (pointer: coarse) { .user-acts { opacity: 1; } }
.user-acts .add-file-act { display: none; }
.msg-user.latest .user-acts .add-file-act { display: inline-flex; }
.act.copy-act.copied, .act.copy-act.copied:hover { color: var(--ok, #138a4b); background: color-mix(in srgb, var(--ok, #138a4b) 14%, transparent); cursor: default; opacity: 1; }
.act.copy-act:disabled { opacity: 1; }
.file-x { display: none; place-items: center; width: 20px; height: 20px; margin: 0 -2px 0 2px; padding: 0; border: 0; border-radius: 50%;
  background: var(--line); color: var(--ink); cursor: pointer; flex: none; }
.file-x svg { width: 12px; height: 12px; }
.msg-user.latest:hover .file-x, .msg-user.latest:focus-within .file-x { display: inline-grid; }
.msg-user.editing .msg-files { display: none; }
.thumb-wrap { position: relative; display: inline-block; }
.thumb-wrap .file-x { position: absolute; top: 4px; right: 4px; margin: 0; background: color-mix(in srgb, var(--surface) 88%, transparent); }
@media (pointer: coarse) { .msg-user.latest .file-x { display: inline-grid; } }
.edit-box { width: min(640px, 100%); display: grid; gap: 8px; justify-self: end; }
.edit-box textarea { width: 100%; box-sizing: border-box; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 18px; background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.edit-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.edit-files .att { width: 200px; }
.edit-bar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.edit-bar .side-note { margin: 0 auto 0 0; }
.edit-bar .edit-add { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; }

/* Message queue: prompts waiting while a reply streams. */
.queue { width: min(768px, 100%); margin: 0 auto 8px; display: grid; gap: 6px; }
.queue-head { display: flex; align-items: center; gap: 6px; padding: 0 4px; font-size: 12.5px; color: var(--muted); }
.queue-head span { margin-right: auto; font-weight: 600; letter-spacing: 0.02em; }
.queue-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 38vh; overflow-y: auto; }
.queued { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: start; gap: 6px; padding: 6px 6px 6px 4px;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 16px;
  background: color-mix(in srgb, var(--bubble) 62%, transparent); opacity: 0.86; transition: opacity 0.15s, transform 0.15s; }
.queued:hover, .queued:focus-within, .queued.open { opacity: 1; }
.queued.dragging { opacity: 0.45; transform: scale(0.98); }
.q-grip { display: grid; place-items: center; width: 22px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--faint); cursor: grab; }
.q-grip:active { cursor: grabbing; }
.q-grip svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.q-grip:hover, .q-grip:focus-visible { color: var(--ink); background: var(--hover); }
.q-num { display: grid; place-items: center; min-width: 20px; height: 20px; margin-top: 5px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700; }
.q-main { display: grid; gap: 6px; min-width: 0; }
.q-files { display: flex; flex-wrap: wrap; gap: 6px; }
.q-files:empty { display: none; }
.q-files .att { width: 190px; padding: 4px 2px 4px 4px; }
.q-files .att .ext, .q-files .att img { width: 28px; height: 28px; }
.q-files .att { grid-template-columns: 28px minmax(0, 1fr) auto; }
.q-bubble { display: block; width: 100%; padding: 5px 4px; border: 0; background: none; color: var(--ink); font: inherit; text-align: left;
  white-space: pre-wrap; overflow-wrap: break-word; cursor: text; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.q-text { display: grid; gap: 6px; }
.q-text textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid var(--accent); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; resize: vertical; }
.q-done { justify-self: end; }
.q-tools { display: flex; gap: 2px; }
.q-tools .icon-btn { width: 30px; height: 30px; border-radius: 10px; }
.q-tools .icon-btn svg { width: 16px; height: 16px; }

/* web sources */
a.cite { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; margin: 0 1px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; text-decoration: none; vertical-align: 2px; }
.sources { margin-top: 14px; }
.sources-head { margin: 0 0 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sources ol { list-style: none; counter-reset: src; display: flex; gap: 8px; overflow-x: auto; padding: 0 0 4px; margin: 0; }
.sources li { counter-increment: src; flex: 0 0 auto; }
.sources a { display: grid; gap: 2px; width: 190px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.sources a:hover { border-color: var(--faint); }
.sources a b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sources a b::before { content: counter(src) "  "; color: var(--accent); }
.sources a small { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* composer additions */
.compare-pick { height: 34px; max-width: 170px; padding: 0 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; }
.mic-btn { width: 34px; height: 34px; border-radius: 50%; }
.mic-btn svg { width: 18px; height: 18px; }
.mic-btn.rec { color: #fff; background: var(--danger); animation: mic-pulse 1.2s ease-in-out infinite; }
.mic-btn[aria-pressed="true"]:not(.rec) { color: var(--accent); background: var(--accent-soft); }
@keyframes mic-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 25%, transparent); } }
@media (prefers-reduced-motion: reduce) { .mic-btn.rec { animation: none; } }
.temp-btn svg { width: 19px; height: 19px; }
.temp-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.temp-note { margin: 8px auto 0; max-width: 760px; text-align: center; font-size: 12.5px; color: var(--muted); }
body.temp-mode .composer { border-style: dashed; }
@media (max-width: 560px) { .compare-pick { max-width: 120px; } }

/* "/" saved prompts */
.composer { position: relative; }
.slash-menu { position: absolute; left: 10px; right: 10px; bottom: calc(100% + 8px); max-height: 300px; overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); z-index: 30; }
.slash-head { margin: 4px 10px 6px; font-size: 12px; font-weight: 600; color: var(--faint); }
.slash-menu button { display: grid; gap: 2px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.slash-menu button.on, .slash-menu button:hover { background: var(--hover); }
.slash-menu small { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* compare */
.msg-compare { position: relative; display: grid; gap: 6px; }
.cmp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; transition: grid-template-columns 0.45s ease; }
.cmp-col { display: grid; align-content: start; gap: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); min-width: 0;
  transition: opacity 0.4s ease, transform 0.45s ease, border-color 0.2s; }
.cmp-col.done { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.cmp-head { display: flex; align-items: center; gap: 8px; }
.cmp-head .model-label { margin: 0; }
.cmp-tag { padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700; letter-spacing: 0.03em; }
.cmp-col .body { line-height: 1.6; overflow-wrap: anywhere; }
.cmp-pick { justify-self: start; margin-top: 4px; }
.msg-compare.merging .cmp-grid { grid-template-columns: minmax(0, 1fr); }
.cmp-col.loser { opacity: 0; transform: scale(0.96); position: absolute; pointer-events: none; }
.cmp-col.winner { border-color: var(--accent); }
.cmp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 2px 2px 10px; margin-bottom: 8px; border-bottom: 1px solid var(--line); }
.cmp-side { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.cmp-side select { min-width: 150px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 500; }
.cmp-side select:disabled { opacity: 0.6; }
.cmp-vs { color: var(--faint); font-size: 12px; }
.cmp-hint { margin: 0 0 0 auto; }
@media (max-width: 720px) { .cmp-hint { display: none; } }
.cmp-err { color: var(--danger); }
.cmp-note { margin: 0; text-align: center; }
@media (max-width: 720px) { .cmp-grid { grid-template-columns: minmax(0, 1fr); } }

/* canvas cards in messages */
.cv-card { display: flex; align-items: center; gap: 12px; width: min(420px, 100%); margin: 8px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.cv-card:hover { border-color: var(--accent); }
.cv-card svg { width: 26px; height: 26px; flex: none; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.cv-card span { display: grid; min-width: 0; }
.cv-card b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-card small { color: var(--faint); font-size: 12.5px; }
.cv-card.writing { cursor: default; border-style: dashed; }

/* canvas side panel */
.shell.canvas-open { grid-template-columns: 272px minmax(0, 1fr) minmax(380px, 46%); }
.shell.collapsed.canvas-open { grid-template-columns: minmax(0, 1fr) minmax(380px, 50%); }
.canvas-panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--surface); }
.canvas-panel[hidden] { display: none; }
.cv-layout { display: flex; flex: 1; min-height: 0; }
.cv-timeline { flex: 0 0 168px; overflow: auto; border-right: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.cv-timeline button { display: grid; gap: 2px; width: 100%; padding: 8px 9px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; font: inherit; font-size: 12.5px; cursor: pointer; }
.cv-timeline button:hover, .cv-timeline button.on { background: var(--hover); }
.cv-timeline button b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.cv-timeline button small { color: var(--faint); font-size: 11px; }
.cv-timeline .cv-empty { margin: 10px 6px; color: var(--faint); font-size: 12.5px; }
.cv-hist { display: inline-block; margin-left: 4px; padding: 1px 6px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 10px; font-weight: 600; }
.cv-stage { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.cv-diff { flex: 1; margin: 0; padding: 14px 18px; overflow: auto; background: var(--bg); font: 12.5px/1.55 var(--mono); white-space: pre-wrap; }
.cv-diff[hidden] { display: none; }
.cv-scratch { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 10px 12px 12px; gap: 10px; overflow: auto; }
.cv-scratch[hidden] { display: none; }
.cv-scratch > p { margin: 0; font-size: 13.5px; }
.cv-scratch-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; min-height: 0; flex: 1; }
.cv-scratch-panes section { display: flex; flex-direction: column; min-width: 0; min-height: 140px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.cv-scratch-panes h3 { margin: 0; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 650; color: var(--muted); }
.cv-scratch-panes pre { flex: 1; margin: 0; padding: 10px 12px; overflow: auto; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; }
.cv-scratch-tools { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 860px) {
  .cv-scratch-panes { grid-template-columns: 1fr; }
}
.cv-diff .add { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.cv-diff .del { background: color-mix(in srgb, var(--danger) 16%, transparent); text-decoration: line-through; }
.cv-diff .meta { color: var(--faint); }
.cv-purge { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface)); font-size: 13px; }
.cv-purge[hidden] { display: none; }
.cv-purge span { flex: 1; min-width: 160px; }
.cv-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.cv-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.cv-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 700 16px/1.2 var(--display); }
.cv-title select { max-width: 150px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg); color: var(--ink); font: inherit; font-size: 12.5px; }
.cv-title select[hidden] { display: none; }
.cv-tools { display: flex; align-items: center; gap: 4px; }
.cv-mode button { padding: 4px 10px; font-size: 13px; }
.cv-body { flex: 1; overflow: auto; padding: 18px 22px; line-height: 1.65; }
.cv-body[hidden] { display: none; }
.cv-code { margin: 0; padding: 14px; border-radius: 12px; background: var(--bg); font: 13px/1.55 var(--mono); white-space: pre; overflow: auto; }
.cv-editor { flex: 1; margin: 0; padding: 18px 22px; border: 0; outline: 0; resize: none; background: var(--surface); color: var(--ink); font: 14px/1.6 var(--mono); }
.cv-frame { flex: 1; width: 100%; border: 0; background: #fff; }
.cv-frame[hidden], .cv-editor[hidden] { display: none; }
.cv-save { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); }
.cv-save[hidden] { display: none; }
.cv-save .side-note { margin: 0 auto 0 0; }
.cv-ask { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.cv-ask[hidden] { display: none; }
.cv-ask input { min-width: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg); color: var(--ink); font: inherit; }
.cv-sel { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-sel[hidden] { display: none; }
@media (max-width: 860px) {
  .shell.canvas-open, .shell.collapsed.canvas-open { grid-template-columns: minmax(0, 1fr); }
  .canvas-panel { position: fixed; inset: 0; z-index: 60; border-left: 0; padding-bottom: env(safe-area-inset-bottom); }
}

/* Ctrl+K palette */
dialog.palette { width: min(620px, calc(100% - 24px)); margin: calc(12 * var(--vh, 1vh)) auto auto; padding: 0; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.palette::backdrop { background: rgba(10, 14, 30, 0.4); }
.palette input { width: 100%; box-sizing: border-box; padding: 16px 18px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); font: inherit; font-size: 16px; outline: 0; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: calc(52 * var(--vh, 1vh)); overflow: auto; }
.palette-list li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.palette-list li.on, .palette-list li:hover { background: var(--hover); }
.palette-list li span { display: grid; min-width: 0; flex: 1; }
.palette-list li b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-list li small { color: var(--faint); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-list li em { font-style: normal; color: var(--faint); font-size: 12px; }
.palette-list li.empty { color: var(--faint); cursor: default; }
.palette-foot { margin: 0; padding: 8px 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; }
.palette-foot kbd { padding: 1px 5px; border: 1px solid var(--line); border-radius: 5px; font: 11px var(--mono); }
.prompt-form { display: grid; gap: 8px; margin-top: 10px; }
.prompt-form input, .prompt-form textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; }
.prompt-form button { justify-self: start; }
@media (max-width: 440px) {
  .composer-bar { gap: 2px; }
  #voice-mode { display: none; }
  .composer-bar .picker-btn { padding-left: 6px; padding-right: 6px; }
}

/* inside the phone apps: store billing only */
.native-app #credits, .native-app .topup-row, .native-app .auto-row, .native-app [data-web-checkout] { display: none !important; }
.native-app .page-top { padding-top: max(12px, env(safe-area-inset-top)); }
/* Google and Microsoft block sign-in inside app web views, so the apps offer email and Apple */
.native-app .provider-btn[data-provider="google"], .native-app .provider-btn[data-provider="microsoft"] { display: none; }
.engine { display: block; color: var(--faint); font-size: 12px; font-weight: 400; }

/* follow-up chips and second opinions */
.followups { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.followups button { padding: 7px 13px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; cursor: pointer; text-align: left; }
.followups button:hover { border-color: var(--accent); color: var(--accent); }
.msg-ai:not(:last-child) .followups { display: none; }
.msg-ai.second-opinion .content { padding-left: 12px; border-left: 3px solid var(--accent-soft); }
.msg-ai.second-opinion .model-label { color: var(--accent); }

/* Drive chat folders */
.chat-folders { margin-top: 26px; }
.chat-folders h2 { font: 700 20px/1.2 var(--display); margin: 0 0 4px; }
.fold { margin: 4px 0 4px 14px; }
#chat-folders > .fold { margin-left: 0; }
.fold > summary { cursor: pointer; padding: 5px 4px; font-weight: 600; color: var(--muted); }
.chat-fold { margin: 6px 0 6px 14px; padding: 4px 12px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.chat-fold > summary { display: flex; align-items: baseline; gap: 10px; color: var(--ink); }
.chat-fold > summary small { color: var(--faint); font-weight: 400; font-size: 12.5px; }
.fold-acts { display: flex; gap: 6px; margin: 4px 0 6px; }
.fold-head { margin: 8px 0 2px; font-size: 12px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; }
.fold-files { list-style: none; margin: 0; padding: 0; }
.fold-files li { display: flex; gap: 10px; align-items: baseline; padding: 3px 0; }
.fold-files small { color: var(--faint); font-size: 12px; }
.mail-toggle { white-space: nowrap; flex: none; }
@media (max-width: 1100px) { .composer-bar .mail-toggle span { display: none; } .composer-bar .mail-toggle { padding: 0 9px; } }

/* ===== in-page docked overlays (Messenger-style) ===== */
.pop-row { position: fixed; right: 132px; bottom: 0; z-index: 70; display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 12px; pointer-events: none; }
.dock-win { pointer-events: auto; display: flex; flex-direction: column; width: 380px; height: min(560px, calc(calc(100 * var(--vh, 1vh)) - 80px)); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 16px 16px 0 0; background: var(--surface); color: var(--ink); box-shadow: 0 -8px 32px -8px rgba(23, 32, 54, 0.38); overflow: hidden; }
/* Chatbot and mail: one-third larger than the 380×560 base (507×747). */
.dock-win.bot, .dock-win.mail { width: 507px; height: min(747px, calc(calc(100 * var(--vh, 1vh)) - 80px)); }
.dock-win.msg { width: 360px; height: min(540px, calc(calc(100 * var(--vh, 1vh)) - 80px)); }
.dw-head { position: relative; display: flex; align-items: center; gap: 10px; padding: 16px 8px 9px 12px; border-bottom: 1px solid var(--line); flex: none; cursor: grab; }
.dw-grab { position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 99px; background: currentColor; opacity: 0.28; pointer-events: none; }
.dock-win.bot .dw-head { background: var(--accent); color: var(--accent-ink); border-bottom-color: transparent; }
.dw-av { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; }
.dock-win.bot .dw-av { background: color-mix(in srgb, var(--accent-ink) 18%, transparent); color: var(--accent-ink); }
.dw-av svg, .dw-btn svg, .dw-send svg, .dock-bubble svg, .dm-av svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dw-titles { display: grid; min-width: 0; flex: 1; }
.dw-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.dw-sub { font-size: 12px; opacity: 0.75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-btn { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.dock-win.msg .dw-btn { color: var(--accent); }
.dw-btn:hover { background: var(--hover); }
.dock-win.bot .dw-btn:hover { background: rgba(255, 255, 255, 0.16); }
.dw-list { list-style: none; margin: 0; padding: 12px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.dw-msg { display: grid; max-width: 86%; gap: 2px; }
.dw-msg.mine { align-self: flex-end; justify-items: end; }
.dw-msg.theirs { align-self: flex-start; }
.dw-bub { padding: 8px 12px; border-radius: 18px; background: var(--bubble); line-height: 1.45; font-size: 14.5px; overflow-wrap: anywhere; }
.dw-msg.mine .dw-bub { background: var(--accent); color: var(--accent-ink); white-space: pre-wrap; }
.dock-win.bot .dw-msg.theirs { max-width: 100%; }
.dock-win.bot .dw-msg.theirs .dw-bub { background: none; padding: 2px 0; border-radius: 0; }
.dw-bub p { margin: 0 0 6px; } .dw-bub p:last-child { margin-bottom: 0; }
.dw-bub pre { overflow-x: auto; font-size: 12.5px; } .dw-bub table { font-size: 12.5px; display: block; overflow-x: auto; }
.dw-bub img { max-width: 100%; border-radius: 12px; display: block; }
.dw-msg.sys { align-self: center; max-width: 100%; } .dw-msg.sys .dw-bub { background: none; color: var(--faint); font-size: 12px; text-align: center; }
.dw-who, .dw-at { font-size: 11.5px; color: var(--faint); padding: 0 6px; }
.dw-empty { margin: auto; color: var(--faint); font-size: 13.5px; text-align: center; }
.dw-gone { max-width: 16em; }
.dw-err { color: var(--danger); }
.dw-typing { display: inline-flex; gap: 4px; } .dw-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); animation: dw-blink 1.2s infinite; }
.dw-typing i:nth-child(2) { animation-delay: 0.2s; } .dw-typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes dw-blink { 50% { opacity: 0.25; } }
.dw-note { margin: 0; padding: 6px 12px; font-size: 12.5px; color: var(--danger); border-top: 1px solid var(--line); }
.dw-form { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.dw-model { flex: 1 0 100%; max-width: 100%; height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg); color: var(--ink); font: inherit; font-size: 12.5px; }
.dw-form textarea { flex: 1; min-width: 0; resize: none; max-height: 120px; padding: 9px 14px; border: 0; border-radius: 20px; background: var(--hover); color: var(--ink); font: inherit; font-size: 14.5px; outline: none; }
.dw-send { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); cursor: pointer; }

/* 48px header tabs and circular chips along the bottom right */
.dock-bubbles { position: fixed; right: 76px; bottom: 0; z-index: 71; display: flex; flex-direction: row-reverse; align-items: flex-end; gap: 8px; }
.dock-bubble { position: relative; height: 48px; display: grid; place-items: center; box-shadow: var(--shadow); }
.dock-bubble .db-open { height: 48px; border: 0; background: var(--surface); color: var(--accent); font: 700 13px var(--text); cursor: pointer; display: flex; align-items: center; gap: 8px; }
.dock-bubble.chip, .dock-bubble.chip .db-open, .dock-bubble.more { width: 48px; height: 48px; border-radius: 50%; justify-content: center; }
.dock-bubble.tab { width: auto; max-width: 176px; border-radius: 12px 12px 0 0; }
.dock-bubble.tab .db-open { width: auto; max-width: 176px; padding: 0 12px 0 8px; border-radius: 12px 12px 0 0; }
.dock-bubble .db-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; }
.dock-bubble .db-face { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; }
.dock-bubble.bot .db-open { background: var(--accent); color: var(--accent-ink); }
.dock-bubble.bot .db-open svg, .dock-bubble.mail .db-open svg { width: 20px; height: 20px; }
.dock-bubble.mail .db-open { background: var(--surface); color: var(--accent); }
.dock-bubble .db-close { position: absolute; top: -4px; right: -4px; width: 22px; height: 22px; display: none; place-items: center; border: 0; border-radius: 50%; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); cursor: pointer; }
.dock-bubble .db-close svg { width: 13px; height: 13px; }
.dock-bubble:hover .db-close, .dock-bubble:focus-within .db-close { display: grid; }
.db-dot { position: absolute; bottom: 2px; right: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.dock-bubble.more { border: 0; background: var(--ink); color: var(--bg); font: 700 14px var(--text); cursor: pointer; }
.dock-menu { position: fixed; right: 84px; bottom: 16px; z-index: 72; width: 290px; max-height: calc(70 * var(--vh, 1vh)); overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.dm-head { margin: 6px 10px; font-size: 12px; font-weight: 600; color: var(--faint); }
.dm-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.dm-item:hover { background: var(--hover); }
.dm-item span:last-child { display: grid; min-width: 0; } .dm-item b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dm-item small { color: var(--faint); font-size: 12px; }
.dm-av { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px; }
.dm-item.bot .dm-av { background: var(--accent); color: var(--accent-ink); }
.popout-btn svg { width: 19px; height: 19px; }
@media (max-width: 700px) {
  .pop-row { right: 0; left: 0; }
  .dock-win, .dock-win.bot, .dock-win.msg, .dock-win.mail { width: calc(100 * var(--vw, 1vw)); height: calc(78 * var(--vh, 1vh)); border-radius: 18px 18px 0 0; }
  .dock-bubbles { bottom: 90px; right: 12px; }
  .dock-has-windows .dock-bubbles { display: none; }
  .dock-bubble, .dock-bubble .db-open { height: 48px; }
}
@media print { .pop-row, .dock-bubbles { display: none; } }

/* two mirrored rows: chatbots drop down from the top right, Messenger rises from the bottom right */
.pop-row-bot { top: 0; bottom: auto; align-items: flex-start; }
.pop-row-bot .dock-win.bot { width: 507px; height: min(747px, calc(calc(100 * var(--vh, 1vh)) - 24px)); border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 18px 18px; box-shadow: 0 6px 28px -6px rgba(23, 32, 54, 0.32); }
.pop-row-msg { bottom: 0; }
body.dock-split .pop-row-bot .dock-win.bot { height: calc(calc(50 * var(--vh, 1vh)) - 14px); }
body.dock-split .pop-row-msg .dock-win.msg { height: calc(calc(50 * var(--vh, 1vh)) - 14px); }
.dock-bubbles-bot { top: 72px; bottom: auto; flex-direction: column; }
.dock-bubbles-msg { right: 76px; bottom: 0; }
.dock-menu.top { top: 72px; bottom: auto; }
@media (max-width: 700px) {
  .pop-row-bot .dock-win.bot { width: calc(100 * var(--vw, 1vw)); height: calc(78 * var(--vh, 1vh)); border-radius: 0 0 18px 18px; }
  .dock-bubbles-bot { top: 64px; bottom: auto; }
}

/* title bar and controls on top, the message box at the bottom */
.pop-row-bot .dock-win.bot { box-shadow: 0 6px 28px -6px rgba(23, 32, 54, 0.32); }

/* + menu, file chips */
.dw-form { position: relative; }
.dw-plus { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer; }
.dw-plus svg, .dw-plus-menu svg, .dw-chip svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.dw-plus:hover { background: var(--hover); }
.dw-plus.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.dw-plus-menu { position: absolute; left: 10px; bottom: calc(100% + 6px); z-index: 5; min-width: 240px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 2px; }
.dw-plus-menu[hidden] { display: none; }
.dw-plus-menu > button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.dw-plus-menu > button span { flex: 1; }
.dw-plus-menu > button i { font-style: normal; font-size: 12px; color: var(--faint); }
.dw-plus-menu > button[aria-pressed="true"] i { color: var(--accent); font-weight: 600; }
.dw-plus-menu > button:hover { background: var(--hover); }
.dw-emoji { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; padding: 2px 2px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.dw-emoji button { border: 0; background: none; font-size: 20px; padding: 4px 0; border-radius: 8px; cursor: pointer; }
.dw-emoji button:hover { background: var(--hover); }
.dw-tray { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 0; flex: none; }
.dw-tray[hidden] { display: none; }
.dw-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 6px 5px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font-size: 12.5px; }
.dw-chip b { font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-chip small { color: var(--faint); }
.dw-chip.error { border-color: var(--danger); } .dw-chip.error small { color: var(--danger); }
.dw-chip button { width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--faint); cursor: pointer; }
.dw-chip button svg { width: 14px; height: 14px; }

/* ===== group pairs: Messenger on the left, Group Chatbot on the right, AXORK blue ===== */
.dock-pair { --pair: var(--accent); position: relative; pointer-events: auto; display: flex; align-items: stretch; height: min(560px, calc(calc(100 * var(--vh, 1vh)) - 80px));
  border: 2px solid var(--pair); border-bottom: 0; border-radius: 16px 16px 0 0; background: var(--surface); overflow: hidden;
  box-shadow: 0 -8px 32px -8px rgba(23, 32, 54, 0.38); }
body.dock-split .dock-pair { height: calc(calc(50 * var(--vh, 1vh)) - 14px); }
.dp-band { display: none; }
.dock-pair .dock-win { height: 100%; border: 0; border-radius: 0; box-shadow: none; }
.dock-pair .dock-win.grp { width: 380px; flex: none; }
/* Peeking + rail is always 32px; Messenger adds 360px when open so the + never tucks away. */
.dp-side { width: 32px; flex: none; overflow: hidden; position: relative; transition: width 0.28s ease; border-right: 1px solid color-mix(in srgb, var(--pair) 40%, var(--line)); }
.dock-pair.open .dp-side { width: 392px; }
.dp-side .dock-win.attached { width: 360px; margin-left: 32px; }
.dp-tab { position: absolute; left: 0; top: 0; bottom: 0; width: 32px; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 8px; padding: 18px 0 10px; border: 0; background: color-mix(in srgb, var(--pair) 16%, var(--surface)); color: var(--pair); cursor: pointer; }
.dp-tab svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.dp-tab span { writing-mode: vertical-rl; transform: rotate(180deg); font: 700 11px var(--text); letter-spacing: 0.04em; }
.dp-tab span[hidden] { display: none; }
.dock-pair.open .dp-tab { display: flex; background: color-mix(in srgb, var(--pair) 22%, var(--surface)); }
.dock-peek-menu { position: fixed; z-index: 80; width: 248px; padding: 6px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 2px; }
.dock-peek-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.dock-peek-menu button:hover:not(:disabled) { background: var(--hover); }
.dock-peek-menu button:disabled { opacity: 0.45; cursor: default; }
.dock-peek-menu svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--pair, var(--accent)); }
.dock-peek-menu span { display: grid; min-width: 0; }
.dock-peek-menu b { font-weight: 600; font-size: 13.5px; }
.dock-peek-menu small { color: var(--muted); font-size: 12px; }
.dp-consent { margin: 0; padding: 10px 12px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--pair) 8%, var(--bg)); display: grid; gap: 8px; }
.dp-consent p { margin: 0; font-size: 13px; line-height: 1.4; color: var(--ink); }
.dp-consent p span { display: block; margin-top: 4px; color: var(--muted); }
.dp-consent-link { justify-self: start; color: var(--pair, var(--accent)); font: 600 13px var(--text); text-decoration: none; }
.dp-consent-link:hover { text-decoration: underline; }
/* Vertical member faces sit between the dock row and the + FAB so docks never cover +. */
.dock-faces { position: fixed; right: 16px; bottom: 72px; z-index: 72; display: flex; flex-direction: column-reverse; align-items: center; gap: 8px; pointer-events: none; }
.dock-faces[hidden] { display: none; }
.dock-face { pointer-events: auto; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--surface); color: var(--accent); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; padding: 0; font: 700 12px var(--text); }
.dock-face:hover { transform: translateY(-1px); }
.dock-face.compose { background: var(--accent); color: var(--accent-ink); }
.dock-face svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
body.dock-has-pair .dock-bubbles-msg { right: 76px; }
.dw-inbox { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.dw-inbox-bar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex: none; }
.dw-inbox-all { margin-left: auto; color: var(--accent); font: 600 13px var(--text); text-decoration: none; }
.dw-inbox-list { list-style: none; margin: 0; padding: 6px; overflow: auto; flex: 1; display: grid; gap: 2px; align-content: start; }
.dw-inbox-item { display: grid; gap: 2px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.dw-inbox-item:hover { background: var(--hover); }
.dw-inbox-item.unread b { color: var(--accent); }
.dw-inbox-item small, .dw-inbox-item span { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-inbox .dw-empty { padding: 24px 16px; text-align: center; }
.dw-inbox-compose { margin: 0 12px 12px; }
@media (prefers-reduced-motion: reduce) { .dp-side { transition: none; } .dock-face:hover { transform: none; } }
/* title bar on top, message box at the bottom — Messenger wash on the left, solid AXORK blue on the right */
.dock-pair .dw-head { padding-top: 12px; }
.dock-pair .dock-win.grp .dw-head { background: var(--pair); color: var(--accent-ink); border-bottom-color: transparent; }
.dock-pair .dock-win.grp .dw-av { background: color-mix(in srgb, var(--accent-ink) 20%, transparent); color: var(--accent-ink); }
.dock-pair .dock-win.grp .dw-btn { color: var(--accent-ink); }
.dock-pair .dock-win.grp .dw-btn:hover { background: color-mix(in srgb, var(--accent-ink) 18%, transparent); }
.dock-pair .dock-win.attached .dw-head { background: color-mix(in srgb, var(--pair) 28%, var(--surface)); border-bottom-color: color-mix(in srgb, var(--pair) 22%, var(--line)); }
.dock-pair .dock-win.attached .dw-av { background: var(--pair); color: var(--accent-ink); }
.dock-pair .dock-win.attached .dw-btn { color: var(--pair); }
.dock-pair .dw-msg.mine .dw-bub { background: var(--pair); color: var(--accent-ink); }
.dock-pair .dw-send { background: var(--pair); color: var(--accent-ink); }
.dock-pair .dw-plus.on { border-color: var(--pair); color: var(--pair); }
.dock-pair .dock-win.grp .dw-msg.ai { max-width: 100%; }
.dock-pair .dock-win.grp .dw-msg.ai .dw-bub { background: none; padding: 2px 0; border-radius: 0; }
.dock-pair .dw-msg.private .dw-bub { outline: 2px dashed color-mix(in srgb, var(--pair) 45%, transparent); outline-offset: 2px; }
.dw-side-btn { width: auto !important; padding: 0 10px; gap: 6px; display: inline-flex !important; align-items: center; border: 1px solid color-mix(in srgb, var(--accent-ink) 45%, transparent) !important; border-radius: 99px !important; position: relative; font: 600 12.5px var(--text); }
.dw-side-btn[aria-expanded="true"] { background: color-mix(in srgb, var(--accent-ink) 22%, transparent) !important; }
.dw-side-btn svg { width: 16px; height: 16px; }
.dw-side-dot { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font: 700 11px/18px var(--text); font-style: normal; text-align: center; border: 2px solid var(--pair); }
.dw-row { flex: 1 0 100%; display: flex; gap: 6px; min-width: 0; }
.dw-row .dw-model { flex: 1; min-width: 0; }
.dw-target { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg); color: var(--faint); font: 500 12.5px var(--text); cursor: pointer; flex: none; }
.dw-target svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dw-target[aria-pressed="true"] { background: var(--pair); border-color: var(--pair); color: var(--accent-ink); }
.dw-dual { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--muted); cursor: pointer; padding: 0; }
.dw-dual svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.dw-dual[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.dw-model-b { flex: 1; min-width: 0; height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg); color: var(--ink); font: inherit; font-size: 12.5px; }
.dw-dual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: min(100%, 340px); }
.dw-dual-col { display: grid; gap: 6px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.dw-dual-col .dw-bub { max-height: 180px; overflow: auto; }
.dw-pick { height: 28px; border: 0; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font: 600 12px var(--text); cursor: pointer; }
.dw-pick:disabled { opacity: 0.45; cursor: default; }
.dw-pick-person { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.dw-pick-person:hover { background: var(--hover); }
.dw-pick-person span:last-child { display: grid; min-width: 0; }
.dw-pick-person small { color: var(--faint); font-size: 12px; }
.dw-mail-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.dw-mail-form { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; flex: 1; min-height: 0; }
.dw-mail-row { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.dw-mail-row input, .dw-mail-row select, .dw-mail-form .dw-body, .dw-mail-ask textarea { width: 100%; box-sizing: border-box; padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; font-size: 13.5px; }
.dw-mail-form .dw-body { flex: 1; min-height: 120px; resize: none; }
.dw-mail-actions { display: flex; justify-content: flex-end; }
.dw-mail-send { height: 34px; padding: 0 14px; border: 0; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font: 600 13px var(--text); cursor: pointer; }
.dw-mail-send:disabled { opacity: 0.5; }

/* Gmail-style mail compose toolbox (dock + full Mail dialog) */
.dock-win.mail.compose-mode .dw-head { background: var(--surface); color: var(--ink); border-bottom: 1px solid var(--line); }
.dock-win.mail.compose-mode .dw-av { background: var(--accent-soft); color: var(--accent); }
.dock-win.mail.compose-mode .dw-btn { color: var(--muted); }
.dock-win.mail.compose-mode .dw-btn:hover { background: var(--hover); }
.dock-win.mail.compose-mode .dw-grab { opacity: 0.2; }
.dock-win.mail.compose-mode .dw-sub { display: none; }
.gmail-compose { gap: 0; padding: 0; background: var(--surface); }
.gmc-row { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: 1px solid var(--line); min-height: 40px; font-size: 13.5px; color: var(--muted); }
.gmc-row > span:first-child { width: 44px; flex: none; }
.gmc-row input, .gmc-row select { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; outline: none; padding: 8px 0; }
.gmc-subject > span { display: none; }
.gmc-subject input { padding: 10px 0; font-size: 14px; }
.gmc-cc-btns { display: flex; gap: 8px; flex: none; }
.gmc-text { border: 0; background: none; color: var(--muted); font: 500 13px var(--text); cursor: pointer; padding: 0; }
.gmc-text:hover { color: var(--accent); }
.gmc-body { flex: 1; min-height: 160px; overflow: auto; padding: 12px 14px; color: var(--ink); font: 14.5px/1.5 var(--text); outline: none; }
.gmc-body:empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; }
.gmc-body img { max-width: 100%; border-radius: 8px; }
.gmc-body blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--muted); }
.gmc-files { list-style: none; margin: 0; padding: 8px 12px; display: flex; flex-wrap: wrap; gap: 6px; border-top: 1px solid var(--line); }
.gmc-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 12px; }
.gmc-chip b { font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gmc-chip small { color: var(--faint); }
.gmc-chip button { width: 20px; height: 20px; border: 0; border-radius: 50%; background: none; color: var(--faint); display: grid; place-items: center; cursor: pointer; padding: 0; }
.gmc-chip button svg { width: 12px; height: 12px; }
.gmc-format { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 0 10px 6px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 99px; background: color-mix(in srgb, var(--bg) 80%, var(--surface)); }
.gmc-format select { height: 28px; border: 0; background: transparent; color: var(--ink); font: 12.5px var(--text); max-width: 96px; }
.gmc-ico { width: 32px; height: 32px; border: 0; border-radius: 50%; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; padding: 0; }
.gmc-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gmc-ico:hover, .gmc-ico[aria-pressed="true"] { background: var(--hover); color: var(--ink); }
.gmc-bar { position: relative; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 8px 10px 10px; border-top: 1px solid var(--line); background: var(--surface); }
.gmc-send-wrap { position: relative; display: flex; margin-right: 6px; }
.gmc-send { height: 36px; padding: 0 16px; border: 0; border-radius: 18px 0 0 18px; background: var(--accent); color: var(--accent-ink); font: 600 13.5px var(--text); cursor: pointer; }
.gmc-send:disabled { opacity: 0.5; }
.gmc-send-more { width: 30px; height: 36px; border: 0; border-left: 1px solid color-mix(in srgb, var(--accent-ink) 28%, transparent); border-radius: 0 18px 18px 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.gmc-send-more svg { width: 16px; height: 16px; }
.gmc-send-menu { position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 6; min-width: 220px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); display: grid; }
.gmc-send-menu button { border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 8px; font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.gmc-send-menu button:hover { background: var(--hover); }
.gmc-trash { margin-left: auto; }
.gmc-pop { position: absolute; left: 12px; bottom: calc(100% + 6px); z-index: 6; min-width: 220px; max-width: min(320px, 100%); max-height: 200px; overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.gmc-emoji { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.gmc-emoji button { border: 0; background: none; font-size: 18px; padding: 4px 0; border-radius: 8px; cursor: pointer; }
.gmc-emoji button:hover { background: var(--hover); }
.gmc-lock { display: grid; gap: 8px; }
.gmc-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); }
.gmc-drive { display: grid; gap: 2px; }
.gmc-drive button { border: 0; background: none; text-align: left; padding: 8px; border-radius: 8px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gmc-drive button:hover { background: var(--hover); }
.gmc-drive-empty { margin: 4px; color: var(--faint); font-size: 13px; }
.dw-thread { flex: 1; min-height: 0; overflow: auto; padding: 12px; display: grid; gap: 8px; align-content: start; }
.dw-thread-meta { display: grid; gap: 2px; margin: 0; font-size: 13px; }
.dw-thread-meta small { color: var(--faint); }
.dw-thread-text { font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.dw-mail-ask { display: flex; gap: 6px; padding: 8px 10px 10px; border-top: 1px solid var(--line); flex: none; }
.dw-mail-ask textarea { flex: 1; min-width: 0; resize: none; }
.dw-ask-log { list-style: none; margin: 0; padding: 8px 12px; flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.dock-win.mail .dw-head { background: var(--accent); color: var(--accent-ink); border-bottom-color: transparent; }
.dock-win.mail .dw-av { background: color-mix(in srgb, var(--accent-ink) 18%, transparent); color: var(--accent-ink); }
.dock-win.mail .dw-btn:hover { background: rgba(255, 255, 255, 0.16); }
.dw-head .dw-av svg, .dw-target svg { flex: none; }
.dock-bubble.grp .db-open { background: var(--pair, var(--accent)); color: var(--accent-ink); }
.db-badge { position: absolute; left: -3px; bottom: -3px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--pair, var(--accent)); box-shadow: var(--shadow); }
.db-badge svg { width: 14px !important; height: 14px !important; }
.dm-item.grp .dm-av { background: var(--pair, var(--accent)); color: var(--accent-ink); }
/* independent Messenger windows: same blue family as the pair's left pane */
.dock-win.msg:not(.attached) { border-top: 3px solid var(--accent); }
.dock-win.msg:not(.attached) .dw-head { background: color-mix(in srgb, var(--accent) 28%, var(--surface)); }
.dock-win.msg:not(.attached) .dw-av { background: var(--accent); color: var(--accent-ink); }
.dock-win.msg:not(.attached) .dw-btn { color: var(--accent); }
.dock-win.msg:not(.attached) .dw-send { background: var(--accent); color: var(--accent-ink); }
.dock-win.mail .dw-btn { color: var(--accent-ink); }
@media (max-width: 700px) {
  .dock-pair { width: calc(100 * var(--vw, 1vw)); height: calc(78 * var(--vh, 1vh)); }
  .dock-pair .dock-win.grp { width: 100%; flex: 1; }
  .dp-side { position: absolute; inset: 0 auto 0 0; z-index: 2; background: var(--surface); }
  .dock-pair.open .dp-side { width: 100%; }
  .dp-side .dock-win.attached { width: calc(100% - 32px); }
  .dw-side-btn span { display: none; }
  .dock-faces { display: none; }
}

/* everything rises from the bottom: chatbot, mail, group pairs and Messenger share one row */
.pop-row-msg .dock-win.bot, .pop-row-msg .dock-win.mail { width: 507px; height: min(747px, calc(calc(100 * var(--vh, 1vh)) - 90px)); }
.pop-row-msg .dock-pair { height: min(560px, calc(calc(100 * var(--vh, 1vh)) - 90px)); border: 2px solid var(--pair); border-bottom: 0;
  border-radius: 16px 16px 0 0; box-shadow: 0 -8px 32px -8px rgba(23, 32, 54, 0.38); }
.pop-row-msg .dock-pair .dock-win.attached { border-top: 0; }
.dock-menu.top { top: auto; bottom: 16px; }
@media (max-width: 700px) {
  .pop-row-msg .dock-win.bot, .pop-row-msg .dock-win.mail, .pop-row-msg .dock-pair { width: calc(100 * var(--vw, 1vw)); height: calc(78 * var(--vh, 1vh)); }
}

/* owner dashboard: what's left before launch */
.launch-card { display: block; margin: 12px 0 16px; border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); }
.launch-card p { margin: 0 0 6px; }
.launch-card ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.launch-card li.crit { color: var(--ink); }
.launch-card li.crit b { color: var(--danger); }

/* top-bar Upgrade / Sign up pill */
.upgrade-pill { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 38px; padding: 0 16px 0 12px; border: 1px solid var(--line);
  border-radius: 99px; background: var(--surface); color: var(--accent); font: 600 15px var(--text); text-decoration: none; cursor: pointer;
  box-shadow: 0 1px 2px rgba(23, 32, 54, 0.05), 0 6px 18px -10px rgba(23, 32, 54, 0.3); }
.upgrade-pill[hidden] { display: none; }
.upgrade-pill svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.upgrade-pill:hover { background: var(--accent-soft); }
@media (max-width: 420px) { .upgrade-pill { height: 34px; padding: 0 12px 0 10px; font-size: 14px; } }

/* ===== support chat: aid bubble at the bottom left ===== */
.sp-bubble { position: fixed; left: calc(var(--sp-left, 16px) + env(safe-area-inset-left, 0px)); bottom: calc(var(--sp-bottom, 16px) + env(safe-area-inset-bottom, 0px));
  z-index: 74; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 16px; background: none; cursor: pointer;
  filter: drop-shadow(0 6px 14px rgba(23, 32, 54, 0.28)); transition: transform 0.15s ease; }
.sp-bubble:hover { transform: translateY(-2px); }
.sp-bubble.on { transform: scale(0.94); }
.sp-mark { width: 100%; height: 100%; display: block; }
.sp-mark-bg { fill: var(--accent); }
.sp-mark-a, .sp-mark-b { fill: none; stroke-width: 6; stroke-linecap: round; }
.sp-mark-a { stroke: var(--accent-ink); }
.sp-mark-b { stroke: #A9B5FF; }
.sp-dot { position: absolute; top: -3px; right: -3px; width: 14px; height: 14px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.sp-panel { position: fixed; left: calc(var(--sp-left, 16px) + env(safe-area-inset-left, 0px)); bottom: calc(var(--sp-bottom, 16px) + 64px + env(safe-area-inset-bottom, 0px));
  z-index: 75; width: min(380px, calc(calc(100 * var(--vw, 1vw)) - 32px)); height: min(600px, calc(calc(100 * var(--vh, 1vh)) - var(--sp-bottom, 16px) - 96px)); display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); overflow: hidden; }
.sp-panel[hidden] { display: none; }
.sp-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 14px; background: var(--accent); color: var(--accent-ink); flex: none; }
.sp-head-mark { width: 34px; height: 34px; flex: none; }
.sp-head .sp-mark-bg { fill: rgba(255, 255, 255, 0.18); }
.sp-titles { display: grid; flex: 1; min-width: 0; }
.sp-titles b { font: 700 15.5px var(--text); }
.sp-titles small { font-size: 12.5px; opacity: 0.85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-x { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.sp-x:hover { background: rgba(255, 255, 255, 0.16); }
.sp-x svg, .sp-send svg, .sp-person svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sp-list { list-style: none; margin: 0; padding: 14px 12px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.sp-msg { display: grid; gap: 3px; max-width: 86%; }
.sp-msg small { font-size: 11.5px; color: var(--faint); padding: 0 4px; }
.sp-bub { padding: 9px 13px; border-radius: 16px; background: var(--bubble); font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.sp-bub a { color: inherit; }
.sp-msg.customer { align-self: flex-end; }
.sp-msg.customer .sp-bub { background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.sp-msg.ai .sp-bub { border-bottom-left-radius: 6px; }
.sp-msg.agent .sp-bub { background: var(--accent-soft); border-bottom-left-radius: 6px; }
.sp-msg.system { align-self: center; max-width: 100%; text-align: center; }
.sp-msg.system .sp-bub { background: none; padding: 2px 8px; font-size: 12.5px; color: var(--muted); }
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; flex: none; }
.sp-chips[hidden] { display: none; }
.sp-chips button { padding: 6px 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink); font: 13px var(--text); cursor: pointer; }
.sp-chips button:hover { border-color: var(--accent); color: var(--accent); }
.sp-actions { display: flex; gap: 8px; padding: 0 12px 8px; flex: none; }
.sp-actions[hidden] { display: none; }
.sp-person, .sp-solved { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface);
  color: var(--ink); font: 500 13px var(--text); cursor: pointer; }
.sp-person { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.sp-person[hidden], .sp-solved[hidden] { display: none; }
.sp-email { display: grid; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); flex: none; font-size: 13px; }
.sp-email[hidden] { display: none; }
.sp-email label { display: grid; gap: 6px; color: var(--muted); }
.sp-email input { padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); font-size: 15px; }
.sp-rate { padding: 8px 12px; border-top: 1px solid var(--line); text-align: center; flex: none; }
.sp-rate[hidden] { display: none; }
.sp-rate p { margin: 0 0 4px; font-size: 13.5px; color: var(--muted); }
.sp-stars { display: flex; justify-content: center; gap: 4px; }
.sp-stars button { width: 34px; height: 34px; border: 0; background: none; color: var(--faint); cursor: pointer; border-radius: 8px; }
.sp-stars button:hover, .sp-stars button:hover ~ button { color: var(--faint); }
.sp-stars:hover button { color: #E8A317; }
.sp-stars button:hover ~ button { color: var(--faint); }
.sp-stars svg { width: 24px; height: 24px; fill: currentColor; }
.sp-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); flex: none; }
.sp-form textarea { flex: 1; min-width: 0; resize: none; max-height: 120px; padding: 10px 14px; border: 0; border-radius: 20px; background: var(--hover); color: var(--ink); font: 15px var(--text); outline: none; }
.sp-send { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.sp-note { margin: 0; padding: 0 14px 10px; font-size: 12.5px; color: var(--danger); }
@media (max-width: 700px) {
  .sp-bubble { width: 46px; height: 46px; }
  .sp-panel { left: 8px !important; right: 8px; width: auto; height: min(calc(78 * var(--vh, 1vh)), calc(calc(100 * var(--vh, 1vh)) - var(--sp-bottom, 16px) - 80px)); bottom: calc(var(--sp-bottom, 16px) + 56px); }
}
@media print { .sp-bubble, .sp-panel { display: none; } }

/* ===== support desk (agents) ===== */
.desk-page { overflow: hidden; height: 100%; display: flex; flex-direction: column; }
.desk-top { padding-block: 12px; }
.desk-title { display: grid; text-align: center; } .desk-title b { font: 800 18px var(--display); } .desk-title small { color: var(--muted); font-size: 12.5px; }
.desk { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px minmax(0, 1fr) 360px; gap: 0; border-top: 1px solid var(--line); }
.desk-queue { display: flex; flex-direction: column; min-height: 0; background: var(--sidebar); border-right: 1px solid var(--line); }
.desk-tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
.desk-tabs button { padding: 5px 10px; border: 0; border-radius: 99px; background: none; color: var(--muted); font: 500 13px var(--text); cursor: pointer; }
.desk-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.desk-tabs i { font-style: normal; font-weight: 700; color: var(--accent); margin-left: 2px; }
.desk-search { margin: 0 10px 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-size: 14px; }
.desk-list { list-style: none; margin: 0; padding: 0 6px 12px; overflow-y: auto; flex: 1; }
.desk-list button { display: grid; gap: 3px; width: 100%; padding: 10px; border: 0; border-radius: 12px; background: none; color: var(--ink); text-align: left; cursor: pointer; font: inherit; }
.desk-list button:hover { background: var(--hover); } .desk-list button.on { background: var(--surface); box-shadow: var(--shadow); }
.dq-top { display: flex; justify-content: space-between; gap: 8px; } .dq-top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .dq-top small { color: var(--faint); font-size: 12px; flex: none; }
.dq-last { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dq-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.st { font-style: normal; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--hover); color: var(--muted); }
.st.waiting { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.st.open { background: var(--accent-soft); color: var(--accent); }
.dq-unread { font-style: normal; margin-left: auto; min-width: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.desk-none { padding: 24px 10px; color: var(--faint); font-size: 13.5px; text-align: center; }
.desk-convo { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.desk-empty { margin: auto; max-width: 360px; text-align: center; color: var(--muted); }
.desk-chat { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.desk-chat[hidden] { display: none; }
.desk-chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.desk-chat-head div:first-child { display: grid; min-width: 0; } .desk-chat-head small { color: var(--muted); font-size: 12.5px; }
.desk-chat-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.desk-reason { margin: 0; padding: 8px 16px; font-size: 13px; color: var(--muted); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); border-bottom: 1px solid var(--line); }
.desk-msgs { list-style: none; margin: 0; padding: 16px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.dm { display: grid; gap: 3px; max-width: 75%; } .dm small { font-size: 11.5px; color: var(--faint); padding: 0 4px; }
.dm-bub { padding: 9px 13px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 14.5px; line-height: 1.45; overflow-wrap: anywhere; }
.dm.agent, .dm.ai, .dm.note { align-self: flex-end; justify-items: end; }
.dm.agent .dm-bub { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.dm.ai .dm-bub { background: var(--accent-soft); border-color: transparent; }
.dm.note .dm-bub { background: color-mix(in srgb, #E8A317 16%, var(--surface)); border-style: dashed; }
.dm.system { align-self: center; max-width: 90%; text-align: center; } .dm.system .dm-bub { background: none; border: 0; color: var(--muted); font-size: 12.5px; padding: 2px; }
.desk-compose { padding: 10px 16px 14px; border-top: 1px solid var(--line); background: var(--surface); display: grid; gap: 8px; }
.desk-compose.note { background: color-mix(in srgb, #E8A317 8%, var(--surface)); }
.desk-compose-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.desk-compose select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg); font-size: 13px; }
.desk-compose textarea { width: 100%; resize: vertical; min-height: 64px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg); font: 15px var(--text); }
.desk-compose-foot { display: flex; justify-content: space-between; align-items: center; }
.desk-customer { overflow-y: auto; padding: 16px; border-left: 1px solid var(--line); background: var(--surface); display: grid; align-content: start; gap: 6px; }
.desk-customer[hidden] { display: none; }
.desk-customer h2 { margin: 0; font: 800 20px var(--display); }
.desk-customer h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--faint); }
.desk-customer .fine { margin: 0; font-size: 13px; color: var(--muted); }
.finding { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 6px; display: grid; gap: 4px; justify-items: start; }
.finding p { margin: 0; font-size: 13px; color: var(--muted); }
.finding.l3 { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.finding.l2 { border-color: color-mix(in srgb, #E8A317 55%, transparent); background: color-mix(in srgb, #E8A317 7%, var(--surface)); }
.dc-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 13.5px; } .dc-facts dt { color: var(--muted); } .dc-facts dd { margin: 0; }
.dc-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.dc-inline { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.dc-inline input, .dc-inline select { flex: 1; min-width: 90px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 13.5px; }
.dc-pay, .dc-trash, .dc-err { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.dc-pay li, .dc-trash li { display: flex; align-items: center; gap: 8px; } .dc-pay li span, .dc-trash li span { flex: 1; min-width: 0; color: var(--muted); }
.dc-err li { display: grid; gap: 2px; padding: 6px 8px; border-radius: 8px; background: var(--hover); } .dc-err small { color: var(--faint); }
.desk-locked { grid-column: 1 / -1; margin: auto; text-align: center; display: grid; gap: 10px; justify-items: center; }
.toast.bad { background: var(--danger); color: #fff; }
@media (max-width: 1100px) { .desk { grid-template-columns: 260px minmax(0, 1fr); } .desk-customer { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); max-height: calc(45 * var(--vh, 1vh)); } .desk-page { overflow: auto; } }
@media (max-width: 700px) { .desk { grid-template-columns: 1fr; } .desk-queue { max-height: calc(40 * var(--vh, 1vh)); } }
.support-cta { margin: 6px 0 14px; }
.desk-customer .fine { text-align: left; }
.desk-compose .segmented button { white-space: nowrap; }

/* ===================================================================== control center (/admin) */
.cc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.cc-privacy { display: flex; align-items: center; gap: 8px; }
.cc-privacy svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ok); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cc-who { display: flex; align-items: center; gap: 8px; margin-left: auto; margin-right: 12px; }
.cc-who small { color: var(--muted); }
.cc-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0 18px; border-bottom: 1px solid var(--line); }
.cc-tabs button { border: 0; background: none; padding: 10px 14px; font: 600 14.5px/1 var(--sans, inherit); color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.cc-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.cc-tabs i { font-style: normal; display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; margin-left: 4px; }
.cc-tabs i:empty { display: none; }
.cc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cc-chip { --c: #5A6478; display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap;
  color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cc-chip { color: color-mix(in srgb, var(--c) 55%, white); } }
:root[data-theme="dark"] .cc-chip { color: color-mix(in srgb, var(--c) 55%, white); }
.cc-tag { font-size: 12.5px; color: var(--muted); }
.cc-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.cc-filters input, .cc-filters select, .cc-form textarea, .cc-form input, .cc-form select, .cc-dlg input, .cc-dlg select, .cc-dlg textarea, .cc-mini input, .cc-mini select, .cc-mini textarea {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; min-width: 0; }
.cc-filters label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.cc-filters input[type=search] { width: min(280px, 100%); }
.cc-pager { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.cc-roles, .cc-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.cc-role { --c: #5A6478; border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: 14px; padding: 14px 16px; background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.cc-role header { display: flex; justify-content: space-between; align-items: center; }
.cc-role header b { font: 800 17px/1.2 var(--display); }
.cc-rank { font: 700 13px/1 var(--mono, monospace); padding: 4px 8px; border-radius: 8px; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); }
.cc-role p { margin: 0; font-size: 14px; }
.cc-role details { font-size: 13.5px; margin-top: 4px; }
.cc-role details p { margin: 6px 0 0; color: var(--muted); }
.cc-role footer { margin-top: auto; padding-top: 8px; display: flex; gap: 6px; }
.cc-approvals, .cc-anns, .cc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cc-appr, .cc-ann { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.cc-appr small, .cc-ann small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.cc-appr.pending { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.cc-ann.warning { border-left: 4px solid #E8590C; } .cc-ann.success { border-left: 4px solid var(--ok); } .cc-ann.info { border-left: 4px solid var(--accent); }
.cc-status { font-size: 12.5px; color: var(--muted); text-transform: capitalize; }
.cc-form { display: grid; gap: 8px; }
.cc-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.cc-row > label, .cc-dlg > label, .cc-mini > label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); flex: 1 1 140px; }
.cc-check { display: flex !important; align-items: center; gap: 6px; font-size: 14px; color: var(--ink) !important; }
.cc-locked { text-align: center; padding: 60px 16px; }
.cc-locked h2 { font: 800 26px/1.2 var(--display); }
dialog.cc-drawer { width: min(820px, calc(100% - 24px)); max-height: calc(calc(100 * var(--vh, 1vh)) - 40px); padding: 22px; overflow: auto; }
.cc-person-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.cc-person-head h2 { margin: 0; font: 800 24px/1.2 var(--display); }
.cc-person-head p { margin: 4px 0; }
.cc-person-btns { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 14px; }
.cc-person-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cc-mini { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 8px; align-content: start; }
.cc-mini.wide { grid-column: 1 / -1; }
.cc-mini h3 { margin: 0; font-size: 14.5px; }
.cc-mini select[multiple] { min-height: 92px; }
.cc-checks { display: flex; flex-wrap: wrap; gap: 8px; }
.cc-checks label { display: flex; align-items: center; gap: 4px; }
.cc-revealed { background: color-mix(in srgb, #F59F00 25%, transparent); padding: 0 4px; border-radius: 4px; }
.cc-viewas { border: 1px dashed var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; background: var(--hover); }
.cc-viewas h3 { margin: 0 0 4px; font-size: 14.5px; }
.cc-viewas p { margin: 6px 0; font-size: 14px; }
.cc-meter { display: grid; grid-template-columns: 110px 1fr auto; gap: 8px; align-items: center; font-size: 13px; margin: 6px 0; }
.cc-counts { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--muted); margin: 8px 0; text-transform: capitalize; }
.cc-counts b { color: var(--ink); }
.cc-dlg { display: grid; gap: 10px; padding: 22px; }
.cc-dlg h2 { margin: 0; font: 800 20px/1.2 var(--display); }
.cc-dlg p { margin: 0; }
.cc-dlg-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
#dlg { width: min(620px, calc(100% - 24px)); max-height: calc(calc(100 * var(--vh, 1vh)) - 40px); overflow: auto; }
.cc-perms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.cc-perms fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 0; display: grid; gap: 4px; }
.cc-perms legend { font-weight: 700; font-size: 13px; padding: 0 4px; }
.cc-perms label { display: flex; gap: 6px; align-items: flex-start; font-size: 13.5px; }
.cc-perms .cc-off { opacity: 0.45; }
.cc-risk { font-size: 11px; font-weight: 700; color: var(--danger); text-transform: uppercase; letter-spacing: 0.04em; }
@media (max-width: 760px) { .cc-two, .cc-person-grid, .cc-perms { grid-template-columns: 1fr; } .cc-who small { display: none; } }

/* site-wide announcement bar and personal notices */
.ax-ann { position: fixed; top: 0; left: 0; right: 0; z-index: 90; display: flex; justify-content: center; align-items: center; gap: 12px; padding: 7px 44px 7px 16px;
  font-size: 14px; font-weight: 500; background: var(--accent); color: var(--accent-ink); text-align: center; }
.ax-ann.warning { background: #E8590C; color: #fff; } .ax-ann.success { background: #2B8A3E; color: #fff; }
.ax-ann a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.ax-ann-x { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 8px; }
body.has-ann { padding-top: 34px; }
body.has-ann .app, body.has-ann > .shell { height: calc(100% - 34px); }
.ax-notice { position: fixed; top: 50px; left: 50%; transform: translateX(-50%); z-index: 91; width: min(420px, calc(100% - 32px)); display: grid; gap: 6px;
  padding: 16px 18px; border-radius: 16px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
.ax-notice b { font: 800 17px/1.25 var(--display); }
.ax-notice p { margin: 0; white-space: pre-wrap; }
.ax-notice small { color: var(--muted); }
.ax-notice .primary { justify-self: end; }
.cc .fine, .cc-drawer .fine, .cc-dlg .fine, .cc-role p { text-align: left; }
.cc-mini > button, .cc-mini .cc-row button { justify-self: start; }
.cc-mini .primary.tiny, .cc-person-grid .primary.tiny { padding: 6px 14px; font-size: 13.5px; border-radius: 10px; }
body.has-ann > .shell { height: calc(calc(100 * var(--vh, 1vh)) - 34px); min-height: 0; }
.cc-dlg > label { flex: none; }
.cc-dlg input:not([type=checkbox]):not([type=color]), .cc-mini input { height: auto; min-height: 0; }
.cc-dlg input[type=color] { width: 54px; height: 38px; padding: 3px; }
.cc-perms fieldset { align-content: start; }
.cc-perms input[type=checkbox], .cc-checks input, .cc-check input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; }
@media (max-width: 760px) { .cc-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .cc-tabs button { white-space: nowrap; padding: 10px 10px; } }
.size-pick { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 13px; }
.size-pick span { color: var(--muted); margin-right: 4px; }
.size-pick button { border: 1px solid var(--line); background: none; border-radius: 8px; padding: 3px 8px; font-size: 12.5px; cursor: pointer; }
.size-pick button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* + flyout and in-chat Drive picker */
.plus-flyout {
  position: absolute; left: 8px; bottom: calc(100% + 8px); z-index: 40; width: min(360px, calc(100% - 16px));
  max-height: min(70vh, 560px); overflow: auto; padding: 8px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--tint-glass, color-mix(in srgb, var(--surface) 86%, transparent));
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow);
  display: grid; gap: 2px;
}
.plus-flyout[hidden] { display: none; }
.fly-sec { margin: 8px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.plus-flyout button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.plus-flyout button:hover, .plus-flyout button:focus-visible { background: var(--hover); }
.plus-flyout button[aria-pressed="true"] { background: var(--accent-soft); }
.plus-flyout svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.plus-flyout span { display: grid; min-width: 0; }
.plus-flyout b { font-weight: 600; }
.plus-flyout small { color: var(--muted); font-size: 12.5px; }
.drive-popover {
  position: absolute; left: 8px; right: 8px; bottom: calc(100% + 8px); z-index: 41; max-height: min(56vh, 480px);
  display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 18px;
  background: var(--tint-glass, color-mix(in srgb, var(--surface) 90%, transparent));
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow);
}
.drive-popover[hidden] { display: none; }
.dp-head { display: flex; align-items: center; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
.dp-search { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; padding: 0 10px; border-radius: 10px; background: var(--hover); color: var(--faint); }
.dp-search svg { width: 16px; height: 16px; flex: none; }
.dp-search input { flex: 1; min-width: 0; padding: 8px 0; border: 0; background: none; color: var(--ink); font: inherit; outline: 0; }
.dp-head .segmented { display: flex; padding: 2px; border-radius: 10px; background: var(--hover); }
.dp-head .segmented button { width: 32px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); display: grid; place-items: center; }
.dp-head .segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); }
.dp-head .segmented svg { width: 16px; height: 16px; }
.dp-sub { margin: 0; padding: 6px 12px; font-size: 12.5px; color: var(--muted); }
.dp-body { flex: 1; overflow: auto; padding: 8px 10px 12px; }
.dp-body.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.dp-body.list { display: grid; gap: 4px; }
.dp-label { grid-column: 1 / -1; margin: 8px 0 0; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.dp-tile { display: grid; gap: 4px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.dp-tile:hover { border-color: var(--accent); }
.dp-tile.on { border-color: var(--accent); background: var(--accent-soft); }
.dp-tile img { width: 100%; height: 64px; object-fit: cover; border-radius: 8px; background: var(--hover); }
.dp-badge { display: grid; place-items: center; height: 64px; border-radius: 8px; background: var(--hover); color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; }
.dp-body.list .dp-tile { grid-template-columns: 48px minmax(0, 1fr); align-items: center; }
.dp-body.list .dp-tile img, .dp-body.list .dp-badge { height: 40px; width: 40px; }
.dp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 600; }
.dp-tile small { color: var(--muted); font-size: 11.5px; }
@media (max-width: 720px) { .dp-body.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.mode-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 4px 8px; }
.mode-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 600; }
.mode-chip[aria-pressed="true"] { border-color: var(--accent); }
.mode-chip span { font-weight: 400; opacity: 0.7; }
.mode-style { min-width: 140px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12.5px; }

/* Mail density: Panoramic (72), Focused (48), Fovea (32) */
.density { position: relative; }
.density .dens-glow { position: absolute; top: 3px; bottom: 3px; width: 33%; border-radius: 8px; background: var(--accent-soft); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), 0 0 12px color-mix(in srgb, var(--accent) 30%, transparent); transition: transform 0.22s ease; pointer-events: none; }
.density-panoramic .dens-glow, .mail-app[data-density="panoramic"] .dens-glow { transform: translateX(0); }
.density-focused .dens-glow, .mail-app[data-density="focused"] .dens-glow { transform: translateX(100%); }
.density-fovea .dens-glow, .mail-app[data-density="fovea"] .dens-glow { transform: translateX(200%); }
.density-panoramic .msg-row, .mail-app[data-density="panoramic"] .msg-row { min-height: 72px; padding: 14px 14px 12px; gap: 4px; }
.density-panoramic .row-snippet, .mail-app[data-density="panoramic"] .row-snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; white-space: normal; line-height: 1.55; }
.density-panoramic .row-chips, .mail-app[data-density="panoramic"] .row-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.density-focused .msg-row, .mail-app[data-density="focused"] .msg-row { min-height: 48px; padding: 8px 12px; }
.density-focused .row-snippet, .mail-app[data-density="focused"] .row-snippet { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.density-focused .row-chips, .mail-app[data-density="focused"] .row-chips { display: none; }
.density-focused .row-attach, .mail-app[data-density="focused"] .row-attach { display: inline; color: var(--faint); font-size: 12px; }
.density-fovea .msg-row, .mail-app[data-density="fovea"] .msg-row { min-height: 32px; grid-template-columns: minmax(88px, 150px) minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; font-size: 13px; }
.density-fovea .row-top, .mail-app[data-density="fovea"] .row-top { display: contents; }
.density-fovea .row-subject, .mail-app[data-density="fovea"] .row-subject { font-size: 13px; }
.density-fovea .row-snippet, .density-fovea .row-chips,
.mail-app[data-density="fovea"] .row-snippet, .mail-app[data-density="fovea"] .row-chips { display: none; }
.density-fovea .msg-row.unread .row-top b::before, .mail-app[data-density="fovea"] .msg-row.unread .row-top b::before { margin-right: 5px; }
.mail-ribbon { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--line); background: var(--sidebar); }
.mail-ribbon .rib-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.mail-ribbon .rib-btn:hover:not(:disabled) { background: var(--hover); }
.mail-ribbon .rib-btn:disabled, .mail-ribbon .rib-btn.rib-off { opacity: 0.4; cursor: default; }
.mail-ribbon .rib-btn.on { color: var(--danger, #c0392b); font-weight: 600; }
.mail-ribbon .rib-btn.dragging { opacity: 0.45; }
.mail-ribbon .rib-btn.drop-target { outline: 1px dashed var(--accent); }
.mail-ribbon .rib-btn[hidden] { display: none; }
.mail-ribbon .rib-step { border: 1px solid var(--line); background: var(--surface); }
.mail-ribbon .rib-more { margin-left: auto; }
.msg-row .row-meta { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.msg-row.flagged .row-flag { display: inline-flex; width: 12px; height: 12px; color: var(--danger, #c0392b); }
.msg-row .row-flag svg { width: 12px; height: 12px; }
.compose-pop { margin-left: 6px; }
.ribbon-dialog { width: min(460px, calc(100% - 24px)); padding: 16px 18px 14px; }
.ribbon-dialog .compose-head { margin-bottom: 4px; }
.ribbon-tools { display: grid; gap: 4px; max-height: 220px; overflow: auto; margin: 10px 0 14px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.ribbon-tool { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; cursor: grab; font-size: 14px; }
.ribbon-tool:hover { background: var(--hover); }
.ribbon-tool small { color: var(--faint); font-size: 11px; }
.ribbon-steps-block { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.ribbon-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ribbon-steps li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--bg); font-size: 13.5px; }
.ribbon-steps li small { color: var(--muted); }
.ribbon-checks { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.ribbon-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.ribbon-foot { margin-top: 12px; justify-content: space-between; }

/* Drive workspace */
.drive-workspace { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; flex: 1; }
.drive-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.drive-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 14px; }
.drive-crumbs button { border: 0; background: none; color: var(--accent); font: inherit; padding: 2px 4px; border-radius: 6px; }
.drive-crumbs button:hover { background: var(--hover); }
.drive-table { width: 100%; border-collapse: collapse; }
.drive-table th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--faint); padding: 8px; border-bottom: 1px solid var(--line); cursor: pointer; }
.drive-table td { padding: 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.drive-table tr:hover td { background: var(--hover); }
.drive-table tr.selected td { background: var(--accent-soft); }
.drive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.drive-card { display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); cursor: pointer; }
.drive-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.drive-card .dp-badge, .drive-card img { height: 72px; border-radius: 10px; }
.drive-bulk { display: flex; gap: 6px; }

/* Unified pin / speed-dial: always visible at the bottom right */
.omni-fab {
  position: fixed; right: 0; bottom: 0; z-index: 9999; display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-end;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom, 0px)) 0; pointer-events: none;
}
.omni-core { pointer-events: auto; width: 48px; height: 48px; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; }
.omni-core svg { width: 22px; height: 22px; }
.omni-fab.open .omni-core { border-radius: 16px; }
.omni-dial { pointer-events: auto; display: grid; gap: 4px; margin-bottom: 8px; padding: 8px; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); border-radius: 16px;
  background: var(--tint-glass, color-mix(in srgb, var(--surface) 72%, transparent)); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); box-shadow: var(--shadow); min-width: 240px; }
.omni-dial[hidden] { display: none; }
.omni-dial button { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.omni-dial button:hover:not(:disabled) { background: var(--hover); }
.omni-dial button:disabled { opacity: 0.45; cursor: default; }
.omni-dial svg { width: 18px; height: 18px; color: var(--accent); flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.omni-dial span { display: grid; min-width: 0; }
.omni-dial b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.omni-dial small { color: var(--muted); font-size: 12px; }
.omni-dial .omni-back { border-bottom: 1px solid var(--line); border-radius: 12px 12px 0 0; margin-bottom: 2px; }
.omni-overlay { position: fixed; inset: 0; z-index: 9998; display: grid; place-items: center; padding: 16px; background: rgba(10, 14, 30, 0.45); }
.omni-overlay[hidden] { display: none; }
.omni-card { width: min(560px, 100%); max-height: min(80vh, 720px); overflow: auto; padding: 18px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); display: grid; gap: 10px; }
body.has-omni .sp-bubble { display: none !important; }
@media print { .omni-fab, .omni-overlay { display: none; } }

.drift-title-lab { display: block; margin: 0 0 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.drift-title { width: 100%; box-sizing: border-box; margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; }

.ctx-gauge { display: flex; align-items: center; gap: 8px; margin: 0 2px 8px; }
.ctx-gauge[hidden] { display: none; }
.ctx-gauge-bar { display: block; height: 4px; flex: 1; border-radius: 99px; background: color-mix(in srgb, var(--ok) 70%, transparent); }
.ctx-gauge.amber .ctx-gauge-bar { background: #d4a017; }
.ctx-gauge.rose .ctx-gauge-bar { background: color-mix(in srgb, var(--danger) 80%, transparent); }
.ctx-gauge-label { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.ctx-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.ctx-chips[hidden] { display: none; }
.ctx-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 8px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg); font-size: 12px; color: var(--ink); }
.ctx-chip.dormant { opacity: 0.55; }
.ctx-chip button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 11.5px; cursor: pointer; padding: 0; }
.ctx-chip .pin { color: var(--accent); }
.att.dormant { opacity: 0.55; }
.att-pin { width: 26px; height: 26px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.att-pin[aria-pressed="true"] { color: var(--accent); }

.attempt { width: min(640px, 100%); justify-self: end; margin: 0 0 8px; border: 1px dashed color-mix(in srgb, var(--muted) 45%, transparent); border-radius: 14px; background: color-mix(in srgb, var(--bubble) 40%, transparent); color: var(--muted); font-size: 13px; }
.attempt summary { cursor: pointer; padding: 8px 12px; font-weight: 650; list-style: none; }
.attempt summary::-webkit-details-marker { display: none; }
.attempt .attempt-body { padding: 0 12px 10px; display: grid; gap: 6px; }
.attempt .attempt-prompt { margin: 0; white-space: pre-wrap; color: var(--ink); }
.attempt .attempt-out { margin: 0; padding: 8px 10px; border-radius: 10px; background: var(--bg); font: 12.5px/1.45 var(--mono); white-space: pre-wrap; color: var(--muted); }

.q-run { color: var(--accent); }
.q-run svg { width: 16px; height: 16px; }

.cv-hunks { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cv-hunks[hidden] { display: none; }
.cv-hunk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.cv-hunk-spacer { flex: 1; }
.cv-hunk-view { flex: 1; overflow: auto; padding: 10px 12px; display: grid; gap: 10px; }
.cv-hunk { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.cv-hunk.rejected { opacity: 0.55; }
.cv-hunk-head { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.cv-hunk-head span { flex: 1; font: 12px/1.4 var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-hunk pre { margin: 0; padding: 8px 10px; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; }
.cv-hunk .add { background: color-mix(in srgb, var(--ok) 16%, transparent); }
.cv-hunk .del { background: color-mix(in srgb, var(--danger) 16%, transparent); text-decoration: line-through; }
.cv-hunk-view.split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cv-hunk-view.split .cv-hunk { display: contents; }
.cv-hunk-pane { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.cv-hunk-pane h4 { margin: 0; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.cv-hunk-pane pre { margin: 0; padding: 8px 10px; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; min-height: 40px; }

.hs-host { margin-top: 6px; }
.hs-pill { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 10px; border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--line)); border-radius: 99px; background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ink); font: inherit; font-size: 12px; cursor: pointer; }
.hs-pill .hs-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 70%, transparent); animation: hs-pulse 1.6s ease-out infinite; }
.hs-pill.locked .hs-dot { animation: none; background: var(--muted); }
.hs-pill .hs-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.hs-pill .hs-lock { font-size: 13px; }
.hs-pill.hs-flash { outline: 2px solid var(--accent); }
@keyframes hs-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .hs-pill .hs-dot { animation: none; }
}
.dw-head .hs-host { margin-top: 0; flex: none; }
.dw-head .hs-pill { margin-left: 4px; max-width: none; padding: 2px 7px; gap: 4px; }
.dw-head .hs-pill .hs-label { display: none; }
.dock-win.bot .hs-pill, .dock-win.mail .hs-pill {
  background: color-mix(in srgb, var(--accent-ink) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent-ink) 35%, transparent);
  color: var(--accent-ink);
}
.dock-win.bot .hs-pill .hs-dot, .dock-win.mail .hs-pill .hs-dot { background: var(--accent-ink); }
.dock-pair .hs-host { display: none; }
.mail-flash { outline: 2px solid var(--accent); }
