:root {
  color-scheme: dark light;
  --bg: #070a10;
  --bg-soft: #0d121c;
  --bg-card: #111827;
  --bg-elev: #172033;
  --border: #253044;
  --border-strong: #38455c;
  --text: #e8edf7;
  --text-muted: #8e99ad;
  --accent: #4f7cff;
  --accent-strong: #3d67e6;
  --accent-soft: rgba(79, 124, 255, 0.16);
  --success: #4ad295;
  --danger: #ff6b7a;
  --warn: #f0b341;
  --thinking: #b591ff;
  --tool: #5fbcff;
  --code-bg: #0b0f17;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 6px 18px rgba(0, 0, 0, 0.3);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
}

/* W1: explicit dark token block so a JS toggle can flip between
   `data-theme="dark"` and `data-theme="light"` without relying on
   the implicit `:root` defaults. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070a10;
  --bg-soft: #0d121c;
  --bg-card: #111827;
  --bg-elev: #172033;
  --border: #253044;
  --border-strong: #38455c;
  --text: #e8edf7;
  --text-muted: #8e99ad;
  --accent: #4f7cff;
  --accent-strong: #3d67e6;
  --accent-soft: rgba(79, 124, 255, 0.16);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 6px 18px rgba(0, 0, 0, 0.3);
}

/* W1: light theme. Tracks the same semantic tokens so any component
   styled with `var(--*)` automatically picks up the right palette. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-soft: #ffffff;
  --bg-card: #ffffff;
  --bg-elev: #f1f4fb;
  --border: #d8dee9;
  --border-strong: #b6bfd0;
  --text: #15213b;
  --text-muted: #5b6a85;
  --accent: #3760e6;
  --accent-strong: #2848c7;
  --accent-soft: rgba(55, 96, 230, 0.12);
  --success: #1f9c63;
  --danger: #d6334d;
  --warn: #d68a14;
  --thinking: #6b3ce0;
  --tool: #1f78d6;
  --code-bg: #eef1f7;
  --shadow: 0 1px 2px rgba(15, 32, 64, 0.06), 0 6px 18px rgba(15, 32, 64, 0.08);
}

* {
  box-sizing: border-box;
}

/* Ensure the standard HTML `hidden` attribute always wins over layout rules
   like `display: flex|grid` defined on the element's class. */
[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

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

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  transition: background 120ms ease, border-color 120ms ease;
}
button:hover:not(:disabled) {
  background: var(--bg-card);
  border-color: var(--border-strong);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent-strong);
  color: white;
}
button.primary:hover:not(:disabled) {
  background: var(--accent-strong);
}
button.danger {
  border-color: rgba(255, 107, 122, 0.4);
  color: var(--danger);
}
button.ghost {
  background: transparent;
}

input, textarea, select {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  width: 100%;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea { resize: vertical; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1; }

.language-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.03);
}
.language-option {
  border: 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
}
.language-option[aria-pressed="true"] {
  background: var(--bg-elev);
  color: var(--text);
}
.language-option:hover:not(:disabled) {
  border-color: transparent;
  background: var(--bg-card);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge.success { color: var(--success); border-color: rgba(74, 210, 149, 0.4); }
.badge.danger { color: var(--danger); border-color: rgba(255, 107, 122, 0.4); }
.badge.warn { color: var(--warn); border-color: rgba(240, 179, 65, 0.4); }
.badge.accent { color: var(--accent); border-color: rgba(108, 140, 255, 0.4); }

.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-muted);
  display: inline-block;
}
.dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(74, 210, 149, 0.18); }
.dot.offline { background: var(--text-muted); }
.dot.warn { background: var(--warn); }

.managed-model-card .row {
  margin-bottom: 6px;
}
.managed-model-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.managed-model-pill {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}
.managed-model-label {
  color: var(--text-muted);
  font-size: 12px;
}
.managed-model-pill code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.workspace-card input {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.workspace-card #workspace-status {
  overflow-wrap: anywhere;
}

.workspace-actions {
  flex-wrap: wrap;
}

/* ---------- top nav ---------- */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}

.topbar .me {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  font-weight: 600;
  letter-spacing: 0.2px;
  text-decoration: none;
}

.topbar .brand:hover { text-decoration: none; }

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: block;
  object-fit: cover;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.10);
}

.topbar .nav-links {
  display: flex;
  gap: 4px;
  margin-left: 8px;
}
.topbar .nav-links a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--text-muted);
}
.topbar .nav-links a.active {
  color: var(--text);
  background: var(--bg-elev);
}
.topbar .nav-links a:hover { text-decoration: none; color: var(--text); background: var(--bg-elev); }

.topbar .me {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-muted);
}

/* ---------- centered auth pages ---------- */

.auth-body {
  background:
    radial-gradient(ellipse at 18% -10%, rgba(108, 140, 255, 0.18), transparent 55%),
    radial-gradient(ellipse at 90% 10%, rgba(181, 145, 255, 0.16), transparent 55%),
    var(--bg);
  min-height: 100vh;
}
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-screen.split {
  align-items: stretch;
  padding: 0;
}
.auth-brand-panel {
  flex: 1.05;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 36px 48px;
  background:
    linear-gradient(160deg, rgba(108, 140, 255, 0.18), rgba(181, 145, 255, 0.10) 70%, transparent),
    var(--bg);
  border-right: 1px solid var(--border);
}
.auth-brand-copy {
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-brand-copy h2 {
  font-size: 28px;
  line-height: 1.2;
  margin: 0;
  letter-spacing: -0.3px;
}
.auth-brand-copy p {
  color: var(--text-muted);
  margin: 0;
  font-size: 15px;
}
.auth-brand-bullets {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-muted);
  font-size: 14px;
}
.auth-brand-bullets li {
  position: relative;
  padding-left: 20px;
}
.auth-brand-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 140, 255, 0.18);
}
.auth-main {
  flex: 0.95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 24px;
}
.auth-card {
  width: 100%;
  max-width: 380px;
}
.auth-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.auth-card h1 { margin: 0 0 4px; font-size: 22px; }
.auth-card p.lead { color: var(--text-muted); margin: 0 0 16px; }
.auth-mode-toggle { margin-bottom: 14px; }
.auth-footnote { margin: 16px 0 0; }
.oauth-panel {
  margin: 12px 0 14px;
}
.oauth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 10px;
}
.oauth-divider::before,
.oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.oauth-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.oauth-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
  font-weight: 600;
}
.oauth-button:hover {
  text-decoration: none;
  border-color: var(--border-strong);
  background: var(--bg-elev);
}

@media (max-width: 880px) {
  .auth-screen.split { flex-direction: column; }
  .auth-brand-panel { border-right: none; border-bottom: 1px solid var(--border); padding: 28px 24px; }
  .auth-brand-copy h2 { font-size: 22px; }
  .auth-main { padding: 24px 18px; }
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
}
.segmented button.active {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow);
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; color: var(--text-muted); }

