:root {
  --bg: #070d17;
  --panel: #0e1727;
  --panel-2: #121f33;
  --line: #1f2f48;
  --text: #e8eef9;
  --muted: #8fa3bf;
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --ok: #2ecc71;
  --warn: #f5b84b;
  --danger: #ff5c6c;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 800px at 80% -10%, #14284a 0%, var(--bg) 55%);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
}
button, input, select, textarea { font: inherit; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }

/* login */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
}
.login-card {
  width: min(420px, 100%); background: linear-gradient(180deg, #101d31, #0b1423);
  border: 1px solid var(--line); border-radius: 22px; padding: 32px;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
}
.brand h1 { font-size: 20px; margin: 0; letter-spacing: .2px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); margin-bottom: 6px; }
.input, select, textarea {
  width: 100%; background: #0a1322; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 12px; outline: none;
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,140,255,.15); }
.btn {
  border: 1px solid var(--line); background: #15243a; color: var(--text);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
}
.btn:hover { border-color: #37527a; background: #1a2c47; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #3f74e8); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: #351621; border-color: #5a2432; color: #ffb8c1; }
.btn.ok { background: #10291e; border-color: #1f5137; color: #a9f0c8; }
.btn.small { padding: 5px 9px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.error { color: #ffb8c1; background: #2a1119; border: 1px solid #542232; padding: 10px 12px; border-radius: 10px; font-size: 13px; }

/* shell */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: rgba(9, 16, 28, .92); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { margin: 0 0 18px 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); cursor: pointer; border: 1px solid transparent;
}
.nav-item:hover { background: #101d31; color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(79,140,255,.18), transparent); color: #fff; border-color: rgba(79,140,255,.2); }
.nav-item .ico { width: 20px; text-align: center; }
.sidebar-footer { margin-top: auto; color: var(--muted); font-size: 11px; padding: 10px 8px; }
.main { min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 26px; border-bottom: 1px solid var(--line);
  background: rgba(8, 14, 24, .75); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 17px; }
.topbar .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: #1a2d4c;
  display: grid; place-items: center; color: #cfe0ff; font-weight: 700;
}
.content { padding: 24px 26px 60px; }
.grid { display: grid; gap: 14px; }
.cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } .shell { grid-template-columns: 76px 1fr; } .nav-item span:not(.ico) { display: none; } .sidebar .brand h1, .sidebar .brand p { display: none; } }
@media (max-width: 700px) { .content { padding: 16px; } .topbar { padding: 12px 16px; } .cards { grid-template-columns: 1fr; } .shell { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; flex-direction: row; overflow-x: auto; } .nav-item span:not(.ico) { display: inline; } .sidebar-footer { display: none; } }
.card {
  background: linear-gradient(180deg, rgba(18,31,51,.95), rgba(11,20,35,.95));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.card h3 { margin: 0 0 12px; font-size: 14px; }
.card .big { font-size: 28px; font-weight: 700; letter-spacing: -.5px; }
.card .muted { color: var(--muted); font-size: 12px; }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi .label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .8px; }
.kpi .value { font-size: 26px; font-weight: 700; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section { margin-top: 20px; }
.section h3 { font-size: 15px; margin: 0 0 10px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .7px; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 8px; border-bottom: 1px solid rgba(31,47,72,.55); vertical-align: middle; }
tr:hover td { background: rgba(79,140,255,.035); }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge.ok { background: rgba(46,204,113,.12); color: #8ff0b8; }
.badge.warn { background: rgba(245,184,75,.12); color: #ffd88a; }
.badge.bad { background: rgba(255,92,108,.12); color: #ffb0b9; }
.badge.muted { background: rgba(143,163,191,.12); color: #c6d4e8; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(2,6,12,.72); display: grid; place-items: center;
  z-index: 100; padding: 20px; backdrop-filter: blur(4px);
}
.modal {
  width: min(620px, 100%); max-height: 88vh; overflow: auto;
  background: #0d182a; border: 1px solid var(--line); border-radius: 18px; padding: 22px;
  box-shadow: 0 30px 90px rgba(0,0,0,.6);
}
.modal h3 { margin: 0 0 14px; }
.toast-wrap { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  background: #10203a; border: 1px solid #2a446a; color: var(--text);
  padding: 11px 14px; border-radius: 10px; max-width: 380px; font-size: 13px;
  box-shadow: 0 12px 30px rgba(0,0,0,.4);
}
.toast.error { border-color: #5a2432; background: #2a1119; }
.toast.ok { border-color: #1f5137; background: #10291e; }
.code-box { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.code-box .mono { font-size: 18px; letter-spacing: 1px; background: #07111f; padding: 10px 14px; border: 1px dashed #2a446a; border-radius: 10px; }
.empty { color: var(--muted); text-align: center; padding: 26px 10px; font-size: 13px; }
.help { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tab { padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line); color: var(--muted); cursor: pointer; }
.tab.active { color: #fff; border-color: rgba(79,140,255,.4); background: rgba(79,140,255,.12); }
