:root {
  --bg: #12141a; --panel: #1a1d26; --panel2: #222632; --line: #2c3140;
  --text: #eef0f5; --muted: #9aa1b2; --blue: #4f8ef7; --green: #3ddc84;
  --red: #ff6b6b; --amber: #f5b942;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--blue); text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 20px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.side .brand { font-weight: 800; font-size: 20px; padding: 4px 10px 16px; }
.side .brand small { display: block; color: var(--muted); font-weight: 500; font-size: 12px; }
.side a.nav { color: var(--muted); padding: 9px 12px; border-radius: 10px; font-weight: 600; }
.side a.nav:hover { background: var(--panel2); color: var(--text); }
.side a.nav.on { background: rgba(79,142,247,.16); color: var(--blue); }
.side .who { margin-top: auto; padding: 10px; color: var(--muted); font-size: 13px; }
.main { padding: 28px clamp(16px, 3vw, 40px) 60px; max-width: 1100px; width: 100%; }
h1 { font-size: 26px; margin: 0 0 18px; }
h2 { font-size: 17px; margin: 24px 0 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.card .n { font-size: 28px; font-weight: 800; }
.card .l { color: var(--muted); font-size: 13px; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
input, select { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; min-width: 0; }
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.bar input[type=search] { flex: 1 1 240px; }
.btn { background: var(--blue); color: #fff; border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 700; cursor: pointer; }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--red); color: #1b0a0a; }
.btn:disabled { opacity: .5; cursor: default; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--panel2); }
.pill { display: inline-block; border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 700; background: var(--panel2); color: var(--muted); }
.pill.green { background: rgba(61,220,132,.15); color: var(--green); }
.pill.red { background: rgba(255,107,107,.15); color: var(--red); }
.pill.blue { background: rgba(79,142,247,.15); color: var(--blue); }
.pill.amber { background: rgba(245,185,66,.15); color: var(--amber); }
.pager { display: flex; gap: 10px; align-items: center; margin-top: 14px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); }
.empty, .note { color: var(--muted); padding: 18px 0; }
.err { color: var(--red); margin: 8px 0; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; z-index: 10; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: min(440px, 100%); }
.modal h3 { margin: 0 0 6px; } .modal p { color: var(--muted); margin: 0 0 14px; }
.modal input, .modal select { width: 100%; margin-bottom: 12px; }
.modal .row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }
.secret { font: 700 20px ui-monospace, Menlo, monospace; background: var(--panel2); padding: 12px; border-radius: 10px; text-align: center; user-select: all; margin-bottom: 12px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; width: min(380px, 100%); display: grid; gap: 12px; }
.login h1 { margin: 0; font-size: 22px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 18px; border-radius: 12px; z-index: 20; }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; }
  .side .brand { padding: 0 8px; } .side .who { margin: 0 0 0 auto; padding: 0 8px; }
  .kv { grid-template-columns: 1fr; }
}
