/* ══ REYES CITY RP · Admin Console ═══════════════════════════════════════════
   Pure black and white. Premium, technical, minimal. No colour except a
   single red reserved for destructive and banned states.
     · Borderless · separation via spacing, elevation and shadow.
     · Surfaces sit ON the page (soft lift); controls sit IN it (recessed well). */

:root {
  --void:  #000000;
  --bg:    #000000;
  --s1:    #0B0B0B;
  --s2:    #131313;
  --s3:    #1D1D1D;
  --well:  #050505;
  --s-hi:  rgba(255, 255, 255, 0.05);

  --w-100: #FFFFFF;
  --w-200: #EDEDED;
  --w-300: #C9C9C9;
  --w:     #9E9E9E;
  --w-500: #6E6E6E;
  --w-600: #4A4A4A;
  --w-800: #262626;
  --w-soft: rgba(255, 255, 255, 0.08);
  --metal: linear-gradient(180deg, #FFFFFF 0%, #E6E6E6 52%, #BDBDBD 100%);
  --metal-edge: linear-gradient(180deg, #FFFFFF 0%, #F0F0F0 46%, #D2D2D2 100%);
  /* legacy hook: inline styles written before the palette change */
  --accent: #C9C9C9;

  --text:      #F5F5F5;
  --text-dim:  #8A8A8A;
  --text-faint:#4D4D4D;

  /* monochrome signals; red is kept only for destructive / banned */
  --green:  #FFFFFF;
  --red:    #E04B4B;
  --blue:   #9E9E9E;
  --orange: #C9C9C9;

  --shadow-1: 0 1px 2px rgba(0,0,0,.8), 0 8px 26px rgba(0,0,0,.6);
  --shadow-2: 0 2px 4px rgba(0,0,0,.85), 0 22px 60px rgba(0,0,0,.75);
  --lift: inset 0 1px 0 var(--s-hi);
  --well-in: inset 0 2px 6px rgba(0,0,0,.9), inset 0 1px 1px rgba(0,0,0,1),
             inset 0 -1px 0 rgba(255,255,255,.05);
  --focus-ring: 0 0 0 2px rgba(255,255,255,.45);

  --sidebar-w: 236px;
  --font-display: 'Archivo', system-ui, sans-serif;
  --font-body:    'IBM Plex Sans', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;

  --radius:    16px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
::selection { background: rgba(255,255,255,.3); color: #fff; }

.gold, .ice { color: var(--w-200); }
.mono-label {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--text-faint);
}

.logo-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex-shrink: 0;
  border-radius: 9px;
  background: var(--metal);
  color: #0A0D10;
  font-family: var(--font-display);
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  box-shadow: 0 4px 14px rgba(255,255,255,.2), inset 0 1px 0 rgba(255,255,255,.7);
}

/* ══ Brand mark ════════════════════════════════════════════════════════════
   Two prebuilt assets: logo-mark.png (skyline only) for small marks and
   logo.png (full lockup) for the login card. Their starfield background is
   flattened to pure black so they sit on the UI seamlessly. If a file is
   missing the img hides itself and only the wordmark text remains. */
[hidden] { display: none !important; }

.brand-icon {
  display: inline-flex; align-items: center; flex-shrink: 0;
  width: 46px; height: 38px;
}
.brand-mark { display: block; width: 100%; height: 100%; object-fit: contain; }
.brand-lockup {
  display: block; width: 168px; max-width: 100%;
  height: auto; margin: 0 auto 4px;
}
.sidebar-logo .brand-icon { width: 40px; height: 33px; }

/* ══ Ambient field ═════════════════════════════════════════════════════════ */
.bg-grid {
  position: fixed; inset: -1px; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(ellipse 80% 60% at 60% 0%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 60% 0%, #000, transparent 75%);
}
.bg-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 55% 32% at 55% -8%, rgba(255,255,255,.12), transparent 70%),
    radial-gradient(ellipse 40% 30% at 96% 100%, rgba(255,255,255,.05), transparent 70%);
}

/* ══ Login ═════════════════════════════════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  position: relative; overflow: hidden;
  width: 392px; max-width: 100%;
  background: var(--s1);
  box-shadow: var(--shadow-2), var(--lift);
  border-radius: 20px; padding: 44px 36px 38px;
  text-align: center;
  animation: rise .6s var(--ease) both;
}
.login-card::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 80% 45% at 50% 0%, rgba(255,255,255,.1), transparent 70%);
}
.login-card > * { position: relative; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  margin-bottom: 16px;
}
.login-title {
  font-family: var(--font-display);
  font-size: 26px; font-weight: 700; letter-spacing: -.04em; text-transform: uppercase;
  background: var(--metal);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 22px rgba(255,255,255,.22));
  margin-bottom: 10px;
}
.login-sub {
  font-size: 13px; font-weight: 300; line-height: 1.7;
  color: var(--text-dim); margin-bottom: 26px;
}

/* ══ Layout ════════════════════════════════════════════════════════════════ */
#adminApp { position: relative; z-index: 5; display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: linear-gradient(180deg, #101317 0%, #08090B 100%);
  box-shadow: 12px 0 40px rgba(0,0,0,.5);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 26px 20px 22px;
  font-family: var(--font-display);
  font-size: 12.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
}
.sidebar-nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px; font-weight: 500;
  color: var(--text-dim);
  background: transparent; border: none; cursor: pointer;
  transition: color .2s var(--ease), background .2s var(--ease);
  text-align: left; width: 100%;
}
.nav-item i { width: 15px; text-align: center; font-size: 12.5px; color: var(--text-faint); transition: color .2s var(--ease); }
.nav-item:hover { background: var(--s2); color: var(--text); }
.nav-item:hover i { color: var(--text-dim); }
.nav-item.active {
  background: var(--w-soft); color: var(--w-100);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.nav-item.active i { color: var(--w-200); }
.nav-item.active::after {
  content: ''; position: absolute; right: 12px;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--w-200);
  box-shadow: 0 0 10px rgba(255,255,255,.9);
}

