/* Visual language borrowed from strack.safetruck.co's public login page:
   navy #285099, light-blue accent #c2ddf0, white->light-blue gradient,
   Poppins, pill-shaped controls, soft-shadow cards. Not a clone of any
   authenticated page - this is a purpose-built review tool. */

:root {
  --navy: #285099;
  --navy-dark: #1c3b73;
  --blue-light: #c2ddf0;
  --blue-pale: #eef6fc;
  --ink: #1f2a3c;
  --muted: #6b7a90;
  --line: #e1e9f2;
  --white: #ffffff;
  --agree: #2f9e6a;
  --agree-bg: #e6f6ee;
  --disagree: #d6493a;
  --disagree-bg: #fdeceb;
  --flag: #b5650a;
  --flag-bg: #fdf1e0;
  --local: #6b46c1;
  --local-bg: #f1ecfc;
  --radius: 14px;
  --radius-pill: 999px;
  --shadow: 0 8px 24px rgba(40, 80, 153, 0.10);
  font-family: "Poppins", "Roboto", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: linear-gradient(180deg, #ffffff 0%, var(--blue-pale) 60%, var(--blue-light) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Poppins", "Roboto", sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button, select { font-family: inherit; }

/* ---- hero header ----
   Layout borrowed from strack.safetruck.co's public login page (gradient
   ground, two-column split, a white card on the right) - not its assets:
   the wordmark below is text, the illustration is an original icon we drew,
   and the certification badges + truck illustration are deliberately not
   reproduced (trademarks of unrelated organizations / a licensed graphic
   asset - reusing them here would misleadingly imply endorsement). */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 22px 32px;
  background: linear-gradient(135deg, #ffffff 0%, var(--blue-pale) 55%, var(--blue-light) 130%);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.hero-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex: 1 1 380px;
  min-width: 260px;
}

.brand { display: flex; align-items: center; gap: 8px; }
.brand-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--navy), var(--blue-light));
  box-shadow: 0 0 0 4px var(--blue-pale);
}
.brand-name {
  font-size: 17px;
  font-weight: 400;
  color: var(--navy);
  letter-spacing: 0.2px;
}
.brand-name strong { font-weight: 700; }

.hero-tagline {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 220px;
  line-height: 1.4;
}

.hero-art { width: 128px; height: auto; flex-shrink: 0; }

.hero-card {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px 16px;
}

.select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 8px 34px 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--navy);
  background: var(--white) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6"><path d="M0 0l5 6 5-6z" fill="%23285099"/></svg>') no-repeat right 14px center;
  cursor: pointer;
}
.select:focus { outline: 2px solid var(--blue-light); }

.segmented {
  display: flex;
  background: var(--blue-pale);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.seg-btn:hover { color: var(--navy); }
.seg-btn.active {
  background: var(--navy);
  color: var(--white);
}

/* ---- summary bar ---- */
.summary-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 24px;
  font-size: 12.5px;
  color: var(--muted);
  flex: 0 0 auto;
}
.summary-bar strong { color: var(--ink); }
.summary-bar .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); opacity: 0.5; }
.summary-bar .agree-text { color: var(--agree); font-weight: 600; }
.summary-bar .disagree-text { color: var(--disagree); font-weight: 600; }
.summary-bar .muted { color: var(--muted); }

/* ---- layout ---- */
.layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  padding: 0 24px 24px;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
}

.alert-list {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-y: auto;
  height: 100%;
  min-height: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.alert-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, border-color 0.12s;
}
.alert-card:hover { background: var(--blue-pale); }
.alert-card.selected {
  background: var(--blue-pale);
  border-color: var(--blue-light);
}
.alert-card .thumb {
  width: 52px; height: 52px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--blue-pale);
  flex-shrink: 0;
}
.alert-card-body { flex: 1; min-width: 0; }
.alert-card-time { font-size: 12px; font-weight: 500; color: var(--ink); }
.badge-row { display: flex; gap: 4px; margin-top: 4px; flex-wrap: wrap; }
.badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.badge-human { background: var(--blue-pale); color: var(--navy); }
.badge-tp { background: var(--agree-bg); color: var(--agree); }
.badge-fp { background: #f1f3f7; color: var(--muted); }
.badge-violation { background: var(--flag-bg); color: var(--flag); }
.badge-no-violation { background: #f1f3f7; color: var(--muted); }
.badge-local { background: var(--local-bg); color: var(--local); }
.pred-tp-text { color: var(--flag); font-weight: 600; }
.verdict-icon { font-size: 15px; flex-shrink: 0; }
.alert-card.is-disagree .verdict-icon { color: var(--disagree); }
.alert-card:not(.is-disagree) .verdict-icon { color: var(--agree); }

/* ---- detail panel ---- */
.detail {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

.empty-state, .error {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 60px 20px;
}
.error { color: var(--disagree); }

.verdict-banner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.verdict-banner.verdict-agree { background: var(--agree-bg); }
.verdict-banner.verdict-disagree { background: var(--disagree-bg); }
.verdict-side { text-align: center; }
.verdict-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 4px; }
.verdict-value { font-size: 18px; font-weight: 700; color: var(--ink); }
.verdict-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.verdict-vs {
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.verdict-agree .verdict-vs { background: var(--agree); color: var(--white); }
.verdict-disagree .verdict-vs { background: var(--disagree); color: var(--white); }

/* unreview mode - single direct statement, no human-review comparison */
.verdict-banner.verdict-solo {
  grid-template-columns: 1fr;
  text-align: center;
}
.verdict-solo.verdict-flag { background: var(--flag-bg); }
.verdict-solo.verdict-clear { background: var(--blue-pale); }
.verdict-solo .verdict-value { font-size: 22px; }
.verdict-flag .verdict-value { color: var(--flag); }

.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}

.frames {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.frame {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--blue-pale);
}
.frame img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--blue-pale);
}
.frame figcaption { padding: 10px 12px 12px; }
.frame-position {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--navy);
}
.frame-prob { float: right; font-size: 11px; color: var(--muted); }
.prob-bar {
  margin-top: 6px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--line);
  overflow: hidden;
}
.prob-bar-fill { height: 100%; background: var(--navy); }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; height: auto; }
  .alert-list { height: 320px; }
  .frames { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .hero-card { width: 100%; justify-content: center; }
}

