/* ═══════════════════════════════════════════════════════════════════════════
   R.E.D.A.C.T. COMMAND DASHBOARD — Main Stylesheet
   Tactical Operations Center aesthetic
   Dark/Light mode | Mobile-first | Command presence
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@400;500;600;700&family=Share+Tech+Mono&family=Barlow:wght@300;400;500;600;700&family=Barlow+Condensed:wght@400;500;600;700&display=swap');

/* ── THEME TOKENS ──────────────────────────────────────────────────────────── */

:root {
  /* Dark mode (default) */
  --bg-base:      #080B0F;
  --bg-surface:   #0E1318;
  --bg-raised:    #141B22;
  --bg-overlay:   #1A232D;
  --bg-hover:     #1F2A35;

  --border:       rgba(200,16,46,0.12);
  --border-dim:   rgba(255,255,255,0.04);
  --border-bright:rgba(200,16,46,0.35);

  --red:          #C8102E;
  --red-dark:     #8B0B1F;
  --red-glow:     rgba(200,16,46,0.25);
  --red-text:     #E8294A;

  --amber:        #D4900A;
  --amber-text:   #F0A824;
  --amber-glow:   rgba(212,144,10,0.2);

  --green:        #0D7A3E;
  --green-text:   #1DB954;
  --green-glow:   rgba(13,122,62,0.2);

  --blue:         #1565C0;
  --blue-text:    #4DA3FF;

  --gold:         #B8952A;
  --gold-text:    #D4AF37;
  --gold-glow:    rgba(212,175,55,0.2);

  --text-primary: #E2E8F0;
  --text-secondary:#8FA3B8;
  --text-muted:   #4A6072;
  --text-dim:     #2A3A4A;

  --scan-color:   rgba(200,16,46,0.03);
  --grid-color:   rgba(255,255,255,0.025);
  --noise-opacity:0.025;

  --font-display: 'Rajdhani', sans-serif;
  --font-body:    'Barlow', sans-serif;
  --font-ui:      'Barlow Condensed', sans-serif;
  --font-mono:    'Share Tech Mono', monospace;

  --radius-sm:    3px;
  --radius:       5px;
  --radius-lg:    8px;

  --shadow-sm:    0 1px 3px rgba(0,0,0,0.4);
  --shadow:       0 4px 16px rgba(0,0,0,0.5);
  --shadow-red:   0 0 20px rgba(200,16,46,0.15);
  --shadow-glow:  0 0 40px rgba(200,16,46,0.08);

  --transition:   0.18s ease;
  --nav-h:        68px;
}

/* ── LIGHT MODE ──────────────────────────────────────────────────────────── */

[data-theme="light"] {
  --bg-base:      #F0F2F5;
  --bg-surface:   #FAFBFC;
  --bg-raised:    #FFFFFF;
  --bg-overlay:   #F5F7FA;
  --bg-hover:     #EDF0F4;

  --border:       rgba(200,16,46,0.15);
  --border-dim:   rgba(0,0,0,0.07);
  --border-bright:rgba(200,16,46,0.4);

  --red-glow:     rgba(200,16,46,0.08);
  --amber-glow:   rgba(212,144,10,0.1);
  --green-glow:   rgba(13,122,62,0.1);
  --gold-glow:    rgba(212,175,55,0.1);

  --text-primary: #0E1318;
  --text-secondary:#3A4A5C;
  --text-muted:   #6B7F94;
  --text-dim:     #9AAAB8;

  --scan-color:   rgba(200,16,46,0.015);
  --grid-color:   rgba(0,0,0,0.03);
  --noise-opacity:0.015;

  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08);
  --shadow:       0 4px 16px rgba(0,0,0,0.10);
  --shadow-red:   0 0 20px rgba(200,16,46,0.08);
  --shadow-glow:  0 0 40px rgba(200,16,46,0.04);
}