.sidebar-bottom { padding: 14px 14px 20px; }
.admin-user { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.admin-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--s3);
  box-shadow: 0 0 0 2px rgba(255,255,255,.25);
}
.admin-name { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.admin-role {
  font-family: var(--font-mono);
  font-size: 8.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--w-500);
}

.main-content { margin-left: var(--sidebar-w); flex: 1; min-width: 0; min-height: 100vh; }
.content-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 24px clamp(16px, 3vw, 34px) 12px;
  background: linear-gradient(180deg, rgba(7,8,10,.94), rgba(7,8,10,.4) 72%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.page-title {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 700; letter-spacing: -.04em; text-transform: uppercase;
}
.page-breadcrumb {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--text-faint); margin-top: 3px;
}
.header-actions { display: flex; align-items: center; gap: 10px; }
.live-indicator {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 99px;
  background: var(--s1); box-shadow: var(--shadow-1), var(--lift);
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--green);
}
.live-dot {
  width: 5px; height: 5px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 10px rgba(255,255,255,.9);
  animation: pulse-live 1.8s infinite;
}
@keyframes pulse-live { 50% { opacity: .35; } }

.admin-page { padding: 14px clamp(16px, 3vw, 34px) 48px; }
.admin-page.hidden { display: none; }
.admin-page.active { display: block; animation: rise .4s var(--ease) both; }

/* ══ Stat tiles ════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px; margin-bottom: 14px;
}
.stat-tile {
  position: relative; overflow: hidden;
  background: var(--s1);
  box-shadow: var(--shadow-1), var(--lift);
  border-radius: var(--radius); padding: 18px 18px 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
}
.stat-tile::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 100% 0%, rgba(255,255,255,.07), transparent 70%);
}
.stat-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-2), var(--lift); }
.stat-tile > * { position: relative; }
.tile-icon {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 10px; font-size: 13px;
  background: var(--s3); color: var(--text-dim);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}
.tile-icon.online { background: rgba(255,255,255,.10); color: var(--green); }
.tile-icon.gold   { background: var(--w-soft);      color: var(--w-200); }
.tile-icon.blue   { background: rgba(255,255,255,.10);color: var(--blue); }
.tile-icon.red    { background: rgba(224,75,75,.10); color: var(--red); }
.tile-val {
  font-family: var(--font-display);
  font-size: 27px; font-weight: 600; letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.tile-label {
  font-family: var(--font-mono);
  font-size: 8.5px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--text-faint);
}

/* ══ Panels ════════════════════════════════════════════════════════════════ */
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel {
  background: var(--s1);
  box-shadow: var(--shadow-1), var(--lift);
  border-radius: var(--radius); overflow: hidden;
  margin-bottom: 14px;
}
.panel-grid .panel { margin-bottom: 0; }
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 18px 20px 12px;
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--w-500);
}

