/* HDNG Design System v2 (Direction C): soft surfaces on a hard skeleton.
   hdng-tokens.css is a pinned copy of www.hdng.ai/brand/hdng-tokens.css;
   its Cockpit v1 aliases (--ink, --paper, --white, --mono, ...) keep the rules
   below working. Panels round and lift; controls, rules and ink stay square.
   Lime means live. Fonts are self-hosted: the CSP allows no font origin but self. */
@import url("hdng-tokens.css?v=ds-v2-20261016");

@font-face { font-family: Poppins; font-style: normal; font-weight: 400; font-display: swap; src: url("poppins-latin-400-normal.woff2?v=5.3.0") format("woff2"); }
@font-face { font-family: Poppins; font-style: normal; font-weight: 500; font-display: swap; src: url("poppins-latin-500-normal.woff2?v=5.3.0") format("woff2"); }
@font-face { font-family: Poppins; font-style: normal; font-weight: 600; font-display: swap; src: url("poppins-latin-600-normal.woff2?v=5.3.0") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("ibm-plex-mono-latin-400-normal.woff2?v=5.3.0") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("ibm-plex-mono-latin-500-normal.woff2?v=5.3.0") format("woff2"); }

:root {
  /* hdng.ai --primary-hover (0 0% 15%); the tokens sheet has no hover value. */
  --cockpit-ink-hover: #262626;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 14px; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3, strong, b { font-weight: var(--hdng-weight-semibold); }
button, input, textarea { font: inherit; }
button { color: inherit; }
/* Controls, tags and rules stay square; only panels and cards round. */
button, input, select, textarea, .button, .badge, .chip { border-radius: var(--hdng-radius-control); }
/* v2 manual: focus is an ink ring (lime on paper is ~1.1:1 and fails WCAG 1.4.11). */
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* Focused by the app after navigation, never by the keyboard: no browser ring. */
.main:focus { outline: none; }
button:disabled { cursor: not-allowed; opacity: .48; }
.brand-mark { display: block; height: auto; }
svg { display: block; fill: none; stroke: currentColor; stroke-linecap: square; stroke-linejoin: miter; stroke-width: 1.7; }

[hidden] { display: none !important; }
.auth-gate { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: var(--paper); }
.auth-card { width: min(100%, 680px); display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 24px 28px; padding: clamp(26px, 6vw, 54px); border: 1px solid var(--hdng-color-hairline); border-radius: var(--hdng-radius-hero); background: var(--white); box-shadow: var(--hdng-shadow-raised); }
.auth-brand { grid-row: 1 / span 4; padding-top: 3px; }
.auth-brand .brand-mark { width: 44px; }
.auth-copy h1 { max-width: 520px; margin-bottom: 16px; font-size: clamp(36px, 7vw, 62px); line-height: .94; }
.auth-copy p { max-width: 540px; margin-bottom: 0; color: var(--mute); line-height: 1.7; }
.auth-primary { width: fit-content; min-height: 3.2rem; padding-inline: 24px; background: var(--ink); }
.auth-message { min-height: 1.5rem; margin: 0; color: var(--mute); font: 11px/1.6 var(--mono); }
.auth-message.is-error { color: var(--err); }
.auth-message.is-ok { color: var(--ok); }
.auth-recovery { padding: 16px; border: 1px solid var(--hair); border-radius: var(--hdng-radius-nested); background: var(--surface-2); }
.auth-recovery strong { display: block; margin-bottom: 7px; }
.auth-recovery p { margin: 0; color: var(--mute); font-size: 12px; line-height: 1.65; }
.auth-foot { grid-column: 1 / -1; padding-top: 16px; border-top: 1px solid var(--hair); color: var(--soft); font: 9.5px var(--mono); letter-spacing: .08em; }
.passkey-dialog { width: min(calc(100% - 32px), 620px); max-height: calc(100vh - 40px); padding: 0; overflow: hidden; border: 1px solid var(--hdng-color-overlay-edge); border-radius: var(--hdng-radius-panel); background: var(--paper); color: var(--ink); box-shadow: var(--hdng-shadow-overlay); }
.passkey-dialog::backdrop { background: rgba(10, 10, 10, .68); }
.passkey-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--hair); background: var(--white); }
.passkey-dialog-head h2 { margin: 0; font-size: 22px; }
.passkey-dialog-copy { margin: 0; padding: 16px 20px; color: var(--mute); font-size: 12px; line-height: 1.65; }
.passkey-list { display: grid; border-top: 1px solid var(--hair); }
.passkey-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 18px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--hair); background: var(--white); }
.passkey-item strong, .passkey-item small { display: block; }
.passkey-item small { margin-top: 4px; color: var(--soft); font: 10px/1.5 var(--mono); }
.passkey-empty { padding: 22px 20px; color: var(--mute); text-align: center; }
.passkey-dialog-actions { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.passkey-dialog-actions span { color: var(--soft); font: 10px/1.5 var(--mono); }

.console { min-height: 100vh; display: grid; grid-template-columns: 3.5rem 15.5rem minmax(0, 1fr); grid-template-rows: 3.25rem minmax(0, 1fr) 2rem; grid-template-areas: "rail topbar topbar" "rail sidebar main" "rail status status"; }
.rail { grid-area: rail; position: sticky; top: 0; height: 100vh; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 0; border-right: 2px solid var(--ink); background: var(--surface-2); }
.logo { margin-bottom: 14px; }
.logo .brand-mark { width: 24px; }
/* #409: the rail is the module switcher. The view modes (.rail-button[data-role], the
   hook personal-office.js and personal-mail.js read) live in the account menu. */
.rail-modules, .rail-addons { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.rail-addons { padding-top: 8px; border-top: 1px solid var(--hair); }
.rail-module, .rail-button { position: relative; width: 2.3rem; height: 2.3rem; display: grid; place-items: center; border: 0; background: transparent; color: var(--mute); cursor: pointer; text-decoration: none; }
.rail-module svg, .rail-button svg { width: 18px; height: 18px; }
.rail-module:hover, .rail-button:hover { background: rgba(10, 10, 10, .08); color: var(--ink); }
.rail-module.is-active, .rail-button.is-active { background: var(--ink); color: var(--paper); }
/* Not connected: still there, dimmed; the tooltip and description say why. Only the
   icon fades, so the tooltip stays readable. */
.rail-module.is-dimmed:not(.is-active) { color: var(--soft); }
.rail-module.is-dimmed:not(.is-active) svg { opacity: .55; }
.rail-module[aria-disabled="true"] { cursor: default; }
.rail-new { border: 1px solid var(--hdng-color-control-edge); }
/* A dot only for a live signal (documents waiting to be filed, unread mail): lime is live. */
.rail-dot { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border: 1px solid var(--lime-dark); border-radius: 50%; background: var(--lime); }
.rail-external-mark { position: absolute; right: 2px; bottom: 0; font: 9px/1 var(--mono); }
/* Tooltip: the module, its status and Core's detail, on hover and on keyboard focus. */
.rail-module[data-tooltip]:hover::after, .rail-module[data-tooltip]:focus-visible::after { content: attr(data-tooltip); position: absolute; top: 50%; left: calc(100% + 10px); z-index: 10; width: max-content; max-width: 17rem; padding: 6px 9px; transform: translateY(-50%); background: var(--ink); color: var(--paper); box-shadow: var(--hdng-shadow-overlay); font: 500 11.5px/1.45 var(--sans); text-align: left; white-space: normal; pointer-events: none; }
.rail-spacer { flex: 1; }
.rail-version { font: 10px var(--mono); color: var(--soft); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* The account menu opens beside the rail's foot, over the page. */
.account { position: relative; }
.account-button { border: 1px solid var(--hdng-color-control-edge); }
.account-menu { position: fixed; bottom: 12px; left: calc(3.5rem + 8px); z-index: 20; width: 17rem; max-height: calc(100vh - 24px); overflow-y: auto; padding: 4px 0; border: 1px solid var(--hdng-color-overlay-edge); border-radius: var(--hdng-radius-panel); background: var(--paper); box-shadow: var(--hdng-shadow-overlay); }
.account-section { padding: 8px 0; border-bottom: 1px solid var(--hair); }
.account-section:last-child { border-bottom: 0; }
.account-section .nav-label { padding: 2px 16px 6px; }
.account-menu .rail-button { width: 100%; height: auto; min-height: 2.3rem; display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 0 16px; font-size: 13px; text-align: left; }
.account-service { padding: 6px 16px; }
.account-service strong, .account-link { display: block; color: var(--ink); font-size: 13px; font-weight: 500; }
.account-link { width: fit-content; text-decoration: underline; text-underline-offset: 3px; }
.account-service-meta { margin: 2px 0 0; color: var(--mute); font-size: 11px; line-height: 1.45; }
.account-service .badge { display: inline; min-height: 0; margin-right: 3px; padding: 0; border: 0; background: none; font-size: 9px; }
.account-item { width: 100%; min-height: 2.3rem; display: flex; align-items: center; padding: 0 16px; border: 0; background: transparent; color: var(--ink); font-size: 13px; text-align: left; cursor: pointer; }
.account-item:hover { background: rgba(10, 10, 10, .05); }

.topbar { grid-area: topbar; position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 16px; padding: 0 22px; border-bottom: 2px solid var(--ink); background: var(--paper); }
.crumbs { display: flex; align-items: center; gap: 7px; font: 11px var(--mono); color: var(--mute); }
.crumbs strong { color: var(--ink); font-weight: 500; }
.preview-state { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font: 10px var(--mono); text-transform: uppercase; letter-spacing: .09em; color: var(--mute); }
.state-dot { width: 9px; height: 9px; flex: 0 0 auto; display: inline-block; border: 1px solid var(--lime-dark); border-radius: 50% !important; background: var(--lime); }
.chip, .badge { display: inline-flex; align-items: center; width: fit-content; min-height: 1.45rem; padding: 3px 8px; border: 1px solid var(--hair); background: transparent; font: 9.5px var(--mono); text-transform: uppercase; letter-spacing: .07em; white-space: nowrap; }
.badge-accent { border-color: var(--lime-dark); background: rgba(207, 255, 77, .22); }
.badge-ok { color: var(--ok); border-color: rgba(38, 133, 90, .35); background: rgba(38, 133, 90, .1); }
.badge-warn { color: var(--warn); border-color: rgba(181, 122, 6, .35); background: rgba(181, 122, 6, .08); }
.mobile-menu { display: none; border: 1px solid var(--ink); background: transparent; padding: 5px 9px; font: 10px var(--mono); text-transform: uppercase; }

/* contain: size keeps the sidebar's own content from growing the page: it fills its row
   and scrolls inside it (#409 put the conversations and Connections in it). */
.sidebar { grid-area: sidebar; display: flex; min-height: 0; flex-direction: column; overflow: auto; contain: size; border-right: var(--hdng-border-ledger); background: var(--surface-2); }
.sidebar-role { padding: 17px 20px; border-bottom: 1px solid var(--hair); }
.label { display: block; margin-bottom: 6px; color: var(--soft); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .15em; }
.sidebar-role strong { display: block; font-size: 13px; }
.nav-group { padding: 14px 0; border-bottom: 1px solid var(--hair); }
.nav-label { padding: 0 20px 8px; color: var(--soft); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .15em; }
.nav-item { width: 100%; min-height: 2.45rem; display: flex; align-items: center; gap: 8px; padding: 0 20px; border: 0; border-left: 2px solid transparent; background: transparent; color: var(--mute); text-align: left; cursor: pointer; }
.nav-item:hover { background: rgba(10, 10, 10, .05); color: var(--ink); }
.nav-item.is-active { border-left-color: var(--lime); background: rgba(10, 10, 10, .06); color: var(--ink); font-weight: 600; }
.nav-item small { margin-left: auto; color: var(--soft); font: 10px var(--mono); }
.sidebar-foot { margin-top: auto; padding: 16px 20px; color: var(--soft); font: 9.5px/1.7 var(--mono); text-transform: uppercase; }
.sidebar-foot span, .sidebar-foot strong { display: block; }
.sidebar-foot strong { color: var(--mute); font-weight: 500; }

/* #409: the sidebar starts with the conversations: New conversation, then the recent ones. */
.sidebar-chats { padding: 14px 0 10px; border-bottom: 1px solid var(--hair); }
.sidebar-new-chat { width: calc(100% - 28px); margin: 0 14px 12px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.sidebar-section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 8px; padding: 0 20px 6px; }
h2.nav-label { margin: 0; }
.sidebar-section-head .nav-label { padding: 0; }
.sidebar-section-head .badge { min-height: 1.2rem; padding: 1px 6px; font-size: 8.5px; }

.main { grid-area: main; min-width: 0; overflow: auto; }
.view { display: none; min-height: 100%; padding: 24px; }
.view.is-active { display: block; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 32px; padding: 24px 26px; border: 1px solid var(--hdng-color-hairline); border-radius: var(--hdng-radius-panel); background: var(--white); box-shadow: var(--hdng-shadow-raised); }
.page-head.compact { padding: 20px 22px; }
h1, h2, p { margin-top: 0; }
h1 { max-width: 850px; margin-bottom: 10px; font-size: clamp(30px, 4vw, 54px); line-height: .98; letter-spacing: -.045em; }
.compact h1 { font-size: clamp(27px, 3vw, 42px); }
.page-head p { max-width: 760px; margin-bottom: 0; color: var(--mute); line-height: 1.65; }
.mode-card { min-width: 190px; display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--ink); border-radius: var(--hdng-radius-nested); background: var(--ink); color: var(--paper); }
.mode-card small, .mode-card strong { display: block; }
.mode-card small { color: rgba(248, 248, 243, .58); font: 9px var(--mono); text-transform: uppercase; }
.mode-card strong { margin-top: 3px; color: var(--paper); font: 11px var(--mono); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 18px 0; }
.metric { min-height: 122px; padding: 17px; border: 1px solid var(--hdng-color-hairline); border-radius: var(--hdng-radius-panel); background: var(--white); box-shadow: var(--hdng-shadow-raised); }
.metric span, .metric small, .metric strong { display: block; }
.metric span { color: var(--soft); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .13em; }
.metric strong { margin: 18px 0 4px; font: 600 21px var(--mono); }
.metric small { color: var(--mute); font: 10px var(--mono); }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); gap: 18px; }
.panel { overflow: hidden; border: 1px solid var(--hdng-color-hairline); border-radius: var(--hdng-radius-panel); background: var(--white); box-shadow: var(--hdng-shadow-raised); }
.panel-head { min-height: 3.4rem; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--hair); }
.panel-head h2 { margin: 0; font-size: 15px; }
.panel-head .label { margin-bottom: 3px; }
.status-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 15px 16px; border-bottom: 1px solid var(--hair-soft); }
.status-row:last-child { border-bottom: 0; }
.status-row strong, .status-row small { display: block; }
.status-row small { margin-top: 4px; color: var(--soft); font-size: 11px; }
.status-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--hair); background: var(--surface-2); font: 10px var(--mono); }
.status-icon.is-ready { border-color: var(--lime-dark); box-shadow: inset 3px 0 0 var(--lime); }
.body-copy { padding: 16px; margin-bottom: 0; color: var(--mute); line-height: 1.7; }
.body-copy strong { color: var(--ink); }
.contract-list { display: grid; border-top: 1px solid var(--hair); }
.contract-list > span { display: flex; justify-content: space-between; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--hair-soft); color: var(--mute); font: 10.5px var(--mono); }
.contract-list b { color: var(--ink); font-weight: 500; }
.help-grid { margin-top: 18px; }

