:root {
  --page-bg: #eef0f3;
  --surface: #ffffff;
  --surface-alt: #f6f7f9;
  --surface-tint: #eef2fb;

  --border: #e3e6ea;
  --border-strong: #cfd4db;

  --ink: #0f1522;
  --text: #333a47;
  --text-muted: #6b7280;
  --text-faint: #9aa1ac;

  --primary: #2a5cdb;
  --primary-dark: #1f45ad;
  --primary-tint: #eaf0fd;

  --green: #1a8a4a;
  --green-dark: #146b39;
  --green-tint: #e9f7ee;

  --red: #d13438;
  --red-dark: #a92225;
  --red-tint: #fceceb;

  --amber: #b6790a;
  --blue: #2563a8;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-xs: 0 1px 2px rgba(15, 21, 34, 0.05);
  --shadow-sm: 0 1px 3px rgba(15, 21, 34, 0.07), 0 1px 2px rgba(15, 21, 34, 0.04);
  --shadow-md: 0 8px 24px rgba(15, 21, 34, 0.10), 0 2px 6px rgba(15, 21, 34, 0.05);
  --shadow-lg: 0 16px 40px rgba(15, 21, 34, 0.14);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
}

.app {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */

.sidebar {
  width: 300px;
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  height: 100vh;
  position: sticky;
  top: 0;
  box-shadow: 1px 0 0 var(--border), 4px 0 16px rgba(15, 21, 34, 0.04);
  z-index: 2;
}

.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 2px;
  color: var(--ink);
}

.sidebar-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0;
}

.progress-block {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  width: 0%;
  transition: width 0.25s ease;
  border-radius: 3px;
}

.company-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.company-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-left: 2.5px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 10px 9px 8px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 2px;
}

.company-item:hover {
  background: var(--surface-alt);
}

.company-item.active {
  background: var(--primary-tint);
  border-left-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 700;
}

.company-item .idx {
  flex: 0 0 20px;
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

.company-item.active .idx {
  color: var(--primary);
}

.company-item .name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  flex: 0 0 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  background: transparent;
}

.status-dot.correct { background: var(--green); border-color: var(--green); }
.status-dot.incorrect { background: var(--red); border-color: var(--red); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* ---------- Main ---------- */

.main {
  flex: 1;
  padding: 40px 56px 32px;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.view {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.view[hidden] {
  display: none;
}

.main-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 24px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}

.main-header h2 {
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 6px;
  color: var(--ink);
}

.domain-link {
  font-size: 13.5px;
  color: var(--text-muted);
  text-decoration: none;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 1px;
}

.domain-link:hover { color: var(--primary); border-color: var(--primary); }

.confidence-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: 0 0 auto;
}

.label-small {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.panel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  display: inline-block;
}

.panel-signalen .panel-dot { background: var(--blue); }
.panel-opmerking .panel-dot { background: var(--primary); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-faint);
}

