/* IronGrid by Axis Meridi Technologies — BlackIron Design System */

:root {
  --bi-black: #080A0D;
  --bi-dark: #0D1117;
  --bi-surface: #111820;
  --bi-surface-2: #161E28;
  --bi-border: #1E2D3D;
  --bi-border-b: #2A3F55;
  --bi-iron: #C0C8D0;
  --bi-steel: #7A8A9A;
  --bi-ghost: #3D5060;
  --bi-red: #FF3B30;
  --bi-amber: #FF9500;
  --bi-yellow: #FFD60A;
  --bi-green: #30D158;
  --bi-blue: #0A84FF;
  --bi-accent: #00E5FF;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bi-black);
  color: var(--bi-iron);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a { color: var(--bi-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

button, .btn {
  background: transparent;
  border: 1px solid var(--bi-border-b);
  color: var(--bi-iron);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  padding: 9px 16px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  text-transform: uppercase;
}
button:hover, .btn:hover {
  border-color: var(--bi-accent);
  color: var(--bi-accent);
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.danger { border-color: var(--bi-red); color: var(--bi-red); }
button.danger:hover { background: rgba(255, 59, 48, 0.08); }
button.primary { border-color: var(--bi-accent); color: var(--bi-accent); }

input, textarea, select {
  background: var(--bi-surface);
  border: 1px solid var(--bi-border);
  color: var(--bi-iron);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 12px;
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--bi-accent);
}

.dot-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: radial-gradient(circle, var(--bi-border) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.5;
}
.scan-line {
  position: fixed;
  left: 0;
  right: 0;
  height: 1px;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--bi-accent) 50%, transparent);
  animation: scanMove 5s ease-in-out infinite;
  opacity: 0;
}
@keyframes scanMove {
  0%   { top: -2px; opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
.hex-flicker {
  position: fixed;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--bi-ghost);
  opacity: 0.18;
  z-index: 1;
  pointer-events: none;
}

/* ====== AUTH GATE (login + enroll) ====== */
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  padding: 32px;
}
.auth-header {
  text-align: center;
  margin-bottom: 32px;
  z-index: 2;
}
.auth-header .brand {
  font-size: 11px;
  letter-spacing: 6px;
  color: var(--bi-iron);
  margin-bottom: 8px;
}
.auth-header .title {
  font-size: 16px;
  letter-spacing: 4px;
  color: var(--bi-accent);
  margin-bottom: 6px;
}
.auth-header .subtitle {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--bi-ghost);
}

.cam-wrap {
  position: relative;
  width: 480px;
  height: 480px;
  z-index: 2;
}
.cam-circle {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background: var(--bi-dark);
  border: 1px solid var(--bi-border);
}
.cam-circle video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}
.cam-ring-outer, .cam-ring-inner {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}
.cam-ring-outer {
  inset: -16px;
  border: 1px dashed var(--bi-border-b);
  animation: ringOut 60s linear infinite;
}
.cam-ring-inner {
  inset: 8px;
  border: 1px solid var(--bi-border-b);
  animation: ringIn 45s linear infinite;
}
@keyframes ringOut { to { transform: rotate(360deg); } }
@keyframes ringIn { to { transform: rotate(-360deg); } }

.cam-bracket {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 1px solid var(--bi-accent);
  pointer-events: none;
  transition: transform 0.6s ease;
}
.cam-bracket.tl { top: -8px; left: -8px; border-right: none; border-bottom: none; }
.cam-bracket.tr { top: -8px; right: -8px; border-left: none; border-bottom: none; }
.cam-bracket.bl { bottom: -8px; left: -8px; border-right: none; border-top: none; }
.cam-bracket.br { bottom: -8px; right: -8px; border-left: none; border-top: none; }
.cam-wrap.capturing .cam-bracket.tl { transform: translate(20px, 20px); }
.cam-wrap.capturing .cam-bracket.tr { transform: translate(-20px, 20px); }
.cam-wrap.capturing .cam-bracket.bl { transform: translate(20px, -20px); }
.cam-wrap.capturing .cam-bracket.br { transform: translate(-20px, -20px); }

.cam-scan {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--bi-accent), transparent);
  pointer-events: none;
  opacity: 0;
  top: 0;
}
.cam-wrap.capturing .cam-scan {
  animation: camScan 2.5s ease-in-out infinite;
  opacity: 1;
}
@keyframes camScan {
  0%   { top: 0; opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}

.status-text {
  margin-top: 32px;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--bi-iron);
  min-height: 18px;
  z-index: 2;
}
.status-text.success { color: var(--bi-green); }
.status-text.danger  { color: var(--bi-red); }

