/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0d1117;
  --surface:      #161b22;
  --surface2:     #21262d;
  --surface3:     #2d333b;
  --border:       #30363d;
  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --accent:       #58a6ff;
  --green:        #3fb950;
  --yellow:       #d29922;
  --orange:       #db6d28;
  --red:          #f85149;
  --purple:       #a371f7;
  --blue:         #58a6ff;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar__brand { display: flex; align-items: center; gap: 12px; }
.topbar__logo  { font-size: 24px; }
.topbar__title { font-size: 16px; font-weight: 600; }
.topbar__badge {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  font-weight: 600;
  margin-left: 8px;
}
.topbar__actions { display: flex; align-items: center; gap: 12px; }
.topbar__hint { color: var(--text-muted); font-size: 12px; }

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Stats Bar ────────────────────────────────────────────────────────────── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 20px 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }

.stat-card__num {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.stat-card__label { font-size: 12px; color: var(--text-muted); margin-top: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.stat-card--yellow { border-color: var(--yellow); }
.stat-card--yellow .stat-card__num { color: var(--yellow); }
.stat-card--red { border-color: var(--red); }
.stat-card--red .stat-card__num { color: var(--red); }
.stat-card--green { border-color: var(--green); }
.stat-card--green .stat-card__num { color: var(--green); }

/* ── Charts Row ───────────────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 16px;
  padding: 0 24px 20px;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  min-height: 240px;
  position: relative;
}
.chart-card canvas { max-height: 200px !important; width: 100% !important; }
.chart-card__title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 16px;
  font-weight: 600;
}

/* ── Trigger Bar ──────────────────────────────────────────────────────────── */
.trigger-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.trigger-bar__label { color: var(--text-muted); font-size: 12px; font-weight: 500; margin-right: 4px; }
.trigger-msg { font-size: 12px; color: var(--green); margin-left: 8px; font-weight: 500; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: #4090e0; }
.btn--ghost { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn--ghost:hover { background: var(--surface3); }

.btn--scenario {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 6px;
  color: #fff;
  border: none;
  cursor: pointer;
  font-weight: 500;
}
.btn--scenario:hover { opacity: 0.85; transform: scale(1.02); }
.btn--red    { background: var(--red); }
.btn--orange { background: var(--orange); }
.btn--purple { background: var(--purple); }
.btn--blue   { background: var(--blue); }
.btn--green  { background: var(--green); }

/* ── Layout ──────────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  padding: 16px 24px;
  min-height: 500px;
}

/* ── Alert List ──────────────────────────────────────────────────────────── */
.alert-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.panel-header__count {
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
}

#alert-items { overflow-y: auto; flex: 1; max-height: 600px; }

.empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Alert Item */
.alert-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.alert-item:hover { background: var(--surface2); }
.alert-item--active { background: var(--surface2); border-left: 3px solid var(--accent); }

.alert-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.alert-item__name { font-weight: 500; font-size: 13px; }
.alert-item__time { font-size: 11px; color: var(--text-muted); }

.alert-item__badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
}
.badge--critical, .badge--CRITICAL { background: rgba(248,81,73,0.2); color: var(--red); }
.badge--high, .badge--HIGH     { background: rgba(219,109,40,0.2); color: var(--orange); }
.badge--medium, .badge--MEDIUM { background: rgba(210,153,34,0.2); color: var(--yellow); }
.badge--low, .badge--LOW, .badge--pending, .badge--PENDING { background: rgba(63,185,80,0.15); color: var(--green); }
.badge--approved, .badge--APPROVED { background: rgba(63,185,80,0.2); color: var(--green); }
.badge--escalated, .badge--ESCALATED { background: rgba(210,153,34,0.2); color: var(--yellow); }
.badge--rejected, .badge--REJECTED { background: rgba(248,81,73,0.2); color: var(--red); }
.badge--reviewed { background: rgba(88,166,255,0.15); color: var(--accent); }

.alert-item__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.alert-item__score {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
/* ── AI Result Card ─────────────────────────────────────────────────────── */
.ai-result-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, var(--surface2), var(--surface3));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 24px;
  margin-bottom: 24px;
}
.ai-result-card__center { flex: 1; }
.ai-result-card__label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 4px; }
.ai-result-card__value { font-size: 28px; font-weight: 800; line-height: 1; }
.ai-result-card__meta { font-size: 11px; color: var(--text-muted); margin-top: 6px; }
.ai-result-card__right { text-align: right; }

/* ── Dimension Grid ────────────────────────────────────────────────────── */
.dimension-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.dimension-card {
  background: var(--surface2);
  border-radius: 12px;
  padding: 14px;
  border: 1px solid var(--border);
}
.dimension-card__header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.dimension-card__name { font-size: 12px; font-weight: 600; color: var(--text); }
.dimension-card__score { font-size: 18px; font-weight: 800; }
.dimension-card__finding {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 0;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  line-height: 1.4;
}

/* ── Findings List ─────────────────────────────────────────────────────── */
.findings-list { display: flex; flex-direction: column; gap: 8px; }
.finding-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface2); border-radius: 10px; border-left: 3px solid var(--orange); }
.finding-item__icon { width: 20px; height: 20px; border-radius: 50%; background: var(--orange); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.finding-item__text { font-size: 13px; line-height: 1.5; }

/* ── Processing Banner ────────────────────────────────────────────────── */
.processing-banner { background: rgba(210,153,34,0.15); border: 1px solid var(--yellow); color: var(--yellow); padding: 10px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 13px; text-align: center; }

/* ── Spinner ──────────────────────────────────────────────────────────── */
.spinner-lg { width: 40px; height: 40px; border: 3px solid var(--surface3); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }


  width: 60px;
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
}
.score-bar__fill { height: 100%; border-radius: 2px; }

