/* Ocean: light interface with a deep ocean blue accent. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --surface: #F6F8FB;
  --surface-2: #EEF2F8;
  --ink: #0B1A33;
  --ink-soft: #5B6B86;
  --ink-faint: #8A97AD;
  --line: #E3E8F2;
  --accent: #1F5EFF;
  --accent-strong: #1546D6;
  --accent-wash: #E8EFFF;
  --danger: #D93B3B;
  --danger-wash: #FDECEC;
  --code-bg: #0F1B30;
  --code-ink: #E6ECF7;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 22px;
  --shadow-composer: 0 1px 2px rgba(11, 26, 51, .04), 0 8px 28px rgba(11, 26, 51, .07);
  --shadow-pop: 0 10px 40px rgba(11, 26, 51, .14);
  --sidebar-w: 272px;
  --read-w: 760px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace; }

/* --- Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px;
  padding: 10px 18px; font-weight: 550; font-size: 15px;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-primary:disabled { background: #B9C8EE; cursor: not-allowed; }
.btn-ghost { background: var(--bg); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface); }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.link-button.small { font-size: 13px; color: var(--ink-soft); text-decoration: none; }
.link-button.small:hover { color: var(--ink); }

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

/* --- Sign in ---------------------------------------------------------------- */

.auth {
  min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, var(--accent-wash), var(--bg) 70%);
}
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 24px; font-weight: 650; letter-spacing: -.02em; margin-bottom: 24px; }
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow-composer);
  display: flex; flex-direction: column;
}
.auth-card h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.015em; }
.auth-card > .muted { margin: 0 0 18px; }
.auth-card label { font-size: 13px; font-weight: 550; margin: 12px 0 6px; }
.auth-card input:not([type=checkbox]) {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 11px 12px; background: var(--bg);
}
.auth-card input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.auth-card .btn-primary { margin-top: 18px; }
.auth-card .link-button { margin-top: 14px; align-self: center; font-size: 13px; }
.hint { font-size: 13px; color: var(--ink-soft); margin: 6px 0 0; }
.error { color: var(--danger); background: var(--danger-wash); border-radius: var(--radius-sm); padding: 8px 12px; margin: 14px 0 0; font-size: 14px; }
.qr { align-self: center; margin: 4px 0 8px; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; }
.secret { display: block; background: var(--surface); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 14px; word-break: break-all; }
.recovery-list {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px;
  background: var(--surface); border-radius: var(--radius); margin: 0 0 14px;
  padding: 12px 12px 12px 2.6em;
  font-family: ui-monospace, Consolas, monospace; font-size: 14px;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 450 !important; margin-top: 16px !important; }

/* --- App layout --------------------------------------------------------------- */

.app {
  height: 100%;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
}
.app.collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.app.collapsed .sidebar { visibility: hidden; }
.only-collapsed { display: none; }
.app.collapsed .only-collapsed { display: inline-grid; }
#open-sidebar { display: none; }
.app.collapsed #open-sidebar { display: inline-grid; }

/* Sidebar */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0; overflow: hidden;
  padding: 12px 10px;
}
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 650; font-size: 18px; letter-spacing: -.02em; }
.new-chat {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); background: var(--bg);
  border-radius: var(--radius); padding: 9px 12px; font-weight: 550;
}
.new-chat:hover { border-color: #C9D5EC; }
.new-chat svg { color: var(--accent); }
.search {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0 6px; padding: 0 10px;
  border-radius: var(--radius); background: var(--surface-2);
  color: var(--ink-soft);
}
.search svg { width: 17px; height: 17px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 9px 0; outline: none; }
.search:focus-within { box-shadow: 0 0 0 2px var(--accent); }

.chat-list { flex: 1; overflow-y: auto; margin: 6px -4px 0; padding: 0 4px; }
.chat-group { font-size: 12px; font-weight: 600; color: var(--ink-faint); padding: 14px 10px 4px; }
.chat-item {
  display: flex; align-items: center; gap: 6px; width: 100%;
  border: 0; background: none; text-align: left;
  border-radius: 10px; padding: 7px 10px; font-size: 14px; color: var(--ink);
}
.chat-item span.title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item:hover { background: var(--surface-2); }
.chat-item[aria-current="true"] { background: var(--accent-wash); color: var(--accent-strong); font-weight: 550; }
.chat-item .open-tag { font-size: 11px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 999px; padding: 0 6px; }
.chat-list-empty { color: var(--ink-faint); font-size: 13px; padding: 12px 10px; margin: 0; }
mark { background: #FFE9A8; color: inherit; border-radius: 3px; padding: 0 1px; }

.side-foot { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 6px; }
.side-row { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 8px 10px; border-radius: 10px; font-size: 14px; color: var(--ink-soft); }
.side-row:hover { background: var(--surface-2); color: var(--ink); }
.side-row svg { width: 18px; height: 18px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 600; font-size: 13px;
}
.me-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.scrim { position: fixed; inset: 0; background: rgba(11, 26, 51, .32); z-index: 20; }

/* Main column */
.main {
  min-width: 0; min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  position: relative;
}
.topbar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px; min-height: 56px;
}
.chat-title { flex: 1; min-width: 0; margin: 0 4px; font-size: 15px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 6px; position: relative; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--bg);
  border-radius: 999px; padding: 5px 11px 5px 9px; font-size: 13px; font-weight: 550; color: var(--ink-soft);
}
.pill svg { width: 15px; height: 15px; }
.pill[aria-pressed="true"] { background: var(--accent-wash); border-color: transparent; color: var(--accent-strong); }
.route {
  border: 1px solid var(--line); background: var(--bg);
  border-radius: 999px; padding: 5px 28px 5px 12px; font-size: 13px; font-weight: 550;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235B6B86' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px;
  max-width: 170px;
}

