/* == Assistant panel (Signac's, on Blackbox tokens): on wide screens a card docked on the right, with the page's
   own gutters around it, so it reads as one more card next to the page's; a bottom sheet under 1000 px, full screen
   under 600 px. Semantic tokens only, so both themes follow. == */
@layer components {
:root {
    --as-w: 420px;
    /* the gutter around the docked card: the page's own side padding, so the gap to the page's cards matches */
    --as-gap: 1.25rem;
    /* chart palette for answers: the app's own series colours */
    --viz-1: var(--color-primary);
    --viz-2: var(--status-warn);
    --viz-3: #B77CE0;
    --viz-4: var(--status-good);
    --viz-5: var(--status-bad);
    --viz-6: var(--status-info);
    --viz-7: #C9C46B;
    --viz-8: #E08FBF;
}

.as {
    position: fixed;
    /* top in line with the page's first cards, bottom in line with the floating replay bar */
    top: calc(var(--header-h) + var(--as-gap));
    bottom: .8rem;
    right: var(--as-gap);
    width: var(--as-w);
    max-width: calc(100vw - 2 * var(--as-gap));
    /* above the rail drawer (950), below Radzen dialogs (~1001) and the header menu (1150+) */
    z-index: 960;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* the page cards' own look (.content-card) */
    background: var(--blackbox-surface);
    border: 1px solid var(--blackbox-border);
    border-radius: var(--bb-radius-sm);
    box-shadow: var(--blackbox-shadow);
    color: var(--text-body);
    transform: translateX(calc(100% + var(--as-gap) + 2rem));
    visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
}

.as.open {
    transform: none;
    visibility: visible;
    transition: transform .22s ease;
}

/* header */
.as-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); }
.as-title { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.as-title b { font-size: 14px; font-weight: 650; color: var(--text-strong); }
.as-sub { font-size: 11.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-flash { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; border: 1px solid var(--border-strong); border-radius: 99px; padding: 3px 9px; color: var(--color-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.as-ib { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-muted); cursor: pointer; flex-shrink: 0; }
.as-ib svg { width: 17px; height: 17px; }
.as-ib:hover { color: var(--color-primary); border-color: var(--border-default); }
.as-ib.on { color: var(--color-primary); }
.as-ib:disabled { opacity: .35; cursor: default; }
.as-ib:disabled:hover { color: var(--text-muted); border-color: transparent; }
.as-ib.small { width: 26px; height: 26px; }
.as-ib.small svg { width: 14px; height: 14px; }
.as-ib:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }

/* approval switch (decision F2): shield with an "Auto" badge, a small menu under it */
.as-approvals { position: relative; flex-shrink: 0; }
.as-shield { width: auto; min-width: 32px; gap: 4px; padding: 0 6px; }
.as-shield i { font-size: 14px; }
.as-badge { font-family: var(--font-mono); font-size: 9.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--color-primary); border: 1px solid var(--border-strong); border-radius: 99px; padding: 0 5px; line-height: 15px; }
.as-menu-backdrop { all: unset; position: fixed; inset: 0; z-index: 4; }
.as-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; width: 248px; padding: 10px 12px; background: var(--blackbox-surface); border: 1px solid var(--blackbox-border); border-radius: var(--bb-radius-sm); box-shadow: var(--blackbox-shadow); }
.as-switch { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 500; color: var(--text-strong); cursor: pointer; }
/* app.css styles every "label > span" as an uppercase field caption */
.as-switch > span { display: inline; margin: 0; color: inherit; font-size: inherit; font-weight: inherit; letter-spacing: normal; text-transform: none; }
.as-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.as-switch > .as-switch-track { display: block; position: relative; flex-shrink: 0; width: 30px; height: 17px; border-radius: 99px; background: var(--border-default); transition: background .15s; }
.as-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--blackbox-surface); transition: transform .15s; }
.as-switch > input:checked + .as-switch-track { background: var(--color-primary); }
.as-switch input:checked + .as-switch-track::after { transform: translateX(13px); }
.as-switch input:focus-visible + .as-switch-track { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.as-menu-note { margin: 8px 0 0; font-size: 11.5px; color: var(--text-muted); }

/* conversations */
.as-threads { border-bottom: 1px solid var(--border-subtle); max-height: 45%; overflow: auto; background: var(--surface-sunken); }
.as-thread { display: grid; grid-template-columns: 1fr auto auto auto auto; gap: 8px; align-items: center; padding: 8px 10px 8px 14px; cursor: pointer; border-bottom: 1px solid var(--border-subtle); }
.as-thread:hover, .as-thread.on { background: var(--surface-hover); }
.as-thread .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.as-thread .d { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-dim); white-space: nowrap; }
.as-thread .pend { font-family: var(--font-mono); font-size: 10px; color: var(--status-warn); border: 1px solid var(--status-warn); border-radius: 99px; padding: 1px 6px; }
.as-thread .pend.shared { color: var(--color-primary); border-color: var(--border-strong); }
.as-admin-link { display: block; padding: 8px 14px; font-size: 12.5px; color: var(--text-link); }
.as-muted { color: var(--text-muted); font-size: 13px; }
.as-pad { padding: 10px 14px; }