/* ── RESET ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  transition: background var(--transition), color var(--transition);
}

/* ── SCANLINE + GRID BACKGROUND ─────────────────────────────────────────── */

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      var(--scan-color) 2px,
      var(--scan-color) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 40px,
      var(--grid-color) 40px,
      var(--grid-color) 41px
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 40px,
      var(--grid-color) 40px,
      var(--grid-color) 41px
    );
}

/* ── TYPOGRAPHY ──────────────────────────────────────────────────────────── */

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
.mono, code, pre { font-family: var(--font-mono); }
a { color: var(--red-text); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--text-primary); }

/* ── NAVBAR ──────────────────────────────────────────────────────────────── */

.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-red);
  backdrop-filter: blur(12px);
}

/* Red accent bar top */
.navbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--red) 0%, var(--red-dark) 60%, transparent 100%);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-right: 28px;
}

.nav-sigil {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--red-glow);
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--red-text);
  flex-shrink: 0;
}

.nav-id {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-callsign {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  color: var(--red-text);
  letter-spacing: 0.12em;
  line-height: 1;
}

.nav-unit {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
}

/* Divider */
.nav-div {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 20px;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  transition: all var(--transition);
  border: 1px solid transparent;
  position: relative;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
  border-color: var(--border-dim);
}

.nav-link.active {
  color: var(--red-text);
  background: var(--red-glow);
  border-color: var(--border);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -7px; left: 50%;
  transform: translateX(-50%);
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--red);
}

.nav-link-icon { font-size: 12px; opacity: 0.7; }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-left: 16px;
}

/* Theme toggle */
.theme-toggle {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--border-bright); color: var(--text-primary); background: var(--bg-hover); }

/* User chip */
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-raised);
}

.nav-avatar {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  background: var(--red-glow);
  border: 1px solid var(--border-bright);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--red-text);
  font-weight: 600;
  flex-shrink: 0;
}

.nav-user-info { display: flex; flex-direction: column; gap: 1px; }

.nav-displayname {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.04em;
  line-height: 1;
}

.nav-clearance {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1;
}

.nav-logout {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  padding: 3px 7px;
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  margin-left: 4px;
  transition: all var(--transition);
}
.nav-logout:hover { border-color: var(--red); color: var(--red-text); background: var(--red-glow); }

/* Mobile hamburger */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 4px;
  width: 32px; height: 32px;
  align-items: center; justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  margin-left: auto;
}
.nav-hamburger span {
  display: block;
  width: 16px; height: 1.5px;
  background: var(--text-muted);
  transition: all var(--transition);
}

/* Mobile menu */
.mobile-menu {
  display: none;
  position: fixed;
  top: var(--nav-h); left: 0; right: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  padding: 12px;
  z-index: 190;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}
.mobile-menu.open { display: flex; }
.mobile-menu .nav-link { width: 100%; }

/* ── LAYOUT ──────────────────────────────────────────────────────────────── */

.main-content {
  flex: 1;
  position: relative;
  z-index: 1;
  max-width: 2400px;
  margin: 0 auto;
  width: 100%;
  padding: 40px 48px;
}

.main-content.full-width { max-width: 100%; padding: 0; }

/* ── PAGE HEADER ─────────────────────────────────────────────────────────── */

.page-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header-left {}

.page-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--red-text);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-eyebrow::before {
  content: '';
  display: inline-block;
  width: 16px; height: 1px;
  background: var(--red);
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 4vw, 30px);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.page-subtitle {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

.page-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── SITREP TICKER ───────────────────────────────────────────────────────── */

.sitrep-bar {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.sitrep-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--red-text);
  text-transform: uppercase;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding-right: 12px;
}

.sitrep-content {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── STAT CARDS ──────────────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  padding: 20px 18px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: var(--border);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* Corner bracket decoration */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 12px; height: 12px;
  border-top: 2px solid var(--red);
  border-left: 2px solid var(--red);
  border-radius: 2px 0 0 0;
}

