/* Pontumi app. Loads after foundation.css and the landing theme.css, so the
   app and the landing share one palette, one type scale and both themes. */
body { font-family: var(--font-body); color: var(--ink); background: var(--bg); font-size: 16px; line-height: 1.6; }
button, input, select, textarea { font: inherit; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: .65rem 1.1rem; background: var(--accent-fill); color: var(--accent-on-fill); border: 0; border-radius: var(--radius-button); cursor: pointer; text-decoration: none; font-weight: 600; }
button:hover, .button:hover { filter: brightness(.95); }
button:disabled { opacity: .65; cursor: wait; }
button svg, .button svg { width: 20px; height: 20px; flex-shrink: 0; }
.quiet { background: var(--surface-2); color: var(--ink); }
a { color: var(--accent-text); text-underline-offset: 4px; }
input:not([type=checkbox]), select, textarea { display: block; width: 100%; min-width: 0; min-height: 48px; background: var(--surface); color: var(--ink); border: 1px solid var(--control-line); border-radius: var(--radius-sm); padding: .7rem .9rem; margin: .4rem 0 1rem; }
textarea { resize: vertical; }
input[type=checkbox] { width: 24px; height: 24px; flex-shrink: 0; accent-color: var(--accent); }
label { display: block; font-weight: 500; }
.check { min-height: 44px; display: flex; gap: .75rem; align-items: flex-start; margin: 1rem 0; font-weight: 400; }
.helper { color: var(--muted); font-size: .95rem; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: var(--tr-h2); line-height: 1.15; text-wrap: balance; }
h1 { font-size: clamp(2rem, 4vw, 3.25rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.25rem; }
p { max-width: 70ch; }
section { min-width: 0; }
.mono { font-family: var(--font-mono); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

/* Header */
.app-header { position: relative; display: flex; align-items: center; gap: 1.5rem; min-height: 64px; padding: .5rem clamp(1rem, 3vw, 2rem); background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; letter-spacing: -.03em; }
.brand-mark { width: 32px; height: 20px; }
.app-nav { display: flex; gap: .25rem; flex: 1; }
.app-nav a, .app-menu-panel nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .8rem; border-radius: var(--radius-sm); color: var(--muted-strong); text-decoration: none; font-weight: 500; }
.app-nav a:hover, .app-menu-panel nav a:hover { background: var(--surface-2); color: var(--ink); }
.app-nav a[aria-current], .app-menu-panel nav a[aria-current] { background: var(--accent-soft); color: var(--accent-text); }
.app-tools, .app-menu-tools { display: flex; align-items: center; gap: .5rem; }
.app-tools form, .app-menu-tools form { margin: 0; }
.app-tools button, .app-menu-tools button { min-height: 44px; padding: .5rem .9rem; font-weight: 500; }
.lang-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .6rem; color: var(--muted-strong); font-weight: 500; }
.app-menu { display: none; margin-left: auto; }
.app-menu summary { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; list-style: none; }
.app-menu summary::-webkit-details-marker { display: none; }
.app-menu-panel { position: absolute; z-index: 30; top: 100%; left: 0; right: 0; padding: .75rem 1rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow-soft); }
.app-menu-panel nav { display: grid; }
.app-menu-tools { flex-wrap: wrap; padding-top: .75rem; margin-top: .5rem; border-top: 1px solid var(--line); }

