:root {
  --gutter: 16px;
  --type-tag: 12px; --type-meta: 15px; --type-body: 16px; --type-lead: clamp(17px, 1.5vw, 20px);
  --type-stat: 20px; --type-title: clamp(26px, 3vw, 36px); --type-figure: clamp(28px, 2.6vw, 34px); --type-spoken: clamp(18px, 1.6vw, 22px);
  --type-hero: clamp(64px, min(19vw, 12vh), 112px);
  --type-display: clamp(34px, 9vw, 48px); --type-hero-small: clamp(52px, min(15vw, 10vh), 88px);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; min-width: 320px; background: var(--ground); color: var(--ink); font-family: var(--font-sans); }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
button:focus-visible, input:focus-visible, a:focus-visible, .conversation:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.surface:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
input:focus-visible { outline: 0; border-color: var(--focus); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label { display: block; margin: 0 0 6px; color: var(--ink-3); font-size: var(--type-tag); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.muted, .sub { color: var(--ink-2); font-size: var(--type-meta); }
.sub { margin: 4px 0 0; }

.stage { min-height: 100%; }
.device { position: relative; display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-width: 0; background: var(--ground); }
.stage-note { display: none; }

.device-bar { flex: 0 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 52px; padding: calc(6px + env(safe-area-inset-top)) calc(var(--gutter) + env(safe-area-inset-right)) 6px calc(var(--gutter) + env(safe-area-inset-left)); border-bottom: 1px solid var(--hairline); background: var(--ground); color: var(--ink); font-size: var(--type-meta); }
.device-brand { margin: 0; font-size: var(--type-lead); font-weight: 800; white-space: nowrap; }
.device-brand span { margin-left: 8px; padding: 1px 7px; border: 1.5px solid currentColor; font-size: var(--type-tag); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; vertical-align: 2px; }
.device-bar-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.device-clock { display: none; font-variant-numeric: tabular-nums; white-space: nowrap; }
.connection { display: inline-flex; gap: 7px; align-items: center; white-space: nowrap; }
.connection::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); }
.connection.ready::before { background: var(--signal-ok); }
.connection.error::before { background: var(--signal-late); }
.bell, .account { min-height: 40px; padding: 0 14px; border-radius: var(--radius-pill); font-size: var(--type-meta); font-weight: 800; white-space: nowrap; }
.bell { border: 0; background: var(--warn); color: var(--shell-ink); }
.bell[hidden], .account[hidden] { display: none; }
.account { border: 1.5px solid var(--ink-3); background: transparent; color: var(--ink); }
.account.signed-in { border-color: var(--shell); background: var(--shell); color: var(--shell-ink); }

.lifecycle { flex: 0 0 auto; margin: 12px calc(var(--gutter) + env(safe-area-inset-right)) 0 calc(var(--gutter) + env(safe-area-inset-left)); }
.lifecycle ol { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; padding: 0; }
.lifecycle[hidden] { display: none; }
.lifecycle li { position: relative; min-width: 0; padding: 18px 2px 0; color: var(--ink-3); font-size: var(--type-tag); font-weight: 700; text-align: center; white-space: nowrap; }
.lifecycle li::before { content: ""; position: absolute; top: 6px; left: 0; right: 0; height: 2px; background: var(--hairline); }
.lifecycle li::after { content: ""; position: absolute; top: 2px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border: 2px solid var(--ink-3); border-radius: 50%; background: var(--ground); }
.lifecycle li.done { color: var(--ink-2); }
.lifecycle li.done::before { background: var(--ink); }
.lifecycle li.done::after { border-color: var(--ink); background: var(--ink); }
.lifecycle li.now { color: var(--ink); font-weight: 800; }
.lifecycle li.now::before { background: linear-gradient(90deg, var(--ink) 50%, var(--hairline) 50%); }
.lifecycle li.now::after { top: 0; width: 14px; height: 14px; margin-left: -7px; border-color: var(--ink); background: var(--ink); }

.message { display: none; margin: 0 0 12px; padding: 10px 14px; border-radius: var(--radius-soft); color: var(--late); background: var(--late-tint); font-size: var(--type-meta); font-weight: 600; line-height: 1.45; }
.message.visible { display: block; }
.message.success { color: var(--ok); background: var(--ok-tint); }
.retry { min-height: 44px; margin: 0 0 12px; padding: 0 18px; border: 1.5px solid var(--shell); border-radius: var(--radius-pill); background: transparent; color: var(--ink); font-size: var(--type-meta); font-weight: 800; }
.retry[hidden] { display: none; }
.retry:hover { background: var(--shell-tint); }