/* #409 (Erik, 2026-10-31): Overview is the chat. One tall column, centred and at most
   52rem wide, fills the height between the top bar and the status bar, so the
   conversation and the composer are both in view and the page never scrolls; only the
   message history scrolls, inside the chat panel. dvh follows a phone's browser bar.
   Until the Cockpit chat (#411) is enabled it says CONNECTION REQUIRED and cannot send. */
.ask-hero { display: flex; flex-direction: column; width: 100%; max-width: 52rem; margin: 0 auto; height: calc(100vh - 3.25rem - 2rem - 48px); height: calc(100dvh - 3.25rem - 2rem - 48px); min-height: 30rem; }
/* The greeting and briefing sit in the empty history and step aside, with the starters,
   once the conversation has a turn. The history is drawn over them and keeps the pointer. */
.ask-intro { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 24px clamp(18px, 4vw, 40px); }
.ask-intro .label { margin-bottom: 6px; }
.ask-intro h1 { margin-bottom: 8px; font-size: clamp(30px, 3.4vw, 44px); }
.ask-briefing { max-width: 38rem; margin: 0; color: var(--mute); font-size: 15px; line-height: 1.55; }
.cockpit-chat-panel:has(.cockpit-chat-turns > *) .ask-intro,
.cockpit-chat-panel:has(.cockpit-chat-turns > *) .ask-suggestions { display: none; }
.ask-box { flex: 0 0 auto; display: grid; border-top: 1px solid var(--hair); background: var(--paper); }
.ask-box footer { display: flex; align-items: center; gap: 12px; padding: 8px 14px 10px; }
/* The visible caption names the textarea for screen readers and speech input. */
.ask-label { margin: 0; padding: 10px 14px 0; }
.ask-box textarea { display: block; width: 100%; min-height: 2.75rem; max-height: 12rem; padding: 4px 14px; border: 0; background: transparent; color: var(--ink); font-size: 16px; line-height: 1.5; resize: none; overflow-y: auto; }
.ask-box textarea::placeholder { color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ask-box textarea:focus-visible { outline-offset: -2px; }
.ask-note { flex: 1 1 auto; min-width: 0; margin: 0; color: var(--mute); font: 11px/1.5 var(--mono); }
.ask-keys { flex: 0 0 auto; color: var(--soft); font: 10px/1.5 var(--mono); }
.ask-box footer .button { flex: 0 0 auto; }
/* Starters for an empty conversation, just above the composer. */
.ask-suggestions { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--hair); }
.ask-suggestion { min-height: 2.35rem; padding: 0 14px; border: 1px solid var(--hdng-color-control-edge-soft); background: transparent; color: var(--ink); font-size: 12.5px; cursor: pointer; }
.ask-suggestion:hover { border-color: var(--ink); background: var(--hdng-color-tag-quiet); }
.button.button-quiet { border-color: var(--hdng-color-control-edge); background: transparent; color: var(--ink); }