/* ══ Activity chart ════════════════════════════════════════════════════════ */
.chart-panel { padding-bottom: 6px; }
.chart-wrap { padding: 4px 14px 10px; }
.chart-svg { width: 100%; height: 210px; display: block; overflow: visible; }
.chart-grid-line { stroke: rgba(255,255,255,.05); stroke-width: 1; }
.chart-axis-text {
  font-family: var(--font-mono); font-size: 8.5px;
  letter-spacing: .1em; fill: var(--text-faint);
}
.chart-area-connections { fill: url(#gradConnections); }
.chart-line-connections { stroke: var(--w-200); stroke-width: 2; fill: none;
  stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 2px 8px rgba(255,255,255,.35)); }
.chart-line-joins { stroke: var(--w-500); stroke-width: 1.5; fill: none;
  stroke-dasharray: 3 3; stroke-linejoin: round; }
.chart-dot { fill: var(--w-100); }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-hit:hover + .chart-hover-bar { opacity: 1; }
.chart-hover-bar { fill: rgba(255,255,255,.08); opacity: 0; transition: opacity .12s; }
.chart-legend {
  display: flex; gap: 16px; flex-wrap: wrap;
  padding: 0 20px 16px;
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-faint);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend-key { width: 14px; height: 3px; border-radius: 2px; }
.legend-key.connections { background: var(--metal-edge); }
.legend-key.joins { background: var(--w-500); }
.chart-total { color: var(--w-200); }
.chart-empty {
  padding: 44px 20px; text-align: center;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .2em; text-transform: uppercase; color: var(--text-faint);
}

/* ══ Tables ════════════════════════════════════════════════════════════════ */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  padding: 8px 18px 12px; text-align: left;
  font-family: var(--font-mono);
  font-size: 8.5px; font-weight: 400; letter-spacing: .22em; text-transform: uppercase;
  color: var(--text-faint); white-space: nowrap;
}
.data-table td { padding: 12px 18px; color: var(--text); vertical-align: middle; }
.data-table tbody tr { transition: background .15s var(--ease); }
.data-table tbody tr:nth-child(odd) { background: rgba(255,255,255,.014); }
.data-table tbody tr:hover { background: var(--s2); }
.queue-table-wrap { overflow-x: auto; }

/* connection counter cell */
.conn-cell { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.conn-month {
  font-family: var(--font-mono); font-size: 15px; font-weight: 500; color: var(--w-100);
}
.conn-total {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; color: var(--text-faint);
}

/* ══ Bulk selection ════════════════════════════════════════════════════════ */
.col-check { width: 34px; padding-right: 0 !important; }
.col-check input { accent-color: var(--w-200); width: 15px; height: 15px; cursor: pointer; }

.bulk-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin: 0 14px 10px; padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--w-soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}
.bulk-count {
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-dim);
}
.bulk-count b { color: var(--w-100); font-size: 13px; }

/* ══ Staff groups ══════════════════════════════════════════════════════════ */
.staff-group-name {
  margin-left: 8px;
  font-family: var(--font-display);
  font-size: 13px; font-weight: 600; letter-spacing: .02em;
  color: var(--text); text-transform: none;
}
.staff-group-count {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-faint);
}