/* body */
.as-body { flex: 1 1 auto; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.as-empty { margin: auto 0; }
.as-hello { text-align: center; padding: 24px 12px; color: var(--text-muted); }
.as-hello svg { width: 32px; height: 32px; color: var(--color-primary); margin-bottom: 10px; }
.as-hello h3 { font-size: 15px; font-weight: 650; margin: 0 0 6px; color: var(--text-strong); text-transform: none; letter-spacing: 0; }
.as-hello p { font-size: 13px; line-height: 1.5; margin: 0; }
.as-msgs { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.as-msg { display: flex; min-width: 0; }
.as-msg.user { justify-content: flex-end; }
.as-bubble { max-width: 92%; min-width: 0; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; }
.as-md { min-width: 0; }
.as-msg.user .as-bubble { background: var(--color-primary-soft); border: 1px solid var(--border-strong); border-bottom-right-radius: 4px; white-space: pre-wrap; color: var(--text-strong); }
.as-msg.assistant .as-bubble { background: var(--surface-raised); border: 1px solid var(--border-subtle); border-bottom-left-radius: 4px; max-width: 100%; }
.as-md > * + * { margin-top: 8px; }
.as-md p { margin: 0; }
.as-md ul, .as-md ol { padding-left: 20px; margin: 0; }
.as-md li + li { margin-top: 2px; }
.as-md h1, .as-md h2, .as-md h3, .as-md h4 { font-size: 13.5px; font-weight: 650; margin: 0; text-transform: none; letter-spacing: 0; color: var(--text-strong); }
.as-md .as-table { overflow-x: auto; max-width: 100%; margin: 0 -4px; padding: 0 4px; }
.as-md table { width: 100%; font-size: 12.5px; border-collapse: collapse; }
.as-md th { padding: 5px 8px; font-size: 10.5px; text-align: left; white-space: nowrap; color: var(--text-muted); }
.as-md td { padding: 5px 8px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.as-md code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-sunken); padding: 1px 5px; border-radius: 5px; }
.as-md pre { background: var(--surface-sunken); padding: 10px; border-radius: 8px; overflow: auto; font-size: 12px; }
.as-md blockquote { border-left: 3px solid var(--border-default); padding-left: 10px; color: var(--text-muted); margin: 0; }
.as-md a { color: var(--text-link); }
/* a time moves the replay; a card link pulses the evidence it came from */
.as-md a.as-time { font-family: var(--font-mono); font-size: 12.5px; text-decoration: none; color: var(--color-primary); background: var(--color-primary-soft); border-radius: 5px; padding: 0 4px; white-space: nowrap; }
.as-md a.as-time:hover { text-decoration: underline; }
.as-md a.as-card { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; text-decoration: none; color: var(--color-primary); border: 1px solid var(--border-strong); border-radius: 999px; padding: 0 8px; white-space: nowrap; }
.as-md a.as-card:hover { background: var(--color-primary-soft); }
.as-msg.assistant.streaming .as-md > :last-child::after { content: "▍"; color: var(--color-primary); animation: asblink 1s steps(2) infinite; margin-left: 2px; }
@keyframes asblink { to { opacity: 0; } }

/* tool rows */
.as-tool { border: 1px solid var(--border-subtle); border-radius: 10px; background: var(--surface-sunken); font-size: 12.5px; }
.as-tool-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px 6px 10px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--text-muted); font: inherit; font-size: 12.5px; }
.as-tool-head .chev { width: 14px; height: 14px; margin-left: auto; transition: transform .15s ease; flex-shrink: 0; }
.as-tool-head[aria-expanded=true] .chev { transform: rotate(180deg); }
.as-tool-name { color: var(--text-body); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-tool-state { color: var(--text-dim); white-space: nowrap; }
.as-tool.ok .as-tool-state { color: var(--status-good); }
.as-tool.err .as-tool-state { color: var(--status-bad); }
.as-tool.err { border-color: color-mix(in srgb, var(--status-bad) 40%, transparent); }
.as-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); flex-shrink: 0; }
.as-tool.ok .as-dot { background: var(--status-good); }
.as-tool.err .as-dot { background: var(--status-bad); }
.as-spin { width: 12px; height: 12px; border: 2px solid var(--border-default); border-top-color: var(--color-primary); border-radius: 50%; animation: as-spin .8s linear infinite; flex-shrink: 0; }
@keyframes as-spin { to { transform: rotate(360deg); } }
.as-tool-detail { border-top: 1px solid var(--border-subtle); padding: 6px 10px; display: grid; gap: 6px; }
.as-tool-detail pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 11.5px; color: var(--text-muted); max-height: 220px; overflow: auto; font-family: var(--font-mono); }

