:root {
  color-scheme: light;
  --ink: oklch(19% 0.018 246);
  --muted: oklch(45% 0.025 246);
  --paper: oklch(97% 0.008 230);
  --paper-2: oklch(93% 0.016 222);
  --line: oklch(82% 0.024 226);
  --blue: oklch(50% 0.17 253);
  --blue-deep: oklch(31% 0.11 252);
  --green: oklch(66% 0.15 157);
  --yellow: oklch(77% 0.14 86);
  --coral: oklch(67% 0.16 32);
  --grid-line: oklch(20% 0.02 246 / 0.035);
  --grid-line-strong: oklch(20% 0.02 246 / 0.03);
  --header-bg: oklch(97% 0.008 230 / 0.94);
  --menu-bg: oklch(98% 0.008 230);
  --button-secondary-bg: oklch(99% 0.006 230 / 0.72);
  --button-primary-text: oklch(98% 0.006 230);
  --on-green: oklch(19% 0.018 246);
  --surface: oklch(98% 0.008 230 / 0.68);
  --surface-strong: oklch(98% 0.008 230 / 0.86);
  --surface-green: oklch(94% 0.038 157);
  --surface-yellow: oklch(94% 0.045 86);
  --board-bg: linear-gradient(135deg, oklch(98% 0.01 228), oklch(90% 0.03 230));
  --board-glow: oklch(77% 0.14 86 / 0.34);
  --signal-bg: var(--ink);
  --signal-text: oklch(96% 0.01 230);
  --signal-muted: oklch(86% 0.018 230);
  --signal-bar-bg: oklch(35% 0.03 246);
  --code-bg: oklch(14% 0.025 246);
  --code-text: oklch(89% 0.075 157);
  --danger-border: oklch(57% 0.14 32 / 0.55);
  --radius: 8px;
  --shadow: 0 24px 70px oklch(33% 0.04 246 / 0.14);
  --max: 1180px;
  --header-height: 78px;
  font-family: Aptos, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: oklch(92% 0.014 234);
  --muted: oklch(72% 0.026 238);
  --paper: oklch(16% 0.028 244);
  --paper-2: oklch(23% 0.038 243);
  --line: oklch(35% 0.04 241);
  --blue: oklch(68% 0.15 250);
  --blue-deep: oklch(76% 0.12 248);
  --green: oklch(72% 0.14 157);
  --yellow: oklch(80% 0.13 86);
  --coral: oklch(72% 0.14 32);
  --grid-line: oklch(86% 0.012 235 / 0.052);
  --grid-line-strong: oklch(86% 0.012 235 / 0.04);
  --header-bg: oklch(16% 0.028 244 / 0.9);
  --menu-bg: oklch(19% 0.033 244);
  --button-secondary-bg: oklch(24% 0.04 243 / 0.74);
  --button-primary-text: oklch(16% 0.028 244);
  --on-green: oklch(16% 0.028 244);
  --surface: oklch(21% 0.034 244 / 0.82);
  --surface-strong: oklch(23% 0.04 244 / 0.9);
  --surface-green: oklch(25% 0.055 166);
  --surface-yellow: oklch(27% 0.06 87);
  --board-bg: linear-gradient(135deg, oklch(20% 0.038 244), oklch(25% 0.052 230));
  --board-glow: oklch(58% 0.14 88 / 0.28);
  --signal-bg: oklch(12% 0.024 244);
  --signal-text: oklch(94% 0.012 235);
  --signal-muted: oklch(76% 0.022 235);
  --signal-bar-bg: oklch(34% 0.04 242);
  --code-bg: oklch(10% 0.02 244);
  --code-text: oklch(85% 0.09 157);
  --danger-border: oklch(63% 0.13 32 / 0.56);
  --shadow: 0 24px 70px oklch(8% 0.02 244 / 0.45);
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(0deg, var(--grid-line-strong) 1px, transparent 1px) 0 0 / 72px 72px,
    var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  transition: background-color 0.22s ease, color 0.22s ease;
}
body.menu-open { overflow: hidden; }
body.chat-page { height: 100svh; overflow: hidden; }
.chat-page .site-main { height: calc(100svh - var(--header-height)); min-height: 0; overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 24px; font-size: clamp(2.72rem, 5.3vw, 4.95rem); line-height: 0.96; }
h2 { margin-bottom: 18px; font-size: clamp(2rem, 3.2vw, 3rem); line-height: 1.02; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
}
input { min-height: 48px; padding: 10px 12px; }
select { min-height: 48px; padding: 10px 36px 10px 12px; }
textarea { padding: 14px; resize: vertical; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid oklch(68% 0.15 250 / 0.48);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.muted { color: var(--muted); }
.compact { font-size: 0.9rem; }
.full-width { width: 100%; }
.eyebrow {
  margin: 0 0 14px;
  color: var(--blue-deep);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px clamp(16px, 3vw, 40px);
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  box-shadow: 0 1px 0 oklch(20% 0.02 246 / 0.03);
  backdrop-filter: blur(14px);
}
.brand { display: inline-flex; min-width: 0; align-items: center; gap: 14px; }
.brand-logo { display: block; flex: 0 0 auto; }
.brand-logo img { width: 160px; height: auto; }
.brand-product { display: grid; padding-left: 14px; border-left: 1px solid var(--line); line-height: 1.1; }
.brand-product strong { font-size: 0.94rem; letter-spacing: 0.12em; }
.brand-product small { margin-top: 5px; color: var(--muted); font-size: 0.73rem; }
.header-actions, .user-menu { display: flex; align-items: center; }
.header-actions { gap: clamp(10px, 2vw, 24px); }
.user-menu { gap: 20px; color: var(--muted); font-size: 0.92rem; font-weight: 650; }
.user-menu a, .quiet-button { position: relative; }
.user-menu a::after, .quiet-button::after {
  position: absolute;
  right: 100%;
  bottom: -6px;
  left: 0;
  height: 2px;
  background: var(--green);
  content: "";
  transition: right 0.18s ease-out;
}
.user-menu a:hover::after, .quiet-button:hover::after { right: 0; }
.user-menu form { margin: 0; }
.quiet-button { padding: 0; border: 0; background: none; }
.status-pill, .prompt-status, .access-signal span, .diagnostic-signal span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.status-pill {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}
.status-pill i, .prompt-status i, .access-signal i, .diagnostic-signal i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px oklch(66% 0.15 157 / 0.16);
}
.theme-toggle, .nav-toggle {
  display: inline-grid;
  width: 46px;
  height: 44px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--button-secondary-bg);
  transition: transform 0.18s ease-out, background 0.18s ease-out;
}
.theme-toggle:hover, .nav-toggle:hover { transform: translateY(-1px); }
.theme-toggle-track { position: relative; width: 25px; height: 14px; border-radius: 999px; background: var(--line); }
.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.18s ease-out, background 0.18s ease-out;
}
:root[data-theme="dark"] .theme-toggle-thumb { transform: translateX(11px); background: var(--yellow); }
.nav-toggle { display: none; gap: 5px; }
.nav-toggle span { display: block; width: 19px; height: 2px; background: var(--ink); transition: transform 0.18s ease-out; }
.nav-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.5px) rotate(-45deg); }

