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

:root {
  --bg:       #080E1A;
  --surface:  #0F1A2E;
  --surface2: #162038;
  --border:   #1E2D47;
  --border2:  #243451;
  --blue:     #2A7FE8;
  --blue-dim: #1A5CB8;
  --blue-glow:#2A7FE820;
  --teal:     #0EA98A;
  --coral:    #E05C4A;
  --amber:    #D4A020;
  --text:     #E8EEF8;
  --text2:    #8A9BBF;
  --text3:    #4A5A7A;
  --mono:     'IBM Plex Mono', monospace;
  --sans:     'IBM Plex Sans', sans-serif;
  --r:        8px;
  --r2:       12px;
  --shadow:   0 4px 24px #00000040;
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.6;
}

/* ── Layout ─────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-logo {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .wordmark {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--blue);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.sidebar-logo .subtitle {
  font-size: 11px;
  color: var(--text3);
  margin-top: 3px;
  font-weight: 300;
}

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-section {
  padding: 8px 16px 4px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .1em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text2);
  cursor: pointer;
  transition: all .15s;
  border-left: 2px solid transparent;
  font-size: 13px;
  font-weight: 400;
}

.nav-item:hover { color: var(--text); background: var(--surface2); }
.nav-item.active { color: var(--blue); border-left-color: var(--blue); background: var(--blue-glow); }
.nav-item .icon { font-size: 16px; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-user {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--blue-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  color: white; flex-shrink: 0;
}

.user-info .name { font-size: 13px; font-weight: 500; }
.user-info .pid  { font-size: 11px; color: var(--text3); font-family: var(--mono); }

.logout-btn {
  margin-left: auto;
  background: none; border: none;
  color: var(--text3); cursor: pointer;
  font-size: 16px; padding: 4px;
  transition: color .15s;
}
.logout-btn:hover { color: var(--coral); }

/* ── Main content ───────────────────────────────────────── */
.main { margin-left: 240px; flex: 1; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
}

.page-title { font-size: 16px; font-weight: 600; }
.page-sub   { font-size: 12px; color: var(--text2); margin-top: 1px; }
.topbar-right { display: flex; gap: 10px; align-items: center; }

.content { padding: 28px; }