/* notes, thinking */
.as-note { font-size: 12.5px; color: var(--text-dim); text-align: center; padding: 4px 8px; }
.as-note.err { color: var(--status-bad); background: var(--status-bad-bg); border-radius: 10px; text-align: left; padding: 8px 12px; }
.as-thinking { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: 12px; padding: 2px 6px; }
.as-dots { display: inline-flex; gap: 3px; }
.as-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); opacity: .35; animation: as-dot 1.2s ease-in-out infinite; }
.as-dots i:nth-child(2) { animation-delay: .18s; }
.as-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes as-dot { 0%, 70%, 100% { opacity: .3; transform: translateY(0); } 35% { opacity: 1; transform: translateY(-2px); } }

/* approval card */
.as-approval { padding: 10px 12px; border: 1px solid var(--status-warn); border-radius: 12px; background: var(--status-warn-bg); font-size: 13px; display: grid; gap: 6px; }
.as-approval-head { display: flex; align-items: center; gap: 8px; color: var(--status-warn); font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.as-approval-head svg { width: 15px; height: 15px; }
.as-approval-title { color: var(--text-strong); font-size: 13.5px; }
.as-approval-args { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 0; font-size: 12.5px; }
.as-approval-args dt { color: var(--text-muted); }
.as-approval-args dd { margin: 0; color: var(--text-strong); font-weight: 600; overflow-wrap: anywhere; white-space: pre-wrap; }
.as-approval-warn { display: flex; gap: 8px; align-items: flex-start; margin: 2px 0 0; padding: 7px 9px; border-radius: 8px; background: var(--status-bad-bg); border-left: 3px solid var(--status-bad); font-size: 12.5px; color: var(--text-body); }
.as-approval-warn svg { width: 15px; height: 15px; color: var(--status-bad); flex: none; margin-top: 1px; }
.as-approval-wait { margin: 2px 0 0; color: var(--text-muted); font-size: 12px; }
.as-approval-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.as-approval.approved { border-color: var(--status-good); background: var(--status-good-bg); }
.as-approval.approved .as-approval-head { color: var(--status-good); }
.as-approval.denied .as-approval-head { color: var(--text-muted); }.as-approval.denied { opacity: .7; }
.as-btn { border-radius: 8px; padding: 6px 14px; font-size: 13px; cursor: pointer; border: 1px solid var(--border-default); background: var(--surface-card); color: var(--text-strong); }
.as-btn.primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--text-inverse); font-weight: 600; }
.as-btn:disabled { opacity: .5; cursor: default; }
.as-batch { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--color-primary); border-radius: 10px; background: color-mix(in srgb, var(--color-primary) 10%, var(--surface-card)); font-size: 12.5px; }
.as-batch-count { display: grid; flex: 1 1 auto; min-width: 0; }
.as-batch-count b { color: var(--text-strong); font-weight: 600; }
.as-batch-count small { color: var(--status-bad); font-size: 11.5px; font-weight: 600; }