.site-main { min-height: calc(100svh - var(--header-height)); }
.primary-button, .secondary-button, .danger-button, .sidebar-toggle {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 750;
  line-height: 1.2;
  transition: transform 0.18s ease-out, box-shadow 0.18s ease-out, background 0.18s ease-out;
}
.primary-button { border-color: var(--ink); background: var(--ink); color: var(--button-primary-text); box-shadow: 0 12px 26px oklch(31% 0.11 252 / 0.16); }
.secondary-button { background: var(--button-secondary-bg); color: var(--blue-deep); }
.danger-button { border-color: var(--danger-border); background: transparent; color: var(--coral); }
.primary-button:hover, .secondary-button:hover, .danger-button:hover { transform: translateY(-2px); }
.primary-button:disabled, .secondary-button:disabled { cursor: wait; opacity: 0.68; transform: none; }

.notices { position: fixed; z-index: 40; top: calc(var(--header-height) + 12px); right: 16px; display: grid; max-width: 420px; gap: 8px; }
.notice { padding: 12px 16px; border: 1px solid var(--blue); border-radius: var(--radius); background: var(--menu-bg); box-shadow: var(--shadow); }
.notice-success { border-color: var(--green); }
.notice-warning { border-color: var(--yellow); }
.notice-error { border-color: var(--coral); }