/* ── Panels / sections ──────────────────────────────────── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  margin-bottom: 20px;
  overflow: hidden;
}

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

.panel-title { font-size: 13px; font-weight: 600; }
.panel-body  { padding: 20px; }

/* ── Stat cards ─────────────────────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r2);
  padding: 16px 18px;
}

.stat-label { font-size: 11px; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.stat-value { font-size: 28px; font-weight: 300; margin-top: 4px; font-family: var(--mono); color: var(--text); }
.stat-sub   { font-size: 11px; color: var(--text2); margin-top: 3px; }
.stat-card.blue  { border-color: #2A7FE840; background: #0D1E3A; }
.stat-card.teal  { border-color: #0EA98A40; background: #081E1A; }
.stat-card.coral { border-color: #E05C4A40; background: #1E0E0A; }
.stat-card.amber { border-color: #D4A02040; background: #1A1508; }

/* ── Table ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--border); }
th { padding: 10px 12px; text-align: left; font-size: 11px; font-weight: 500; color: var(--text3); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 500; font-family: var(--mono);
  white-space: nowrap;
}
.badge-pending  { background: #1A1508; color: #D4A020; border: 1px solid #D4A02040; }
.badge-approved { background: #081E1A; color: #0EA98A; border: 1px solid #0EA98A40; }
.badge-rejected { background: #1E0E0A; color: #E05C4A; border: 1px solid #E05C4A40; }
.badge-reviewed { background: #0D1E3A; color: #2A7FE8; border: 1px solid #2A7FE840; }
.badge-vishing  { background: #1E0E0A; color: #E05C4A; border: 1px solid #E05C4A30; }
.badge-benign   { background: #081E1A; color: #0EA98A; border: 1px solid #0EA98A30; }
.badge-irs      { background: #0D1E3A; color: #6FA8F0; border: 1px solid #6FA8F030; }
.badge-bank     { background: #1A1508; color: #D4A020; border: 1px solid #D4A02030; }
.badge-gray     { background: var(--surface2); color: var(--text2); border: 1px solid var(--border); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--r);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1.5px solid transparent; transition: all .15s;
  font-family: var(--sans);
}
.btn-primary { background: var(--blue); color: white; border-color: var(--blue); }
.btn-primary:hover { background: #1A6DD0; border-color: #1A6DD0; }
.btn-ghost   { background: transparent; color: var(--text2); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--border2); }
.btn-danger  { background: transparent; color: var(--coral); border-color: #E05C4A40; }
.btn-danger:hover { background: #1E0E0A; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-teal { background: var(--teal); color: white; border-color: var(--teal); }
.btn-teal:hover { background: #0A8A70; }

/* ── Forms ─────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
.form-label span { color: var(--coral); }

.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: var(--r); color: var(--text);
  font-family: var(--sans); font-size: 13px;
  transition: border-color .15s;
  outline: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--blue);
}
.form-input[type="file"] { padding: 8px 12px; cursor: pointer; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238A9BBF' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-select option { background: var(--surface); }
.form-textarea { resize: vertical; min-height: 80px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.form-hint { font-size: 11px; color: var(--text3); margin-top: 4px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input[type=checkbox] { accent-color: var(--blue); width: 15px; height: 15px; }
.checkbox-row label { font-size: 13px; color: var(--text2); cursor: pointer; }

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: #000000A0; backdrop-filter: blur(4px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadein .15s ease;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px #00000080;
}
.modal-lg { max-width: 720px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 20px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ── Login page ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 50%, #0D2040 0%, var(--bg) 60%);
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 16px;
  padding: 40px;
  width: 100%; max-width: 400px;
  box-shadow: 0 32px 80px #00000060;
}

.login-logo {
  text-align: center; margin-bottom: 32px;
}

.login-wordmark {
  font-family: var(--mono);
  font-size: 20px; font-weight: 500;
  color: var(--blue); letter-spacing: .14em;
}

.login-tagline {
  font-size: 12px; color: var(--text3); margin-top: 6px; font-weight: 300;
}

.login-error {
  background: #1E0E0A; border: 1px solid #E05C4A40;
  border-radius: var(--r); padding: 10px 14px;
  color: var(--coral); font-size: 13px; margin-bottom: 16px;
}

/* ── Misc ────────────────────────────────────────────────── */
.mono { font-family: var(--mono); }
.text-2 { color: var(--text2); }
.text-3 { color: var(--text3); }
.text-teal { color: var(--teal); }
.text-coral { color: var(--coral); }
.text-blue { color: var(--blue); }
.text-amber { color: var(--amber); }
.hidden { display: none !important; }

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

.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text3);
}
.empty-state .icon { font-size: 36px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

.alert {
  border-radius: var(--r); padding: 12px 16px;
  font-size: 13px; margin-bottom: 16px;
}
.alert-info  { background: #0D1E3A; border: 1px solid #2A7FE840; color: #6FA8F0; }
.alert-warn  { background: #1A1508; border: 1px solid #D4A02040; color: #D4A020; }
.alert-success { background: #081E1A; border: 1px solid #0EA98A40; color: #0EA98A; }

.timestamp-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); padding: 14px;
  margin: 8px 0;
}

.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }

.progress-bar {
  height: 4px; background: var(--surface2);
  border-radius: 2px; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--blue); transition: width .3s; }

.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .6s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.pill-scammer { background: #1E0E0A; color: var(--coral); border: 1px solid #E05C4A30; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-family: var(--mono); }
.pill-victim  { background: #081E1A; color: var(--teal);  border: 1px solid #0EA98A30; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-family: var(--mono); }

.section-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text3); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .08em; margin: 20px 0 16px;
}
.section-divider::before, .section-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── Script card ─────────────────────────────────────────── */
.script-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r2); padding: 18px;
  margin-bottom: 14px;
  transition: border-color .15s;
}
.script-card:hover { border-color: var(--border2); }
.script-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.script-card-title { font-size: 14px; font-weight: 500; }
.script-card-meta  { font-size: 12px; color: var(--text2); margin-top: 4px; }
.script-phase-bar  { display: flex; height: 3px; border-radius: 2px; overflow: hidden; gap: 1px; margin: 10px 0; }
.script-phase-bar span { flex: 1; }
.phase-greeting   { background: var(--teal); }
.phase-setup      { background: var(--amber); }
.phase-escalation { background: #E07A30; }
.phase-harvest    { background: var(--coral); }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}
