/* Page styles for the vulnerability report tool.
 *
 * The navbar and footer come from /static/chrome.css and are NOT redefined here. That
 * file is the single source of truth for them; a copy drifts, and the drift is
 * invisible because each stylesheet stays internally consistent.
 * tests/vulnreport/test_static_ui.py checks this file stays out of chrome's selectors.
 *
 * The palette leans on chrome's own --chrome-* variables so the two render together
 * whichever stylesheet the browser applies last.
 */

:root {
  --vr-ink: #0f172a;
  --vr-ink-soft: #334155;
  --vr-muted: #64748b;
  --vr-border: #e2e8f0;
  --vr-surface: #ffffff;
  --vr-surface-alt: #f8fafc;
  --vr-accent: #1f3864;
  --vr-accent-soft: #2f5597;
  --vr-orange: #e05d26;
  --vr-orange-light: #fff7ed;
  --vr-orange-border: #fed7aa;
  --vr-high: #f4b7b7;
  --vr-mid: #fce4a6;
  --vr-low: #d9e8d2;
  --vr-radius: 12px;
  --vr-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --vr-font: "Noto Sans JP", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--vr-font);
  color: var(--vr-ink);
  background: var(--vr-surface-alt);
  line-height: 1.7;
}

.app-layout { display: flex; flex-direction: column; min-height: 100vh; }
.main-content { flex: 1; padding: 40px 0 64px; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* --- Hero ----------------------------------------------------------------
 *
 * Deliberately the same light band the deck tool draws: white to a pale orange, an
 * orange rule down the left edge, ink-coloured text. It used to be a dark navy
 * gradient with white text, which made moving between the two tools look like moving
 * between two products - the drift the shared chrome exists to prevent - and it put
 * the cost strip on a ground its own colours were not chosen for.
 *
 * The values mirror the deck tool's --slc-orange-* set. They are duplicated rather
 * than shared because the two tools do not share a stylesheet by design (only the
 * chrome does), so this is the one place the band is described for this tool.
 */

.hero-card {
  background: linear-gradient(135deg, var(--vr-surface) 0%, var(--vr-orange-light) 100%);
  border: 1px solid var(--vr-orange-border);
  border-radius: var(--vr-radius);
  padding: 28px 32px;
  margin-bottom: 28px;
  box-shadow: var(--vr-shadow);
  position: relative;
  overflow: hidden;
}

.hero-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: var(--vr-orange);
}

.hero-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--vr-orange);
  margin-bottom: 10px;
}

.hero-heading {
  margin: 0 0 10px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--vr-ink);
}

.hero-desc { margin: 0; font-size: 0.94rem; color: var(--vr-ink-soft); }

/* --- Cards --------------------------------------------------------------- */

.card {
  background: var(--vr-surface);
  border: 1px solid var(--vr-border);
  border-radius: var(--vr-radius);
  box-shadow: var(--vr-shadow);
  padding: 28px;
  margin-bottom: 24px;
}

.card-heading {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--vr-accent);
}

.card-desc { margin: 0 0 20px; font-size: 0.86rem; color: var(--vr-muted); }

/* --- Form ---------------------------------------------------------------- */

.field { margin-bottom: 20px; }
.field-label { display: block; font-size: 0.88rem; font-weight: 700; margin-bottom: 6px; }
.field-hint { margin: 6px 0 0; font-size: 0.79rem; color: var(--vr-muted); }

/* Collapsible "how to get this file" help under a field. */
.field-details { margin: 8px 0 0; font-size: 0.79rem; color: var(--vr-muted); }
.field-details summary { cursor: pointer; color: var(--vr-accent-soft); font-weight: 500; }
.field-details p { margin: 8px 0 4px; }
.code-block {
  margin: 4px 0;
  padding: 8px 10px;
  overflow-x: auto;
  font-size: 0.76rem;
  color: var(--vr-ink);
  background: var(--vr-surface-alt);
  border: 1px solid var(--vr-border);
  border-radius: 6px;
}

.field-input,
.field-textarea,
.field-select {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--vr-ink);
  background: var(--vr-surface);
  border: 1px solid var(--vr-border);
  border-radius: 8px;
}

.field-textarea { min-height: 110px; resize: vertical; line-height: 1.7; }

.field-input:focus,
.field-textarea:focus,
.field-select:focus {
  outline: 2px solid var(--vr-accent-soft);
  outline-offset: 1px;
}

