:root {
  --bg: #0b1220;
  --panel: #111827;
  --panel2: #1f2937;
  --text: #f3f4f6;
  --muted: #94a3b8;
  --accent: #3b82f6;
  --green: #10b981;
  --danger: #ef4444;
  --line: #374151;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: Inter, system-ui, sans-serif; }
a { color: #93c5fd; text-decoration: none; }
a:hover { text-decoration: underline; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 240px; background: #0f172a;
  display: flex; flex-direction: column; padding: 24px 16px; border-right: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: .04em; margin-bottom: 24px; display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 36px; height: 36px; border-radius: 8px; flex: 0 0 auto; }
.auth-icon { width: 56px; height: 56px; display: block; margin: 0 auto 12px; border-radius: 12px; }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sidebar nav a { color: var(--text); padding: 8px 10px; border-radius: 8px; }
.sidebar nav a.on, .sidebar nav a:hover { background: var(--panel2); text-decoration: none; }
.who { font-size: 13px; }
.muted { color: var(--muted); }
.content { margin-left: 240px; padding: 24px 28px 40px; min-height: 100vh; }
h1 { margin: 0 0 8px; font-size: 22px; }
h2 { font-size: 15px; margin: 0 0 12px; }
.lede { margin: 0 0 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; background: var(--panel2); padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.filters.stacked { flex-direction: column; align-items: stretch; }
.filters label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.filters input, .filters select { min-width: 120px; }
.filters .btn, .filters a.btn { align-self: end; }
input, select, button { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.btn { display: inline-block; background: var(--accent); color: white; border: 0; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.green { background: var(--green); }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; border: 1px solid var(--line); width: 100%; margin-top: 8px; }
.btn.tiny { padding: 4px 8px; font-size: 12px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
.metric { background: var(--panel); border-radius: 12px; padding: 18px; }
.metric .k { color: var(--muted); font-size: 12px; font-weight: 700; }
.metric .v { font-size: 28px; font-weight: 800; margin-top: 6px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { white-space: nowrap; }
section > h2 { margin: 18px 0 8px; }
.panel h2 { margin: 0 0 12px; }
.table-wrap { overflow: auto; max-height: calc(100vh - 240px); border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.table-wrap table { margin: 0; }
.table-wrap thead tr:first-child th { position: sticky; top: 0; background: #1f2937; z-index: 3; }
.table-wrap thead tr.range-row th { position: sticky; top: 37px; background: #0f172a; z-index: 2; font-weight: 400; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0 10px; }
.table-tools input { min-width: 240px; }
.table-hint { font-size: 12px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: #93c5fd; background: #162033; }
th.sorted-asc::after { content: " ▲"; font-size: 10px; }
th.sorted-desc::after { content: " ▼"; font-size: 10px; }
.range-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.range-pair input, .range-row input { width: 100%; min-width: 0; padding: 4px 6px; font-size: 11px; }
textarea { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px; width: 100%; max-width: 100%; min-width: 0; }
table.wide { min-width: 1400px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.ops-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr); gap: 18px; align-items: start; }
.ops-form { display: flex; flex-direction: column; gap: 14px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.fields label { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.fields label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; grid-column: 1 / -1; }
.fields input, .fields select { width: 100%; }
.fields input[type="checkbox"] { width: auto; flex: 0 0 auto; }
.hint { font-size: 11px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.ops-side { display: flex; flex-direction: column; gap: 14px; }
.ops-actions { display: flex; gap: 10px; }
.inbox-head { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.inbox-head .cards { margin: 0; }
.dump-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.dump-form textarea { min-height: 92px; }
.pager { display: flex; gap: 12px; align-items: center; margin: 10px 0; font-size: 13px; }
.tag-list { display: flex; flex-direction: column; gap: 4px; max-width: 220px; }
.tag-list a { padding: 6px 8px; border-radius: 6px; color: var(--text); }
.tag-list a.on { background: var(--panel2); }
.alert { background: #7f1d1d; color: #fecaca; padding: 8px 10px; border-radius: 8px; margin-bottom: 10px; }
.ok { background: #064e3b; color: #a7f3d0; padding: 8px 10px; border-radius: 8px; margin-bottom: 10px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
pre { background: var(--panel); padding: 12px; border-radius: 8px; overflow: auto; font-size: 12px; }
.auth { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.auth-card { width: 360px; background: var(--panel); padding: 28px; border-radius: 14px; }
.auth-card form { display: flex; flex-direction: column; gap: 8px; }
.auth-card input { width: 100%; }
.qr { display: block; margin: 12px auto; width: 180px; height: 180px; background: white; padding: 8px; border-radius: 8px; }
.secret { font-size: 12px; word-break: break-all; }
@media (max-width: 1100px) {
  .cards, .split, .ops-layout, .inbox-head, .fields { grid-template-columns: 1fr; }
  .table-wrap { max-height: none; }
}
