/* NIGHTFALL — access hub */
:root {
  --bg: #050507;
  --bg-soft: #0a0709;
  --panel: #120b0e;
  --panel-2: #1a0d11;
  --line: #3a1218;
  --line-soft: #241016;
  --text: #f5f3f6;
  --text-2: #b9b3bd;
  --text-3: #7d7581;
  --red: #e1122a;
  --red-2: #ff2d45;
  --red-dim: rgba(225, 18, 42, 0.15);
  --gold: #f2c94c;
  --green: #27d17c;
  --purple: #b15cff;
  --font: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Bebas Neue", "Barlow", "Segoe UI", sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", ui-monospace, Consolas, monospace;
  --radius: 16px;
}

* { box-sizing: border-box; }
html { color-scheme: dark; scrollbar-color: #2b2b36 #08080b; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 10% -10%, rgba(225, 18, 42, 0.2), transparent 62%),
    radial-gradient(720px 420px at 100% 0%, rgba(242, 201, 76, 0.05), transparent 55%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.35;
  background-image: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.012) 0 1px, transparent 1px 3px);
}
::selection { background: rgba(225, 42, 60, 0.35); color: #fff; }
a { color: inherit; }
svg { display: block; }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-family: var(--display); }
code { font-family: var(--mono); }

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(25, 9, 13, 0.96), rgba(6, 4, 6, 0.98));
  backdrop-filter: blur(14px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 20px;
  text-decoration: none;
}
.brand-mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(225, 18, 42, 0.55);
  border-radius: 13px;
  color: var(--red-2);
  background: linear-gradient(160deg, rgba(225, 18, 42, 0.22), rgba(225, 18, 42, 0.02));
  box-shadow: 0 0 28px rgba(225, 18, 42, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.brand-mark svg { width: 23px; height: 23px; filter: drop-shadow(0 0 8px rgba(225, 18, 42, 0.6)); }
.brand-copy strong { display: block; font-family: var(--display); font-size: 21px; font-weight: 400; letter-spacing: 0.09em; line-height: 1; }
.brand-copy small { display: block; margin-top: 4px; font-size: 8.5px; letter-spacing: 0.34em; color: var(--red-2); opacity: 0.9; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; overflow-y: auto; }
.nav-label {
  padding: 16px 10px 7px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-3);
}
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.nav-item svg { width: 17px; height: 17px; opacity: 0.8; }
.nav-item:hover { background: rgba(255, 255, 255, 0.035); color: var(--text); }
.nav-item.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(225, 42, 60, 0.16), rgba(225, 42, 60, 0.02) 70%);
  border-color: rgba(225, 42, 60, 0.18);
}
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: var(--red);
  box-shadow: 0 0 12px rgba(225, 42, 60, 0.7);
}
.nav-item.is-active svg { opacity: 1; color: var(--red-2); }

.side-foot {
  margin-top: auto;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line-soft);
}
.statusline { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-2); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--text-3); flex: 0 0 auto; }
.dot.ok { background: var(--green); box-shadow: 0 0 10px rgba(91, 191, 143, 0.7); }
.side-meta { margin: 7px 0 14px; font-size: 10.5px; color: var(--text-3); letter-spacing: 0.02em; }
.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  transition: 0.15s ease;
}
.logout-btn svg { width: 15px; height: 15px; }
.logout-btn:hover { border-color: rgba(225, 42, 60, 0.4); color: var(--red-2); background: rgba(225, 42, 60, 0.06); }