.error-banner {
  border: 1px solid rgba(255, 107, 122, 0.5);
  background: rgba(255, 107, 122, 0.1);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.notice-banner {
  border: 1px solid rgba(108, 140, 255, 0.5);
  background: rgba(108, 140, 255, 0.1);
  color: var(--accent);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}

.success-banner {
  border: 1px solid rgba(74, 210, 149, 0.45);
  background: rgba(74, 210, 149, 0.1);
  color: var(--success);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
}

/* ---------- Codex-style light auth pages ---------- */

.auth-body {
  --bg: #ffffff;
  --bg-soft: #f7f7f4;
  --bg-card: #ffffff;
  --bg-elev: #f1f1ee;
  --border: #e8e8e3;
  --border-strong: #d7d7cf;
  --text: #1f1f1d;
  --text-muted: #85847c;
  --accent: #222220;
  --accent-strong: #111110;
  --accent-soft: #f0f0eb;
  --success: #1d8f5d;
  --danger: #c33b4a;
  --code-bg: #f6f6f2;
  --shadow: 0 18px 48px rgba(30, 30, 20, 0.10), 0 2px 8px rgba(30, 30, 20, 0.06);
  background:
    radial-gradient(circle at 50% -20%, rgba(32, 32, 28, 0.05), transparent 34%),
    #fff;
  color: var(--text);
}

.auth-body .auth-screen.split {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(360px, 0.95fr);
}

.auth-body .auth-brand-panel {
  padding: 28px clamp(26px, 5vw, 58px);
  background: #fff;
  border-right: 1px solid var(--border);
}

.auth-body .landing-brand {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.auth-body .brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #242421;
  color: #fff;
  box-shadow: none;
}

.auth-body .auth-brand-copy {
  max-width: 560px;
  margin-bottom: 6vh;
}

.auth-body .auth-brand-copy h2 {
  max-width: 640px;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.05;
  letter-spacing: -1.9px;
  font-weight: 650;
}

.auth-body .auth-brand-copy p {
  max-width: 520px;
  color: #68675f;
  font-size: 16px;
  line-height: 1.7;
}

.auth-body .auth-brand-bullets {
  color: #77766f;
  gap: 8px;
}

.auth-body .auth-brand-bullets li::before {
  background: #242421;
  box-shadow: 0 0 0 4px rgba(36, 36, 33, 0.08);
}

.auth-body .auth-main {
  padding: 48px clamp(24px, 5vw, 80px);
  background:
    radial-gradient(circle at 55% 24%, rgba(36, 36, 33, 0.05), transparent 30%),
    #fbfbf8;
}

.auth-body .auth-card {
  max-width: 410px;
  border-color: #e9e9e3;
  border-radius: 22px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.auth-body .auth-card h1 {
  color: var(--text);
  font-size: 22px;
  letter-spacing: -0.3px;
}

.auth-body .auth-card p.lead {
  color: var(--text-muted);
}

.auth-body .language-switcher {
  background: var(--bg-soft);
  border-color: var(--border);
}

.auth-body .language-option[aria-pressed="true"] {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.auth-body .segmented {
  border-color: #e7e7df;
  border-radius: 14px;
  background: #f6f6f2;
}

.auth-body .segmented button {
  color: #77766f;
  border-radius: 11px;
}

.auth-body .segmented button.active {
  background: #fff;
  color: #242421;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.08);
}

.auth-body .oauth-divider::before,
.auth-body .oauth-divider::after {
  background: #e7e7df;
}

.auth-body .oauth-button {
  background: #fff;
  border-color: #e7e7df;
  color: #242421;
}

.auth-body .oauth-button:hover {
  background: #f6f6f2;
}

.auth-body input,
.auth-body textarea,
.auth-body select {
  border-color: #e6e6df;
  background: #fbfbf8;
  color: var(--text);
  border-radius: 12px;
}

.auth-body input:focus,
.auth-body textarea:focus,
.auth-body select:focus {
  border-color: #c9c9bf;
  box-shadow: 0 0 0 3px rgba(36, 36, 33, 0.08);
}

.auth-body button.primary {
  background: #242421;
  border-color: #242421;
  color: #fff;
  border-radius: 13px;
}

.auth-body button.primary:hover:not(:disabled) {
  background: #111110;
}

.auth-body .auth-footnote {
  color: #85847c;
  line-height: 1.55;
}

.auth-body .notice-banner {
  border-color: #e1e1da;
  background: #fbfbf8;
  color: #5d5c55;
}

.auth-body .error-banner {
  background: rgba(195, 59, 74, 0.08);
  border-color: rgba(195, 59, 74, 0.26);
}

@media (max-width: 880px) {
  .auth-body .auth-screen.split {
    display: flex;
    flex-direction: column;
  }
  .auth-body .auth-brand-panel {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 24px;
  }
  .auth-body .auth-brand-copy {
    margin-top: 44px;
    margin-bottom: 12px;
  }
  .auth-body .auth-brand-copy h2 {
    font-size: 32px;
    letter-spacing: -1px;
  }
  .auth-body .auth-main {
    padding: 28px 18px;
  }
}

/* ---------- Modern auth refresh ---------- */

.auth-body {
  --auth-ink: #121314;
  --auth-muted: #667085;
  --auth-line: rgba(18, 19, 20, 0.09);
  --auth-panel: rgba(255, 255, 255, 0.72);
  --auth-glow-blue: rgba(76, 111, 255, 0.18);
  --auth-glow-violet: rgba(155, 91, 255, 0.16);
  background:
    radial-gradient(circle at 18% 14%, rgba(93, 131, 255, 0.18), transparent 30%),
    radial-gradient(circle at 86% 18%, rgba(179, 113, 255, 0.16), transparent 28%),
    linear-gradient(135deg, #fbfbff 0%, #f7f2ea 48%, #eef5ff 100%);
}

.auth-body .auth-modern {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.auth-body .auth-modern::before,
.auth-body .auth-modern::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 999px;
  filter: blur(18px);
}

.auth-body .auth-modern::before {
  width: 360px;
  height: 360px;
  left: -120px;
  top: 12%;
  background: var(--auth-glow-blue);
}

.auth-body .auth-modern::after {
  width: 420px;
  height: 420px;
  right: -140px;
  bottom: -80px;
  background: var(--auth-glow-violet);
}

.auth-body .auth-modern .auth-brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  min-height: 100vh;
  border-right: 0;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.14)),
    transparent;
}

.auth-body .auth-modern .auth-brand-copy {
  margin: 0;
  max-width: 620px;
}

.auth-body .auth-modern .auth-brand-copy h2 {
  background: linear-gradient(120deg, #15171a, #31437c 54%, #7a4cff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-body .auth-modern .auth-brand-copy p {
  font-size: 17px;
  color: var(--auth-muted);
}

.auth-body .auth-modern .auth-brand-bullets {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 18px;
}

.auth-body .auth-modern .auth-brand-bullets li {
  width: fit-content;
  padding: 9px 13px 9px 34px;
  border: 1px solid var(--auth-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: #4d5665;
  backdrop-filter: blur(18px);
}

.auth-body .auth-modern .auth-brand-bullets li::before {
  left: 14px;
  top: 15px;
  width: 7px;
  height: 7px;
  background: #5c7cff;
  box-shadow: 0 0 0 4px rgba(92, 124, 255, 0.14);
}

.auth-visual-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 520px;
}

.auth-device-card,
.auth-mini-card {
  border: 1px solid var(--auth-line);
  background: rgba(255, 255, 255, 0.64);
  box-shadow: 0 20px 60px rgba(57, 72, 103, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(24px);
}

.auth-device-card {
  border-radius: 28px;
  padding: 18px;
}

.auth-device-title {
  margin-top: 22px;
  font-size: 25px;
  font-weight: 720;
  letter-spacing: -0.7px;
  color: var(--auth-ink);
}

.auth-device-subtitle {
  margin-top: 5px;
  color: var(--auth-muted);
  line-height: 1.55;
}

.auth-device-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.auth-mini-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: 22px;
  padding: 15px;
}

.auth-mini-card strong {
  color: var(--auth-ink);
}

.auth-mini-card span:last-child {
  color: var(--auth-muted);
  font-size: 12px;
}

.auth-mini-icon {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(92, 124, 255, 0.1);
  color: #4259d4;
  font-size: 11px;
  font-weight: 700;
}

.auth-body .auth-modern .auth-main {
  background: transparent;
}

.auth-body .auth-modern .auth-card {
  max-width: 460px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 30px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.78)),
    rgba(255, 255, 255, 0.78);
  box-shadow: 0 28px 80px rgba(42, 50, 77, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(28px);
}

.auth-body .auth-modern .auth-card h1 {
  font-size: 29px;
  letter-spacing: -0.9px;
}

.auth-body .auth-modern .auth-card p.lead {
  margin-bottom: 18px;
  color: var(--auth-muted);
}

.auth-body .auth-modern .oauth-panel {
  margin: 16px 0;
}

.auth-body .auth-modern .oauth-title {
  margin-bottom: 8px;
  color: #5c6b84;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.auth-body .auth-modern .oauth-buttons {
  grid-template-columns: 1fr;
}

.auth-body .auth-modern .oauth-button {
  min-height: 50px;
  justify-content: flex-start;
  gap: 12px;
  padding: 0 14px;
  border-radius: 16px;
  border-color: rgba(18, 19, 20, 0.1);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

.auth-body .auth-modern .oauth-button:hover {
  transform: translateY(-1px);
  background: #fff;
  box-shadow: 0 12px 30px rgba(43, 54, 88, 0.11);
}

.oauth-provider-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid rgba(18, 19, 20, 0.1);
  border-radius: 999px;
  background: #fff;
  color: #1f2937;
  font-size: 12px;
  font-weight: 800;
}

.auth-body .auth-modern .oauth-divider {
  margin: 14px 0 12px;
}

.auth-body .auth-modern .segmented {
  margin-bottom: 16px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(18, 19, 20, 0.045);
}

.auth-body .auth-modern .segmented button {
  min-height: 36px;
  border-radius: 999px;
  font-weight: 650;
}

.auth-body .auth-modern .field {
  gap: 7px;
}

.auth-body .auth-modern .field label {
  color: #566074;
  font-weight: 650;
}

.auth-body .auth-modern input {
  min-height: 48px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.82);
}

.auth-body .auth-modern button.primary {
  min-height: 50px;
  margin-top: 2px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #2f5cff, #7d4dff);
  box-shadow: 0 14px 34px rgba(85, 91, 255, 0.25);
  font-weight: 720;
}

.auth-body .auth-modern button.primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #244df0, #6b3df1);
  transform: translateY(-1px);
}

.auth-body .auth-modern .auth-footnote {
  text-align: center;
  color: #7a8495;
}

@media (max-width: 880px) {
  .auth-body .auth-modern .auth-brand-panel {
    min-height: auto;
    padding: 22px;
  }
  .auth-body .auth-modern .auth-brand-copy {
    margin-top: 30px;
  }
  .auth-visual-stack {
    display: none;
  }
  .auth-body .auth-modern .auth-main {
    padding: 16px;
  }
  .auth-body .auth-modern .auth-card {
    max-width: none;
    padding: 22px;
    border-radius: 24px;
  }
}

/* ---------- chat layout ---------- */

.chat-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  background: var(--bg);
}

.sidebar {
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(79, 124, 255, 0.06), transparent 180px),
    var(--bg-soft);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-section {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* W2: sidebar IA — account row + ws chip + nav block + sessions list +
   footer. Mirrors the mockup `p1-3-workspace-switcher-mockup.html`. */
.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 10px;
  flex-shrink: 0;
}
.account-row__avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.account-row__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.account-row__name {
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-row__email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-chip-wrap {
  position: relative;
  padding: 4px 12px 10px;
  flex-shrink: 0;
}
.ws-chip {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}
.ws-chip:hover { border-color: var(--border-strong); background: var(--bg-card); }
.ws-chip[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ws-chip__emoji { font-size: 16px; }
.ws-chip__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-chip__role {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 10px;
}
.ws-chip__caret { color: var(--text-muted); font-size: 11px; }
.ws-chip-menu {
  position: absolute;
  left: 12px;
  right: 12px;
  top: calc(100% - 4px);
  z-index: 30;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
}
.ws-chip-menu__list { display: flex; flex-direction: column; gap: 2px; }
.ws-chip-menu__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  border: 0;
  color: var(--text);
  text-align: left;
  font-size: 13px;
  width: 100%;
}
.ws-chip-menu__row:hover { background: var(--bg-elev); }
.ws-chip-menu__row.is-active { background: var(--accent-soft); color: var(--accent); }
.ws-chip-menu__row .meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}
.ws-chip-menu__divider {
  height: 1px;
  margin: 4px 0;
  background: var(--border);
}
.ws-chip-menu__action {
  width: 100%;
  display: block;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.ws-chip-menu__action:hover { background: var(--bg-elev); }

.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
}
.nav-item:hover { background: var(--bg-elev); }
.nav-item--primary {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item--primary:hover { background: var(--accent-soft); filter: brightness(1.05); }
.nav-item__icon { width: 18px; text-align: center; opacity: 0.85; }
.nav-item__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item__hint { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; }
.nav-item__badge {
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 6px;
  min-width: 18px;
  text-align: center;
}

.sessions-section {
  flex: 1;
  min-height: 0;
  padding: 8px 12px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sessions-section__head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.sessions-section__head h3 {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  flex-shrink: 0;
}
.sidebar-footer__settings {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}
.sidebar-footer__settings:hover { color: var(--text); border-color: var(--border-strong); }
.sidebar-footer__pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-elev);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.sidebar-footer__pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--text-muted);
}
.sidebar-footer__pill[data-status="connecting"] { color: var(--warn); border-color: rgba(240, 179, 65, 0.4); }
.sidebar-footer__pill[data-status="connecting"] .dot { background: var(--warn); }
.sidebar-footer__pill[data-status="ready"] { color: var(--success); border-color: rgba(74, 210, 149, 0.45); }
.sidebar-footer__pill[data-status="ready"] .dot { background: var(--success); }
.sidebar-footer__pill[data-status="busy"] { color: var(--accent); border-color: rgba(79, 124, 255, 0.45); }
.sidebar-footer__pill[data-status="busy"] .dot { background: var(--accent); }
.sidebar-footer__pill[data-status="disconnected"] { color: var(--danger); border-color: rgba(255, 107, 122, 0.45); }
.sidebar-footer__pill[data-status="disconnected"] .dot { background: var(--danger); }