/* footer: context line, suggestions, composer */
.as-foot { border-top: 1px solid var(--border-subtle); padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; }
.as-context { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.as-suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.as-sug { border: 1px solid var(--border-default); background: transparent; border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12.5px; color: var(--text-muted); cursor: pointer; text-align: left; }
.as-sug:hover { border-color: var(--color-primary); color: var(--color-primary); }
.as-compose { display: flex; gap: 6px; align-items: flex-end; }
.as-compose textarea { flex: 1 1 auto; min-height: 60px; max-height: 220px; resize: none; background: var(--surface-sunken); color: var(--text-strong); border: 1px solid var(--border-default); border-radius: 12px; padding: 9px 10px; font-family: var(--font-sans); font-size: 13.5px; line-height: 1.4; }
.as-compose textarea:focus { outline: none; border-color: var(--color-primary); }
.as-compose textarea:disabled { opacity: .6; }
.as-compose .as-ib { width: 36px; height: 36px; border-radius: 10px; }
.as-compose .as-ib.send { background: var(--color-primary); border-color: var(--color-primary); color: var(--text-inverse); }
.as-compose .as-ib.send:disabled { background: var(--surface-sunken); border-color: var(--border-default); color: var(--text-dim); }
.as-compose .as-ib.stop { border-color: var(--status-bad); color: var(--status-bad); background: var(--status-bad-bg); }
.as-row { display: flex; align-items: center; justify-content: flex-end; font-size: 11px; color: var(--text-dim); }

/* the header button: same round button as privacy and theme; the sparkle glows while a run is busy. It sits
   outside .header-actions (so phones reach it beside the menu button), so it takes the header's gap (1.5rem,
   .9rem on tablets); the negative margin brings it to the actions' own .5rem. */
.app-header .assist-btn { margin-right: -1rem; }
.app-header .assist-btn.busy > svg { animation: as-glow 1.4s ease-in-out infinite; }
@keyframes as-glow { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* suggestions in the event and candidate header */
.details-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--border-subtle); }
.details-ask-label { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); }
.details-ask-label svg { width: 15px; height: 15px; color: var(--color-primary); }
.details-ask .as-sug { font-size: 12.5px; }

/* the list's Ask button */
.candidate-actions .ask-btn svg, .candidate-ask svg { width: 16px; height: 16px; }
.candidate-ask { width: 30px; height: 30px; display: inline-grid; place-items: center; padding: 0; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--color-primary); cursor: pointer; }
.candidate-ask:hover { border-color: var(--border-strong); background: var(--color-primary-soft); }

/* PostHog's support bubble sits on the panel's send button: out of the way while the panel is open. */
body:has(.as.open) #ph-conversations-widget-container { display: none !important; }

