/* Sigma / folded-line interface. Rich document styles remain in styles.css. */
:root {
  --paper: #f7f5f1; --rail: #efede8; --card: #fcfaf7; --card-soft: #f2f0ea;
  --border: #e3dfd7; --border-strong: #ccc6ba; --ink: #2a2721;
  --muted: #7c7669; --faint: #98917f; --accent: #c7673e; --accent-ink: #a34e28;
  --accent-soft: #c7673e14; --on-accent: #fdfaf6; --code-bg: #efece5;
  --cache: #4b8c85; --radius: 14px; --rail-w: 246px; --topbar-h: 64px;
  --sans: 'Segoe UI Variable Text', 'Segoe UI', system-ui, sans-serif;
  --shadow: 0 4px 24px #2f241805; --shadow-lg: 0 24px 80px #20171326;
}
[data-theme="dark"] {
  color-scheme: dark;
  --paper: #181511; --rail: #131110; --card: #211d19; --card-soft: #1c1915;
  --border: #322c25; --border-strong: #4a4136; --ink: #ede7dd;
  --muted: #a79d8e; --faint: #8b8272; --accent: #d98a5b; --accent-ink: #e29d70;
  --accent-soft: #d98a5b17; --on-accent: #261a10; --code-bg: #23201a;
  --cache: #87bdb2; --shadow: 0 8px 36px #00000012; --shadow-lg: 0 24px 80px #0006;
}
@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    color-scheme: dark;
    --paper: #181511; --rail: #131110; --card: #211d19; --card-soft: #1c1915;
    --border: #322c25; --border-strong: #4a4136; --ink: #ede7dd;
    --muted: #a79d8e; --faint: #8b8272; --accent: #d98a5b; --accent-ink: #e29d70;
    --accent-soft: #d98a5b17; --on-accent: #261a10; --code-bg: #23201a;
    --cache: #87bdb2; --shadow: 0 8px 36px #00000012; --shadow-lg: 0 24px 80px #0006;
  }
}
.app { height: var(--app-h, 100dvh); }
/* Interface zoom: scales the whole shell plus top-layer surfaces (dialogs,
   toasts, banner, login). --app-h is divided by the factor in JS so nothing
   is pushed off-screen. */