.subtitle-text {
  margin-top: 12px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--bi-ghost);
  min-height: 14px;
  z-index: 2;
}

.password-fallback-link {
  margin-top: 24px;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--bi-steel);
  cursor: pointer;
  z-index: 2;
}
.password-fallback-link:hover { color: var(--bi-accent); }

.password-form {
  margin-top: 24px;
  width: 320px;
  display: none;
  z-index: 2;
}
.password-form.show { display: block; }
.password-form input { margin-bottom: 12px; }
.password-form button { width: 100%; }

.flash-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.4s;
}
.flash-overlay.green { background: rgba(48, 209, 88, 0.18); opacity: 1; }
.flash-overlay.red   { background: rgba(255, 59, 48, 0.18); opacity: 1; }

/* ====== DASHBOARD ====== */
.app {
  display: flex;
  height: 100vh;
  position: relative;
  z-index: 2;
}
.sidebar {
  width: 200px;
  background: var(--bi-dark);
  border-right: 1px solid var(--bi-border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
}
.sidebar .logo {
  padding: 0 20px 24px 20px;
  border-bottom: 1px solid var(--bi-border);
}
.sidebar .logo-line-1 {
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--bi-iron);
}
.sidebar .logo-line-2 {
  font-size: 9px;
  letter-spacing: 3px;
  color: var(--bi-ghost);
  margin-top: 4px;
}
.sidebar .nav { padding: 16px 0; }
.sidebar .nav-item {
  display: block;
  padding: 10px 20px;
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--bi-steel);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.sidebar .nav-item:hover { color: var(--bi-iron); }
.sidebar .nav-item.active {
  border-left-color: var(--bi-accent);
  color: var(--bi-accent);
  background: rgba(0, 229, 255, 0.04);
}
.sidebar .divider {
  margin: 16px 20px;
  height: 1px;
  background: var(--bi-border);
}
.sidebar .stat-block { padding: 0 20px; }
.stat-row {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--bi-steel);
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}
.stat-row .label { flex: 1; color: var(--bi-ghost); }
.stat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.stat-dot.green { background: var(--bi-green); box-shadow: 0 0 8px rgba(48, 209, 88, 0.6); }
.stat-dot.red { background: var(--bi-red); box-shadow: 0 0 8px rgba(255, 59, 48, 0.6); }

.sidebar .actions { padding: 16px 20px; margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.sidebar .actions button { width: 100%; }

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bi-black);
  overflow: hidden;
}
.main-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--bi-border);
  display: flex;
  align-items: center;
  background: var(--bi-dark);
}
.main-header .h-title {
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--bi-iron);
  flex: 1;
}
.main-header .h-title .accent { color: var(--bi-accent); }
.main-header .h-actions { display: flex; gap: 8px; }

.feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
}

.threat-card {
  background: var(--bi-dark);
  border: 1px solid var(--bi-border);
  border-left: 3px solid var(--bi-yellow);
  padding: 16px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
  animation: cardIn 0.4s ease backwards;
}
.threat-card:hover { border-color: var(--bi-border-b); transform: translateX(2px); }
.threat-card.severity-suspicious { border-left-color: var(--bi-yellow); }
.threat-card.severity-high_risk  { border-left-color: var(--bi-amber); }
.threat-card.severity-critical   { border-left-color: var(--bi-red); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.threat-card .row-1 {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  gap: 12px;
}
.severity-badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 9px;
  letter-spacing: 2px;
  border: 1px solid;
}
.severity-badge.suspicious { color: var(--bi-yellow); border-color: var(--bi-yellow); }
.severity-badge.high_risk  { color: var(--bi-amber); border-color: var(--bi-amber); }
.severity-badge.critical   { color: var(--bi-red); border-color: var(--bi-red); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; } }

.score {
  font-size: 18px;
  font-weight: 700;
  color: var(--bi-iron);
  margin-left: auto;
}
.score.critical { color: var(--bi-red); animation: pulse 1.4s ease-in-out infinite; }

.threat-card .from {
  color: var(--bi-accent);
  font-size: 12px;
  margin-bottom: 4px;
}
.threat-card .subj {
  color: var(--bi-iron);
  font-size: 12px;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.signal-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.signal-pill {
  font-size: 9px;
  letter-spacing: 1px;
  padding: 2px 6px;
  border: 1px solid var(--bi-border-b);
  color: var(--bi-steel);
}
.osint-status {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--bi-ghost);
}
.osint-status.complete { color: var(--bi-green); }
.osint-status.running { color: var(--bi-amber); }