.stat-card::after {
  content: '';
  position: absolute;
  bottom: 0; right: 0;
  width: 12px; height: 12px;
  border-bottom: 2px solid var(--border);
  border-right: 2px solid var(--border);
}

.stat-card.alert::after { border-color: var(--red); }
.stat-card.ok::after { border-color: var(--green); }

.stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card.alert .stat-value { color: var(--red-text); }
.stat-card.ok .stat-value { color: var(--green-text); }
.stat-card.warn .stat-value { color: var(--amber-text); }

.stat-delta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* ── CARD ────────────────────────────────────────────────────────────────── */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition);
}

.card:hover { border-color: var(--border); }

/* Top accent line */
.card-accent {
  height: 2px;
  background: linear-gradient(90deg, var(--red) 0%, transparent 100%);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-dim);
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border-dim);
  border-radius: 2px;
  padding: 2px 6px;
}

.card-body { padding: 20px; }

/* ── TABLE ───────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead { position: sticky; top: 0; z-index: 1; }

th {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-dim);
  vertical-align: middle;
  transition: background var(--transition);
}

tr:last-child td { border-bottom: none; }

tr:hover td { background: var(--bg-hover); }

.td-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── BADGES ──────────────────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 2px;
  font-weight: 400;
  white-space: nowrap;
}

.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

.badge-pending  { background: var(--amber-glow); color: var(--amber-text); border: 1px solid rgba(212,144,10,0.3); }
.badge-pending::before { background: var(--amber-text); }
.badge-approved { background: var(--green-glow); color: var(--green-text); border: 1px solid rgba(13,122,62,0.3); }
.badge-approved::before { background: var(--green-text); }
.badge-denied   { background: var(--red-glow); color: var(--red-text); border: 1px solid rgba(200,16,46,0.3); }
.badge-denied::before { background: var(--red-text); }
.badge-open     { background: rgba(77,163,255,0.1); color: var(--blue-text); border: 1px solid rgba(77,163,255,0.25); }
.badge-open::before { background: var(--blue-text); }
.badge-closed   { background: var(--bg-overlay); color: var(--text-muted); border: 1px solid var(--border-dim); }
.badge-closed::before { background: var(--text-muted); }
.badge-active   { background: var(--green-glow); color: var(--green-text); border: 1px solid rgba(13,122,62,0.3); }
.badge-active::before { background: var(--green-text); animation: pulse 2s infinite; }
.badge-loa      { background: var(--amber-glow); color: var(--amber-text); border: 1px solid rgba(212,144,10,0.3); }
.badge-loa::before { background: var(--amber-text); }
.badge-discharged{ background: var(--bg-overlay); color: var(--text-muted); border: 1px solid var(--border-dim); }
.badge-discharged::before { background: var(--text-muted); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--red);
  color: #fff;
  border-color: var(--red-dark);
  box-shadow: 0 2px 8px var(--red-glow);
}
.btn-primary:hover { background: var(--red-dark); box-shadow: 0 4px 16px var(--red-glow); color: #fff; }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-bright); }

.btn-success {
  background: var(--green-glow);
  color: var(--green-text);
  border-color: rgba(13,122,62,0.3);
}
.btn-success:hover { background: rgba(13,122,62,0.3); }

.btn-danger {
  background: var(--red-glow);
  color: var(--red-text);
  border-color: rgba(200,16,46,0.3);
}
.btn-danger:hover { background: rgba(200,16,46,0.3); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm { padding: 5px 12px; font-size: 11px; }
.btn-lg { padding: 11px 24px; font-size: 14px; }
.btn-full { width: 100%; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ── FORMS ───────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 18px; }

.form-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.form-label-required { color: var(--red-text); }

.form-control {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  transition: all var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--red);
  background: var(--bg-overlay);
  box-shadow: 0 0 0 3px var(--red-glow);
}

.form-control::placeholder { color: var(--text-dim); }
textarea.form-control { resize: vertical; min-height: 90px; line-height: 1.6; }
select.form-control { cursor: pointer; }

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--border-dim);
  flex-wrap: wrap;
}

/* ── TABS ────────────────────────────────────────────────────────────────── */

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-dim);
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
}