.login-shell {
  display: grid;
  width: min(var(--max), calc(100% - 36px));
  min-height: calc(100svh - var(--header-height));
  grid-template-columns: minmax(0, 1fr) minmax(400px, 0.8fr);
  align-items: center;
  gap: clamp(36px, 7vw, 96px);
  margin: 0 auto;
  padding: clamp(48px, 8vh, 96px) 0;
}
.login-copy { max-width: 720px; }
.login-copy h1 { max-width: 12ch; }
.login-lede { max-width: 58ch; color: var(--muted); font-size: clamp(1.04rem, 1.5vw, 1.22rem); }
.login-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 34px; color: var(--blue-deep); font-size: 0.84rem; font-weight: 800; text-transform: uppercase; }
.login-flow i { width: 32px; height: 2px; background: linear-gradient(90deg, var(--blue), var(--green)); }
.access-board {
  position: relative;
  padding: clamp(20px, 3vw, 32px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: radial-gradient(circle at 82% 12%, var(--board-glow), transparent 28%), var(--board-bg);
  box-shadow: var(--shadow);
}
.board-topline { display: flex; justify-content: space-between; gap: 18px; margin-bottom: 32px; color: var(--muted); font-size: 0.82rem; font-weight: 750; }
.board-topline strong { color: var(--ink); }
.access-card { padding: clamp(20px, 3vw, 30px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); }
.access-title { margin-bottom: 4px; font-size: 1.34rem; font-weight: 800; }
.stacked-form { display: grid; gap: 8px; margin-top: 24px; }
.stacked-form label { margin-top: 5px; font-size: 0.88rem; font-weight: 750; }
.stacked-form button { margin-top: 12px; }
.form-error { margin-bottom: 4px; color: var(--coral); font-weight: 700; }
.access-signal, .diagnostic-signal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--signal-bg);
  color: var(--signal-text);
  font-size: 0.86rem;
}
.access-signal { margin-top: 14px; }
.access-signal span, .diagnostic-signal span { color: var(--signal-muted); }

.app-shell {
  display: grid;
  min-height: calc(100svh - var(--header-height));
  grid-template-columns: 300px minmax(0, 1fr);
}
.sidebar-toggle { display: none; }
.conversation-sidebar {
  min-width: 0;
  min-height: 0;
  padding: 24px 18px;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: var(--surface-strong);
}
.sidebar-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.sidebar-heading .eyebrow { margin-bottom: 3px; }
.sidebar-heading h2 { margin: 0; font-size: 1.45rem; }
.conversation-count { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--blue-deep); font-size: 0.78rem; font-weight: 800; }
.conversation-nav { display: grid; gap: 6px; margin-top: 18px; }
.conversation-nav a { position: relative; display: grid; min-width: 0; gap: 3px; padding: 11px 12px; border: 1px solid transparent; border-radius: var(--radius); }
.conversation-nav a:hover, .conversation-nav a.is-active { border-color: var(--line); background: var(--surface); }
.conversation-nav a.is-active { border-color: var(--blue); }
.conversation-nav a.is-active::before { position: absolute; top: 10px; bottom: 10px; left: -1px; width: 3px; border-radius: 0 2px 2px 0; background: var(--green); content: ""; }
.conversation-nav strong { display: -webkit-box; overflow: hidden; font-size: 0.9rem; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.conversation-nav span { color: var(--muted); font-size: 0.76rem; }
.back-link { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--blue-deep); font-weight: 750; }