.button { min-height: 2.55rem; padding: 0 17px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 500; cursor: pointer; }
.button:hover:not(:disabled) { border-color: var(--cockpit-ink-hover); background: var(--cockpit-ink-hover); color: var(--paper); }
.files-layout { display: grid; grid-template-columns: 15.5rem minmax(0, 1fr); min-height: 410px; margin-top: 18px; overflow: hidden; border: 1px solid var(--hdng-color-hairline); border-radius: var(--hdng-radius-panel); background: var(--white); box-shadow: var(--hdng-shadow-raised); }
.folder-panel { min-width: 0; border-right: 1px solid var(--hair); background: var(--surface-2); }
.folder-panel header, .browser-head { min-height: 3.1rem; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--hair); }
.folder-panel header .label { margin: 0; }
.folder { width: 100%; min-height: 2.65rem; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px; border: 0; border-left: 2px solid transparent; background: transparent; color: var(--mute); text-align: left; }
.folder.is-active { border-left-color: var(--lime); background: rgba(10, 10, 10, .06); color: var(--ink); font-weight: 600; }
/* A long folder path truncates inside the panel; the full path is in its title. */
.folder > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder small { flex: none; font: 10px var(--mono); }
.folder-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--hair); }
.folder-actions .button { flex: 1 1 auto; padding-inline: 8px; }
.folder-note { margin: 14px; padding: 12px; border: 1px dashed rgba(10, 10, 10, .25); border-radius: var(--hdng-radius-nested-sm); color: var(--soft); font: 10px/1.6 var(--mono); }
.file-browser { --file-grid: minmax(0, 2.2fr) minmax(0, 1.1fr) minmax(0, 1.3fr) 6.5rem 5.5rem; min-width: 0; display: flex; flex-direction: column; }
.file-columns { display: grid; grid-template-columns: var(--file-grid); gap: 16px; padding: 9px 16px; border-bottom: 1px solid var(--hair); background: var(--surface-3); color: var(--soft); font: 9px var(--mono); text-transform: uppercase; letter-spacing: .09em; }
.empty-state { min-height: 290px; display: grid; align-content: center; justify-items: center; padding: 30px; text-align: center; color: var(--mute); }
.empty-state svg { width: 42px; height: 42px; margin-bottom: 14px; color: var(--soft); }
.empty-state strong { color: var(--ink); }
.empty-state p { max-width: 500px; margin: 8px 0 0; font-size: 12px; line-height: 1.65; }
.compact-empty { min-height: 220px; }
.state-contract { margin-top: 18px; overflow: hidden; border: 1px solid var(--hdng-color-hairline); border-radius: var(--hdng-radius-panel); background: var(--white); box-shadow: var(--hdng-shadow-raised); }
.state-example { display: grid; grid-template-columns: 46px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--hair); }
.file-symbol { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--ink); font: 9px var(--mono); }
.state-example strong, .state-example small { display: block; }
.state-example small { margin-top: 4px; color: var(--soft); font: 10px var(--mono); }
.state-explanation { margin: 0; padding: 13px 16px; color: var(--mute); font-size: 12px; line-height: 1.6; }

