:root {
  /* Same palette as the CA Support Wiki: CA logo orange on the app bar's blue-grey. */
  --bg: #f7f6f4; --panel: #fff; --ink: #1f2328; --muted: #5f6670; --line: #e6e2dc;
  --accent: #b85400; --accent-fill: #fb7d08; --accent-ink: #1a1206; --accent-soft: #fff1e2;
  --bar: #37474f; --bar-ink: #eceff1; --bar-line: #455a64; --brand: #ffb52e;
  --ok: #2e7d4f; --warn: #9a5b00; --bad: #b3261e;
  --p0: #e9e6e1; --p1: #ffe3b8; --p2: #ffb052; --p3: #8fd1a6; --p4: #2e7d4f;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15181c; --panel: #1e2328; --ink: #e9ecef; --muted: #a2abb5; --line: #2f363d; --accent: #ffa63d; --accent-fill: #fb8c1e; --accent-soft: #3a2a17; --bar: #263238; --bar-line: #37474f; --ok: #6fcf97; --warn: #f2b45a; --bad: #f28b82;
    --p0: #2c3238; --p1: #5a4320; --p2: #a8620f; --p3: #2f6b47; --p4: #6fcf97; }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.warn { color: var(--warn); } .bad { color: var(--bad); } .ok { color: var(--ok); } .info { color: var(--muted); }
code { font-size: .9em; background: var(--accent-soft); padding: 1px 5px; border-radius: 4px; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 10px 18px; background: var(--bar); color: var(--bar-ink); border-bottom: 3px solid var(--accent-fill); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--bar-ink); text-decoration: none; font-weight: 650; white-space: nowrap; }
.brand-name { color: var(--brand); font-weight: 700; }
.logo { width: 28px; height: 28px; flex: none; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a { color: #cfd8dc; text-decoration: none; padding: 6px 12px; border-radius: 7px; }
.tabs a:hover { background: rgba(255, 255, 255, .08); }
.tabs a.active { background: var(--accent-fill); color: var(--accent-ink); font-weight: 600; }
.who { color: #b0bec5; font-size: 13px; white-space: nowrap; }
.demo, .error { padding: 8px 18px; font-size: 14px; }
.demo { background: var(--accent-soft); color: var(--accent); }
.error { background: var(--bad); color: #fff; position: sticky; top: 53px; z-index: 9; }

main { padding: 22px 28px 60px; max-width: 1180px; margin: 0 auto; }
body.wide main { max-width: none; }
h1 { font-size: 24px; line-height: 1.25; margin: 4px 0 6px; }
h2 { font-size: 18px; margin: 26px 0 8px; }
h3 { font-size: 15px; margin: 16px 0 6px; }
.num { font-variant-numeric: tabular-nums; color: var(--accent); font-weight: 700; margin-right: 4px; }
.crumbs { margin: 0 0 6px; }
.links a { white-space: nowrap; }
.foot { color: var(--muted); font-size: 12px; padding: 0 28px 24px; text-align: center; }
.notice { padding: 10px 14px; border-radius: 8px; background: #fff3df; color: #6b4300; margin: 10px 0; font-size: 14px; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
@media (prefers-color-scheme: dark) { .notice { background: #3a2e18; color: var(--warn); } }

.btn { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 7px; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn.primary { background: var(--accent-fill); color: var(--accent-ink); border-color: var(--accent-fill); font-weight: 600; }
input, select, textarea { font: inherit; font-size: 14px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-fill); outline-offset: -1px; }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input { min-width: 280px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Overview: items × languages */
.matrix-wrap { overflow: auto; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); max-height: calc(100vh - 210px); }
.matrix { border-collapse: separate; border-spacing: 0; font-size: 14px; }
.matrix th, .matrix td { border-bottom: 1px solid var(--line); padding: 4px 3px; }
.matrix thead th { position: sticky; top: 0; background: var(--panel); z-index: 2; font-size: 12px; font-weight: 600; color: var(--muted); }
.matrix th.loc { writing-mode: vertical-rl; transform: rotate(180deg); height: 64px; padding: 6px 4px; text-align: left; }
.matrix tbody th { position: sticky; left: 0; background: var(--panel); z-index: 1; text-align: left; font-weight: 500; min-width: 250px; max-width: 320px; padding-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.matrix tbody th a { color: var(--ink); text-decoration: none; }
.matrix tbody th a:hover { color: var(--accent); }
.matrix tbody tr:hover td, .matrix tbody tr:hover th { background: var(--accent-soft); }
.matrix td { text-align: center; white-space: nowrap; }
.cell-link { display: inline-flex; gap: 2px; text-decoration: none; padding: 2px; border-radius: 5px; }
.cell-link:hover { outline: 2px solid var(--accent-fill); }
.none { color: var(--line); }
.wk { margin-left: 8px; font-size: 11px; color: var(--muted); }

.chip { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 3px; border-radius: 4px; font-size: 11px; font-weight: 700; color: var(--ink); border: 1px solid transparent; }
.chip.p0 { background: var(--p0); color: var(--muted); }
.chip.p1 { background: var(--p1); }
.chip.p2 { background: var(--p2); color: #2b1600; }
.chip.p3 { background: var(--p3); color: #0e2a19; }
.chip.p4 { background: var(--p4); color: #fff; }
.chip.shared { background: transparent; border: 1px dashed var(--p3); color: var(--muted); }
.chip.na { background: repeating-linear-gradient(45deg, var(--p0), var(--p0) 3px, transparent 3px, transparent 6px); color: var(--muted); }
.chip.waiting { box-shadow: 0 0 0 2px var(--bad); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 12px; font-size: 13px; color: var(--muted); }

/* Item page */
.item-meta { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin: 12px 0; }
.item-meta label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.item-meta .grow { flex: 1; min-width: 280px; }
.item-meta textarea { width: 100%; }
.cells, .list { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.cells th, .cells td, .list th, .list td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cells th, .list th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel); }
.cells td.loc { white-space: nowrap; font-weight: 600; }
.list code { white-space: nowrap; }
.cells td.facts { font-size: 13px; color: var(--muted); }
.cells tr.focus td { background: var(--accent-soft); }
.note-preview { color: var(--ink); margin-top: 2px; white-space: pre-wrap; }

/* Details dialog */
.dialog { border: 0; border-radius: 12px; padding: 0; width: min(920px, 96vw); max-height: 92vh; background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.dialog::backdrop { background: rgba(20, 24, 28, .45); }
.dlg { padding: 18px 22px; }
.dlg header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.dlg header h2 { margin: 0; font-size: 18px; }
.dlg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.dlg fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 10px; padding: 6px 12px 8px; }
.dlg legend { font-size: 13px; font-weight: 600; color: var(--accent); padding: 0 4px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; padding: 2px 0; }
.check input { margin-top: 4px; }
.link-list { display: grid; gap: 6px; }
.link-list label { display: grid; grid-template-columns: 150px 1fr; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.dlg textarea { width: 100%; }
.rules { background: var(--accent-soft); border-radius: 8px; padding: 8px 12px; margin: 8px 0; font-size: 14px; }
.rules summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.history { font-size: 13px; max-height: 180px; overflow: auto; }
.history ul { margin: 0; padding-left: 16px; }
.dlg footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

.wait-list { list-style: none; padding: 0; margin: 0; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); }
.wait-list li { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.count { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 0 8px; font-size: 13px; }

@media (max-width: 760px) {
  .dlg-grid { grid-template-columns: 1fr; }
  .brand-name { display: none; }
  main { padding: 16px 12px 40px; }
}
.dialog.narrow { width: min(520px, 94vw); }
.dlg ul { padding-left: 18px; }
