:root {
  --blue: #1f4e78; --blue-l: #e8f0f8; --bg: #f5f6f8; --card: #fff; --text: #1d2329; --muted: #66707a;
  --line: #d9dee3; --ok: #1e7b34; --err: #b42318; --warn: #a15c00; --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #15191d; --card: #1e2429; --text: #e6e9ec; --muted: #9aa4ad; --line: #333c44; --blue-l: #22303c; }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); }
main { max-width: 1400px; margin: 0 auto; padding: 16px; min-height: 80vh; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 12px; } h2 { font-size: 17px; margin: 0 0 10px; }
a { color: #2b6cb0; } @media (prefers-color-scheme: dark) { a { color: #7fb2e5; } }
.muted { color: var(--muted); } .small { font-size: 13px; } .nowrap { white-space: nowrap; }

.top { background: var(--blue); color: #fff; display: flex; align-items: center; flex-wrap: wrap; padding: 0 16px; gap: 8px; }
.top .brand { color: #fff; font-weight: 700; text-decoration: none; padding: 12px 0; margin-right: auto; }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.top nav a, .top nav .link { color: #fff; text-decoration: none; padding: 12px 10px; border-radius: 6px; font: inherit; }
.top nav a:hover, .top nav .link:hover { background: rgba(255,255,255,.12); }
.navtoggle { display: none; } .burger { display: none; color: #fff; font-size: 22px; cursor: pointer; padding: 8px; }
@media (max-width: 860px) {
  .burger { display: block; } .top nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 8px; }
  .navtoggle:checked ~ nav { display: flex; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.narrow { max-width: 440px; margin: 40px auto; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.cols2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 12px; border: 1px solid; }
.flash.ok { background: #e7f5eb; border-color: #9ed3ab; color: var(--ok); }
.flash.error { background: #fdecea; border-color: #f2b3ab; color: var(--err); }
.flash.info { background: var(--blue-l); border-color: #b3cbe2; color: inherit; }

button, .btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 8px 14px; border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { border-color: var(--blue); }
.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.danger { background: var(--err); color: #fff; border-color: var(--err); }
button.link { background: none; border: none; padding: 0 4px; color: #2b6cb0; }
.top button.link { color: #fff; padding: 12px 10px; }
.danger-text { color: var(--err) !important; }
.danger-zone { margin-top: 8px; text-align: right; }
form.inline, .inline { display: inline; }

.switch { display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--blue); border-radius: 6px; overflow: hidden; }
.switch-label { padding: 0 10px; font-size: 13px; color: var(--muted); }
.switch button { border: none; border-left: 1px solid var(--blue); border-radius: 0; padding: 8px 14px; }
.switch button.on { background: var(--blue); color: #fff; font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tile { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: var(--radius); padding: 12px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
.tile:hover { border-color: var(--blue); }
.tile.empty { opacity: .6; border-left-color: var(--line); } .tile.warn { border-left-color: var(--warn); }
.tile-n { font-size: 26px; font-weight: 700; } .tile-l { font-weight: 600; } .tile-s { font-size: 12px; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.actions .muted { margin-right: auto; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #8fb4dc; border-color: var(--blue); }
input:disabled, select:disabled, textarea:disabled { background: var(--bg); color: var(--text); }
.full { width: 100%; }

.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 16px; }
table.list { border-collapse: collapse; width: 100%; }
table.list th, table.list td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list th { background: var(--blue); color: #fff; font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
table.list tbody tr:hover { background: var(--blue-l); }
table.list tr.inactive td { color: var(--muted); text-decoration: line-through; }
.badge { background: var(--warn); color: #fff; font-size: 11px; border-radius: 4px; padding: 0 4px; }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; }

.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea { width: 100%; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 14px; padding: 10px 14px; }
legend { font-weight: 700; padding: 0 6px; color: var(--blue); }
@media (prefers-color-scheme: dark) { legend { color: #7fb2e5; } }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0 16px; }
.grid .wide { grid-column: 1 / -1; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px 16px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.qr { background: #fff; padding: 12px; width: 240px; margin: 8px 0; }
.qr svg { width: 216px; height: 216px; display: block; }
code { background: var(--bg); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