/* ══ Badges ════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 8.5px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase;
  white-space: nowrap;
}
.badge-waiting  { background: var(--w-soft);        color: var(--w-200); }
.badge-ready    { background: rgba(255,255,255,.10);   color: var(--green); }
.badge-banned   { background: rgba(224,75,75,.10);   color: var(--red); }
.badge-ok       { background: rgba(255,255,255,.10);  color: var(--blue); }
.badge-neutral  { background: var(--s3);              color: var(--text-dim); }
.badge-critical { background: rgba(224,75,75,.15);   color: var(--red); }
.badge-high     { background: rgba(255,255,255,.14);   color: var(--orange); }
.badge-medium   { background: var(--w-soft);        color: var(--w-200); }
.badge-low      { background: var(--s3);              color: var(--text-dim); }

.user-row { display: flex; align-items: center; gap: 10px; }
.user-row img { width: 30px; height: 30px; border-radius: 50%; background: var(--s3); }
.user-row-name { font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.user-row-id { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-faint); }

/* ══ Event lists ═══════════════════════════════════════════════════════════ */
.event-list, .event-list-full { padding: 4px 12px 14px; }
.event-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 10px; border-radius: var(--radius-sm);
  font-size: 12.5px;
  transition: background .15s var(--ease);
}
.event-item:hover { background: var(--s2); }
.event-icon {
  width: 28px; height: 28px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 11px;
  background: var(--s3); color: var(--text-dim);
}
.event-icon.critical { background: rgba(224,75,75,.14);  color: var(--red); }
.event-icon.high     { background: rgba(255,255,255,.14);  color: var(--orange); }
.event-icon.medium   { background: var(--w-soft);       color: var(--w-200); }
.event-icon.low      { background: var(--s3);             color: var(--text-dim); }
.event-icon.info     { background: rgba(255,255,255,.14); color: var(--blue); }
.event-body { flex: 1; min-width: 0; }
.event-type {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--w-500); margin-bottom: 3px;
}
.event-detail { color: var(--text); overflow-wrap: anywhere; line-height: 1.5; }
.event-meta {
  font-family: var(--font-mono); font-size: 9.5px;
  color: var(--text-faint); margin-top: 4px; overflow-wrap: anywhere;
}
.event-time {
  font-family: var(--font-mono); font-size: 9.5px;
  color: var(--text-faint); white-space: nowrap;
}

.diff-block {
  margin-top: 7px; padding: 9px 11px; border-radius: var(--radius-xs);
  background: var(--well); box-shadow: var(--well-in);
  font-family: var(--font-mono); font-size: 10px; line-height: 1.6;
  overflow-x: auto;
}
.diff-before { color: var(--red); }
.diff-after  { color: var(--green); }

/* ══ Recessed controls ═════════════════════════════════════════════════════
   Inputs are cut INTO the surface: dark well, shadow from the top edge. */
.log-filter-input,
.setting-input,
.note-input,
.search-box,
.select-input {
  background: var(--well);
  border: none;
  color: var(--text);
  box-shadow: var(--well-in);
  transition: box-shadow .2s var(--ease);
}
.log-filter-input:focus,
.setting-input:focus,
.note-input:focus,
.select-input:focus,
.search-box:focus-within { outline: none; box-shadow: var(--well-in), var(--focus-ring); }

.log-filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 2px 20px 14px;
}
.log-filter-input {
  border-radius: var(--radius-sm); padding: 9px 12px;
  font-family: var(--font-mono); font-size: 11.5px; width: 150px;
}
.log-filter-input::placeholder { color: var(--text-faint); }
.log-filter-input::-webkit-calendar-picker-indicator { filter: invert(.75); opacity: .6; cursor: pointer; }