/* Footer */
.app-footer { padding: 2rem clamp(1rem, 5vw, 4rem); background: var(--surface-2); color: var(--muted); font-size: .95rem; }
.app-footer nav { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.app-footer a { display: inline-flex; align-items: center; min-height: 44px; }

/* Pages */
.page { padding: 3rem clamp(1rem, 5vw, 4rem); max-width: 1280px; margin: auto; }
.page > section { padding: 2.5rem 0; border-top: 1px solid var(--line); margin-top: 2rem; }
.eyebrow { font-family: var(--font-mono); font-size: .8rem; text-transform: var(--case-eyebrow); letter-spacing: var(--tr-eyebrow); color: var(--accent-text); }
.text-link { font-weight: 600; }

/* Sign in and sign up */
.auth-layout { display: grid; gap: 2.5rem; padding: clamp(2rem, 6vw, 5rem) clamp(1rem, 5vw, 4rem); max-width: 1280px; margin: auto; }
.auth-intro h1 { font-size: clamp(2.6rem, 6vw, 5rem); line-height: 1; letter-spacing: var(--tr-display); max-width: 12ch; }
.auth-intro .lead { font-size: 1.2rem; color: var(--muted-strong); margin-top: 1.25rem; }
.auth-points { margin: 1.5rem 0; padding: 0; list-style: none; display: grid; gap: .6rem; }
.auth-points li { position: relative; padding-left: 1.6rem; }
.auth-points li::before { content: ""; position: absolute; left: 0; top: .55em; width: .7rem; height: .7rem; border-radius: 50%; background: var(--accent-soft); border: 2px solid var(--accent); }
.auth-form { width: 100%; max-width: 480px; padding: clamp(1.25rem, 4vw, 2rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); }
.auth-form h2 { margin-bottom: 1.25rem; }
.auth-form button { width: 100%; }
.auth-alt { margin-top: 1.25rem; }
.auth-or { display: flex; align-items: center; gap: .75rem; color: var(--muted); font-size: .9rem; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.button-google { width: 100%; background: var(--surface); color: var(--ink); border: 1px solid var(--control-line); font-weight: 500; }
.button-google:hover { filter: none; border-color: var(--line-strong); }
.button-google:focus-visible { outline: 2px solid var(--accent-fill); outline-offset: 2px; }
.form-error { margin: 0 0 1.25rem; padding: .9rem 1rem; border-radius: var(--radius-sm); background: var(--accent-soft); border-left: 4px solid var(--accent); color: var(--ink); }
.form-error p { margin: 0; }
.form-error p + p { margin-top: .4rem; }

/* Error page */
.error-page { min-height: 55svh; max-width: 760px; }
.error-page h1 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); margin: .5rem 0 1rem; }
.error-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 1.5rem; }
.error-actions .text-link { display: inline-flex; align-items: center; min-height: 44px; }

/* Chat workspace: history on the left, conversation and composer on the right */
body.is-workspace { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
body.is-workspace main { flex: 1; min-height: 0; }
.workspace-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: 100%; }
.history { display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); border-right: 1px solid var(--line); }
.history-top { display: flex; gap: .5rem; padding: 1rem; }
.new-chat { flex: 1; justify-content: flex-start; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); }
.new-chat:hover { border-color: var(--accent); filter: none; }
.new-chat svg { color: var(--accent); }
.history-close { min-height: 48px; width: 48px; padding: 0; }
.history-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 .75rem 1rem; }
.history-group { margin: 1rem .5rem .35rem; font-family: var(--font-body); font-size: .78rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.history ul { margin: 0; padding: 0; list-style: none; }
.history-list a, .history-drafts a { display: block; min-height: 40px; padding: .55rem .6rem; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .95rem; }
.history-list a:hover, .history-drafts a:hover { background: var(--surface); }
.history-list a[aria-current] { background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.history-empty { margin: .5rem; color: var(--muted); font-size: .92rem; }
.history-drafts { padding: 0 .75rem .5rem; }
.history-foot { display: grid; padding: .75rem 1.25rem 1rem; border-top: 1px solid var(--line); font-size: .92rem; }
.history-foot a { display: inline-flex; align-items: center; min-height: 40px; }
.history-scrim { display: none; }

.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat-bar { display: flex; align-items: center; gap: .75rem; min-height: 56px; padding: .4rem clamp(1rem, 3vw, 2rem); border-bottom: 1px solid var(--line); }
.chat-bar h1 { flex: 1; min-width: 0; margin: 0; font-family: var(--font-body); font-size: 1rem; font-weight: 600; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-delete { margin: 0; }
.chat-delete button, .history-open { min-height: 40px; padding: .35rem .8rem; font-weight: 500; font-size: .92rem; }
.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.messages { max-width: 800px; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2rem) 2rem; display: flex; flex-direction: column; gap: 1.5rem; }
.message { min-width: 0; }
.message-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.message.user { align-self: flex-end; max-width: min(85%, 640px); padding: .75rem 1.1rem; background: var(--accent-soft); color: var(--ink); border-radius: 20px 20px 6px 20px; }
.message.assistant { align-self: stretch; }
.message-who { display: flex; align-items: center; gap: .5rem; margin: 0 0 .35rem; font-family: var(--font-body); font-size: .9rem; font-weight: 650; letter-spacing: 0; color: var(--muted-strong); }
.message.assistant .message-who::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--accent); }
.message-meta { margin: .5rem 0 0; color: var(--muted); font-family: var(--font-mono); font-size: .8rem; }
.message-actions { margin-top: .35rem; }
.message-actions .copy { min-height: 36px; padding: .25rem .7rem; font-size: .85rem; font-weight: 500; background: transparent; color: var(--muted-strong); border: 1px solid var(--line); }
.message.is-writing .message-text:empty::after { content: "…"; color: var(--muted); }