.chat-shell { min-height: calc(100vh - 3.25rem - 2rem - 48px); display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--hdng-color-hairline); border-radius: var(--hdng-radius-panel); background: var(--paper); box-shadow: var(--hdng-shadow-raised); }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--hair); background: var(--white); }
.chat-head h1 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.messages { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 28px; }
.message { max-width: min(680px, 84%); padding: 14px 16px; border-radius: var(--hdng-radius-nested); }
.message p { margin: 0; line-height: 1.65; }
.message-user { align-self: flex-end; background: var(--ink); color: var(--paper); }
.message-assistant { align-self: flex-start; border: 1px solid var(--hair); background: var(--white); }
.message-who { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; color: var(--soft); font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .12em; }
.message-user .message-who { color: rgba(248, 248, 243, .62); }
.answer-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 14px; background: var(--hair); }
.answer-facts > span { padding: 9px 10px; background: var(--paper); color: var(--mute); font: 10px var(--mono); }
.answer-facts b { display: block; margin-bottom: 3px; color: var(--ink); font-weight: 500; }
.trace { display: block; margin-top: 11px; color: var(--soft); font: 9.5px var(--mono); }
.composer { display: flex; gap: 10px; padding: 13px 16px; border-top: 2px solid var(--ink); background: var(--white); }
.composer input { flex: 1; min-width: 0; height: 2.55rem; padding: 0 12px; border: 1px solid var(--hair); background: var(--paper); color: var(--mute); }