.surface { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 14px calc(var(--gutter) + env(safe-area-inset-right)) 18px calc(var(--gutter) + env(safe-area-inset-left)); scrollbar-width: thin; }
.surface:not(:has(> [data-surface="confirm"]:not([hidden]))) { mask-image: linear-gradient(#000 calc(100% - 24px), transparent); }
.card[hidden] { display: none; }
.card h2[tabindex="-1"]:focus { outline: none; }
.diff { font-weight: 800; text-decoration: underline; text-decoration-color: var(--shell); text-decoration-thickness: 3px; text-underline-offset: 4px; text-decoration-skip-ink: none; }
.outcome { display: inline-block; color: var(--ok); font-size: var(--type-tag); font-weight: 800; letter-spacing: .06em; line-height: 1.3; text-transform: uppercase; white-space: nowrap; }
.outcome.late { color: var(--late); text-decoration: underline dashed 2px; text-underline-offset: 4px; }
.card h2 { margin: 0 0 6px; font-size: var(--type-title); line-height: 1.15; letter-spacing: -.01em; }
.card .lead { margin: 0; font-size: var(--type-lead); line-height: 1.4; font-weight: 600; }
.card .note { margin: 12px 0 0; color: var(--ink-3); font-size: var(--type-meta); line-height: 1.5; }
.band { margin: 8px 0 0; color: var(--ink); font-size: var(--type-body); font-weight: 700; line-height: 1.4; }
.band.ok { color: var(--ok); }
.band.late { color: var(--late); }
.band.warn { color: var(--warn); }

.home-head { margin-bottom: 18px; }
.home-head h2 { margin: 0; }
.night-figure { display: flex; align-items: center; gap: 14px; margin: 12px 0 0; }
.night-figure strong { font-size: var(--type-hero); font-weight: 800; line-height: .9; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.night-figure span { color: var(--ink-2); font-size: var(--type-lead); font-weight: 700; line-height: 1.25; }
.night-figure.late strong { color: var(--late); }
.night { margin: 14px 0 0; }
.night-lanes { display: block; width: 100%; height: auto; overflow: visible; }
.lane-key { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; color: var(--ink-3); font-size: var(--type-tag); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.key-promise { width: 2px; height: 12px; background: var(--ink-2); }
.key-delay { width: 22px; height: 3px; margin-left: 10px; background: repeating-linear-gradient(90deg, var(--late) 0 4px, transparent 4px 7px); }
.lane-lead, .lane-tail { fill: none; stroke-linecap: round; }
.lane-lead { stroke: var(--ink); stroke-width: 2; }
.lane-lead.risk { stroke-width: 3; }
.lane-lead.done { stroke: var(--ink-3); }
.lane-tail { stroke: var(--late); stroke-width: 2.5; stroke-dasharray: 3 5; }
.lane-tail.risk { stroke-width: 4; }
.lane-promise { stroke: var(--ink-2); stroke-width: 1.5; }
.lane-end, .lane-hub { fill: var(--ink); }
.lane-end.late { fill: var(--late); }
.lane-end.done { fill: var(--ink-3); }
.lane-id, .lane-delay { fill: var(--ink-2); font-size: calc(var(--type-tag) + 2px); font-weight: 800; letter-spacing: .06em; }
.lane-delay.late { fill: var(--late); }
.lane-delay.done { fill: var(--ink-3); }
.queue { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); margin: 0 -10px; padding: 0; }
.queue li + li { border-top: 1px solid var(--hairline); }
.incident-card { width: 100%; height: 100%; display: grid; gap: 6px; align-content: start; padding: 12px 10px; border: 0; border-radius: var(--radius-soft); background: transparent; text-align: left; }
.incident-card:hover { background: var(--surface); }
.incident-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.incident-top .incident-id { font-size: var(--type-stat); font-weight: 800; }
.incident-top { column-gap: 12px; }
.incident-top .critical, .incident-top .at-risk, .incident-top .state, .incident-top .executed, .incident-top .start-here { font-size: var(--type-tag); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.incident-top .start-here { color: var(--ink); }
.incident-top .at-risk { color: var(--late); }
.incident-top .critical { color: var(--warn); }
.incident-top .state { color: var(--ink-3); }
.incident-top .executed { color: var(--ok); }
.incident-card .incident-text { color: var(--ink-2); font-size: var(--type-body); line-height: 1.4; }
.session-strip { list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; margin: 22px 0 0; padding: 0; }
.session-strip li { display: grid; gap: 2px; align-content: start; padding: 0; }
.session-strip strong { font-size: var(--type-body); font-variant-numeric: tabular-nums; }
.session-strip span { color: var(--ink-3); font-size: var(--type-meta); }
.session-strip li.late strong { color: var(--late); }
.session-strip.empty { display: block; }
.session-strip.empty li { padding: 0; border: 0; background: none; color: var(--ink-3); font-size: var(--type-meta); }

.incident-head .band { margin: 6px 0 0; }
.incident-head h2 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: var(--type-display); letter-spacing: -.02em; }
.incident-id { font-variant-numeric: tabular-nums; white-space: nowrap; }
.incident-route { margin: 0; color: var(--ink-2); font-size: var(--type-body); line-height: 1.5; }
.plan-line { margin: 8px 0 0; color: var(--ink-2); font-size: var(--type-body); font-weight: 700; line-height: 1.45; }
.incident-figure { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 10px 0 0; color: var(--ink-2); }
.incident-figure strong { color: var(--ink); font-size: var(--type-hero-small); font-weight: 800; line-height: .95; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.incident-figure.late strong { color: var(--late); }
.incident-figure span { color: var(--ink); font-size: var(--type-lead); font-weight: 700; }
.incident-figure small { color: var(--ink-3); font-size: var(--type-meta); }
.incident-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 16px; }
.device-map { margin: 0; }
.device-map svg { display: block; width: 100%; height: auto; overflow: visible; }
.device-map figcaption { margin-top: 4px; }
.trails { animation: trail-reveal 1.4s cubic-bezier(.16, 1, .3, 1) backwards; }
.settled .trails { animation: none; }
@keyframes trail-reveal { from { clip-path: inset(-40% 100% -40% -10%); } to { clip-path: inset(-40% -10% -40% -10%); } }
.trail { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.trail.late { stroke: var(--late); stroke-dasharray: 2 6; }
.trail.ghost { stroke: var(--rule); stroke-width: 1.5; stroke-dasharray: 2 6; }
.trail-glow { fill: none; stroke: var(--ink); stroke-width: 7; stroke-linecap: round; opacity: .35; }
.place { fill: var(--ink); }
.place-origin, .place-source { fill: var(--ground); stroke: var(--ink); stroke-width: 2; }
.place-label { fill: var(--ink-2); font-size: 14px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.trail-label { fill: var(--ink); font-size: calc(var(--type-tag) + 2px); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.trail-label.late { fill: var(--late); }
.promise-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.promise { display: grid; gap: 6px; }
.promise .who { font-size: var(--type-body); font-weight: 700; }
.promise.shipment .who { color: var(--ink-2); font-weight: 600; }
.critical-tag { margin-left: 8px; color: var(--warn); font-size: var(--type-tag); font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.track { position: relative; display: block; height: 14px; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: var(--hairline); }
.track .lit { position: absolute; left: 0; top: 6px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--ink)); }
.track.pending .lit { opacity: .45; }
.track .over { position: absolute; top: 5px; height: 4px; background: repeating-linear-gradient(90deg, var(--late) 0 6px, transparent 6px 10px); }
.track .tick { position: absolute; top: 0; width: 2px; height: 14px; margin-left: -1px; background: var(--ink); }
.track .dot { position: absolute; top: 3px; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: var(--ink); }
.track.late .dot { background: var(--late); }
.rows.timeline dt .track { margin: 8px 0 2px; }
.promise .verdict { font-size: var(--type-meta); font-weight: 700; }
.promise.on-time .verdict { color: var(--ok); }
.promise.late .verdict { color: var(--late); }
.promise.shipment .verdict, .promise.pending .verdict { color: var(--ink-2); font-weight: 400; }
.stock-line { margin: 14px 0 0; color: var(--ink-2); font-size: var(--type-meta); }
.label-split { display: grid; grid-template-columns: minmax(0, 1fr); }

.plans-head { margin-bottom: 12px; }
.plans-head h2 { font-size: var(--type-title); }
.mcp-app { border-radius: var(--radius-panel); background: var(--surface); overflow: hidden; }
.mcp-app[hidden] { display: none; }
.mcp-app iframe { display: block; width: 100%; height: 260px; border: 0; background: transparent; }
.mcp-app-note { margin: 0; padding: 12px 16px; background: var(--warn-tint); color: var(--warn-ink); font-size: var(--type-meta); line-height: 1.5; }
.plans { display: grid; gap: 10px; }
.plans[hidden] { display: none; }
.plan { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 16px; border: 0; border-radius: var(--radius-panel); background: var(--surface); }
.plan.selected { box-shadow: inset 0 0 0 2px var(--shell); border-color: var(--shell); }
.plan strong, .plan small { display: block; }
.plan strong { font-size: var(--type-body); }
.plan small { margin-top: 4px; color: var(--ink-3); font-size: var(--type-meta); }
.plan-figures strong { font-size: var(--type-stat); font-variant-numeric: tabular-nums; }
.badge { display: inline-block; margin-left: 10px; color: var(--ink); font-size: var(--type-tag); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; vertical-align: 2px; }
.badge.preference { color: var(--warn); }
.plan-select, .primary, .secondary { min-height: 48px; padding: 0 22px; border-radius: var(--radius-pill); font-size: var(--type-body); font-weight: 800; }
.plan-select, .secondary { border: 1.5px solid var(--ink-3); background: transparent; color: var(--ink); white-space: nowrap; }
.plan-select:hover:not(:disabled), .secondary:hover:not(:disabled) { background: var(--sunken); }
.primary { border: 2px solid var(--shell); background: var(--shell); color: var(--shell-ink); }
.primary:hover:not(:disabled) { background: var(--shell-deep); border-color: var(--shell-deep); }

.confirm-card, .receipt-card, .alert-card, .result-card { max-width: 640px; }
.confirm-figure, .result-figure { margin: 12px 0 0; color: var(--ink-2); font-size: var(--type-meta); }
.confirm-figure strong, .result-figure strong { color: var(--ink); font-size: var(--type-hero); font-weight: 800; line-height: .95; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.confirm-figure span { margin-left: .4em; }
.result-figure span { color: var(--ink); font-size: var(--type-lead); font-weight: 700; }
.result-figure small { color: var(--ink-3); font-size: var(--type-meta); }
.rows { display: grid; grid-template-columns: minmax(46%, 1fr) minmax(0, auto); margin: 12px 0 0; font-size: var(--type-body); }
.rows dt, .rows dd { padding: 8px 0; border-top: 1px solid var(--hairline); }
.rows dt { color: var(--ink-2); }
.rows dd { margin: 0; padding-left: 16px; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rows dt.line, .rows dd.line { padding-top: 2px; border-top: 0; color: var(--ink-3); font-size: var(--type-meta); }
.rows dt.line { padding-left: 16px; }
.purchase .rows dt:last-of-type, .purchase .rows dd:last-of-type, .receipt-card .rows dt:last-of-type, .receipt-card .rows dd:last-of-type { color: var(--ink); font-weight: 800; border-top: 2px solid var(--ink-3); }
.confirm-actions { display: flex; gap: 10px; margin-top: 16px; }
.confirm-actions button { flex: 1 1 0; padding-inline: 16px; white-space: nowrap; }
.receipt-total { margin: 8px 0 4px; font-size: var(--type-hero); font-weight: 800; line-height: .95; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.receipt-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.was-plan, .new-plan { position: relative; margin: 14px 0 0; padding: 14px 0 0; font-size: var(--type-body); }
.was-plan::before, .new-plan::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 2px; }
.was-plan { color: var(--ink-3); }
.was-plan::before { background: repeating-linear-gradient(90deg, var(--ink-3) 0 6px, transparent 6px 12px); }
.new-plan { color: var(--ok); font-weight: 800; }
.new-plan::before { background: linear-gradient(90deg, transparent, var(--ok) 40%); }
.new-plan.late { color: var(--late); }
.new-plan.late::before { background: repeating-linear-gradient(90deg, var(--late) 0 6px, transparent 6px 10px); }
.figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.figure { display: grid; gap: 2px; align-content: start; padding: 8px 0 0; border-top: 1px solid var(--hairline); }
.figure strong { font-size: var(--type-body); line-height: 1.3; font-variant-numeric: tabular-nums; }
.figure span { color: var(--ink-2); font-size: var(--type-meta); }
.figure small { color: var(--ink-3); font-size: var(--type-meta); }
.result-card .times { margin: 12px 0 0; color: var(--ok); font-size: var(--type-body); font-weight: 800; }
.result-map { margin: 4px 0 6px; }
.device-map.result-map svg { max-width: 360px; margin: 0; }

.talk { position: relative; flex: 0 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 14px calc(var(--gutter) + env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) calc(var(--gutter) + env(safe-area-inset-left)); background: var(--surface); }
.talk::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--hairline); transform-origin: center; }
.talk[data-voice="listening"]::before { background: var(--ink); animation: voice-breathe 1.6s ease-in-out infinite alternate; }
.talk[data-voice="thinking"]::before { background: linear-gradient(90deg, var(--hairline) 0 30%, var(--warn) 42%, var(--ink) 50%, var(--warn) 58%, var(--hairline) 70% 100%); background-size: 280% 100%; animation: voice-comet 1.5s linear infinite; }
.talk[data-voice="speaking"]::before { background: linear-gradient(90deg, var(--hairline), var(--ink) 50%, var(--hairline)); animation: voice-speak .45s ease-in-out infinite alternate; }
@keyframes voice-breathe { from { opacity: .4; } to { opacity: 1; } }
@keyframes voice-comet { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes voice-speak { from { transform: scaleX(.55); } to { transform: scaleX(1); } }
.turns { position: relative; display: grid; gap: 2px; min-width: 0; min-height: 44px; padding-right: 84px; }
.turns p { margin: 0; }
.heard { overflow: hidden; color: var(--ink-3); font-size: var(--type-meta); white-space: nowrap; text-overflow: ellipsis; }
.heard .label { display: inline; margin: 0 6px 0 0; color: var(--ink-3); }
.heard .label[hidden] { display: none; }
#device-heard { color: var(--ink-2); }
.spoken-wrap .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.spoken { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; font-size: var(--type-spoken); font-weight: 700; line-height: 1.3; cursor: pointer; }
.talk.expanded .spoken { display: block; max-height: 38vh; overflow-y: auto; -webkit-line-clamp: none; line-clamp: none; }
.more { position: absolute; right: 0; top: 0; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--ink-3); border-radius: var(--radius-pill); background: transparent; font-size: var(--type-meta); font-weight: 800; }
.more[hidden] { display: none; }
.chips { display: flex; gap: 8px; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips:empty { display: none; }
.chip { flex: 0 0 auto; min-height: 44px; padding: 0 18px; border: 1.5px solid var(--ink-3); border-radius: var(--radius-pill); background: transparent; font-size: var(--type-meta); font-weight: 600; white-space: nowrap; scroll-snap-align: start; }
.chip:hover:not(:disabled) { border-color: var(--shell); background: var(--shell-tint); }
.chip.act { border-color: var(--shell); background: var(--shell); color: var(--shell-ink); font-weight: 800; }
.chip.act:hover:not(:disabled) { border-color: var(--shell-deep); background: var(--shell-deep); }
.chip.act ~ .chip.act { border-color: var(--ink); background: transparent; color: var(--ink); }
.chip.act ~ .chip.act:hover:not(:disabled) { background: var(--shell-tint); }
.chips[inert] .chip, .more[inert] { opacity: .45; }
.ask-row { display: flex; align-items: center; gap: 8px; }
.orb-row { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.orb { position: relative; flex: 0 0 auto; width: 44px; height: 44px; padding: 0; border: 1.5px solid var(--ink-3); border-radius: 50%; background: transparent; cursor: pointer; }
.orb:disabled { cursor: default; opacity: 1; }
.orb[aria-pressed="false"] span { background: var(--ink-3); }
.orb span { position: absolute; inset: 8px; border-radius: 50%; background: var(--shell); transform: scale(.55); transition: transform .3s cubic-bezier(.16, 1, .3, 1); }
.orb[data-state="speaking"] span { transform: scale(.8); }
.orb-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.device-elapsed { display: none; color: var(--ink-3); font-size: var(--type-meta); font-variant-numeric: tabular-nums; white-space: nowrap; }
input { flex: 1 1 auto; min-width: 0; min-height: 48px; padding: 0 18px; border: 1.5px solid var(--ink-3); border-radius: var(--radius-pill); outline: none; background: var(--sunken); color: var(--ink); font-size: 16px; }
input::placeholder { color: var(--ink-3); }
.mic, .send { flex: 0 0 auto; min-height: 48px; font-weight: 800; }
.mic { display: grid; place-items: center; width: 48px; padding: 0; border: 0; border-radius: 50%; background: var(--shell); color: var(--shell-ink); }
.mic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.mic[hidden] { display: none; }
.mic[aria-pressed="true"] { background: var(--late); }
.send { padding: 0 20px; border: 1.5px solid var(--ink-3); border-radius: var(--radius-pill); background: transparent; color: var(--ink); font-size: var(--type-body); }
.ask-row:has(#ask-input:not(:placeholder-shown)) .send { border-color: var(--shell); background: var(--shell); color: var(--shell-ink); }
.send-icon { display: none; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

.sheet { position: absolute; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; background: var(--scrim); }
.sheet[hidden] { display: none; }
.sheet-panel { display: flex; flex-direction: column; width: min(100%, 860px); max-height: 92%; padding: 18px var(--gutter) calc(16px + env(safe-area-inset-bottom)); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0; background: var(--surface); }
.sheet-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.sheet-head h2 { margin: 0 auto 0 0; font-size: var(--type-stat); }
.sheet-head .speak-toggle { order: 3; flex-basis: 100%; }
.speak-toggle { display: flex; align-items: center; gap: 8px; min-height: 44px; color: var(--ink-2); font-size: var(--type-meta); }
.speak-toggle[hidden] { display: none; }
.speak-toggle input { flex: 0 0 auto; width: 20px; min-height: 0; height: 20px; padding: 0; accent-color: var(--shell); }
.conversation { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; flex: 1 1 auto; min-height: 120px; overflow-y: auto; margin: 14px 0 0; padding: 4px 2px; }
.turn { max-width: min(92%, 72ch); min-width: 0; overflow-wrap: anywhere; padding: 12px 16px; border-radius: var(--radius-panel); background: var(--sunken); }
.turn.user { justify-self: end; background: var(--shell-tint); }
.turn.assistant { justify-self: start; }
.turn-role { display: block; margin-bottom: 6px; color: var(--ink-3); font-size: var(--type-tag); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.turn.user .turn-role { color: var(--ink-2); }
.turn p { margin: 0; white-space: pre-wrap; line-height: 1.55; font-size: var(--type-body); }
.turn small { display: block; margin-top: 8px; color: var(--ink-3); font-size: var(--type-meta); }
.turn .check-badge { display: inline-block; margin-top: 8px; color: var(--ok); font-size: var(--type-tag); font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.turn .check-badge.failed { color: var(--late); text-decoration: underline dashed 2px; text-underline-offset: 4px; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p, .markdown ul, .markdown ol, .markdown .table-scroll, .markdown blockquote { margin: 8px 0; font-size: var(--type-body); line-height: 1.55; }
.markdown h3, .markdown h4, .markdown h5, .markdown h6 { margin: 14px 0 6px; font-size: var(--type-lead); line-height: 1.3; }
.markdown ul, .markdown ol { padding-left: 20px; }
.markdown code { padding: 1px 5px; background: var(--sunken); font-size: .92em; overflow-wrap: anywhere; }
.markdown hr { margin: 12px 0; border: 0; border-top: 1px solid var(--hairline); }
.markdown blockquote { padding: 6px 12px; border: 1px solid var(--hairline); border-radius: var(--radius-label); color: var(--ink-2); }
.markdown .table-scroll { max-width: 100%; overflow-x: auto; }
.markdown table { border-collapse: collapse; }
.markdown th, .markdown td { padding: 6px 10px; border: 1px solid var(--hairline); text-align: left; font-size: var(--type-meta); }
.markdown th { background: var(--sunken); }
.turn-trace { margin-top: 8px; border-top: 1px solid var(--hairline); }
.turn-trace summary { padding: 12px 0; color: var(--ink-2); font-size: var(--type-meta); font-weight: 700; line-height: 20px; cursor: pointer; }
.turn-trace summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.device-steps { list-style: none; display: grid; margin: 4px 0 6px; padding: 0 0 0 22px; }
.device-steps li { position: relative; padding: 4px 0; color: var(--ink-2); font-size: var(--type-meta); line-height: 1.4; }
.device-steps li::before { content: ""; position: absolute; left: -16px; top: 0; bottom: 0; width: 2px; background: var(--ink-3); }
.device-steps li::after { content: ""; position: absolute; left: -19px; top: calc(4px + .7em - 4px); width: 8px; height: 8px; border-radius: 50%; background: var(--ink); }
.device-steps li:first-child::before { top: calc(4px + .7em); }
.device-steps li:last-child::before { bottom: calc(100% - 4px - .7em); }
.turn-trace.fresh .device-steps li { animation: step-in .25s cubic-bezier(.16, 1, .3, 1) both; animation-delay: calc(var(--step, 0) * 120ms); }
.device-steps li.error { color: var(--late); }
.device-steps li.error::after { background: var(--late); }
.device-steps li.skill { color: var(--ink); font-weight: 700; }
.device-steps li.skill::after { border: 2px solid var(--ink); background: var(--sunken); }
@keyframes step-in { from { clip-path: inset(0 100% 0 -30px); } to { clip-path: inset(0 -10px 0 -30px); } }
.agent-stage { position: absolute; left: 0; right: 0; z-index: 3; display: grid; align-content: center; gap: 18px; padding: 18px calc(var(--gutter) + env(safe-area-inset-right)) 18px calc(var(--gutter) + env(safe-area-inset-left)); background: var(--ground); clip-path: inset(0 0 0 0); transition: clip-path .36s cubic-bezier(.16, 1, .3, 1); }
.agent-stage[hidden] { display: none; }
.agent-stage.leaving { clip-path: inset(0 0 100% 0); }
.agent-stage > * { width: 100%; max-width: 640px; margin: 0 auto; }
.agent-ask { margin: 0 auto; color: var(--ink-2); font-size: var(--type-title); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
.agent-ask strong { color: var(--ink); font-weight: 800; white-space: nowrap; }
.agent-track { position: relative; min-height: 216px; padding-left: 28px; overflow: hidden; }
.agent-track::before { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: var(--rule); }
.agent-comet { position: absolute; left: 6px; top: 0; width: 4px; height: 96px; border-radius: 2px; background: linear-gradient(transparent, var(--warn) 60%, var(--ink)); animation: agent-comet 1.5s cubic-bezier(.45, 0, .55, 1) infinite; }
.agent-comet::after { content: ""; position: absolute; left: -4px; right: -4px; top: 30%; bottom: -4px; border-radius: 6px; background: inherit; filter: blur(5px); opacity: .7; }
.agent-stage[data-phase="replay"] .agent-comet { display: none; }
@keyframes agent-comet { from { transform: translateY(-96px); } to { transform: translateY(216px); } }
.agent-stations { list-style: none; display: grid; margin: 0; padding: 0; }
.agent-stations li { position: relative; min-height: 36px; padding: 7px 0; color: var(--ink); font-size: var(--type-body); font-weight: 700; line-height: 22px; animation: station-in .32s cubic-bezier(.16, 1, .3, 1) backwards; animation-delay: calc(var(--step, 0) * 120ms); }
.agent-stations li::before { content: ""; position: absolute; left: -21px; top: 0; bottom: 0; width: 2px; background: var(--ink); }
.agent-stations li::after { content: ""; position: absolute; left: -25px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); }
.agent-stations li:last-child::before { bottom: calc(100% - 18px); }
.agent-stations li.error, .agent-stations li.check.failed { color: var(--late); }
.agent-stations li.error::after { background: var(--late); }
.agent-stations li.check::after { left: -27px; top: 11px; width: 14px; height: 14px; border: 3px solid var(--ink); background: var(--ground); }
.agent-stations li.check.failed::after { border-color: var(--late); }
.agent-meta { margin: 0 auto; color: var(--ink-3); font-size: var(--type-meta); font-variant-numeric: tabular-nums; }
.agent-stage[data-phase="asking"] .agent-meta { color: var(--ink); font-size: var(--type-figure); font-weight: 800; }
.agent-stage[data-phase="replay"] .agent-meta { animation: station-in .32s cubic-bezier(.16, 1, .3, 1) backwards; animation-delay: calc(var(--step, 0) * 120ms); }
@keyframes station-in { from { clip-path: inset(0 100% 0 -40px); } to { clip-path: inset(0 -10px 0 -40px); } }
.agent-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 0 0; color: var(--ink-3); font-size: var(--type-meta); }
.agent-line[hidden] { display: none; }
.agent-dots { position: relative; display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.agent-dots::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; background: var(--ink-3); }
.agent-dots span { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.agent-dots .error { background: var(--late); }
.agent-dots .check { width: 11px; height: 11px; border: 2px solid var(--ink); background: var(--ground); }
.agent-dots .check.failed { border-color: var(--late); }

@media (max-height: 500px) and (orientation: landscape) {
  .device-bar { min-height: 44px; }
  .lifecycle { display: none; }
  .heard { display: none; }
  .spoken { -webkit-line-clamp: 1; line-clamp: 1; }
  .talk { gap: 6px; padding-top: 6px; }
  .confirm-actions { position: sticky; bottom: -18px; z-index: 1; margin: 12px calc(-1 * var(--gutter)) 0; padding: 10px var(--gutter) 14px; border-top: 1px solid var(--hairline); background: var(--ground); }
}
@media (min-width: 768px) {
  :root { --gutter: 24px; }
  .device-clock { display: inline; }
  .incident-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 28px; align-items: center; }
  .figures { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .plan { grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; }
  .plan-figures { text-align: right; white-space: nowrap; }
  .session-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .confirm-actions button { flex: 0 0 auto; }
  .orb-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; margin: 0; font-size: var(--type-meta); font-weight: 700; }
  .device-elapsed { display: inline; }
  .sheet { padding: 16px; align-items: center; }
  .sheet-panel { max-height: 100%; border-radius: var(--radius-sheet); }
}
@media (min-width: 900px) {
  .home:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 0 44px; align-content: start; }
  .home-head { grid-column: 1; grid-row: 1 / span 2; margin: 0; }
  .home #inbox, .home .session-strip { grid-column: 2; }
  .home .session-strip { align-self: start; margin-top: 14px; }
  .home .incident-card { gap: 4px; padding: 9px 10px; }
  .night { max-width: 520px; }
  .device-map svg { max-width: 540px; margin: 0 auto; }
  .incident:not([hidden]) { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 0 40px; }
  .incident-head { grid-column: 2; grid-row: 1; }
  .incident-grid { display: contents; }
  .device-map { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
  .incident .device-map svg { max-width: 470px; }
  .device-promise { grid-column: 2; grid-row: 2; margin-top: 10px; }
  .incident .promise-list { gap: 9px; }
  .incident-head h2 { margin-bottom: 0; }
  .confirm-card, .receipt-card, .alert-card, .result-card { max-width: none; }
  .label-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 32px; align-items: start; }
  .label-side > :first-child { margin-top: 4px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  :root { --type-meta: 14px; --type-body: 15px; }
}
@media (min-width: 1024px) and (pointer: coarse) {
  :root { --type-tag: 14px; --type-meta: 16px; --type-body: 18px; }
}
@media (min-width: 1024px) and (pointer: fine) {
  body { background: var(--outer); }
  .stage { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; }
  .device { width: min(100%, 1180px); height: auto; aspect-ratio: 16 / 10; max-height: calc(100vh - 92px); min-height: 560px; border: 10px solid var(--bezel); border-radius: 28px; box-shadow: 0 24px 48px rgba(17, 20, 24, .28); overflow: hidden; }
  .stage-note { display: flex; align-items: center; justify-content: center; gap: 12px; max-width: 1180px; margin: 0; color: var(--ink-2); font-size: var(--type-meta); line-height: 1.5; text-align: center; }
  .stage-note a { color: var(--shell); }
}
@media (max-width: 399px) {
  .device-bar, .device-bar-right { gap: 6px; }
  .device-brand span { margin-left: 6px; padding: 1px 5px; }
  .bell, .account { padding: 0 10px; }
  .lifecycle ol { grid-template-columns: repeat(4, auto); }
  .lifecycle li { padding-inline: 4px; }
  .send { display: grid; place-items: center; width: 48px; padding: 0; }
  .send-label { display: none; }
  .send-icon { display: block; }
}
@media (max-width: 479px) {
  .spoken { -webkit-line-clamp: 3; line-clamp: 3; }
  .talk.replied .heard { display: none; }
  .device-bar-right:has(.bell:not([hidden])) .connection, .device-bar-right:has(.account:not([hidden])) .connection { font-size: 0; }
  .confirm-actions { position: sticky; bottom: -18px; z-index: 1; margin: 16px calc(-1 * var(--gutter)) 0; padding: 12px var(--gutter) 16px; border-top: 1px solid var(--hairline); background: var(--ground); }
  .bell-where { display: none; }
}
@media (forced-colors: active) {
  .lifecycle li.now { forced-color-adjust: none; background: Highlight; color: HighlightText; }
  .lifecycle li.done { text-decoration: underline; }
  .track .lit, .track .tick, .track .dot, .track.late .dot { forced-color-adjust: none; background: CanvasText; }
  .track .over, .was-plan::before, .new-plan.late::before { forced-color-adjust: none; background: repeating-linear-gradient(90deg, CanvasText 0 6px, transparent 6px 10px); }
  .new-plan::before { forced-color-adjust: none; background: CanvasText; }
  .outcome.late, .turn .check-badge.failed { text-decoration-color: CanvasText; }
  .chip.act { border-width: 3px; }
  .send, .mic { border: 1px solid ButtonText; }
  .place, .place-label, .trail-label, .trail-label.late, .lane-id, .lane-delay, .lane-delay.late, .lane-delay.done, .lane-end, .lane-end.late, .lane-end.done, .lane-hub { fill: CanvasText; }
  .trail, .trail.late, .trail.ghost, .lane-lead, .lane-lead.done, .lane-tail, .lane-promise { stroke: CanvasText; }
  .trail-glow { display: none; }
  .agent-stations li::before, .agent-stations li::after, .agent-dots span, .agent-dots::before, .device-steps li::before, .device-steps li::after { forced-color-adjust: none; background: CanvasText; }
  .agent-stations li.check::after, .agent-dots .check { border-color: CanvasText; background: Canvas; }
  .key-promise { forced-color-adjust: none; background: CanvasText; }
  .key-delay { forced-color-adjust: none; background: repeating-linear-gradient(90deg, CanvasText 0 4px, transparent 4px 7px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .orb, .orb span { animation: none !important; }
  .talk::before, .trails, .agent-comet { animation: none !important; }
}