.workspace-home {
  display: grid;
  width: min(100% - 48px, 1320px);
  grid-template-columns: minmax(0, 0.9fr) minmax(440px, 1.1fr);
  align-items: center;
  gap: clamp(36px, 6vw, 80px);
  margin: 0 auto;
  padding: clamp(44px, 7vw, 90px) 0;
}
.workspace-copy h1 { max-width: 10ch; }
.workspace-copy > p:not(.eyebrow) { max-width: 58ch; color: var(--muted); font-size: 1.08rem; }
.suggestion-section { margin-top: 30px; }
.suggestion-section h2 { margin-bottom: 14px; font-size: 1rem; line-height: 1.3; }
.suggestion-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.suggestion-grid form { min-width: 0; }
.suggestion-card {
  width: 100%;
  min-height: 100%;
  padding: 14px;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
  transition: border-color 0.18s ease-out, background 0.18s ease-out, box-shadow 0.18s ease-out;
}
.suggestion-card:hover { border-color: var(--blue); background: var(--surface-strong); box-shadow: 0 8px 22px oklch(31% 0.11 252 / 0.1); }
.suggestion-card:disabled { cursor: wait; opacity: 0.68; box-shadow: none; }
.diagnostic-board { position: relative; padding: clamp(20px, 3vw, 30px); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: radial-gradient(circle at 80% 16%, var(--board-glow), transparent 26%), var(--board-bg); box-shadow: var(--shadow); }
.diagnostic-flow { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.diagnostic-flow::before { position: absolute; inset: 50%; width: calc(100% - 74px); height: calc(100% - 74px); border: 2px solid oklch(66% 0.08 180 / 0.4); border-radius: 18px; content: ""; transform: translate(-50%, -50%); }
.diagnostic-flow article { position: relative; z-index: 1; display: grid; min-height: 138px; grid-template-columns: 34px 1fr; align-items: start; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); }
.diagnostic-flow article:nth-child(2) { border-color: oklch(68% 0.1 86 / 0.65); }
.diagnostic-flow article:nth-child(3) { border-color: oklch(61% 0.12 157 / 0.65); }
.diagnostic-flow article:nth-child(4) { border-color: oklch(58% 0.12 253 / 0.65); }
.diagnostic-flow article > span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: var(--paper-2); color: var(--blue-deep); font-size: 0.76rem; font-weight: 850; }
.diagnostic-flow strong { display: block; margin-bottom: 6px; font-size: 1.06rem; }
.diagnostic-flow p { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.45; }