/* pointing at a card: three pulses */
.as-pulse { outline: 3px solid var(--color-primary) !important; outline-offset: 3px; border-radius: 10px; animation: as-pulse 1.1s ease-in-out 3; }
@keyframes as-pulse { 0%, 100% { outline-color: var(--color-primary); } 50% { outline-color: transparent; } }

/* chart blocks in answers (Signac's renderer) */
.as-chart { position: relative; margin: 10px 0 6px; }
.as-chart figcaption { font-weight: 600; font-size: 13px; margin-bottom: 4px; color: var(--text-strong); }
.as-chart-legend { display: flex; flex-wrap: wrap; gap: 2px 12px; list-style: none; padding: 0; margin: 0 0 4px; font-size: 12px; color: var(--text-muted); }
.as-chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.as-chart-svg { width: 100%; }
.as-chart svg { width: 100%; height: auto; display: block; touch-action: none; overflow: visible; font-family: var(--font-sans); }
.as-chart .grid { stroke: var(--border-default); stroke-width: 1; shape-rendering: crispEdges; }
.as-chart .grid.zero { stroke: var(--text-dim); }
.as-chart .axis-text { fill: var(--text-dim); font-size: 11px; }
.as-chart .end-label { fill: var(--text-muted); font-size: 11px; }
.as-chart .as-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.as-chart .area { opacity: .14; }
.as-chart .dot { stroke: var(--surface-raised); stroke-width: 2; }
.as-chart .dot.hover { r: 5.5; }
.as-chart .bar.hover { filter: brightness(1.15); }
.as-chart .crosshair { stroke: var(--text-dim); stroke-width: 1; display: none; pointer-events: none; }
.as-chart-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface-raised); border: 1px solid var(--border-default); border-radius: 8px; padding: 6px 9px; font-size: 12px; box-shadow: var(--shadow-overlay); min-width: 120px; }
.as-chart-tip[hidden] { display: none; }
.as-chart-tip-x { color: var(--text-muted); margin-bottom: 3px; }
.as-chart-tip-row { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.as-chart-tip-row i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.as-chart-tip-row b { font-family: var(--font-mono); font-weight: 600; }
.as-chart-tip-row span { color: var(--text-muted); }
.as-chart-note { font-size: 12px; margin-top: 2px; color: var(--text-muted); }
.as-chart-table summary { font-size: 12px; color: var(--text-muted); cursor: pointer; margin-top: 4px; }
.as-chart-table .as-table { max-height: 240px; overflow: auto; margin-top: 4px; }
.as-chart-error { font-size: 12.5px; color: var(--text-muted); padding: 8px 10px; border: 1px dashed var(--border-default); border-radius: 8px; }

/* shared conversation and usage pages */
.assistant-page { max-width: 1100px; margin: 0 auto; display: grid; gap: 1rem; }
.assistant-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.assistant-page-head h1 { margin: 0; font-size: 1.4rem; color: var(--text-strong); }
.assistant-page-body { display: flex; flex-direction: column; gap: 10px; }
.assistant-page-body .as-msg.user .as-bubble { max-width: 70%; }
.assistant-page-body .as-tool summary { cursor: pointer; }
.aa-totals { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }
.aa-totals b { color: var(--text-strong); font-family: var(--font-mono); }
.aa-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.aa-table th { text-align: left; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); padding: 6px 8px; border-bottom: 1px solid var(--border-default); }
.aa-table td { padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
.aa-table td.mono { font-family: var(--font-mono); font-size: 12px; }
.aa-table td.req { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aa-table td.bad { color: var(--status-bad); }
.aa-table tr.write td { background: var(--status-warn-bg); }
.aa-scroll { max-height: 520px; overflow: auto; }
.aa-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.aa-month, .aa-select { height: 32px; padding: 0 10px; border-radius: var(--radius-input); border: 1px solid var(--border-default); background: var(--surface-sunken); color: var(--text-strong); font: inherit; font-size: 13px; }
.aa-month { font-family: var(--font-mono); color-scheme: dark; }
:root[data-theme="light"] .aa-month { color-scheme: light; }
.aa-select { min-width: 220px; }
.aa-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); cursor: pointer; }
.aa-calls-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.aa-summary { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.aa-summary b { color: var(--text-strong); font-family: var(--font-mono); }
.aa-summary .bad b { color: var(--status-bad); }
.aa-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.aa-tools .chip b { margin-left: 4px; font-family: var(--font-mono); }
.aa-users tbody tr { cursor: pointer; }
.aa-users tbody tr:hover td { background: var(--surface-hover); }
.aa-users tbody tr.is-selected td { background: var(--color-primary-soft); color: var(--text-strong); }
.aa-user-link { border: 0; background: none; padding: 0; color: var(--text-link); cursor: pointer; font: inherit; text-align: left; }
.aa-user-link:hover { text-decoration: underline; }
}