.menu {
  position: absolute; top: 42px; right: 40px; z-index: 30;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-pop); padding: 6px; min-width: 150px;
  display: flex; flex-direction: column;
}
.menu button { border: 0; background: none; text-align: left; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.menu button:hover { background: var(--surface); }
.menu .danger { color: var(--danger); }

.gauge { position: relative; width: 36px; height: 36px; border: 0; background: none; padding: 0; display: grid; place-items: center; border-radius: 50%; }
.gauge:hover { background: var(--surface-2); }
.gauge svg { position: absolute; inset: 0; width: 36px; height: 36px; transform: rotate(-90deg); }
.gauge-track { stroke: var(--line); stroke-width: 3; }
.gauge-fill { stroke: var(--accent); stroke-width: 3; stroke-linecap: butt; stroke-dasharray: 87.96; stroke-dashoffset: 87.96; transition: stroke-dashoffset .5s ease; }
.gauge[data-level="high"] .gauge-fill { stroke: var(--danger); }
.gauge-text { font-size: 9.5px; font-weight: 650; color: var(--ink-soft); }

/* Scrolling area */
.scroller { overflow-y: auto; min-height: 0; padding: 0 16px; }
.messages { max-width: var(--read-w); margin: 0 auto; padding: 8px 0 24px; }

/* Start screen: the composer sits in the middle, under the greeting */
.welcome { display: none; }
.main.is-empty .welcome {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  text-align: center; height: 100%; padding: 0 0 28px;
}
.main.is-empty .scroller { overflow: hidden; }
.main.is-empty .dock { padding-bottom: max(12vh, 40px); }
.welcome-logo { margin-bottom: 14px; filter: drop-shadow(0 6px 16px rgba(31, 94, 255, .28)); }
.greeting { margin: 0; font-size: clamp(28px, 4.2vw, 40px); font-weight: 650; letter-spacing: -.03em; line-height: 1.15; }
.welcome-sub { margin: 8px 0 0; font-size: 18px; color: var(--ink-soft); }

/* --- Messages --------------------------------------------------------------------- */

.msg { margin: 22px 0; }
.msg-user { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-user .bubble {
  max-width: min(85%, 620px);
  background: var(--surface-2); border-radius: 20px 20px 6px 20px;
  padding: 10px 16px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-user .files { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.msg-tools { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-tools, .msg:focus-within .msg-tools, .msg.last .msg-tools { opacity: 1; }
@media (hover: none) { .msg-tools { opacity: 1; } }
.tool {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none; color: var(--ink-faint);
  padding: 5px 8px; border-radius: 8px; font-size: 13px;
}
.tool svg { width: 16px; height: 16px; }
.tool:hover { background: var(--surface-2); color: var(--ink); }

.msg-bot { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 0 14px; }
.msg-bot .who { width: 30px; height: 30px; border-radius: 50%; margin-top: 2px; }
.msg-bot .content { min-width: 0; }

.edit-box { width: min(100%, 620px); display: flex; flex-direction: column; gap: 8px; }
.edit-box textarea {
  width: 100%; min-height: 80px; resize: vertical;
  border: 1px solid var(--accent); border-radius: 16px; padding: 10px 14px; outline: none;
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.edit-box .row { justify-content: flex-end; }
.edit-box .btn { padding: 7px 14px; font-size: 14px; }

/* Rendered markdown */
.md { overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h1, .md h2, .md h3, .md h4 { letter-spacing: -.015em; line-height: 1.3; margin: 22px 0 8px; }
.md h1 { font-size: 22px; }
.md h2 { font-size: 18px; }
.md h3 { font-size: 16px; }
.md h4 { font-size: 15px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 4px 0; }
.md li::marker { color: var(--accent); }
.md strong { font-weight: 650; }
.md a { text-decoration: underline; text-decoration-color: rgba(31, 94, 255, .35); text-underline-offset: 3px; }
.md a:hover { text-decoration-color: var(--accent); }
.md blockquote { margin: 0 0 12px; padding: 4px 0 4px 14px; border-left: 3px solid var(--accent); color: var(--ink-soft); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.md :not(pre) > code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .88em;
  background: var(--surface-2); border-radius: 5px; padding: 1px 5px;
}
.md .table-wrap { overflow-x: auto; margin: 0 0 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.md table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md th, .md td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.md th { background: var(--surface); font-weight: 600; }
.md tr:last-child td { border-bottom: 0; }
.md img { max-width: 100%; }

.codeblock { margin: 0 0 14px; border-radius: var(--radius); overflow: hidden; background: var(--code-bg); }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; background: #17263F; color: #A9B7CF; font-size: 12px; }
.code-head .tool { color: #A9B7CF; padding: 3px 8px; }
.code-head .tool:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.codeblock pre { margin: 0; padding: 14px; overflow-x: auto; }
.codeblock code { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace; font-size: 13px; line-height: 1.55; color: var(--code-ink); white-space: pre; }

.picture { margin: 0 0 12px; }
.picture img { display: block; max-width: min(100%, 512px); border-radius: var(--radius); border: 1px solid var(--line); }
.picture figcaption { margin-top: 6px; font-size: 13px; }

.research { margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 13px; }
.research summary { cursor: pointer; padding: 8px 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; list-style: none; }
.research summary::-webkit-details-marker { display: none; }
.research summary svg { width: 16px; height: 16px; color: var(--accent); }
.research summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg); transition: transform .15s; }
.research[open] summary::after { transform: rotate(-135deg); }
.research ul { margin: 0; padding: 0 12px 10px 32px; color: var(--ink-soft); }
.research li { margin: 3px 0; overflow-wrap: anywhere; }

.thinking { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); padding-top: 4px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: bob 1.1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.msg-error { color: var(--danger); background: var(--danger-wash); border-radius: var(--radius); padding: 10px 14px; font-size: 14px; }

/* --- Composer ---------------------------------------------------------------------- */

.dock { padding: 0 16px 14px; }
.composer {
  max-width: var(--read-w); margin: 0 auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-composer);
  padding: 10px 10px 8px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.composer:focus-within { border-color: #BFD0FF; box-shadow: var(--shadow-composer), 0 0 0 3px var(--accent-wash); }
.composer.dragging { border-color: var(--accent); border-style: dashed; }
.composer textarea {
  display: block; width: 100%; border: 0; outline: none; resize: none; background: none;
  font-size: 16px; line-height: 1.5; padding: 4px 2px; max-height: 40vh;
}
.composer textarea::placeholder { color: var(--ink-faint); }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.composer-left, .composer-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.modes { display: flex; gap: 6px; margin-left: 4px; overflow-x: auto; scrollbar-width: none; }
.modes::-webkit-scrollbar { display: none; }
.mode {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  border: 1px solid var(--line); background: var(--bg);
  border-radius: 999px; padding: 5px 12px 5px 9px; font-size: 13px; font-weight: 550; color: var(--ink-soft);
}
.mode svg { width: 16px; height: 16px; }
.mode:hover { border-color: #C9D5EC; color: var(--ink); }
.mode[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-strong); }

.send {
  width: 38px; height: 38px; border-radius: 50%; border: 0;
  background: var(--accent); color: #fff; display: grid; place-items: center;
}
.send svg { stroke-width: 2.2; }
.send:hover { background: var(--accent-strong); }
.send:disabled { background: #C7D3F0; cursor: not-allowed; }
.mic.recording { background: var(--danger-wash); color: var(--danger); }
.mic.busy { opacity: .5; pointer-events: none; }
.rec-time { font-size: 13px; font-variant-numeric: tabular-nums; color: var(--danger); font-weight: 600; }

.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 8px; }
.file-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 260px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; padding: 6px 6px 6px 8px; font-size: 13px;
}
.file-chip .ficon { width: 28px; height: 28px; border-radius: 7px; background: var(--accent-wash); color: var(--accent); display: grid; place-items: center; flex: none; }
.file-chip .ficon svg { width: 16px; height: 16px; }
.file-chip .fmeta { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.file-chip .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.file-chip .fsub { font-size: 12px; color: var(--ink-faint); }
.file-chip.failed { border-color: #F3C2C2; background: var(--danger-wash); }
.file-chip.failed .fsub { color: var(--danger); }
.file-chip .remove { width: 24px; height: 24px; border-radius: 6px; }
.file-chip .remove svg { width: 14px; height: 14px; }
a.file-chip { color: var(--ink); text-decoration: none; }
a.file-chip:hover { border-color: #C9D5EC; }

.suggestions {
  max-width: var(--read-w); margin: 14px auto 0;
  display: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
}
.main.is-empty .suggestions { display: grid; }
.suggestion {
  text-align: left; border: 1px solid var(--line); background: var(--bg);
  border-radius: var(--radius); padding: 12px 14px; font-size: 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.suggestion:hover { background: var(--surface); border-color: #C9D5EC; }
.suggestion strong { font-weight: 600; }
.suggestion span { color: var(--ink-soft); font-size: 13px; }

.status { max-width: var(--read-w); margin: 8px auto 0; text-align: center; font-size: 12.5px; color: var(--ink-faint); min-height: 1em; }
.status:empty { display: none; }

/* --- Usage panel --------------------------------------------------------------------- */

.usage-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 40;
  width: min(380px, 100%); overflow-y: auto;
  background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop);
  padding: 16px 18px 24px;
}
.usage-head { display: flex; align-items: center; justify-content: space-between; }
.usage-head h2 { margin: 0; font-size: 17px; }
.usage-sub { font-size: 14px; margin: 22px 0 8px; }
.provider { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 10px 0; }
.provider-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.provider-name { font-weight: 600; }
.provider-tag { font-size: 11px; color: var(--danger); background: var(--danger-wash); border-radius: 999px; padding: 1px 8px; }
.provider-model { font-size: 12px; color: var(--ink-faint); overflow-wrap: anywhere; }
.provider-off, .provider-note { font-size: 12.5px; color: var(--ink-soft); margin: 8px 0 0; }
.bar-row { margin-top: 8px; }
.bar-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-soft); }
.bar { height: 6px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 4px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar span.high { background: var(--danger); }
.history { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 6px; }
.history-day { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.history-bar { width: 100%; min-height: 2px; background: var(--accent); border-radius: 5px 5px 2px 2px; opacity: .85; }
.history-label { font-size: 11px; color: var(--ink-faint); }

.small-btn { padding: 8px 14px; font-size: 14px; margin-top: 4px; }
.pair-box { margin-top: 14px; padding: 14px; border-radius: var(--radius); background: var(--accent-wash); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pair-code { font-family: ui-monospace, Consolas, monospace; font-size: 28px; font-weight: 700; letter-spacing: .12em; color: var(--accent-strong); }
.device { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 8px 0; }
.device-name { font-weight: 600; }
.device-meta { font-size: 12px; color: var(--ink-faint); }
.device button { color: var(--danger); }

/* --- Phone and small tablets ------------------------------------------------------------- */

@media (max-width: 860px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
    width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .2s ease;
    visibility: visible !important;
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-pop); }
  #open-sidebar { display: inline-grid; }
  #collapse-sidebar { display: none; }
  .only-collapsed { display: inline-grid; }
  .topbar { padding: 8px 8px; }
  .route { max-width: 120px; }
  .msg-bot { grid-template-columns: minmax(0, 1fr); }
  .msg-bot .who { display: none; }
  .suggestions { grid-template-columns: minmax(0, 1fr); }
  .suggestion:nth-child(n+3) { display: none; }
  .main.is-empty .dock { padding-bottom: 24px; }
}
@media (max-width: 480px) {
  .mode span { display: none; }
  .mode { padding: 6px 8px; }
  #private-label { display: none; }
  .chat-title { visibility: hidden; }
  .pill { padding: 6px 8px; }
  .scroller, .dock { padding-left: 12px; padding-right: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
.device .link-button.small { color: var(--danger); }