/* W3: two-row chat header */
.chat-header {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.chat-header__row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-header__title-block { display: flex; flex-direction: column; min-width: 0; }
.chat-header__title-block .title { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-header__title-block .status-text { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-info-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
}
.chat-header__row--secondary { display: none; }
.chat-header__ws-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}
.chat-header__workdir-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  max-width: 60ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-header__workdir-chip:hover { border-color: var(--border-strong); }

.chat-recording-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  margin-bottom: 8px;
  color: var(--text);
}
.chat-recording-bar__dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--danger);
  box-shadow: 0 0 0 0 rgba(214, 51, 77, 0.5);
  animation: recPulse 1.2s ease-in-out infinite;
}
@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(214, 51, 77, 0.5); }
  50% { box-shadow: 0 0 0 8px rgba(214, 51, 77, 0); }
}
.chat-recording-bar__timer {
  font-family: var(--mono-stack, "Menlo", "Consolas", monospace);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 600;
}
.chat-recording-bar__partial {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* W4: settings SPA */
.settings-spa { width: min(720px, 92vw); padding: 0; }
.settings-spa__head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.settings-spa__tabs {
  display: flex;
  gap: 4px;
  padding: 6px 12px 0;
  border-bottom: 1px solid var(--border);
}
.settings-tab {
  background: transparent;
  border: 0;
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  border-radius: 0;
}
.settings-tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.settings-tab:hover { color: var(--text); }
.settings-spa__body {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.settings-card h3 {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}
.settings-row > label { color: var(--text-muted); font-size: 13px; }
.settings-row select,
.settings-row input {
  max-width: 220px;
}
.sidebar-section h3 {
  margin: 0;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.tunnel-list, .session-list {
  display: flex; flex-direction: column; gap: 6px; min-height: 0;
}
.tunnel-list { overflow-y: auto; max-height: 40vh; }
.session-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  overscroll-behavior: contain;
}

.tunnel-item, .session-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
}
.tunnel-item:hover, .session-item:hover {
  background: var(--bg-elev);
}
.tunnel-item.active, .session-item.active {
  background: linear-gradient(90deg, var(--accent-soft), rgba(79, 124, 255, 0.07));
  border-color: rgba(108, 140, 255, 0.5);
}
.tunnel-item .meta, .session-item .meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
}
.tunnel-item .name, .session-item .name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-actions {
  opacity: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.session-action-btn {
  padding: 4px 6px;
  border-radius: 8px;
  color: var(--text-muted);
  background: transparent;
}
.session-action-btn svg {
  width: 15px;
  height: 15px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.session-item:hover .session-actions,
.session-item.active .session-actions,
.session-actions:focus-within {
  opacity: 1;
}
.session-action-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}
.tunnel-item .sub { font-size: 11px; color: var(--text-muted); }

.chat-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(79, 124, 255, 0.10), transparent 42%),
    var(--bg);
}

.chat-banner {
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-soft);
}
.chat-banner .title { font-weight: 600; }
.chat-banner .status-text { color: var(--text-muted); font-size: 12px; }

.spawned-session-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 16px 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 200, 80, 0.12);
  border: 1px solid rgba(255, 170, 60, 0.45);
  color: var(--text);
}
.spawned-session-banner[hidden] { display: none; }
.spawned-session-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  color: rgba(180, 95, 0, 1);
  background: rgba(255, 200, 80, 0.18);
  border: 1px solid rgba(255, 170, 60, 0.55);
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease;
}
.spawned-session-back:hover { background: rgba(255, 200, 80, 0.3); }
.spawned-session-back:active { background: rgba(255, 200, 80, 0.4); }
.spawned-session-back-arrow { font-size: 14px; line-height: 1; }
.spawned-session-divider {
  width: 1px;
  height: 22px;
  background: rgba(255, 170, 60, 0.4);
}
.spawned-session-icon { font-size: 16px; line-height: 1; }
.spawned-session-title { font-weight: 600; font-size: 13px; }
.spawned-session-meta {
  font-family: var(--font-mono, ui-monospace, "SFMono-Regular", Menlo, monospace);
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-conversations-dialog {
  width: min(640px, 92vw);
  max-height: 80vh;
}
.session-info-dialog {
  width: min(520px, 92vw);
}
.session-info-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.session-info-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}
.session-info-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.session-info-section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.session-info-workdir {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg-soft);
}
.session-info-workdir code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.session-info-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.session-info-meta-row {
  display: grid;
  grid-template-columns: 20px minmax(110px, auto) 1fr;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.session-info-meta-icon,
.session-info-meta-label {
  color: var(--text-muted);
}
.session-info-meta-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}
.session-info-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.session-info-actions button {
  justify-content: center;
}
.danger-text {
  color: var(--danger);
}
.search-conversations-field {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.search-conversations-field input[type="search"] {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text);
}
.search-conversations-field input[type="search"]:focus {
  outline: none;
  border-color: var(--accent);
}
.search-conversations-results {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  margin-top: 8px;
}
.search-conversation-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font: inherit;
  transition: background 120ms ease, border-color 120ms ease;
}
.search-conversation-row:hover {
  background: var(--bg-hover, rgba(120, 120, 120, 0.08));
  border-color: var(--accent);
}
.search-conversation-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-conversation-title {
  flex: 1;
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-conversation-chevron {
  font-size: 16px;
  color: var(--text-muted);
}
.search-conversation-snippet {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.search-conversation-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.child-sessions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}
.child-session-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
}
.child-session-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
}
.child-session-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.child-session-title {
  font-weight: 500;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.child-session-meta { font-size: 11px; color: var(--text-muted); }
.child-session-key {
  font-family: var(--font-mono, ui-monospace, "SFMono-Regular", Menlo, monospace);
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 22px clamp(20px, 5vw, 64px) 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.history-pager {
  width: min(100%, 820px);
  margin: 0 auto;
  display: flex;
  justify-content: center;
}
.history-pager__button {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--bg-card);
}
.message {
  width: min(100%, 820px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
}
.message.continuation {
  margin-top: -10px;
}
.message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-top: 2px;
  background: rgba(95, 188, 255, 0.14);
  border: 1px solid rgba(95, 188, 255, 0.25);
  color: var(--tool);
  font-size: 11px;
  font-weight: 700;
}
.message.user .message-avatar {
  background: rgba(79, 124, 255, 0.16);
  border-color: rgba(79, 124, 255, 0.32);
  color: #9fb5ff;
}
.message.continuation .message-avatar {
  visibility: hidden;
}
.message-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.message .role {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.message.continuation .role {
  display: flex;
}
.message-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}
.message-process-toggle {
  cursor: pointer;
  user-select: none;
}
.message-process-toggle:hover {
  color: var(--text);
}
.message-process-count {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
  opacity: 0.86;
}
.message-process-chevron {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
.message-process-toggle.expanded .message-process-chevron {
  transform: rotate(180deg);
}
.message-process-layer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: -2px 0 4px;
  padding-left: 14px;
  border-left: 1px solid var(--border);
}
.message-time {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
  opacity: 0.82;
}
.message-time::before {
  content: "·";
  margin-right: 8px;
}

/* Generic part container — every message part renders as its own block. */
.part {
  min-width: 0;
  word-break: break-word;
  line-height: 1.6;
}

/* Plain prose answers: ChatGPT-style flat text, no bubble. */
.message.assistant .part-text {
  font-size: 14.5px;
  color: var(--text);
}
.message.user {
  justify-items: end;
}
.message.user .message-body {
  align-items: flex-end;
}
.message.user .part-text {
  background: var(--accent-soft);
  border: 1px solid rgba(108, 140, 255, 0.45);
  padding: 10px 14px;
  border-radius: 16px 16px 4px 16px;
  max-width: min(640px, 100%);
  white-space: pre-wrap;
}

/* Inline rich-text rendering helpers. */
.text-line { white-space: pre-wrap; }
.part-text strong { color: var(--text); }
.part-text em { color: var(--text); font-style: italic; }
.part-text code,
.thinking-detail code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12.8px;
}
.part-text .code-block,
.thinking-detail .code-block,
.tool-block-content {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--code-bg);
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 12.8px;
  line-height: 1.5;
  overflow-x: auto;
  margin: 8px 0 0;
  border: 1px solid var(--border);
  white-space: pre;
}
.part-text .code-block:first-child,
.thinking-detail .code-block:first-child {
  margin-top: 0;
}