.badge[data-level="hoog"] { border-color: var(--green); color: var(--green-dark); background: var(--green-tint); }
.badge[data-level="hoog"]::before { background: var(--green); }
.badge[data-level="middel-hoog"] { border-color: var(--blue); color: var(--blue); background: #eaf3fb; }
.badge[data-level="middel-hoog"]::before { background: var(--blue); }
.badge[data-level="middel"] { border-color: var(--amber); color: var(--amber); background: #fbf3e6; }
.badge[data-level="middel"]::before { background: var(--amber); }
.badge[data-level="laag"] { border-color: var(--border-strong); color: var(--text-muted); background: var(--surface-alt); }
.badge[data-level="laag"]::before { background: var(--text-faint); }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  margin-bottom: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.segment-hero {
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

.segment-hero .label-small { margin-bottom: 10px; }

.segment-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.01em;
  padding-left: 14px;
  border-left: 3px solid var(--primary);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.info-panel {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.panel-opmerking {
  background: var(--surface-tint);
  border-color: #dbe6f8;
}

.info-panel .label-small { margin-bottom: 9px; }

.body-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}

.body-text-muted {
  color: var(--text);
  font-style: italic;
}

.card-judgment .label-small {
  margin-bottom: 14px;
  font-size: 12px;
}

.judgment-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}

.judge-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  font-size: 14.5px;
  font-weight: 700;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease, transform 0.08s ease;
}

.judge-icon { font-size: 15px; }

.judge-correct .judge-icon { color: var(--green); }
.judge-incorrect .judge-icon { color: var(--red); }

.judge-btn:not(.active):hover {
  transform: translateY(-1px);
}

.judge-correct:not(.active):hover {
  border-color: var(--green);
  background: var(--green-tint);
}

.judge-incorrect:not(.active):hover {
  border-color: var(--red);
  background: var(--red-tint);
}

.judge-btn.judge-correct.active {
  background: var(--green);
  border-color: var(--green);
  color: var(--white, #fff);
  box-shadow: 0 4px 14px rgba(26, 138, 74, 0.28);
}

.judge-btn.judge-correct.active .judge-icon { color: #fff; }

.judge-btn.judge-incorrect.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 4px 14px rgba(209, 52, 56, 0.28);
}

.judge-btn.judge-incorrect.active .judge-icon { color: #fff; }

.textarea-label { margin-bottom: 8px; }

.notes-field {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  resize: vertical;
  min-height: 110px;
}

.notes-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}

.main-footer {
  margin-top: auto;
  padding-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.footer-status {
  font-size: 12.5px;
  color: var(--text-muted);
  flex: 1;
  text-align: center;
}

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: opacity 0.12s ease, background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(42, 92, 219, 0.25);
}

.btn-primary:hover:not(:disabled) { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-outline:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-dark); }

.btn-block { width: 100%; }

/* ---------- Overview ---------- */

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

.stat-tile {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.stat-tile .stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.stat-tile .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-tile.tile-correct .stat-value { color: var(--green-dark); }
.stat-tile.tile-incorrect .stat-value { color: var(--red-dark); }
.stat-tile.tile-pending .stat-value { color: var(--amber); }

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  overflow-x: auto;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.overview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.overview-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 16px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.overview-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
  vertical-align: top;
}

.overview-table tr:last-child td { border-bottom: none; }
.overview-table tr:hover td { background: var(--surface-alt); }

.overview-table .company-cell { font-weight: 600; }
.overview-table .domain-cell { color: var(--text-muted); font-size: 12px; font-family: "SF Mono", ui-monospace, Menlo, monospace; }

.note-cell {
  max-width: 260px;
  color: var(--text);
  white-space: pre-wrap;
}

.note-cell.empty { color: var(--text-faint); font-style: italic; }

.oordeel-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border-strong);
}

.oordeel-pill.correct { background: var(--green-tint); color: var(--green-dark); border-color: var(--green); }
.oordeel-pill.incorrect { background: var(--red-tint); color: var(--red-dark); border-color: var(--red); }
.oordeel-pill.pending { background: var(--surface-alt); color: var(--text-faint); border-color: var(--border); }

.edit-link {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.edit-link:hover { color: var(--primary-dark); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 14px 22px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-width: 420px;
  text-align: center;
}

/* ---------- Login ---------- */

.login-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 15% -10%, #e6ecfb 0%, rgba(230, 236, 251, 0) 55%),
    radial-gradient(900px 500px at 110% 10%, #eaf3fb 0%, rgba(234, 243, 251, 0) 50%),
    var(--page-bg);
  z-index: 50;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 34px 32px 26px;
  box-shadow: var(--shadow-md);
}

.login-brand { margin-bottom: 22px; }

.login-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
}

.login-card h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 10px;
  color: var(--ink);
}

.login-intro {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 0;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin: 16px 0 6px;
}

.text-input {
  width: 100%;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--ink);
  background: var(--surface);
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-tint);
}

.login-error {
  margin-top: 14px;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  background: var(--red-tint);
  border: 1px solid var(--red);
  color: var(--red-dark);
  font-size: 12.5px;
  font-weight: 600;
}

#login-submit { margin-top: 22px; }

.login-foot {
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
  margin: 16px 0 0;
}

/* ---------- Sidebar user row ---------- */

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.user-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  flex: 0 0 auto;
}

.link-btn:hover { color: var(--red); }

/* ---------- Done screen ---------- */

.view-centered {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.done-card {
  max-width: 460px;
  padding: 20px;
}

.done-check {
  width: 68px;
  height: 68px;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 34px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(26, 138, 74, 0.32);
}

.done-card h2 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  color: var(--ink);
}

.done-text {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 22px;
}

.done-stats {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.done-pill {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.done-pill-c { background: var(--green-tint); color: var(--green-dark); border: 1px solid var(--green); }
.done-pill-i { background: var(--red-tint); color: var(--red-dark); border: 1px solid var(--red); }

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex: none; height: auto; position: relative; }
  .main { padding: 24px; max-width: 100%; }
  .field-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}
