/* nimproxy console - instrument-panel aesthetic, no framework, no build step */

:root {
  --bg: #070a08;
  --bg-soft: #0a0f0b;
  --panel: #0d120e;
  --panel-2: #111713;
  --panel-3: #151d17;
  --line: #1b251f;
  --line-2: #28352c;
  --text: #e3ede0;
  --muted: #849982;
  --dim: #566a59;
  --lime: #c8f05a;
  --lime-soft: rgba(200, 240, 90, 0.12);
  --lime-line: rgba(200, 240, 90, 0.32);
  --teal: #5fd7c3;
  --amber: #f0b451;
  --red: #f0655a;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 2px;
  --rail: 236px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 88% -12%, rgba(200, 240, 90, 0.05), transparent 62%),
    radial-gradient(900px 500px at 0% 110%, rgba(95, 215, 195, 0.035), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.016) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--lime); color: #060906; }

a { color: var(--lime); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 1px solid var(--lime);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-2); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* ---------- typography ---------- */

.eyebrow {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
}

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 18px; letter-spacing: -0.01em; }
h2 { font-size: 14px; letter-spacing: 0.02em; }
h3 { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100dvh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(13, 18, 14, 0.92), rgba(7, 10, 8, 0.96));
  backdrop-filter: blur(6px);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 22px;
  height: 22px;
  position: relative;
  flex: none;
}
.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  background: var(--lime);
}
.brand-mark::before { left: 0; top: 0; width: 4px; height: 22px; }
.brand-mark::after { left: 8px; top: 0; width: 14px; height: 4px; box-shadow: 0 18px 0 var(--lime); }
.brand-mark i {
  position: absolute;
  left: 12px;
  top: 8px;
  width: 4px;
  height: 8px;
  background: var(--teal);
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
}
.brand-name span { color: var(--lime); }
.brand-sub {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--dim);
  text-transform: uppercase;
  margin-top: 1px;
}

.nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-group { margin-bottom: 22px; }
.nav-label {
  padding: 0 10px 8px;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
}
.nav-link {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: color 120ms ease, background 120ms ease, border-color 120ms ease;
}
.nav-link svg { width: 15px; height: 15px; flex: none; opacity: 0.75; }
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.025); text-decoration: none; }
.nav-link.active {
  color: var(--lime);
  background: var(--lime-soft);
  border-left-color: var(--lime);
}
.nav-link.active svg { opacity: 1; }

.rail-foot {
  border-top: 1px solid var(--line);
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.role-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.rail-hint { font-size: 10px; color: var(--dim); line-height: 1.7; }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 8, 0.82);
  backdrop-filter: blur(10px);
}
.topbar-left { min-width: 0; }
.topbar-left .eyebrow { margin-bottom: 3px; }
.page-title { font-size: 17px; letter-spacing: -0.01em; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex: none; }