.statusbar { grid-area: status; display: flex; align-items: center; gap: 22px; padding: 0 22px; border-top: 1px solid var(--hair); background: var(--surface-2); color: var(--mute); font: 10px var(--mono); white-space: nowrap; }
.status-right { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; }
/* One line at every width (#519): a status longer than the room ellipsizes (its whole text
   stays in the DOM for screen readers) and the parts beside it keep their size. */
.statusbar > span { flex: 0 0 auto; }
.statusbar > #status-text { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 1000px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .files-layout { grid-template-columns: 13rem minmax(0, 1fr); }
  .ask-briefing { font-size: 18px; }
}

@media (max-width: 760px) {
  .console { grid-template-columns: 3.5rem minmax(0, 1fr); grid-template-rows: 3.25rem minmax(0, 1fr) 2rem; grid-template-areas: "rail topbar" "rail main" "rail status"; }
  /* Closed: fully off-screen, so its ledger line never crosses the rail. */
  .sidebar { position: fixed; inset: 3.25rem auto 2rem 3.5rem; z-index: 5; width: 15.5rem; transform: translateX(calc(-100% - 3.5rem)); border-right: var(--hdng-border-ledger); transition: transform .16s ease; }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-menu { display: inline-flex; }
  .preview-state { display: none; }
  .view { padding: 14px; }
  .page-head { flex-direction: column; padding: 18px; }
  .mode-card { width: 100%; }
  .files-layout { grid-template-columns: 1fr; }
  .folder-panel { border-right: 0; border-bottom: 1px solid var(--hair); }
  .file-columns { display: none; }
  .state-example { grid-template-columns: 46px minmax(0, 1fr); }
  .state-example .badge { grid-column: auto; }
  .answer-facts { grid-template-columns: 1fr; }
  .message { max-width: 94%; }
  /* Phone and small tablet: the column takes the whole width and the intro shrinks. */
  .ask-hero { height: calc(100vh - 3.25rem - 2rem - 28px); height: calc(100dvh - 3.25rem - 2rem - 28px); min-height: 24rem; }
  .ask-intro { padding: 16px; }
  .ask-intro .label { display: none; }
  .ask-intro h1 { font-size: 26px; margin-bottom: 4px; }
  .ask-briefing { font-size: 13px; line-height: 1.45; }
  .ask-keys { display: none; }
  .ask-suggestions { padding: 8px 10px; }
  .ask-box footer { padding: 6px 10px 8px; }
}