/* ---------- Thinking card (collapsed by default) ---------- */
.thinking-card {
  border: 1px dashed rgba(181, 145, 255, 0.32);
  background: rgba(181, 145, 255, 0.06);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
}
.thinking-card[open] {
  background: rgba(181, 145, 255, 0.08);
}
.thinking-toggle {
  list-style: none;
  cursor: pointer;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d7c8ff;
  font-size: 12.5px;
  user-select: none;
}
.thinking-toggle::-webkit-details-marker { display: none; }
.thinking-card .part-icon { color: #d7c8ff; }
.thinking-card .part-chevron {
  margin-left: auto;
  font-size: 10px;
  transition: transform 0.15s ease;
  color: var(--text-muted);
}
.thinking-card[open] .part-chevron { transform: rotate(180deg); }
.thinking-detail {
  padding: 0 14px 12px;
  font-size: 13.5px;
  color: #cdbcff;
  line-height: 1.6;
  white-space: normal;
}

/* ---------- Inline artifact card (assistant-produced file) ---------- */
.artifact-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(95, 188, 255, 0.35);
  border-radius: 12px;
  background: var(--bg-card);
}
.artifact-card.status-failed { border-color: rgba(255, 122, 122, 0.55); }
.artifact-card.status-pending { border-color: rgba(255, 196, 110, 0.45); }
.artifact-card-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(95, 188, 255, 0.12);
  font-size: 14px;
  color: var(--tool);
  flex-shrink: 0;
}
.artifact-card.status-failed .artifact-card-icon { color: #ff7a7a; }
.artifact-card.status-pending .artifact-card-icon { color: #ffc46e; }
.artifact-card-body { min-width: 0; flex: 1; }
.artifact-card-title {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.artifact-card-subtitle {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Tool invocation card (merged tool_use + tool_result) ---------- */
.tool-card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
}
.tool-card.status-pending { border-color: rgba(95, 188, 255, 0.35); }
.tool-card.status-error { border-color: rgba(255, 122, 122, 0.45); }
.tool-card-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font: inherit;
}
.tool-card-toggle:hover { background: rgba(255, 255, 255, 0.03); }
.tool-card .part-status {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 11px;
  border-radius: 999px;
  flex-shrink: 0;
}
.tool-card.status-ok .part-status { color: var(--ok, #4ad295); }
.tool-card.status-error .part-status { color: #ff7a7a; }
.tool-card.status-pending .part-status { color: var(--tool); }
.tool-card .part-icon {
  font-size: 12px;
  color: var(--tool);
}
.tool-card .part-title {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
  flex-shrink: 0;
}
.tool-card .part-summary {
  color: var(--text-muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.tool-card .part-chevron {
  margin-left: auto;
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.15s ease;
  flex-shrink: 0;
}
.tool-card.expanded .part-chevron { transform: rotate(180deg); }
.tool-card-detail {
  border-top: 1px solid var(--border);
  padding: 10px 12px 12px;
  background: rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tool-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tool-block-label {
  font-size: 10.5px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.tool-block-content {
  margin: 0;
  max-height: 320px;
}
.tool-block-pending {
  color: var(--text-muted);
  font-size: 12.5px;
  font-style: italic;
}
.tool-block.muted { color: var(--text-muted); font-size: 12px; }

/* Spinner shared by tool-card pending state and the standalone placeholder. */
.part-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  opacity: 0.85;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Raw fallback card. */
.part-raw {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  padding: 0 12px 10px;
}
.part-raw summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12.5px;
}
.part-raw summary::-webkit-details-marker { display: none; }
.part-raw .part-chevron { margin-left: auto; }

.stream-cursor {
  display: inline-block;
  width: 7px;
  height: 1.15em;
  margin-left: 2px;
  vertical-align: -0.15em;
  border-radius: 999px;
  background: var(--accent);
  animation: stream-cursor-blink 1s steps(2, start) infinite;
}
.stream-cursor {
  display: inline-block;
  width: 7px;
  height: 1.15em;
  margin-left: 2px;
  vertical-align: -0.15em;
  border-radius: 999px;
  background: var(--accent);
  animation: stream-cursor-blink 1s steps(2, start) infinite;
}
@keyframes stream-cursor-blink {
  50% { opacity: 0; }
}

.composer {
  border-top: 1px solid var(--border);
  padding: 12px clamp(22px, 6vw, 96px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: rgba(13, 18, 28, 0.96);
}
.composer.drag-over {
  box-shadow: inset 0 0 0 2px rgba(79, 124, 255, 0.45);
}
.composer-row {
  display: flex;
  gap: 10px;
}
.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 200px;
  resize: none;
  background: var(--bg-card);
  border-radius: 16px;
}
.composer button {
  align-self: stretch;
}
.composer .attach-btn {
  width: 44px;
  border-radius: 14px;
  font-size: 20px;
  line-height: 1;
}
.composer button.danger {
  background: rgba(255, 107, 122, 0.12);
}
.composer button.danger:hover:not(:disabled) {
  background: rgba(255, 107, 122, 0.2);
}
.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.artifact-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 0 2px;
}
.artifact-strip__label,
.artifact-strip__more {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.artifact-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
}
.artifact-chip__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-chip {
  display: grid;
  grid-template-columns: 36px minmax(80px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  max-width: min(420px, 100%);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
}
.attachment-chip.status-uploading {
  border-color: rgba(95, 188, 255, 0.4);
}
.attachment-chip.status-error {
  border-color: rgba(255, 107, 122, 0.5);
}
.attachment-chip img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-soft);
}
.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.attachment-status {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}
.attachment-remove {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
}
.drop-hint {
  color: var(--text-muted);
  font-size: 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 8px 10px;
  text-align: center;
}
.composer.drag-over .drop-hint {
  color: var(--accent);
  border-color: rgba(79, 124, 255, 0.6);
  background: var(--accent-soft);
}

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}
.empty-state .inner {
  max-width: 420px;
}
.empty-state h2 { color: var(--text); margin: 0 0 8px; }

/* ---------- console ---------- */

.console-layout {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 18px 24px 24px;
  gap: 16px;
  overflow-y: auto;
}

.console-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.deploy-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.change-password-form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
  margin-top: 14px;
}
.change-password-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.metric-card strong {
  font-size: 18px;
  word-break: break-word;
}
.metric-card code {
  overflow: hidden;
  text-overflow: ellipsis;
}

.analytics-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.analytics-detail-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.analytics-chart {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 160px;
  overflow-x: auto;
  padding-top: 12px;
}

.analytics-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 34px;
}

.analytics-bars {
  display: flex;
  align-items: end;
  gap: 3px;
  width: 24px;
  height: 120px;
}

.analytics-bar {
  display: block;
  width: 6px;
  min-height: 4px;
  border-radius: 999px 999px 0 0;
}

.analytics-bar.pv { background: var(--accent); }
.analytics-bar.uv { background: var(--success); }
.analytics-bar.downloads { background: var(--warn); }

.analytics-day-label {
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.log-viewer {
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--code-bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow: auto;
  max-height: 420px;
}

.tunnel-card, .user-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tunnel-card .row.title {
  align-items: center;
}
.tunnel-card .name { font-weight: 600; font-size: 16px; }
.tunnel-card .info { font-size: 12px; color: var(--text-muted); }

table.simple {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.simple th, table.simple td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
table.simple th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
table.simple tr:last-child td { border-bottom: none; }
table.simple tr.selected td {
  background: var(--accent-soft);
}
table.simple tbody tr[data-username] {
  cursor: pointer;
}
table.simple tbody tr[data-username]:hover td {
  background: rgba(255, 255, 255, 0.04);
}
table.simple tbody tr.selected:hover td {
  background: var(--accent-soft);
}

html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}
html[data-theme="light"] .language-switcher {
  background: #eef2f8;
}
html[data-theme="light"] .managed-model-pill,
html[data-theme="light"] table.simple tbody tr[data-username]:hover td {
  background: #f6f8fc;
}
html[data-theme="light"] .log-viewer {
  background: #f8fafc;
  color: #15213b;
}

.notification-test-form {
  margin-top: 12px;
}
.notification-devices-card {
  overflow: auto;
  min-height: 96px;
}
.notification-result-card {
  margin-top: 4px;
}
.notification-result-card .log-viewer {
  min-height: 220px;
  max-height: min(52vh, 560px);
  white-space: pre;
}

dialog {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
dialog .dialog-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
dialog .dialog-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
dialog .dialog-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.approval-dialog {
  max-width: 520px;
}
.approval-dialog .approval-body {
  gap: 14px;
}
.approval-dialog .approval-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.approval-dialog .approval-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.approval-dialog .approval-tool {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  background: var(--bg-soft, rgba(127, 127, 127, 0.08));
  padding: 4px 8px;
  border-radius: 6px;
  align-self: flex-start;
}
.approval-dialog .approval-reason {
  font-size: 13px;
  color: var(--text);
}
.approval-dialog .approval-args {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--bg-soft, rgba(127, 127, 127, 0.08));
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.approval-dialog .approval-foot {
  gap: 10px;
}
.device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow-y: auto;
}
.device-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
}
.device-main {
  flex: 1;
  min-width: 0;
}
.device-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.device-badge {
  border: 1px solid rgba(108, 140, 255, 0.45);
  background: rgba(108, 140, 255, 0.14);
  color: var(--accent);
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 11px;
}
.device-empty {
  padding: 12px;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: 12px;
  text-align: center;
}
.danger-text {
  color: var(--danger);
}

/* ---------- Codex-style chat surface ---------- */

body[data-title-key="chat.title"] {
  --bg: #ffffff;
  --bg-soft: #f7f7f4;
  --bg-card: #ffffff;
  --bg-elev: #f1f1ee;
  --border: #e8e8e3;
  --border-strong: #d7d7cf;
  --text: #1f1f1d;
  --text-muted: #8a8982;
  --accent: #222220;
  --accent-strong: #111110;
  --accent-soft: #f0f0eb;
  --success: #1d8f5d;
  --danger: #c33b4a;
  --warn: #b87512;
  --thinking: #7c6f5e;
  --tool: #6f716a;
  --code-bg: #f6f6f2;
  --shadow: 0 18px 48px rgba(30, 30, 20, 0.10), 0 2px 8px rgba(30, 30, 20, 0.06);
  --composer-shadow: 0 12px 32px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.08);
  --sidebar-text: #4f4e47;
  --sidebar-muted: #8a8981;
  background: var(--bg);
  font-size: 13px;
  letter-spacing: -0.01em;
}

body[data-title-key="chat.title"] .app-shell {
  background: var(--bg);
}

body[data-title-key="chat.title"] .topbar {
  height: 38px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

body[data-title-key="chat.title"] .topbar .brand {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  flex-shrink: 0;
}

.codex-titlebar-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 2px;
  flex-shrink: 0;
}

.codex-titlebar-nav a {
  color: var(--text-muted);
  padding: 5px 9px;
  border-radius: 9px;
  font-size: 13px;
  line-height: 1;
}

.codex-titlebar-nav a:hover {
  color: var(--text);
  background: var(--bg-elev);
  text-decoration: none;
}

.codex-titlebar-nav a[aria-current="page"] {
  color: var(--text);
}

body[data-title-key="chat.title"] .topbar .nav-links {
  display: none;
}

body[data-title-key="chat.title"].is-admin .topbar .nav-links {
  display: flex;
}

body[data-title-key="chat.title"] .topbar .me {
  gap: 8px;
}

body[data-title-key="chat.title"] #me-username {
  color: #77766f;
}

body[data-title-key="chat.title"] button {
  border-color: transparent;
  background: transparent;
  color: var(--text);
}

body[data-title-key="chat.title"] button:hover:not(:disabled) {
  background: var(--bg-elev);
  border-color: transparent;
}

body[data-title-key="chat.title"] button.primary {
  background: #2c2c29;
  border-color: #2c2c29;
  color: #fff;
}

body[data-title-key="chat.title"] button.primary:hover:not(:disabled) {
  background: #111110;
}

.codex-nav-toggle {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 9px;
  font-size: 15px;
  line-height: 1;
}

body[data-title-key="chat.title"] .language-switcher {
  background: var(--bg-soft);
  border-color: var(--border);
}

body[data-title-key="chat.title"] .language-option[aria-pressed="true"] {
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

body[data-title-key="chat.title"] .host-chip-wrap {
  margin-right: 0;
}

body[data-title-key="chat.title"] .host-chip {
  max-width: 260px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  border-radius: 999px;
  box-shadow: none;
}

body[data-title-key="chat.title"] .host-chip[data-state="online"] {
  border-color: rgba(29, 143, 93, 0.25);
}

body[data-title-key="chat.title"] .chat-layout {
  --chat-sidebar-width: 250px;
  --chat-sidebar-resizer-width: 6px;
  position: relative;
  display: grid;
  grid-template-columns: var(--chat-sidebar-width) var(--chat-sidebar-resizer-width) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #fff;
  transition: grid-template-columns 180ms ease;
}

body[data-title-key="chat.title"] .chat-layout.sidebar-collapsed {
  --chat-sidebar-width: 0px;
  --chat-sidebar-resizer-width: 0px;
}

body[data-title-key="chat.title"] .sidebar {
  position: relative;
  z-index: 20;
  width: var(--chat-sidebar-width);
  min-width: 0;
  overflow: hidden;
  transform: none;
  transition: width 180ms ease, opacity 120ms ease;
  background: #f7f7f3;
  border-right: 1px solid var(--border);
  box-shadow: none;
  color: var(--sidebar-text);
}

body[data-title-key="chat.title"] .chat-layout.sidebar-collapsed .sidebar {
  opacity: 0;
  pointer-events: none;
  border-right-color: transparent;
}

body[data-title-key="chat.title"] .sidebar-resizer {
  position: relative;
  z-index: 21;
  cursor: col-resize;
  background: transparent;
}

body[data-title-key="chat.title"] .sidebar-resizer::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  transform: translateX(-50%);
  background: var(--border);
  opacity: 0.72;
}

body[data-title-key="chat.title"] .sidebar-resizer:hover::after,
body[data-title-key="chat.title"].sidebar-resizing .sidebar-resizer::after {
  background: var(--accent);
  opacity: 1;
}

body[data-title-key="chat.title"].sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}