/* ====== RIGHT PANEL (Subject Intelligence Card) ====== */
.right-panel {
  width: 280px;
  background: var(--bi-dark);
  border-left: 1px solid var(--bi-border);
  overflow-y: auto;
  padding: 20px;
}
.panel-section { margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--bi-border); }
.panel-section:last-child { border-bottom: none; }
.panel-section h4 {
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--bi-accent);
  margin: 0 0 10px 0;
  font-weight: 400;
}
.kv {
  display: grid;
  grid-template-columns: 90px 1fr;
  font-size: 11px;
  margin-bottom: 6px;
  gap: 8px;
}
.kv .k { color: var(--bi-ghost); letter-spacing: 1px; }
.kv .v { color: var(--bi-iron); word-break: break-all; }

.confidence-bar {
  height: 4px;
  background: var(--bi-surface);
  position: relative;
  margin: 6px 0 10px 0;
  border: 1px solid var(--bi-border);
}
.confidence-bar .fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--bi-accent);
  transition: width 0.5s ease;
}

.attribution-text {
  font-size: 11px;
  line-height: 1.7;
  color: var(--bi-iron);
}

.empty-panel {
  font-size: 11px;
  color: var(--bi-ghost);
  text-align: center;
  padding: 40px 0;
  letter-spacing: 2px;
}

/* ====== THREAT DOSSIER PAGE ====== */
.dossier {
  position: relative;
  z-index: 2;
  padding: 32px 48px;
  max-width: 1200px;
  margin: 0 auto;
  height: 100vh;
  overflow-y: auto;
}
.dossier-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--bi-border);
}
.dossier-header .threat-id {
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--bi-ghost);
}
.dossier-header .big-score {
  font-size: 64px;
  font-weight: 300;
  color: var(--bi-accent);
  line-height: 1;
}
.dossier-header .big-score.critical { color: var(--bi-red); animation: pulse 1.4s ease-in-out infinite; }

.section-block {
  background: var(--bi-dark);
  border: 1px solid var(--bi-border);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.section-block h3 {
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--bi-accent);
  margin: 0 0 16px 0;
  font-weight: 400;
}

.signal-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.signal-table th, .signal-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--bi-border);
}
.signal-table th { color: var(--bi-ghost); letter-spacing: 2px; font-weight: 400; font-size: 10px; }

details {
  border: 1px solid var(--bi-border);
  margin-bottom: 8px;
}
summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--bi-iron);
  background: var(--bi-surface);
}
details[open] summary { border-bottom: 1px solid var(--bi-border); }
details .body { padding: 12px 14px; font-size: 11px; color: var(--bi-iron); }

.radar-canvas { width: 360px; height: 360px; display: block; margin: 16px auto; }

textarea.notes { width: 100%; min-height: 100px; resize: vertical; }

.action-bar {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

/* ====== MODAL ====== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 13, 0.85);
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--bi-dark);
  border: 1px solid var(--bi-border-b);
  width: 480px;
  max-width: 90vw;
  max-height: 85vh;
  overflow: auto;
  padding: 24px 28px;
  position: relative;
}
.modal::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--bi-accent), transparent);
}
.modal h3 {
  margin: 0 0 4px 0;
  font-size: 13px;
  letter-spacing: 4px;
  color: var(--bi-accent);
  font-weight: 400;
}
.modal .modal-sub {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--bi-ghost);
  margin-bottom: 20px;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--bi-steel);
  font-size: 14px;
  padding: 4px 8px;
  cursor: pointer;
}
.modal-close:hover { color: var(--bi-red); }

.admin-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  border-top: 1px solid var(--bi-border);
}
.admin-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--bi-border);
  font-size: 11px;
}
.admin-list .uname { color: var(--bi-iron); letter-spacing: 1px; }
.admin-list .meta {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--bi-ghost);
}
.admin-list .badge {
  font-size: 9px;
  letter-spacing: 1px;
  padding: 2px 6px;
  border: 1px solid var(--bi-border-b);
  color: var(--bi-steel);
}
.admin-list .badge.face-on { color: var(--bi-green); border-color: var(--bi-green); }

.add-admin-form { display: grid; gap: 8px; }
.form-error {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--bi-red);
  min-height: 12px;
  margin-top: 6px;
}