/* ------------------------------------------------------------------- main */
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 36px 22px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(10, 10, 14, 0.5), transparent);
}
.eyebrow {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.28em;
  color: var(--text-3);
  text-transform: uppercase;
}
.eyebrow span { color: var(--red); margin: 0 4px; }
.topbar h1 { margin-top: 5px; font-family: var(--display); font-size: 36px; font-weight: 400; letter-spacing: 0.035em; line-height: 1; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.content {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 26px 36px 64px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ------------------------------------------------------------------- bits */
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.01em; }
.muted { color: var(--text-3); }
.gold { color: var(--gold); }
.right { text-align: right; }
.empty { padding: 26px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty a { color: var(--red-2); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #ff2d45, #b10e20);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(225, 18, 42, 0.35), 0 0 24px rgba(225, 18, 42, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 38px rgba(225, 18, 42, 0.45), 0 0 34px rgba(225, 18, 42, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.26); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost {
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--line);
}
.btn-ghost:hover { color: var(--text); border-color: rgba(225, 18, 42, 0.45); background: rgba(225, 18, 42, 0.07); }
.btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn.is-disabled, .btn:disabled { opacity: 0.38; pointer-events: none; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
  color: var(--text-3);
  text-decoration: none;
  transition: 0.15s ease;
}
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:hover { color: var(--text); border-color: #3a3a46; background: rgba(255, 255, 255, 0.05); }
.icon-btn.is-warn:hover { color: var(--gold); border-color: rgba(214, 176, 106, 0.45); background: rgba(214, 176, 106, 0.07); }
.icon-btn.is-danger:hover { color: var(--red-2); border-color: rgba(225, 42, 60, 0.45); background: rgba(225, 42, 60, 0.08); }
.icon-btn:disabled { opacity: 0.3; pointer-events: none; }
button.icon-btn { padding: 0; }

/* ------------------------------------------------------------------ cards */
.card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(27, 10, 14, 0.96), rgba(9, 6, 8, 0.98));
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.55), 0 0 45px rgba(225, 18, 42, 0.05);
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(225, 18, 42, 0.55), transparent);
  pointer-events: none;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 22px 16px;
}
.card-head h2 { font-family: var(--display); font-size: 21px; font-weight: 400; letter-spacing: 0.04em; line-height: 1; }
.card-sub { margin: 4px 0 0; font-size: 12px; color: var(--text-3); }
.card-tools { display: flex; gap: 10px; align-items: center; }
.link-quiet { color: var(--text-3); font-size: 12px; text-decoration: none; white-space: nowrap; }
.link-quiet:hover { color: var(--red-2); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat {
  position: relative;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(31, 11, 16, 0.94), rgba(9, 6, 8, 0.98));
  overflow: hidden;
}
.stat::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -30px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(225, 18, 42, 0.18), transparent 65%);
}
.stat-kicker { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-2); }
.stat-value { display: block; margin: 10px 0 2px; font-family: var(--display); font-size: 46px; font-weight: 400; letter-spacing: 0.02em; line-height: 0.9; }
.stat-sub { font-size: 11px; color: var(--text-3); }
.stat-spark {
  position: absolute;
  right: 0;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(180deg, transparent, var(--red), transparent);
  opacity: 0.65;
}
.stat-spark.is-gold { background: linear-gradient(180deg, transparent, var(--gold), transparent); }
.stat-spark.is-danger { background: linear-gradient(180deg, transparent, #ff6675, transparent); }

.grid-main { display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.4fr); gap: 18px; align-items: start; }

/* ------------------------------------------------------------------ lists */
.script-list { padding: 0 10px 10px; }
.script-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
}
.script-row:hover { background: rgba(255, 255, 255, 0.025); border-color: var(--line-soft); }
.script-glyph {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 1px solid rgba(225, 42, 60, 0.22);
  background: rgba(225, 42, 60, 0.07);
  color: var(--red-2);
}
.script-glyph svg { width: 17px; height: 17px; }
.script-glyph.big { width: 42px; height: 42px; border-radius: 11px; }
.script-glyph.big svg { width: 20px; height: 20px; }
.script-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.script-info strong { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.script-info .mono { color: var(--text-3); }

/* ----------------------------------------------------------------- tables */
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  padding: 9px 14px;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, 0.012);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-3);
  text-align: left;
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.12s ease; }
.data-table tbody tr:hover { background: rgba(255, 255, 255, 0.022); }
.data-table.compact td { padding: 10px 14px; }
.data-table th:first-child, .data-table td:first-child { padding-left: 22px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 22px; }
.data-table th.right, .data-table td.right { text-align: right; }
.data-table .muted.mono { font-size: 11.5px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge.is-on { color: #8fe3bb; background: rgba(91, 191, 143, 0.09); border-color: rgba(91, 191, 143, 0.25); }
.badge.is-off { color: var(--text-3); background: rgba(255, 255, 255, 0.03); border-color: var(--line); }
.badge.is-warn { color: var(--gold); background: rgba(214, 176, 106, 0.09); border-color: rgba(214, 176, 106, 0.26); }
.badge.is-danger { color: #ff8b96; background: rgba(225, 42, 60, 0.1); border-color: rgba(225, 42, 60, 0.28); }
.badge .dot { width: 5px; height: 5px; }

.pill-quiet {
  display: inline-block;
  max-width: 170px;
  padding: 3px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-2);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.key-cell { display: flex; align-items: center; gap: 6px; }
.keycode {
  display: inline-block;
  max-width: 220px;
  padding: 3px 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text-3);
  font-size: 11.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.keycode.is-revealed { color: var(--gold); border-color: rgba(214, 176, 106, 0.3); }
.key-note { margin-top: 4px; font-size: 10.5px; color: var(--text-3); max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; align-items: center; gap: 5px; justify-content: flex-end; }
.row-actions form { display: inline-flex; margin: 0; }

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}
.field input, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(5, 5, 8, 0.7);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input::placeholder { color: #4c4954; }
.field input:focus, .field select:focus {
  border-color: rgba(225, 42, 60, 0.55);
  box-shadow: 0 0 0 3px rgba(225, 42, 60, 0.12);
}
.field small { font-size: 10.5px; color: var(--text-3); }
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: span 2; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--text-2); }
.check input { margin-top: 2px; accent-color: var(--red); width: 15px; height: 15px; }
.check small { display: block; font-size: 10.5px; color: var(--text-3); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(5, 5, 8, 0.5);
  color: var(--text-3);
}
.search svg { width: 14px; height: 14px; }
.search input { border: none; background: none; outline: none; color: var(--text); font-size: 12px; width: 190px; }
.search input::placeholder { color: #4c4954; }

/* ------------------------------------------------------------------ modal */
dialog.modal { padding: 0; border: none; background: transparent; color: var(--text); max-width: 100vw; }
dialog.modal::backdrop { background: rgba(3, 3, 5, 0.72); backdrop-filter: blur(5px); }
.modal-card {
  width: min(600px, 94vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  border: 1px solid #4a151d;
  border-radius: 18px;
  background: linear-gradient(170deg, #1d0b10, #0a0608);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7), 0 0 60px rgba(225, 18, 42, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
dialog[open] .modal-card { animation: pop 0.18s ease-out both; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.modal-head h2 { margin-top: 3px; font-family: var(--display); font-size: 26px; font-weight: 400; letter-spacing: 0.04em; }
.modal-head .icon-btn { font-size: 20px; line-height: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line-soft); }

/* ------------------------------------------------------------------ alerts */
.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 16px;
  border: 1px solid;
  border-radius: 11px;
  font-size: 12.5px;
  animation: fadeIn 0.2s ease;
}
.alert.is-ok { color: #b9e7d2; background: rgba(91, 191, 143, 0.08); border-color: rgba(91, 191, 143, 0.3); }
.alert.is-error { color: #ffb7be; background: rgba(225, 42, 60, 0.1); border-color: rgba(225, 42, 60, 0.34); }
.alert-close { border: none; background: none; color: inherit; opacity: 0.6; font-size: 17px; line-height: 1; padding: 0 2px; }
.alert-close:hover { opacity: 1; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.toast-wrap { position: fixed; z-index: 200; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  min-width: 220px;
  max-width: 360px;
  padding: 11px 15px;
  border: 1px solid #2e2e3a;
  border-left: 2px solid var(--green);
  border-radius: 10px;
  background: rgba(17, 17, 23, 0.97);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  color: var(--text);
  font-size: 12.5px;
  animation: toastIn 0.2s ease both;
}
.toast.is-error { border-left-color: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------------- dashboard */
.note-card {
  border: 1px dashed #2b2b37;
  border-radius: 12px;
  padding: 15px 18px;
  background: rgba(255, 255, 255, 0.015);
  font-size: 12.5px;
  color: var(--text-2);
}
.note-card strong { display: block; color: var(--text); font-size: 12.5px; margin-bottom: 5px; }
.note-card p { margin: 0; line-height: 1.6; }
.note-card.inset { margin: 4px 22px 22px; }
.inline-code { padding: 1px 6px; border-radius: 5px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line-soft); color: var(--gold); font-size: 11px; }
.quick-body { padding: 0 22px 22px; }

/* ---------------------------------------------------------------- scripts */
.script-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.script-card {
  display: flex;
  flex-direction: column;
  gap: 13px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(170deg, rgba(21, 21, 29, 0.92), rgba(10, 10, 15, 0.95));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
}
.script-card-head { display: flex; align-items: center; gap: 12px; }
.script-title { min-width: 0; flex: 1; }
.script-title h2 { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.script-title .mono { color: var(--text-3); font-size: 11px; }
.script-notes { margin: 0; font-size: 12px; color: var(--text-2); }
.script-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 10.5px; color: var(--text-3); }
.script-meta strong { color: var(--text-2); font-weight: 600; }
.lua-block {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px 9px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.38);
}
.lua-block code { flex: 1; min-width: 0; font-size: 10.5px; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.script-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 3px; }
.script-card-foot form { margin: 0; }
.empty-card { display: grid; place-items: center; min-height: 180px; color: var(--text-3); }

/* ----------------------------------------------------------------- events */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: 0.15s ease;
}
.chip:hover { color: var(--text-2); border-color: #34343f; }
.chip.is-active { color: var(--red-2); border-color: rgba(225, 42, 60, 0.4); background: rgba(225, 42, 60, 0.08); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; border-top: 1px solid var(--line-soft); }
.pager-label { font-size: 11px; color: var(--text-3); }

/* --------------------------------------------------------------- settings */
.settings-form { display: flex; flex-direction: column; gap: 14px; padding: 0 22px 22px; }
.kv { margin: 0; padding: 0 22px 18px; display: flex; flex-direction: column; }
.kv > div { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.kv > div:last-child { border-bottom: none; }
.kv dt { font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.09em; }
.kv dd { margin: 0; font-size: 11.5px; color: var(--text-2); text-align: right; word-break: break-all; }

.error-card { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 60px 24px; text-align: center; }
.error-code { font-family: var(--display); font-size: 72px; font-weight: 800; line-height: 1; color: transparent; -webkit-text-stroke: 1px rgba(225, 42, 60, 0.5); letter-spacing: 0.04em; }
.error-card p { color: var(--text-2); margin: 0 0 6px; }

/* ------------------------------------------------------------------- auth */
.auth-body { background: #050507; }
.auth { position: relative; z-index: 1; min-height: 100vh; display: grid; grid-template-columns: 1.08fr 0.92fr; }
.auth-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px clamp(40px, 7vw, 110px);
  border-right: 1px solid var(--line-soft);
  background:
    radial-gradient(760px 500px at 18% 18%, rgba(225, 18, 42, 0.2), transparent 62%),
    linear-gradient(180deg, rgba(25, 9, 13, 0.7), rgba(5, 4, 6, 0.85));
}
.auth-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(760px 520px at 26% 30%, #000 10%, transparent 72%);
  -webkit-mask-image: radial-gradient(760px 520px at 26% 30%, #000 10%, transparent 72%);
}
.auth-emblem {
  position: absolute;
  right: -4%;
  bottom: -9%;
  font-family: var(--display);
  font-size: min(34vw, 430px);
  font-weight: 800;
  letter-spacing: -0.09em;
  line-height: 0.8;
  color: transparent;
  -webkit-text-stroke: 1px rgba(225, 42, 60, 0.1);
  pointer-events: none;
  user-select: none;
}
.auth-inner { position: relative; max-width: 560px; }
.auth-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
  color: var(--red-2);
  border: 1px solid rgba(225, 18, 42, 0.5);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(225, 18, 42, 0.22), rgba(225, 18, 42, 0.02));
  box-shadow: 0 0 36px rgba(225, 18, 42, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.auth-mark svg { width: 32px; height: 32px; filter: drop-shadow(0 0 10px rgba(225, 18, 42, 0.7)); }
.auth-word { margin: 14px 0 18px; font-family: var(--display); font-size: clamp(64px, 8vw, 118px); font-weight: 400; line-height: 0.88; letter-spacing: 0.025em; }
.auth-word span { color: var(--red); text-shadow: 0 0 54px rgba(225, 18, 42, 0.55); }
.auth-tag { max-width: 470px; margin: 0 0 28px; font-size: 14.5px; line-height: 1.65; color: var(--text-2); }
.auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.auth-points li { position: relative; padding-left: 22px; font-size: 12.5px; color: var(--text-2); }
.auth-points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 6px;
  width: 7px;
  height: 7px;
  background: var(--red);
  transform: rotate(45deg);
  box-shadow: 0 0 12px rgba(225, 42, 60, 0.55);
}
.auth-foot { position: absolute; left: clamp(40px, 7vw, 110px); bottom: 26px; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.auth-card-wrap { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-card {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid #42141c;
  border-radius: 20px;
  background: linear-gradient(170deg, rgba(30, 11, 16, 0.96), rgba(8, 5, 7, 0.98));
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6), 0 0 70px rgba(225, 18, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.auth-card-head h2 { margin: 6px 0 8px; font-family: var(--display); font-size: 34px; font-weight: 400; letter-spacing: 0.04em; }
.auth-card-head p { margin: 0 0 22px; font-size: 12.5px; line-height: 1.6; color: var(--text-3); }
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .field input { padding: 12px 44px 12px 12px; }
.input-with-btn { position: relative; }
.reveal-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-3);
}
.reveal-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.reveal-btn svg { width: 16px; height: 16px; }
.auth-note { display: flex; align-items: center; gap: 8px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 10.5px; color: var(--text-3); }

/* ------------------------------------------------------------- responsive */
@media (max-width: 1240px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main, .script-grid { grid-template-columns: 1fr; }
}
@media (max-width: 980px) {
  .layout { display: block; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--line-soft); }
  .brand { padding: 16px 20px 10px; }
  .nav { flex-direction: row; flex-wrap: wrap; padding: 6px 12px 12px; gap: 4px; }
  .nav-label { display: none; }
  .nav-item.is-active::before { left: 10px; right: 10px; top: auto; bottom: 2px; width: auto; height: 2px; }
  .side-foot { display: none; }
  .topbar { padding: 22px 20px 18px; }
  .content { padding: 20px 20px 48px; }
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-card-wrap { min-height: 100vh; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 14px; }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn { width: 100%; }
  .card-head { flex-direction: column; }
  .card-tools { width: 100%; }
  .search { width: 100%; }
  .search input { width: 100%; }
  .field-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .keycode { max-width: 150px; }
  .auth-card-wrap { padding: 20px; }
  .auth-card { padding: 26px 22px; }
}

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