:root {
  color-scheme: dark;
  --bg: #070b16;
  --surface: rgba(17, 24, 44, .86);
  --surface-strong: #11182c;
  --border: rgba(148, 163, 184, .18);
  --text: #f8fafc;
  --muted: #94a3b8;
  --accent: #7c8cff;
  --accent-2: #43d4b5;
  --danger: #fb7185;
  --shadow: 0 22px 60px rgba(0, 0, 0, .32);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0, rgba(124,140,255,.18), transparent 32rem),
    radial-gradient(circle at 92% 18%, rgba(67,212,181,.12), transparent 28rem),
    var(--bg);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(32px, 5vw, 54px); line-height: 1.04; letter-spacing: -.045em; }
h2 { margin-bottom: 6px; letter-spacing: -.025em; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin-bottom: 7px; color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.panel { border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.shell { width: min(1180px, calc(100% - 32px)); margin: auto; padding: 36px 0 64px; }
.hero { display: flex; gap: 28px; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; }
.hero-actions, .modal-actions { display: flex; gap: 10px; align-items: center; }
.button, .primary, .icon-button {
  border: 1px solid rgba(124,140,255,.3); border-radius: 11px; padding: 10px 14px;
  color: var(--text); background: rgba(124,140,255,.12); cursor: pointer; text-decoration: none;
}
.button:hover, .icon-button:hover { background: rgba(124,140,255,.22); }
.primary { border: 0; background: linear-gradient(135deg, #6878f4, #43bfa7); font-weight: 750; }
.primary:hover { filter: brightness(1.08); }
.ghost { border-color: var(--border); background: transparent; }
.logout-button { color: #fecdd3; border-color: rgba(251,113,133,.3); background: rgba(251,113,133,.1); }
.logout-button:hover { background: rgba(251,113,133,.2); }
.tabs { display: flex; gap: 6px; margin-bottom: 20px; padding: 6px; }
.tab { border: 0; border-radius: 12px; padding: 10px 18px; color: var(--muted); background: transparent; cursor: pointer; }
.tab.active { color: #fff; background: linear-gradient(135deg, rgba(124,140,255,.32), rgba(67,212,181,.18)); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.stat-card { min-width: 0; padding: 20px; }
.stat-card span, .stat-card small { display: block; color: var(--muted); }
.stat-card strong { display: block; margin: 9px 0 4px; overflow: hidden; font-size: 27px; text-overflow: ellipsis; }
.memory-card { display: flex; min-height: 137px; flex-direction: column; }
.memory-values { display: flex; min-width: 0; align-items: baseline; gap: 7px; margin: 9px 0 8px; white-space: nowrap; }
.memory-values strong { min-width: 0; margin: 0; transition: color .2s; }
.memory-values > span { flex: 0 0 auto; color: var(--muted); font-size: 14px; font-weight: 600; }
.memory-meta { display: grid; gap: 6px; margin-top: auto; }
.memory-track { width: 100%; height: 5px; overflow: hidden; border-radius: 999px; background: rgba(148,163,184,.13); }
.memory-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: currentColor; transition: width .35s ease, color .2s; }
.memory-green { color: #6ee7b7; }
.memory-yellow { color: #fde047; }
.memory-orange { color: #fb923c; }
.memory-red { color: #fb7185; }
.stat-card.accent { border-color: rgba(67,212,181,.32); background: linear-gradient(145deg, rgba(17,54,57,.85), rgba(17,24,44,.88)); }
.overview-panel { display: grid; min-height: 230px; grid-template-columns: minmax(190px,.75fr) minmax(440px,1.8fr) 180px; gap: 24px; align-items: center; margin-bottom: 14px; padding: 26px 30px; overflow: hidden; }
.overview-panel h2 { font-size: clamp(35px, 6vw, 64px); }
.lifetime-summary { min-width: 0; }
.history-grid { display: grid; min-width: 0; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.history-chart { min-width: 0; padding: 14px; border: 1px solid rgba(148,163,184,.14); border-radius: 16px; background: rgba(6,11,25,.42); }
.history-chart header, .history-chart footer { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.history-chart header span { color: var(--muted); font-size: 12px; font-weight: 700; }
.history-chart header strong { font-size: 14px; }
.history-chart svg { display: block; width: 100%; height: 108px; margin: 8px 0 4px; overflow: visible; }
.history-chart footer { color: #64748b; font-size: 10px; }
.chart-grid-line { fill: none; stroke: rgba(148,163,184,.1); stroke-width: 1; stroke-dasharray: 3 5; }
.chart-empty { fill: #64748b; font-size: 11px; }
.orbit { position: relative; width: 180px; height: 180px; flex: 0 0 auto; border: 1px solid rgba(124,140,255,.28); border-radius: 50%; }
.orbit::before, .orbit::after { position: absolute; inset: 22px; border: 1px solid rgba(67,212,181,.25); border-radius: 50%; content: ""; }
.orbit::after { inset: 54px; background: radial-gradient(circle at 30% 25%, #8c98ff, #263267 68%); box-shadow: 0 0 45px rgba(124,140,255,.35); }
.orbit span { position: absolute; top: 18px; left: 48px; width: 14px; height: 14px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 20px var(--accent-2); }
.quick-users, .content-panel { padding: 24px; }
.section-head { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.section-head h2 { margin-bottom: 2px; }
.mini-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mini-user { padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: rgba(9,14,29,.45); }
.mini-user header, .user-main, .user-actions { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.mini-user strong { overflow: hidden; text-overflow: ellipsis; }
.status { display: inline-flex; padding: 4px 9px; border-radius: 999px; color: #9cf3df; background: rgb(3,39,31); font-size: 11px; font-weight: 750; }
.status.disabled { color: #fecdd3; background: #4b1722; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 11px; padding: 11px 12px;
  color: var(--text); background: rgba(3,7,18,.58); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: rgba(124,140,255,.7); box-shadow: 0 0 0 3px rgba(124,140,255,.12); }
label { display: grid; gap: 6px; color: #cbd5e1; font-size: 13px; font-weight: 650; }
label small { color: var(--muted); font-weight: 400; }
.users-list { display: grid; gap: 10px; }
.user-row { display: grid; grid-template-columns: minmax(180px,1.1fr) minmax(210px,1.2fr) minmax(150px,.8fr) auto; gap: 18px; align-items: center; padding: 17px; border: 1px solid var(--border); border-radius: 17px; background: linear-gradient(145deg, rgba(16,24,45,.72), rgba(8,13,27,.66)); transition: border-color .16s, transform .16s; }
.user-row:hover { border-color: rgba(124,140,255,.34); transform: translateY(-1px); }
.user-row p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.protocol-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { padding: 3px 7px; border-radius: 7px; color: #cbd5e1; background: rgba(124,140,255,.12); font-size: 10px; text-transform: uppercase; }
.traffic-cell { min-width: 0; }
.traffic-values { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.traffic-values strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.traffic-values span { flex: 0 0 auto; color: var(--muted); font-size: 11px; }
.traffic-progress { display: block; width: 100%; height: 7px; overflow: hidden; border: 0; border-radius: 999px; appearance: none; background: rgba(148,163,184,.13); }
.traffic-progress::-webkit-progress-bar { border-radius: inherit; background: rgba(148,163,184,.13); }
.traffic-progress::-webkit-progress-value { border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.traffic-progress::-moz-progress-bar { border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.traffic-progress.warning::-webkit-progress-value { background: linear-gradient(90deg, #f5b83d, #f59e0b); }
.traffic-progress.warning::-moz-progress-bar { background: linear-gradient(90deg, #f5b83d, #f59e0b); }
.traffic-progress.critical::-webkit-progress-value { background: linear-gradient(90deg, #fb7185, #e11d48); }
.traffic-progress.critical::-moz-progress-bar { background: linear-gradient(90deg, #fb7185, #e11d48); }
.traffic-progress.unlimited::-webkit-progress-value { background: linear-gradient(90deg, rgba(124,140,255,.5), rgba(67,212,181,.5)); }
.traffic-progress.unlimited::-moz-progress-bar { background: linear-gradient(90deg, rgba(124,140,255,.5), rgba(67,212,181,.5)); }
.user-actions { justify-content: flex-end; }
.user-actions button { padding: 7px 9px; font-size: 12px; }
.danger { color: #fecdd3; border-color: rgba(251,113,133,.28); background: rgba(251,113,133,.1); }
.warning-button { color: #fde68a; border-color: rgba(245,184,61,.34); background: rgba(245,158,11,.11); }
.warning-button:hover { background: rgba(245,158,11,.2); }
.announce-layout { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(260px,.6fr); gap: 28px; }
.locations-placeholder { width: 100%; }
.placeholder-card {
  display: grid;
  gap: 6px;
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(17, 24, 44, .62);
}
.placeholder-card span { color: var(--muted); }
.form-stack { display: grid; gap: 15px; }
.switch-row { display: flex; gap: 18px; align-items: center; justify-content: space-between; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: rgba(3,7,18,.35); cursor: pointer; }
.switch-row span { display: grid; gap: 2px; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row i { position: relative; width: 46px; height: 26px; flex: 0 0 auto; border-radius: 999px; background: #334155; }
.switch-row i::after { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; content: ""; transition: transform .18s; }
.switch-row input:checked + i { background: var(--accent-2); }
.switch-row input:checked + i::after { transform: translateX(20px); }
.announce-preview { padding: 16px; border-left: 1px solid var(--border); color: var(--muted); }
.announce-preview article { margin-top: 12px; padding: 18px; border: 1px solid rgba(67,212,181,.25); border-radius: 16px; color: var(--text); background: linear-gradient(145deg, rgba(17,54,57,.72), rgba(17,24,44,.9)); }
.announce-preview a { color: var(--accent-2); }
.limits-layout { display: grid; gap: 14px; }
.limits-settings .section-head { align-items: flex-start; }
.limits-settings .section-head .muted { max-width: 660px; margin-bottom: 0; }
.limits-schedule { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.limits-form-footer { display: flex; gap: 16px; align-items: center; justify-content: space-between; }
.limits-form-footer p { margin: 0; }
.limits-history .section-head { align-items: flex-start; }
.history-badge {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid rgba(67,212,181,.25);
  border-radius: 999px;
  color: #9cf3df;
  background: rgb(3,39,31);
  font-size: 11px;
  font-weight: 750;
}
.limits-history-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: 16px; }
.limits-table { width: 100%; min-width: 680px; border-collapse: collapse; }
.limits-table th, .limits-table td { padding: 13px 15px; border-bottom: 1px solid rgba(148,163,184,.11); text-align: right; white-space: nowrap; }
.limits-table thead th { color: var(--muted); background: rgba(3,7,18,.42); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.limits-table th:first-child { position: sticky; left: 0; z-index: 1; min-width: 180px; text-align: left; background: #11182c; }
.limits-table thead th:first-child { z-index: 2; background: #0c1222; }
.limits-table tbody tr:last-child th, .limits-table tbody tr:last-child td { border-bottom: 0; }
.limits-table tbody td { color: #dbe4f0; font-variant-numeric: tabular-nums; }
.limits-empty { display: grid; gap: 5px; padding: 28px; text-align: center; }
.limits-empty span { color: var(--muted); }
button:disabled { opacity: .5; cursor: not-allowed; }
.login-shell { display: grid; min-height: 100vh; padding: 20px; place-items: center; }
.login-card { width: min(430px,100%); padding: 30px; }
.login-card h1 { font-size: 38px; }
.error { margin: 0; color: #fda4af; }
dialog { width: min(760px, calc(100% - 24px)); max-height: calc(100vh - 30px); padding: 0; overflow-x: hidden; overflow-y: auto; border: 1px solid var(--border); border-radius: 22px; color: var(--text); background: var(--surface-strong); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(2,6,23,.72); backdrop-filter: blur(5px); }
.modal-card { display: grid; min-width: 0; gap: 16px; padding: 24px; }
.modal-card > *, .modal-card fieldset { min-width: 0; }
.icon-button { display: inline-grid; width: 38px; height: 38px; padding: 0; place-items: center; font-size: 24px; line-height: 1; }
.icon-button span { display: block; line-height: 1; transform: translateY(-2px); }
.form-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 14px; }
fieldset { border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
legend { padding: 0 8px; color: var(--muted); font-size: 12px; }
.protocol-list { display: grid; gap: 8px; }
.protocol-item { display: flex; width: 100%; max-width: 100%; gap: 8px; align-items: center; min-width: 0; padding: 8px; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: rgba(3,7,18,.28); }
.protocol-master { display: flex; width: 116px; flex: 0 0 116px; gap: 9px; align-items: center; justify-content: space-between; padding: 7px 9px; border-radius: 9px; background: rgba(124,140,255,.1); cursor: pointer; }
.protocol-master span { display: grid; gap: 0; }
.protocol-master small { color: var(--muted); font-weight: 400; }
.protocol-master input { position: absolute; opacity: 0; pointer-events: none; }
.protocol-master i { position: relative; width: 32px; height: 18px; flex: 0 0 auto; border-radius: 999px; background: #334155; }
.protocol-master i::after { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: white; content: ""; transition: transform .18s; }
.protocol-master input:checked + i { background: var(--accent-2); }
.protocol-master input:checked + i::after { transform: translateX(14px); }
.protocol-item input { width: auto; }
.inbound-list { display: flex; flex: 1 1 auto; gap: 7px; min-width: 0; padding: 0; }
.inbound-option { display: flex; flex: 1 1 0; gap: 9px; align-items: center; justify-content: space-between; min-width: 0; padding: 7px 9px; border: 1px solid var(--border); border-radius: 9px; background: rgba(17,24,44,.62); cursor: pointer; }
.inbound-option span { display: grid; min-width: 0; gap: 1px; }
.inbound-option strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.inbound-option small { color: var(--muted); font-weight: 400; }
.inbound-option input { position: absolute; opacity: 0; pointer-events: none; }
.inbound-option i { position: relative; width: 30px; height: 18px; flex: 0 0 auto; border-radius: 999px; background: #334155; }
.inbound-option i::after { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: white; content: ""; transition: transform .18s; }
.inbound-option input:checked + i { background: var(--accent-2); }
.inbound-option input:checked + i::after { transform: translateX(12px); }
.input-action { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; }
.toast { position: fixed; z-index: 10; top: 18px; right: 18px; max-width: 380px; padding: 12px 16px; border: 1px solid rgba(67,212,181,.35); border-radius: 12px; background: #092c27; box-shadow: var(--shadow); }
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .overview-panel { grid-template-columns: 1fr; }
  .orbit { display: none; }
  .mini-grid { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr 1fr; }
  .user-actions { justify-content: flex-start; }
}
@media (max-width: 650px) {
  .shell { width: min(100% - 18px,1180px); padding-top: 20px; }
  .hero, .section-head { align-items: stretch; flex-direction: column; }
  .hero-actions { flex-wrap: wrap; }
  .tabs { overflow-x: auto; }
  .stats-grid, .form-grid, .announce-layout, .limits-schedule { grid-template-columns: 1fr; }
  .protocol-item { align-items: stretch; flex-direction: column; }
  .protocol-master { width: 100%; flex-basis: auto; }
  .inbound-list { flex-direction: column; }
  .overview-panel { min-height: 0; }
  .history-grid { grid-template-columns: 1fr; }
  .user-row { grid-template-columns: 1fr; }
  .traffic-values { align-items: flex-start; flex-direction: column; gap: 2px; }
  .user-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .user-actions button { width: 100%; }
  .input-action { grid-template-columns: 1fr; }
  .announce-preview { border-top: 1px solid var(--border); border-left: 0; }
  .limits-form-footer { align-items: stretch; flex-direction: column; }
  .limits-form-footer .primary { width: 100%; }
  .history-badge { align-self: flex-start; }
}
