:root {
  --bg: #f7f7f5; --panel: #ffffff; --text: #1d1d1b; --muted: #6b6b66; --line: #e3e2dd;
  --accent: #1f5f8b; --accent-text: #ffffff; --hover: #f0f4f8; --chip: #eef1f4;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #161615; --panel: #1f1f1d; --text: #ecebe6; --muted: #a09f99; --line: #33332f;
          --accent: #5aa2d6; --accent-text: #0d1b26; --hover: #262a2e; --chip: #2a2e33; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
.top { display: flex; align-items: baseline; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.top h1 { font-size: 18px; margin: 0; }
.top { align-items: center; }
.auth { display: flex; justify-content: center; padding: 48px 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: min(380px, 100%); }
.card h2 { margin: 0 0 12px; font-size: 18px; }
.wide { width: 100%; margin-top: 8px; }
.msg { min-height: 1.2em; font-size: 13px; margin: 10px 0 0; }
.msg.err { color: #b3261e; } .msg.ok { color: #1e7a3c; }
@media (prefers-color-scheme: dark) { .msg.err { color: #ff8a80; } .msg.ok { color: #7fd69a; } }
.flush { margin: 0; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.layout { display: grid; grid-template-columns: 300px 1fr; min-height: calc(100vh - 52px); }
.filters { background: var(--panel); border-right: 1px solid var(--line); padding: 16px; overflow: auto; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 14px 0 0; padding: 10px 0 0; }
legend { font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0; }
label { display: block; margin: 8px 0; font-size: 13px; }
label.inline { display: flex; gap: 6px; align-items: center; }
input, select, button { font: inherit; color: var(--text); }
input:not([type=checkbox]), select { width: 100%; margin-top: 4px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); }
select[multiple] { padding: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
button { padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); cursor: pointer; }
button:hover { background: var(--hover); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; gap: 8px; margin-top: 16px; }
.hint { font-size: 12px; color: var(--muted); }
main { padding: 16px 20px; overflow: auto; }
.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bar .count { font-weight: 600; }
.bar .sort { display: flex; align-items: center; gap: 6px; margin: 0; }
.bar .sort select { width: auto; margin: 0; }
.spacer { flex: 1; }
.tablewrap { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: auto; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); }
td.num, th.num { text-align: right; white-space: nowrap; }
th.cb, td.cb { width: 32px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--hover); }
.firm { font-weight: 600; } .dom { color: var(--muted); font-size: 12px; }
.chip { display: inline-block; background: var(--chip); border-radius: 10px; padding: 1px 8px; margin: 1px 2px 1px 0; font-size: 12px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 14px 0; }
.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; justify-content: flex-end; }
.drawer[hidden] { display: none; }
.drawer-inner { width: min(720px, 100%); height: 100%; background: var(--panel); overflow: auto; padding: 20px 24px; position: relative; }
.close { position: absolute; top: 12px; right: 12px; font-size: 20px; line-height: 1; padding: 4px 10px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 4px 12px; margin: 12px 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.people td { font-size: 13px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
a { color: var(--accent); }
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  .filters { border-right: 0; border-bottom: 1px solid var(--line); }
  .kv { grid-template-columns: 1fr; }
}