.tab:hover { color: var(--text-primary); text-decoration: none; }
.tab.active { color: var(--red-text); border-bottom-color: var(--red); }

.tab-count {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-raised);
  color: var(--text-muted);
  border: 1px solid var(--border-dim);
  border-radius: 2px;
  padding: 1px 5px;
}

.tab.active .tab-count {
  background: var(--red-glow);
  color: var(--red-text);
  border-color: rgba(200,16,46,0.3);
}

/* ── DETAIL GRID ─────────────────────────────────────────────────────────── */

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1px;
  background: var(--border-dim);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}

.detail-item {
  background: var(--bg-surface);
  padding: 14px 18px;
}

.detail-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.detail-value {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

/* ── ALERT BANNERS ───────────────────────────────────────────────────────── */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
  border-left: 3px solid;
}

.alert-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--green-glow); border-color: var(--green); color: var(--green-text); }
.alert-warning { background: var(--amber-glow); border-color: var(--amber); color: var(--amber-text); }
.alert-danger  { background: var(--red-glow); border-color: var(--red); color: var(--red-text); }
.alert-info    { background: rgba(77,163,255,0.1); border-color: var(--blue); color: var(--blue-text); }

/* ── TIMELINE / SERVICE RECORD ───────────────────────────────────────────── */

.timeline { position: relative; padding-left: 20px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 5px; top: 4px; bottom: 4px;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 18px 16px;
  font-size: 13px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -3px; top: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--bg-raised);
  border: 1px solid var(--border-bright);
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-event {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--red-text);
  margin-bottom: 2px;
}

.timeline-detail { color: var(--text-secondary); margin-bottom: 2px; }

.timeline-ts {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* ── SEARCH / FILTER BAR ─────────────────────────────────────────────────── */

.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar .form-control { max-width: 260px; }

.filter-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ── EMPTY STATE ─────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 36px;
  opacity: 0.3;
  margin-bottom: 16px;
}

.empty-state-title {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.empty-state-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── DIVIDER ─────────────────────────────────────────────────────────────── */

.divider {
  border: none;
  border-top: 1px solid var(--border-dim);
  margin: 24px 0;
}

/* ── CLASSIFICATION STAMP ────────────────────────────────────────────────── */

.classification {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 2px;
  border: 1px solid;
}
.cls-unclass { color: var(--green-text); border-color: rgba(13,122,62,0.4); background: var(--green-glow); }
.cls-fouo    { color: var(--amber-text); border-color: rgba(212,144,10,0.4); background: var(--amber-glow); }
.cls-unit    { color: var(--red-text);   border-color: rgba(200,16,46,0.4);  background: var(--red-glow); }

/* ── OUTCOME ─────────────────────────────────────────────────────────────── */

.outcome-pass    { color: var(--green-text); }
.outcome-partial { color: var(--amber-text); }
.outcome-fail    { color: var(--red-text); }

/* ── FOOTER ──────────────────────────────────────────────────────────────── */

.footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--border-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  flex-wrap: wrap;
  gap: 10px;
}

.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-muted); letter-spacing: 0.08em; }
.footer-links a:hover { color: var(--red-text); }

.footer-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--green-text);
}
.footer-status::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green-text);
  animation: pulse 2s infinite;
}

/* ── LOGIN PAGE ──────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  position: relative;
}

/* Diagonal accent */
.login-page::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    linear-gradient(135deg, rgba(200,16,46,0.04) 0%, transparent 50%),
    linear-gradient(315deg, rgba(200,16,46,0.02) 0%, transparent 50%);
  pointer-events: none;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-glow), var(--shadow);
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.login-sigil {
  width: 60px; height: 60px;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  background: var(--red-glow);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--red-text);
  margin: 0 auto 20px;
}