body[data-title-key="chat.title"].sidebar-resizing .chat-layout {
  transition: none;
}

.sidebar-backdrop {
  position: fixed;
  inset: 38px 0 0;
  z-index: 45;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.16);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
}

body[data-title-key="chat.title"] .sidebar-head {
  display: none;
}

.sidebar-head strong {
  flex: 1;
  font-size: 14px;
}

#session-drawer-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 9px;
  font-size: 18px;
}

body[data-title-key="chat.title"] .sidebar-section {
  border-bottom: 0;
  padding: 8px 8px 10px;
}

body[data-title-key="chat.title"] .account-row {
  padding: 18px 14px 12px;
}

body[data-title-key="chat.title"] .account-row__name,
body[data-title-key="chat.title"] .ws-chip,
body[data-title-key="chat.title"] .nav-item,
body[data-title-key="chat.title"] .session-item .name,
body[data-title-key="chat.title"] .sidebar-footer__settings {
  color: var(--sidebar-text);
}

body[data-title-key="chat.title"] .account-row__email,
body[data-title-key="chat.title"] .ws-chip__role,
body[data-title-key="chat.title"] .ws-chip__caret,
body[data-title-key="chat.title"] .nav-item__hint,
body[data-title-key="chat.title"] .session-item .sub {
  color: var(--sidebar-muted);
}

body[data-title-key="chat.title"] .ws-chip {
  background: transparent;
  border-color: transparent;
  font-weight: 500;
}

body[data-title-key="chat.title"] .ws-chip:hover {
  background: rgba(0, 0, 0, 0.035);
  border-color: transparent;
}

body[data-title-key="chat.title"] .ws-chip__role {
  background: rgba(0, 0, 0, 0.03);
}

body[data-title-key="chat.title"] .nav-section {
  border-bottom: 0;
}

body[data-title-key="chat.title"] .nav-item {
  font-weight: 400;
}

body[data-title-key="chat.title"] .nav-item--primary {
  background: transparent;
  font-weight: 500;
}

body[data-title-key="chat.title"] .nav-item--primary:hover,
body[data-title-key="chat.title"] .nav-item:hover {
  background: rgba(0, 0, 0, 0.035);
  filter: none;
}

body[data-title-key="chat.title"] .nav-item__icon {
  color: currentColor;
  opacity: 0.72;
}

body[data-title-key="chat.title"] .sidebar-section h3 {
  display: none;
}

body[data-title-key="chat.title"] .session-list {
  gap: 2px;
  max-height: none;
  padding: 2px 0;
}

body[data-title-key="chat.title"] .session-item {
  position: relative;
  min-height: 32px;
  border-radius: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  color: var(--sidebar-text);
  overflow: hidden;
}

body[data-title-key="chat.title"] .session-item:hover {
  background: rgba(0, 0, 0, 0.035);
}

body[data-title-key="chat.title"] .session-item.active {
  background: #e7e7e2;
  border-color: transparent;
  box-shadow: none;
}

body[data-title-key="chat.title"] .session-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

body[data-title-key="chat.title"] .session-item .name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 400;
}

body[data-title-key="chat.title"] .session-age {
  color: var(--sidebar-muted);
  font-size: 11px;
  line-height: 1;
  white-space: nowrap;
  transition: opacity 120ms ease;
}

body[data-title-key="chat.title"] .session-actions {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  gap: 2px;
  padding-left: 18px;
  background: linear-gradient(90deg, rgba(247, 247, 243, 0), #f7f7f3 38%);
}

body[data-title-key="chat.title"] .session-item .session-actions {
  opacity: 0;
}

body[data-title-key="chat.title"] .session-item:hover .session-age,
body[data-title-key="chat.title"] .session-item:focus-within .session-age {
  opacity: 0;
}

body[data-title-key="chat.title"] .session-item:hover .session-actions,
body[data-title-key="chat.title"] .session-item:focus-within .session-actions,
body[data-title-key="chat.title"] .session-actions:focus-within {
  opacity: 1;
}

body[data-title-key="chat.title"] .session-item.active:hover .session-actions,
body[data-title-key="chat.title"] .session-item.active:focus-within .session-actions {
  background: linear-gradient(90deg, rgba(231, 231, 226, 0), #e7e7e2 38%);
}

body[data-title-key="chat.title"] .session-action-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 7px;
  color: var(--sidebar-muted);
}

body[data-title-key="chat.title"] .session-action-btn:hover {
  color: var(--sidebar-text);
  background: rgba(0, 0, 0, 0.045);
}

body[data-title-key="chat.title"] .session-archive-btn {
  width: 24px;
  padding: 0;
}

body[data-title-key="chat.title"] .chat-pane {
  height: 100%;
  min-height: 0;
  background: #fff;
}

body[data-title-key="chat.title"] .chat-header {
  min-height: 44px;
  padding: 8px 20px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #ecece6;
  flex-shrink: 0;
}

body[data-title-key="chat.title"] .chat-header__title-block {
  gap: 2px;
}

body[data-title-key="chat.title"] .chat-header__title-block .title {
  color: #222220;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

body[data-title-key="chat.title"] .chat-header__title-block .status-text {
  color: #8a8981;
  font-size: 11px;
  letter-spacing: 0;
}

body[data-title-key="chat.title"] .chat-banner {
  display: none;
}

body[data-title-key="chat.title"] .chat-banner .title {
  font-size: 14px;
  font-weight: 650;
}

body[data-title-key="chat.title"] .chat-banner .status-text {
  max-width: 58vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
}

.codex-more-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  font-size: 18px;
  line-height: 1;
}

body[data-title-key="chat.title"] #forget-btn {
  display: none !important;
}

body[data-title-key="chat.title"] .messages {
  flex: 1;
  gap: 24px;
  padding: 28px clamp(22px, 9vw, 132px) 166px;
  background: #fff;
  scroll-padding-bottom: 180px;
}

body[data-title-key="chat.title"] .message {
  width: min(100%, 700px);
  grid-template-columns: minmax(0, 1fr);
  column-gap: 0;
}

body[data-title-key="chat.title"] .history-pager {
  width: min(100%, 700px);
}

body[data-title-key="chat.title"] .history-pager__button {
  background: #f5f5f0;
  border-color: #ededE7;
  color: #77766f;
}

body[data-title-key="chat.title"] .message-avatar {
  display: none;
}

body[data-title-key="chat.title"] .message.user {
  justify-items: stretch;
}

body[data-title-key="chat.title"] .message.user .message-body {
  align-items: flex-end;
}

body[data-title-key="chat.title"] .message.user .message-meta {
  justify-content: flex-end;
  padding: 0 6px 2px 0;
  color: #8a8981;
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}

body[data-title-key="chat.title"] .message.user .part-text {
  max-width: min(520px, 84%);
  padding: 12px 14px;
  color: #222220;
  background: #f4f4f1;
  border: 0;
  border-radius: 16px;
  box-shadow: none;
}

body[data-title-key="chat.title"] .message.assistant {
  justify-items: stretch;
}

body[data-title-key="chat.title"] .message.assistant .message-body {
  max-width: min(700px, 100%);
  align-items: stretch;
  gap: 13px;
}

body[data-title-key="chat.title"] .message.assistant .message-meta {
  padding: 0 0 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
}

body[data-title-key="chat.title"] .message.assistant .message-role-label {
  display: none;
}

body[data-title-key="chat.title"] .message.assistant .message-time::before {
  content: "·";
  margin-right: 8px;
}

body[data-title-key="chat.title"] .message-time {
  white-space: nowrap;
}

.task-progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

.task-progress::after {
  content: "›";
  color: #bbb9b0;
  font-size: 17px;
  line-height: 1;
}

.message-process-toggle .task-progress::after {
  content: none;
}

body[data-title-key="chat.title"] .message.assistant .part-text {
  font-size: 13px;
  line-height: 1.72;
  color: #242421;
}

body[data-title-key="chat.title"] .thinking-card,
body[data-title-key="chat.title"] .tool-card,
body[data-title-key="chat.title"] .part-raw {
  border-color: transparent;
  background: transparent;
  border-radius: 8px;
  box-shadow: none;
}

body[data-title-key="chat.title"] .thinking-card {
  border-style: solid;
}

