:root {
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-alt: #f1f0ec;
  --text: #1f1f1d;
  --text-2: #5f5e5a;
  --text-3: #8b8a85;
  --border: rgba(0, 0, 0, .1);
  --border-strong: rgba(0, 0, 0, .2);
  --accent: #185fa5;
  --accent-bg: #e6f1fb;
  --ok: #3b6d11;   --ok-bg: #eaf3de;
  --warn: #854f0b; --warn-bg: #faeeda;
  --off: #a32d2d;  --off-bg: #fcebeb;
  --pro: #534ab7;  --pro-bg: #eeedfe;
  --radius: 8px;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a19; --surface: #232322; --surface-alt: #2c2c2a;
    --text: #ececea; --text-2: #b4b2a9; --text-3: #888780;
    --border: rgba(255, 255, 255, .1); --border-strong: rgba(255, 255, 255, .2);
    --accent: #85b7eb; --accent-bg: #0c447c;
    --ok: #c0dd97; --ok-bg: #27500a;
    --warn: #fac775; --warn-bg: #633806;
    --off: #f7c1c1; --off-bg: #791f1f;
    --pro: #cecbf6; --pro-bg: #3c3489;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 500; margin: 0; }
h2 { font-size: 17px; font-weight: 500; margin: 0 0 12px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.ti { vertical-align: -2px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 24px; min-height: 56px; }
.brand { font-weight: 500; color: var(--text); font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--text-2); padding: 6px 10px; border-radius: var(--radius); font-size: 14px; white-space: nowrap; }
.nav a:hover { background: var(--surface-alt); text-decoration: none; }
.nav a.on { color: var(--text); background: var(--surface-alt); font-weight: 500; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 14px; white-space: nowrap; }
.userbox > a:last-child { color: var(--text-2); font-size: 18px; }
.nav-toggle { display: none; }

main.wrap { padding-top: 24px; padding-bottom: 32px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; }
.footer { padding-bottom: 24px; font-size: 12px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 20px; }
.card-body { padding: 16px 20px; }
.card-head { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.card-head h2 { margin: 0; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; }
.stat .label { font-size: 13px; color: var(--text-2); }
.stat .value { font-size: 24px; font-weight: 500; }
.c-ok { color: var(--ok); } .c-warn { color: var(--warn); } .c-off { color: var(--off); }

table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-weight: 400; font-size: 12px; color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--border); }
table.list td { padding: 10px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr:hover td { background: var(--surface-alt); }
table.list td.actions { text-align: right; white-space: nowrap; }
.empty { padding: 32px 20px; text-align: center; color: var(--text-2); }

.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: var(--radius); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-off { background: var(--off-bg); color: var(--off); }
.badge-muted { background: var(--surface-alt); color: var(--text-2); }
.badge-pro { background: var(--pro-bg); color: var(--pro); }
.badge-accent { background: var(--accent-bg); color: var(--accent); }

input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
}
textarea { height: auto; padding: 8px 12px; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.hint { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; margin-right: 18px; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.input-suffix { display: flex; align-items: stretch; flex: 1; }
.input-suffix input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-suffix span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; background: var(--surface-alt); color: var(--text-2); font-size: 14px; white-space: nowrap; }

.btn, button { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.btn:hover, button:hover { background: var(--surface-alt); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.1); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #042c53; } }
.btn-danger { color: var(--off); }
.btn-danger:hover { background: var(--off-bg); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.icon-btn { border: 0; background: none; height: auto; padding: 4px; color: var(--text-2); font-size: 17px; }
.icon-btn:hover { background: none; color: var(--text); }

.codebox { display: flex; align-items: center; gap: 8px; background: var(--surface-alt); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 8px; font-family: var(--mono); font-size: 13px; word-break: break-all; }
.codebox code { flex: 1; }
pre.code { background: var(--surface-alt); border-radius: var(--radius); padding: 12px 14px; font-family: var(--mono); font-size: 13px; overflow-x: auto; margin: 0 0 12px; white-space: pre; }

.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: var(--ok-bg); color: var(--ok); }
.alert-error { background: var(--off-bg); color: var(--off); }
.alert-info { background: var(--accent-bg); color: var(--accent); }
.alert-warn { background: var(--warn-bg); color: var(--warn); }

.pager { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 14px; font-size: 14px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters input, .filters select { width: auto; min-width: 160px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; }
.login-card .brand { display: block; text-align: center; font-size: 22px; margin-bottom: 20px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 12px; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; height: 42px; background: none; color: var(--text-2); }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.on { display: block; }

@media (max-width: 820px) {
  .topbar-inner { flex-wrap: wrap; gap: 8px 16px; padding: 8px 0; }
  .nav-toggle { display: inline-flex; margin-left: auto; height: 34px; }
  .nav { display: none; order: 3; flex-basis: 100%; flex-direction: column; }
  body.nav-open .nav { display: flex; }
  .userbox { order: 2; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  table.list td, table.list th { padding: 8px 10px; }
  .inline-form { flex-wrap: wrap; }
}