.file-drop {
  border: 1px dashed var(--vr-border);
  border-radius: 8px;
  padding: 14px;
  background: var(--vr-surface-alt);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary { background: var(--vr-orange); color: #fff; }
.btn-primary:hover:not(:disabled) { background: #c94d1b; }
.btn-secondary { background: var(--vr-surface); color: var(--vr-ink-soft); border-color: var(--vr-border); }
.btn-download { background: var(--vr-accent); color: #fff; }
.btn-small { padding: 4px 10px; font-size: 0.8rem; border-radius: 6px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- Upload summary ------------------------------------------------------ */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 0;
}

.summary-grid div { background: var(--vr-surface-alt); border-radius: 8px; padding: 12px 14px; }
.summary-grid dt { font-size: 0.74rem; color: var(--vr-muted); margin: 0 0 4px; }
.summary-grid dd { margin: 0; font-size: 0.95rem; font-weight: 700; word-break: break-all; }

/* --- Notices ------------------------------------------------------------- */

.notice {
  border-radius: 8px;
  padding: 13px 16px;
  font-size: 0.86rem;
  margin-bottom: 14px;
  border: 1px solid transparent;
}

.notice-warn { background: #fff7ed; border-color: #fed7aa; color: #7c2d12; }
.notice-error { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.notice-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a5f; }
.notice ul { margin: 8px 0 0; padding-left: 20px; }

/* --- Progress ----------------------------------------------------------- */

.progress-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--vr-border);
  border-top-color: var(--vr-orange);
  border-radius: 50%;
  animation: vr-spin 0.9s linear infinite;
  flex: none;
}

@keyframes vr-spin { to { transform: rotate(360deg); } }

.progress-title { margin: 0; font-size: 1rem; font-weight: 700; }
.progress-desc { margin: 2px 0 0; font-size: 0.84rem; color: var(--vr-muted); }

.progress-track {
  height: 8px;
  background: var(--vr-border);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-fill {
  height: 100%;
  background: var(--vr-orange);
  border-radius: 9999px;
  transition: width 0.4s ease;
}

.step-pills { display: flex; flex-wrap: wrap; gap: 8px; }

.step-pill {
  font-size: 0.77rem;
  padding: 5px 12px;
  border-radius: 9999px;
  background: var(--vr-surface-alt);
  color: var(--vr-muted);
  border: 1px solid var(--vr-border);
}

.step-pill.is-active { background: var(--vr-accent); color: #fff; border-color: var(--vr-accent); }
.step-pill.is-done { background: var(--vr-low); color: #14532d; border-color: #bbdfa8; }

.progress-note { margin: 16px 0 0; font-size: 0.8rem; color: var(--vr-muted); }

/* --- Result ------------------------------------------------------------- */

.result-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }

.result-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--vr-low);
  color: #14532d;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex: none;
}

.result-title { margin: 0; font-size: 1.1rem; font-weight: 700; }
.result-subtitle { margin: 2px 0 0; font-size: 0.85rem; color: var(--vr-muted); }

.stage-counts { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }

.stage-chip {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--vr-border);
  background: var(--vr-surface-alt);
}

.stage-chip[data-stage="2"] { background: var(--vr-high); border-color: #e79c9c; }
.stage-chip[data-stage="3"] { background: var(--vr-mid); border-color: #e8c983; }
.stage-chip[data-stage="4"] { background: var(--vr-low); border-color: #bbdfa8; }

/* --- History table ------------------------------------------------------ */

.table-wrap { overflow-x: auto; }

.history-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }

.history-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--vr-accent);
  color: #fff;
  font-weight: 700;
  white-space: nowrap;
}

.history-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--vr-border);
  vertical-align: top;
}

.history-table tbody tr:nth-child(even) { background: var(--vr-surface-alt); }

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.status-COMPLETED { background: var(--vr-low); color: #14532d; }
.status-FAILED { background: var(--vr-high); color: #7f1d1d; }
.status-PROCESSING,
.status-QUEUED { background: var(--vr-mid); color: #78350f; }

.empty-state { padding: 40px 0; text-align: center; color: var(--vr-muted); }

.hidden { display: none !important; }

@media (max-width: 640px) {
  .card { padding: 20px; }
  .hero-card { padding: 24px; }
}

/* A second line under a history cell: the format the log was read as. */
.cell-sub { display: block; margin-top: 2px; font-size: 0.74rem; color: var(--vr-muted); }

/* --- Manual candidates panel -------------------------------------------- */

.manual-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}

.manual-panel-head h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--vr-accent);
}

.manual-panel-desc {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--vr-ink-soft);
}

.manual-summary {
  margin-bottom: 14px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--vr-ink-soft);
}

.manual-panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 20px;
}

.manual-limit-warn {
  color: #b91c1c;
  font-size: 0.84rem;
  font-weight: 600;
}

.manual-cost-note {
  font-size: 0.84rem;
  color: var(--vr-muted);
}

.manual-candidates th:first-child,
.manual-candidates td:first-child {
  text-align: center;
  width: 44px;
}

/* --- Manual workbook links callout -------------------------------------- */

.manual-workbook-links-box {
  background: var(--vr-surface-alt);
  border: 1px solid var(--vr-border);
  border-left: 4px solid var(--vr-accent-soft);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.manual-workbook-links-content {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.manual-workbook-links-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--vr-ink);
}

.manual-workbook-links-note {
  margin-top: 6px;
  font-size: 0.79rem;
  color: var(--vr-muted);
}