body[data-title-key="chat.title"] .thinking-toggle,
body[data-title-key="chat.title"] .thinking-detail {
  color: #77766f;
}

body[data-title-key="chat.title"] .thinking-toggle,
body[data-title-key="chat.title"] .tool-card-toggle {
  min-height: 30px;
  padding: 4px 6px;
  border-radius: 8px;
  color: #353530;
}

body[data-title-key="chat.title"] .thinking-toggle:hover,
body[data-title-key="chat.title"] .tool-card-toggle:hover {
  background: rgba(0, 0, 0, 0.035);
}

body[data-title-key="chat.title"] .tool-card .part-title {
  color: #3a3a35;
  font-family: inherit;
  font-weight: 500;
}

body[data-title-key="chat.title"] .tool-card-detail {
  margin: 2px 0 6px 20px;
  padding: 8px 0 2px 10px;
  border-top: 0;
  border-left: 1px solid #e4e4dd;
  background: transparent;
}

body[data-title-key="chat.title"] .thinking-detail {
  margin: 2px 0 6px 20px;
  padding: 6px 0 2px 10px;
  border-left: 1px solid #e4e4dd;
  color: #5f5e57;
}

body[data-title-key="chat.title"] .message-process-layer {
  border-left-color: #e4e4dd;
}

body[data-title-key="chat.title"] .message-process-count {
  color: #8a8981;
}

body[data-title-key="chat.title"] .tool-block-content,
body[data-title-key="chat.title"] .part-text .code-block,
body[data-title-key="chat.title"] .thinking-detail .code-block {
  background: #f6f6f2;
  border-color: #e8e8e3;
  color: #2d2d29;
}

body[data-title-key="chat.title"] .stream-cursor {
  background: #2c2c29;
}

body[data-title-key="chat.title"] .composer {
  position: fixed;
  left: calc(var(--chat-sidebar-width) + ((100vw - var(--chat-sidebar-width)) / 2));
  bottom: max(28px, env(safe-area-inset-bottom));
  z-index: 35;
  width: min(612px, calc(100vw - var(--chat-sidebar-width) - 48px));
  transform: translateX(-50%);
  min-height: 84px;
  padding: 13px 12px 10px;
  gap: 6px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid #e6e6e1;
  border-radius: 17px;
  box-shadow: var(--composer-shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

body[data-title-key="chat.title"] .composer-row {
  align-items: center;
  gap: 12px;
}

body[data-title-key="chat.title"] .composer textarea {
  min-height: 36px;
  padding: 0 2px 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #222220;
  resize: none;
}

body[data-title-key="chat.title"] .composer textarea:focus {
  border: 0;
  box-shadow: none;
}

body[data-title-key="chat.title"] .composer .attach-btn {
  width: auto;
  height: 28px;
  align-self: center;
  border-radius: 9px;
  padding: 0 2px;
  font-size: 18px;
  color: #77766f;
}

body[data-title-key="chat.title"] .composer-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  color: #77766f;
  font-size: 13px;
  white-space: nowrap;
}

body[data-title-key="chat.title"] .composer-chip::after {
  content: "⌄";
  margin-left: 4px;
  font-size: 11px;
  color: #aaa9a1;
}

body[data-title-key="chat.title"] .composer-chip--model {
  margin-left: auto;
  color: #222220;
  font-weight: 500;
}

body[data-title-key="chat.title"] #send-btn,
body[data-title-key="chat.title"] #stop-btn {
  min-width: 28px;
  width: 28px;
  height: 28px;
  align-self: flex-end;
  border-radius: 999px;
  padding: 0;
}

body[data-title-key="chat.title"] #send-btn {
  font-size: 0;
  background: #898983;
  border-color: #898983;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.16);
}

body[data-title-key="chat.title"] #send-btn::before {
  content: "↑";
  font-size: 15px;
  font-weight: 700;
}

body[data-title-key="chat.title"] #stop-btn {
  background: #1f1f1d;
  color: #fff;
  width: auto;
  min-width: 64px;
  padding: 0 12px;
}

body[data-title-key="chat.title"] #stop-btn::before {
  content: "■";
  font-size: 10px;
  margin-right: 6px;
}

body[data-title-key="chat.title"] .attachment-strip {
  padding: 0 2px;
}

body[data-title-key="chat.title"] .artifact-chip {
  background: #f8f8f4;
  border-color: #e9e9e2;
}

body[data-title-key="chat.title"] .attachment-chip {
  background: #f8f8f4;
  border-color: #e9e9e2;
}

body[data-title-key="chat.title"] .drop-hint {
  display: none;
  border-color: #e8e8e3;
  background: #fafaf7;
}

body[data-title-key="chat.title"] .composer.drag-over .drop-hint {
  display: block;
}

body[data-title-key="chat.title"] .empty-state {
  align-items: flex-start;
  padding-top: 18vh;
}

body[data-title-key="chat.title"] .empty-state h2 {
  color: #222220;
  font-weight: 560;
}

body[data-title-key="chat.title"] .offline-host-state {
  display: flex;
  justify-content: center;
  padding: 9vh 24px 28px;
}

body[data-title-key="chat.title"] .offline-host-card {
  width: min(680px, 100%);
  border: 1px solid #e8e8e1;
  background: linear-gradient(180deg, #ffffff 0%, #fbfbf7 100%);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(36, 36, 33, 0.08);
  padding: 28px;
}

body[data-title-key="chat.title"] .offline-host-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #8a6a16;
  background: #fff8e7;
  border: 1px solid #f1deb0;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

body[data-title-key="chat.title"] .offline-host-card h2 {
  margin: 0 0 10px;
  color: #222220;
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 620;
  letter-spacing: -0.03em;
}

body[data-title-key="chat.title"] .offline-host-card p {
  margin: 0;
  color: #65645d;
  font-size: 15px;
  line-height: 1.65;
}

body[data-title-key="chat.title"] .offline-host-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

body[data-title-key="chat.title"] .offline-host-meta span {
  border: 1px solid #ecece6;
  background: #ffffff;
  color: #65645d;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

body[data-title-key="chat.title"] .offline-host-steps {
  display: grid;
  gap: 8px;
  margin: 20px 0 0;
  padding-left: 20px;
  color: #3f3e38;
  line-height: 1.55;
}

body[data-title-key="chat.title"] .offline-host-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 800px) {
  .chat-layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .sidebar.mobile-open { display: flex; position: fixed; inset: 0; z-index: 10; }
}

@media (max-width: 800px) {
  body[data-title-key="chat.title"] .chat-layout {
    --chat-sidebar-width: 0px;
    display: block;
  }
  body[data-title-key="chat.title"] .sidebar {
    display: flex;
    position: fixed;
    top: 38px;
    left: 0;
    bottom: 0;
    z-index: 50;
    width: min(320px, calc(100vw - 28px));
    transform: translateX(-102%);
    transition: transform 180ms ease;
    background: rgba(250, 250, 247, 0.98);
    border-right: 1px solid var(--border);
    box-shadow: 16px 0 42px rgba(33, 33, 25, 0.10);
    opacity: 1;
    pointer-events: auto;
  }
  body[data-title-key="chat.title"] .sidebar-head {
    display: flex;
  }
  body[data-title-key="chat.title"] .chat-layout.sidebar-open .sidebar {
    transform: translateX(0);
  }
  body[data-title-key="chat.title"] .topbar {
    padding: 0 10px;
    gap: 8px;
  }
  body[data-title-key="chat.title"] .host-chip-label {
    max-width: 132px;
  }
  body[data-title-key="chat.title"] .host-menu {
    position: fixed;
    top: 44px;
    left: 10px;
    right: 10px;
    width: auto;
    min-width: 0;
    max-height: min(70vh, 460px);
  }
  body[data-title-key="chat.title"] .chat-banner {
    padding: 0 14px;
  }
  body[data-title-key="chat.title"] .messages {
    padding: 24px 16px 164px;
    scroll-padding-bottom: 164px;
  }
  body[data-title-key="chat.title"] .message.user .part-text {
    max-width: 92%;
  }
  body[data-title-key="chat.title"] .message.assistant .message-body,
  body[data-title-key="chat.title"] .message.assistant .part-text {
    max-width: 100%;
  }
  body[data-title-key="chat.title"] .composer {
    left: 50%;
    width: calc(100vw - 18px);
    bottom: max(8px, env(safe-area-inset-bottom));
    border-radius: 20px;
  }
  body[data-title-key="chat.title"] .composer-chip {
    display: none;
  }
  body[data-title-key="chat.title"] .topbar .me .small {
    display: none;
  }
}

@media (max-width: 520px) {
  html,
  body {
    min-width: 0;
    overflow-x: hidden;
  }

  body[data-title-key="chat.title"] .app-shell {
    height: 100dvh;
  }

  body[data-title-key="chat.title"] .topbar {
    height: 44px;
    padding: 0 8px;
  }

  body[data-title-key="chat.title"] .brand-logo {
    width: 24px;
    height: 24px;
    border-radius: 7px;
  }

  body[data-title-key="chat.title"] .topbar .brand span,
  body[data-title-key="chat.title"] #me-username {
    display: none;
  }

  body[data-title-key="chat.title"] .codex-titlebar-nav {
    display: none;
  }

  body[data-title-key="chat.title"] .codex-titlebar-nav a {
    padding: 5px 6px;
    font-size: 12px;
  }

  body[data-title-key="chat.title"] .host-chip {
    max-width: 148px;
    height: 32px;
    padding: 0 8px;
  }

  body[data-title-key="chat.title"] .host-chip-label {
    max-width: 86px;
  }

  body[data-title-key="chat.title"] .sidebar {
    top: 44px;
    width: min(300px, calc(100vw - 20px));
  }

  .sidebar-backdrop {
    inset: 44px 0 0;
  }

  body[data-title-key="chat.title"] .chat-header {
    min-height: 42px;
    padding: 8px 12px;
  }

  body[data-title-key="chat.title"] .chat-header__title-block .title {
    font-size: 13px;
  }

  body[data-title-key="chat.title"] .chat-header__title-block .status-text,
  body[data-title-key="chat.title"] #search-conversations-btn span:last-child,
  body[data-title-key="chat.title"] #child-sessions-btn {
    display: none;
  }

  body[data-title-key="chat.title"] .messages {
    padding: 18px 12px 154px;
    gap: 18px;
    scroll-padding-bottom: 154px;
  }

  body[data-title-key="chat.title"] .message.user .part-text {
    max-width: 94%;
    padding: 10px 12px;
  }

  body[data-title-key="chat.title"] .message.assistant .message-meta {
    font-size: 12px;
  }

  body[data-title-key="chat.title"] .message.assistant .part-text {
    font-size: 13px;
    line-height: 1.68;
  }

  body[data-title-key="chat.title"] .composer {
    width: calc(100vw - 14px);
    min-height: 76px;
    padding: 10px;
    border-radius: 18px;
  }

  body[data-title-key="chat.title"] .composer textarea {
    min-height: 32px;
    max-height: 128px;
    font-size: 16px;
  }

  body[data-title-key="chat.title"] .composer-row {
    gap: 8px;
  }

  body[data-title-key="chat.title"] .composer .attach-btn,
  body[data-title-key="chat.title"] #send-btn {
    width: 32px;
    height: 32px;
  }

  body[data-title-key="chat.title"] #stop-btn {
    min-width: 58px;
    height: 32px;
    padding: 0 10px;
  }

  body[data-title-key="chat.title"] .attachment-chip {
    grid-template-columns: 32px minmax(0, 1fr) auto;
  }

  body[data-title-key="chat.title"] .offline-host-state {
    padding: 32px 12px 24px;
  }

  body[data-title-key="chat.title"] .offline-host-card {
    border-radius: 18px;
    padding: 20px;
  }

  body[data-title-key="chat.title"] .offline-host-actions .btn,
  body[data-title-key="chat.title"] .onboarding-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .onboarding-view {
    padding: 24px 12px 40px;
  }

  .onboarding-card {
    border-radius: 18px;
    padding: 20px;
  }

  .onboarding-step-row {
    grid-template-columns: 28px 1fr;
    gap: 12px;
  }

  .onboarding-step-num {
    width: 28px;
    height: 28px;
  }
}