.login-title {
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 0.2em;
  color: var(--red-text);
  text-align: center;
  margin-bottom: 4px;
}

.login-subtitle {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 28px;
}

.discord-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #5865F2;
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: 100%;
  transition: all var(--transition);
  border: 1px solid rgba(255,255,255,0.1);
}
.discord-btn:hover { background: #4752C4; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(88,101,242,0.4); color: #fff; text-decoration: none; }

.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.login-divider::before, .login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-dim);
}

.login-restriction {
  background: var(--bg-raised);
  border: 1px solid var(--border-dim);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.8;
  letter-spacing: 0.04em;
}

.login-restriction strong {
  color: var(--red-text);
  font-weight: 400;
}

.login-legal {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-dim);
  text-align: center;
  margin-top: 20px;
  line-height: 1.8;
  letter-spacing: 0.04em;
}

/* ── LEGAL PAGES ─────────────────────────────────────────────────────────── */

.legal-page {
  max-width: 780px;
  margin: 40px auto;
  padding: 0 20px 80px;
  position: relative;
  z-index: 1;
}

.legal-header {
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-dim);
}

.legal-header h1 {
  font-size: clamp(22px, 4vw, 28px);
  margin-bottom: 12px;
}

.legal-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 2;
  letter-spacing: 0.04em;
}

.legal-meta span { display: block; }

.legal-body section { margin-bottom: 32px; }

.legal-body h2 {
  font-family: var(--font-display);
  font-size: 16px;
  color: var(--red-text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

.legal-body h2::before {
  content: '§';
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

.legal-body p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.legal-body ul {
  padding-left: 20px;
  margin-bottom: 14px;
}

.legal-body li {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-secondary);
  margin-bottom: 3px;
  position: relative;
}

.legal-body li::marker { color: var(--red-text); }

.legal-nav {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
  font-family: var(--font-mono);
  font-size: 11px;
  flex-wrap: wrap;
}

/* ── MOBILE RESPONSIVE ───────────────────────────────────────────────────── */

@media (max-width: 768px) {
  :root { --nav-h: 52px; }

  .nav-links, .nav-div, .nav-user { display: none; }
  .nav-hamburger { display: flex; }
  .nav-actions { margin-left: 0; }
  .theme-toggle { margin-left: auto; }

  .main-content { padding: 20px 14px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-value { font-size: 28px; }

  .detail-grid { grid-template-columns: repeat(2, 1fr); }

  .page-header { flex-direction: column; gap: 12px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }

  .filter-bar { gap: 8px; }
  .filter-bar .form-control { max-width: 100%; flex: 1; }

  .form-row { grid-template-columns: 1fr; }

  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }

  .card-header { flex-direction: column; align-items: flex-start; }

  .footer { flex-direction: column; text-align: center; gap: 8px; }

  table { font-size: 12px; }
  th, td { padding: 10px 12px; }

  /* Stack table on mobile for key views */
  .table-mobile-stack thead { display: none; }
  .table-mobile-stack tr {
    display: block;
    border: 1px solid var(--border-dim);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 12px;
    background: var(--bg-surface);
  }
  .table-mobile-stack td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border: none;
    border-bottom: 1px solid var(--border-dim);
    font-size: 12px;
  }
  .table-mobile-stack td:last-child { border-bottom: none; padding-bottom: 0; }
  .table-mobile-stack td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .login-card { padding: 28px 20px; }

  .legal-page { padding: 0 14px 60px; }
}

@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}

/* ── UTILITY ─────────────────────────────────────────────────────────────── */

.text-red    { color: var(--red-text); }
.text-green  { color: var(--green-text); }
.text-amber  { color: var(--amber-text); }
.text-blue   { color: var(--blue-text); }
.text-gold   { color: var(--gold-text); }
.text-muted  { color: var(--text-muted); }
.text-mono   { font-family: var(--font-mono); }
.text-upper  { text-transform: uppercase; letter-spacing: 0.08em; }
.text-right  { text-align: right; }
.text-center { text-align: center; }

