:root {
  --bg: #f4f6f9; --card: #fff; --ink: #1b2430; --muted: #6b7686; --line: #dbe1ea;
  --accent: #0b4f8a; --accent-ink: #fff; --warn: #8a5a00; --warn-bg: #fff6df; --ok: #0d6b3a; --bad: #a11d2e;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
.top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 8px; padding: 10px 16px; background: var(--accent); color: #fff; }
.brand { font-weight: 700; letter-spacing: .3px; }
.top-right { display: flex; gap: 4px; align-items: center; }
.top button.link { white-space: nowrap; }
.top .muted { color: #cfe0f2; }
.banner { background: var(--warn-bg); color: var(--warn); font-size: 13px; padding: 6px 16px; border-bottom: 1px solid #ecd9a6; }
main { max-width: 920px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.narrow { max-width: 360px; margin: 40px auto; }
label { display: block; margin: 10px 0; font-size: 14px; }
input, textarea, select { width: 100%; font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
textarea { resize: vertical; }
button { font: inherit; cursor: pointer; }
button.primary { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 9px 18px; }
button.primary:disabled { opacity: .55; cursor: wait; }
button.link { background: none; border: 0; color: var(--accent); padding: 2px 4px; text-decoration: underline; }
.top button.link { color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 6px; }
.top button.link:hover, .top button.link.active { background: rgba(255, 255, 255, .18); }
button.small { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px; font-size: 14px; color: var(--accent); }
button.small:disabled { opacity: .5; cursor: not-allowed; }
.admin-shell { display: flex; flex-direction: column; gap: 4px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin: 4px 0 14px; }
.page-head h1 { margin: 0; font-size: 22px; line-height: 1.3; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tabs.sub { margin-top: -4px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 12px; }
.toolbar .field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.toolbar .field.grow { flex: 1 1 220px; }
.toolbar label { margin: 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.toolbar input, .toolbar select { padding: 7px 10px; font-size: 14px; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { position: sticky; top: 0; background: #eef2f7; text-align: left; padding: 10px 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--line); }
table.data th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
table.data th button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
table.data th[aria-sort] { color: var(--ink); }
table.data td { padding: 10px 12px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr.clickable { cursor: pointer; }
table.data tbody tr.clickable:hover td { background: #f3f7fb; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .nowrap { white-space: nowrap; }
table.data td.trunc { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data td a { color: var(--accent); text-decoration: none; font-weight: 600; }
table.data td a:hover { text-decoration: underline; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.table-foot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 10px 2px; color: var(--muted); font-size: 14px; }
.table-foot .pager { display: flex; gap: 8px; align-items: center; }
.table-foot select { width: auto; padding: 4px 8px; font-size: 14px; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f7; color: #44505f; white-space: nowrap; }
.pill.ok { background: #e3f4ea; color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: #fbe7ea; color: var(--bad); }
.pill.info { background: #e8f0f9; color: var(--accent); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.stat .l { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat .v { font-size: 24px; font-weight: 700; line-height: 1.3; font-variant-numeric: tabular-nums; }
.stat .n { font-size: 12px; color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin-bottom: 14px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 14px; }
.panel > h2 { margin: 0; padding: 12px 16px; font-size: 15px; border-bottom: 1px solid var(--line); }
.panel > .body { padding: 14px 16px; }
.panel .table-wrap { border: 0; border-radius: 0 0 10px 10px; max-height: 340px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.form-grid label { margin: 0; }
.notice { margin: 10px 0 0; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.notice.ok { background: #e3f4ea; color: var(--ok); }
.notice.err { background: #fbe7ea; color: var(--bad); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.info { background: #e8f0f9; color: var(--accent); }
code { font: 13px ui-monospace, Menlo, Consolas, monospace; background: #f1f4f8; padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }
.panel-sub { padding: 8px 16px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f8fafc; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.model-picker { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.model-list { max-height: 300px; overflow: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.model-row { display: block; width: 100%; text-align: left; background: #fff; border: 0; border-bottom: 1px solid #eef1f5; padding: 8px 12px; font: inherit; color: var(--ink); cursor: pointer; }
.model-row:hover { background: #f3f7fb; }
.model-row[aria-pressed="true"] { background: #e8f0f9; box-shadow: inset 3px 0 var(--accent); }
.prompt-box { width: 100%; min-height: 220px; resize: vertical; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.lab-title { font-size: 18px; margin: 22px 0 10px; }
.lab-card { margin-bottom: 14px; }
.lab-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.lab-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.lab-section { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.lab-section > summary { cursor: pointer; font-weight: 600; color: var(--ink); padding: 4px 0; }
.lab-section-body { padding: 8px 0 4px; }
.lab-section-body .dl { grid-template-columns: max-content 1fr; }
.dimmed { opacity: .55; }
textarea[readonly] { background: #f3f5f8; color: var(--muted); }
.notice a { color: inherit; font-weight: 600; }
.bar { display: block; height: 6px; border-radius: 3px; background: #cfe0f2; margin-top: 4px; min-width: 2px; }
.footnote { font-size: 13px; color: var(--muted); margin: 6px 2px 16px; }
.money.partial { color: var(--warn); }
.answer-box .summary { margin-bottom: 8px; }
.answer-box .variant { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 12px; }
.loading { padding: 28px 16px; text-align: center; color: var(--muted); }
.saved-answer { white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.5 ui-monospace, Menlo, Consolas, monospace; background: #f8fafc; border: 1px solid var(--line); padding: 10px; border-radius: 6px; }
details summary { cursor: pointer; color: var(--accent); }
main.wide { max-width: 1240px; }
button.secondary { background: #fff; color: var(--accent); border: 1.5px solid var(--accent); border-radius: 8px; padding: 9px 18px; font-weight: 600; }
button.secondary:hover:not(:disabled) { background: #eef5fc; }
button.secondary:disabled { opacity: .45; cursor: not-allowed; }
button.secondary.sm, button.primary.sm { padding: 5px 12px; font-size: 14px; border-radius: 6px; }
button.danger { background: var(--bad); color: #fff; border: 0; border-radius: 8px; padding: 9px 18px; }
button.block { display: block; width: 100%; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 16px 0 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.error { color: var(--bad); min-height: 1.2em; }
.ask { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.ask textarea { flex: 1; }
.ask select { width: auto; align-self: stretch; }
.shot-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: -2px 0 10px; font-size: 14px; }
#shot-note { margin-bottom: 10px; }
.status { color: var(--muted); padding: 8px 2px; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin-right: 8px; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.summary { font-size: 18px; font-weight: 600; }
.variant-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 6px; }
.badge { background: #e8f0f9; color: var(--accent); border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 600; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.answer { white-space: pre-wrap; margin: 6px 0 12px; }
.ref { border-left: 4px solid var(--accent); background: #f8fafc; padding: 10px 12px; margin: 10px 0; border-radius: 0 8px 8px 0; }
.ref-head { font-weight: 700; }
.ref-meta { font-size: 13px; color: var(--muted); margin: 2px 0 8px; }
.quote { white-space: pre-wrap; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; background: #fff; border: 1px solid var(--line); padding: 8px 10px; border-radius: 6px; overflow-x: auto; }
.ref-actions { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; }
table.md { border-collapse: collapse; font-size: 14px; background: #fff; margin: 4px 0; display: block; overflow-x: auto; }
table.md th, table.md td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
table.md th { background: #eef2f7; }
.kind { text-transform: uppercase; font-size: 11px; letter-spacing: .6px; color: var(--muted); }
.notes { color: var(--muted); font-size: 14px; margin-top: 8px; }
.notfound { border-left: 4px solid var(--warn); }
.feedback { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.feedback input { flex: 1; min-width: 180px; }
.searched li { margin: 2px 0; font-size: 14px; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(380px, 100%); background: #fff; border-left: 1px solid var(--line); padding: 14px; overflow-y: auto; z-index: 20; }
.drawer-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.drawer ul { list-style: none; padding: 0; margin: 0; }
.drawer li { padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.drawer li:hover { color: var(--accent); }
.modal { position: fixed; inset: 0; background: #0f141c; z-index: 30; display: flex; flex-direction: column; }
.modal-bar { display: flex; justify-content: space-between; gap: 10px; padding: 8px 14px; color: #fff; flex-wrap: wrap; }
.modal-bar .link { color: #fff; }
.modal-body { flex: 1; overflow: auto; text-align: center; padding: 6px; }
.modal-body img { max-width: 100%; height: auto; background: #fff; }
.modal-body img.zoom { max-width: none; width: 160%; }
@media (max-width: 600px) { .ask { flex-direction: column; } .ask button, .ask select { width: 100%; } }
.inline-check { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; font-size: .95rem; }
.inline-check input { width: auto; }

.section-title { margin: 0 0 12px; font-size: 1.15rem; }