/* ---------- onboarding view (chat.html) ---------- */

.onboarding-view {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 24px 64px;
  overflow-y: auto;
}
.onboarding-card {
  width: 100%;
  max-width: 640px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.onboarding-step-row {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 16px;
  align-items: flex-start;
}
.onboarding-step-row h3 {
  margin: 0 0 6px;
  font-size: 17px;
}
.onboarding-step-row p {
  margin: 0 0 10px;
}
.onboarding-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.onboarding-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.onboarding-status {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
}
.onboarding-status.online {
  background: rgba(74, 210, 149, 0.08);
  border-color: rgba(74, 210, 149, 0.4);
  color: var(--success);
}
.onboarding-status .ghost {
  margin-left: auto;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--code-bg);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text);
}

/* ---------- top-bar host chip + dropdown menu ---------- */

.host-chip-wrap {
  position: relative;
  margin-right: 8px;
}
.host-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.host-chip:hover { background: var(--bg-card); }
.host-chip[data-state="online"] { border-color: rgba(74, 210, 149, 0.45); }
.host-chip[data-state="offline"] { border-color: rgba(240, 179, 65, 0.45); color: var(--warn); }
.host-chip[data-state="error"] { border-color: rgba(255, 107, 122, 0.45); color: var(--danger); }
.host-chip-label {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.host-chip-caret {
  font-size: 10px;
  color: var(--text-muted);
}
.host-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.host-menu-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
}
.host-menu-section + .host-menu-section {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 4px;
}
.host-menu-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  padding: 4px 8px;
}
.host-menu-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
}
.host-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  text-align: left;
}
.host-menu-item:hover { background: var(--bg-elev); }
.host-menu-item.active {
  background: var(--accent-soft);
  border-color: rgba(108, 140, 255, 0.5);
}
.host-menu-item .name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.host-menu-item .meta {
  font-size: 11px;
  color: var(--text-muted);
}
.host-menu-action {
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
}
.host-menu-action:hover { background: var(--bg-elev); color: var(--text); }
.host-menu-empty {
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ---------- marketing landing page ---------- */

.landing-body {
  background:
    radial-gradient(ellipse at 12% -10%, rgba(108, 140, 255, 0.18), transparent 55%),
    radial-gradient(ellipse at 90% 5%, rgba(181, 145, 255, 0.16), transparent 55%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 32px;
  background: rgba(15, 17, 23, 0.78);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid rgba(43, 51, 68, 0.7);
}

.landing-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 16px;
}
.landing-brand:hover { text-decoration: none; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #b591ff);
  color: white;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.landing-nav-links {
  display: flex;
  gap: 4px;
  margin-left: 12px;
}
.landing-nav-links a {
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 14px;
}
.landing-nav-links a:hover {
  color: var(--text);
  background: var(--bg-elev);
  text-decoration: none;
}

.landing-nav-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.btn:hover { text-decoration: none; background: var(--bg-card); border-color: var(--border-strong); }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: transparent;
  color: white;
  box-shadow: 0 8px 24px rgba(108, 140, 255, 0.28);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent-strong), #4060e0); transform: translateY(-1px); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg-elev); }
.btn-lg { padding: 12px 20px; font-size: 15px; border-radius: 12px; }

.landing-main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 32px 80px;
  display: flex;
  flex-direction: column;
  gap: 80px;
}

.landing-hero {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 56px;
  align-items: center;
  padding-top: 28px;
}
.hero-text { display: flex; flex-direction: column; gap: 18px; }
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(74, 210, 149, 0.35);
  background: rgba(74, 210, 149, 0.08);
  color: var(--success);
  font-size: 12px;
}
.hero-text h1 {
  font-size: 44px;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.5px;
  font-weight: 700;
}
.hero-sub {
  font-size: 17px;
  color: var(--text-muted);
  margin: 0;
  max-width: 540px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.hero-bullets {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
  font-size: 14px;
}
.hero-bullets li {
  position: relative;
  padding-left: 22px;
}
.hero-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(108, 140, 255, 0.18);
}

