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

:root {
  /* Apple-inspired materials: soft gray stage, white cards, system blue. */
  --bg: #F5F5F7;
  --sidebar: #F0F0F2;
  --surface: #FFFFFF;
  --ink: #1D1D1F;
  --muted: #6E6E73;
  --faint: #86868B;
  --line: #D2D2D7;
  --hover: rgba(0, 0, 0, 0.04);
  --accent: #0071E3;
  --accent-ink: #FFFFFF;
  --accent-soft: #E8F1FC;
  --bubble: #F2F2F7;
  --danger: #FF3B30;
  --ok: #34C759;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.06);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --chrome-h: 52px;
  --sidebar-w: 260px;

  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Helvetica, Arial, sans-serif;
  --text: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --sidebar: #1C1C1E;
    --surface: #2C2C2E;
    --ink: #F5F5F7;
    --muted: #A1A1A6;
    --faint: #8E8E93;
    --line: #3A3A3C;
    --hover: rgba(255, 255, 255, 0.08);
    --accent: #0A84FF;
    --accent-ink: #FFFFFF;
    --accent-soft: #0B2748;
    --bubble: #1C1C1E;
    --danger: #FF453A;
    --ok: #30D158;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 12px 28px rgba(0, 0, 0, 0.45);
    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 15px/1.47 var(--text);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  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: 980px;
  background: transparent;
  color: var(--muted);
  transition: background .12s ease, color .12s ease;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }

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

.primary {
  border: 0;
  border-radius: 980px;
  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 14px; 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; }
.verify-local {
  margin: 0 0 22px; padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent, #4f6ef7) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent, #4f6ef7) 28%, transparent);
  color: var(--ink); font: 600 14.5px/1.4 var(--sans); letter-spacing: 0.02em;
}
.verify-local[hidden] { display: none !important; }

.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; }
.phone-row {
  display: flex; gap: 8px; align-items: stretch;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); padding: 0 4px 0 0;
}
.phone-row:focus-within { border-color: var(--accent); }
.phone-row select {
  flex: 0 0 auto; max-width: 7.5rem; border: 0; background: transparent; color: var(--ink);
  font: inherit; padding: 10px 8px; border-radius: 12px;
}
.phone-row input {
  flex: 1; min-width: 0; border: 0 !important; background: transparent !important; padding: 10px 12px 10px 4px !important;
}
.mfa-pick {
  border: 0; margin: 4px 0 0; padding: 0; display: grid; gap: 6px;
}
.mfa-pick legend { font-size: 13.5px; font-weight: 600; padding: 0; margin-bottom: 2px; }
.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;
  min-width: 0;
}
.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%);
  min-width: 0;
  flex: 1 1 auto;
  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: 220px minmax(0, 1fr);
  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: 220px minmax(0, 1fr); }