.messages-start { max-width: 1160px; width: 100%; }
.empty-chat { margin: 0 auto; padding: 1rem 0; width: 100%; max-width: 100%; }
.task-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin: 0; padding: 0; list-style: none; }
.task-tiles li { min-width: 0; }
.task-tile { width: 100%; height: 100%; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: .2rem; padding: .65rem .5rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); font-weight: 500; line-height: 1.25; text-align: center; text-decoration: none; overflow-wrap: anywhere; }
.task-tile:hover { border-color: var(--control-line); filter: none; }
.task-tile.is-chosen { border-color: var(--accent); background: var(--accent-soft); }
.task-tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.task-tile .glyph { display: grid; place-items: center; width: 72px; height: 72px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-text); flex-shrink: 0; }
.task-tile .glyph svg { width: 64px; height: 64px; }
.task-tile.is-pending .glyph { background: var(--surface-2); color: var(--muted-strong); }
.task-label { font-weight: 650; font-size: .875rem; }
.task-meta { display: flex; flex-direction: column; gap: .05rem; font-size: .75rem; font-weight: 500; color: var(--muted-strong); }
.task-cost { font-family: var(--font-mono); color: var(--muted); }
.task-pending { color: var(--muted-strong); font-weight: 650; }
.task-status { margin: 0 0 .6rem; font-size: .88rem; color: var(--muted-strong); text-align: left; }
.task-status:empty { margin: 0; }
@media (min-width: 1100px) {
  .messages-start { padding-top: .5rem; padding-bottom: .5rem; }
  .empty-chat { padding: .25rem 0; }
  .task-tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; }
  .task-tile { padding: .35rem; gap: .1rem; }
  .task-label { font-size: .8125rem; }
  .task-tile .glyph { width: 72px; height: 72px; }
  .task-tile .glyph svg { width: 72px; height: 72px; }
}
@media (min-width: 1400px) {
  .task-tiles { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .task-tile .glyph { width: 80px; height: 80px; }
  .task-tile .glyph svg { width: 80px; height: 80px; }
}
@media (min-width: 1800px) {
  .task-tiles { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .task-tile .glyph { width: 88px; height: 88px; }
  .task-tile .glyph svg { width: 88px; height: 88px; }
}

.composer-wrap { padding: 0 clamp(.75rem, 3vw, 2rem) .75rem; }
.chat-notice, .composer, .composer-foot { max-width: 800px; margin-left: auto; margin-right: auto; }
.chat-notice { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem 1rem; margin-bottom: .6rem; padding: .7rem 1rem; border-radius: var(--radius-sm); background: var(--accent-soft); border-left: 4px solid var(--accent); }
.chat-notice p { margin: 0; font-weight: 500; }
.chat-notice a { display: inline-flex; align-items: center; min-height: 36px; }
.chat-notice.is-info { background: var(--surface-2); border-left-color: var(--line-strong); }
.composer { padding: .5rem .5rem .5rem .9rem; background: var(--surface); border: 1px solid var(--control-line); border-radius: 22px; box-shadow: var(--shadow-soft); }
.composer:focus-within { border-color: var(--accent); }
.composer textarea { min-height: 52px; max-height: 40vh; margin: 0; padding: .55rem .1rem; border: 0; background: transparent; resize: none; line-height: 1.5; }
.composer textarea:focus-visible { outline: none; }
.composer-bar { display: flex; align-items: center; gap: .6rem; }
.model-picker { width: auto; max-width: min(60%, 340px); min-height: 44px; margin: 0; padding: .35rem 2rem .35rem .8rem; border: 1px solid var(--line); border-radius: 999px; background-color: var(--surface-2); font-size: .9rem; font-weight: 500; text-overflow: ellipsis; }
.composer-hint { flex: 1; min-width: 0; color: var(--muted); font-size: .82rem; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.send { width: 44px; min-height: 44px; height: 44px; padding: 0; border-radius: 50%; flex-shrink: 0; }
.send-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.composer-foot { margin-top: .45rem; color: var(--muted); font-size: .8rem; text-align: center; }
.composer-foot a { color: var(--muted-strong); }
/* Attachments: the tray above the prompt, the drop state and files in sent messages. */
.composer { position: relative; }
.attach { width: 40px; min-height: 40px; height: 40px; padding: 0; border-radius: 50%; flex-shrink: 0; color: var(--muted-strong); }
.attach:hover { color: var(--ink); }
.drop-hint { display: none; }
.composer.is-dropping { border-color: var(--accent); border-style: dashed; background: var(--accent-soft); }
.composer.is-dropping .drop-hint { display: flex; position: absolute; inset: 0; z-index: 2; align-items: center; justify-content: center; margin: 0; border-radius: inherit; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; pointer-events: none; }
.attach-tray { display: flex; flex-wrap: wrap; gap: .5rem; margin: .1rem 0 .25rem -.4rem; padding: 0; list-style: none; }
.attach-item { display: flex; align-items: center; gap: .6rem; max-width: 100%; min-height: 56px; padding: .35rem .35rem .35rem .4rem; border-radius: 14px; background: var(--surface-2); }
.attach-item.is-uploading { opacity: .7; }
.attach-item .file-preview, .attach-item .file-kind { width: 44px; height: 44px; flex-shrink: 0; border-radius: 10px; object-fit: cover; background: var(--surface); }
.file-kind { display: inline-flex; align-items: center; justify-content: center; padding: 0 .4rem; border-radius: 8px; background: var(--accent-soft); color: var(--accent-text); font-size: .72rem; font-weight: 700; letter-spacing: .02em; }
.file-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.file-name { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; font-weight: 500; }
.file-size { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.file-remove { width: 36px; min-height: 36px; height: 36px; padding: 0; border-radius: 50%; background: transparent; color: var(--muted-strong); flex-shrink: 0; }
.file-remove:hover { background: var(--surface); color: var(--ink); filter: none; }
.file-remove svg { width: 16px; height: 16px; }
.message-files { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0 0; padding: 0; list-style: none; }
.message-files li { margin: 0; }
.file-thumb { display: block; overflow: hidden; border-radius: 12px; line-height: 0; }
.file-thumb img, .file-thumb .file-preview { display: block; width: auto; max-width: min(240px, 100%); max-height: 200px; object-fit: cover; }
.file-chip { display: inline-flex; align-items: center; gap: .5rem; max-width: 100%; min-height: 44px; padding: .3rem .8rem .3rem .3rem; border-radius: 12px; background: var(--surface); color: var(--ink); text-decoration: none; }
.file-chip .file-kind, .file-chip .file-preview { min-width: 36px; height: 36px; }
.file-chip .file-preview { width: 36px; border-radius: 8px; object-fit: cover; }

@media (max-width: 759px) {
  .app-nav, .app-tools { display: none; }
  .app-menu { display: block; }
  .app-header { min-height: 56px; }
  .workspace-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .history { max-height: 30vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .history-foot { display: none; }
  .js .workspace-layout { grid-template-rows: minmax(0, 1fr); }
  .js .history { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(86vw, 330px); max-height: none; transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow-soft); border-right: 1px solid var(--line); }
  .js .history.is-open { transform: none; }
  .js .history-foot { display: grid; }
  .js .history-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 35; min-height: 0; padding: 0; border-radius: 0; background: rgba(15, 18, 34, .45); }
  .chat-bar { padding: .35rem .75rem; }
  .messages { padding: 1rem .9rem 1.5rem; gap: 1.1rem; }
  .message.user { max-width: 90%; }
  .empty-chat { padding-top: 1.5rem; }
  .composer-wrap { padding: 0 .5rem .5rem; }
  .composer-hint { display: none; }
  .model-picker { max-width: none; flex: 1; }
  .composer-foot { display: none; }
  .attach-tray { flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x proximity; margin-right: -.4rem; padding-bottom: .15rem; }
  .attach-item { flex: 0 0 auto; max-width: 78%; scroll-snap-align: start; }
  .file-name { max-width: 9.5rem; }
}
@media (pointer: coarse) { .composer-hint { display: none; } .file-remove, .attach { width: 44px; min-height: 44px; height: 44px; } }

/* Account, usage, compare and draft pages */
.account-band, .settings-grid, .plan-list { display: grid; gap: 2rem; }
.account-band { background: var(--surface-2); padding: 2rem !important; border-radius: var(--radius); border-top: 0 !important; }
.plan-list form { padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.plan-list form button { width: 100%; }
.plan-price, .big-number { font-family: var(--font-mono); font-size: 2rem; font-weight: 600; }
.big-number small, .plan-price small { font-family: var(--font-body); font-size: 1rem; font-weight: 400; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .85rem; vertical-align: top; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); }
.page details { padding: 1rem 0; border-bottom: 1px solid var(--line); }
.page summary { cursor: pointer; min-height: 44px; font-weight: 600; }
.page details form { padding: 1rem 0; }
fieldset { border: 0; padding: 0; margin: 0; }
.facts-row { display: flex; flex-wrap: wrap; gap: 2rem; margin: 2rem 0; }
.facts-row strong { display: block; font-family: var(--font-mono); font-size: 2rem; }
.legal { max-width: 900px; }
.skip-link { position: absolute; left: 1rem; top: -100px; padding: 1rem; background: var(--surface); color: var(--ink); z-index: 50; }
.skip-link:focus { top: 0; }
.compare-form { max-width: 900px; }
.model-checks { display: grid; gap: 0 2rem; }
.model-checks .check { margin: .4rem 0; }
.compare-results { display: grid; gap: 2rem; padding-top: 2rem; }
.compare-answer { padding-top: 1rem; border-top: 2px solid var(--line-strong); min-width: 0; }
.compare-answer h2 { font-size: 1.2rem; }
.compare-meta { color: var(--muted); font-size: .9rem; margin-top: 1rem; }
.compare-error { color: var(--ink); font-weight: 600; }
.page .message { padding: 1.2rem 0; border-top: 1px solid var(--line); }
meter { display: block; width: 100%; max-width: 640px; height: 1.25rem; margin: .5rem 0 1rem; }
.usage-split { display: grid; gap: 2rem; }
.weights { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0 2rem; }
.weights div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: .4rem 0; }
.day-bars { list-style: none; padding: 0; display: grid; gap: .35rem; max-width: 720px; }
.day-bars li { display: grid; grid-template-columns: 4rem 1fr 3.5rem; gap: 1rem; align-items: center; }
.day-bars progress { width: 100%; height: .9rem; accent-color: var(--accent); }
.econ td, .econ th { white-space: nowrap; }
.chat-tools { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }

@media (min-width: 760px) {
  .auth-layout { grid-template-columns: 1.15fr 1fr; align-items: center; }
  .account-band, .settings-grid { grid-template-columns: 1fr 1fr; }
  .plan-list { grid-template-columns: repeat(3, 1fr); }
  .model-checks, .usage-split { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1100px) { .compare-results { grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* A reading surface beside the conversation. Mobile uses one full-height screen. */
.preview-panel { position: fixed; inset: 0; z-index: 45; display: flex; flex-direction: column; min-width: 0; background: var(--surface); }
.preview-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 72px; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.preview-header > div { min-width: 0; }
.preview-label { margin: 0 0 .15rem; font-size: .8rem; color: var(--muted); }
.preview-header h2 { margin: 0; font-family: var(--font-body); font-size: 1rem; font-weight: 600; letter-spacing: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-header button { flex-shrink: 0; width: 44px; min-height: 44px; padding: 0; background: transparent; }
.preview-tabs { display: flex; gap: .25rem; padding: .5rem .75rem; overflow-x: auto; border-bottom: 1px solid var(--line); }
.preview-tabs button { flex: 0 0 auto; min-height: 44px; max-width: 180px; padding: .4rem .7rem; background: transparent; color: var(--muted-strong); border-radius: var(--radius-sm); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-tabs button[aria-current="true"] { background: var(--surface-2); color: var(--ink); }
.preview-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem; background: var(--bg); overscroll-behavior: contain; }
.preview-body img, .preview-body video { display: block; width: 100%; max-height: 100%; object-fit: contain; margin: auto; }
.preview-body .pdf-page-image { max-height: none; background: var(--surface); }
.preview-body .preview-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.preview-footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 60px; padding: .4rem 1rem; border-top: 1px solid var(--line); }
.preview-footer a { display: inline-flex; align-items: center; min-height: 44px; font-size: .88rem; }
.pdf-controls { display: flex; align-items: center; gap: .5rem; }
.pdf-controls button { width: 44px; min-height: 44px; padding: 0; font-size: 1.5rem; }
.pdf-controls span { font-family: var(--font-mono); font-size: .85rem; }
.preview-trigger { display: inline-flex; align-items: center; min-height: 44px; padding: .25rem .6rem; background: transparent; color: var(--muted-strong); border-radius: var(--radius-sm); font-size: .88rem; }
.message-actions { display: flex; align-items: center; gap: .5rem; }
.latest-message { align-self: center; margin: -.3rem 0 .6rem; min-height: 44px; padding: .35rem 1rem; border: 1px solid var(--line); font-size: .88rem; }
.composer textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.file-remove, .attach { width: 44px; min-height: 44px; height: 44px; }
.chat-delete button, .history-open { min-height: 44px; }
@media (min-width: 1000px) {
  .workspace-layout.has-preview { grid-template-columns: 210px minmax(340px, 1fr) minmax(340px, 42%); }
  .preview-panel { position: static; z-index: auto; min-height: 0; border-left: 1px solid var(--line); }
  .has-preview .composer-hint { display: none; }
  .has-preview .model-picker { max-width: none; flex: 1; }
  .has-preview .messages { padding-inline: 1.25rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .preview-panel:not([hidden]) { animation: preview-in .18s ease-out; }
  @keyframes preview-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
}

.file-open { padding: 0; min-width: 44px; min-height: 44px; background: transparent; color: var(--ink); border-radius: var(--radius-sm); }

.answer-state { color: var(--muted-strong); font-size: .95rem; margin-block: .8rem; }
.continue-answer { min-height: 44px; padding: .5rem 1rem; color: var(--accent-text); }

.voice { width: 44px; height: 44px; min-height: 44px; padding: 0; flex-shrink: 0; border-radius: 50%; color: var(--muted-strong); }
.voice svg { width: 20px; height: 20px; }
.voice[aria-pressed="true"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--accent); }
#voice-status:not([hidden]), #voice-policy:not([hidden]) { display: block; }
/* Live voice meter: replaces the bar's secondary controls while recording. */
.voice-meter:not([hidden]) { display: flex; flex: 1; min-width: 0; align-items: center; gap: .55rem; height: 44px; padding: 0 .7rem 0 0; border-radius: 22px; background: var(--accent-soft); }
.voice-cancel { width: 44px; height: 44px; min-height: 44px; padding: 0; flex-shrink: 0; border-radius: 50%; background: transparent; color: var(--muted-strong); }
.voice-cancel svg { width: 18px; height: 18px; }
.voice-cancel:hover { color: var(--ink); background: var(--surface-2); }
.voice-dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; background: var(--accent); }
.voice-wave { flex: 1; min-width: 0; width: 100%; height: 28px; color: var(--accent); }
.voice-time { flex-shrink: 0; min-width: 2.6em; color: var(--muted-strong); font-size: .85rem; font-variant-numeric: tabular-nums; text-align: right; }
.voice-time.is-ending { color: var(--accent-text); font-weight: 600; }
.composer.is-recording .attach, .composer.is-recording .model-picker, .composer.is-recording .composer-hint { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .voice-dot { animation: voice-pulse 1.2s ease-in-out infinite; }
  @keyframes voice-pulse { 50% { opacity: .35; } }
}

/* Neutral, original provider monograms; native select remains the no-JS fallback. */
.provider-icon { width: 36px; height: 36px; flex: 0 0 36px; color: var(--accent-text); }
.provider-icon text { font-family: var(--font-body); font-size: 13px; font-weight: 700; }
.model-trigger { min-width: 0; min-height: 44px; max-width: 340px; gap: .4rem; padding: .2rem .6rem; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); }
.model-trigger .provider-icon { width: 28px; height: 28px; flex-basis: 28px; }
.model-trigger-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.picker-chevron { width: 18px; height: 18px; flex: 0 0 18px; }
.model-dialog { color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 1.25rem; width: min(900px, calc(100% - 2rem)); max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain; box-shadow: var(--shadow-soft); }
.model-dialog::backdrop { background: var(--scrim, rgba(15, 18, 34, .6)); }
.model-dialog-header { position: sticky; top: -1.25rem; z-index: 1; background: var(--surface); padding: .5rem 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.model-dialog-header h2 { margin: 0; font-size: 1.35rem; }
.model-dialog-header button { min-height: 44px; color: var(--ink); }
.model-dialog-note { margin: .65rem 0 1rem; color: var(--muted-strong); font-size: .88rem; line-height: 1.5; }
.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; }
.model-choice { position: relative; display: flex; width: 100%; align-items: flex-start; gap: .75rem; padding: 1rem .5rem; min-height: 44px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); text-align: left; font-weight: 400; line-height: 1.4; }
.model-choice:hover { background: var(--surface-2); filter: none; }
.model-choice[aria-pressed="true"] { background: var(--accent-soft); }
.model-choice:disabled { opacity: 1; color: var(--muted-strong); cursor: not-allowed; }
.model-choice-body { display: grid; gap: .25rem; flex: 1; min-width: 0; font-size: .86rem; }
.model-choice strong { font-size: .97rem; font-weight: 650; }
.model-vendor { font-size: .75rem; color: var(--muted-strong); }
.model-cost { color: var(--accent-text); font-weight: 600; }
.model-badge { font-size: .75rem; font-weight: 600; color: var(--muted-strong); }
.model-unavailable { font-size: .8rem; text-decoration: underline; text-underline-offset: 3px; }
.model-selected { display: none; font-size: .72rem; color: var(--accent-text); }
.model-choice[aria-pressed="true"] .model-selected { display: inline; }
.model-auto { grid-column: 1 / -1; }
.latest-message { margin: .25rem 0 .5rem; flex-shrink: 0; }
.composer.is-recording .model-trigger { display: none; }
@media (max-width: 760px) {
  .model-dialog { position: fixed; inset: auto 0 0; margin: 0; width: 100%; max-width: none; max-height: 82dvh; padding: 1rem 1rem max(1rem, env(safe-area-inset-bottom)); border-radius: var(--radius) var(--radius) 0 0; }
  .model-dialog-header { top: -1rem; }
  .model-grid { grid-template-columns: minmax(0, 1fr); }
  .model-trigger { flex: 1; max-width: none; }
  .composer textarea { min-height: 44px; max-height: 24dvh; padding: .35rem .1rem; }
  .composer-bar { gap: .35rem; }
  .composer { padding: .3rem .4rem .35rem .65rem; }
  .composer-wrap { flex-shrink: 0; }
  .composer-foot#voice-policy:not([hidden]), .composer-foot#voice-status:not([hidden]) { display: block; text-align: left; font-size: .72rem; line-height: 1.35; margin: .35rem .25rem 0; }
  .empty-chat { padding-top: .6rem; }
  .task-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .task-tile { padding: .65rem .5rem; gap: .2rem; }
  .attach, .voice, .send { width: 44px; height: 44px; min-height: 44px; padding: .5rem; flex-shrink: 0; }
}

/* Small sign-off line under every app page and the chat list. */
.tagline { margin: .75rem 0 0; font-size: var(--fs-small); color: var(--muted); }
.tagline a { display: inline; min-height: 0; color: inherit; }
.history-foot .tagline { margin-top: .25rem; }

/* Owner agent reports (/admin/agents): a ledger read top to bottom.
   Tabs are two large text switches, groups are hairline rule lists, the
   budget table is the one bordered panel. Priority uses a left rail. */
.admin-links { margin: 1rem 0 0; }
.crumb { margin: 0 0 .5rem; font-size: var(--fs-small); }
.crumb a { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted-strong); }
.agents-page h1 { margin: 0; }
.agents-page h2 { font-size: clamp(1.3rem, 2.2vw, 1.7rem); margin: 0 0 1rem; }
.agent-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 2rem 0 0; border-bottom: 1px solid var(--line-strong); }
.agent-tabs a { display: grid; gap: .2rem; min-height: 64px; padding: .75rem 1rem .9rem 0; color: var(--muted-strong); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.agent-tabs a strong { font-family: var(--font-display); font-size: clamp(1.3rem, 3vw, 1.9rem); color: var(--ink); }
.agent-tabs a span { font-size: var(--fs-small); }
.agent-tabs a[aria-current] { border-bottom-color: var(--accent); }
.agent-tabs a[aria-current] strong { color: var(--accent-text); }
.agent-tabs a:not([aria-current]) strong { color: var(--muted-strong); }
.agent-notice { margin: 1.25rem 0 0; padding: .75rem 1rem; background: var(--accent-soft); color: var(--ink); border-radius: var(--radius-sm); }
.agent-notice.is-error { box-shadow: inset 4px 0 0 var(--alarm); background: var(--surface-2); }
.report-head { padding: 1.5rem 0 0; }
.report-meta { margin: 0; font-size: var(--fs-small); color: var(--muted); }
.report-summary { max-width: 70ch; font-size: 1.1rem; color: var(--muted-strong); margin: .75rem 0 0; }
.report-block { padding: 2rem 0; border-bottom: 1px solid var(--line); }
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1.5rem 2rem; margin: 0; }
.figures div { display: grid; gap: .2rem; align-content: start; }
.figures dt { font-size: var(--fs-small); color: var(--muted-strong); }
.figures dd { margin: 0; font-size: var(--fs-small); }
.figures dd strong { font-family: var(--font-mono); font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 600; color: var(--ink); }
.figures .unit { color: var(--muted); }
.priorities div { padding-left: .9rem; box-shadow: inset 3px 0 0 var(--line-strong); }
.prio-p0 { --rail: var(--alarm); } .prio-p1 { --rail: var(--caution); } .prio-p2 { --rail: var(--accent); } .prio-p3 { --rail: var(--muted); }
.priorities div[class^="prio-"] { box-shadow: inset 3px 0 0 var(--rail); }
.funnel { margin: 0; padding: 0; list-style: none; }
.funnel li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem 1rem; padding: .75rem 0; border-top: 1px solid var(--line); }
.funnel li > span:nth-of-type(2), .funnel-note { grid-column: 1 / -1; font-size: var(--fs-small); }
.funnel strong { font-size: 1.25rem; }
.table-scroll { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); margin-top: 1rem; }
.agents-page th.num, .agents-page td.num { text-align: right; }
.agents-page tfoot th, .agents-page tfoot td { font-weight: 600; border-bottom: 0; color: var(--ink); }
.cell-note { display: block; font-weight: 400; font-size: var(--fs-small); white-space: normal; }
.flag-over { color: var(--alarm); font-weight: 600; }
.plan-list, .bug-list, .update-list { margin: 0; padding: 0; list-style: none; }
.plan-list li, .bug-list li, .update-list li { display: grid; grid-template-columns: 1fr; gap: .25rem 1.5rem; padding: 1rem 0; border-top: 1px solid var(--line); }
.plan-list p, .bug-list p, .update-list p { margin: 0; }
.plan-list h3 { margin: 0 0 .25rem; font-size: 1.1rem; }
.plan-when, .bug-id, .update-date { font-size: var(--fs-small); color: var(--muted); }
.plan-list li.is-done, .plan-list li.is-dropped { color: var(--muted-strong); }
.state { display: inline-block; margin-left: .35rem; padding: .05rem .5rem; border-radius: 999px; font-family: var(--font-body); font-size: .78rem; font-weight: 600; vertical-align: .15em; background: var(--surface-2); color: var(--muted-strong); }
.state-open, .state-running { background: var(--accent-soft); color: var(--accent-text); }
.state-in_progress { background: var(--accent-soft); color: var(--ink); }
.state-fixed, .state-verified, .state-done { color: var(--ok); }
.prio-head { display: flex; align-items: baseline; gap: .75rem; margin: 1.75rem 0 .25rem; padding-left: .9rem; font-family: var(--font-mono); font-size: 1.15rem; box-shadow: inset 3px 0 0 var(--rail); }
.prio-head span { font-family: var(--font-body); font-size: var(--fs-small); font-weight: 400; }
.bug-title { font-weight: 600; }
.bug-list a, .update-list a { color: var(--accent-text); }
.page > .updates-band { margin: 0 calc(-1 * clamp(1rem, 5vw, 4rem)); padding: 2rem clamp(1rem, 5vw, 4rem); background: var(--surface-2); border-bottom: 0; }
.kind { margin-left: .35rem; font-size: var(--fs-small); color: var(--muted-strong); }
.deadline { color: var(--caution); font-weight: 600; }
.report-empty { padding: 2.5rem 0; max-width: 65ch; border-bottom: 1px solid var(--line); }
.agent-edit { padding: 2.5rem 0; }
.agent-edit code { font-size: .9em; }
.edit-grid { display: grid; gap: 2rem; margin-top: 1.5rem; }
.edit-grid form { display: grid; gap: .6rem; align-content: start; }
.edit-grid label { font-weight: 600; }
.edit-grid input[type="file"] { min-height: 48px; padding: .6rem 0; }
.edit-grid textarea { width: 100%; min-height: 18rem; padding: .75rem; font-family: var(--font-mono); font-size: .85rem; line-height: 1.45; color: var(--ink); background: var(--surface); border: 1px solid var(--control-line); border-radius: var(--radius-sm); resize: vertical; }
.edit-grid button { justify-self: start; }
.agent-history ol { margin: 0; padding: 0; list-style: none; }
.agent-history li { padding: .25rem 0; }
.agent-history a { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--font-mono); font-size: var(--fs-small); }
.agent-history a[aria-current] { font-weight: 700; }
@media (min-width: 760px) {
  .plan-list li, .bug-list li, .update-list li { grid-template-columns: 11rem minmax(0, 1fr); }
  .edit-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
}