.chat-shell { height: 100%; min-height: 0; }
.chat-sidebar { height: 100%; }
.chat-panel { display: grid; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; background: oklch(from var(--paper) l c h / 0.76); }
.conversation-header { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px clamp(20px, 4vw, 54px); border-bottom: 1px solid var(--line); background: var(--surface); }
.conversation-header .eyebrow { margin-bottom: 3px; }
.conversation-header h1 { max-width: 36ch; margin: 0; overflow-wrap: anywhere; font-size: clamp(1.25rem, 2.2vw, 1.75rem); line-height: 1.15; }
.conversation-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.conversation-actions form { margin: 0; }
.rename-panel { position: relative; }
.rename-panel summary { min-height: 46px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--button-secondary-bg); color: var(--blue-deep); font-weight: 750; list-style: none; cursor: pointer; }
.rename-panel summary::-webkit-details-marker { display: none; }
.rename-panel[open] .compact-form { display: grid; }
.compact-form { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; display: none; width: min(340px, calc(100vw - 32px)); grid-template-columns: 1fr auto; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--menu-bg); box-shadow: var(--shadow); }
.compact-form button { min-height: 48px; }
.message-stream { min-height: 0; overflow-y: auto; padding: 28px max(20px, 7vw) 12px; }
.message { max-width: 880px; margin: 0 auto 18px; padding: clamp(18px, 2.4vw, 26px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.message-user { border-color: oklch(61% 0.12 157 / 0.58); background: var(--surface-green); }
.message-role { display: block; margin-bottom: 12px; color: var(--blue-deep); font-size: 0.75rem; font-weight: 850; text-transform: uppercase; }
.message-user .message-role { color: var(--ink); }
.message-content { overflow-wrap: anywhere; line-height: 1.68; }
.message-content > :last-child { margin-bottom: 0; }
.message-content h1, .message-content h2, .message-content h3 { margin: 1.4em 0 0.55em; font-size: 1.15rem; line-height: 1.25; }
.message-content a { color: var(--blue-deep); text-decoration: underline; text-underline-offset: 3px; }
.message-content pre { max-width: 100%; overflow-x: auto; padding: 16px; border: 1px solid oklch(45% 0.03 246); border-radius: var(--radius); background: var(--code-bg); color: var(--code-text); line-height: 1.5; }
.message-content code { font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace; font-size: 0.9em; }
.message-content :not(pre) > code { padding: 2px 5px; border-radius: 4px; background: var(--paper-2); color: var(--blue-deep); }
.message-content table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.message-content th, .message-content td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; }
.message-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.copy-button { min-width: 94px; min-height: 44px; padding: 8px 14px; }
.pending-prompt { display: flex; width: min(100%, 880px); align-items: center; gap: 10px; margin: 0 auto 18px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-yellow); color: var(--ink); }
.pending-prompt p { margin: 0; font-weight: 700; }
.response-error { width: min(100%, 880px); margin: 0 auto 18px; padding: 16px 18px; border: 1px solid var(--danger-border); border-radius: var(--radius); background: var(--surface); color: var(--coral); }
.response-error p { margin: 0; font-weight: 700; }
.pending-prompt.response-error .status-dot { background: var(--coral); box-shadow: 0 0 0 4px oklch(67% 0.16 32 / 0.15); }
.chat-welcome { display: flex; min-height: 42vh; align-items: center; justify-content: center; gap: 10px; color: var(--muted); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px oklch(66% 0.15 157 / 0.15); }
.prompt-box { width: min(calc(100% - 40px), 880px); margin: 8px auto 18px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); box-shadow: 0 -16px 50px oklch(15% 0.025 246 / 0.12); color: var(--ink); }
.prompt-box textarea { min-height: 84px; max-height: 260px; border: 0; background: transparent; color: var(--ink); }
.prompt-box textarea::placeholder { color: var(--muted); }
.prompt-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 5px 4px 2px; }
.prompt-status { color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.prompt-box .primary-button { border-color: var(--green); background: var(--green); color: var(--on-green); box-shadow: none; }

.usage-shell { width: min(100% - 48px, 1320px); margin: 0 auto; padding: clamp(40px, 6vw, 76px) 0 80px; }
.usage-heading { display: flex; align-items: end; justify-content: space-between; gap: 32px; }
.usage-heading h1 { margin-bottom: 16px; font-size: clamp(2.5rem, 5vw, 4.5rem); }
.usage-heading p:not(.eyebrow) { max-width: 68ch; color: var(--muted); }
.usage-heading > .secondary-button { flex: 0 0 auto; margin-bottom: 18px; }
.usage-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-top: 30px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.usage-filters > div { display: grid; min-width: min(230px, 100%); gap: 5px; }
.usage-filters label { font-size: 0.82rem; font-weight: 800; }
.usage-period { margin: 14px 0 0; color: var(--muted); font-size: 0.88rem; }
.usage-summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 28px; }
.usage-card { display: grid; min-width: 0; min-height: 150px; align-content: space-between; gap: 10px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); box-shadow: 0 12px 30px oklch(31% 0.11 252 / 0.07); }
.usage-card-cost { border-color: oklch(61% 0.12 157 / 0.7); background: var(--surface-green); }
.usage-card span, .usage-card small { color: var(--muted); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; }
.usage-card strong { overflow-wrap: anywhere; font-size: clamp(1.45rem, 2.4vw, 2.15rem); line-height: 1.05; }
.usage-card .usage-card-date { font-size: 1.08rem; line-height: 1.25; }
.usage-section { margin-top: 42px; }
.usage-section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.usage-section-heading .eyebrow { margin-bottom: 3px; }
.usage-section-heading h2 { margin: 0; font-size: clamp(1.6rem, 2.6vw, 2.25rem); }
.usage-section-heading > span { color: var(--muted); font-size: 0.88rem; font-weight: 750; }
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-strong); }
.usage-table { width: 100%; min-width: 760px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.usage-conversation-table { min-width: 1380px; }
.usage-table th, .usage-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.usage-table th { position: sticky; top: 0; background: var(--paper-2); color: var(--blue-deep); font-size: 0.75rem; font-weight: 850; text-transform: uppercase; }
.usage-table tbody tr:last-child td { border-bottom: 0; }
.usage-table tbody tr:hover { background: var(--surface); }
.usage-table td { white-space: nowrap; }
.usage-table td:first-child { white-space: normal; }
.usage-state { display: block; margin-top: 3px; color: var(--muted); font-size: 0.74rem; font-weight: 750; text-transform: uppercase; }
.usage-model { max-width: 280px; overflow-wrap: anywhere; white-space: normal !important; }
.usage-empty { padding: 36px !important; color: var(--muted); text-align: center !important; }
.usage-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 18px; }
.usage-pagination span { color: var(--muted); font-size: 0.9rem; font-weight: 750; }