@media (max-width: 480px) {
  .auth-gate { padding: 16px; }
  .auth-card { grid-template-columns: 1fr; gap: 20px; padding: 26px 22px; }
  .auth-brand { grid-row: auto; }
  .auth-brand .brand-mark { width: 34px; }
  .auth-foot { grid-column: 1; }
  .passkey-dialog-actions { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar .chip { display: none; }
  .statusbar { padding: 0 12px; }
  .statusbar > span:first-child { display: none; }
  /* A phone keeps only the status itself; "UI active" goes like the product name. */
  .status-right { display: none; }
}


/* #133 LIVE Files additions. Design system v2: square controls, lime only for live. */
.hidden {
  display: none !important;
}

.button-small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.72rem;
}

.connection-state.is-live .state-dot {
  background: var(--lime);
  box-shadow: 0 0 0 3px rgb(190 242 100 / 18%);
}

.connection-state.is-locked .state-dot,
.connection-state.is-error .state-dot {
  background: var(--err);
}

.connection-state.is-connecting .state-dot {
  background: var(--warn);
}

/* One track that may shrink: an implicit auto track grew to the longest unbroken
   folder name and pushed every row's "Mapp" label out over the file table. */
.folder-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.file-row {
  display: grid;
  grid-template-columns: var(--file-grid);
  gap: 16px;
  align-items: center;
  min-height: 66px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--hair);
  background: var(--paper);
}

.file-row:hover {
  background: var(--surface-2);
}

.file-row time {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--mute);
  white-space: nowrap;
}