.live-clock {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}
.live-clock b { color: var(--text); font-weight: 500; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid var(--line-2);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.pill.ok { border-color: var(--lime-line); color: var(--lime); }
.pill.warn { border-color: rgba(240, 180, 81, 0.35); color: var(--amber); }
.pill.bad { border-color: rgba(240, 101, 90, 0.4); color: var(--red); }

.content {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  padding: 26px 30px 72px;
}

.view { animation: rise 180ms ease both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}

/* ---------- stats ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 20px;
}
.stat {
  background: var(--panel);
  padding: 16px 18px 15px;
  position: relative;
  min-width: 0;
}
.stat::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 0;
  width: 18px;
  height: 1px;
  background: var(--lime);
}
.stat .eyebrow { margin-bottom: 10px; }
.stat.compact .stat-value { font-size: 21px; line-height: 1.25; }
.modal .stat { padding: 12px 14px; }
.modal .stat-value { font-size: 22px; }
.stat-value {
  font-size: 29px;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-value small { font-size: 13px; color: var(--dim); letter-spacing: 0; }
.stat-sub {
  margin-top: 7px;
  font-size: 10.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-sub .up { color: var(--lime); }
.stat-sub .down { color: var(--red); }

/* ---------- panels ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  min-width: 0;
}
.panel + .panel { margin-top: 16px; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  min-height: 46px;
}
.panel-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.panel-title h2 { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; }
.panel-title span { font-size: 10px; color: var(--dim); letter-spacing: 0.05em; }
.panel-body { padding: 16px; }
.panel-body.flush { padding: 0; }

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 9.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.012);
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.035);
  vertical-align: middle;
  font-size: 12px;
  white-space: nowrap;
}
tbody tr { transition: background 100ms ease; }
tbody tr:hover td { background: rgba(200, 240, 90, 0.028); }
tbody tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; }

/* ---------- tags, dots, chips ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border: 1px solid var(--line-2);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.tag.lime { color: var(--lime); border-color: var(--lime-line); }
.tag.teal { color: var(--teal); border-color: rgba(95, 215, 195, 0.4); }
.tag.amber { color: var(--amber); border-color: rgba(240, 180, 81, 0.4); }
.tag.red { color: var(--red); border-color: rgba(240, 101, 90, 0.4); }

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
}
.dot.ok { background: var(--lime); box-shadow: 0 0 0 3px rgba(200, 240, 90, 0.12); }
.dot.ok.live { animation: pulse 2.4s ease-in-out infinite; }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(240, 180, 81, 0.12); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 3px rgba(240, 101, 90, 0.12); }
.dot.off { background: var(--dim); }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(200, 240, 90, 0.1); }
  50% { box-shadow: 0 0 0 6px rgba(200, 240, 90, 0.02); }
}

/* ---------- buttons & forms ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 13px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease, transform 60ms ease;
}
.btn:hover { border-color: var(--lime); color: var(--lime); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--lime); border-color: var(--lime); color: #080b06; font-weight: 600; }
.btn.primary:hover { background: #d7ff74; color: #080b06; }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { border-color: var(--line-2); color: var(--text); }
.btn.danger:hover { border-color: var(--red); color: var(--red); }
.btn.sm { padding: 5px 9px; font-size: 9.5px; letter-spacing: 0.1em; }
.btn.icon { padding: 7px; width: 32px; height: 32px; }
.btn svg { width: 14px; height: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label {
  font-size: 9.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dim);
}
.input, .select, .textarea {
  width: 100%;
  background: #080c09;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  padding: 9px 11px;
  font-size: 12px;
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.textarea { min-height: 130px; resize: vertical; line-height: 1.6; font-size: 11.5px; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: right 14px center, right 9px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--lime);
  box-shadow: 0 0 0 1px rgba(200, 240, 90, 0.18);
}
.input::placeholder, .textarea::placeholder { color: #3f4f43; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.hint { font-size: 10.5px; color: var(--dim); line-height: 1.6; }
.hint code { color: var(--teal); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar .spacer { flex: 1; }
.search { position: relative; }
.search .input { padding-left: 30px; width: 230px; }
.search::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 9px;
  height: 9px;
  border: 1px solid var(--dim);
  border-radius: 50%;
  transform: translateY(-50%);
}
.search::after {
  content: "";
  position: absolute;
  left: 19px;
  top: 58%;
  width: 5px;
  height: 1px;
  background: var(--dim);
  transform: rotate(45deg);
}

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 10px;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}
.chip:hover { color: var(--text); border-color: var(--muted); }
.chip.active { color: var(--lime); border-color: var(--lime-line); background: var(--lime-soft); }

/* ---------- bars / meters ---------- */

.bars {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 126px;
  padding-top: 6px;
}
.bar-col {
  flex: 1;
  min-width: 3px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
}
.bar {
  width: 100%;
  min-height: 2px;
  background: linear-gradient(180deg, var(--lime) 0%, rgba(200, 240, 90, 0.18) 100%);
  transition: opacity 120ms ease;
}
.bar-col:hover .bar { opacity: 0.75; }
.bar-col.zero .bar { background: var(--line-2); }
.bar-cap {
  font-size: 8.5px;
  color: var(--dim);
  text-align: center;
  font-variant-numeric: tabular-nums;
  min-height: 11px;
}

.meter {
  height: 4px;
  background: var(--line);
  overflow: hidden;
  flex: 1;
  min-width: 40px;
}
.meter > i { display: block; height: 100%; background: var(--lime); transition: width 220ms ease; }
.meter.warn > i { background: var(--amber); }
.meter.bad > i { background: var(--red); }

.country-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.055);
}
.country-row:last-child { border-bottom: 0; }
.country-code {
  font-size: 11px;
  color: var(--lime);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.country-meta { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.country-meta .meter { flex: none; width: 100%; }
.country-count { font-size: 10.5px; color: var(--dim); text-align: right; }

/* ---------- misc ---------- */

.empty {
  border: 1px dashed var(--line-2);
  padding: 34px 20px;
  text-align: center;
  color: var(--dim);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}
.empty b { color: var(--muted); font-weight: 500; }
.empty .prompt { color: var(--lime); }

.loadbar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  background: var(--lime);
  z-index: 100;
  transition: width 200ms ease, opacity 300ms ease;
}
.loadbar.on { width: 72%; opacity: 1; }
.loadbar.done { width: 100%; opacity: 0; }

.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 14px; font-size: 11.5px; }
.kv dt { color: var(--dim); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; padding-top: 2px; }
.kv dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }

.code-block {
  position: relative;
  background: #060907;
  border: 1px solid var(--line);
  padding: 12px 14px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--teal);
  overflow-x: auto;
  white-space: pre;
}
.code-block .copy {
  position: absolute;
  right: 8px;
  top: 8px;
}
.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: #080c09;
  min-width: 0;
}
.copy-row + .copy-row { margin-top: 6px; }
.copy-row code {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--teal);
}
.copy-row .tag { flex: none; }

.token-box {
  border: 1px solid var(--lime-line);
  background: var(--lime-soft);
  padding: 12px;
  margin: 12px 0;
}
.token-box .eyebrow { color: var(--lime); margin-bottom: 8px; }
.token-box code { display: block; font-size: 12px; color: var(--text); overflow-wrap: anywhere; margin-bottom: 10px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 10px;
}
.section-head:first-child { margin-top: 0; }

.key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.055);
}
.key-row:last-child { border-bottom: 0; }
.key-row .key-meta { min-width: 0; }
.key-row .key-id { font-size: 11.5px; color: var(--text); }
.key-row .key-sub { font-size: 10px; color: var(--dim); margin-top: 2px; }

.quota {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.quota-label { font-size: 10px; color: var(--dim); white-space: nowrap; }

/* ---------- login ---------- */

.login {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
}
.login-left {
  position: relative;
  padding: 42px 46px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  background:
    radial-gradient(800px 420px at 12% 108%, rgba(95, 215, 195, 0.055), transparent 62%),
    radial-gradient(700px 380px at 92% -8%, rgba(200, 240, 90, 0.06), transparent 60%);
}
.login-right {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}
.auth-card { width: min(410px, 100%); }
.auth-brand { display: none; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-lead { font-size: 12px; color: var(--muted); margin: 10px 0 22px; line-height: 1.7; }
.topo {
  display: grid;
  grid-template-columns: minmax(0, auto) 54px minmax(0, auto) 54px minmax(0, auto);
  align-items: center;
  max-width: 580px;
  margin-top: 30px;
}
.topo-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 10.5px;
  color: var(--dim);
  letter-spacing: 0.06em;
}
.topo-side span { white-space: nowrap; }
.topo-side.right { align-items: flex-start; }
.topo-side em { color: var(--lime); font-style: normal; }
.topo-hub {
  border: 1px solid var(--lime-line);
  background: var(--lime-soft);
  padding: 14px 16px;
  text-align: center;
}
.topo-hub b { display: block; color: var(--lime); letter-spacing: 0.18em; font-size: 11px; }
.topo-hub small {
  display: block;
  color: var(--dim);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 4px;
}
.topo-wire { position: relative; height: 100%; min-height: 118px; }
.topo-wire::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line-2);
}
.topo-wire::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--lime);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(200, 240, 90, 0.08);
}
input[type="checkbox"] { accent-color: var(--lime); }