.select-input {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  border-radius: var(--radius-sm); padding: 9px 30px 9px 12px;
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: .08em;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--w-300) 50%),
    linear-gradient(135deg, var(--w-300) 50%, transparent 50%);
  background-position: calc(100% - 16px) 17px, calc(100% - 11px) 17px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.select-input option { background: #12161C; color: var(--text); }

/* ══ Settings ══════════════════════════════════════════════════════════════ */
.settings-grid { display: grid; grid-template-columns: 1fr; max-width: 780px; gap: 4px; }
.settings-form { padding: 4px 20px 20px; display: flex; flex-direction: column; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 0; gap: 20px;
}
.setting-row.full { flex-direction: column; align-items: flex-start; gap: 10px; }
.setting-label { font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.setting-desc { font-size: 12px; font-weight: 300; color: var(--text-dim); margin-top: 3px; line-height: 1.55; }
.setting-control { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.setting-input {
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-family: var(--font-mono); font-size: 13px;
  font-variant-numeric: tabular-nums;
  width: 88px; text-align: center;
}
.setting-input.full { width: 100%; text-align: left; font-family: var(--font-body); font-size: 13px; }
.setting-unit {
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint);
}
.save-msg { color: var(--green); font-size: 11px; font-family: var(--font-mono); letter-spacing: .18em; }

/* ══ Toggle (recessed track, metal knob) ═══════════════════════════════════ */
.toggle { position: relative; width: 44px; height: 24px; cursor: pointer; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; border-radius: 99px;
  background: var(--well); box-shadow: var(--well-in);
  transition: background .25s var(--ease);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--text-faint); top: 4px; left: 4px;
  transition: transform .25s var(--ease), background .25s var(--ease), box-shadow .25s var(--ease);
}
.toggle input:checked + .toggle-slider { background: rgba(255,255,255,.16); }
.toggle input:checked + .toggle-slider::before {
  background: var(--metal); transform: translateX(20px);
  box-shadow: 0 0 12px rgba(255,255,255,.55);
}

/* ══ Buttons ═══════════════════════════════════════════════════════════════ */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border: none; cursor: pointer;
  font-family: var(--font-display);
  font-weight: 600; font-size: 11.5px;
  letter-spacing: .1em; text-transform: uppercase;
  border-radius: var(--radius-sm);
  transition: transform .18s var(--ease), box-shadow .25s var(--ease),
              background .25s var(--ease), color .25s var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn.small { padding: 9px 16px; font-size: 11px; }
.btn.full { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 10px; letter-spacing: .08em; }
.btn-primary {
  background: var(--metal-edge); color: #0A0D10;
  box-shadow: 0 5px 18px rgba(255,255,255,.16), inset 0 1px 0 rgba(255,255,255,.75);
}
.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.55) 48%, transparent 66%);
  transform: translateX(-130%); transition: transform .75s var(--ease);
}
.btn-primary:hover { box-shadow: 0 8px 26px rgba(255,255,255,.26), inset 0 1px 0 rgba(255,255,255,.85); }
.btn-primary:hover::after { transform: translateX(130%); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary:disabled::after { display: none; }
.btn-ghost { background: var(--s2); color: var(--text-dim); box-shadow: var(--lift); }
.btn-ghost:hover { background: var(--s3); color: var(--w-100); }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; }
.btn-danger-ghost { background: rgba(224,75,75,.10); color: var(--red); }
.btn-danger-ghost:hover { background: rgba(224,75,75,.2); }
.btn-danger-ghost:disabled { opacity: .4; cursor: not-allowed; background: rgba(224,75,75,.08); }
.btn-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--s2); color: var(--text-dim);
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  box-shadow: var(--lift);
  transition: color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.btn-icon:hover { color: var(--w-100); background: var(--s3); transform: translateY(-1px); }

.error-msg {
  padding: 12px 14px; background: rgba(224,75,75,.10);
  border-radius: var(--radius-sm); color: var(--red);
  font-family: var(--font-mono); font-size: 11.5px; margin-top: 14px;
}

/* ══ Search / filters ══════════════════════════════════════════════════════ */
.search-box {
  display: flex; align-items: center; gap: 9px;
  border-radius: var(--radius-sm); padding: 9px 13px;
}
.search-box i { color: var(--text-faint); font-size: 11px; }
.search-input {
  background: transparent; border: none; color: var(--text);
  font-family: var(--font-body); font-size: 12.5px; width: 250px;
}
.search-input:focus { outline: none; }
.search-input::placeholder { color: var(--text-faint); }

.filter-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-row.inline { padding: 0; }
.filter-btn {
  padding: 7px 14px; border-radius: var(--radius-xs);
  background: var(--s2); border: none; color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  cursor: pointer; box-shadow: var(--lift);
  transition: color .2s var(--ease), background .2s var(--ease);
}
.filter-btn:hover { color: var(--text); background: var(--s3); }
.filter-btn.active { background: var(--w-soft); color: var(--w-100); }