/* #236: every cell owns its column and truncates; the full value is in its title. */
.file-name {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.file-name .file-symbol {
  flex: none;
}

.file-name strong,
.file-folder {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-folder {
  color: var(--ink);
}

.file-status {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.file-status .badge {
  max-width: 100%;
  white-space: normal;
}

.file-actions {
  display: flex;
  justify-content: flex-end;
}

.badge-danger {
  border-color: var(--err);
  color: var(--err);
  background: transparent;
}

.empty-state.is-error,
.empty-state.is-denied,
.empty-state.session-gate {
  min-height: 300px;
}

.empty-state.is-error {
  border-left: 3px solid var(--err);
}

.empty-state.is-denied {
  border-left: 3px solid var(--warn);
}

.empty-state.session-gate {
  border-left: 3px solid var(--ink);
}

@media (max-width: 1050px) {
  /* Too narrow for five columns: the name takes its own line, the rest sit below it. */
  .file-browser {
    --file-grid: minmax(0, 1fr) minmax(0, 1.2fr) 5.5rem;
  }

  .file-row {
    gap: 8px 16px;
  }

  .file-row .file-name {
    grid-column: 1 / -1;
  }

  .file-row time,
  .file-columns {
    display: none;
  }
}

@media (max-width: 720px) {
  .file-browser {
    --file-grid: minmax(0, 1fr) auto;
  }

  .file-row {
    gap: 8px;
  }

  .file-row .file-name,
  .file-row .file-folder {
    grid-column: 1 / -1;
  }

  .file-columns {
    display: none;
  }

  .topbar .button-small {
    display: none;
  }
}

.state-example {
  grid-template-columns: 46px minmax(0, 1fr) auto auto auto;
}


/* #411 internal read-only chat beta. Only content retrieved for the signed-in
   principal is rendered, as text, never injected as HTML. */
/* One chat panel, the Overview's column: header with the conversation controls, the
   history (the only part that scrolls), starters, and the composer anchored at the bottom. */
.cockpit-chat-panel { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--hdng-color-hairline); border-radius: var(--hdng-radius-hero); background: var(--white); box-shadow: var(--hdng-shadow-raised); }
.cockpit-chat-toolbar { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center;
  padding: 8px 14px; border-bottom: 1px solid var(--hair); }
.cockpit-chat-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
/* A long unbroken title wraps instead of pushing the buttons out of reach. */
.cockpit-chat-toolbar strong { font-size: 12px; flex: 1 1 10rem; min-width: 0; overflow-wrap: anywhere; }
.cockpit-chat-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
/* The column is the readable width: answers use all of it, the user's turns stay narrower. */
.cockpit-chat-turns { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 14px;
  overflow-y: auto; overscroll-behavior: contain; padding: 20px clamp(14px, 3vw, 26px); }
.cockpit-chat-user, .cockpit-chat-answer { border: 1px solid var(--hair);
  border-radius: var(--hdng-radius-nested); padding: 10px 14px; overflow-wrap: anywhere; font-size: 15px; }
.cockpit-chat-user { align-self: flex-end; max-width: min(85%, 36rem); background: var(--surface-2); }
.cockpit-chat-answer { align-self: stretch; background: var(--white); border-left: 3px solid var(--ink); }
/* The transcript is focusable for keyboard scrolling; the panel clips an outside ring. */
.cockpit-chat-turns:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.cockpit-chat-turns strong { display: block; font: 600 10px/1.4 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--mute); margin-bottom: 4px; }
.cockpit-chat-user strong { text-align: right; }
.cockpit-chat-turns p { white-space: pre-wrap; margin: 0; line-height: 1.6; }
/* Shown when an answer arrives while the reader is further up; never moves them. It has
   its own strip under the history (#519): the history gives it room while it shows, so it
   never lies over a turn, and takes the room back when it hides. */
.cockpit-chat-latest { flex: 0 0 auto; align-self: center; margin: 6px 0; box-shadow: var(--hdng-shadow-raised); }
.cockpit-chat-latest[hidden] { display: none; }
/* The documents an answer is grounded on, as a footnote under the answer, folded behind
   "Sources (n)" (a native disclosure: keyboard and screen readers work without script). */
.cockpit-chat-sources { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--hair); font-size: 12px; color: var(--mute); }
/* Mail Part 5 (M5-23): the approval card under the answer that proposed it. */
.cockpit-approval-card { border: 1px solid var(--hair, currentColor); padding: 0.75rem; margin-top: 0.5rem; }
.cockpit-approval-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.25rem 0.75rem; }
.cockpit-approval-card dd { margin: 0; overflow-wrap: anywhere; }
.cockpit-approval-body { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 20rem; overflow: auto; }
.cockpit-approval-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.cockpit-approval-hint { font-size: 12px; color: var(--mute, currentColor); }
.cockpit-chat-sources-label { width: fit-content; cursor: pointer; font: 600 10px/1.6 var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.cockpit-chat-sources-label:hover { color: var(--ink); }
.cockpit-chat-sources-label:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.cockpit-chat-sources[open] .cockpit-chat-sources-label { margin-bottom: 4px; }
.cockpit-chat-sources ul { margin: 0; padding-left: 18px; }
.cockpit-chat-source { overflow-wrap: anywhere; }
/* A short screen (a laptop, a phone on its side) gives the history the height. */
@media (max-height: 760px) {
  .ask-intro .label { display: none; }
  /* A short screen keeps every rail module in reach. */
  .rail { gap: 4px; padding: 10px 0; }
  .logo { margin-bottom: 6px; }
  .rail-modules, .rail-addons { gap: 3px; }
  .ask-intro h1 { font-size: 28px; margin-bottom: 2px; }
  .ask-briefing { font-size: 13px; line-height: 1.45; }
}
@media (max-width: 760px) {
  /* Title and state share a line; the two controls share the next. */
  .cockpit-chat-toolbar { padding: 8px 10px; gap: 6px 8px; }
  .cockpit-chat-toolbar strong { flex: 1 1 0; }
  .cockpit-chat-actions { width: 100%; margin-left: 0; gap: 4px; }
  .cockpit-chat-actions .button-small { min-height: 30px; padding: 0 8px; font-size: 11px; }
  .cockpit-chat-turns { padding: 12px 10px; gap: 10px; }
}
/* The recent conversations, in the sidebar (#409): one line each, the list scrolls on its own. */
.cockpit-chat-recent-list { display: flex; flex-direction: column; max-height: 14.5rem; overflow-y: auto; overscroll-behavior: contain; }
.cockpit-chat-recent-list p { margin: 0; padding: 2px 20px 4px; font-size: 12px; line-height: 1.5; color: var(--mute); }
.cockpit-chat-recent { width: 100%; min-height: 2.15rem; flex: 0 0 auto; padding: 0 20px; border: 0; border-left: 2px solid transparent;
  background: transparent; color: var(--mute); text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cockpit-chat-recent:hover { background: rgba(10, 10, 10, .05); color: var(--ink); }

/* #427 language switcher (English / Svenska), on the sign-in card and in the top bar.
   The focus ring is ink like every other control; lime stays reserved for live signals. */
.locale-switch { display: inline-flex; gap: 2px; border: 1px solid var(--hdng-color-control-edge); border-radius: var(--hdng-radius-control); padding: 2px; }
.locale-switch-option { border: 0; background: transparent; color: inherit; font: inherit; font-size: 12px; padding: 4px 10px; border-radius: var(--hdng-radius-control); cursor: pointer; }
.locale-switch-option.is-active, .locale-switch-option[aria-pressed="true"] { background: var(--hdng-color-ink); color: var(--hdng-color-paper); }
.locale-switch-option:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* The auth card is a grid: the switcher takes its own full-width first row, right-aligned. */
.auth-card .locale-slot { grid-column: 1 / -1; grid-row: 1; align-self: flex-end; justify-self: end; }
.auth-card .locale-slot + .auth-brand { grid-row: 2 / span 4; }
.topbar .locale-slot { flex: 0 0 auto; }
@media (max-width: 640px) {
  .topbar .locale-slot { order: 10; margin-left: auto; }
  /* The crumbs give way to the switcher instead of pushing the page sideways. */
  .topbar .crumbs { min-width: 0; overflow: hidden; white-space: nowrap; }
  /* Only the current view is shown (#519): the scope and separator step aside visually but
     stay for screen readers, and a name longer than the room ellipsizes. */
  .topbar .crumbs > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .topbar .crumbs strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .topbar .locale-switch-option { padding: 4px 7px; font-size: 11px; }
}
@media (max-width: 480px) { .auth-card .locale-slot + .auth-brand { grid-row: auto; } }
/* Investor preview (demo/investor-2026-11-30): safe Markdown answers and clearer sources. */
.cockpit-chat-answer .md { line-height: 1.6; }
.cockpit-chat-answer .md > :first-child { margin-top: 0; }
.cockpit-chat-answer .md p { margin: 0 0 .6em; white-space: normal; }
.cockpit-chat-answer .md .md-h { margin: .9em 0 .35em; font-size: 15px; font-weight: 600; line-height: 1.3; }
.cockpit-chat-answer .md h3.md-h { font-size: 16px; }
.cockpit-chat-answer .md ul, .cockpit-chat-answer .md ol { margin: .2em 0 .7em; padding-left: 1.3em; }
.cockpit-chat-answer .md li { margin: .15em 0; }
.cockpit-chat-answer .md .md-strong { display: inline; font: inherit; font-weight: 600; text-transform: none; letter-spacing: normal; color: inherit; margin: 0; }
.cockpit-chat-answer .md code { font: 13px/1.4 var(--mono); background: var(--surface-2); padding: 1px 4px; border-radius: 3px; }
.cockpit-chat-answer .md .md-table { overflow-x: auto; margin: .4em 0 .8em; }
.cockpit-chat-answer .md table { border-collapse: collapse; font-size: 14px; min-width: 60%; }
.cockpit-chat-answer .md th, .cockpit-chat-answer .md td { border-bottom: 1px solid var(--hair); padding: 6px 10px; text-align: left; vertical-align: top; }
.cockpit-chat-answer .md th { font-weight: 600; border-bottom-color: var(--ink); }
.cockpit-chat-answer .md td:last-child, .cockpit-chat-answer .md th:last-child { white-space: nowrap; }
.cockpit-chat-answer .md hr { border: 0; border-top: 1px solid var(--hair); margin: .8em 0; }
.cockpit-chat-sources { color: var(--ink); }
.cockpit-chat-sources-label { text-transform: none; letter-spacing: 0; font-family: inherit; font-size: 12px; font-weight: 600; color: var(--mute); }
.cockpit-chat-sources ul { list-style: none; padding-left: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.cockpit-chat-source { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--hair); border-radius: 999px; padding: 3px 10px 3px 8px; background: var(--surface-2); font-size: 12.5px; }
.cockpit-chat-source::before { content: ""; width: 10px; height: 12px; flex: none; border: 1.5px solid currentColor; border-radius: 1.5px; opacity: .55; }
