:root {
  --bg: #0f1724;
  --bg-soft: #162033;
  --panel: #1b2a40;
  --line: rgba(255, 255, 255, 0.08);
  --text: #eef4ff;
  --muted: #9fb0c8;
  --accent: #3ee0b2;
  --accent-2: #f4b942;
  --danger: #ff6b6b;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(62, 224, 178, 0.12), transparent 24%),
    linear-gradient(180deg, #101a2a 0%, #0c1420 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.topbar,
.panel,
.stat-card,
.flash {
  background: rgba(22, 32, 51, 0.86);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  margin-bottom: 20px;
}

.eyebrow,
.model-tag,
.muted,
.hint,
.subhead,
.stat-card span,
.empty-state span {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
}

h1,
h2,
h3,
h4 {
  margin: 0;
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2.3rem);
}

.subhead {
  margin: 8px 0 0;
}

.status-pills,
.result-meta,
.flash-stack,
.stats-grid,
.agent-grid,
.workspace {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.pill,
.badge,
.chip,
.primary-btn {
  border-radius: 999px;
}

.pill,
.badge,
.chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.pill.ok,
.chip.ok {
  color: var(--accent);
  border-color: rgba(62, 224, 178, 0.3);
}

.pill.warn,
.chip.warn {
  color: var(--accent-2);
  border-color: rgba(244, 185, 66, 0.35);
}

.chip.danger {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.35);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 20px;
}

.stat-card,
.panel,
.agent-card,
.result-card,
.empty-state {
  padding: 22px;
}

.stat-card strong {
  display: block;
  margin-top: 10px;
  font-size: 1.5rem;
}

.workspace {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 20px;
  margin-bottom: 20px;
}

.panel {
  margin-bottom: 20px;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head p,
.safe-note,
.description {
  margin: 8px 0 0;
  color: var(--muted);
}

.form-row {
  margin-bottom: 14px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

select,
textarea,
input[type="file"] {
  width: 100%;
  color: var(--text);
  background: #101826;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
}

.dropzone {
  position: relative;
  min-height: 180px;
  margin: 8px 0 16px;
  border: 1px dashed rgba(62, 224, 178, 0.4);
  border-radius: 18px;
  background: rgba(16, 24, 38, 0.8);
  overflow: hidden;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-copy {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 42px 20px;
  text-align: center;
}

.dropzone.dragging,
.dropzone.has-preview {
  border-color: var(--accent);
}

.live-preview,
.result-image {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  display: block;
}

.live-preview {
  position: absolute;
  inset: 0;
}

.hidden {
  display: none !important;
}

.primary-btn {
  width: 100%;
  border: 0;
  cursor: pointer;
  background: linear-gradient(90deg, #2ee0b1, #63d6ff);
  color: #082017;
  font-weight: 700;
  padding: 14px 18px;
}

.primary-btn:disabled {
  opacity: 0.7;
  cursor: wait;
}

.hint {
  font-size: 13px;
  margin-top: 12px;
}

.result-card,
.empty-state {
  border-radius: 18px;
  border: 1px solid var(--line);
}

.threat-none,
.empty-state {
  background: rgba(62, 224, 178, 0.08);
}

.threat-low,
.threat-moderate {
  background: rgba(244, 185, 66, 0.1);
}

.threat-high,
.threat-critical,
.threat-error,
.flash.error {
  background: rgba(255, 107, 107, 0.12);
}

.result-card h3 {
  margin-top: 14px;
  line-height: 1.45;
}

.result-card h4 {
  margin-top: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.agent-card {
  background: #101826;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
  color: var(--accent);
  margin: 0 0 8px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 22, 0.72);
  display: grid;
  place-items: center;
  text-align: center;
  z-index: 20;
}

.spinner {
  width: 46px;
  height: 46px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .topbar,
  .workspace,
  .stats-grid,
  .agent-grid {
    grid-template-columns: 1fr;
    display: grid;
  }

  .status-pills {
    display: flex;
  }
}
