@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --red:      #e02020;
  --red2:     #b01010;
  --red-dim:  #1a0000;
  --bg:       #0a0000;
  --bg2:      #110000;
  --bg3:      #1a0505;
  --border:   #3a0a0a;
  --border2:  #550f0f;
  --text:     #f5e0e0;
  --muted:    #a07070;
  --dim:      #5a2020;
  --green:    #16a34a;
  --green-dim:#052e16;
}

body {
  background: var(--bg);
  font-family: 'IBM Plex Sans', sans-serif;
  color: var(--text);
  min-height: 100vh;
}

/* ── Nav ── */
nav {
  background: var(--bg2);
  border-bottom: 1px solid var(--border2);
  padding: 0 24px;
  height: 50px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.nav-brand {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 2px;
  color: var(--red);
  margin-right: 20px;
  text-decoration: none;
}
.nav-link {
  padding: 0 14px;
  height: 50px;
  display: flex;
  align-items: center;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all .15s;
  letter-spacing: .5px;
  text-decoration: none;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.nav-link:hover { color: var(--text); }
.nav-link.active { color: var(--red); border-bottom-color: var(--red); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-user {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}

/* ── Page ── */
.page { max-width: 960px; margin: 0 auto; padding: 28px 20px; }
.page-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 28px;
  letter-spacing: 2px;
  color: var(--red);
  margin-bottom: 4px;
}
.page-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 22px;
  letter-spacing: 1px;
}

/* ── Login ── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 32px;
  width: 100%;
  max-width: 360px;
}
.login-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  letter-spacing: 3px;
  color: var(--red);
  text-align: center;
  margin-bottom: 4px;
}
.login-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 2px;
  margin-bottom: 24px;
}

/* ── Form fields ── */
.field { margin-bottom: 12px; }
.field label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}
.field input,
.field select {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 9px 11px;
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.field input:focus,
.field select:focus { border-color: var(--red); }
.field select option { background: var(--bg3); }
.field input::placeholder { color: var(--dim); }

/* ── Buttons ── */
.btn {
  width: 100%;
  padding: 12px;
  background: var(--red);
  border: none;
  border-radius: 4px;
  color: #fff;
  font-family: 'Bebas Neue', sans-serif;
  font-size: 18px;
  letter-spacing: 2px;
  cursor: pointer;
  transition: background .2s;
}
.btn:hover { background: var(--red2); }
.btn:disabled { background: var(--border2); color: var(--dim); cursor: not-allowed; }

.btn-sm {
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 4px 10px;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: all .15s;
  width: auto;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn-sm:hover { border-color: var(--red); color: var(--red); }

.btn-red {
  background: var(--red);
  border: none;
  border-radius: 4px;
  padding: 6px 13px;
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  cursor: pointer;
  transition: background .15s;
  width: auto;
  letter-spacing: .5px;
  text-decoration: none;
  display: inline-block;
}
.btn-red:hover { background: var(--red2); }

.btn-del {
  background: transparent;
  border: 1px solid var(--red2);
  border-radius: 4px;
  padding: 4px 9px;
  color: var(--red);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: all .15s;
  width: auto;
}
.btn-del:hover { background: var(--red-dim); }

/* ── Drop zone ── */
.drop {
  border: 2px dashed var(--border2);
  border-radius: 6px;
  padding: 38px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg2);
  margin-bottom: 16px;
}
.drop:hover, .drop.over { border-color: var(--red); background: var(--red-dim); }
.drop input { display: none; }
.drop-icon { font-size: 32px; display: block; margin-bottom: 8px; opacity: .5; }
.drop-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 2px;
  margin-bottom: 3px;
}
.drop-sub { font-family: 'IBM Plex Mono', monospace; font-size: 10px; color: var(--muted); }

.file-row {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.file-name {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--red);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fields-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

/* ── Progress ── */
.prog-wrap {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 18px;
  margin-top: 14px;
}
.prog-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}
.prog-bar {
  height: 4px;
  background: var(--bg3);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}