.hero-visual {
  position: relative;
  height: 380px;
}
.hv-card {
  position: absolute;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hv-mac {
  top: 30px;
  left: 0;
  width: 320px;
}
.hv-phone {
  bottom: 0;
  right: 0;
  width: 260px;
  background: var(--bg-elev);
}
.hv-title {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.4px;
}
.hv-row.hv-bar {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(108, 140, 255, 0.35), rgba(181, 145, 255, 0.25));
}
.hv-row.hv-bar.short { width: 70%; }
.hv-status {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--success);
}
.hv-bubble {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  max-width: 90%;
}
.hv-bubble-user {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid rgba(108, 140, 255, 0.45);
  color: var(--text);
}
.hv-bubble-ai {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.landing-section {
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.landing-section h2 {
  font-size: 28px;
  margin: 0;
  letter-spacing: -0.3px;
  font-weight: 700;
}
.landing-section-tinted {
  background: rgba(28, 34, 48, 0.55);
  border: 1px solid rgba(43, 51, 68, 0.7);
  border-radius: 20px;
  padding: 36px;
}

.why-grid, .privacy-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.why-card, .privacy-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.why-card h3, .privacy-card h3 { margin: 0; font-size: 17px; }
.why-card p, .privacy-card p { color: var(--text-muted); margin: 0; font-size: 14px; }
.why-tag {
  align-self: flex-start;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 999px;
}

.steps-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.step {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.step h3 { margin: 0; font-size: 17px; }
.step p { color: var(--text-muted); margin: 0; font-size: 14px; }
.step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.download-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.download-card h3 { margin: 0; font-size: 18px; }
.download-card p { margin: 0; }
.download-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.download-primary {
  background: linear-gradient(135deg, rgba(108, 140, 255, 0.15), rgba(181, 145, 255, 0.08));
  border-color: rgba(108, 140, 255, 0.4);
}

.landing-footer {
  border-top: 1px solid var(--border);
  padding: 24px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 13px;
}
.footer-row { display: flex; align-items: center; gap: 10px; }
.footer-links a { color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }

@media (max-width: 920px) {
  .landing-hero { grid-template-columns: 1fr; gap: 36px; }
  .hero-visual { height: 320px; }
  .hv-mac { width: 78%; }
  .hv-phone { width: 64%; }
  .hero-text h1 { font-size: 34px; }
  .why-grid, .privacy-grid, .steps-grid, .download-grid { grid-template-columns: 1fr; }
  .landing-section-tinted { padding: 24px; }
}

@media (max-width: 640px) {
  .landing-nav { padding: 12px 18px; gap: 10px; }
  .landing-nav-links { display: none; }
  .landing-nav-actions { gap: 6px; }
  .landing-nav-actions .btn-ghost { display: none; }
  .landing-main { padding: 24px 18px 60px; gap: 56px; }
  .hero-text h1 { font-size: 28px; }
}

/* ---------- Codex-style light landing page ---------- */

.landing-body {
  --bg: #ffffff;
  --bg-soft: #f7f7f4;
  --bg-card: #ffffff;
  --bg-elev: #f1f1ee;
  --border: #e8e8e3;
  --border-strong: #d7d7cf;
  --text: #1f1f1d;
  --text-muted: #85847c;
  --accent: #222220;
  --accent-strong: #111110;
  --accent-soft: #f0f0eb;
  --success: #1d8f5d;
  --code-bg: #f6f6f2;
  --shadow: 0 18px 48px rgba(30, 30, 20, 0.10), 0 2px 8px rgba(30, 30, 20, 0.06);
  background:
    radial-gradient(circle at 50% -20%, rgba(32, 32, 28, 0.05), transparent 35%),
    #fff;
}

.landing-body .landing-nav {
  height: 52px;
  padding: 0 clamp(18px, 4vw, 42px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.landing-body .landing-brand {
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.landing-body .brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #242421;
  color: #fff;
  box-shadow: none;
}

.landing-body .brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  box-shadow: none;
}

.landing-body .landing-nav-links a {
  color: var(--text-muted);
  border-radius: 9px;
}

.landing-body .landing-nav-links a:hover {
  color: var(--text);
  background: var(--bg-elev);
}

.landing-body .btn {
  border-color: var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 999px;
  box-shadow: none;
}

.landing-body .btn:hover {
  background: var(--bg-elev);
  border-color: var(--border-strong);
  transform: none;
}

.landing-body .btn-primary {
  background: #242421;
  border-color: #242421;
  color: #fff;
  box-shadow: none;
}

.landing-body .btn-primary:hover {
  background: #111110;
}

.landing-body .btn-download {
  background: #fff;
  border-color: #242421;
  color: #242421;
  box-shadow: 0 10px 28px rgba(30, 30, 20, 0.10);
  font-weight: 650;
}

.landing-body .btn-download::before {
  content: "↓";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #242421;
  color: #fff;
  font-size: 13px;
  line-height: 1;
}

.landing-body .btn-download:hover {
  background: #f6f6f2;
  border-color: #111110;
}

.landing-body .landing-main {
  max-width: 1080px;
  padding-top: 68px;
  gap: 96px;
  color: var(--text);
}

.landing-body .landing-hero {
  grid-template-columns: minmax(0, 1.06fr) minmax(320px, 0.94fr);
  gap: 60px;
  align-items: center;
  padding-top: 10px;
}

.landing-body .hero-badge {
  border-color: #e2e2dc;
  background: #fbfbf8;
  color: #5d5c55;
}

.landing-body .hero-text {
  gap: 20px;
}

.landing-body .hero-text h1 {
  max-width: 760px;
  font-size: clamp(42px, 6vw, 68px);
  line-height: 1.04;
  letter-spacing: -2.4px;
  font-weight: 650;
}

.landing-body .hero-sub {
  max-width: 620px;
  font-size: 18px;
  line-height: 1.75;
  color: #68675f;
}

.landing-body .hero-actions {
  margin-top: 8px;
}

.landing-body .hero-download-hint {
  margin: -8px 0 0;
  color: #6c6b63;
  font-size: 13px;
}

.landing-body .hero-bullets {
  color: #77766f;
}

.landing-body .hero-bullets li::before {
  background: #242421;
  box-shadow: 0 0 0 4px rgba(36, 36, 33, 0.08);
}

.landing-body .hero-visual {
  height: 410px;
}

.landing-body .hv-card {
  border-color: #e9e9e3;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.landing-body .hv-mac {
  width: min(360px, 82%);
}

.landing-body .hv-phone {
  width: min(292px, 70%);
  background: #fbfbf8;
}

.landing-body .hv-row.hv-bar {
  background: linear-gradient(90deg, #ecece6, #f7f7f2);
}

.landing-body .hv-bubble-user {
  background: #f5f5f0;
  border-color: #eeeeE8;
}

.landing-body .landing-section {
  gap: 24px;
  color: var(--text);
}

.landing-body .landing-section h2 {
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -1.1px;
  font-weight: 620;
  color: #20201d;
}

.landing-body .landing-section-tinted {
  background: #fafaf7;
  border: 1px solid #ecece6;
  border-radius: 28px;
  color: var(--text);
}

.landing-body .why-card,
.landing-body .privacy-card,
.landing-body .step,
.landing-body .download-card {
  border-color: #e9e9e3;
  border-radius: 20px;
  background: #fff;
  box-shadow: none;
  color: var(--text);
}

.landing-body .why-card h3,
.landing-body .privacy-card h3,
.landing-body .step h3,
.landing-body .download-card h3 {
  color: #242421;
  font-weight: 610;
  letter-spacing: -0.2px;
}

.landing-body .why-card p,
.landing-body .privacy-card p,
.landing-body .step p,
.landing-body .download-card p,
.landing-body .download-card .muted {
  color: #65645d;
  line-height: 1.65;
}

.landing-body .why-tag,
.landing-body .step-num {
  background: #f3f3ee;
  color: #343431;
  border: 1px solid #e6e6df;
}

.landing-body .download-primary {
  background: #fafaf7;
  border-color: #e4e4dc;
}

.landing-body .landing-footer {
  background: #fff;
  border-top-color: var(--border);
  color: #74736c;
}

.landing-body .footer-links a {
  color: #6f6e66;
}

.landing-body .footer-links a:hover {
  color: #242421;
}

.landing-body .muted {
  color: #6f6e66;
}

.landing-body .small {
  color: #78776f;
}

@media (max-width: 920px) {
  .landing-body .landing-hero {
    grid-template-columns: 1fr;
  }
  .landing-body .hero-visual {
    max-width: 560px;
  }
}

@media (max-width: 640px) {
  .landing-body .landing-nav {
    padding: 0 14px;
  }
  .landing-body .landing-main {
    padding-top: 40px;
  }
  .landing-body .hero-text h1 {
    letter-spacing: -1.2px;
  }
}

/* Final landing override: keep marketing pages fully light even when older
   dark-theme rules share the same class names. */
html:has(body.landing-body),
body.landing-body {
  background: #ffffff !important;
  color: #1f1f1d !important;
}

body.landing-body .landing-main,
body.landing-body .landing-section {
  background: transparent !important;
  color: #1f1f1d !important;
}

body.landing-body .landing-section-tinted {
  background: #fafaf7 !important;
  border-color: #ecece6 !important;
  color: #1f1f1d !important;
}

body.landing-body .why-card,
body.landing-body .privacy-card,
body.landing-body .step,
body.landing-body .download-card,
body.landing-body .hv-card {
  background: #ffffff !important;
  border-color: #e9e9e3 !important;
  color: #1f1f1d !important;
}

body.landing-body .download-primary,
body.landing-body .hv-phone {
  background: #fafaf7 !important;
}

body.landing-body h1,
body.landing-body h2,
body.landing-body h3 {
  color: #20201d !important;
}

body.landing-body p,
body.landing-body .muted,
body.landing-body .hero-sub,
body.landing-body .hero-bullets,
body.landing-body .why-card p,
body.landing-body .privacy-card p,
body.landing-body .step p,
body.landing-body .download-card p {
  color: #65645d !important;
}

@media (max-width: 520px) {
  .auth-body .auth-screen.split,
  .auth-body .auth-modern {
    min-height: 100dvh;
  }

  .auth-body .auth-modern::before,
  .auth-body .auth-modern::after {
    opacity: 0.65;
  }

  .auth-body .auth-modern .auth-brand-panel {
    padding: 18px 16px 8px;
  }

  .auth-body .auth-modern .auth-brand-copy {
    margin-top: 22px;
  }

  .auth-body .auth-modern .auth-brand-copy h2 {
    font-size: 28px;
    line-height: 1.08;
  }

  .auth-body .auth-modern .auth-brand-copy p,
  .auth-body .auth-modern .auth-brand-bullets {
    display: none;
  }

  .auth-body .auth-modern .auth-main {
    align-items: flex-start;
    padding: 10px 12px 24px;
  }

  .auth-body .auth-modern .auth-card {
    padding: 18px;
    border-radius: 20px;
    box-shadow: 0 18px 48px rgba(42, 50, 77, 0.12);
  }

  .auth-body .auth-modern .auth-card h1 {
    font-size: 23px;
  }

  .auth-card-head {
    gap: 10px;
  }

  .auth-body .auth-modern .segmented {
    border-radius: 16px;
  }

  .auth-body .auth-modern .segmented button {
    min-height: 40px;
    border-radius: 12px;
    padding: 8px 10px;
  }

  .auth-body .auth-modern input,
  .auth-body .auth-modern button.primary,
  .auth-body .auth-modern .oauth-button {
    min-height: 48px;
    font-size: 16px;
  }

  .landing-body .landing-nav {
    height: auto;
    min-height: 54px;
    align-items: center;
    padding: 10px 12px;
    gap: 8px;
  }

  .landing-body .landing-brand .brand-text {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .landing-body .landing-nav-actions {
    gap: 6px;
  }

  .landing-body .landing-nav-actions [data-language-switcher] {
    display: none;
  }

  .landing-body .landing-nav-actions .btn {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .landing-body .landing-main {
    padding: 22px 12px 54px;
    gap: 44px;
  }

  .landing-body .landing-hero {
    gap: 24px;
  }

  .landing-body .hero-badge {
    max-width: 100%;
  }

  .landing-body .hero-text h1 {
    font-size: clamp(30px, 11vw, 42px);
    line-height: 1.06;
  }

  .landing-body .hero-sub {
    font-size: 15px;
  }

  .landing-body .hero-actions,
  .landing-body .download-actions {
    width: 100%;
    flex-direction: column;
  }

  .landing-body .hero-actions .btn,
  .landing-body .download-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .landing-body .hero-visual {
    height: auto;
    min-height: 260px;
    max-width: 100%;
  }

  .landing-body .hv-mac {
    width: 92%;
  }

  .landing-body .hv-phone {
    width: 74%;
    right: 0;
  }

  .landing-body .landing-section,
  .landing-body .landing-section-tinted {
    border-radius: 20px;
    padding: 20px;
  }

  .landing-body .landing-section h2 {
    font-size: 24px;
  }

  .landing-body .why-card,
  .landing-body .privacy-card,
  .landing-body .step,
  .landing-body .download-card {
    border-radius: 16px;
    padding: 18px;
  }

  .landing-body .landing-footer {
    padding: 22px 14px;
    gap: 14px;
  }

  .landing-body .footer-row,
  .landing-body .footer-links {
    width: 100%;
    justify-content: flex-start;
  }
}

/* ---------- legal public pages ---------- */

.legal-body {
  min-height: 100vh;
  background: #ffffff;
  color: #20201d;
}

.legal-nav {
  background: rgba(255, 255, 255, 0.88);
  border-bottom-color: #ecece6;
  color: #20201d;
}

.legal-nav .landing-brand,
.legal-nav .landing-nav-links a {
  color: #20201d;
}

.legal-nav .landing-nav-links a:not([aria-current="page"]) {
  color: #6f6e66;
}

.legal-nav .landing-nav-links a:hover,
.legal-nav .landing-nav-links a[aria-current="page"] {
  background: #f3f3ee;
  color: #20201d;
}

.legal-nav .btn-ghost {
  border-color: #e4e4dc;
  color: #20201d;
}

.legal-main {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(32px, 7vw, 72px) 20px 80px;
}

.legal-card {
  background: #ffffff;
  border: 1px solid #e9e9e3;
  border-radius: 24px;
  box-shadow: 0 24px 70px rgba(29, 27, 20, 0.08);
  padding: clamp(24px, 5vw, 56px);
}

.legal-kicker {
  margin: 0 0 12px;
  color: #77766f;
  font-size: 13px;
}

.legal-card h1 {
  margin: 0 0 18px;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.04em;
  color: #20201d;
}

.legal-card h2 {
  margin: 32px 0 10px;
  font-size: 18px;
  color: #20201d;
}

.legal-card p {
  margin: 0 0 14px;
  color: #5f5e57;
  font-size: 15px;
  line-height: 1.72;
}

.legal-card a {
  color: #315ee8;
}

@media (max-width: 640px) {
  .legal-nav {
    padding: 12px 16px;
  }

  .legal-nav .landing-nav-links {
    display: none;
  }
}
