/* forensic upload UI — vanilla CSS, no framework */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2d3148;
  --accent: #4f8ef7;
  --accent-hover: #3a7ae4;
  --text: #e2e8f0;
  --muted: #8892a4;
  --pass: #22c55e;
  --reject: #ef4444;
  --escalate: #f59e0b;
  --conditional: #a78bfa;
  --pending: #64748b;
  --radius: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 2rem 1rem;
}

#app { max-width: 720px; margin: 0 auto; }

header { text-align: center; margin-bottom: 2rem; }
header h1 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; }
header .subtitle { color: var(--muted); margin-top: 0.4rem; font-size: 0.9rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }

/* Drop zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(79,142,247,0.05);
}
.drop-zone:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.drop-zone p { color: var(--muted); }
.drop-zone p.hint { font-size: 0.8rem; margin-top: 0.25rem; }

/* Form */
.form-row { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.4rem; }
.form-row label { font-size: 0.85rem; color: var(--muted); }
input[type="text"], input[type="password"] {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  width: 100%;
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }

/* File list */
.file-list { margin-top: 1rem; }
.file-list h3 { font-size: 0.9rem; color: var(--muted); margin-bottom: 0.5rem; }
#file-items { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.file-item {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}
.file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .file-size { color: var(--muted); white-space: nowrap; }
.file-item .doc-type-badge { padding: 0.15rem 0.4rem; border-radius: 4px; font-size: 0.75rem; background: var(--border); }
.file-item select {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; color: var(--text); font-size: 0.75rem; padding: 0.1rem 0.25rem;
}
.file-item .format-hint {
  font-size: 0.72rem; color: var(--muted); white-space: nowrap; flex-shrink: 0;
}
.file-item .format-hint.format-error { color: var(--reject); font-weight: 600; }
.file-item.has-error { border-color: var(--reject); }

/* Action row */
#action-row { margin-top: 1rem; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

button {
  border: none; border-radius: var(--radius);
  cursor: pointer; font-size: 0.9rem; padding: 0.55rem 1.1rem;
  transition: background 0.15s, opacity 0.15s;
}
button.primary { background: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); }
button.secondary { background: var(--border); color: var(--text); }
button.secondary:hover:not(:disabled) { background: #3d4163; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
button.ghost:hover { color: var(--text); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Spinner */
.spinner {
  display: flex; align-items: center; gap: 0.75rem;
  margin-top: 1rem; color: var(--muted); font-size: 0.9rem;
}
.spin-ring {
  width: 20px; height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Verdict banner */
.verdict-banner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; border-radius: var(--radius);
  margin-bottom: 1rem; font-weight: 700; font-size: 1.1rem;
}
.verdict-banner.pass { background: rgba(34,197,94,0.15); border: 1px solid var(--pass); color: var(--pass); }
.verdict-banner.reject { background: rgba(239,68,68,0.15); border: 1px solid var(--reject); color: var(--reject); }
.verdict-banner.escalate { background: rgba(245,158,11,0.15); border: 1px solid var(--escalate); color: var(--escalate); }
.verdict-banner.conditional { background: rgba(167,139,250,0.15); border: 1px solid var(--conditional); color: var(--conditional); }
.verdict-banner.pending { background: rgba(100,116,139,0.15); border: 1px solid var(--pending); color: var(--pending); }

.result-row {
  display: flex; gap: 0.5rem; margin-bottom: 0.5rem;
  font-size: 0.88rem; flex-wrap: wrap;
}
.result-row .label { color: var(--muted); min-width: 180px; }

/* Verdict reasons */
.verdict-reasons {
  margin-top: 1rem; padding: 0.9rem 1rem;
  background: var(--bg); border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
}
.verdict-reasons h3 {
  font-size: 0.78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin-bottom: 0.4rem; font-weight: 600;
}
.verdict-explanation {
  font-size: 0.92rem; line-height: 1.45;
}

/* Findings list */
.findings-section { margin-top: 1rem; }
.findings-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.6rem;
}
.findings-header h3 {
  font-size: 0.78rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600;
}
button.small { padding: 0.3rem 0.7rem; font-size: 0.78rem; }

.findings-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.finding-item {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.65rem 0.85rem;
  border-left: 3px solid var(--border);
}
.finding-item.sev-critical { border-left-color: var(--reject); }
.finding-item.sev-high     { border-left-color: var(--escalate); }
.finding-item.sev-medium   { border-left-color: var(--conditional); }
.finding-item.sev-low      { border-left-color: var(--pending); }
.finding-item.sev-info     { border-left-color: var(--muted); }

.finding-row {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  margin-bottom: 0.3rem;
}
.finding-sev {
  font-size: 0.68rem; font-weight: 700;
  padding: 0.1rem 0.45rem; border-radius: 3px;
  letter-spacing: 0.04em;
}
.finding-sev.sev-critical { background: rgba(239,68,68,0.18); color: var(--reject); }
.finding-sev.sev-high     { background: rgba(245,158,11,0.18); color: var(--escalate); }
.finding-sev.sev-medium   { background: rgba(167,139,250,0.18); color: var(--conditional); }
.finding-sev.sev-low      { background: rgba(100,116,139,0.18); color: var(--pending); }
.finding-sev.sev-info     { background: rgba(136,146,164,0.15); color: var(--muted); }

.finding-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem; color: var(--muted);
}
.finding-source {
  font-size: 0.72rem; color: var(--muted);
  margin-left: auto;
  padding: 0.1rem 0.4rem;
  background: var(--surface); border-radius: 3px;
}
.finding-summary {
  font-size: 0.88rem; line-height: 1.4; color: var(--text);
}
.finding-evidence {
  margin-top: 0.35rem;
  font-size: 0.78rem; color: var(--muted);
  font-style: italic;
  border-left: 2px solid var(--border);
  padding-left: 0.55rem;
  line-height: 1.4;
  word-break: break-word;
}

#result-actions {
  margin-top: 1.2rem;
  display: flex; gap: 0.5rem; flex-wrap: wrap;
}
#result-panel button { margin-right: 0; }

/* Error banner */
.error-banner {
  background: rgba(239,68,68,0.1); border: 1px solid var(--reject);
  border-radius: var(--radius); padding: 1rem;
  color: var(--reject); margin-top: 0.75rem;
}
.error-banner p { color: var(--text); margin-top: 0.25rem; font-size: 0.88rem; }

.error { color: var(--reject); font-size: 0.85rem; margin-top: 0.4rem; }

/* Token panel */
#token-panel h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }
#token-panel p { color: var(--muted); font-size: 0.88rem; margin-bottom: 0.75rem; }
#token-save-btn { margin-top: 0.75rem; }