@media (min-width: 981px) {
  body.home-page { height: 100svh; overflow: hidden; }
  .home-page .site-main { height: calc(100svh - var(--header-height)); min-height: 0; overflow: hidden; }
  .home-page .app-shell { height: 100%; min-height: 0; }
}

@media (max-width: 1100px) {
  .workspace-home { grid-template-columns: 1fr; }
  .workspace-copy { max-width: 760px; }
  .workspace-copy h1 { max-width: 13ch; }
  .diagnostic-board { max-width: 760px; }
  .status-pill { display: none; }
  .usage-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  :root { --header-height: 70px; }
  .site-header { padding: 8px 16px; }
  .brand-logo img { width: 142px; }
  .brand-product small { display: none; }
  .nav-toggle { display: inline-grid; }
  .user-menu {
    position: fixed;
    inset: var(--header-height) 12px auto;
    z-index: 35;
    display: grid;
    gap: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--menu-bg);
    box-shadow: var(--shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.18s ease-out, transform 0.18s ease-out;
  }
  .user-menu.is-open { opacity: 1; pointer-events: auto; transform: translateY(0); }
  .user-menu > span, .user-menu a, .user-menu button { display: block; width: 100%; padding: 13px; text-align: left; }
  .user-menu a::after, .quiet-button::after { display: none; }
  .login-shell { grid-template-columns: 1fr; }
  .login-copy { max-width: 760px; }
  .login-copy h1 { max-width: 13ch; }
  .access-board { width: min(100%, 620px); }
  .app-shell { position: relative; grid-template-columns: 1fr; }
  .sidebar-toggle { display: flex; position: sticky; z-index: 12; top: var(--header-height); justify-content: space-between; border-width: 0 0 1px; border-radius: 0; background: var(--menu-bg); }
  .conversation-sidebar {
    position: static;
    z-index: 11;
    display: none;
    max-height: min(60svh, 520px);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
  }
  .conversation-sidebar.is-open { display: block; }
  .chat-shell { height: 100%; min-height: 0; grid-template-rows: auto auto minmax(0, 1fr); }
  .chat-shell > .sidebar-toggle { position: static; top: auto; grid-row: 1; }
  .chat-shell > .chat-sidebar { grid-row: 2; }
  .chat-shell > .chat-panel { min-height: 0; grid-row: 3; }
}