.prog-fill {
  height: 100%;
  background: var(--red);
  border-radius: 2px;
  transition: width .5s ease;
}
.prog-step {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.spin {
  width: 10px;
  height: 10px;
  border: 2px solid var(--border2);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Result card ── */
.result-card {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 14px;
  margin-bottom: 14px;
}
.rc-hdr {
  padding: 12px 16px;
  background: var(--red-dim);
  border-bottom: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.rc-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 15px;
  letter-spacing: 1px;
  color: var(--red);
}
.rc-body {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
}

/* ── Stat cards ── */
.stat {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
}
.stat-lbl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 3px;
}
.stat-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px;
  font-weight: 500;
  color: var(--red);
}
.stat-pct { font-size: 10px; color: var(--dim); margin-top: 1px; }

/* ── Error / Success ── */
.error {
  background: var(--red-dim);
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 12px 14px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--red);
  line-height: 1.7;
  margin-top: 14px;
}
.success {
  background: var(--green-dim);
  border: 1px solid var(--green);
  border-radius: 4px;
  padding: 8px 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--green);
  margin-bottom: 12px;
}

/* ── Table ── */
.tbl-wrap {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  overflow: hidden;
  overflow-x: auto;
  margin-bottom: 16px;
}
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  background: var(--bg3);
  padding: 8px 12px;
  text-align: left;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border2);
}
td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }

/* ── Notice ── */
.notice {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--dim);
  text-align: center;
  line-height: 1.7;
  margin-top: 20px;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border2);
  margin-bottom: 20px;
}
.tab {
  padding: 8px 18px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .15s;
}
.tab.active { color: var(--red); border-bottom-color: var(--red); }

/* ── Form box ── */
.form-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 18px;
  max-width: 420px;
  margin-top: 16px;
}
.form-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

/* ── Badges ── */
.badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid;
}
.badge-admin { border-color: var(--red); color: var(--red); background: var(--red-dim); }
.badge-analyst { border-color: var(--border2); color: var(--muted); }

/* ── Flex helpers ── */
.flex-gap { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Landing hero ── */
.hero {
  padding: 60px 20px 40px;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}
.hero-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 56px;
  letter-spacing: 4px;
  color: var(--red);
  line-height: 1;
  margin-bottom: 6px;
}
.hero-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 3px;
  margin-bottom: 32px;
}
.hero-desc {
  font-size: 15px;
  color: var(--text);
  opacity: .8;
  line-height: 1.7;
  margin-bottom: 32px;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.stat-big {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 6px;
  padding: 18px 16px;
  text-align: center;
}
.stat-big-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 28px;
  font-weight: 500;
  color: var(--red);
  margin-bottom: 4px;
}
.stat-big-lbl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--red);
  text-align: center;
  margin-bottom: 20px;
}

.viz-placeholder {
  background: var(--bg2);
  border: 1px dashed var(--border2);
  border-radius: 8px;
  padding: 48px 20px;
  text-align: center;
  max-width: 960px;
  margin: 0 auto 40px;
}
.viz-placeholder-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--dim);
  margin-bottom: 8px;
}
.viz-placeholder-sub {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--dim);
  letter-spacing: 1px;
}

/* ── Checkbox ── */
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.check-row input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--red);
  cursor: pointer;
}
.check-row label {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

/* ── Admin totals grid ── */
.totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  .fields-row { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 36px; }
}
/* ── Light theme overrides ── */
[data-theme="light"] {
  --red:      #c01010;
  --red2:     #900a0a;
  --red-dim:  #fde8e8;
  --bg:       #f5f5f5;
  --bg2:      #ffffff;
  --bg3:      #f0f0f0;
  --border:   #ddd;
  --border2:  #f0a0a0;
  --text:     #1a0000;
  --muted:    #7a4040;
  --dim:      #b08080;
  --green:    #16a34a;
  --green-dim:#dcfce7;
}

/* Theme toggle button */
.theme-toggle {
  background: transparent;
  border: 1px solid var(--border2);
  border-radius: 4px;
  padding: 4px 10px;
  color: var(--muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.theme-toggle:hover { border-color: var(--red); color: var(--red); }