.app, .dlg, .toasts, .push-banner, .login-screen { zoom: var(--ui-zoom, 1); }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { transition: color 150ms, background-color 150ms, border-color 150ms; }
button:active:not(:disabled) { filter: brightness(.94); }
.rail { padding: 26px 16px 16px; gap: 6px; }
.rail-head { padding: 0 10px 27px; align-items: center; }
.brand-row { gap: 11px; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  color: var(--on-accent); font-family: var(--serif); font-size: 16px;
  display: grid; place-items: center; line-height: 1;
}
.brand-word { font-size: 13px; font-weight: 600; letter-spacing: .22em; line-height: 1; }
.new-thread { border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: var(--card); font-size: 12px; }
.new-thread .kbd { border: 0; background: none; padding: 0; font-size: 9px; opacity: .8; }
.rail-search { border: 0; background: none; padding: 9px 10px; font-size: 12px; }
.rail-search .kbd { border: 0; background: none; font-size: 9px; }
.focus-pills { margin: 23px 0 10px; padding: 0; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: none; gap: 16px; }
.focus-pill { position: relative; border-radius: 0; padding: 9px 5px 13px; font-size: 12px; }
.focus-pill[aria-pressed="true"] { background: none; box-shadow: none; }
.focus-pill::after { content: ''; position: absolute; bottom: -1px; left: 8px; right: 8px; height: 2px; background: var(--accent); transform: scaleX(0); transition: transform 180ms ease; }
.focus-pill[aria-pressed="true"]::after { transform: scaleX(1); }
.thread-group-label { padding: 24px 9px 8px; letter-spacing: .13em; font: 9px var(--mono); overflow-wrap: anywhere; }
.thread-item { min-height: 37px; border-radius: 5px; font-size: 12px; margin-bottom: 2px; }
.thread-item.active { box-shadow: none; background: var(--accent-soft); }
.thread-item.active::before { content: ''; position: absolute; left: 0; height: 13px; width: 2px; background: var(--accent); }
.thread-item .t-open { padding: 6px 8px; }
.thread-actions { background: var(--card); border-radius: 4px; }
.threads-empty { font-size: 11px; padding: 20px 9px; }
.rail-foot { padding-top: 16px; border-top: 1px solid var(--border); }
.conn-card { border: 0; background: none; border-radius: 6px; padding: 10px 8px; }
.conn-name { font-size: 11px; font-weight: 500; }
.conn-status { font-size: 10px; }
.conn-dot { width: 5px; height: 5px; }
.rail-tools { gap: 6px; }
.rail-tools .ghost-btn { border: 0; text-align: left; padding: 9px 8px; font-size: 11px; }
.rail-tools button:hover, .rail-tools button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.topbar { padding: 0 32px; height: var(--topbar-h); flex: 0 0 var(--topbar-h); border-bottom-color: transparent; }
.crumb { font-size: 11px; gap: 12px; }
.crumb-sep { color: var(--border-strong); }
#crumb-title { font-weight: 400; }
.topbar-actions { gap: 6px; }
.icon-btn { width: 30px; height: 30px; border-radius: 6px; }
.icon-btn .icon { width: 16px; height: 16px; }
.statusbar { border: 0; justify-content: flex-end; padding: 9px 32px; height: 32px; letter-spacing: .02em; font: 10px var(--sans); opacity: .8; }
.landing-inner { max-width: 780px; padding: 42px 48px 90px; align-items: center; text-align: center; }
.landing-heading { display: flex; flex-direction: column; align-items: center; padding: 0 0 36px; }
.section-index { display: block; font: 9px var(--mono); letter-spacing: .16em; color: var(--muted); }
.landing-title { font-size: clamp(28px, 3vw, 39px); font-weight: 450; letter-spacing: -.045em; margin: 14px 0 0; }
.title-period { color: var(--accent); }
.sigma-mark { width: 72px; height: 72px; margin: 0 0 20px; color: var(--accent); }
.sigma-mark path { stroke-dasharray: 300; stroke-dashoffset: 0; animation: fold-draw 1100ms ease-out both; }
.sigma-mark .orbit-b { animation-delay: 110ms; }
.sigma-mark .sigma-glyph { animation-delay: 220ms; }
.composer { border-radius: 14px; padding: 0; gap: 0; border: 1px solid var(--border-strong); background: var(--card); box-shadow: var(--shadow); overflow: visible; transition: border-color 180ms, box-shadow 180ms; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, var(--border-strong)); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.composer textarea { padding: 14px 16px 4px; min-height: 46px; font-size: 15px; line-height: 1.65; }
.composer textarea::placeholder { color: var(--faint); }
.composer-att { padding: 0 14px; }
.composer-att:not(:empty) { padding-top: 10px; }
.att-thumb { width: 22px; height: 22px; object-fit: cover; border-radius: 4px; display: block; }
.composer-bar { gap: 6px; min-height: 44px; padding: 4px 10px 8px; flex-wrap: nowrap; }
.chip-btn { border: 0; border-radius: 5px; padding: 6px; gap: 7px; background: transparent; font-size: 11px; }
.chip-btn:hover { background: var(--accent-soft); }
.model-btn { max-width: 42%; padding: 5px 6px; color: var(--ink); font-size: 12px; }
.model-btn:hover { background: var(--accent-soft); color: var(--accent); }
.model-static { display: inline-flex; align-items: center; cursor: default; color: var(--ink); font-size: 12px; }
.model-static:hover { background: transparent; }
.model-label { max-width: 240px; }
.model-indicator { width: 9px; height: 9px; background: linear-gradient(135deg, var(--accent) 45%, transparent 45%, transparent 55%, var(--accent) 55%); flex: none; opacity: .9; }
.selector-chevron { margin-left: auto; font-size: 14px; line-height: 1; color: var(--muted); flex: none; }
.composer-workspace { display: flex; align-items: center; gap: 7px; max-width: 26%; border: 0; background: none; color: var(--muted); padding: 5px 0; font-size: 11px; cursor: pointer; }
.composer-workspace .icon { width: 13px; height: 13px; }
.workspace-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-workspace:hover { color: var(--accent); }
.mode-btn { max-width: 160px; font-size: 11px; }
.send-btn { border-radius: 8px; width: 32px; height: 32px; }
.send-btn .icon { width: 15px; height: 15px; }
.composer-shortcuts { display: flex; justify-content: flex-end; gap: 18px; margin: 14px 4px 0; color: var(--faint); font-size: 10px; }
.composer-shortcuts kbd { font: 10px var(--mono); margin-right: 4px; }
.workdir-hint { border: 0; background: none; padding: 0 0 14px; font-size: 12px; }
.workdir-note { display: none; }
.workdir-hint .primary-btn { background: none; border: 1px dashed var(--border-strong); color: var(--muted); width: 100%; padding: 12px; }
.composer-slot.docked { padding-bottom: 18px; }
.docked .composer textarea { min-height: 44px; }
.chat-inner { padding-top: 36px; }
.msg { margin-bottom: 30px; }
.msg-role { font-size: 11px; }
/* Floating selectors never participate in layout. */
.slash-menu { left: 0; right: auto; width: min(380px, 100%); border-radius: 10px; border: 1px solid var(--border-strong); background: var(--card); padding: 6px; box-shadow: var(--shadow-lg); animation: panel-enter 150ms ease-out; }
.slash-item { border-radius: 5px; padding: 10px 12px; font-size: 12px; }
.slash-item:hover, .slash-item:focus-visible { background: var(--accent-soft); }
.cmd-desc { font-size: 10px; color: var(--muted); }
.model-menu {
  left: 10px; right: auto; width: max-content; min-width: 108px;
  height: auto; max-height: none; padding: 4px; z-index: 50;
}
.composer-slot:not(.docked) .slash-menu { top: calc(100% + 6px); bottom: auto; }
.composer-slot:not(.docked) .model-menu { top: calc(100% + 8px); bottom: auto; }
.model-menu-heading { padding: 5px 10px 9px; font: 10px var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.model-menu .palette-input { padding: 10px; font-size: 12px; border-radius: 5px; background: var(--paper); border: 1px solid var(--border); flex: none; }
.model-options { min-height: 0; flex: none; overflow: visible; padding-top: 0; }
.model-menu .slash-item {
  position: relative; flex-direction: row; align-items: center; gap: 8px;
  padding: 6px 22px 6px 10px; font-size: 12px; width: 100%;
}
.model-menu .slash-item .cmd-name { font-family: inherit; font-size: 12px; color: inherit; }
.model-menu .slash-item[aria-selected="true"],
.model-menu .slash-item[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.model-menu .slash-item[aria-selected="true"]::after,
.model-menu .slash-item[aria-pressed="true"]::after { content: '✓'; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; }
.project-control { position: relative; }
.project-filter { width: 100%; display: flex; align-items: center; gap: 9px; border: 0; background: none; padding: 10px 8px; color: var(--muted); cursor: pointer; margin: 0; }
.project-filter > span:first-of-type { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-filter .icon { width: 14px; height: 14px; }
.project-filter:hover { color: var(--ink); }
.project-menu { position: absolute; left: 0; top: calc(100% + 4px); width: min(330px, calc(100vw - 36px)); z-index: 60; background: var(--card); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px; animation: panel-enter 150ms ease-out; }
.project-menu .palette-input { font-size: 12px; padding: 9px; border: 1px solid var(--border); background: var(--paper); border-radius: 5px; }
.project-options { height: 220px; overflow-y: auto; scrollbar-gutter: stable; padding: 6px 0; }
.project-option { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; border-radius: 5px; background: none; text-align: left; padding: 10px; cursor: pointer; }
.project-option > span { min-width: 0; }
.project-option strong { display: block; font-size: 12px; font-weight: 500; }
.project-option small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 9px var(--mono); color: var(--muted); margin-top: 3px; }
.project-option:hover, .project-option[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.project-browse { display: flex; gap: 8px; align-items: center; background: none; border: 0; border-top: 1px solid var(--border); width: 100%; padding: 12px 10px 6px; cursor: pointer; font-size: 12px; }
/* Fixed frames: only their contents scroll, not the dialog or page geometry. */
.dlg { border-radius: 14px; }
.dlg[open] { animation: panel-enter 180ms ease-out; }
.dlg::backdrop { background: #09070f70; backdrop-filter: blur(5px); }
#settings-dialog { width: min(900px, calc(100vw - 48px)); max-width: none; height: min(720px, calc(100dvh - 56px)); max-height: none; overflow: hidden; }
#settings-dialog > div { display: flex; flex-direction: column; height: 100%; }
#settings-dialog > div > div:first-child { flex: 0 0 42px; }
.settings-wrap { min-height: 0; flex: 1; overflow: hidden; }
.settings-nav { width: 176px; padding: 20px 14px; gap: 6px; }
.settings-nav button { font-size: 12px; padding: 10px 12px; border-radius: 6px; }
.settings-pane { min-width: 0; min-height: 0; max-height: none; padding: 20px 32px 36px; overflow-y: auto; scrollbar-gutter: stable; animation: pane-in 140ms ease-out; }
.settings-pane h2 { font-size: 24px; font-weight: 450; letter-spacing: -.04em; margin-bottom: 10px; }
.settings-pane h3 { font-size: 12px; font-weight: 500; margin-top: 26px; }
.set-row { padding: 15px 0; gap: 24px; }
.set-row .set-label { font-size: 12px; }
.set-row .set-label small { font-size: 11px; line-height: 1.6; margin-top: 5px; max-width: 270px; }
.set-row .set-ctl { max-width: 260px; min-width: 0; }
.text-input, .dlg textarea.text-input { border-radius: 6px; background: var(--card-soft); border-color: var(--border); }
.ghost-btn, .primary-btn { border-radius: 6px; font-size: 12px; padding: 8px 12px; }
.ghost-btn { border-color: var(--border); }
.extension-card { border-radius: 8px; background: var(--card-soft); padding: 8px 16px 14px; }
.extension-card .set-row:first-child { border-bottom-color: transparent; }
#folder-dialog { width: min(760px, calc(100vw - 48px)); max-width: none; height: min(640px, calc(100dvh - 56px)); max-height: none; overflow: hidden; }
.folder-card { height: 100%; min-height: 0; padding: 26px; gap: 12px; }
.folder-card h2 { font-size: 22px; font-weight: 450; letter-spacing: -.035em; }
.native-browse { display: flex; align-items: center; gap: 8px; align-self: flex-start; }
.folder-list { flex: 1; min-height: 0; max-height: none; overflow-y: auto; border-radius: 6px; scrollbar-gutter: stable; }
.folder-recent { flex: 0 0 84px; max-height: 84px; }
.folder-name { font-family: var(--sans); font-size: 12px; }
.folder-card .dlg-actions { flex: none; margin: 0; padding-top: 8px; }
.drawer { position: fixed; right: 18px; top: 68px; bottom: 18px; width: min(370px, calc(100vw - 36px)); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 35; animation: panel-enter 180ms ease-out; }
/* Observatory */
.usage-page { flex: 1; min-height: 0; overflow-y: auto; scrollbar-gutter: stable; }
.usage-content { max-width: 1260px; margin: 0 auto; padding: 30px 40px 40px; }
.usage-head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 18px; margin-bottom: 30px; }
.usage-head h1 { margin: 10px 0 0; font-size: 36px; letter-spacing: -.05em; font-weight: 400; line-height: 1.2; }
.usage-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.segmented { display: flex; border: 1px solid var(--border); border-radius: 6px; padding: 3px; }
.segmented button { border: 0; border-radius: 3px; padding: 5px 10px; font-size: 11px; background: none; cursor: pointer; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--card); color: var(--accent); }
.usage-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin: 0 0 28px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--card-soft); }
.usage-stat { display: flex; flex-direction: column; gap: 12px; padding: 20px; border: 0; border-right: 1px solid var(--border); border-radius: 0; }
.usage-stat:last-child { border: 0; }
.usage-stat span { margin: 0; font-size: 11px; }
.usage-stat strong { font-family: var(--sans); font-size: clamp(22px, 2.3vw, 32px); font-weight: 400; letter-spacing: -.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.usage-stat small { font-size: 9px; color: var(--muted); }
.stat-cachedRead strong, .stat-cachedWrite strong { color: var(--cache); }
.usage-chart-card { border: 1px solid var(--border); border-radius: 10px; padding: 22px 24px 0; background: var(--card-soft); }
.chart-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.usage-content h2 { font-size: 12px; font-weight: 500; margin: 0; }
.chart-heading > span, .chart-axis { font: 9px var(--mono); color: var(--muted); }
.usage-plot { display: flex; align-items: stretch; gap: 3px; height: 188px; margin-top: 32px; border-bottom: 1px solid var(--border-strong); background: repeating-linear-gradient(to top, transparent 0, transparent 46px, var(--border) 47px, transparent 48px); }
.usage-day { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; min-width: 0; padding: 0; background: none; border: 0; cursor: pointer; }
.usage-day::after { content: ''; height: 2px; background: var(--border-strong); position: absolute; left: 0; right: 0; bottom: 0; }
.usage-bar { width: 75%; max-width: 32px; background: var(--accent); opacity: .55; border-radius: 2px 2px 0 0; transform-origin: bottom; transition: opacity 150ms; animation: bar-in 450ms ease-out; }
.usage-day:hover .usage-bar, .usage-day[aria-pressed="true"] .usage-bar { opacity: 1; }
.usage-day[aria-pressed="true"]::after { background: var(--accent); }
.chart-axis { display: flex; justify-content: space-between; padding-top: 10px; }
.usage-day-detail { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; min-height: 58px; padding: 14px 0; font-size: 10px; color: var(--muted); }
.usage-day-detail strong { color: var(--ink); font-weight: 500; }
.usage-lower { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 24px; margin-top: 28px; }
.usage-log, .usage-models { min-width: 0; }
.usage-table-scroll { height: 316px; overflow: auto; margin-top: 16px; scrollbar-gutter: stable; }
.usage-log table { border-collapse: collapse; width: 100%; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.usage-log th { position: sticky; top: 0; background: var(--paper); color: var(--muted); font-weight: 400; }
.usage-log th, .usage-log td { padding: 10px 9px; text-align: right; border-bottom: 1px solid var(--border); }
.usage-log th:first-child, .usage-log td:first-child { text-align: left; padding-left: 0; }
.usage-log td:nth-child(4), .usage-log td:nth-child(5) { color: var(--cache); }
.usage-model-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; padding: 18px 0; border-bottom: 1px solid var(--border); font-size: 11px; }
.usage-model-row > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usage-model-row strong { font-weight: 500; }
.usage-model-row small { grid-column: 1 / -1; color: var(--muted); font-size: 9px; }
.usage-note { font-size: 10px; color: var(--muted); max-width: 760px; line-height: 1.8; margin-top: 24px; }
@keyframes panel-enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pane-in { from { opacity: .6; } to { opacity: 1; } }
@keyframes fold-draw { from { stroke-dashoffset: 300; opacity: 0; } }
@keyframes bar-in { from { transform: scaleY(.05); } to { transform: scaleY(1); } }
@media (max-width: 1100px) {
  .usage-content { padding: 24px; }
  .usage-stat { padding: 16px 12px; }
  .usage-lower { grid-template-columns: minmax(0, 1fr); }
  .usage-models { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 24px; }
  .usage-models h2 { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .rail { padding-top: 24px; }
  .topbar { padding: 0 14px; --topbar-h: 56px; }
  .topbar-actions { gap: 0; }
  .crumb { gap: 7px; }
  .landing-inner { padding: 26px 20px 48px; }
  .landing-heading { padding-bottom: 28px; }
  .landing-title { font-size: 30px; }
  .sigma-mark { width: 58px; height: 58px; margin-bottom: 16px; }
  .composer textarea { padding: 12px 14px 4px; min-height: 44px; }
  .composer-bar { padding: 6px 10px 10px; gap: 8px; }
  .model-btn { max-width: 65%; }
  .model-label { max-width: none; }
  .mode-btn { max-width: 145px; }
  .composer-workspace { max-width: 40%; font-size: 10px; }
  .composer-shortcuts { font-size: 9px; gap: 12px; }
  .composer-slot.docked { padding: 8px 12px 10px; }
  .statusbar { padding: 7px 20px; }
  #settings-dialog { width: calc(100vw - 24px); height: calc(100dvh - 32px); }
  .settings-wrap { flex-direction: column; }
  .settings-nav { flex-direction: row; width: 100%; padding: 6px 12px 10px; gap: 4px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .settings-nav button { padding: 8px 10px; white-space: nowrap; font-size: 11px; }
  .settings-pane { padding: 20px; }
  .set-row { gap: 14px; }
  .set-row .set-ctl { max-width: 52%; }
  #folder-dialog { width: calc(100vw - 24px); height: calc(100dvh - 32px); }
  .folder-card { padding: 20px; }
  .folder-bar .text-input { min-width: 0; font-size: 11px; }
  .drawer { top: 62px; right: 12px; bottom: 12px; width: calc(100vw - 24px); }
  .usage-content { padding: 24px 18px; }
  .usage-head { align-items: flex-start; }
  .usage-head h1 { font-size: 30px; }
  .usage-actions { gap: 7px; }
  .usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .usage-stat { border-bottom: 1px solid var(--border); }
  .usage-stat:first-child { grid-column: 1 / -1; }
  .usage-stat:nth-child(3) { border-right: 0; }
  .usage-stat:last-child { border-right: 0; }
  .usage-chart-card { padding: 16px 12px 0; }
  .chart-heading { align-items: flex-start; flex-direction: column; }
  .usage-day-detail { gap: 8px 16px; min-height: 84px; }
  .usage-plot { gap: 1px; height: 144px; }
  .usage-bar { width: 80%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
[data-motion="reduce"] *, [data-motion="reduce"] *::before, [data-motion="reduce"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }

/* --- Login screen --- */
.login-screen {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: var(--paper); padding: 24px;
}
.login-card {
  width: min(400px, 100%); display: flex; flex-direction: column; align-items: stretch;
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  padding: 34px 30px 30px; text-align: left;
}
.login-mark { width: 34px; height: 34px; border-radius: 9px; font-size: 21px; margin-bottom: 16px; }
.login-title { font-size: 27px; font-weight: 450; letter-spacing: -.04em; margin: 10px 0 8px; }
.login-sub { font-size: 12px; color: var(--muted); margin: 0 0 22px; line-height: 1.55; }
.login-label {
  font: 9px var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 6px 2px;
}
.login-card .text-input { margin-bottom: 14px; padding: 10px 12px; }
.login-error {
  margin: 0 0 12px; font-size: 12px; color: var(--danger);
}
.login-btn { margin-top: 6px; padding: 11px; font-size: 13px; font-weight: 600; }
.login-btn:disabled { opacity: .55; }
.rail-user { font: 9px var(--mono); letter-spacing: .12em; color: var(--muted); padding: 10px 8px 0; text-transform: uppercase; overflow-wrap: anywhere; }

/* --- iOS / touch + Home Screen app --- */
.app {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.rail {
  padding-top: max(14px, env(safe-area-inset-top, 0px));
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
}
@media (min-width: 901px) {
  .drawer {
    top: max(68px, calc(18px + env(safe-area-inset-top, 0px)));
    bottom: max(18px, env(safe-area-inset-bottom, 0px));
  }
  .composer-slot.docked {
    padding-bottom: max(18px, env(safe-area-inset-bottom, 0px));
  }
}
@media (max-width: 900px) {
  .drawer { top: 0; bottom: 0; }
  .composer-slot.docked {
    padding-bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }
}
.toasts { bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
.login-screen {
  padding: calc(24px + env(safe-area-inset-top, 0px)) 24px calc(24px + env(safe-area-inset-bottom, 0px));
}

@media (pointer: coarse) {
  /* ≥16px inputs stop iOS zooming the page in on focus. */
  .composer textarea, .text-input, .dlg textarea.text-input,
  select.text-input, .palette-input, #prompt-input { font-size: 16px; }
  .icon-btn, .send-btn { min-width: 40px; min-height: 40px; }
  .kbd, .composer-shortcuts { display: none; }
}

@media (hover: none) {
  /* No hover on touch: message affordances stay visible. */
  .msg-actions { opacity: 1; }
}

@media (display-mode: standalone) and (max-width: 760px) {
  .statusbar { display: none; }
}

.push-banner {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 90; display: flex; align-items: center; gap: 10px;
  background: var(--card); border: 1px solid var(--border-strong);
  border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow-lg);
  max-width: calc(100vw - 24px);
}
.push-banner-text { font-size: 13px; white-space: nowrap; }