@layer responsive {
/* tablets: app.css narrows the header gap to .9rem, so the pull towards the actions is smaller */
@media (max-width: 1023px) {
    .app-header .assist-btn { margin-right: -.4rem; }
}
/* phones: the assistant button is the twin of the round menu button beside it */
@media (max-width: 767px) {
    .app-header .assist-btn { width: 2.6rem; height: 2.6rem; min-inline-size: 0; margin-right: 0; font-size: 1.05rem; border-radius: 10px; }
}
/* bottom sheet under 1000 px; full screen under 600 px; the page then keeps its full width */
@media (max-width: 1000px) {
    .as {
        top: auto;
        bottom: 0;
        right: 0;
        height: min(72dvh, 640px);
        width: 100%;
        max-width: none;
        border: 0;
        border-top: 1px solid var(--border-default);
        border-radius: 16px 16px 0 0;
        box-shadow: var(--shadow-overlay);
        transform: translateY(104%);
    }
    .as.open { transform: none; }
    .as-row { display: none; }
}
@media (max-width: 600px) {
    .as { height: calc(100dvh - var(--header-h)); border-radius: 0; }
    .as-body { padding: 10px 10px 6px; }
    .as-bubble { max-width: 96%; }
    .assistant-page-body .as-msg.user .as-bubble { max-width: 100%; }
}
/* Docked (wide screens): the page makes room, the header keeps the full width, and the fixed furniture (replay
   bar, review mode, a maximized tile) stops at the panel. In this layer so it beats the per-breakpoint rules. */
@media (min-width: 1001px) {
    .app-shell.assist-open { padding-right: calc(var(--as-w) + var(--as-gap)); }
    .app-shell.assist-open .app-header { margin-right: calc(-1 * (var(--as-w) + var(--as-gap))); }
    .app-shell.assist-open .timeline-controls {
        left: calc((100vw - var(--as-w) - var(--as-gap)) / 2);
        width: min(1040px, calc(100vw - var(--as-w) - var(--as-gap) - 2rem));
        max-width: calc(100vw - var(--as-w) - var(--as-gap) - 2rem);
    }
    .app-shell.assist-open .incident-page.is-review #footage,
    .app-shell.assist-open .camera-panel.is-maximized { right: calc(var(--as-w) + 2 * var(--as-gap)); }
}
/* The page's own 1279 px step, for the width the docked card leaves (1279 + 420 + 20). */
@media (min-width: 1001px) and (max-width: 1719px) {
    .app-shell.assist-open .details-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .app-shell.assist-open .chartgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app-shell.assist-open .media-grid-regular:not([data-review-layout]) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .app-shell.assist-open .media-grid-secondary:not([data-review-layout]) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
    .as-body { scroll-behavior: auto; }
    .as-spin, .as-dots i, .app-header .assist-btn.busy > svg, .as-pulse { animation: none; }
    .as-dots i { opacity: .7; }
}
}
