:root {
  color-scheme: dark;
  --bg: #101210;
  --panel: #191d19;
  --surface: #222822;
  --line: #303a30;
  --muted: #9aa69a;
  --text: #edf3ed;
  --accent: #38ee5d;
  --accent-soft: #b7f5c2;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; transition: background .15s, border-color .15s; }
button:disabled { opacity: .5; cursor: wait; }
button:hover:not(:disabled) { filter: brightness(1.1); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
.shell { max-width: 1280px; margin: 0 auto; padding: 0 20px 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 650; letter-spacing: -.5px; white-space: nowrap; }
.brand-avatar { width: 40px; height: 40px; object-fit: cover; border: 1px solid var(--line); border-radius: 9px; flex-shrink: 0; }
.header-actions { display: flex; align-items: center; gap: 18px; }
nav { display: flex; gap: 4px; margin-right: auto; }
nav a { padding: 7px 10px; border-radius: 6px; color: var(--muted); font-size: 12px; }
nav a[aria-current="page"] { background: #223b28; color: var(--accent-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.refresh { color: var(--muted); font-size: 11px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.quiet { background: none; border: 0; padding: 5px; color: var(--muted); font-size: 12px; white-space: nowrap; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -.6px; margin: 0 0 20px; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -.2px; margin: 0; }
p { color: var(--muted); font-size: 12px; margin: 0; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.panel { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 16px; min-width: 0; }
.card-top, .card-title, .section-title { display: flex; align-items: center; gap: 10px; }
.card-top { justify-content: space-between; margin-bottom: 12px; }
.card-title { gap: 8px; }
.icon { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; font-size: 20px; color: var(--accent-soft); background: #213726; border: 1px solid #38583c; border-radius: 7px; }
.codex-icon, .flow-icon { background: #242d25; border-color: #3a483b; color: #c5d8c8; }
.badge { font-size: 10px; color: #b1bcb2; border: 1px solid #465047; background: #29302a; padding: 2px 7px; border-radius: 20px; white-space: nowrap; }
.badge.good { color: #a1f4b2; background: #203c28; border-color: #356541; }
.badge.warn { color: #e6cd95; background: #383225; border-color: #5c5037; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.card-actions:not(:has(> :not([hidden]))) { display: none; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 12px; border-radius: 6px; padding: 8px 12px; min-height: 36px; font-size: 12px; white-space: nowrap; }
.primary { background: var(--accent); color: #102415; border: 1px solid var(--accent); font-weight: 650; }
.secondary { background: var(--surface); color: var(--text); border: 1px solid #465447; }
dl { margin: 0; font-size: 12px; }
dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
dl > div:last-child { border-bottom: 0; }
dt { color: var(--muted); }
dd { margin: 0; text-align: right; }
.activity { display: grid; grid-template-columns: 1fr 1fr; margin: 4px 0 10px; }
.activity > div + div { border-left: 1px solid var(--line); padding-left: 18px; }
.activity strong { display: block; font-size: 28px; font-weight: 500; line-height: 1.2; letter-spacing: -.8px; }
.activity span { color: var(--muted); font-size: 11px; }
.activity-footer { display: flex; justify-content: space-between; gap: 10px; padding-top: 9px; border-top: 1px solid var(--line); font-size: 10px; color: var(--muted); }
.activity-footer b { color: #d5e3d7; font-weight: 500; }
.shared-qa-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; }
.shared-qa-copy { min-width: 0; }
.shared-qa-copy p { margin-top: 5px; }
.shared-qa-panel .card-actions { flex-shrink: 0; margin: 0; }
.section-title { flex-wrap: wrap; }
.count { display: inline-block; margin-left: 5px; padding: 1px 6px; border-radius: 4px; background: #2b392d; color: #c7ddcb; font-size: 10px; vertical-align: middle; }
.numbers-panel { margin-top: 12px; }
.skill-toggles label { display: flex; align-items: center; gap: 6px; margin: 3px 0; white-space: nowrap; }
.skill-toggles input { width: 14px; min-height: 14px; height: 14px; margin: 0; padding: 0; accent-color: var(--accent); }
.number-form { display: grid; grid-template-columns: 1fr 1.2fr auto; gap: 10px; align-items: end; margin: 14px 0; }
label { display: block; font-size: 11px; color: #b5c2b7; margin-bottom: 5px; }
input, select { width: 100%; min-height: 36px; border: 1px solid #3c493d; background: #111711; color: var(--text); border-radius: 6px; padding: 8px 10px; font-size: 12px; outline: none; }
input::placeholder { color: #768477; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px #38ee5d18; }
select:disabled { opacity: .6; }
.settings-form { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 9px; }
.settings-form .model-field, .settings-footer { grid-column: 1 / -1; }
.settings-footer { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.settings-footer > span { font-size: 10px; color: var(--muted); margin-right: auto; }
.settings-footer button { min-height: 30px; padding: 5px 8px; font-size: 10px; }
.runtime-uptime { margin-top: 10px; font-size: 10px; }
.row-actions { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.row-actions .secondary, .row-actions .quiet { min-height: 28px; font-size: 10px; padding: 5px 7px; }
.row-actions a { color: var(--accent-soft); }
.sessions-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sessions-heading h1 { font-size: 19px; margin: 0; }
.archive-filter { display: flex; align-items: center; gap: 7px; margin: 0; }
.archive-filter input { width: 14px; min-height: 14px; accent-color: var(--accent); }
.session-detail { margin-bottom: 12px; }
.session-detail .section-title { justify-content: space-between; margin-bottom: 10px; }
.session-detail h2 { overflow-wrap: anywhere; }
.session-detail .section-title p { margin-top: 3px; }
.session-metadata { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 20px; margin-bottom: 14px; }
.session-metadata dd { overflow-wrap: anywhere; }
.session-settings { grid-template-columns: minmax(180px,2fr) 1fr 1fr; }
.session-settings .model-field { grid-column: auto; }
.session-selected { background: #203126; }
.session-link { padding: 0; border: 0; background: none; text-align: left; color: var(--text); font-size: 12px; }
.session-link:hover { color: var(--accent-soft); }
.session-title-cell { max-width: 320px; }
.session-title-cell .session-link { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; display: block; }
.session-subtitle { display: flex; gap: 5px; align-items: center; margin-top: 4px; color: var(--muted); font-size: 10px; }
.sessions-table { min-width: 760px; }
.sessions-table td { vertical-align: top; }
.session-model { font-family: ui-monospace, monospace; font-size: 11px; white-space: nowrap; }
.session-model small { display: block; color: var(--muted); font-family: inherit; margin-top: 3px; }
.session-date { white-space: nowrap; font-size: 10px; color: var(--muted); }
.load-more { text-align: center; }
.load-more:has(button:not([hidden])) { margin-top: 12px; }
.muted { color: var(--muted); }
.inspection-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.inspection-heading h1 { margin: 0; font-size: 20px; }
.inspection-toolbar { display: grid; grid-template-columns: minmax(160px,1fr) minmax(180px,1.4fr) auto; align-items: end; gap: 10px; margin-bottom: 10px; }
#inspection-status { margin-bottom: 12px; }
.inspection-errors { padding: 10px; border: 1px solid #5c5037; border-radius: 6px; color: #e6cd95; margin-bottom: 12px; }
.inspection-panel { margin-top: 12px; padding: 12px 16px; }
.inspection-panel > summary { cursor: pointer; }
.inspection-panel > summary h2 { display: inline; }
.inspection-panel[open] > summary { margin-bottom: 8px; }
.inspection-entry { border-top: 1px solid var(--line); }
.inspection-entry > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; list-style: none; cursor: pointer; padding: 10px 0; font-size: 12px; overflow-wrap: anywhere; }
.inspection-entry > summary::-webkit-details-marker { display: none; }
.inspection-entry > summary::before { content: '▸'; color: var(--muted); }
.inspection-entry[open] > summary::before { content: '▾'; }
.inspection-entry-title { font-weight: 550; flex: 1; min-width: 100px; }
.inspection-path { display: inline; margin-left: 8px; color: var(--muted); font: 9px/1.4 ui-monospace, monospace; font-weight: 400; overflow-wrap: anywhere; }
.inspection-switch { display: inline-flex; align-items: center; gap: 5px; margin: 0 0 0 10px; font-size: 11px; cursor: pointer; white-space: nowrap; }
.inspection-switch input { width: 14px; min-height: 14px; height: 14px; padding: 0; margin: 0; accent-color: var(--accent); }
.inspection-switch:has(input:disabled) { opacity: .55; cursor: default; }
.inspection-entry summary .badge { margin: 0 3px; display: inline-block; }
.inspection-body { padding: 0 0 12px 12px; min-width: 0; }
.inspection-body > p { overflow-wrap: anywhere; margin-bottom: 8px; font-size: 11px; }
.inspection-body pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #111711; border: 1px solid var(--line); border-radius: 6px; padding: 12px; font-size: 11px; line-height: 1.6; max-height: 65vh; overflow: auto; margin: 0; tab-size: 2; }
.inspection-tool { margin-left: 4px; }
.native-capabilities { margin-top: 10px; }
.native-capability { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 9px 0; }
.native-capability small { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }
@media (max-width: 620px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topbar nav { order: 3; width: 100%; }
  .inspection-toolbar { grid-template-columns: 1fr auto; }
  .inspection-toolbar > div:first-child { grid-column: 1 / -1; }
}
.table-wrap { border-top: 1px solid var(--line); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; text-align: left; }
th { font-size: 9px; font-weight: 500; letter-spacing: .8px; color: var(--muted); padding: 10px 8px; border-bottom: 1px solid var(--line); }
td { padding: 11px 8px; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
td:last-child { text-align: right; }
.phone { font-family: ui-monospace, monospace; font-size: 11px; color: #b6c8ba; white-space: nowrap; }
.remove { background: transparent; color: #d5aaaa; border: 1px solid #5a4141; padding: 5px 8px; border-radius: 5px; font-size: 10px; white-space: nowrap; }
.empty { padding: 24px 8px; text-align: center; }
.login { max-width: 390px; margin: 48px auto; padding: 24px; }
.login form { display: grid; gap: 10px; }
.login label { margin: 0; }
.login .remember-option { display: flex; align-items: center; gap: 8px; font-size: 12px; cursor: pointer; }
.login .remember-option input { width: auto; margin: 0; }
.login .primary { margin-top: 4px; }
#notice { position: fixed; bottom: 18px; right: 18px; max-width: 430px; padding: 11px 15px; background: #203a27; color: #d2f1d9; border: 1px solid #496f50; border-radius: 8px; box-shadow: 0 8px 30px #0008; font-size: 12px; }
#notice.error { background: #442c30; color: #f0c8cf; border-color: #78505a; }
#qr-wrap { text-align: center; margin-top: 14px; }
#qr { width: min(220px, 100%); height: auto; border-radius: 8px; background: white; }
#qr-wrap p { margin-top: 8px; font-size: 11px; }
#device-code { display: block; font-family: ui-monospace, monospace; font-size: 22px; letter-spacing: 2px; margin: 10px 0; }
#device-login { max-width: 100%; }
.device-url { display: block; margin-top: 10px; color: var(--accent-soft); text-decoration: underline; overflow-wrap: anywhere; font-size: 11px; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; width: min(440px, calc(100% - 24px)); padding: 22px; }
dialog::backdrop { background: #000a; }
dialog label { margin-top: 16px; }
dialog p { margin: 12px 0; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
@media (max-width: 900px) {
  .numbers-panel th, .numbers-panel td { padding-left: 4px; padding-right: 4px; }
  .numbers-panel td > .quiet { font-size: 10px; padding: 4px 2px; }
  .numbers-panel .row-actions { gap: 3px; }
  .numbers-panel .row-actions .secondary, .numbers-panel .row-actions .quiet { padding-left: 4px; padding-right: 4px; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards > .panel:last-child { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; }
  .cards > .panel:last-child .card-top { margin: 0; }
  .activity { margin: 0; }
  .activity-footer { display: grid; gap: 5px; padding: 0 0 0 14px; border-top: 0; border-left: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .shell { padding: 0 12px 18px; }
  .topbar { gap: 10px; padding: 10px 0; margin-bottom: 12px; flex-wrap: wrap; }
  .brand { font-size: 19px; gap: 8px; }
  .brand-avatar { width: 36px; height: 36px; }
  .header-actions { gap: 8px; }
  nav { order: 3; flex-basis: 100%; }
  .header-actions { margin-left: auto; }
  .quiet { font-size: 11px; }
  .cards { grid-template-columns: 1fr; gap: 10px; }
  .cards > .panel:last-child { grid-column: auto; display: block; }
  .cards > .panel:last-child .card-top { margin-bottom: 12px; }
  .activity { margin: 4px 0 10px; }
  .activity-footer { display: flex; padding: 9px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .panel { padding: 14px; }
  .shared-qa-panel { align-items: flex-start; flex-direction: column; gap: 12px; }
  .number-form { grid-template-columns: 1fr 1fr; }
  .number-form button { grid-column: 1 / -1; }
  th, td { padding-left: 4px; padding-right: 4px; }
  .table-wrap table { min-width: 480px; }
  .table-wrap .sessions-table { min-width: 720px; }
  .session-metadata, .session-settings { grid-template-columns: minmax(0,1fr); }
  .session-metadata dl > div { min-width: 0; }
  #notice { left: 12px; right: 12px; bottom: 12px; }
}

.sessions-heading { flex-wrap: wrap; }
.sessions-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
#sessions-search { width: min(280px, 40vw); }
#sessions-kind { width: auto; }
.session-row { cursor: pointer; }
.session-row:hover { background: #28362b; }
.session-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.session-archived, .session-archived .session-link, .session-archived .phone { color: #89918c; }
.session-archived { background: #181b19; }
.pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
.pagination > span { margin-right: auto; font-size: 11px; color: var(--muted); }
.pagination label { display: flex; align-items: center; gap: 6px; margin: 0; }
.pagination select { width: 70px; }
.pagination button { min-height: 30px; padding: 5px 8px; }
.message-history { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; }
.schedule-card { margin-top: 12px; }
.schedule-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; font-size: 13px; }
.schedule-card summary small { display: block; color: var(--muted); font-size: 10px; margin-top: 4px; }
.schedule-card[open] summary { margin-bottom: 12px; }
.schedule-card p { font-size: 11px; margin: 8px 0; }
.schedule-card pre { font: 12px/1.6 ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 850px) { .topbar { flex-wrap: wrap; gap: 6px; } .topbar nav { order: 3; width: 100%; } }
.message-history summary { cursor: pointer; color: var(--accent-soft); font-size: 12px; }
#message-rows { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.history-message { background: #242d26; border-radius: 7px; padding: 9px 11px; max-width: 90%; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-message.user { align-self: flex-end; background: #233b2a; }
.history-message small { display: block; color: var(--muted); font-size: 10px; margin-bottom: 5px; }
.history-attachment { display: block; margin: 5px 0; color: var(--accent-soft); }
.history-attachment img { display: block; max-width: 100%; max-height: 260px; border-radius: 5px; object-fit: contain; }
.history-message audio { display: block; max-width: 100%; margin: 5px 0; }
@media (max-width: 600px) { .sessions-heading { align-items: flex-start; gap: 10px; flex-direction: column; } .sessions-toolbar { width: 100%; } #sessions-search { width: 100%; } }

.progress-form { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.progress-options { display: flex; gap: 6px; margin: 8px 0 5px; }
.progress-options select { min-width: 0; }
.progress-options button { min-height: 30px; padding: 5px 8px; font-size: 10px; }
.progress-form p { font-size: 10px; }
.stt-panel { margin-top: 12px; }
.stt-panel > summary { cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.stt-form { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; padding-top: 12px; }
.stt-enabled { grid-column: 1 / -1; }
.stt-key-field { grid-column: span 2; }
.stt-key-field .archive-filter { margin-top: 6px; }
.stt-form .settings-footer { align-items: center; }
#stt-last { font-size: 11px; }
@media (max-width: 900px) { .stt-form { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 560px) { .stt-form { grid-template-columns: 1fr; } .stt-key-field { grid-column: auto; } }
@media (max-width: 640px) { nav { flex-wrap: wrap; } }