@media (max-width: 520px) {
  .topo { grid-template-columns: minmax(0, auto) 24px minmax(0, auto) 24px minmax(0, auto); }
  .topo-side { font-size: 9px; gap: 7px; }
  .topo-hub { padding: 10px; }
}
.login-foot { font-size: 10px; color: var(--dim); letter-spacing: 0.1em; text-transform: uppercase; }

.tabs { display: flex; border: 1px solid var(--line); margin-bottom: 20px; }
.tab {
  flex: 1;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}
.tab.active {
  background: var(--panel-2);
  color: var(--lime);
  box-shadow: inset 0 -2px 0 var(--lime);
}
.form-error {
  border: 1px solid rgba(240, 101, 90, 0.45);
  background: rgba(240, 101, 90, 0.07);
  color: #ffb3ad;
  padding: 10px 12px;
  font-size: 11px;
  margin-bottom: 14px;
}

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(3, 5, 4, 0.74);
  backdrop-filter: blur(3px);
  animation: fade 140ms ease both;
}
.modal-backdrop.right { justify-content: flex-end; align-items: stretch; padding: 0; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: min(620px, 100%);
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62);
  animation: pop 160ms ease both;
}
.modal-backdrop.right .modal {
  width: min(720px, 100%);
  height: 100dvh;
  max-height: none;
  border-right: 0;
  border-top: 0;
  border-bottom: 0;
  animation: slide 180ms ease both;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes slide { from { transform: translateX(18px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.modal-head .eyebrow { margin-bottom: 4px; }
.modal-close {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--muted);
  width: 28px;
  height: 28px;
  cursor: pointer;
  flex: none;
  line-height: 1;
}
.modal-close:hover { color: var(--red); border-color: var(--red); }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
}
.modal-foot .spacer { flex: 1; }

.toast-wrap, #toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}
.toast {
  border: 1px solid var(--lime-line);
  background: #0b1308;
  color: var(--text);
  padding: 10px 14px;
  font-size: 11px;
  letter-spacing: 0.03em;
  max-width: 380px;
  animation: pop 160ms ease both;
}
.toast.err { border-color: rgba(240, 101, 90, 0.5); background: #170b0a; }

.spin {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid var(--line-2);
  border-top-color: var(--lime);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 14px 18px 12px; }
  .nav { display: flex; gap: 20px; padding: 8px 12px 12px; overflow-x: auto; }
  .nav-group { margin: 0; display: flex; align-items: center; gap: 4px; }
  .nav-label { display: none; }
  .nav-link { padding: 7px 9px; border-left: 0; border-bottom: 2px solid transparent; }
  .nav-link.active { border-left: 0; border-bottom-color: var(--lime); }
  .rail-foot { display: none; }
  .topbar { padding: 10px 18px; }
  .content { padding: 18px 18px 56px; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-left { display: none; }
  .login-right { min-height: 100dvh; }
  .auth-brand { display: flex; }
}

@media (max-width: 700px) {
  .topbar-left .eyebrow { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: span 1; }
  .live-clock { display: none; }
  .page-title { font-size: 15px; }
  .search .input { width: 100%; }
  .toolbar { align-items: stretch; }
  .toolbar .search { flex: 1 1 100%; }
}

input[type="checkbox"] { accent-color: var(--lime); }

@media (max-width: 520px) {
  .stat-value { font-size: 23px; }
  .stat.compact .stat-value { font-size: 17px; }
  .content { padding: 14px 12px 48px; }
  .topbar { min-height: 58px; }
  .panel-head { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