/* ── Detail Panel ────────────────────────────────────────────────────────── */
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  color: var(--text-muted);
}
.detail-empty__icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.detail-empty__text { font-size: 14px; }

.detail-content { padding: 20px; overflow-y: auto; max-height: 700px; }
.hidden { display: none !important; }

/* Detail Header */
.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.detail-title { font-size: 18px; font-weight: 600; margin-bottom: 4px; }
.detail-subtitle { color: var(--text-muted); font-size: 12px; }

.risk-gauge {
  text-align: center;
  min-width: 100px;
}
.risk-gauge__score {
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
}
.risk-gauge__label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; }
.risk-gauge--critical .risk-gauge__score { color: var(--red); }
.risk-gauge--high .risk-gauge__score { color: var(--orange); }
.risk-gauge--medium .risk-gauge__score { color: var(--yellow); }
.risk-gauge--low .risk-gauge__score { color: var(--green); }

/* Section */
.detail-section { margin-bottom: 24px; }
.detail-section__title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.detail-section__title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Info Grid */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.info-item { background: var(--surface2); padding: 10px 12px; border-radius: 8px; }
.info-item__label { font-size: 10px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.info-item__value { font-size: 13px; font-weight: 500; }

/* Dimension Bars */
.dimension-item { margin-bottom: 14px; }
.dimension-item__header { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 12px; }
.dimension-item__name { font-weight: 500; }
.dimension-item__score { color: var(--text-muted); }
.dimension-bar {
  height: 8px;
  background: var(--surface3);
  border-radius: 4px;
  overflow: hidden;
}
.dimension-bar__fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

/* Suspicions */
.suspicion-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface2);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  border-left: 3px solid var(--red);
}

/* Compliance Summary */
.compliance-box {
  background: linear-gradient(135deg, rgba(88,166,255,0.1), rgba(163,113,247,0.1));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-size: 13px;
  line-height: 1.7;
}

/* Action Buttons */
.action-buttons { display: flex; gap: 10px; margin-top: 16px; }
.btn--approve { background: var(--green); color: #fff; }
.btn--escalate { background: var(--yellow); color: #000; }
.btn--reject   { background: var(--red); color: #fff; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal__card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 440px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.modal__close { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; }
.modal__close:hover { color: var(--text); }
.modal__body { padding: 20px; }
.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* Form Elements */
.form-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 8px; font-weight: 500; }
.form-textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px;
  font-size: 13px;
  resize: vertical;
  font-family: inherit;
}
.form-textarea:focus { outline: none; border-color: var(--accent); }

.radio-group { display: flex; flex-direction: column; gap: 8px; }
.radio-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.radio-opt:hover { background: var(--surface2); }
.radio-opt input { accent-color: var(--accent); }

.mt-2 { margin-top: 16px; }
