:root { --bg: #f5f6f8; --card: #fff; --ink: #1d2433; --muted: #6b7280; --line: #e5e7eb; --accent: #1f4e8c;
        --bad: #b42318; --good: #067647; --warn: #b54708; }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--ink); }
.bar { display: flex; gap: 12px; align-items: center; padding: 12px 20px; background: var(--ink); color: #fff; }
.who { margin-left: auto; opacity: .85; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 12px 0; }
.narrow { max-width: 420px; margin: 48px auto; }
main { max-width: 1100px; margin: 0 auto; padding: 0 16px 40px; }
[hidden] { display: none !important; }
/* The console: a full-height sidebar tree of the menus beside the page (2026-10-16). */
#console { display: grid; grid-template-columns: 248px minmax(0, 1fr); max-width: none; padding: 0; align-items: start; }
#console .content { min-width: 0; padding: 20px 28px 40px; max-width: 1180px; }
.sidebar { position: sticky; top: 0; height: calc(100vh - 48px); overflow-y: auto; background: #fbfcfd;
           border-right: 1px solid var(--line); padding: 14px 12px; }
.sidebar button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: none;
                  color: #334155; font-size: 15px; border-radius: 10px; padding: 10px 12px; margin: 2px 0; }
.sidebar button:hover { background: #f1f4f8; }
.sidebar button.active { background: #e6ebf2; color: var(--ink); font-weight: 600; }
.sidebar .nav-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7;
                     stroke-linecap: round; stroke-linejoin: round; color: #475569; }
.sidebar button.active .nav-icon { color: var(--ink); }
.sidebar .nav-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .nav-chevron { width: 16px; height: 16px; flex: none; fill: none; stroke: #94a3b8; stroke-width: 2;
                        stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.sidebar .nav-group-toggle[aria-expanded="true"] .nav-chevron { transform: rotate(90deg); }
.sidebar .nav-children { padding-left: 32px; }
.sidebar .badge { margin-left: auto; }
@media (max-width: 800px) {
  #console { grid-template-columns: 1fr; }
  #console .content { padding: 12px 16px 40px; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
}
input, textarea, select { width: 100%; padding: 8px 10px; margin: 6px 0; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
button { padding: 7px 14px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; font: inherit; }
button.secondary { background: #e5e7eb; color: var(--ink); }
button.danger { background: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
.tabs { display: flex; gap: 6px; margin: 16px 0 4px; flex-wrap: wrap; }
.tabs button { background: #e5e7eb; color: var(--ink); }
.tabs button.active { background: var(--accent); color: #fff; }
.badge:empty { display: none; }
.badge { background: var(--bad); color: #fff; border-radius: 10px; padding: 0 7px; margin-left: 4px; font-size: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.big { font-size: 26px; font-weight: 600; margin: 4px 0; }
.status-BALANCED { color: var(--good); } .status-UNDETERMINED { color: var(--warn); } .status-BREACHED { color: var(--bad); }
.hint { color: var(--muted); margin: 4px 0; }
.error { color: var(--bad); }
.notice { padding: 10px 14px; border-radius: 6px; background: #eef4ff; border: 1px solid #c7d7f5; }
.notice.bad { background: #fef3f2; border-color: #fecdca; color: var(--bad); }
.item { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-all; }
.actions { display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
pre { background: #f3f4f6; padding: 8px; border-radius: 6px; white-space: pre-wrap; word-break: break-all; margin: 6px 0; }
@media (max-width: 700px) { .item { grid-template-columns: 1fr; } .actions { min-width: 0; } }
.secret { font-family: ui-monospace, Menlo, monospace; background: #fffbeb; border: 1px solid #f5d38a; padding: 10px; border-radius: 6px; word-break: break-all; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; align-items: end; }
.form label { display: flex; flex-direction: column; color: var(--muted); font-size: 13px; }
.form label.check { flex-direction: row; gap: 6px; align-items: center; }
.form label.check input { width: auto; }
a.link { color: var(--accent); }
#role-editor label.check { display: inline-flex; gap: 6px; align-items: center; }
#role-editor label.check input { width: auto; margin: 2px 0; }
.role-picks { border: 0; padding: 0; margin: 0; }
.role-picks legend { padding: 0; margin-bottom: 6px; }
.role-checks { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.role-checks label.check { display: flex; flex-direction: row; gap: 6px; align-items: center; }
.role-checks label.check input { width: auto; margin: 0; }
#setup-secret { overflow-wrap: anywhere; word-break: break-all; }
.totp-qr { display: block; width: 200px; height: 200px; margin: 12px 0; image-rendering: pixelated; }
.totp-qr[hidden] { display: none; }
/* 2026-10-20: the player lookup and the full lists. */
.inline-form { display: grid; grid-template-columns: 200px 1fr auto; gap: 8px; align-items: center; }
.inline-form input, .inline-form select { margin: 0; }
table.entries { width: 100%; border-collapse: collapse; margin: 8px 0; }
table.entries th, table.entries td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.entries th { color: var(--muted); font-weight: 500; }
table.entries .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 700px) { .inline-form { grid-template-columns: 1fr; } }

/* Spec 2026-10-25: the language switcher, beside the operator's name. */
.locale-switch { display: flex; gap: 4px; }
.locale-switch button { padding: 3px 8px; font-size: 13px; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4); }
.locale-switch button[aria-pressed="true"] { background: #fff; color: var(--ink); }
html:lang(zh-Hant) body { font-family: "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif; }

/* Tables (2026-10-27): every list is a table; a page has its heading, its filters and its table; forms open in a drawer. */
#console .content { max-width: 1360px; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.page-head h1 { font-size: 20px; margin: 0; }
.page-head .cta { margin-left: auto; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 12px; }
.toolbar .table-search { width: 240px; margin: 0 0 0 auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: #fff; color: #334155; border: 1px solid #cbd5e1; border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.page-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 12px; flex-wrap: wrap; }
.page-tabs button { background: none; color: #475569; border-radius: 0; border-bottom: 2px solid transparent; padding: 8px 14px; }
.page-tabs button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.table-box { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow-x: auto; margin: 0 0 16px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { background: #f8fafc; color: #475569; font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 10px 12px; border-bottom: 1px solid #eef0f3; white-space: nowrap; vertical-align: top; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #f9fafb; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.wrap { white-space: normal; min-width: 220px; }
table.data th.acts { text-align: right; }
table.data tr.detail td { background: #f8fafc; white-space: normal; }
table.data tr.detail:hover td { background: #f8fafc; }
table.data tr.child td:first-child { padding-left: 36px; }
table.data tr.group td:first-child { font-weight: 600; }
table.data .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
table.data .row-actions button { padding: 4px 10px; font-size: 13px; }
table.data button.secondary { background: #fff; border: 1px solid #cbd5e1; }
table.data button.danger { background: #fff; color: var(--bad); border: 1px solid #f1a7a0; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.sub { color: #5b6472; font-size: 12px; margin-top: 2px; }
.strong { font-weight: 600; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pill.green { background: #dcfce7; color: #14532d; } .pill.amber { background: #fef3c7; color: #7c2d12; }
.pill.red { background: #fee2e2; color: #7f1d1d; } .pill.gray { background: #eef0f3; color: #374151; }
.pill.blue { background: #dbeafe; color: #1e3a8a; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); background: #fff; border-left: 1px solid var(--line);
          box-shadow: -8px 0 24px rgba(15, 23, 42, .12); overflow-y: auto; padding: 16px 20px; z-index: 20; }
.drawer.wide { width: min(760px, 100vw); }
.drawer-close { float: right; }
.drawer .card { border: 0; padding: 0; margin: 0 0 12px; }
.drawer .form { grid-template-columns: 1fr; }
@media (max-width: 700px) { .toolbar .table-search { width: 100%; margin-left: 0; } }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.permission-list { margin: 0; padding-left: 18px; columns: 2; }
@media (max-width: 700px) { /* 2026-11-17: the one dialog an action asks in (its fields, the reason, the confirmation), instead of the browser's prompts. */
dialog.ask { border: 0; border-radius: 12px; padding: 20px 24px; width: min(440px, calc(100vw - 32px)); box-sizing: border-box;
             box-shadow: 0 20px 50px rgba(15, 23, 42, .25); }
dialog.ask::backdrop { background: rgba(15, 23, 42, .45); }
dialog.ask h2 { margin: 0 0 8px; font-size: 17px; }
dialog.ask label { display: block; margin-top: 12px; font-size: 13px; color: var(--muted); }
dialog.ask input { display: block; width: 100%; box-sizing: border-box; margin-top: 6px; }
dialog.ask .error { margin: 10px 0 0; }
dialog.ask .drawer-actions { justify-content: flex-end; margin-top: 18px; }