.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8       { gap: 8px; }
.gap-12      { gap: 12px; }
.gap-16      { gap: 16px; }
.flex-wrap   { flex-wrap: wrap; }
.flex-1      { flex: 1; }

.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }

.w-full { width: 100%; }

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hidden { display: none !important; }

/* ── ANIMATIONS ──────────────────────────────────────────────────────────── */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.animate-in { animation: fadeIn 0.3s ease forwards; }

.stagger-1 { animation-delay: 0.05s; opacity: 0; }
.stagger-2 { animation-delay: 0.1s;  opacity: 0; }
.stagger-3 { animation-delay: 0.15s; opacity: 0; }
.stagger-4 { animation-delay: 0.2s;  opacity: 0; }

/* ── SCROLLBAR ───────────────────────────────────────────────────────────── */

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--red); }

/* ── SELECTION ───────────────────────────────────────────────────────────── */

::selection { background: var(--red-glow); color: var(--red-text); }

/* ── WATERMARK ──────────────────────────────────────────────────────────────── */
.main-content::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 480px;
  height: 480px;
  background-image: url('/static/logo.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] .main-content::before {
  opacity: 0.035;
}

.main-content > * {
  position: relative;
  z-index: 1;
}

/* ── NAV LOGO + DISCORD AVATAR ─────────────────────────────────────────────── */
.nav-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(200,16,46,0.4));
  transition: filter 0.2s;
}
.nav-logo:hover {
  filter: drop-shadow(0 0 10px rgba(200,16,46,0.7));
}
.nav-avatar-img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-bright);
  background: var(--bg-overlay);
}

/* ── 4K / LARGE DISPLAY SCALING ────────────────────────────────────────────── */
@media (min-width: 2560px) {
  :root {
    --nav-h: 80px;
    font-size: 18px;
  }
  .main-content {
    padding: 56px 80px;
  }
  .navbar {
    padding: 0 64px;
  }
  .nav-logo {
    width: 64px;
    height: 64px;
  }
  .nav-avatar-img {
    width: 52px;
    height: 52px;
  }
  .nav-avatar {
    width: 52px;
    height: 52px;
    font-size: 18px;
  }
  .nav-callsign {
    font-size: 18px;
  }
  .nav-unit {
    font-size: 12px;
  }
  .nav-link {
    font-size: 14px;
    padding: 8px 16px;
  }
  .page-title {
    font-size: 42px;
  }
  .page-eyebrow {
    font-size: 12px;
  }
  .page-subtitle {
    font-size: 15px;
  }
  .stat-value {
    font-size: 52px;
  }
  .stat-label {
    font-size: 11px;
  }
  .card {
    border-radius: 10px;
  }
  .btn {
    font-size: 13px;
    padding: 10px 20px;
  }
  .btn-sm {
    font-size: 11px;
    padding: 7px 14px;
  }
  table {
    font-size: 14px;
  }
  th {
    font-size: 10px;
    padding: 12px 16px;
  }
  td {
    padding: 14px 16px;
  }
  .form-control {
    font-size: 14px;
    padding: 10px 14px;
  }
  .sitrep-bar {
    font-size: 13px;
    padding: 10px 20px;
  }
  .stats-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
  .main-content::before {
    width: 700px;
    height: 700px;
  }
  .badge {
    font-size: 11px;
    padding: 4px 10px;
  }
  .nav-displayname {
    font-size: 14px;
  }
  .nav-clearance {
    font-size: 10px;
  }
  .footer {
    font-size: 12px;
    padding: 14px 48px;
  }
}

@media (min-width: 3200px) {
  :root { --nav-h: 88px; }
  .main-content { padding: 64px 120px; }
  .navbar { padding: 0 100px; }
  .nav-logo { width: 72px; height: 72px; }
  .page-title { font-size: 52px; }
  .stat-value { font-size: 64px; }
  .main-content::before { width: 900px; height: 900px; }
}