@media (max-width: 680px) {
  body {
    background:
      linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 48px 48px,
      linear-gradient(0deg, var(--grid-line-strong) 1px, transparent 1px) 0 0 / 48px 48px,
      var(--paper);
  }
  .brand { gap: 8px; }
  .brand-logo img { width: 120px; }
  .brand-product { padding-left: 8px; }
  .brand-product strong { font-size: 0.76rem; }
  .header-actions { gap: 6px; }
  .theme-toggle, .nav-toggle { width: 42px; height: 42px; }
  .login-shell { width: min(100% - 28px, var(--max)); padding: 38px 0 50px; }
  .login-copy h1 { max-width: 100%; font-size: clamp(2.55rem, 12vw, 3.15rem); }
  .login-lede { font-size: 1rem; }
  .login-flow { gap: 8px; }
  .login-flow i { width: 18px; }
  .access-board { padding: 14px; }
  .board-topline { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .access-card { padding: 18px; }
  .access-signal { align-items: flex-start; flex-direction: column; }
  .notices { position: static; width: calc(100% - 24px); max-width: none; margin: 12px auto; }
  .chat-page .notices { position: fixed; top: calc(var(--header-height) + 8px); right: 12px; width: calc(100% - 24px); margin: 0; }
  .workspace-home { width: min(100% - 28px, 1320px); padding: 42px 0 60px; }
  .workspace-copy h1 { max-width: 100%; font-size: clamp(2.6rem, 12vw, 3.2rem); }
  .suggestion-grid { grid-template-columns: 1fr; }
  .diagnostic-flow { grid-template-columns: 1fr; }
  .diagnostic-flow::before { top: 18px; bottom: 18px; left: 16px; width: 2px; height: auto; border: 0; border-radius: 0; background: linear-gradient(180deg, var(--blue), var(--green), var(--yellow), var(--coral)); transform: none; }
  .diagnostic-flow article { min-height: auto; }
  .diagnostic-signal { align-items: flex-start; flex-direction: column; }
  .conversation-header { align-items: flex-start; flex-direction: column; padding: 16px; }
  .conversation-header h1 { max-width: 100%; }
  .conversation-actions { width: 100%; justify-content: space-between; }
  .message-stream { padding: 18px 12px 8px; }
  .message { padding: 17px; }
  .prompt-box { position: sticky; bottom: 0; width: 100%; margin: 0; border-right: 0; border-bottom: 0; border-left: 0; }
  .chat-welcome { min-height: 34vh; padding: 24px; text-align: center; }
  .usage-shell { width: min(100% - 28px, 1320px); padding: 38px 0 60px; }
  .usage-heading { align-items: stretch; flex-direction: column; gap: 8px; }
  .usage-heading h1 { font-size: clamp(2.55rem, 12vw, 3.2rem); }
  .usage-heading > .secondary-button { align-self: flex-start; margin-bottom: 0; }
  .usage-filters { align-items: stretch; flex-direction: column; padding: 14px; }
  .usage-filters > div, .usage-filters > button, .usage-filters > a { width: 100%; }
  .usage-summary-grid { grid-template-columns: 1fr; }
  .usage-card { min-height: 128px; }
  .usage-section-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .usage-pagination { align-items: stretch; flex-direction: column; text-align: center; }
}

@media (max-width: 420px) {
  .brand-product { display: none; }
  .conversation-actions { align-items: stretch; flex-direction: column; }
  .conversation-actions > form, .conversation-actions .danger-button, .rename-panel, .rename-panel summary { width: 100%; }
  .compact-form { right: auto; left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
    animation-duration: 1ms !important;
  }
}