/* Relay docks as a third column — same chrome family as Messenger’s info rail */
.mail-app.mcp-rail-open,
body.mcp-open .mail-app {
  grid-template-columns: 220px minmax(0, 1fr) minmax(300px, 340px);
}
@media (max-width: 1180px) {
  .mail-app.mcp-rail-open,
  body.mcp-open .mail-app { grid-template-columns: 200px minmax(0, 1fr) minmax(280px, 320px); }
}
@media (max-width: 960px) {
  .mail-app.mcp-rail-open,
  body.mcp-open .mail-app { grid-template-columns: 220px minmax(0, 1fr); }
  body.mcp-open .mail-ai.mcp-rail {
    position: fixed; inset: calc(var(--chrome-h, 52px) + env(safe-area-inset-top, 0px)) 0 0 auto;
    width: min(360px, 100vw); z-index: 30; border-left: 1px solid var(--line);
    box-shadow: -12px 0 32px rgba(15, 23, 42, 0.08);
  }
}
.mail-side { padding: 14px 12px; border-right: 1px solid var(--line); overflow: auto; display: flex; flex-direction: column; gap: 12px; background: #F7F8FC; min-width: 0; }
[data-theme="dark"] .mail-side, body.dark .mail-side { background: var(--sidebar); }
.mail-side .primary, .mail-write {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none;
  height: 44px; border-radius: 12px; font-weight: 700; font-size: 15px;
}
.mail-side .primary svg, .mail-write svg { width: 17px; height: 17px; }
.mail-folders-label { margin: 2px 0 0; flex: none; }
.side-plus {
  margin-left: 6px; width: 22px; height: 22px; border: 0; border-radius: 6px; background: var(--hover);
  color: var(--muted); font: 700 14px/1 var(--text); cursor: pointer; vertical-align: middle;
}
.side-plus:hover { color: var(--accent); background: var(--accent-soft); }
.folders { display: grid; gap: 2px; width: 100%; flex: none; }
.folder { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; font: inherit; font-size: 14.5px; cursor: pointer; }
.folder svg { width: 18px; height: 18px; flex: none; color: var(--muted); }
.folder:hover { background: var(--hover); }
.folder.active { background: color-mix(in srgb, var(--accent) 14%, #fff); color: var(--accent); font-weight: 700; box-shadow: none; }
.folder.active svg { color: var(--accent); }
.folder b {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px;
  background: #E11D48; color: #fff; font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center;
}
.mail-storage-card {
  margin-top: auto; border: 1px solid var(--line); border-radius: 14px; padding: 12px;
  background: var(--surface); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.mail-storage-card .side-label { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); }
.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; }
.addr-list .inbox-row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 4px 6px; border: 0; border-radius: 8px; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.addr-list .inbox-row.on { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.addr-list .unread-n { margin-left: auto; color: var(--accent); font-size: 12px; }
.all-inboxes { width: 100%; margin: 0 0 6px; }
.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; }
.stream-bar { display: flex; align-items: center; gap: 8px; padding: 10px 12px 0; flex-wrap: wrap; }
.mail-search { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px; 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; }
.mail-layout { display: flex; flex: none; padding: 3px; border-radius: 10px; background: var(--hover); gap: 0; }
.mail-layout button { border: 0; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.mail-layout button[aria-pressed="true"] { background: var(--accent); color: #fff; box-shadow: none; }
.mail-layout-note { display: none; }
.mail-quick-filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.mail-quick-filters button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 99px; cursor: pointer; }
.mail-quick-filters button[aria-pressed="true"] { border-color: transparent; background: var(--accent); color: #fff; }
.mail-quick-filters button.qfilter-drive[aria-pressed="true"] { letter-spacing: 0.01em; }
.mail-drive-side { padding: 4px 10px 8px; border-top: 1px solid var(--line); margin-top: 4px; }
.mail-drive-folder { width: 100%; }
.mail-drive-folder.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.drive-read { display: flex; flex-direction: column; gap: 10px; min-height: 0; padding-bottom: 8px; }
.drive-read[hidden] { display: none; }
.drive-read h1 { margin: 0; font-size: 1.35rem; line-height: 1.25; }
.drive-crumb { margin: 0; color: var(--muted); font-size: 12.5px; word-break: break-word; }
.drive-att-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; overflow: auto; min-height: 0; flex: 1; }
.drive-att-card { display: grid; grid-template-columns: 72px 1fr auto auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
.drive-thumb { width: 72px; height: 72px; border-radius: 10px; display: grid; place-items: center; background: linear-gradient(160deg, #EEF2FF, #E0E7FF); color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 0.04em; overflow: hidden; }
.drive-thumb span { padding: 4px 6px; border-radius: 6px; background: rgba(255,255,255,0.75); }
.drive-thumb-img { background-size: cover; background-position: center; }
.drive-thumb-pdf { background: linear-gradient(160deg, #FEE2E2, #FECACA); color: #B91C1C; }
.drive-thumb-doc { background: linear-gradient(160deg, #FFEDD5, #FED7AA); color: #C2410C; }
.drive-thumb-code { background: linear-gradient(160deg, #1E293B, #0F172A); color: #93C5FD; }
.drive-att-meta { min-width: 0; display: grid; gap: 3px; }
.drive-att-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.drive-att-meta small { color: var(--muted); font-size: 12px; }
.drive-type { display: inline-block; padding: 1px 7px; border-radius: 99px; background: var(--hover); font-weight: 700; font-size: 10.5px; letter-spacing: 0.04em; }
.drive-att-card .drive-dl { color: var(--muted); }
.drive-att-card .drive-dl svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drive-path-foot { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.drive-path-foot code { font: 12px/1.4 var(--mono, ui-monospace, monospace); color: var(--ink); word-break: break-word; }
.drive-empty { margin: 24px 0; color: var(--faint); text-align: center; }
.att-preview { display: flex; flex-direction: column; gap: 10px; min-height: 280px; flex: 1; }
.att-preview[hidden] { display: none; }
.att-preview-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.att-preview-head b { flex: 1; min-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-preview-dl { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; padding: 8px 14px; border-radius: 10px; }
.att-preview-stage { flex: 1; min-height: 240px; border: 1px solid var(--line); border-radius: 14px; overflow: auto; background: #0B1220; color: #E2E8F0; position: relative; }
.att-preview-img { display: block; max-width: 100%; margin: 0 auto; background: #111; }
.att-preview-frame { width: 100%; height: min(70vh, 640px); border: 0; background: #fff; }
.att-preview-code { margin: 0; padding: 18px 20px; font: 12.5px/1.55 var(--mono, ui-monospace, monospace); white-space: pre-wrap; word-break: break-word; }
.att-preview-fallback { margin: 40px 20px; text-align: center; color: #94A3B8; }
.mail-features-block { margin-bottom: 4px; }
.mail-features-block code { font-size: 11.5px; }
.density { display: flex; flex: none; align-items: center; padding: 3px; border-radius: 10px; background: var(--hover); gap: 0; }
.density .dens-label { padding: 0 6px 0 8px; font-size: 11.5px; font-weight: 700; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; }
.density button { border: 0; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; padding: 5px 8px; border-radius: 8px; cursor: pointer; }
.density button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.mail-ask { display: inline-flex !important; align-items: center; gap: 6px; border-radius: 99px !important; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)) !important; background: var(--accent-soft) !important; color: var(--accent) !important; font-weight: 700; }
.mail-ask svg { width: 15px; height: 15px; }

/* Classic (Mailbird 3-pane) / Split / List — colors still come from Appearance. */
.mail-app.layout-betterbird .mail-split,
.mail-app[data-layout="betterbird"] .mail-split { flex-direction: column; }
.mail-app.layout-classic {
  grid-template-columns: 220px minmax(0, 1fr);
}
.mail-app.layout-classic .mail-split,
.mail-app[data-layout="classic"] .mail-split { flex-direction: row; align-items: stretch; }
.mail-app.layout-classic .mail-stream.open .msg-list,
.mail-app[data-layout="classic"] .mail-stream.open .msg-list,
.mail-app.layout-classic .mail-stream .msg-list,
.mail-app[data-layout="classic"] .mail-stream .msg-list {
  flex: 0 0 min(36%, 380px); max-width: 420px; border-right: 1px solid var(--line);
  background: #FAFBFE; padding: 0;
}
[data-theme="dark"] .mail-app.layout-classic .msg-list,
[data-theme="dark"] .mail-app[data-layout="classic"] .msg-list { background: color-mix(in srgb, var(--bg) 55%, var(--surface)); }
.mail-app.layout-classic .mail-stream.open .mail-read,
.mail-app[data-layout="classic"] .mail-stream.open .mail-read,
.mail-app.layout-classic .mail-stream .mail-read,
.mail-app[data-layout="classic"] .mail-stream .mail-read {
  flex: 1 1 auto; border-top: 0; min-width: 0; display: flex; flex-direction: column;
}
.mail-app.layout-classic .mail-stream:not(.open) .mail-read,
.mail-app[data-layout="classic"] .mail-stream:not(.open) .mail-read {
  display: flex; flex-direction: column; flex: 1 1 auto; border-top: 0;
}
.mail-app.layout-classic .folder.active,
.mail-app[data-layout="classic"] .folder.active {
  background: color-mix(in srgb, var(--accent) 14%, #fff); color: var(--accent); box-shadow: none; font-weight: 700;
}
.mail-app.layout-classic .folder.active svg,
.mail-app[data-layout="classic"] .folder.active svg { color: var(--accent); }
.mail-app.layout-classic .msg-row,
.mail-app[data-layout="classic"] .msg-row {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 2px 10px; align-items: start;
  border-radius: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  padding: 12px 14px; border-left: 3px solid transparent;
}
.mail-app.layout-classic .msg-row .row-avatar { grid-row: 1 / span 3; align-self: center; }
.mail-app.layout-classic .msg-row .row-top { grid-column: 2; }
.mail-app.layout-classic .msg-row .row-meta { grid-column: 3; grid-row: 1; }
.mail-app.layout-classic .msg-row .row-subject { grid-column: 2 / span 2; }
.mail-app.layout-classic .msg-row .row-snippet { grid-column: 2 / span 2; }
.mail-app.layout-classic .msg-row .row-chips { grid-column: 2 / span 2; }
.mail-app.layout-classic .msg-row.active,
.mail-app[data-layout="classic"] .msg-row.active {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-left-color: var(--accent);
  box-shadow: none;
}
.mail-app.layout-classic .read-empty,
.mail-app[data-layout="classic"] .read-empty {
  flex: 1; display: grid; place-items: center; text-align: center; padding: 32px;
  color: var(--muted);
}
.mail-app.layout-list .mail-stream.open .msg-list,
.mail-app[data-layout="list"] .mail-stream.open .msg-list { flex: 1 1 auto; }
.mail-app.layout-list .mail-stream.open .mail-read,
.mail-app[data-layout="list"] .mail-stream.open .mail-read {
  position: absolute; inset: 0; z-index: 5; background: var(--surface); border-top: 0;
  display: block; overflow: auto;
}
.mail-app.layout-list .mail-stream { position: relative; }
.mail-app.layout-list .back-btn { display: inline-flex; }
.mail-app.layout-classic .mail-quick-filters,
.mail-app[data-layout="classic"] .mail-quick-filters { display: flex; }
.row-avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font: 700 13px/1 var(--text); flex: none;
}
.read-foot {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 18px;
  border-top: 1px solid var(--line);
}
.read-foot-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px;
  border-radius: 12px; font-weight: 600;
}
.read-foot-btn svg { width: 16px; height: 16px; }
@media (max-width: 980px) {
  .mail-app.layout-classic .mail-split,
  .mail-app[data-layout="classic"] .mail-split { flex-direction: column; }
  .mail-app.layout-classic .mail-stream.open .msg-list,
  .mail-app[data-layout="classic"] .mail-stream.open .msg-list,
  .mail-app.layout-classic .mail-stream .msg-list,
  .mail-app[data-layout="classic"] .mail-stream .msg-list { flex: 0 1 40%; max-width: none; border-right: 0; }
  .mail-app.layout-classic .mail-stream.open .mail-read,
  .mail-app[data-layout="classic"] .mail-stream.open .mail-read { border-top: 1px solid var(--line); }
}
.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; }
.mail-app.layout-classic .mail-read #read,
.mail-app[data-layout="classic"] .mail-read #read {
  display: flex; flex-direction: column; min-height: 100%;
}
.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)); }
/* Only when open — a bare display:flex keeps closed <dialog> visible and blocks the Mail page. */
dialog.compose.gmail-dialog[open] { 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); }

/* ---- Relay floating overlay + top bubble + edge tab ---- */
.mcp-topbar {
  display: flex; align-items: center; gap: 8px; max-width: min(420px, 46vw); min-width: 0;
}
.mcp-topbar[hidden] { display: none !important; }
.mcp-bubble {
  display: flex; align-items: center; gap: 2px; min-width: 0; max-width: 100%;
  padding: 2px 3px 2px 4px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--accent-soft);
}
.mcp-bubble[hidden] { display: none !important; }
.mcp-bubble-open {
  display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; padding: 5px 8px 5px 7px;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.mcp-bubble-open:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.mcp-spark { width: 16px; height: 16px; color: var(--accent); flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ai-head b { display: inline-flex; align-items: center; gap: 6px; }
.ai-head .mcp-spark { width: 15px; height: 15px; }
.mcp-dot {
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: #22C55E; box-shadow: 0 0 0 3px color-mix(in srgb, #22C55E 24%, transparent);
}
.mcp-bubble-copy { display: grid; min-width: 0; }
.mcp-bubble-copy b { font: 700 12.5px/1.15 var(--display); color: var(--accent); }
.mcp-bubble-copy small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-bubble-x { width: 28px; height: 28px; flex: none; }
.mcp-home-link { display: none !important; }
.mcp-drag-hint { display: none !important; }

.mcp-edge {
  position: fixed; top: 50%; z-index: 41; transform: translateY(-50%);
  writing-mode: vertical-rl; text-orientation: mixed;
  padding: 18px 7px; border: 1px solid var(--line); border-radius: 14px 0 0 14px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--ink);
  font: 700 12px/1 var(--display); letter-spacing: 0.04em; cursor: pointer;
  box-shadow: var(--shadow);
}
.mcp-edge[hidden] { display: none !important; }
.mcp-edge[data-side="right"] { right: 0; border-radius: 14px 0 0 14px; }
.mcp-edge[data-side="left"] { left: 0; border-radius: 0 14px 14px 0; writing-mode: vertical-lr; }
.mcp-edge:hover { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }

.mail-ai.mcp-overlay, .mail-ai {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--sidebar);
}
/* Native Mail rail — not a floating external card */
.mail-ai.mcp-rail {
  position: relative; top: auto; right: auto; width: auto; height: auto;
  z-index: 1; border: 0; border-left: 1px solid var(--line); border-radius: 0;
  box-shadow: none; overflow: hidden; background: var(--sidebar);
}
.mail-ai.mcp-overlay[hidden] { display: none !important; }
.mcp-drag { cursor: default; touch-action: pan-y; user-select: none; }
.mcp-hint { display: none; }

.ai-head {
  display: flex; align-items: flex-start; gap: 8px; padding: 12px 12px 10px;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.ai-head-title { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ai-head-tools { display: inline-flex; align-items: center; gap: 1px; flex: none; }
.ai-head-tools .icon-btn { width: 30px; height: 30px; color: var(--muted); }
.ai-head-tools .icon-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ai-head b { font: 700 15px/1.2 var(--display); }
.ai-head small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-head .hs-host { margin-top: 4px; }
.ai-model-wrap {
  flex: none; display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px 2px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg);
}
.ai-model-wrap > .mcp-spark { width: 12px; height: 12px; }
.ai-model-wrap select {
  appearance: none; -webkit-appearance: none;
  max-width: 78px; padding: 4px 16px 4px 2px; border: 0;
  border-radius: 999px; color: var(--ink); font: 600 12px/1.2 var(--text);
  cursor: pointer; outline: 0; background: transparent;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 11px;
}
.ai-model-wrap select:focus { color: var(--accent); }
.ai-model-wrap.ai-model-locked {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--accent-soft);
}
.ai-model-wrap.ai-model-locked select {
  cursor: default; max-width: 96px; color: var(--accent);
  background-image: none; padding-right: 6px;
}
.ai-close { display: inline-grid; }
/* Messenger-aligned thread surface */
.ai-log {
  list-style: none; margin: 0; padding: 14px 12px 12px; overflow: auto; flex: 1;
  display: flex; flex-direction: column; gap: 10px; background: var(--bg);
}
.ai-msg { max-width: 100%; display: grid; gap: 4px; }
.ai-model-chip {
  display: inline-flex; align-items: center; gap: 5px; margin: 0; padding: 2px 8px;
  width: fit-content; border-radius: 999px; background: var(--accent-soft);
  font-size: 11px; font-weight: 600; color: var(--accent); letter-spacing: 0.01em;
}
.ai-model-chip .mcp-spark { width: 11px; height: 11px; }
.ai-bub {
  padding: 10px 14px; border-radius: 16px; font-size: 14px; line-height: 1.45;
  overflow-wrap: anywhere; background: var(--bubble, var(--surface));
}
.ai-msg.user { align-self: flex-end; max-width: 88%; justify-items: end; }
.ai-msg.user .ai-bub {
  background: var(--accent-soft); color: var(--ink); white-space: pre-wrap;
  border-radius: 16px 16px 6px 16px;
}
.ai-msg.user .ai-meta {
  display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-size: 11px; padding: 0 4px;
}
.ai-msg.user .ai-checks { color: var(--accent); letter-spacing: -1px; font-weight: 700; }
.ai-msg.assistant { align-self: stretch; max-width: 96%; }
.ai-msg.assistant .ai-bub {
  background: transparent; border: 1px solid var(--line);
  border-radius: 16px; box-shadow: none;
}
.ai-msg.assistant .ai-bub > :first-child { margin-top: 0; }
.ai-msg.assistant .ai-bub > :last-child { margin-bottom: 0; }
.ai-msg.assistant .ai-bub p { margin: 0 0 0.55em; }
.ai-msg.assistant .ai-bub ul, .ai-msg.assistant .ai-bub ol { margin: 0.2em 0 0.6em; padding-left: 1.2em; }
.ai-thumb {
  width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--muted);
  font-size: 14px; cursor: pointer; justify-self: start;
}
.ai-thumb:hover, .ai-thumb.on { background: var(--hover); color: var(--accent); }
.ai-msg.note { align-self: center; color: var(--faint); font-size: 12.5px; text-align: center; padding: 8px 6px; }
.ai-form { display: flex; flex: none; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.ai-composer {
  display: grid; grid-template-columns: 1fr auto auto; align-items: end; gap: 6px; width: 100%;
  padding: 4px 4px 4px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg);
}
.ai-composer:focus-within { border-color: var(--accent); }
.ai-form textarea {
  flex: 1; min-width: 0; min-height: 38px; max-height: 120px; padding: 8px 0; border: 0;
  border-radius: 0; background: transparent; resize: none; outline: 0; font: inherit; font-size: 14px; line-height: 1.4;
}
.ai-attach { width: 34px; height: 34px; color: var(--muted); }
.ai-attach svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ai-send {
  width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink, #fff);
  display: inline-grid; place-items: center; cursor: pointer;
}
.ai-send svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ai-send:hover { filter: brightness(1.05); }
.ai-send.stopping { background: var(--danger, #c0392b); }
body.mail-page .ai-form { padding-right: 12px; }
body.mail-assistant-page .mail-ai {
  border: 0; border-radius: 0; box-shadow: none; height: 100%;
  background: var(--sidebar);
}
body.mail-assistant-page .ai-head { background: var(--surface); }

.mcp-dialog { border: 0; padding: 0; background: transparent; max-width: min(440px, calc(100vw - 24px)); }
.mcp-dialog::backdrop { background: rgba(10, 14, 30, 0.55); }
.mcp-dialog-card {
  display: grid; gap: 12px; padding: 18px; border-radius: 18px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink);
}
.mcp-dialog-card header { display: flex; align-items: center; gap: 8px; }
.mcp-dialog-card h2 { margin: 0; flex: 1; font: 700 18px/1.25 var(--display); }
.mcp-history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: min(50vh, 420px); overflow: auto; }
.mcp-history-list li { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.mcp-hist-item {
  display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); color: var(--ink); text-align: left; font: inherit; cursor: pointer;
}
.mcp-hist-item:hover { border-color: var(--accent); }
.mcp-hist-item b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcp-hist-item small { color: var(--muted); font-size: 12.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mcp-convert-actions { display: grid; gap: 8px; }
.mcp-convert-dialog { max-width: min(420px, calc(100vw - 24px)); }

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; position: static; width: auto; border: 0; border-radius: 0; box-shadow: none; }
body.mail-assistant-page .ai-close { display: none; }
body.mail-assistant-page .mcp-hint { display: none; }

@media (max-width: 1179px) {
  .mail-app, .mail-app.ai-out { grid-template-columns: 220px minmax(0, 1fr); }
  .mail-ai.mcp-overlay {
    top: 0; right: 0; bottom: 0; width: min(400px, 100%); height: auto; border-radius: 0;
    border-left: 1px solid var(--line); border-right: 0; border-top: 0; border-bottom: 0;
  }
  .ai-toggle { display: inline-grid; }
}
@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; align-items: center; }
  .mail-side .side-block { display: none; }
  .mail-side .mail-folders-label { display: none; }
  .mail-side .primary { width: auto; }
  .folders { display: flex; overflow-x: auto; width: auto; flex: 1; min-width: 0; }
  .folder { white-space: nowrap; width: auto; }
  .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 { color: var(--faint); }
.b-meta :is(.fwd-btn, .rep-btn, .pin-btn) { opacity: 0; transition: opacity 0.15s; }
.b-meta :is(.fwd-btn, .rep-btn, .pin-btn):first-of-type, .b-meta time + :is(.fwd-btn, .rep-btn, .pin-btn) { margin-left: auto; }
.bubble:is(:hover, :focus-within) .b-meta :is(.fwd-btn, .rep-btn, .pin-btn) { opacity: 1; }
@media (hover: none) { .b-meta :is(.fwd-btn, .rep-btn, .pin-btn) { opacity: 1; } }
/* Dark mode: other people's bubbles were the same colour as the page. */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bubble:not(.mine):not(.ai):not(.system) { background: color-mix(in srgb, var(--ink) 11%, var(--surface)); } }
:root[data-theme="dark"] .bubble:not(.mine):not(.ai):not(.system) { background: color-mix(in srgb, var(--ink) 11%, var(--surface)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bubble.mine { background: color-mix(in srgb, var(--accent) 34%, var(--surface)); } }
:root[data-theme="dark"] .bubble.mine { background: color-mix(in srgb, var(--accent) 34%, var(--surface)); }
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; }
.ask-form .dir-results { max-height: 180px; overflow: auto; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 12px; background: var(--panel, var(--bg)); }
.ask-form .dir-results li { margin: 0; border-bottom: 1px solid var(--line); }
.ask-form .dir-results li:last-child { border-bottom: 0; }
.ask-form .dir-results button { width: 100%; text-align: left; border: 0; background: transparent; color: inherit; font: inherit; padding: 10px 12px; cursor: pointer; display: grid; gap: 2px; }
.ask-form .dir-results button:hover, .ask-form .dir-results button:focus-visible { background: color-mix(in srgb, var(--accent, #5b8cff) 12%, transparent); outline: none; }
.ask-form .dir-results small { color: var(--muted); font-size: 12px; }
.ask-form .dir-results .kind-teams_only small { color: #c47a1a; }
.ask-form .dir-results .kind-axork small { color: var(--accent, #5b8cff); }
#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; } }

/* Gangspace hub — interactive lounge + phone-style status bar */
.gs-workspace .main { display: flex; flex-direction: column; min-height: 0; position: relative; }
.gs-workspace .main.empty { overflow-y: auto; }
.gs-workspace .gs-empty { flex: 1; display: grid; place-items: center; padding: 24px 16px 48px; overflow: auto; }
.gs-workspace .gs-empty .welcome { display: block; max-width: 640px; margin: 0 auto; text-align: center; }
.gs-workspace .gs-empty .env-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.gs-workspace .gs-hub { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr) 240px; overflow: hidden; }
.gs-workspace .gs-rail, .gs-workspace .gs-assets { overflow: auto; padding: 16px 14px; background: color-mix(in srgb, var(--surface) 70%, var(--sidebar)); }
.gs-workspace .gs-rail { border-right: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.gs-workspace .gs-assets { border-left: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.gs-workspace .gs-feed { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 22px 22px 32px; overflow: auto; }
.gs-role { display: inline-flex; align-items: center; margin-left: 8px; padding: 4px 9px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.gs-channels, .gs-members, .gs-inboxes { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 3px; }
.gs-channels button { width: 100%; text-align: left; display: grid; gap: 2px; padding: 8px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.gs-channels button b { color: var(--ink); font-weight: 600; font-size: 13px; }
.gs-channels button small, .gs-members small { color: var(--muted); font-size: 11px; }
.gs-channels button:hover, .gs-channels button.on { background: var(--accent-soft); color: var(--accent); }
.gs-channels button.on b { color: var(--accent); }
.gs-members li { padding: 6px 8px; border-radius: 8px; font-size: 13px; }
.gs-channel-form { display: flex; gap: 6px; margin: 0 0 12px; padding: 0 4px; }
.gs-channel-form input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12px; }
.gs-active-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.gs-meter-note { margin: 0 0 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.gs-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.gs-rail-shortcuts { display: grid; gap: 4px; margin: 0 0 14px; }
.gs-rail-shortcuts button {
  text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font: 600 12.5px var(--text); cursor: pointer;
}
.gs-rail-shortcuts button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.gs-pulse { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.gs-pulse li { padding: 8px 10px; border-radius: 10px; background: var(--hover); color: var(--muted); font-size: 12px; line-height: 1.4; }

/* ---- Phone status bar ---- */
.gs-statusbar {
  flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 14px 6px; background: color-mix(in srgb, var(--ink) 92%, #000);
  color: #f4f6ff; z-index: 5;
}
.gs-sb-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gs-statusbar time { font: 700 13px/1 var(--text); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.gs-sb-pill {
  max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.12); font: 600 11px var(--text);
}
.gs-sb-island {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 12px 0 10px; border: 0; border-radius: 999px;
  background: #0a0e1c; color: #fff; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.gs-sb-island svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gs-sb-island b {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font: 700 11px var(--text);
}
.gs-sb-island.has-unread { background: #121933; }
.gs-sb-dot {
  position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%;
  background: #ff453a; box-shadow: 0 0 0 2px #0a0e1c;
}
.gs-sb-island.gs-ping { animation: gs-ping 0.7s ease; }
@keyframes gs-ping {
  0% { transform: scale(1); }
  35% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
.gs-sb-right { display: flex; align-items: center; gap: 8px; color: rgba(255,255,255,.88); }
.gs-sb-sig, .gs-sb-wifi { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.gs-sb-batt {
  display: inline-flex; align-items: center; gap: 5px; height: 14px; padding: 0 3px 0 0;
  border: 1.5px solid rgba(255,255,255,.55); border-radius: 4px; position: relative; width: 26px;
}
.gs-sb-batt::after {
  content: ""; position: absolute; right: -4px; top: 3px; width: 2px; height: 6px;
  border-radius: 0 2px 2px 0; background: rgba(255,255,255,.55);
}
.gs-sb-batt i { display: block; height: 8px; width: 84%; margin-left: 2px; border-radius: 2px; background: #30d158; }
.gs-sb-batt em { position: absolute; left: -34px; font: 600 10px var(--text); font-style: normal; color: rgba(255,255,255,.75); }

/* Notification shade */
.gs-notif-shade {
  position: absolute; left: 0; right: 0; top: 44px; z-index: 40;
  max-height: min(420px, 58vh); overflow: auto;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(16, 22, 42, 0.18);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  animation: gs-shade-in 0.22s ease;
}
@keyframes gs-shade-in {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.gs-notif-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--line);
}
.gs-notif-head b { display: block; font: 700 15px var(--display); }
.gs-notif-head small { color: var(--muted); font-size: 12px; }
.gs-notif-list { list-style: none; margin: 0; padding: 8px; display: grid; gap: 6px; }
.gs-notif {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "kind title time" "kind body body";
  gap: 2px 10px; padding: 12px 12px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line);
  cursor: pointer; text-align: left;
}
.gs-notif:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.gs-notif.unread { background: color-mix(in srgb, var(--accent-soft) 55%, var(--bg)); }
.gs-notif-kind {
  grid-area: kind; align-self: start; margin-top: 2px; padding: 3px 7px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font: 700 10px var(--text); letter-spacing: .04em; text-transform: uppercase;
}
.gs-notif b { grid-area: title; font-size: 14px; }
.gs-notif p { grid-area: body; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.gs-notif time { grid-area: time; color: var(--faint); font-size: 11px; }
.gs-notif-empty { padding: 20px 12px; text-align: center; color: var(--faint); font-size: 13.5px; }

/* ---- Lounge mosaic ---- */
.gs-lounge-hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.gs-hello { margin: 0 0 4px; color: var(--muted); font: 600 13px var(--text); }
.gs-lounge-hero h2 { margin: 0; font: 800 clamp(26px, 3vw, 36px)/1.1 var(--display); letter-spacing: -.03em; }
.gs-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.gs-mosaic {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px;
}
.gs-card {
  grid-column: span 4; min-height: 148px; padding: 14px; border-radius: 18px;
  border: 1px solid var(--line); background: var(--surface); box-shadow: 0 10px 28px rgba(16,22,42,.05);
  cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  display: flex; flex-direction: column; gap: 10px; outline: none;
}
.gs-card:hover, .gs-card:focus-visible { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: 0 16px 36px rgba(16,22,42,.1); }
.gs-card.on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.gs-card-wide, .gs-card-drive { grid-column: span 8; }
.gs-card-vault {
  background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 88%, #1a1f3d), color-mix(in srgb, #6b7cff 70%, var(--accent)));
  color: #fff; border-color: transparent;
}
.gs-card-vault header small, .gs-card-vault .gs-row small { color: rgba(255,255,255,.78); }
.gs-card-vault .gs-row b { color: #fff; }
.gs-card header { display: flex; align-items: center; gap: 8px; }
.gs-card header b { flex: 1; font: 700 15px var(--text); }
.gs-card header small { color: var(--muted); font-size: 12px; }
.gs-card-ico { font-size: 15px; }
.gs-card-body { display: grid; gap: 6px; }
.gs-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.gs-row b { font-weight: 600; }
.gs-row small { color: var(--muted); }
.gs-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); }
.gs-drive-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.gs-drive-strip.big { flex-wrap: wrap; }
.gs-thumb {
  flex: none; width: 92px; height: 78px; border-radius: 12px; border: 1px solid var(--line);
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, #f3e8ff 70%, var(--bg)));
  display: grid; align-content: end; gap: 2px; padding: 8px; text-align: left; cursor: pointer; color: var(--ink); font: inherit;
}
.gs-thumb i { font-style: normal; font-weight: 800; font-size: 12px; color: var(--accent); }
.gs-thumb span { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-thumb-img { background-size: cover; background-position: center; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.gs-thumb-img span { align-self: end; }
.gs-people-row { display: flex; flex-wrap: wrap; gap: 8px; }
.gs-people-row.large { gap: 12px; }
.gs-avatar {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font: 700 12px var(--text);
}
.gs-people-row.large .gs-avatar {
  width: auto; min-width: 72px; height: auto; padding: 10px; border-radius: 14px; gap: 6px;
}
.gs-people-row.large .gs-avatar small { display: block; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11px; font-weight: 500; }
.gs-chip {
  display: inline-flex; padding: 7px 10px; border-radius: 999px; background: var(--hover);
  color: var(--ink); text-decoration: none; font: 600 12.5px var(--text); margin: 0 6px 6px 0;
}
.gs-chip:hover { background: var(--accent-soft); color: var(--accent); }
.gs-group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.gs-group {
  display: grid; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--bg); text-align: left; cursor: pointer; font: inherit; color: var(--ink);
}
.gs-group:hover { border-color: var(--accent); }
.gs-group b { font-size: 13.5px; }
.gs-group small { color: var(--muted); font-size: 11px; }
.gs-card-channel { grid-column: span 4; background: color-mix(in srgb, var(--accent-soft) 40%, var(--surface)); }

.gs-preview-stage {
  margin-top: 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface);
  overflow: hidden; box-shadow: 0 14px 36px rgba(16,22,42,.08);
}
.gs-preview-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 14px 14px 12px; border-bottom: 1px solid var(--line);
}
.gs-preview-head b { display: block; font: 700 16px var(--display); }
.gs-preview-head small { color: var(--muted); font-size: 12.5px; }
.gs-preview-actions { display: flex; align-items: center; gap: 6px; }
.gs-preview-body { padding: 14px; display: grid; gap: 8px; max-height: 280px; overflow: auto; }
.gs-preview-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-radius: 12px; background: var(--bg); border: 1px solid transparent; font: inherit; color: var(--ink);
}
.gs-preview-row.btn, .gs-preview-row.linkish { cursor: pointer; text-decoration: none; }
.gs-preview-row:hover { border-color: var(--line); }
.gs-preview-row span { color: var(--muted); font-size: 12.5px; }

.tg-panel { display: grid; gap: 8px; }
.tg-panel .tg-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 1100px) {
  .gs-workspace .gs-hub { grid-template-columns: minmax(0, 1fr) 220px; }
  .gs-workspace .gs-rail { display: none; }
  .gs-card, .gs-card-wide, .gs-card-drive, .gs-card-channel { grid-column: span 6; }
}
@media (max-width: 760px) {
  .gs-workspace .gs-hub { grid-template-columns: 1fr; }
  .gs-workspace .gs-assets { display: none; }
  .gs-card, .gs-card-wide, .gs-card-drive, .gs-card-channel { grid-column: span 12; }
  .gs-sb-pill, .gs-sb-batt em { display: none; }
  .gs-notif-shade { top: 40px; }
}

/* 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; }
.shell.canvas-open .canvas-panel.canvas-pop {
  animation: canvas-pop 0.28s ease-out;
}
@keyframes canvas-pop {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: 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 (AXORK Stage Cards + compact docks) ===== */
.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)); }
/* Messenger Stage Cards: landscape postcard (wider than tall) */
.dock-win.msg { width: 460px; height: min(360px, calc(calc(100 * var(--vh, 1vh)) - 120px)); border-radius: 22px; border: 1px solid color-mix(in srgb, var(--line) 80%, transparent); border-bottom: 1px solid color-mix(in srgb, var(--line) 80%, transparent); box-shadow: 0 18px 50px rgba(16, 22, 42, 0.18); }

/* ---- Stage Cards shell (bottom-center fan deck) ---- */
.ax-stage {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  z-index: 72; width: min(560px, calc(100vw - 48px));
  display: grid; justify-items: center; gap: 10px; pointer-events: none;
}
.ax-stage[hidden] { display: none !important; }
.ax-stage-badge {
  pointer-events: none; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); box-shadow: var(--shadow); font: 700 12px var(--text);
}
.ax-stage-badge i { display: grid; place-items: center; color: var(--accent); }
.ax-stage-badge i svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ax-stage-badge b {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink); font: 700 11px var(--text);
}
.ax-stage-deck {
  position: relative; width: 100%; height: min(380px, calc(100vh - 140px));
  pointer-events: none;
}
.ax-stage-deck .ax-stage-card {
  position: absolute; left: 50%; bottom: 0; margin-left: -230px;
  pointer-events: auto; transform-origin: 50% 100%;
  transition: transform 0.28s cubic-bezier(.2,.8,.2,1), box-shadow 0.28s ease, opacity 0.2s ease;
}
.ax-stage-deck .ax-stage-card.is-front {
  transform: translate(0, 0) scale(1); opacity: 1;
  box-shadow: 0 22px 60px rgba(16, 22, 42, 0.22);
}
.ax-stage-deck .ax-stage-card.is-peek {
  cursor: pointer;
  transform: translate(calc(var(--stage-i) * -42px), calc(var(--stage-i) * -14px)) scale(calc(1 - var(--stage-i) * 0.045));
  opacity: calc(1 - var(--stage-i) * 0.12);
  filter: saturate(0.92);
}
.ax-stage-deck .ax-stage-card.is-peek .dw-list,
.ax-stage-deck .ax-stage-card.is-peek .dw-form,
.ax-stage-deck .ax-stage-card.is-peek .dw-note,
.ax-stage-deck .ax-stage-card.is-peek .dw-tray,
.ax-stage-deck .ax-stage-card.is-peek .dw-teams-pill span,
.ax-stage-deck .ax-stage-card.is-peek .dw-titles small,
.ax-stage-deck .ax-stage-card.is-peek .dw-btn:not(.dw-call):not([data-act="close"]) {
  visibility: hidden;
}
.ax-stage-deck .ax-stage-card.is-peek .dw-head { border-bottom-color: transparent; }
.ax-stage-rail {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(16,22,42,.12);
  backdrop-filter: blur(12px);
}
.ax-stage-rail-btn {
  width: 36px; height: 36px; border: 0; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); cursor: pointer;
}
.ax-stage-rail-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ax-stage-rail-btn:hover { background: var(--accent); color: var(--accent-ink); }
.ax-stage-rail-track { display: flex; gap: 6px; align-items: center; padding: 0 8px; }
.ax-stage-rail-track i {
  width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 55%, var(--line));
  display: block;
}
.ax-stage-rail-track i:nth-child(odd) { width: 16px; border-radius: 99px; height: 6px; }
.dw-teams-pill {
  height: 32px; padding: 0 12px 0 10px; border-radius: 999px; border: 0;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: #6264A7; color: #fff; font: 700 12.5px var(--text); flex: none;
}
.dw-teams-pill svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dw-teams-pill:hover { filter: brightness(1.06); }
body.dock-stage-on .pop-row-msg { right: 16px; bottom: 18px; }
body.dock-stage-on .dock-bubbles-msg { bottom: 18px; }

/* Layers switcher — tap to bring Chatbot / Group / Chat forward without covering the page */
.ax-layer-bar {
  position: fixed; left: 16px; bottom: 18px; z-index: 74;
  display: flex; align-items: center; gap: 6px; padding: 6px 8px;
  border-radius: 999px; background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(16,22,42,.14);
  backdrop-filter: blur(12px);
}
.ax-layer-bar[hidden] { display: none !important; }
.ax-layer-label {
  font: 700 11px var(--text); color: var(--muted); text-transform: uppercase;
  letter-spacing: .04em; padding: 0 6px;
}
.ax-layer-btn {
  height: 34px; padding: 0 12px 0 10px; border: 0; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: transparent; color: var(--ink); font: 600 12.5px var(--text);
}
.ax-layer-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ax-layer-btn:hover { background: var(--hover); }
.ax-layer-btn.on { background: var(--accent); color: var(--accent-ink); }

/* Compact sizes when Chatbot + Group + Messenger are open together —
   keep a clear page lane in the middle; Layers bar swaps which kind is sharp. */
body.dock-layered .pop-row-bot .dock-win.bot {
  width: 340px; height: min(248px, calc(34 * var(--vh, 1vh)));
  border-radius: 0 0 16px 16px;
}
body.dock-layered .pop-row-msg .dock-pair {
  height: min(280px, calc(38 * var(--vh, 1vh)));
}
body.dock-layered .pop-row-msg .dock-pair .dock-win.grp { width: 300px; }
body.dock-layered .dock-pair.open .dp-side { width: 312px; }
body.dock-layered .dp-side .dock-win.attached { width: 280px; }
body.dock-layered .ax-stage { width: min(400px, calc(100vw - 96px)); bottom: 58px; }
body.dock-layered .ax-stage-deck { height: min(260px, calc(36 * var(--vh, 1vh))); }
body.dock-layered .ax-stage-deck .ax-stage-card {
  width: 380px; height: min(260px, calc(36 * var(--vh, 1vh))); margin-left: -190px;
}
body.dock-layered .layer-back {
  opacity: 0.68; filter: saturate(0.8) brightness(0.98);
  transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}
/* Scale only non-stage docks — Stage Cards keep their fan transforms */
body.dock-layered .layer-back:not(.ax-stage-card) {
  transform: scale(0.94);
  transform-origin: bottom center;
}
body.dock-layered .pop-row-bot .layer-back { transform-origin: top right; }
body.dock-layered .layer-front {
  opacity: 1; filter: none; z-index: 80 !important;
  transition: opacity 0.2s ease, filter 0.2s ease, transform 0.2s ease;
}
body.dock-layered.dock-stage-on .pop-row-msg { bottom: 58px; right: 8px; }
body.dock-layered .dock-bubbles-msg { bottom: 58px; }
body.dock-layered .ax-layer-bar { bottom: 12px; left: 12px; }

@media (max-width: 700px) {
  .ax-stage { left: 0; right: 0; bottom: 0; width: 100%; transform: none; padding: 0; }
  .ax-stage-badge, .ax-stage-rail, .ax-layer-bar { display: none; }
  .ax-stage-deck { height: calc(78 * var(--vh, 1vh)); }
  .ax-stage-deck .ax-stage-card {
    left: 0; margin-left: 0; width: 100%; height: calc(78 * var(--vh, 1vh));
    border-radius: 18px 18px 0 0;
  }
  .ax-stage-deck .ax-stage-card.is-peek { display: none; }
}
.dw-head { position: relative; display: flex; align-items: center; gap: 10px; padding: 18px 10px 12px 14px; border-bottom: 1px solid var(--line); flex: none; cursor: grab; }
.dw-head:active { cursor: grabbing; }
.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: 36px; height: 36px; 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: 16px; }
.dw-sub { font-size: 13px; opacity: 0.78; 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); }
.dock-win.msg .dw-btn.dw-teams-call { color: #6264A7; }
.dock-win.msg .dw-btn.dw-teams-call:hover { background: color-mix(in srgb, #6264A7 14%, transparent); }
.dw-btn:hover { background: var(--hover); }
.dock-win.bot .dw-btn:hover { background: rgba(255, 255, 255, 0.16); }
/* Spacious pop-out chat chrome — larger type, airier bubbles, less cramped composer */
.dw-list { list-style: none; margin: 0; padding: 18px 16px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.dw-msg { display: grid; max-width: 88%; gap: 4px; }
.dw-msg.mine { align-self: flex-end; justify-items: end; }
.dw-msg.theirs { align-self: flex-start; }
.dw-bub { padding: 12px 16px; border-radius: 20px; background: var(--bubble); line-height: 1.55; font-size: 16px; 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: 4px 2px; border-radius: 0; font-size: 16.5px; line-height: 1.58; }
.dw-bub p { margin: 0 0 10px; } .dw-bub p:last-child { margin-bottom: 0; }
.dw-bub pre { overflow-x: auto; font-size: 13.5px; } .dw-bub table { font-size: 13.5px; display: block; overflow-x: auto; }
.dw-bub img { max-width: 100%; border-radius: 14px; display: block; }
.dw-msg.sys { align-self: center; max-width: 100%; } .dw-msg.sys .dw-bub { background: none; color: var(--faint); font-size: 13px; text-align: center; }
.dw-who, .dw-at { font-size: 12.5px; color: var(--faint); padding: 0 8px; }
.dw-empty { margin: auto; color: var(--faint); font-size: 15px; text-align: center; line-height: 1.5; padding: 12px; max-width: 22em; }
.dw-gone { max-width: 16em; }
.dw-err { color: var(--danger); }
.dw-typing { display: inline-flex; gap: 5px; } .dw-typing i { width: 7px; height: 7px; 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: 8px 14px; font-size: 13.5px; color: var(--danger); border-top: 1px solid var(--line); }
.dw-form { display: flex; align-items: flex-end; gap: 8px; padding: 12px 14px 14px; border-top: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.dw-model { flex: 1 0 100%; max-width: 100%; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--bg); color: var(--ink); font: inherit; font-size: 13.5px; }
.dw-model-locked { opacity: 0.92; cursor: default; font-weight: 600; }
.dock-win.relay-dock .dw-head { background: linear-gradient(135deg, #2E46F0, #5B6CFF); }
.dw-form textarea { flex: 1; min-width: 0; resize: none; max-height: 140px; padding: 12px 16px; border: 0; border-radius: 22px; background: var(--hover); color: var(--ink); font: inherit; font-size: 16px; outline: none; }
.dw-send { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); cursor: pointer; }

/* App dock — circles per application; hover opens a vertical Windows-style window stack */
.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, .dock-app .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-app { transition: transform 0.15s ease; }
.dock-app.is-open, .dock-app:hover { transform: translateY(-3px); }
.dock-app-count {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--ink); color: var(--bg); font: 700 10px var(--text);
  display: grid; place-items: center; box-shadow: 0 2px 6px rgba(16,22,42,.2);
}
.dock-app.bot .dock-app-count { background: var(--accent-ink); color: var(--accent); }
.dock-flyout {
  position: fixed; z-index: 95; min-width: 220px; max-width: 280px;
  padding: 8px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(16,22,42,.22);
  backdrop-filter: blur(14px); display: flex; flex-direction: column; gap: 4px;
  animation: dock-fly-in 0.16s ease;
}
@keyframes dock-fly-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.dock-flyout-bot { animation-name: dock-fly-in-bot; }
@keyframes dock-fly-in-bot {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}
.dock-flyout-head {
  margin: 2px 8px 6px; font: 700 11px var(--text); color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.dock-flyout-item {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px;
  border: 0; border-radius: 12px; background: color-mix(in srgb, var(--bg) 80%, transparent);
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--line) 70%, transparent);
}
.dock-flyout-item:hover { background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, var(--line)); }
.dock-flyout-item.is-min { opacity: 0.92; }
.dock-flyout-thumb { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.dock-flyout-face {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 12px;
}
.dock-flyout-face svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dock-flyout-copy { display: grid; min-width: 0; }
.dock-flyout-copy b { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock-flyout-copy small { color: var(--muted); font-size: 11.5px; }
.dock-flyout-x {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%;
  color: var(--faint); opacity: 0;
}
.dock-flyout-item:hover .dock-flyout-x { opacity: 1; }
.dock-flyout-x:hover { background: var(--hover); color: var(--ink); }
.dock-flyout-x svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }

/* Free desktop windows — drag header, stretch edges, capped max size */
.dock-free {
  position: fixed !important; z-index: 90; margin: 0 !important;
  border-radius: 16px !important; border-bottom: 1px solid var(--line) !important;
  box-shadow: 0 22px 60px rgba(16, 22, 42, 0.28) !important;
  max-width: min(920px, 92vw); max-height: min(780px, 86vh);
  transform: none !important; filter: none !important; opacity: 1 !important;
  pointer-events: auto;
}
.dock-free.dock-pair { border-bottom: 2px solid var(--pair, var(--accent)) !important; display: flex; }
.dock-free.dock-pair .dock-win { height: 100%; }
.dock-free.dock-pair .dock-win.grp { width: auto; flex: 1; min-width: 240px; }
.dock-free .dw-head { cursor: grab; }
.dock-free .dw-head:active { cursor: grabbing; }
.dock-free .dw-grab { opacity: 0.45; }
.dw-rz {
  position: absolute; z-index: 6; background: transparent; touch-action: none;
}
.dock-free .dw-rz { display: block; }
.dock-win:not(.dock-free) .dw-rz,
.dock-pair:not(.dock-free) .dw-rz { display: none; }
.dw-rz-n { top: -3px; left: 12px; right: 12px; height: 8px; cursor: ns-resize; }
.dw-rz-s { bottom: -3px; left: 12px; right: 12px; height: 8px; cursor: ns-resize; }
.dw-rz-e { right: -3px; top: 12px; bottom: 12px; width: 8px; cursor: ew-resize; }
.dw-rz-w { left: -3px; top: 12px; bottom: 12px; width: 8px; cursor: ew-resize; }
.dw-rz-ne { top: -3px; right: -3px; width: 14px; height: 14px; cursor: nesw-resize; }
.dw-rz-nw { top: -3px; left: -3px; width: 14px; height: 14px; cursor: nwse-resize; }
.dw-rz-se { bottom: -3px; right: -3px; width: 16px; height: 16px; cursor: nwse-resize; }
.dw-rz-sw { bottom: -3px; left: -3px; width: 14px; height: 14px; cursor: nesw-resize; }
.dw-rz-se::after {
  content: ""; position: absolute; right: 3px; bottom: 3px; width: 8px; height: 8px;
  border-right: 2px solid color-mix(in srgb, var(--ink) 35%, transparent);
  border-bottom: 2px solid color-mix(in srgb, var(--ink) 35%, transparent);
}
@media (max-width: 700px) {
  .dw-rz, .dock-flyout { display: none !important; }
}
.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.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); }
/* Layered mode wins over half-height split — otherwise the page disappears */
body.dock-layered.dock-split .pop-row-bot .dock-win.bot {
  height: min(248px, calc(34 * var(--vh, 1vh)));
}
body.dock-layered.dock-split .pop-row-msg .dock-win.msg,
body.dock-layered.dock-split .dock-pair {
  height: min(280px, calc(38 * var(--vh, 1vh)));
}
.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: 0; }
.dock-win.msg.ax-stage-card .dw-head { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); padding-top: 12px; }
.dock-win.msg.ax-stage-card .dw-grab { display: none; }
.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); }
.dock-win.cal { width: 380px; height: 520px; }
.dock-win.cal .cal-frame { flex: 1; border: 0; width: 100%; height: 100%; background: var(--surface); }
.cal-card { border: 1px solid var(--line); background: var(--surface); border-radius: 16px; padding: 12px 14px; margin-top: 8px; }
.cal-card p { margin: 0 0 8px; }
.cal-card .cal-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cal-shield { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: inherit; cursor: pointer; }
.composer .cal-model { max-width: 140px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; padding: 4px 8px; }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--dot, #5A6478); flex: none; }
.dot-synapse { --dot: #2E46F0; }
.dot-pulsar { --dot: #2B8A3E; }
.dot-cortex { --dot: #B26B00; }
.dot-axon { --dot: #7C4DDB; }
.dot-neural { --dot: #C2255C; }
.dot-resting { --dot: #5A6478; }
#loc-ask { border: 0; border-radius: 20px; padding: 22px; max-width: 480px; width: calc(100vw - 32px); background: var(--surface); color: var(--ink); }
#loc-ask::backdrop { background: rgba(16, 22, 42, 0.46); }
#loc-ask h2 { margin: 0 0 8px; }
#loc-ask p { margin: 0 0 10px; }
.msg .cal-card { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.msg .cal-card p { margin: 0; flex: 1; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; list-style: none; margin: 8px 0; padding: 0; font-size: 13px; }

/* ========== Model picker in the chat header ========== */
.model-picker { flex: none; }
.model-picker .picker-btn { gap: 6px; padding: 7px 10px 7px 12px; border-radius: 10px; font-size: 16px; font-weight: 650; color: var(--ink); max-width: min(280px, calc(46 * var(--vw, 1vw))); }
.model-picker .picker-btn svg { color: var(--muted); }
.model-picker .model-menu { width: min(380px, calc(calc(100 * var(--vw, 1vw)) - 24px)); z-index: 40; }
.model-picker + .chat-title { padding-left: 2px; font-size: 14px; color: var(--faint); }
.main.empty .model-picker + .chat-title { visibility: hidden; }
.welcome-sub { font-size: 22px; font-weight: 600; color: var(--ink); }

.mode-chip {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.mode-chip:hover { background: var(--hover); color: var(--ink); }
.mode-chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.composer-bar .tool-chip { display: inline-flex; }
.composer-bar .tool-chip[hidden] { display: none !important; }

@media (max-width: 720px) {
  .composer-bar .tool-chip span { display: none; }
  .model-picker + .chat-title { display: none; }
}

/* ---------------------------------------------------------------- Canvas Lab (/canvas-lab) */
body.page.lab-page .page-main.lab-main { width: min(1320px, 100%); }
.lab-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 14px; }
.lab-head .page-title { margin-top: 18px; }
.lab-tabs { flex-wrap: wrap; }
.lab-tabs button { flex: none; padding: 7px 14px; }
.lab-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.lab-panel { display: flex; flex-direction: column; gap: 12px; }
.lab-panel > .side-note { margin: 0; }
.lab-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lab-bar input:not([type="checkbox"]):not([type="range"]), .lab-bar select {
  flex: 1 1 220px; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.lab-bar select { flex: 0 1 260px; }
.lab-spacer { flex: 1; }
.lab-split { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.lab-side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lab-side h2 { margin: 0; font: 700 17px/1.3 var(--display); overflow-wrap: anywhere; }
.lab-side h3 { margin: 10px 0 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.lab-side .side-note { margin: 0; }
.lab-kicker { margin: 0; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); }
.lab-empty { margin: 0; padding: 40px 16px; text-align: center; color: var(--muted); }
.lab-legend { display: inline-flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.lab-legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.chat { background: var(--accent); }
.dot.drive { background: var(--ok); }
.dot.vault { background: #E08A1E; }
.lab-page .markdown p { margin: 0 0 8px; }
.lab-page .markdown p:last-child { margin-bottom: 0; }
.lab-page .markdown pre { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bubble); overflow-x: auto; font: 13px/1.5 var(--mono); }
.lab-page .markdown code { font-family: var(--mono); font-size: 0.92em; }
.lab-page .markdown table { border-collapse: collapse; }
.lab-page .markdown th, .lab-page .markdown td { border: 1px solid var(--line); padding: 4px 8px; }

/* Nodes */
.g-stage, .__________cytoscape_container { position: relative; }
.g-stage { height: min(68vh, 640px); min-height: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.g-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.g-links li { display: flex; flex-direction: column; font-size: 14px; overflow-wrap: anywhere; }
.g-links small { color: var(--muted); }

/* Model diffs */
.d-head { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; font-size: 13px; color: var(--muted); }
.d-rows { display: flex; flex-direction: column; gap: 8px; }
.d-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
.d-row.change { grid-template-columns: 1fr 1fr; }
.d-cell { min-width: 0; padding: 12px 14px; border-radius: 12px; overflow-wrap: anywhere; text-align: left; font: inherit; color: inherit; }
.d-row.same .d-cell { background: var(--surface); border: 1px solid var(--line); }
.d-row.change .d-cell { border: 2px dashed var(--line); background: transparent; opacity: 0.6; cursor: pointer; }
.d-row.change .d-cell[aria-pressed="true"] { border: 2px solid var(--accent); background: var(--accent-soft); opacity: 1; }
.d-merge { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.d-merge-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.d-merge-bar h2 { margin: 0; font: 700 17px var(--display); }
.d-merge textarea { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font: 13px/1.5 var(--mono); resize: vertical; }

/* Mail staging */
.s-form label { font-size: 13px; font-weight: 600; color: var(--muted); }
.s-form input:not([type="checkbox"]):not([type="range"]), .s-form textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.s-form textarea { font: 13px/1.5 var(--mono); resize: vertical; }
.s-form input[type="range"] { width: 100%; accent-color: var(--accent); }
.s-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-split:has(.s-form) { grid-template-columns: 320px minmax(0, 1fr); }
.s-frames { display: grid; grid-template-columns: 1fr; gap: 12px; min-width: 0; }
.s-frames.both { grid-template-columns: 1fr 1fr; }
.s-frame { width: 100%; height: min(72vh, 680px); min-height: 420px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

/* Sandbox */
.z-open { cursor: pointer; }
.z-status { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lab-split.z-split { grid-template-columns: minmax(0, 1fr); }
.z-preview .lab-split.z-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.z-editor { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.z-editor .CodeMirror { height: min(64vh, 620px); font: 13px/1.5 var(--mono); background: var(--surface); color: var(--ink); }
.z-editor .CodeMirror-gutters { background: var(--bg); border-right: 1px solid var(--line); }
.z-editor .CodeMirror-linenumber { color: var(--faint); }
.z-editor .CodeMirror-cursor { border-left-color: var(--ink); }
.z-view { min-width: 0; height: min(64vh, 620px); overflow: auto; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

/* Calendar board */
.b-board { display: grid; grid-template-columns: repeat(8, minmax(150px, 1fr)); gap: 8px; overflow-x: auto; padding-bottom: 8px; }
.b-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px; border-radius: var(--radius); background: var(--hover); }
.b-col.inbox { background: var(--accent-soft); }
.b-col.today { outline: 2px solid var(--accent); outline-offset: -2px; }
.b-col h3 { margin: 0; font-size: 13px; font-weight: 700; }
.b-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-height: 120px; flex: 1; }
.b-card { display: grid; grid-template-columns: auto 1fr; column-gap: 6px; align-items: baseline; padding: 8px 10px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); cursor: grab; font-size: 13.5px; overflow-wrap: anywhere; }
.b-card b { grid-column: 2; font-weight: 600; }
.b-card small { grid-column: 2; color: var(--muted); font-size: 12px; }
.b-card.locked { cursor: default; opacity: 0.75; }
.b-card.sortable-ghost { opacity: 0.4; }
.b-dot { grid-row: 1; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

@media (max-width: 860px) {
  .lab-split, .lab-split:has(.s-form), .z-preview .lab-split.z-split { grid-template-columns: minmax(0, 1fr); }
  .s-frames.both { grid-template-columns: 1fr; }
  .d-row.change { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- AXORK Player (media-player.js) */
.cv-player { flex: 1; min-height: 0; overflow: auto; padding: 10px; }
.cv-player[hidden] { display: none; }
.cv-player, #lab-player { container-type: inline-size; }
.mp { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 10px; outline: none; color: var(--ink); }
.mp.no-list { grid-template-columns: minmax(0, 1fr); }
.mp.no-list .mp-list { display: none; }
.canvas-panel.cv-playing .cv-timeline { display: none; }
.mp:fullscreen { background: #000; padding: 12px; grid-template-columns: minmax(0, 1fr); align-content: center; }
.mp:fullscreen .mp-list { display: none; }
.mp:fullscreen .mp-stage { height: calc(100vh - 170px); aspect-ratio: auto; }
.mp:fullscreen .mp-now, .mp:fullscreen .mp-seek, .mp:fullscreen .mp-controls { color: #fff; }
.mp-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mp-stage { position: relative; aspect-ratio: 16 / 9; max-height: 62vh; border-radius: 12px; overflow: hidden; background: #000; display: grid; place-items: center; }
.mp-video { width: 100%; height: 100%; object-fit: contain; background: #000; transition: transform 0.2s ease; }
.mp.audio .mp-video { opacity: 0; }
.mp-viz { position: absolute; inset: 18% 6% 8%; width: 88%; height: 74%; }
.mp:not(.audio) .mp-viz { display: none; }
.mp-msg { position: absolute; inset: auto 12px 12px; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, 0.75); color: #fff; font-size: 13.5px; line-height: 1.4; }
.mp-osd { position: absolute; top: 10px; right: 12px; padding: 4px 10px; border-radius: 8px; background: rgba(0, 0, 0, 0.6); color: #fff; font: 600 13px var(--text); font-variant-numeric: tabular-nums; pointer-events: none; }
.mp-stage video::cue { background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 1.05em; }
.mp-now { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; min-width: 0; }
.mp-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.mp-info { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mp-seek { display: flex; align-items: center; gap: 10px; font: 12.5px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.mp-bar { flex: 1; min-width: 0; accent-color: var(--accent); }
.mp-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.mp-group { display: flex; align-items: center; gap: 2px; }
.mp-btn { position: relative; display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border: 0; border-radius: 9px; background: none; color: inherit; font: 700 12px var(--text); cursor: pointer; }
.mp-btn:hover { background: var(--hover); }
.mp-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.mp-btn svg { width: 19px; height: 19px; }
.mp-play { min-width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.mp-play:hover { background: var(--accent); filter: brightness(1.08); }
.mp-loop-tag { position: absolute; right: 3px; bottom: 2px; font-size: 9px; }
.mp-speed, .mp-subs { height: 32px; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 13px; }
.mp-subs { max-width: 150px; }
.mp-vol { width: 90px; accent-color: var(--accent); }
.mp-vol-pct { min-width: 46px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mp-file { cursor: pointer; }
.mp-adjust { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; }
.mp-adjust label { display: flex; align-items: center; gap: 6px; }
.mp-adjust input[type="range"] { width: 110px; accent-color: var(--accent); }
.mp-list { display: flex; flex-direction: column; gap: 8px; min-width: 0; max-height: 72vh; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.mp-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mp-filter { padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); }
.mp-items { list-style: none; margin: 0; padding: 0; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.mp-item { width: 100%; display: grid; grid-template-columns: 20px minmax(0, 1fr); column-gap: 8px; align-items: center; padding: 7px 8px; border: 0; border-radius: 9px; background: none; color: var(--ink); text-align: left; cursor: pointer; }
.mp-item:hover { background: var(--hover); }
.mp-item.on { background: var(--accent-soft); color: var(--accent); }
.mp-item .mp-kind { grid-row: span 2; text-align: center; color: var(--muted); }
.mp-item .mp-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-item small { grid-column: 2; font-size: 11.5px; color: var(--muted); }
.mp-list-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.mp-list-note:empty { display: none; }
.ai-video-figure .ai-video-open { margin-top: 6px; }
@container (max-width: 720px) {
  .mp { grid-template-columns: minmax(0, 1fr); }
  .mp-list { max-height: 260px; }
}
@media (max-width: 860px) {
  .mp { grid-template-columns: minmax(0, 1fr); }
  .mp-vol { width: 70px; }
}

/* ---------------------------------------------------------------- File viewer (viewer.js) */
html.vw-open, html.vw-open body { overflow: hidden; }
.vw { position: fixed; inset: 0; z-index: 120; display: grid; padding: 24px; padding: max(24px, env(safe-area-inset-top, 0px)) 24px 24px; }
.vw[hidden] { display: none; }
.vw-scrim { position: absolute; inset: 0; background: rgba(16, 22, 42, 0.46); }
.vw-win { position: relative; min-height: 0; display: flex; flex-direction: column; background: var(--surface); color: var(--ink); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.vw-head { flex: none; display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 8px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.vw-icon { width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--muted); display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.vw-icon.small { width: 28px; height: 28px; border-radius: 8px; }
.vw-icon:hover { background: var(--hover); color: var(--ink); }
.vw-badge { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; background: var(--hover); color: var(--muted); }
.vw-badge.big { width: 64px; height: 64px; border-radius: 14px; font-size: 15px; }
.vw-badge[data-kind="pdf"], .vw-tile[data-kind="pdf"] { background: color-mix(in srgb, var(--danger) 14%, var(--surface)); color: var(--danger); }
.vw-badge[data-kind="doc"], .vw-tile[data-kind="doc"] { background: var(--accent-soft); color: var(--accent); }
.vw-badge[data-kind="slides"], .vw-tile[data-kind="slides"] { background: color-mix(in srgb, #d9480f 14%, var(--surface)); color: #b4470c; }
.vw-badge[data-kind="sheet"], .vw-tile[data-kind="sheet"] { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); color: color-mix(in srgb, var(--ok) 70%, var(--ink)); }
.vw-badge[data-kind="video"], .vw-tile[data-kind="video"], .vw-badge[data-kind="audio"], .vw-tile[data-kind="audio"] { background: var(--accent-soft); color: var(--accent); }
.vw-titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 160px; }
.vw-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vw-spacer { flex: 1 1 0; }
.vw-zoom { display: flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.vw-zoom[hidden], .vw-find[hidden] { display: none; }
.vw-zoom button { min-width: 30px; height: 30px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-size: 17px; cursor: pointer; }
.vw-zoom .vw-fit { font-size: 13px; font-weight: 600; padding: 0 10px; }
.vw-zoom .vw-fit[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.vw-zoom button:hover { background: var(--hover); color: var(--ink); }
.vw-zoom-val { min-width: 46px; text-align: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vw-find { display: flex; align-items: center; gap: 4px; height: 38px; width: min(300px, 100%); padding: 0 6px 0 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.vw-find:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.vw-find svg { width: 17px; height: 17px; color: var(--muted); }
.vw-find input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font-size: 14px; }
.vw-find button { width: 26px; height: 26px; border: 0; border-radius: 7px; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.vw-find button:hover { background: var(--hover); color: var(--ink); }
.vw-find button svg { width: 16px; height: 16px; }
.vw-find-count { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.vw-actions { display: flex; gap: 6px; align-items: center; }
.vw-tools { position: relative; }
.vw-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; min-width: 230px; display: flex; flex-direction: column; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.vw-menu[hidden] { display: none; }
.vw-menu > a, .vw-menu > button { display: block; padding: 9px 12px; border: 0; border-radius: 9px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer; }
.vw-menu > a:hover, .vw-menu > button:hover { background: var(--hover); }
.vw-menu > [hidden] { display: none; }

.vw-body { position: relative; flex: 1; min-height: 0; display: flex; }
.vw-left, .vw-right { flex: none; display: flex; flex-direction: column; min-height: 0; }
.vw-left[hidden], .vw-right[hidden], .vw-tab[hidden] { display: none; }
.vw-left { width: 196px; background: var(--sidebar); border-right: 1px solid var(--line); }
.vw-right { width: 300px; background: var(--surface); border-left: 1px solid var(--line); }
.vw-rail-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; }
.vw-left .vw-rail-head { justify-content: space-between; }
.vw-left-title { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.vw-right-title { flex: 1; font-size: 15px; font-weight: 600; }
.vw-seg { display: flex; gap: 4px; padding: 0 12px 10px; }
.vw-seg[hidden] { display: none; }
.vw-seg button, .vw-scopes button { height: 28px; padding: 0 11px; border: 1px solid transparent; border-radius: 999px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.vw-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); }
.vw-parts { list-style: none; margin: 0; padding: 4px 12px 16px; overflow: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.vw-parts > li[hidden] { display: none; }
.vw-thumb { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; }
.vw-thumb-img { position: relative; display: block; background: #fff; border-radius: 3px; box-shadow: 0 1px 3px rgba(23, 32, 54, 0.2); }
.vw-thumb-img img { width: 100%; height: 100%; display: block; border-radius: 3px; }
.vw-thumb[aria-current="true"] .vw-thumb-img { outline: 3px solid var(--accent); outline-offset: 2px; }
.vw-thumb[aria-current="true"] .vw-thumb-n { color: var(--accent); font-weight: 600; }
.vw-thumb-n { font-size: 12px; }
.vw-thumb-count { position: absolute; top: -8px; right: -8px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; font-weight: 600; display: grid; place-items: center; box-sizing: border-box; }
.vw-thumb-count[hidden] { display: none; }
.vw-scene { width: 100%; display: flex; flex-direction: column; gap: 4px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 12px; text-align: left; cursor: pointer; }
.vw-scene img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; background: #000; }
.vw-scene[aria-current="true"] img { outline: 3px solid var(--accent); outline-offset: 2px; }
.vw-scene[aria-current="true"] { color: var(--accent); font-weight: 600; }
.vw-sheet-tab { width: 100%; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: var(--ink); font: inherit; font-size: 14px; font-weight: 600; text-align: left; cursor: pointer; }
.vw-sheet-tab small { font-size: 12px; font-weight: 400; color: var(--muted); }
.vw-sheet-tab[aria-current="true"] { background: var(--surface); color: var(--accent); }

.vw-tab { flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px; width: 44px; padding: 14px 0; border: 0; background: var(--sidebar); color: var(--muted); cursor: pointer; }
.vw-tab-left { border-right: 1px solid var(--line); }
.vw-tab-right { width: 56px; background: var(--surface); border-left: 1px solid var(--line); }
.vw-tab svg { width: 16px; height: 16px; }
.vw-tab-label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12.5px; font-weight: 600; }
.vw-minis { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.vw-minis .vw-tile { width: 34px; height: 34px; font-size: 9px; }
.vw-minis small { font-size: 12px; font-weight: 600; }
.vw-tab:hover { color: var(--ink); }

.vw-canvas { position: relative; flex: 1; min-width: 0; overflow: auto; background: var(--bg); outline: none; }
.vw-stage { min-height: 100%; }
.vw-wait { margin: 0; padding: 80px 20px; text-align: center; color: var(--muted); }
.vw-pages { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 24px 16px 96px; }
.vw-page { position: relative; flex: none; margin: 0; max-width: none; background: #fff; box-shadow: 0 1px 3px rgba(23, 32, 54, 0.16), 0 8px 24px -12px rgba(23, 32, 54, 0.3); }
.vw-page img { width: 100%; height: 100%; display: block; }
.vw-pageno { font-size: 12px; color: var(--muted); }
.vw-hits { position: absolute; inset: 0; pointer-events: none; }
.vw-hit { position: absolute; display: block; background: rgba(255, 214, 0, 0.42); border-radius: 2px; mix-blend-mode: multiply; }
.vw-hit.on { background: rgba(46, 70, 240, 0.4); outline: 2px solid var(--accent); }
.vw-pill { position: sticky; bottom: 18px; left: 0; width: max-content; margin: -64px auto 0; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 999px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow); }
.vw-pill[hidden] { display: none; }
.vw-pill button { width: 32px; height: 32px; border: 0; border-radius: 999px; background: none; color: inherit; display: grid; place-items: center; cursor: pointer; }
.vw-pill button svg { width: 16px; height: 16px; }
.vw-pill-val { padding: 0 6px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.vw-toast { position: sticky; bottom: 70px; width: max-content; max-width: calc(100% - 32px); margin: 0 auto; padding: 8px 14px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 13.5px; }
.vw-toast[hidden] { display: none; }
.vw-image { min-height: 100%; display: grid; place-items: center; padding: 24px; box-sizing: border-box; }
.vw-image.fit { height: 100%; }
.vw-image.fit img { max-width: 100%; max-height: calc(100vh - 170px); object-fit: contain; }
.vw-image img { display: block; background: repeating-conic-gradient(#e6e9f0 0% 25%, #fff 0% 50%) 50% / 20px 20px; box-shadow: 0 8px 24px -12px rgba(23, 32, 54, 0.45); }
.vw-media { padding: 20px; max-width: 1100px; margin: 0 auto; }
.vw-media .mp-stage { max-height: calc(100vh - 290px); }
.vw-sheet { padding: 16px; overflow: auto; }
.vw-sheet table { border-collapse: collapse; background: var(--surface); font-size: 13px; font-variant-numeric: tabular-nums; }
.vw-sheet th, .vw-sheet td { border: 1px solid var(--line); padding: 5px 9px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.vw-sheet thead th, .vw-sheet tbody th { position: sticky; background: var(--sidebar); color: var(--muted); font-weight: 600; font-size: 12px; }
.vw-sheet thead th { top: 0; z-index: 1; }
.vw-sheet tbody th { left: 0; }
.vw-note { color: var(--muted); font-size: 13px; }
.vw-text { max-width: 860px; margin: 24px auto; padding: 28px 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.vw-code { white-space: pre-wrap; font: 13px/1.55 var(--mono); }
.vw-text.markdown pre { padding: 10px 12px; border-radius: 10px; background: var(--bubble); overflow-x: auto; }
.vw-error { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 80px 20px; text-align: center; color: var(--muted); }

.vw-scopes { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 12px 10px; }
.vw-scopes[hidden] { display: none; }
.vw-scopes button { border-color: var(--line); }
.vw-scopes button[aria-pressed="true"] { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.vw-filter { margin: 0 12px 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); font-size: 13.5px; }
.vw-shelf { flex: 1; min-height: 0; overflow: auto; padding: 0 12px 16px; }
.vw-shelf-label { margin: 8px 0 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.vw-shelf-label[hidden], .vw-empty[hidden] { display: none; }
.vw-recent, .vw-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.vw-recent .vw-file { border: 2px solid var(--accent); background: var(--accent-soft); }
.vw-recent .vw-file small { color: var(--accent); }
.vw-file { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.vw-file:hover { border-color: var(--faint); }
.vw-file.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.vw-file-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vw-file-meta b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-file-meta small { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-tile { flex: none; width: 54px; height: 54px; border-radius: 8px; display: grid; place-items: center; overflow: hidden; background: var(--hover); color: var(--muted); font-size: 11px; font-weight: 700; }
.vw-tile.pic { background: var(--bg); }
.vw-tile.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vw-tile.page img { object-fit: contain; background: #fff; }
.vw-empty { color: var(--muted); font-size: 13px; }

/* phones and narrow windows: the side panels slide over the canvas */
.vw.narrow { padding: 0; }
.vw.narrow .vw-win { border-radius: 0; }
.vw.narrow .vw-left, .vw.narrow .vw-right { position: absolute; top: 0; bottom: 0; z-index: 3; box-shadow: var(--shadow); }
.vw.narrow .vw-left { left: 0; }
.vw.narrow .vw-right { right: 0; width: min(320px, 88vw); }
.vw.narrow .vw-tab { width: 36px; }
.vw.narrow .vw-tab-right .vw-minis { display: none; }
.vw.narrow .vw-zoom .vw-fit, .vw.narrow .vw-actions .ghost[data-act="ask"] { display: none; }
.vw.narrow .vw-find { order: 10; width: 100%; }
@media (prefers-reduced-motion: no-preference) {
  .vw-win { animation: vw-in 0.18s ease-out; }
  @keyframes vw-in { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }
}
.d-view-thumb { display: block; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; }
.link.d-view { text-align: left; }

/* ======================================================================= Mail composer (mail-compose.js) */
dialog.compose.mc[open] { width: min(1360px, calc(100% - 32px)); height: calc(100% - 32px); max-height: none; border-radius: 16px; }
dialog.compose form.mc-form { flex: 1; min-height: 0; max-height: none; display: flex; flex-direction: column; }
.mc-title { background: var(--accent); color: var(--accent-ink); border-bottom: 0 !important; padding: 8px 8px 8px 16px !important; }
.mc-title h2 { flex: 1; color: inherit; }
.mc-title .icon-btn { color: inherit; }
.mc-title .icon-btn:hover, .mc-title .icon-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--accent-ink) 18%, transparent); }
.mc-tabs { display: flex; gap: 2px; padding: 0 10px; background: var(--bg); }
.mc-tab { height: 34px; padding: 0 12px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font: 600 13px var(--text); cursor: pointer; }
.mc-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.mc-ribbon.gmc-format { position: relative; display: block; margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--bg); }
.mc-panel { display: flex; align-items: stretch; gap: 0; padding: 6px 8px 0; overflow-x: auto; scrollbar-width: thin; }
.mc-panel[hidden] { display: none; }
.mc-group { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 0 10px 20px; border-right: 1px solid var(--line); flex: none; }
.mc-group:last-child { border-right: 0; }
.mc-group::after { content: attr(data-label); position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font: 500 11px var(--text); color: var(--faint); }
.mc-group:not(:has(.mc-row)) { flex-direction: row; align-items: center; }
.mc-row { display: flex; align-items: center; gap: 2px; }
.mc-row select, dialog.mc .mc-row select { height: 28px; max-width: none; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font: 12.5px var(--text); padding: 0 4px; }
#mc-font { width: 140px; }
#mc-size { width: 58px; }
.mc-i { position: relative; width: 30px; height: 28px; border: 0; border-radius: 7px; background: none; color: var(--ink); font: 600 13.5px var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; white-space: nowrap; }
.mc-i svg, .mc-big svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.mc-i sub, .mc-i sup { font-size: 9px; }
.mc-i:hover, .mc-big:hover, .mc-style:hover { background: var(--hover); }
.mc-i[aria-pressed="true"], .mc-style[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.mc-swatch { display: flex; flex-direction: column; gap: 1px; }
.mc-swatch span, .mc-swatch svg { width: 16px; height: 16px; line-height: 16px; }
.mc-bar { display: block; width: 16px; height: 3px; border-radius: 2px; background: currentColor; }
.mc-big { min-width: 58px; height: 56px; padding: 4px 6px; border: 0; border-radius: 9px; background: none; color: var(--ink); font: 500 11.5px var(--text); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.mc-big svg { width: 22px; height: 22px; color: var(--accent); }
.mc-code-btn b { font: 700 13px/22px var(--mono); color: var(--accent); }
.mc-styles { gap: 6px; }
.mc-style { min-width: 84px; white-space: nowrap; height: 52px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: 500 12.5px var(--text); text-align: left; cursor: pointer; }
.mc-style.h1 { font: 700 15px var(--text); color: var(--accent); }
.mc-style.h2 { font: 700 13.5px var(--text); }
.mc-style.h3 { font: 600 12.5px var(--text); color: var(--muted); }
dialog.mc.mc-simple .mc-group { padding-bottom: 0; }
dialog.mc.mc-simple .mc-group::after { display: none; }
dialog.mc.mc-simple .mc-panel { padding: 4px 8px; }
dialog.mc.mc-simple .mc-group { flex-direction: row; align-items: center; }
dialog.mc.mc-simple .mc-big { min-width: 0; height: 30px; flex-direction: row; font-size: 12.5px; }
dialog.mc.mc-simple .mc-big svg { width: 16px; height: 16px; }
dialog.mc.mc-simple .mc-style { height: 30px; width: auto; }
dialog.mc.mc-simple .mc-style:not(.h1):not([data-mc="paragraph"]) { display: none; }
.mc .gmc-pop { top: 100%; bottom: auto; left: 12px; margin-top: 4px; z-index: 20; max-height: 360px; }
.mc .gmc-pop:not(.mc-pop) { left: auto; right: 12px; }
.mc .gmc-pop.mc-pop { width: max-content; max-width: 340px; max-height: min(560px, 70vh); display: grid; gap: 8px; }
.mc-pop-label { margin: 0; font: 600 12.5px var(--text); color: var(--ink); }
.mc-pop-note { margin: 0; font-size: 12px; color: var(--muted); }
.mc-swatches { display: grid; grid-template-columns: repeat(5, 26px); gap: 6px; }
.mc-sw { width: 26px; height: 26px; border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); border-radius: 7px; cursor: pointer; padding: 0; }
.mc-sw:hover { outline: 2px solid var(--accent); outline-offset: 1px; }
.mc-sw-none, .mc-menu-item { border: 0; border-radius: 8px; background: none; color: var(--ink); font: 500 13px var(--text); text-align: left; padding: 7px 10px; cursor: pointer; }
.mc-sw-none:hover, .mc-menu-item:hover { background: var(--hover); }
.mc-menu-item[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.mc-grid { display: grid; grid-template-columns: repeat(8, 18px); gap: 3px; }
.mc-grid button { width: 18px; height: 18px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); padding: 0; cursor: pointer; }
.mc-grid button.on { background: var(--accent-soft); border-color: var(--accent); }
.mc-langs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.mc-themes { display: flex; gap: 8px; }
.mc-theme { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 600 11.5px var(--text); cursor: pointer; }
.mc-theme[aria-pressed="true"] { border: 2px solid var(--accent); padding: 5px; }
.mc-theme span { width: 58px; height: 28px; border: 1px solid; border-radius: 6px; display: grid; place-items: center; }
.mc-theme i { font: 600 12px var(--mono); font-style: normal; }
.mc-heads { display: flex; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.mc-send { flex-direction: column; margin: 0; }
.mc-send .gmc-send { width: 76px; height: 40px; border-radius: 12px 12px 0 0; }
.mc-send .gmc-send-more { width: 76px; height: 22px; border: 0; border-top: 1px solid color-mix(in srgb, var(--accent-ink) 28%, transparent); border-radius: 0 0 12px 12px; }
.mc-send .gmc-send-menu { top: calc(100% + 6px); bottom: auto; z-index: 21; }
.mc-send #c-at { margin-top: 6px; width: 76px; font-size: 11px; }
.mc-fields { flex: 1; min-width: 0; }
.mc-fields .gmc-row { padding: 0; min-height: 34px; border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.mc-fields .gmc-row > span:first-child { width: 62px; }
.mc-fields .gmc-subject > span { display: block; }
.mc-main { flex: 1; min-height: 0; display: flex; }
.mc-files { width: 240px; flex: none; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: color-mix(in srgb, var(--bg) 70%, var(--line)); border-right: 1px solid var(--line); min-height: 0; }
.mc-files.collapsed { width: 44px; padding: 0; }
.mc-files.collapsed > :not(.mc-rail) { display: none; }
.mc-files-head { display: flex; align-items: center; gap: 8px; }
.mc-files-head b { flex: 1; font-size: 14px; }
.mc-files-head .icon-btn { width: 28px; height: 28px; font-size: 15px; }
.mc-src { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.mc-src button { flex: 1; height: 26px; padding: 0 6px; white-space: nowrap; border: 0; border-radius: 999px; background: none; color: var(--muted); font: 600 12px var(--text); cursor: pointer; }
.mc-src button[aria-selected="true"] { background: var(--ink); color: var(--surface); }
.mc-src button[hidden] { display: none; }
#mc-files-q { height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: 13px var(--text); }
.mc-file-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; overflow: auto; flex: 1; min-height: 0; align-content: start; }
.mc-file { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--ink); text-align: left; cursor: grab; font: inherit; }
.mc-file:hover { border-color: var(--accent); }
.mc-file.dragging { opacity: 0.5; }
.mc-file { min-width: 0; }
.mc-file-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mc-file-text b, .mc-open b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-file-text small, .mc-open small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-tag { flex: none; min-width: 34px; height: 22px; padding: 0 5px; border-radius: 6px; display: inline-grid; place-items: center; font: 700 10px var(--text); letter-spacing: 0.02em; background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.mc-tag[data-ext="docx"], .mc-tag[data-ext="doc"], .mc-tag[data-ext="odt"], .mc-tag[data-ext="rtf"] { background: #dde2ff; color: #2e46f0; }
.mc-tag[data-ext="xlsx"], .mc-tag[data-ext="xls"], .mc-tag[data-ext="csv"], .mc-tag[data-ext="ods"] { background: #dcf3e5; color: #1e7a45; }
.mc-tag[data-ext="pptx"], .mc-tag[data-ext="ppt"], .mc-tag[data-ext="odp"] { background: #ffe8d6; color: #b4470c; }
.mc-tag[data-ext="pdf"] { background: #fde2e1; color: #c62828; }
.mc-tag[data-ext="html"], .mc-tag[data-ext="htm"] { background: #172036; color: #ffffff; }
.mc-tag[data-ext="py"] { background: #fff4c2; color: #8a6100; }
.mc-tag[data-ext="css"], .mc-tag[data-ext="js"], .mc-tag[data-ext="ts"] { background: #e3e8ff; color: #3b4bc4; }
.mc-tag[data-ext="png"], .mc-tag[data-ext="jpg"], .mc-tag[data-ext="jpeg"], .mc-tag[data-ext="gif"], .mc-tag[data-ext="webp"] { background: #e6dcff; color: #6b3fd4; }
.mc-hint { margin: 0; font-size: 12px; color: var(--muted); }
.mc-rail { width: 44px; height: 100%; border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; padding-top: 14px; cursor: pointer; }
.mc-rail[hidden] { display: none; }
.mc-rail-label { writing-mode: vertical-rl; transform: rotate(180deg); font: 600 12.5px var(--text); }
.mc-center { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mc-write { position: relative; flex: 1; min-height: 0; overflow: auto; background: color-mix(in srgb, var(--bg) 80%, var(--line)); padding: 16px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mc-write { background: color-mix(in srgb, var(--surface) 70%, var(--line)); } }
:root[data-theme="dark"] .mc-write { background: color-mix(in srgb, var(--surface) 70%, var(--line)); }
.mc-write[hidden], .mc-edit[hidden] { display: none; }
.mc-paper { max-width: 820px; min-height: 100%; margin: 0 auto; background: var(--surface); border-radius: 4px; box-shadow: 0 1px 3px rgba(23, 32, 54, 0.14); }
.mc-host.gmc-body { padding: 0; min-height: 100%; overflow: visible; }
.mc-doc { position: relative; white-space: pre-wrap; word-wrap: break-word; font-variant-ligatures: none; font-feature-settings: "liga" 0; }
.mc-doc [contenteditable="false"] { white-space: normal; }
.mc-doc pre { white-space: pre-wrap; }
.mc-doc img.ProseMirror-separator { display: inline !important; border: none !important; margin: 0 !important; }
.mc-doc .ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; margin: 0; }
.mc-doc .ProseMirror-gapcursor::after { content: ""; display: block; position: absolute; top: -2px; width: 20px; border-top: 1px solid var(--ink); animation: mc-cursor 1.1s steps(2, start) infinite; }
@keyframes mc-cursor { to { visibility: hidden; } }
.mc-doc.ProseMirror-hideselection *::selection { background: transparent; }
.mc-doc.ProseMirror-focused .ProseMirror-gapcursor { display: block; }
.mc-doc { min-height: 420px; padding: 28px 44px; outline: none; font: 15px/1.5 "Instrument Sans", var(--text); color: var(--ink); }
.mc-doc > * + * { margin-top: 0; }
.mc-doc p { margin: 0; }
.mc-doc h1 { font: 700 26px/1.25 var(--text); margin: 10px 0 6px; }
.mc-doc h2 { font: 700 20px/1.3 var(--text); margin: 10px 0 4px; }
.mc-doc h3 { font: 600 16.5px/1.35 var(--text); margin: 8px 0 4px; }
.mc-doc ul, .mc-doc ol { margin: 4px 0; padding-left: 26px; }
.mc-doc blockquote { margin: 6px 0; padding-left: 12px; border-left: 3px solid var(--line); color: var(--muted); }
.mc-doc a { color: var(--accent); }
.mc-doc img { max-width: 100%; height: auto; border-radius: 4px; }
.mc-doc img.ProseMirror-selectednode { outline: 2px solid var(--accent); }
.mc-doc hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.mc-doc mark { border-radius: 2px; padding: 0 1px; color: inherit; }
.mc-doc code { font: 0.9em var(--mono); background: var(--bg); padding: 1px 5px; border-radius: 5px; }
.mc-doc table { border-collapse: collapse; margin: 8px 0; table-layout: fixed; min-width: 50%; }
.mc-doc th, .mc-doc td { border: 1px solid var(--line); padding: 6px 10px; vertical-align: top; min-width: 60px; }
.mc-doc th { background: var(--bg); font-weight: 600; text-align: left; }
.mc-doc .selectedCell { background: var(--accent-soft); }
.mc-doc pre { position: relative; margin: 10px 0; padding: 0 0 10px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font: 13.5px/1.65 var(--mono); white-space: pre-wrap; }
.mc-doc pre::before { display: block; padding: 5px 12px; margin-bottom: 10px; border-bottom: 1px solid; font: 600 12px var(--text); content: "Code"; }
.mc-doc pre code { display: block; padding: 0 14px; background: none; font: inherit; border-radius: 0; color: inherit; }
.mc-doc pre:has(+ *) { margin-bottom: 10px; }
.mc-doc p.is-editor-empty:first-child::before { content: attr(data-placeholder); float: left; height: 0; color: var(--faint); pointer-events: none; }
.mc-drop { position: absolute; inset: 0; z-index: 5; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px; background: color-mix(in srgb, var(--surface) 70%, transparent); backdrop-filter: blur(2px); }
.mc-drop[hidden] { display: none; }
.mc-drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 2px dashed var(--accent); border-radius: 16px; background: color-mix(in srgb, var(--accent-soft) 70%, transparent); color: var(--accent); text-align: center; padding: 12px; }
.mc-drop-zone b { font-size: 16px; }
.mc-drop-zone span { font-size: 13px; color: var(--muted); }
.mc-drop-zone.over { background: var(--accent); color: var(--accent-ink); border-style: solid; }
.mc-drop-zone.over span { color: inherit; }
.mc-attached { width: 268px; flex: none; display: flex; flex-direction: column; gap: 8px; padding: 12px; border-left: 1px solid var(--line); background: var(--surface); min-height: 0; }
.mc-attached.over { background: var(--accent-soft); }
.mc-attached-list.gmc-files { display: grid; gap: 8px; padding: 0; border: 0; overflow: auto; align-content: start; }
.mc-attached-list .gmc-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--surface); }
.mc-attached-list .gmc-chip.edited { border-color: color-mix(in srgb, var(--ok) 60%, var(--line)); }
.mc-attached-list .gmc-chip.edited small { color: #1e7a45; }
.mc-attached-list .mc-tag { min-width: 36px; height: 36px; border-radius: 8px; }
.mc-attached-list .gmc-chip .mc-open { width: auto; height: auto; border-radius: 0; place-items: initial; }
.mc-attached-list .gmc-chip > button:last-child { flex: none; }
.mc-open { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; border: 0; background: none; color: var(--ink); text-align: left; padding: 0; cursor: pointer; font: inherit; }
.mc-open b, .mc-open small { display: block; max-width: 100%; line-height: 1.35; }
.mc-edit { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.mc-mode { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--accent-soft); border-bottom: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); min-width: 0; }
.mc-mode > * { flex: none; }
.mc-mode .mc-edit-note { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#mc-done { height: 34px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: 600 13px var(--text); cursor: pointer; width: auto; }
.mc-back { height: 32px; padding: 0 12px; border: 1px solid var(--accent); border-radius: 999px; background: var(--surface); color: var(--accent); font: 600 13px var(--text); cursor: pointer; }
.mc-mode b { font-size: 14px; }
.mc-pill { height: 26px; padding: 0 12px; border-radius: 999px; background: var(--ink); color: var(--surface); display: inline-grid; place-items: center; font: 600 12px var(--text); }
dialog.mc[data-editor="office"] .mc-pill { background: #d9480f; color: #fff; }
.mc-edit-note { font-size: 12.5px; color: var(--muted); }
.mc-grow { flex: 1; }
.mc-code { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #1b2236; color: #e7ebf5; }
.mc-code[hidden], .mc-office[hidden], .mc-preview[hidden], .mc-tb[hidden] { display: none; }
.mc-code[data-theme="day"] { background: #f6f8fb; color: #172036; }
.mc-code-bar { display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: #141a2c; border-bottom: 1px solid #2b3452; }
.mc-code-bar select, dialog.mc .mc-code-bar select { height: 28px; padding: 0 6px; border: 1px solid #2b3452; border-radius: 7px; background: #1b2236; color: #e7ebf5; font: 600 12px var(--text); }
.mc-tb { height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: #c9d1e3; font: 600 12px var(--text); cursor: pointer; }
.mc-tb:hover { background: #232c48; }
.mc-tb.on, .mc-tb[aria-pressed="true"] { background: #2e46f0; color: #fff; }
.mc-code-main { flex: 1; min-height: 0; display: flex; }
.mc-cm { flex: 1; min-width: 0; display: flex; }
.mc-cm .CodeMirror { flex: 1; height: auto; font: 13.5px/1.7 var(--mono); }
.mc-preview { width: 38%; min-width: 280px; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.mc-preview-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.mc-preview-head b { flex: 1; font-size: 13px; }
.mc-preview-head span { font-size: 11.5px; color: var(--muted); }
.mc-preview iframe { flex: 1; margin: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.mc-code-status { height: 26px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 12px; border-top: 1px solid #2b3452; background: #141a2c; font-size: 11.5px; color: #9aa4bb; }
.mc-office { flex: 1; min-height: 0; display: flex; }
.mc-office > div, .mc-office iframe { flex: 1; width: 100%; height: 100%; border: 0; }
.mc-foot { display: flex; align-items: center; gap: 10px; padding: 4px 12px; border-top: 1px solid var(--line); min-height: 36px; }
.mc-foot .code-msg { flex: 1; margin: 0; }
.mc-foot .gmc-trash { margin-left: auto; }
/* CodeMirror themes for the code editor */
.cm-s-axork-night.CodeMirror { background: #1b2236; color: #e7ebf5; }
.cm-s-axork-night .CodeMirror-gutters { background: #1b2236; border-right: 1px solid #2b3452; }
.cm-s-axork-night .CodeMirror-linenumber { color: #6e7891; }
.cm-s-axork-night .CodeMirror-cursor { border-left-color: #e7ebf5; }
.cm-s-axork-night .CodeMirror-selected, .cm-s-axork-night.CodeMirror-focused .CodeMirror-selected { background: #2b3a66; }
.cm-s-axork-night .CodeMirror-activeline-background { background: #232c48; }
.cm-s-axork-night .cm-keyword { color: #c678dd; } .cm-s-axork-night .cm-tag { color: #e06c75; }
.cm-s-axork-night .cm-attribute, .cm-s-axork-night .cm-number { color: #d19a66; }
.cm-s-axork-night .cm-string { color: #98c379; } .cm-s-axork-night .cm-comment { color: #7f8aa3; font-style: italic; }
.cm-s-axork-night .cm-def, .cm-s-axork-night .cm-variable-2, .cm-s-axork-night .cm-property { color: #61afef; }
.cm-s-axork-night .cm-builtin, .cm-s-axork-night .cm-atom { color: #56b6c2; } .cm-s-axork-night .cm-bracket, .cm-s-axork-night .cm-meta { color: #9aa4bb; }
.cm-s-axork-night .cm-variable, .cm-s-axork-night .cm-operator { color: #e7ebf5; } .cm-s-axork-night .cm-header { color: #e06c75; }
.cm-s-axork-day.CodeMirror { background: #ffffff; color: #172036; }
.cm-s-axork-day .CodeMirror-gutters { background: #f6f8fb; border-right: 1px solid #d3d9e4; }
.cm-s-axork-day .CodeMirror-linenumber { color: #9aa4bb; }
.cm-s-axork-day .cm-keyword { color: #7c3aed; } .cm-s-axork-day .cm-tag { color: #c2410c; }
.cm-s-axork-day .cm-attribute, .cm-s-axork-day .cm-number { color: #b45309; }
.cm-s-axork-day .cm-string { color: #0d7a5f; } .cm-s-axork-day .cm-comment { color: #7f8aa3; font-style: italic; }
.cm-s-axork-day .cm-def, .cm-s-axork-day .cm-variable-2, .cm-s-axork-day .cm-property { color: #2e46f0; }
.mc-code[data-theme="day"] .mc-code-bar, .mc-code[data-theme="day"] .mc-code-status { background: #eef1f6; border-color: #d3d9e4; color: #5a6478; }
.mc-code[data-theme="day"] .mc-code-bar select, dialog.mc .mc-code[data-theme="day"] .mc-code-bar select { background: #fff; color: #172036; border-color: #d3d9e4; }
.mc-code[data-theme="day"] .mc-tb { color: #3b4252; }
.mc-code[data-theme="day"] .mc-tb:hover { background: #dde2ff; }
@media (max-width: 1100px) {
  .mc-attached { width: 220px; }
  .mc-files:not(.collapsed) { width: 210px; }
  .mc-preview { min-width: 220px; }
}
@media (max-width: 760px) {
  dialog.compose.mc[open] { width: 100%; height: 100%; max-width: none; border-radius: 0; }
  .mc-main { flex-direction: column; overflow: auto; }
  .mc-files, .mc-files.collapsed { display: none; }
  .mc-attached { width: auto; border-left: 0; border-top: 1px solid var(--line); flex: none; max-height: 40%; }
  .mc-write { padding: 0; flex: none; min-height: 320px; }
  .mc-paper { border-radius: 0; box-shadow: none; }
  .mc-doc { padding: 14px 16px; min-height: 280px; }
  .mc-heads { padding: 8px 12px; }
  .mc-send .gmc-send { width: 64px; }
  .mc-send .gmc-send-more { width: 64px; }
  .mc-code-main { flex-direction: column; }
  .mc-preview { width: auto; min-width: 0; height: 40%; border-left: 0; border-top: 1px solid var(--line); }
  .mc-edit-note { display: none; }
}
.mc-code-go { height: 34px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: 600 13px var(--text); cursor: pointer; }

/* ======================================================================= PDF reader (pdf-reader.js, PDF.js) */
.vw-page .pdf-canvas, .pdf-page .pdf-canvas { position: absolute; left: 0; top: 0; display: block; z-index: 1; }
.vw-page[data-drawn] > img { visibility: hidden; }
.vw-page .vw-hits { z-index: 2; }
.textLayer { position: absolute; inset: 0; overflow: clip; opacity: 1; line-height: 1; text-align: initial; z-index: 3;
  -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: color-mix(in srgb, #2e46f0 30%, transparent); }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }
.textLayer.selecting .endOfContent { top: 0; }
.textLayer .pdf-hit { background: rgba(255, 214, 79, 0.55); border-radius: 2px; }
.textLayer .pdf-hit.on { background: rgba(249, 168, 37, 0.75); outline: 2px solid #f9a825; }
.pdf-reader { position: relative; min-height: 0; display: flex; flex-direction: column; background: color-mix(in srgb, var(--bg) 70%, var(--line)); }
.pdf-scroll { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.pdf-pages { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pdf-page { position: relative; flex: none; background: #fff; box-shadow: 0 1px 3px rgba(23, 32, 54, 0.18); }
.pdf-msg { margin: 24px; color: var(--muted); text-align: center; }
.pdf-selbar { position: fixed; z-index: 400; display: flex; gap: 2px; padding: 4px; border-radius: 10px; background: #172036; box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.45); }
.pdf-selbar[hidden] { display: none; }
.pdf-selbar button { height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: #fff; font: 600 12.5px var(--text); cursor: pointer; }
.pdf-selbar button:hover { background: rgba(255, 255, 255, 0.14); }
.pdf-selbar button:last-child:not(:first-child) { background: #2e46f0; }

/* ======================================================================= File preview pane (file-preview.js) */
.fp { display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.fp-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.fp-title { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.fp-title b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-title small { font-size: 12px; color: var(--muted); }
.fp-tag { flex: none; min-width: 38px; height: 24px; padding: 0 6px; border-radius: 6px; display: inline-grid; place-items: center; font: 700 10.5px var(--text);
  background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.fp-tag[data-ext="pdf"] { background: #fde2e1; color: #c62828; }
.fp-tag:is([data-ext="docx"], [data-ext="doc"], [data-ext="odt"]) { background: #dde2ff; color: #2e46f0; }
.fp-tag:is([data-ext="xlsx"], [data-ext="xls"], [data-ext="csv"]) { background: #dcf3e5; color: #1e7a45; }
.fp-tag:is([data-ext="pptx"], [data-ext="ppt"]) { background: #ffe8d6; color: #b4470c; }
.fp-tag:is([data-ext="mp4"], [data-ext="webm"], [data-ext="mov"], [data-ext="mkv"], [data-ext="png"], [data-ext="jpg"], [data-ext="jpeg"]) { background: #e6dcff; color: #6b3fd4; }
.fp-icon { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: 600 14px var(--text); cursor: pointer; display: grid; place-items: center; }
.fp-icon:hover, .fp-btn:hover { background: var(--hover); }
.fp-tools { display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.fp-tools[hidden], .fp-acts[hidden] { display: none; }
.fp-zoom { min-width: 44px; text-align: center; font-size: 12.5px; color: var(--muted); }
.fp-btn { height: 30px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: 600 12.5px var(--text); cursor: pointer; }
.fp-page, .fp-count { font-size: 12.5px; color: var(--muted); margin-left: 6px; }
.fp-grow { flex: 1; }
.fp-find { width: 150px; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: 12.5px var(--text); }
.fp-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; background: color-mix(in srgb, var(--bg) 70%, var(--line)); }
.fp-pdf { flex: 1; min-height: 0; }
.fp-wait { margin: 24px; color: var(--muted); text-align: center; }
.fp-image { padding: 16px; display: grid; place-items: center; }
.fp-image img { max-width: 100%; max-height: 70vh; border-radius: 6px; box-shadow: 0 1px 3px rgba(23, 32, 54, 0.18); }
.fp-media { padding: 12px; }
.fp-text { margin: 0; padding: 16px; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; background: var(--surface); flex: 1; }
.fp-tabs { display: flex; gap: 4px; padding: 8px 10px; flex-wrap: wrap; }
.fp-tabs button { height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 600 12px var(--text); cursor: pointer; }
.fp-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.fp-sheet { overflow: auto; padding: 0 10px 10px; }
.fp-sheet table { border-collapse: collapse; background: var(--surface); font-size: 12.5px; }
.fp-sheet td { border: 1px solid var(--line); padding: 4px 8px; white-space: nowrap; }
.fp-sheet tr:first-child td { background: var(--bg); font-weight: 600; }
.fp-acts { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 14px; border-top: 1px solid var(--line); }
.fp-act { height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 600 12.5px var(--text); cursor: pointer; }
.fp-act.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
dialog.fp-picker { width: min(420px, calc(100% - 24px)); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
dialog.fp-picker::backdrop { background: rgba(10, 14, 30, 0.4); }
.fp-picker-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 12px 16px; border-bottom: 1px solid var(--line); }
.fp-picker-head b { flex: 1; font-size: 15px; }
dialog.fp-picker ul { list-style: none; margin: 0; padding: 8px; display: grid; gap: 2px; max-height: 60vh; overflow: auto; }
dialog.fp-picker li button { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
dialog.fp-picker li button:hover { background: var(--hover); }
dialog.fp-picker li small { color: var(--muted); font-size: 12px; }

/* Drive: list on the left, preview on the right. With the pane open, the pane holds each file's actions. */
.drive-split.open td.d-actions, .drive-split.open th:last-child { display: none; }
.drive-split.open td, .drive-split.open th { white-space: nowrap; }
.drive-split.open td:nth-child(2) { white-space: normal; }
.drive-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.drive-split.open { grid-template-columns: minmax(0, 1fr) minmax(360px, 46%); }
.drive-preview { position: sticky; top: 12px; height: max(480px, calc(100vh - 250px)); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.drive-preview[hidden] { display: none; }
.previewing, .drive-card.previewing { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft); }
@media (max-width: 900px) {
  .drive-split.open { grid-template-columns: minmax(0, 1fr); }
  .drive-preview { position: fixed; inset: 0; z-index: 90; height: auto; border-radius: 0; }
}

/* ======================================================================= Editor dialog (file-edit.js) */
dialog.fe { width: min(1280px, calc(100% - 32px)); height: calc(100% - 32px); max-height: none; padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); }
dialog.fe[open] { display: flex; flex-direction: column; }
dialog.fe::backdrop { background: rgba(10, 14, 30, 0.45); }
.fe-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--accent-soft); border-bottom: 1px solid var(--line); }
.fe-close { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--ink); cursor: pointer; }
.fe-name { font-size: 14.5px; }
.fe-pill { height: 26px; padding: 0 12px; border-radius: 999px; background: var(--ink); color: var(--surface); display: inline-grid; place-items: center; font: 600 12px var(--text); }
.fe-note, .fe-saved { font-size: 12.5px; color: var(--muted); }
.fe-grow { flex: 1; }
.fe-done { height: 34px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font: 600 13px var(--text); cursor: pointer; }
.fe-code { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #1b2236; }
.fe-code[hidden], .fe-office[hidden], .fe-preview[hidden], .fe-tb[hidden] { display: none; }
.fe-tools { display: flex; align-items: center; gap: 4px; padding: 6px 10px; background: #141a2c; border-bottom: 1px solid #2b3452; }
.fe-tools select, dialog.fe .fe-tools select { height: 28px; padding: 0 6px; border: 1px solid #2b3452; border-radius: 7px; background: #1b2236; color: #e7ebf5; font: 600 12px var(--text); }
.fe-tb { height: 30px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: #c9d1e3; font: 600 12px var(--text); cursor: pointer; }
.fe-tb[aria-pressed="true"] { background: #2e46f0; color: #fff; }
.fe-main { flex: 1; min-height: 0; display: flex; }
.fe-cm { flex: 1; min-width: 0; display: flex; }
.fe-cm .CodeMirror { flex: 1; height: auto; font: 13.5px/1.7 var(--mono); }
.fe-preview { width: 40%; display: flex; background: var(--bg); border-left: 1px solid var(--line); }
.fe-preview iframe { flex: 1; margin: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.fe-office { flex: 1; min-height: 0; display: flex; }
.fe-office > div, .fe-office iframe { flex: 1; width: 100%; height: 100%; border: 0; }
@media (max-width: 760px) {
  dialog.fe { width: 100%; height: 100%; border-radius: 0; }
  .fe-main { flex-direction: column; }
  .fe-preview { width: auto; height: 40%; border-left: 0; border-top: 1px solid var(--line); }
  .fe-note { display: none; }
}

/* ======================================================================= Chat canvas (chat-canvas.js) */
.conv-body { flex: 1; min-height: 0; display: flex; }
.conv-chat { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.conv-canvas { position: relative; width: 460px; flex: none; min-height: 0; display: flex; border-left: 1px solid var(--line); background: var(--bg); }
.conv-canvas[hidden] { display: none; }
.conv-body[data-canvas="full"] .conv-chat { display: none; }
.conv-body[data-canvas="full"] .conv-canvas { flex: 1; width: auto !important; border-left: 0; }
.conv-body[data-canvas="full"] .cc-resize { display: none; }
.cc-resize { position: absolute; left: -5px; top: 0; bottom: 0; width: 10px; cursor: col-resize; z-index: 3; }
.cc-resize::after { content: ""; position: absolute; left: 3px; top: 50%; width: 4px; height: 44px; margin-top: -22px; border-radius: 2px; background: var(--line); }
.cc-resize:hover::after, .cc-resize:focus-visible::after { background: var(--accent); }
.cc-host { flex: 1; min-width: 0; display: flex; }
.canvas-toggle[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.cc { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); }
.cc.off .cc-tools, .cc.off .cc-head .cc-views { display: none; }
.cc-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.cc-title { font-size: 15px; }
.cc-views { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--hover); }
.cc-views button { height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: 600 12.5px var(--text); cursor: pointer; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-views button[hidden] { display: none; }
.cc-views button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.cc-grow { flex: 1; }
.cc-faces { display: flex; }
.cc-face { width: 26px; height: 26px; margin-left: -6px; border-radius: 50%; border: 2px solid var(--surface); color: #fff; font: 700 10.5px var(--text); display: grid; place-items: center; }
.cc-icon { width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.cc-icon:hover { background: var(--hover); color: var(--ink); }
.cc-file { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cc-file[hidden], .cc-board[hidden], .cc-add[hidden], .cc-menu[hidden], .cc-file-bar[hidden] { display: none; }
.cc-file-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.cc-file-host { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cc-file-host > .fp { flex: 1; }
.cc-note { font-size: 12px; color: var(--muted); }
.cc-chip { height: 30px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--accent); font: 600 12.5px var(--text); cursor: pointer; white-space: nowrap; }
.cc-chip:hover { border-color: var(--accent); }
.cc-chip.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.cc-chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.cc-chip[hidden] { display: none; }
.cc-board { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.cc-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px; }
.cc-filters { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--hover); flex-wrap: wrap; }
.cc-filters button { height: 26px; padding: 0 9px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font: 600 12px var(--text); cursor: pointer; }
.cc-filters button[aria-pressed="true"] { background: var(--surface); color: var(--ink); }
.cc-ai { position: relative; }
.cc-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: 280px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); display: grid; }
.cc-menu button { padding: 9px 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; font: 500 13px var(--text); cursor: pointer; }
.cc-menu button:hover { background: var(--hover); }
.cc-add { display: grid; gap: 8px; margin: 0 12px 10px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.cc-add :is(input, textarea), .cc-inline :is(input, textarea) { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); color: var(--ink); font: 13.5px var(--text); box-sizing: border-box; resize: vertical; }
.cc-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cc-msg { margin: 0 12px; min-height: 0; font-size: 12.5px; color: var(--accent); }
.cc-msg:empty { display: none; }
.cc-cards { padding: 4px 12px 16px; columns: 260px; column-gap: 12px; }
.cc-empty { margin: 24px 4px; color: var(--muted); font-size: 13.5px; column-span: all; }
.cc-card { position: relative; break-inside: avoid; display: flex; flex-direction: column; gap: 8px; margin: 0 0 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.cc-card.ai { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.cc-card.k-note { background: color-mix(in srgb, #fff4c2 55%, var(--surface)); border-color: color-mix(in srgb, #f0dc8a 70%, var(--line)); }
.cc-card-head { display: flex; align-items: center; gap: 6px; }
.cc-kind { font: 700 10.5px var(--text); letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.cc-mini { height: 24px; padding: 0 8px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: 600 11.5px var(--text); cursor: pointer; }
.cc-mini:hover { background: var(--hover); color: var(--ink); }
.cc-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.cc-name { font-size: 14.5px; }
.cc-sub { font-size: 12.5px; color: var(--muted); }
.cc-lines { margin: 0; padding-left: 18px; font-size: 13.5px; }
.cc-by, .cc-src { font-size: 11.5px; color: var(--muted); }
.cc-bar { height: 8px; border-radius: 4px; background: var(--hover); overflow: hidden; }
.cc-bar i { display: block; height: 100%; background: var(--ok); }
.cc-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.cc-task { display: flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.cc-task input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.cc-task span { flex: 1; }
.cc-task.done span { text-decoration: line-through; color: var(--muted); }
.cc-task small { color: var(--muted); font-size: 11.5px; }
.cc-ava { width: 22px; height: 22px; border-radius: 50%; color: #fff; font: 700 9px var(--text); font-style: normal; display: grid; place-items: center; flex: none; }
.cc-inline { display: flex; gap: 6px; }
.cc-inline.cc-editing { flex-direction: column; }
.cc-option { position: relative; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 500 13px var(--text); cursor: pointer; overflow: hidden; text-align: left; }
.cc-option span { flex: 1; position: relative; z-index: 1; }
.cc-option b { position: relative; z-index: 1; }
.cc-option i { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, #6b3fd4 16%, transparent); }
.cc-option.mine { border: 2px solid var(--accent); }
.cc-when { font-size: 18px; font-weight: 700; }
.cc-filebtn { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: var(--bg); color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.cc-filebtn span:last-child { display: flex; flex-direction: column; min-width: 0; }
.cc-filebtn b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-filebtn small { font-size: 12px; color: var(--accent); }
.cc-quote { margin: 0; padding-left: 12px; border-left: 3px solid var(--accent); font-size: 14px; font-style: italic; }
.cc-code { border-radius: 10px; overflow: hidden; background: #1b2236; color: #e7ebf5; }
.cc-code-head { display: flex; align-items: center; padding: 4px 6px 4px 10px; background: #141a2c; font-size: 12px; }
.cc-code-head b { flex: 1; color: #c9d1e3; }
.cc-code-head .cc-mini { color: #c9d1e3; }
.cc-code pre { margin: 0; padding: 10px 12px; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; max-height: 280px; overflow: auto; }
.cc-link { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
.cc-link small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cc-looking { align-self: flex-start; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 600 11px var(--text); }
.cc.compact .cc-cards { columns: 1; }
.cc.compact .cc-tools .cc-filters { display: none; }
/* Smart cards in messages */
.smart-file { display: flex; align-items: center; gap: 10px; margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); text-align: left; font: inherit; cursor: pointer; min-width: 220px; }
.smart-file:hover { border-color: var(--accent); }
.smart-file span:last-child { display: flex; flex-direction: column; min-width: 0; }
.smart-file b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smart-file small { font-size: 12px; color: var(--accent); }
.smart-board { margin-top: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--accent); border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 600 12.5px var(--text); cursor: pointer; }
.smart-date { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.smart-date span { padding: 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.msg-code { margin: 6px 0; border-radius: 10px; overflow: hidden; background: #1b2236; color: #e7ebf5; }
.msg-code-head { padding: 5px 10px; background: #141a2c; font-size: 12px; color: #c9d1e3; }
.msg-code pre { margin: 0; padding: 10px 12px; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 1100px) {
  .conv-body[data-canvas="side"] .conv-chat { display: none; }
  .conv-body[data-canvas="side"] .conv-canvas { flex: 1; width: auto !important; border-left: 0; }
  .conv-body[data-canvas="side"] .cc-resize { display: none; }
}
.ms-terms-row { margin-top: 12px; }

/* ======================================================================= Pop-outs: one frame for every window (dock.js) */
body .pop-row-msg { right: 132px; bottom: 0; gap: 12px; }
body .pop-row .dock-win, body .pop-row .dock-pair {
  height: min(560px, calc(calc(100 * var(--vh, 1vh)) - 72px)) !important; border: 1px solid var(--line); border-bottom: 0; border-radius: 14px 14px 0 0;
  background: var(--surface); color: var(--ink); box-shadow: 0 12px 32px -14px rgba(23, 32, 54, 0.35); opacity: 1; transform: none; filter: none; }
body .pop-row .dock-win { width: 360px; }
body .pop-row .dock-win.bot { width: 400px; }
body .pop-row .dock-win.mail { width: 420px; }
body .pop-row .dock-pair .dock-win { height: 100% !important; border: 0; border-radius: 0; box-shadow: none; }
body .pop-row .dock-pair .dock-win.grp { width: 360px; }
body .pop-row .dock-win .dw-head, body .pop-row .dock-win.bot .dw-head, body .pop-row .dock-win.relay-dock .dw-head,
body .pop-row .dock-win.mail .dw-head, body .pop-row .dock-win.cal .dw-head, body .pop-row .dock-win.grp .dw-head {
  min-height: 52px; padding: 8px 6px 8px 12px; gap: 8px; background: var(--surface) !important; color: var(--ink) !important;
  border-bottom: 1px solid var(--line) !important; border-radius: 0; }
body .pop-row .dw-head .dw-grab { display: none; }
body .pop-row .dw-av { width: 30px; height: 30px; border-radius: 9px; background: var(--accent) !important; color: #fff !important; font: 700 11.5px var(--text); }
body .pop-row .dw-av svg { width: 16px; height: 16px; }
body .pop-row .dock-win.msg .dw-av { background: #6b3fd4 !important; }
body .pop-row .dock-win.mail .dw-av { background: #172036 !important; }
body .pop-row .dock-win.cal .dw-av { background: #1e7a45 !important; }
body .pop-row .dw-titles b { font-size: 13.5px; }
body .pop-row .dw-titles small { font-size: 11.5px; color: var(--muted) !important; opacity: 1; }
body .pop-row .dw-btn { width: 30px; height: 30px; border-radius: 8px; color: var(--muted) !important; }
body .pop-row .dw-btn:hover { background: var(--hover) !important; color: var(--ink) !important; }
body .pop-row .dw-btn[aria-pressed="true"] { background: var(--accent-soft) !important; color: var(--accent) !important; }
body .pop-row .dw-btn svg { width: 17px; height: 17px; }
body .pop-row .dw-teams-pill { height: 28px; }
body .pop-row .dw-side-btn { width: auto; padding: 0 8px; gap: 4px; border-radius: 8px; font: 600 12px var(--text); }
body .pop-row .dw-side-btn span { display: inline; }
/* Stage Cards and layered mode are retired: nothing overlaps, nothing goes see-through. */
.ax-stage, .ax-layer-bar { display: none !important; }
body.dock-layered .layer-back { opacity: 1 !important; transform: none !important; filter: none !important; }
/* The canvas inside a chat pop-out */
body .pop-row .dock-win.msg.with-canvas { width: calc(360px + 440px); }
body .pop-row .dock-pair.has-canvas .dock-win.grp { width: calc(360px + 440px); }
.dock-win.with-canvas { display: grid !important; grid-template-columns: minmax(0, 1fr) 440px; grid-template-rows: auto minmax(0, 1fr) auto auto auto; }
.dock-win.with-canvas > :not(.dw-canvas) { grid-column: 1; }
.dock-win.with-canvas > .dw-list { min-height: 0; }
.dw-canvas { grid-column: 2; grid-row: 1 / -1; min-height: 0; display: flex; border-left: 1px solid var(--line); }
.dw-canvas > .cc { border-top-right-radius: 14px; }
.dw-file { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-align: left; font: inherit; cursor: pointer; }
.dw-file span:last-child { display: flex; flex-direction: column; min-width: 0; }
.dw-file b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-file small { font-size: 11px; color: var(--accent); }
button.dw-media { padding: 0; border: 0; background: none; cursor: pointer; }
@media (max-width: 1100px) {
  body .pop-row .dock-win.msg.with-canvas, body .pop-row .dock-pair.has-canvas .dock-win.grp { width: min(760px, calc(100vw - 24px)); }
  .dock-win.with-canvas { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
}
@media (max-width: 700px) {
  .dock-win.with-canvas { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto auto; }
  .dock-win.with-canvas > .dw-canvas { position: fixed; inset: 0; z-index: 200; grid-column: 1; border: 0; background: var(--surface); }
}
body .pop-row .dw-head { overflow: hidden; }
body .pop-row .dw-titles { flex: 1; min-width: 56px; overflow: hidden; }
body .pop-row .dw-titles b, body .pop-row .dw-titles small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body .pop-row .dw-teams-pill { width: 30px; padding: 0; justify-content: center; border-radius: 8px; flex: none; }
body .pop-row .dw-teams-pill span { display: none; }
body .pop-row .dw-head > :not(.dw-titles):not(.dw-av) { flex: none; }
body .pop-row .dock-win.msg:not(.attached) { width: 380px; }
body .pop-row .dock-win.msg.with-canvas { width: calc(380px + 440px); }
body .pop-row .dock-win .dw-head { gap: 2px; padding-right: 4px; }
body .pop-row .dock-win .dw-head .dw-av { margin-right: 6px; }
body .pop-row .dock-win .dw-head .dw-btn, body .pop-row .dw-teams-pill { width: 27px; height: 27px; }

/* Gangspace: no phone status bar; the bell lives in the header and opens a dropdown */
.gs-grow { flex: 1; }
.gs-bell { position: relative; width: auto; min-width: 36px; padding: 0 8px; gap: 4px; display: inline-flex; align-items: center; border-radius: 10px; }
.gs-bell[hidden] { display: none; }
.gs-bell svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gs-bell b { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--hover); color: var(--muted); font: 700 11px/18px var(--text); }
.gs-bell.has-unread b { background: var(--accent); color: var(--accent-ink); }
.gs-bell .gs-sb-dot { position: absolute; top: 5px; right: 5px; }
.gs-bell.gs-ping { animation: gs-ping 0.7s ease; }
main .gs-notif-shade { left: auto; right: 16px; top: 56px; width: min(380px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 14px; background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
.gs-empty-actions { justify-content: center; margin-top: 18px; }
@media (max-width: 720px) { main .gs-notif-shade { right: 8px; left: 8px; width: auto; top: 52px; } }

/* ======================================================================= Cookie consent and permission prompts (permissions.js) */
.ax-consent {
  position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 12000;
  max-width: 720px; margin: 0 auto; padding: 14px 16px;
  border: 1px solid var(--line, #d2d2d7); border-radius: 16px;
  background: var(--surface, #fff); color: var(--ink, #1d1d1f);
  box-shadow: 0 18px 50px rgba(16,22,42,.18);
  display: grid; gap: 10px; font: 400 13.5px/1.45 var(--text, system-ui);
}
.ax-consent[hidden] { display: none !important; }
.ax-consent h2 { margin: 0; font: 700 15px/1.2 var(--display, system-ui); }
.ax-consent p { margin: 0; color: var(--muted, #6e6e73); }
.ax-consent a { color: var(--accent, #0071E3); font-weight: 600; }
.ax-consent-opts { display: grid; gap: 6px; }
.ax-consent-opts label {
  display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start;
  padding: 8px 10px; border: 1px solid var(--line, #e5e5ea); border-radius: 12px; background: var(--bg, #f5f5f7);
}
.ax-consent-opts label small { display: block; color: var(--muted, #6e6e73); font-weight: 400; }
.ax-consent-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.ax-consent-actions button {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line, #d2d2d7);
  background: var(--bg, #f5f5f7); color: inherit; font: 600 13px var(--text, system-ui); cursor: pointer;
}
.ax-consent-actions .primary {
  background: var(--accent, #0071E3); border-color: var(--accent, #0071E3); color: #fff;
}
.ax-perm-dialog::backdrop { background: rgba(16,22,42,.42); }
.ax-perm-dialog {
  border: 1px solid var(--line, #d2d2d7); border-radius: 16px; padding: 18px;
  max-width: min(420px, calc(100vw - 24px)); background: var(--surface, #fff); color: var(--ink, #1d1d1f);
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.ax-perm-dialog h2 { margin: 0 0 8px; font: 700 17px/1.2 var(--display, system-ui); }
.ax-perm-dialog p { margin: 0 0 8px; color: var(--muted, #6e6e73); font: 400 13.5px/1.45 var(--text, system-ui); }
.ax-perm-dialog .ax-consent-actions { margin-top: 12px; }
@media (max-width: 700px) {
  .ax-consent { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom, 0px)); }
}
    

/* Messages on a phone: an open chat covers the page header, so its back button, title and Canvas show,
   and the floating quick-actions button steps aside so it doesn't cover Send. */
@media (max-width: 760px) {
  body.reading .msgr-main { z-index: 85; }
  body.reading .omni-fab { display: none; }
  body.reading .conv-head { padding: 8px 10px; gap: 6px; }
  body.reading .conv-head .conv-title { flex: 1; min-width: 0; }
  body.reading .conv-head .conv-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
  body.reading .conv-head .conv-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.reading .conv-head .tabs { order: 10; flex-basis: 100%; }
  body.reading .conv-head .tabs button { padding: 6px 8px; font-size: 13px; }
  body.reading .conv-head #head-share, body.reading .conv-head #head-popout { display: none; }
  .conv-body[data-canvas] .conv-canvas { width: auto !important; }
  .conv-body[data-canvas="side"] .conv-chat { display: none; }
  .conv-body[data-canvas="side"] .conv-canvas { flex: 1; border-left: 0; }
  .cc-tools { gap: 4px; }
  .cc-filters { display: none; }
}
.gs-thumb-img { position: relative; overflow: hidden; }
.gs-thumb-pic { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }
.gs-thumb-img span { position: relative; z-index: 1; }

/* ======================================================================== AXORK Chat (axchat.js) */
.model-menu.axc-sheet { max-height: none; }
.axc-sheet { padding: 6px; width: min(400px, calc(calc(100 * var(--vw, 1vw)) - 24px)); }
.axc-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px 6px; font-size: 13px; color: var(--muted); }
.axc-head b { color: var(--ink); font-size: 13.5px; letter-spacing: 0.01em; }
.axc-head > span { margin-left: auto; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--hover); }
.axc-back { display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); }
.axc-back:hover { background: var(--hover); }
.axc-back svg, .axc-more svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.menu > button.axc-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 20px; align-items: start; gap: 10px;
  padding: 8px 12px; border-radius: 10px;
}
.axc-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.axc-name { font-weight: 600; font-size: 14.5px; }
.axc-line { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.axc-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.axc-chip {
  display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 1px 8px;
  font-size: 11.5px; font-weight: 600; background: var(--hover); color: var(--muted); white-space: nowrap;
}
.axc-chip.extra { background: rgba(217, 119, 6, 0.13); color: #b45309; }
.axc-chip.plan { background: var(--accent-soft); color: var(--accent); }
.axc-chip.rec { background: var(--accent-soft); color: var(--accent); }
.axc-chip.note { background: transparent; border: 1px solid var(--line); font-weight: 500; }
.axc-tick { color: var(--accent); padding-top: 2px; }
.axc-tick svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.2; }
.axc-row.locked .axc-name, .axc-row.locked .axc-line { opacity: 0.6; }
.axc-row.locked .axc-tick { color: var(--faint); }
.axc-row.axc-auto { margin-bottom: 2px; }
.axc-section { margin: 10px 12px 4px; font-size: 12px; font-weight: 600; color: var(--faint); text-transform: lowercase; }
.axc-effort { margin: 6px 4px 2px; padding: 10px 8px 8px; border-top: 1px solid var(--line); }
.axc-effort-head { display: flex; align-items: baseline; gap: 8px; margin: 0 4px 8px; font-size: 13.5px; }
.axc-effort-head span { font-size: 12px; color: var(--muted); }
.axc-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; padding: 3px; border-radius: 11px; background: var(--hover); }
.axc-seg button {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  border: 0; border-radius: 8px; padding: 6px 4px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600;
}
.axc-seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.axc-seg button.locked { opacity: 0.55; }
.axc-seg svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2; }
.axc-dot { position: absolute; top: 5px; right: 7px; width: 6px; height: 6px; border-radius: 50%; background: #d97706; }
.menu > button.axc-more {
  display: flex; justify-content: space-between; margin-top: 4px; padding: 10px 12px; border-top: 1px solid var(--line);
  border-radius: 0 0 10px 10px; font-weight: 600; font-size: 14px;
}
.axc-foot { display: block; margin: 2px 8px 6px; padding: 8px 6px 2px; font-size: 12px; color: var(--muted); text-decoration: none; }
.axc-foot:hover { color: var(--accent); }

/* the usage meter under the message box */
.axc-meter { margin: 6px auto 0; width: 100%; max-width: var(--composer-w, 760px); padding: 0 6px; }
.axc-meter-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: transparent; padding: 2px 4px;
  color: var(--muted); font-size: 12.5px; text-align: left; cursor: pointer; border-radius: 8px;
}
.axc-meter-btn:hover { background: var(--hover); }
.axc-meter-track { position: relative; flex: 0 0 120px; height: 5px; border-radius: 999px; background: var(--line); overflow: hidden; }
.axc-meter-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--accent); transition: width 0.3s ease; }
.axc-meter-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.axc-meter-text b { font-weight: 600; color: var(--ink); }
.axc-meter.warn .axc-meter-fill { background: #d97706; }
.axc-meter.warn .axc-meter-text b { color: #b45309; }
.axc-meter.full .axc-meter-fill { background: var(--danger); }
.axc-meter.full .axc-meter-text b { color: var(--danger); }

/* the usage page */
dialog.axc-usage {
  width: min(520px, calc(calc(100 * var(--vw, 1vw)) - 24px)); max-height: calc(calc(100 * var(--vh, 1vh)) - 40px);
  border: 0; border-radius: 20px; padding: 22px 24px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
}
dialog.axc-usage::backdrop { background: rgba(8, 12, 28, 0.5); }
.axc-u-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.axc-u-head h2 { margin: 0; font-size: 19px; }
.axc-u-head .icon-btn { margin-left: auto; }
.axc-u-row { margin: 0 0 14px; }
.axc-u-row .axc-meter-track { display: block; flex: none; height: 7px; margin: 6px 0 4px; }
.axc-u-top { display: flex; justify-content: space-between; font-size: 14px; }
.axc-u-top span, .axc-u-row small, .axc-u-note { color: var(--muted); font-size: 12.5px; }
dialog.axc-usage h3 { margin: 18px 0 8px; font-size: 14px; }
.axc-u-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.axc-u-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.axc-u-table td { padding: 7px 6px; border-bottom: 1px solid var(--line); }
.axc-u-table td:not(:first-child), .axc-u-table th:not(:first-child) { text-align: right; }
.axc-u-empty { color: var(--muted); text-align: center !important; }
.axc-u-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.axc-u-actions a { text-decoration: none; }

/* "This looks like a new topic" */
.axc-topic {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: var(--composer-w, 760px); margin: 0 auto 8px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow);
  font-size: 14px;
}
.axc-topic[hidden] { display: none; }
.axc-topic-ico { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.axc-topic-ico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }
.axc-topic-text { flex: 1; min-width: 0; }
.axc-topic-text small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.axc-topic .ghost, .axc-topic .primary { flex: none; }

/* answer label and versions */
.model-label.axc-label { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.axc-ver { display: inline-flex; align-items: center; gap: 2px; margin-right: 4px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.axc-ver .act { padding: 4px; min-width: 0; }
.axc-ver .act:disabled { opacity: 0.35; }
.axc-ver svg { width: 15px; height: 15px; }

@media (max-width: 640px) {
  .axc-meter-track { flex-basis: 70px; }
  .axc-topic { flex-wrap: wrap; }
  .axc-topic-text { flex-basis: calc(100% - 44px); }
}

/* printable chat (chat-print.html) */
body.cp-page { background: var(--bg); color: var(--ink); margin: 0; }
.cp-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--muted); }
.cp-bar .primary { margin-left: auto; }
.cp-bar a { text-decoration: none; }
.cp-doc { max-width: 760px; margin: 0 auto; padding: 32px 20px 60px; }
.cp-brand { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.cp-head h1 { margin: 6px 0 4px; font-size: 26px; line-height: 1.25; }
.cp-meta { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.cp-list { list-style: none; margin: 0; padding: 0; }
.cp-msg { padding: 14px 0; border-top: 1px solid var(--line); break-inside: avoid-page; }
.cp-who { margin: 0 0 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.cp-user .cp-body { white-space: pre-wrap; font-weight: 500; }
.cp-files { margin: 6px 0 0; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.cp-body pre { white-space: pre-wrap; overflow-wrap: anywhere; }
@media print {
  .cp-bar { display: none; }
  body.cp-page { background: #fff; color: #000; }
  .cp-doc { padding: 0; max-width: none; }
  .cp-body pre, .cp-body code { background: #f4f4f5 !important; color: #000 !important; }
}

/* chat title menu and project settings */
.chat-title { cursor: pointer; border-radius: 8px; padding: 2px 6px; }
.chat-title:hover { background: var(--hover); }
dialog.axc-project { width: min(560px, calc(calc(100 * var(--vw, 1vw)) - 24px)); padding: 24px; }
dialog.axc-project h2 { margin: 0 0 4px; font-size: 19px; }
.axc-p-lab { display: block; margin: 14px 0 6px; font-weight: 600; font-size: 13.5px; }
.axc-p-lab small { font-weight: 400; color: var(--muted); }
dialog.axc-project textarea { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; resize: vertical; }
.axc-p-files { list-style: none; margin: 0; padding: 4px; max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.axc-p-files label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: 13.5px; cursor: pointer; }
.axc-p-files label:hover { background: var(--hover); }
.axc-p-files label span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.axc-p-files label small { color: var(--muted); }
.axc-p-files li.axc-u-note { padding: 10px; }
.sheet-days { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 14px; }
.sheet-days[hidden] { display: none; }
.sheet-days select { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: var(--surface); color: var(--ink); font: inherit; }

/* AXORK Chat in the chatbot pop-outs */
.dw-pickm {
  display: inline-flex; align-items: center; gap: 4px; max-width: 170px; border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 8px 3px 10px; background: var(--surface); color: var(--ink); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.dw-pickm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-pickm svg { width: 14px; height: 14px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; }
.dw-pickm:hover { background: var(--hover); }
.dw-popmenu { position: fixed; z-index: 400; overflow-y: auto; }
.dw-popmenu.dw-sheet { width: min(360px, calc(calc(100 * var(--vw, 1vw)) - 16px)); }
.dw-popmenu > button { font-size: 14px; }
.dw-recent { width: 280px; }
.dw-recent > button span { display: flex; flex-direction: column; min-width: 0; }
.dw-recent > button b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dw-recent > button small { color: var(--muted); font-size: 12px; }
.dw-recent > button.dw-recent-new b { font-weight: 700; }
.dw-recent-all { display: block; padding: 8px 10px 4px; font-size: 13px; color: var(--accent); text-decoration: none; }
.dock-win .dw-meter { margin: 0; padding: 0 10px 8px; max-width: none; }
.dock-win .dw-meter .axc-meter-track { flex-basis: 64px; }
.dock-win .dw-meter .axc-meter-btn { font-size: 11.5px; }
.dock-win .dw-topic { margin: 0 8px 6px; width: auto; padding: 8px 10px; flex-wrap: wrap; font-size: 13px; box-shadow: none; }
.dock-win .dw-topic .axc-topic-text { flex-basis: calc(100% - 42px); }
.dock-win .dw-who.axc-label { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.dock-win .dw-who .axc-chip { font-size: 10.5px; padding: 0 6px; }
body .pop-row .dock-win.bot.with-canvas { width: calc(400px + 440px); }
.dw-botcanvas { position: relative; flex-direction: column; background: var(--bg); border-top-right-radius: 14px; overflow: hidden; }
.dbc-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 8px 14px; border-bottom: 1px solid var(--line); }
.dbc-list { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; }
.dbc-empty { margin: 14px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.dbc-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-radius: 10px; background: transparent; padding: 8px; text-align: left; color: var(--ink); }
.dbc-item:hover { background: var(--hover); }
.dbc-item span:last-child { display: flex; flex-direction: column; min-width: 0; }
.dbc-item b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbc-item small { color: var(--muted); font-size: 12px; }
.dbc-ico { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
.dbc-ico svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.dbc-view { position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--surface); }
.dbc-view[hidden] { display: none; }
.dbc-view-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.dbc-view-head b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.dbc-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px; font-size: 14px; line-height: 1.55; }
.dbc-body pre { white-space: pre-wrap; font-size: 12.5px; }
.dw-model[hidden] { display: none !important; }
@media (max-width: 640px) {
  .model-menu.axc-sheet, .model-menu.axc-sheet.down { position: fixed; left: 8px; right: 8px; top: 64px; bottom: auto; width: auto; }
}

/* The + tucks into a dot at the edge until you come near it; drag it along either edge */
.omni-fab { transition: bottom .15s ease; }
.omni-fab.left { align-items: flex-start; padding: 0 0 0 12px; }
.omni-fab:not(.left) { padding: 0 12px 0 0; }
.omni-core { touch-action: none; transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease; }
.omni-fab.tucked:not(.near):not(.open) .omni-core { transform: translateX(30px) scale(0.42); opacity: 0.45; box-shadow: none; }
.omni-fab.tucked.left:not(.near):not(.open) .omni-core { transform: translateX(-30px) scale(0.42); }
.omni-fab.dragging .omni-core { cursor: grabbing; transform: scale(1.08); opacity: 0.9; }
.omni-fab.dragging { transition: none; }