/* ══ Pagination ════════════════════════════════════════════════════════════ */
.pagination { display: flex; gap: 6px; padding: 4px 20px 18px; flex-wrap: wrap; }
.page-btn {
  min-width: 30px; padding: 7px 11px; border-radius: var(--radius-xs);
  background: var(--s2); border: none; color: var(--text-dim);
  font-family: var(--font-mono); font-size: 11px;
  cursor: pointer; box-shadow: var(--lift);
  transition: color .2s var(--ease), background .2s var(--ease);
}
.page-btn:hover { color: var(--text); background: var(--s3); }
.page-btn.active { background: var(--w-soft); color: var(--w-100); }

/* ══ Modals ════════════════════════════════════════════════════════════════ */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(2,3,4,.8);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.modal-card {
  position: relative; z-index: 201;
  width: 600px; max-width: 100%; max-height: 86vh; overflow-y: auto;
  background: var(--s1);
  box-shadow: var(--shadow-2), var(--lift);
  border-radius: 18px;
  animation: rise .35s var(--ease) both;
}
.modal-header {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  background: linear-gradient(180deg, var(--s1) 70%, rgba(15,17,20,0));
  font-family: var(--font-display);
  font-size: 15px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase;
}
.modal-body { padding: 10px 22px 24px; }
.modal-section { margin-bottom: 22px; }
.modal-section-title {
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--w-500); margin-bottom: 11px;
}
.info-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.info-item {
  background: var(--well); border-radius: var(--radius-sm); padding: 11px 13px;
  box-shadow: var(--well-in);
}
.info-item-label {
  font-family: var(--font-mono);
  font-size: 8.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 5px;
}
.info-item-value { font-size: 12.5px; font-weight: 500; overflow-wrap: anywhere; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 16px; }

.note-input {
  width: 100%; border-radius: var(--radius-sm); padding: 10px 12px;
  font-family: var(--font-body); font-size: 13px; margin-bottom: 8px;
}
.note-input::placeholder { color: var(--text-faint); }
.note-input[type="color"] { padding: 4px; height: 42px; cursor: pointer; }
.note-input::-webkit-calendar-picker-indicator { filter: invert(.75); opacity: .6; cursor: pointer; }
select.note-input {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  padding-right: 32px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--w-300) 50%),
    linear-gradient(135deg, var(--w-300) 50%, transparent 50%);
  background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
select.note-input option { background: #12161C; color: var(--text); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.form-field {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: .2em; text-transform: uppercase;
  color: var(--text-faint);
}
.form-toggles { display: flex; flex-direction: column; gap: 11px; margin-top: 16px; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 13px; cursor: pointer; color: var(--text-dim); }
.check-row input { accent-color: var(--w-300); width: 15px; height: 15px; }

.role-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 7px;
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: .14em; text-transform: uppercase;
  margin: 0 4px 4px 0;
}
.role-chip button { background: none; border: none; color: inherit; cursor: pointer; opacity: .65; font-size: 10px; }
.role-chip button:hover { opacity: 1; }

/* ══ Responsive ════════════════════════════════════════════════════════════ */
@media (max-width: 1040px) { .panel-grid { grid-template-columns: 1fr; } }
@media (max-width: 800px) {
  .sidebar {
    width: 100%; position: sticky; top: 0; bottom: auto; height: auto;
    flex-direction: row; align-items: center;
    box-shadow: 0 12px 30px rgba(0,0,0,.5);
  }
  .sidebar-logo { display: none; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; padding: 10px; }
  .nav-item { white-space: nowrap; width: auto; }
  .nav-item.active::after { display: none; }
  .sidebar-bottom { display: none; }
  #adminApp { flex-direction: column; }
  .main-content { margin-left: 0; }
  .content-header { position: static; }
  .form-grid { grid-template-columns: 1fr; }
  .info-grid-2 { grid-template-columns: 1fr; }
  .search-input { width: 150px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ══ Scrollbar ═════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--s3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--w-800); }