/* ---- model report ---- */
.report-layout {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 24px 24px;
  overflow-y: auto;
}
.report-panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}
.report-generated { font-size: 12px; color: var(--muted); margin: 0 0 16px; }
.report-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-table th, .report-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.report-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.report-table tbody tr:hover { background: var(--blue-pale); }
.report-cat { font-weight: 600; color: var(--ink); }
.report-metric-cell { font-variant-numeric: tabular-nums; }
.report-metric-cell .sub { color: var(--muted); font-size: 11px; }
.report-note { font-size: 12px; color: var(--muted); max-width: 260px; white-space: normal; }
.report-retrain { white-space: normal; min-width: 140px; }
.retrain-btn {
  border: none;
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--white);
  background: var(--navy);
  white-space: nowrap;
}
.retrain-btn:disabled { opacity: 0.55; cursor: default; }
.retrain-note { font-size: 11px; color: var(--muted); margin-top: 4px; max-width: 160px; }

/* ---- scenario x violation heatmap ---- */
.heatmap-section { margin-top: 18px; }
.heatmap-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.heatmap-section-head h2 {
  margin: 0;
  font-size: 15px;
  color: var(--navy);
}
.heatmap-section-head span { font-size: 12px; color: var(--muted); }
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}
.heatmap-card {
  background: linear-gradient(180deg, var(--heat), #ffffff 86%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 154px;
}
.heatmap-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.heatmap-category {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.heatmap-rate {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.heatmap-bars {
  height: 7px;
  background: rgba(255,255,255,0.72);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin: 10px 0;
}
.heatmap-bars span {
  display: block;
  height: 100%;
  background: rgba(31,42,60,0.45);
}
.heatmap-stats, .heatmap-model {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  font-size: 11px;
  color: var(--ink);
}
.heatmap-model {
  margin-top: 8px;
  color: var(--muted);
}
.heatmap-run {
  margin-top: 8px;
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---- submitting a human review from the Unreviewed detail panel ---- */
.badge-submitted { background: var(--agree-bg); color: var(--agree); }
.review-submit {
  margin-top: 24px;
  padding: 16px 18px;
  background: var(--blue-pale);
  border-radius: var(--radius);
}
.review-submit-label { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.review-remark-input {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--white);
  margin-bottom: 10px;
}
.review-remark-input:focus { outline: 2px solid var(--blue-light); }
.review-submit-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.review-btn {
  border: none;
  border-radius: var(--radius-pill);
  padding: 9px 18px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--white);
}
.review-btn:disabled { opacity: 0.6; cursor: default; }
.review-btn-tp { background: var(--agree); }
.review-btn-fp { background: var(--muted); }
.review-submit-status { margin-top: 10px; font-size: 12px; color: var(--muted); min-height: 1.2em; }
.review-submit-status.ok { color: var(--agree); font-weight: 600; }
.review-submit-status.error { color: var(--disagree); font-weight: 600; }

.summary-bar > span { line-height: 1.6; }
.metric-note { color: #855600; background: #fff4d9; border-radius: 6px; padding: 3px 8px; }
.split-tag { font-size: 10px; color: var(--muted); margin-left: 4px; }
.review-remark { font-size: 13px; line-height: 1.5; }
.video-evidence { margin-top: 20px; }
.video-evidence video { max-width: 100%; max-height: 480px; margin-top: 12px; }

/* ---- camera-cover alert: evidence frame mostly blocked (lens covered) ---- */
.badge-cover { background: var(--disagree-bg); color: var(--disagree); }
.cover-alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  margin-bottom: 14px;
  border: 1px solid var(--disagree);
  border-radius: var(--radius);
  background: var(--disagree-bg);
  font-size: 13px;
  line-height: 1.45;
}
.cover-alert-icon { font-size: 18px; line-height: 1.2; flex-shrink: 0; }
.cover-alert-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.frame-covered { border-color: var(--disagree); }
.frame-cover { display: block; margin-top: 6px; font-size: 11px; font-weight: 700; color: var(--disagree); }
[hidden] { display: none !important; }

/* Demo only: status badges in the Model Report table of gcp_demo/app.js. */
.report-badge {
  display: inline-block; font-size: 10.5px; font-weight: 700; padding: 2px 8px;
  border-radius: var(--radius-pill); text-transform: uppercase; letter-spacing: 0.03em;
}
.report-badge.trustworthy { background: var(--agree-bg); color: var(--agree); }
.report-badge.limited { background: var(--flag-bg); color: var(--flag); }
.report-badge.legacy { background: #f1f3f7; color: var(--muted); }
.report-badge.blocked { background: var(--disagree-bg); color: var(--disagree); }
