/* ===================================================================
   JUSTITIE – PZM Design System (Light Blue)
   Unified CSS for the Justitie application
   =================================================================== */

/* ── Design Tokens ─────────────────────────────────────────────────── */
:root {
  /* Primary palette – Light Blue */
  --primary-900: #0d2137;
  --primary-800: #14375e;
  --primary-700: #1a4d85;
  --primary:     #2196f3;
  --primary-400: #4dabf5;
  --primary-300: #7bc4f8;
  --primary-200: #b3ddfb;
  --primary-100: #e3f2fd;

  /* Semantic aliases */
  --bg:            #f4f5f7;
  --surface:       #ffffff;
  --surface-alt:   #fafafa;
  --text:          #1a1a1a;
  --text-light:    #5c6370;
  --text-inverted: #ffffff;
  --border:        #8b919a;
  --border-light:  #d4d7dc;
  --line:          #d4d7dc;
  --muted:         #5c6370;

  /* Legacy compat aliases */
  --primary-strong: #12325e;
  --primary-soft: #deedf8;
  --clr-gray-50: #fafafa;
  --clr-gray-200: #d4d7dc;
  --clr-gray-500: #5c6370;
  --clr-gray-600: #3d4148;

  /* Status colors */
  --success:       #1a7f42;
  --success-light: #e8f5ec;
  --warning:       #c45000;
  --warning-light: #fde8d4;
  --danger:        #b5332b;
  --danger-light:  #fce5e4;
  --info:          #1b6ec2;
  --info-light:    #deedf8;

  /* Spacing */
  --space-3xs: 0.25rem;
  --space-xxs: 0.5rem;
  --space-xs:  0.75rem;
  --space-s:   1rem;
  --space:     1.25rem;
  --space-l:   2rem;
  --space-xl:  2.75rem;
  --space-xxl: 3.5rem;

  /* Shape */
  --radius:    3px;
  --radius-sm: 2px;

  /* Shadow */
  --shadow:    0 1px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 3px 10px rgba(0, 0, 0, 0.10);

  /* Typography */
  --font-base:    "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-heading: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono:    "Consolas", "Courier New", monospace;
  --fw-normal: 400;
  --fw-medium: 500;
  --fw-bold:   600;
  --fw-extra:  700;

  /* Component sizing */
  --input-height: 2.75rem;
  --btn-height:   2.75rem;
  --topbar-h:     3.25rem;
  --sidebar-w:    14.5rem;
}

html[data-theme="dark"] {
  --bg:            #111827;
  --surface:       #1f2937;
  --surface-alt:   #273449;
  --text:          #f3f4f6;
  --text-light:    #cbd5e1;
  --border:        #64748b;
  --border-light:  #475569;
  --line:          #475569;
  --muted:         #cbd5e1;
  --primary-100:   #14375e;
  --primary-soft:  #14375e;
  --success-light: #123d2b;
  --warning-light: #4a2b12;
  --danger-light:  #4c1d1d;
  --info-light:    #14375e;
}

/* ── Reset & Base ──────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-base);
  font-size: 16px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html[data-theme="dark"] body {
  color-scheme: dark;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
  cursor: pointer;
}

.theme-switch input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

img { vertical-align: middle; }

/* ── Button System ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xxs);
  min-height: var(--btn-height);
  padding: 0 var(--space);
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--text-inverted);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: var(--fw-bold);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--primary-800);
  color: var(--text-inverted);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--primary);
}

.btn-outline:hover {
  background: var(--primary-100);
  border-color: var(--primary-400);
  color: var(--primary-800);
}

.btn-sm {
  min-height: 2rem;
  padding: 0 var(--space-xs);
  font-size: 0.8125rem;
}

.btn.alt {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.alt:hover {
  background: var(--bg);
  border-color: var(--border);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover,
a:focus {
  color: var(--primary-800);
}

/* ── Top Bar ───────────────────────────────────────────────────────── */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--topbar-h);
  z-index: 1000;
  background: var(--primary-900);
  color: var(--text-inverted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  padding: 0 var(--space-s);
  gap: var(--space-xs);
}

.mobile-toggle {
  display: none;
  background: transparent;
  color: var(--text-inverted);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  padding: 0.375rem 0.5rem;
  cursor: pointer;
  font-size: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-xxs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.875rem;
}

.brand-badge {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: var(--text-inverted);
  font-size: 0.875rem;
  font-weight: var(--fw-extra);
}

.topbar-title {
  margin-left: auto;
  margin-right: auto;
  font-weight: var(--fw-bold);
  letter-spacing: 0.06em;
  font-size: 0.8125rem;
  text-transform: uppercase;
}

.topbar-action {
  color: var(--text-inverted);
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8125rem;
  font-weight: var(--fw-medium);
  cursor: pointer;
  transition: background 0.2s ease;
}

.topbar-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-inverted);
}

.theme-toggle-btn {
  font-size: 1rem;
  line-height: 1;
  padding: 0.375rem 0.5rem;
}

/* ── Layout ────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  padding-top: var(--topbar-h);
}

/* ── Sidebar ───────────────────────────────────────────────────────── */
.sidebar {
  background: var(--primary-800);
  color: var(--text-inverted);
  padding: var(--space-xs);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
}

.nav-section {
  margin-top: var(--space-3xs);
}

.nav-label {
  font-size: 0.6875rem;
  opacity: 0.6;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: var(--space-s) var(--space-xxs) var(--space-xxs);
  font-weight: var(--fw-bold);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-xxs);
  color: var(--text-inverted);
  text-decoration: none;
  border-radius: var(--radius);
  padding: 0.625rem 0.75rem;
  margin-bottom: 1px;
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: var(--fw-medium);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-inverted);
}

.nav-link.active {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  font-weight: var(--fw-bold);
}

/* Hidden nav elements (legacy compat) */
.main-nav,
.brand-wrap,
.officer-pill {
  display: none;
}

/* ── Main Content Area ─────────────────────────────────────────────── */
.dashboard-layout {
  max-width: none;
  margin: 0;
  padding: var(--space-s);
}

/* ── Hero Section ──────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: var(--space) var(--space);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
}

.kicker {
  margin: 0 0 var(--space-xxs);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: var(--fw-extra);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.375rem, 2vw, 1.75rem);
  font-weight: var(--fw-bold);
  font-family: var(--font-heading);
}

.hero p {
  max-width: 70ch;
  margin: var(--space-xxs) 0 0;
  color: var(--text-light);
  line-height: 1.4;
}

/* ── Quick Actions ─────────────────────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: var(--space-xs);
  margin-top: var(--space-s);
}

.quick-actions button {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-xs);
  background: var(--surface);
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.quick-actions button:hover {
  background: var(--primary-100);
  color: var(--primary-800);
}

/* ── Stats Grid ────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: var(--space-xs);
  margin-top: var(--space-s);
}

.stat-card {
  padding: var(--space-s);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-card h2 {
  margin: 0;
  color: var(--text-light);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-card .value {
  margin: var(--space-xxs) 0 var(--space-3xs);
  color: var(--primary-800);
  font-size: 1.75rem;
  font-weight: var(--fw-extra);
  line-height: 1;
}

.stat-card .delta {
  margin: 0;
  color: var(--success);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
}

/* ── Panel Grid ────────────────────────────────────────────────────── */
.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xs);
  margin-top: var(--space-s);
}

.panel {
  padding: var(--space-s);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-xs);
  margin-bottom: var(--space-xs);
}

.panel-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: var(--fw-bold);
}

.panel-head a {
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
  text-decoration: none;
}

.panel-head a:hover {
  text-decoration: underline;
}

/* ── Activity & Task Lists ─────────────────────────────────────────── */
.activity-list,
.task-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-list li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: var(--space-xxs);
  padding: var(--space-xxs) 0;
  border-bottom: 1px solid var(--border-light);
}

.activity-list li:last-child {
  border-bottom: none;
}

.activity-list .time {
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: var(--fw-extra);
}

.activity-list p {
  margin: 0;
  color: var(--text);
  font-size: 0.875rem;
}

.task-list li {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xxs);
  padding: var(--space-xxs) 0;
  border-bottom: 1px solid var(--border-light);
}

.task-list li:last-child {
  border-bottom: none;
}

.task-list input {
  accent-color: var(--primary);
}

.task-list label {
  color: var(--text);
  font-size: 0.875rem;
}

/* ── Task Item Components ──────────────────────────────────────────── */
.task-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xxs);
  width: 100%;
}

.task-item-head {
  display: flex;
  align-items: center;
  gap: var(--space-xxs);
}

.task-item-title {
  color: var(--text);
  font-size: 0.875rem;
}

.task-item-actions {
  display: flex;
  gap: var(--space-xxs);
  flex-wrap: wrap;
}

.task-state-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
  background: var(--border);
}

.task-state-dot--open        { background: var(--border); }
.task-state-dot--in-progress { background: var(--warning); }
.task-state-dot--done        { background: var(--success); }

.source-task-state {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
}

.source-task-state-text {
  font-size: 0.8125rem;
  color: var(--text-light);
}

/* ── Responsive – Dashboard ────────────────────────────────────────── */
@media (max-width: 1120px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }
  .panel-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    width: var(--sidebar-w);
    z-index: 1001;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-toggle {
    display: inline-block;
  }

  .topbar-title {
    margin-right: 0;
    font-size: 0.75rem;
  }

  .dashboard-layout {
    padding: 0 var(--space-xs);
  }

  .hero {
    padding: var(--space-s);
  }

  .quick-actions {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Lookup Shell & Results Panel ──────────────────────────────────── */
.lookup-shell,
.results-panel {
  margin-top: var(--space-s);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ── Lookup Form ───────────────────────────────────────────────────── */
.lookup-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: var(--space-xs);
  padding: var(--space-s);
}

/* ── Field (Universal form group) ──────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
}

.field label {
  color: var(--text);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field select {
  width: 100%;
  min-height: var(--input-height);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 var(--space-xs);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.field input[type="checkbox"],
.field input[type="radio"] {
  width: 1rem;
  height: 1rem;
  min-height: auto;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--primary);
}

.field label:has(input[type="checkbox"]) {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xxs);
}

.field.actions {
  align-self: end;
  flex-direction: row;
  align-items: end;
  gap: var(--space-xxs);
}

.field.actions button {
  min-height: var(--btn-height);
  border: none;
  border-radius: var(--radius);
  padding: 0 var(--space);
  background: var(--primary);
  color: var(--text-inverted);
  font-size: 1rem;
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: background 0.2s ease;
}

.field.actions button:hover {
  background: var(--primary-800);
}

.field.actions .ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.field.actions .ghost:hover {
  background: var(--bg);
}

.field.full {
  grid-column: 1 / -1;
}

/* ── Textarea ──────────────────────────────────────────────────────── */
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-xs);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  resize: vertical;
  transition: border-color 0.2s ease;
}

textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

/* ── Results Panel & Tables ────────────────────────────────────────── */
.results-panel {
  padding: var(--space-s);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  border-bottom: 2px solid var(--border);
  padding: var(--space-xxs);
  color: var(--text);
  text-align: left;
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
}

tbody td {
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-xs) var(--space-xxs);
  color: var(--text);
  font-size: 0.875rem;
  vertical-align: middle;
}

tbody tr {
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: var(--primary-100);
}

/* ── Status Badge ──────────────────────────────────────────────────── */
.status-badge {
  display: inline-block;
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  padding: 0.25rem 0.625rem;
  background: transparent;
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
}

/* ── Table Buttons ─────────────────────────────────────────────────── */
.table-btn {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.375rem 0.75rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.table-btn:hover {
  background: var(--bg);
  border-color: var(--border);
}

.table-actions {
  display: flex;
  gap: var(--space-xxs);
}

.table-link {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.625rem;
  background: var(--surface);
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
  text-decoration: none;
  transition: background 0.15s ease;
}

.table-link:hover {
  background: var(--primary-100);
}

.empty-state {
  padding: var(--space) var(--space-xxs);
  color: var(--text-light);
  text-align: center;
  font-size: 0.875rem;
}

/* ── Create Form ───────────────────────────────────────────────────── */
.create-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: var(--space-xs);
  padding: var(--space-3xs) var(--space-s) var(--space-s);
}

/* ── Selection Banner ──────────────────────────────────────────────── */
.selection-banner {
  margin: var(--space-s);
  border: 1px solid var(--primary-200);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: var(--space-xs) var(--space-s);
  background: var(--primary-100);
  color: var(--text);
}

.selection-banner p {
  margin: 0;
}

.entity-chip {
  display: inline-block;
  margin-left: var(--space-xxs);
  border-radius: var(--radius);
  padding: 0.125rem 0.5rem;
  background: var(--primary);
  color: var(--text-inverted);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
}

/* ── Feedback ──────────────────────────────────────────────────────── */
.feedback {
  min-height: 1.5rem;
  margin: 0;
  padding: 0 var(--space-s) var(--space-xs);
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
}

.feedback--success {
  color: var(--success);
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  margin: var(--space-xxs) var(--space-s) var(--space-xs);
  padding: var(--space-xxs) var(--space-xs);
}

/* ── Warrant Sheet ─────────────────────────────────────────────────── */
.warrant-sheet {
  margin-top: var(--space-s);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.warrant-sheet-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-s);
  border-bottom: 1px solid var(--border-light);
  background: var(--primary-100);
}

.warrant-sheet-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: var(--fw-bold);
}

.warrant-sheet-head p {
  margin: 0;
  color: var(--text-light);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
}

.warrant-form {
  padding-top: 0;
}

.warrant-hero {
  border-left: 4px solid var(--primary);
}

/* ── Modal System ──────────────────────────────────────────────────── */
body.modal-open {
  overflow: hidden;
}

.entity-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: var(--space-s);
  background: rgba(0, 0, 0, 0.5);
}

.entity-modal.hidden {
  display: none;
}

.entity-modal-card {
  width: min(980px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.entity-modal-card--sm {
  width: min(540px, 100%);
}

.approval-modal-card {
  width: min(760px, 100%);
}

.entity-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-s);
  border-bottom: 1px solid var(--border-light);
  background: var(--primary-100);
}

.entity-modal-head h3 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: var(--fw-bold);
}

.entity-modal-close {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1.125rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease;
}

.entity-modal-close:hover {
  background: var(--bg);
}

.entity-modal-sub {
  margin: 0;
  padding: var(--space-xs) var(--space-s);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-alt);
}

.entity-modal-section {
  padding: var(--space-xs) var(--space-s);
  border-bottom: 1px solid var(--border-light);
}

.approval-modal-body {
  max-height: calc(90vh - 140px);
  overflow: auto;
  padding-top: var(--space-xs);
}

/* ── Dossier Columns ───────────────────────────────────────────────── */
.dossier-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-s) var(--space-s);
}

.dossier-columns section {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-xxs);
  background: var(--surface-alt);
}

.dossier-columns h4 {
  margin: 0 0 var(--space-xxs);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
}

/* ── Dossier List ──────────────────────────────────────────────────── */
.dossier-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.dossier-list li {
  margin-bottom: 1px;
  padding: var(--space-xxs) var(--space-xs);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.875rem;
  border: 1px solid var(--border-light);
}

.dossier-list li:last-child {
  margin-bottom: 0;
}

.dossier-list li label {
  display: flex;
  align-items: center;
  gap: var(--space-xxs);
}

.dossier-list input[type="checkbox"] {
  width: 0.75rem;
  height: 0.75rem;
}

.dossier-empty {
  background: var(--surface-alt);
  color: var(--text-light);
  border-color: var(--border-light);
}

/* ── Visibility ────────────────────────────────────────────────────── */
.is-hidden {
  display: none;
}

.admin-only-link {
  display: none;
}

html.focus-admin .admin-only-link {
  display: block;
}

/* ── Auth Pages (Login / Logout) ───────────────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space);
  background: var(--bg);
}

.auth-card {
  width: min(460px, 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
  padding: var(--space);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.auth-title,
.auth-subtitle {
  margin: 0;
}

.auth-title {
  color: var(--primary-900);
  font-size: 1rem;
  font-weight: var(--fw-extra);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.auth-subtitle {
  color: var(--text-light);
  font-size: 0.8125rem;
}

.auth-card h1 {
  margin: var(--space-s) 0 var(--space-3xs);
  font-size: 1.375rem;
  font-weight: var(--fw-bold);
}

.auth-help {
  margin: 0 0 var(--space-xs);
  color: var(--text-light);
  font-size: 0.875rem;
}

.auth-form {
  display: grid;
  gap: var(--space-xxs);
}

.auth-btn {
  min-height: var(--btn-height);
  border: none;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--text-inverted);
  font: inherit;
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: background 0.2s ease;
}

.auth-btn:hover {
  background: var(--primary-800);
}

/* ── Dynamic Inputs ────────────────────────────────────────────────── */
.dynamic-inputs-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  margin-top: var(--space-3xs);
}

.dynamic-inputs-wrap input {
  width: 100%;
  min-height: var(--input-height);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 var(--space-xs);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.dynamic-inputs-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.dynamic-add-btn {
  margin-top: var(--space-3xs);
  min-height: 2.25rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 0 var(--space-xs);
  background: var(--surface-alt);
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
  cursor: pointer;
  width: 100%;
  transition: background 0.15s ease;
}

.dynamic-add-btn:hover {
  background: var(--primary-100);
}

.dynamic-inline-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xxs);
}

/* ── Zaak Taken List ───────────────────────────────────────────────── */
.zaak-taken-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  margin-top: var(--space-3xs);
}

.zaak-taak-row {
  display: flex;
  gap: var(--space-xxs);
  align-items: center;
}

.zaak-taak-row input[type="text"] {
  flex: 1;
  min-width: 0;
}

.zaak-taak-row select {
  flex: 0 0 220px;
  min-width: 0;
}

.zaak-taak-remove {
  flex: 0 0 auto;
  padding: 0.25rem 0.625rem !important;
  font-size: 1rem;
  line-height: 1;
}

/* ── Penalty Picker ────────────────────────────────────────────────── */
.penalty-picker-summary {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface-alt);
  color: var(--text);
  min-height: var(--input-height);
  padding: var(--space-xxs) var(--space-xs);
  font-size: 0.875rem;
}

.penalty-picker-btn {
  margin-top: var(--space-xxs);
  min-height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 var(--space-xs);
  background: var(--surface);
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.penalty-picker-btn:hover {
  background: var(--primary-100);
}

.penalty-picker-body {
  max-height: calc(90vh - 210px);
  overflow: auto;
  padding: var(--space-xs) var(--space-s) var(--space-s);
}

.penalty-picker-body .dossier-list li {
  margin-bottom: var(--space-xxs);
}

/* ── Penalty Card Grid ─────────────────────────────────────────────── */
.penalty-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-xxs);
}

.penalty-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-xxs);
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-xs);
  transition: border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}

.penalty-card:hover {
  border-color: var(--border);
  background: var(--primary-100);
}

.penalty-card--selected {
  border-color: var(--primary);
  background: var(--primary-100);
  box-shadow: inset 3px 0 0 0 var(--primary);
}

.penalty-card-check {
  flex-shrink: 0;
  padding-top: 0.125rem;
}

.penalty-card-check input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  accent-color: var(--primary);
  cursor: pointer;
}

.penalty-card-body {
  flex: 1;
  min-width: 0;
}

.penalty-card-title {
  font-weight: var(--fw-bold);
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: var(--space-3xs);
}

.penalty-card-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: var(--text-light);
  cursor: help;
  font-size: 1rem;
}

.penalty-tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  background: var(--primary-100);
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
  transition: background 0.15s ease;
}

.penalty-card-info:hover .penalty-tooltip-icon {
  background: var(--primary-200);
}

.penalty-tooltip-box {
  display: none;
  position: fixed;
  min-width: 220px;
  max-width: 360px;
  padding: var(--space-xs) var(--space-s);
  background: var(--primary-900);
  color: var(--text-inverted);
  font-size: 0.8125rem;
  font-weight: var(--fw-medium);
  line-height: 1.4;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  white-space: normal;
  word-break: break-word;
  z-index: 99999;
  pointer-events: none;
}

.penalty-tooltip-box::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--primary-900);
}

.penalty-card-info:hover .penalty-tooltip-box {
  display: block;
}

/* ── Penalty Category Chips ────────────────────────────────────────── */
.penalty-category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs);
  padding: 0 var(--space-s) var(--space-xs);
}

.penalty-cat-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.3125rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.penalty-cat-chip:hover {
  background: var(--primary-100);
  border-color: var(--primary-200);
}

.penalty-cat-chip--active {
  background: var(--primary);
  color: var(--text-inverted);
  border-color: var(--primary);
}

.penalty-cat-chip--active:hover {
  background: var(--primary-800);
  border-color: var(--primary-800);
}

.penalty-card-cat {
  display: inline-block;
  background: var(--primary-100);
  color: var(--primary-800);
  font-size: 0.75rem;
  font-weight: var(--fw-bold);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius);
  margin-bottom: var(--space-3xs);
}

.penalty-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xxs);
  font-size: 0.8125rem;
  color: var(--text-light);
}

.penalty-card-meta span {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.125rem 0.5rem;
}

.penalty-card-warning {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: var(--space-3xs);
  font-size: 0.8125rem;
  color: var(--warning);
  cursor: pointer;
}

.penalty-card-warning input[type="checkbox"] {
  accent-color: var(--warning);
}

.penalty-card-empty {
  padding: var(--space);
  text-align: center;
  color: var(--text-light);
  font-size: 0.875rem;
}

/* ── Field Warning ─────────────────────────────────────────────────── */
.field--warning {
  border: 1px dashed var(--border-light);
  border-radius: var(--radius);
  background: var(--surface-alt);
  padding: var(--space-xxs) var(--space-xs);
}

.field--warning .auth-help {
  margin: 0;
}

/* ── Checkbox Grid ─────────────────────────────────────────────────── */
.checkbox-grid {
  display: grid;
  gap: var(--space-xxs);
  padding: var(--space-xxs);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.checkbox-grid-title {
  margin: 0;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: var(--fw-extra);
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: var(--space-xxs);
  color: var(--text);
  font-size: 0.875rem;
}

.checkbox-grid input[type="checkbox"] {
  width: 0.75rem;
  height: 0.75rem;
}

.approval-modal-body input[type="checkbox"] {
  width: 0.75rem;
  height: 0.75rem;
}

/* ── Gezocht (Wanted) ──────────────────────────────────────────────── */
.table-btn.table-btn--danger {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}

.table-btn.table-btn--danger:hover {
  background: #f5d0d0;
}

.table-btn.table-btn--active {
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
}

.table-btn.table-btn--active:hover {
  background: #d4f0dc;
}

.status-badge--gezocht {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger);
}

.row--gezocht {
  background: var(--danger-light);
}

.gezocht-body {
  padding: var(--space-xs) var(--space-s) var(--space-s);
}

.gezocht-huidig {
  margin-bottom: var(--space-xs);
  padding: var(--space-xs) var(--space-s);
  border-radius: var(--radius);
  border: 1px solid var(--danger);
  background: var(--danger-light);
}

.gezocht-huidig-label {
  margin: 0 0 var(--space-xxs);
  font-size: 0.75rem;
  font-weight: var(--fw-extra);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--danger);
}

.gezocht-huidig p {
  margin: 0 0 0.25rem;
  font-size: 0.875rem;
  color: var(--text);
}

.gezocht-huidig p:last-child {
  margin-bottom: 0;
}

.field.actions .gezocht-btn-danger {
  border: 1px solid var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}

.field.actions .gezocht-btn-danger:hover {
  background: #f5d0d0;
}

/* ── Muted Text ────────────────────────────────────────────────────── */
.muted {
  color: var(--text-light);
  font-size: 0.875rem;
}

/* ── Summary Modal ─────────────────────────────────────────────────── */
#summaryModal .ghost {
  min-height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 var(--space-xs);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease;
}

#summaryModal .ghost:hover {
  background: var(--primary-100);
}

#summaryModal #summaryBurgerZoekBtn {
  min-height: var(--input-height);
  border: none;
  border-radius: var(--radius);
  padding: 0 var(--space);
  background: var(--primary);
  color: var(--text-inverted);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: background 0.15s ease;
}

#summaryModal #summaryBurgerZoekBtn:hover {
  background: var(--primary-800);
}

#summaryModal #summaryBurgerResultaten {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

#summaryModal #summaryBurgerResultaten:empty {
  display: none;
}

#summaryModal #summaryBurgerResultaten li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xxs) var(--space-xs);
  gap: var(--space-xxs);
}

#summaryModal #summaryBurgerResultaten .table-btn {
  min-height: 2rem;
  padding: 0.25rem 0.875rem;
  border-color: var(--success);
  background: var(--success-light);
  color: var(--success);
  font-weight: var(--fw-bold);
  white-space: nowrap;
  transition: background 0.15s ease;
}

#summaryModal #summaryBurgerResultaten .table-btn:hover {
  background: #d4f0dc;
}

#summaryModal #summaryBurgerGeselecteerd {
  border: 1px solid var(--success);
  border-radius: var(--radius);
  background: var(--success-light);
  padding: var(--space-xxs) var(--space-xs);
}

#summaryModal #summaryBurgerWisBtn {
  min-height: 1.875rem;
  padding: 0.125rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: background 0.15s ease;
}

#summaryModal #summaryBurgerWisBtn:hover {
  background: var(--bg);
}

#summaryModal .field.actions button[type="submit"] {
  min-height: var(--btn-height);
  border: none;
  border-radius: var(--radius);
  padding: 0 var(--space);
  background: var(--primary);
  color: var(--text-inverted);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
  cursor: pointer;
  transition: background 0.15s ease;
}

#summaryModal .field.actions button[type="submit"]:hover {
  background: var(--primary-800);
}

#summaryModal .table-wrap .table-btn {
  min-height: 1.875rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
}

#summaryModal #bewijsSectie .checkbox-grid-title {
  margin-bottom: var(--space-3xs);
  font-size: 0.875rem;
}

#summaryModal #bewijsSectie .ghost {
  min-height: 2.25rem;
  padding: 0 var(--space-xs);
  border-style: dashed;
  border-color: var(--border);
  background: var(--surface-alt);
  font-size: 0.875rem;
}

#summaryModal #bewijsSectie .ghost:hover {
  background: var(--primary-100);
}

#summaryModal .feedback {
  font-size: 0.875rem;
  min-height: 1.25rem;
}

/* ── View-Only Zaak Modal ──────────────────────────────────────────── */
.view-zaak-section {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: var(--space-xs) var(--space-s);
  background: var(--surface-alt);
}

.view-zaak-section-title {
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
  margin: 0 0 var(--space-xxs);
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.view-zaak-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xxs) var(--space-s);
}

.view-zaak-field {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.view-zaak-field--full {
  grid-column: 1 / -1;
}

.view-zaak-label {
  font-size: 0.75rem;
  font-weight: var(--fw-bold);
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.view-zaak-value {
  font-size: 0.875rem;
  color: var(--text);
  word-break: break-word;
}

.view-zaak-empty {
  font-size: 0.875rem;
  color: var(--text-light);
  margin: 0;
}

.view-zaak-straf {
  display: flex;
  align-items: baseline;
  gap: var(--space-xxs);
  padding: var(--space-3xs) 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
}

.view-zaak-straf:last-child {
  border-bottom: none;
}

.view-zaak-straf-meta {
  font-size: 0.8125rem;
  color: var(--text-light);
}

.view-zaak-taak {
  padding: var(--space-xxs) 0;
  border-bottom: 1px solid var(--border-light);
}

.view-zaak-taak:last-child {
  border-bottom: none;
}

.view-zaak-taak-header {
  display: flex;
  align-items: center;
  gap: var(--space-xxs);
  flex-wrap: wrap;
}

.view-zaak-taak small {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-light);
  margin-top: 0.125rem;
}

.view-zaak-samenvatting {
  padding: var(--space-xxs) 0;
  border-bottom: 1px solid var(--border-light);
}

.view-zaak-samenvatting:last-child {
  border-bottom: none;
}

.view-zaak-samenvatting-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-xxs);
  flex-wrap: wrap;
}

.view-zaak-samenvatting-header small {
  font-size: 0.8125rem;
  color: var(--text-light);
}

.view-zaak-samenvatting-inhoud {
  margin: var(--space-3xs) 0 0;
  font-size: 0.875rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.view-zaak-bewijs {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: var(--text-light);
}

/* ── Responsive – Forms ────────────────────────────────────────────── */
@media (max-width: 980px) {
  .lookup-form {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .create-form {
    grid-template-columns: 1fr;
  }

  .dossier-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .lookup-form {
    grid-template-columns: 1fr;
  }

  .field.actions {
    align-self: stretch;
  }

  .field.actions button {
    flex: 1;
  }

  .warrant-sheet-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .dynamic-inline-row {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================
   JUSTITIE-SPECIFIC COMPONENTS
   Classes used by justitie HTML that extend the base design system
   =================================================================== */

/* ── Main Content ──────────────────────────────────────────────────── */
.main {
  padding: var(--space-s);
  overflow-y: auto;
}

/* ── Card System ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.card-header {
  padding: var(--space-xs) var(--space-s);
  border-bottom: 1px solid var(--border-light);
  background: var(--surface-alt);
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: var(--fw-bold);
}

.card-body {
  padding: var(--space-xs) var(--space-s) var(--space-s);
}

/* ── Toolbar & Search ──────────────────────────────────────────────── */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xxs);
  align-items: center;
  margin-bottom: var(--space-s);
}

.search-input {
  width: min(420px, 100%);
  min-height: var(--input-height);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 var(--space-xs);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.search-input--sm {
  min-height: 2.25rem;
  padding: 0 var(--space-xxs);
  font-size: 0.875rem;
}

/* ── Grid & Layout Utilities ───────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-xs);
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-xxs);
  align-items: end;
}

/* ── Modal System ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3.5rem var(--space-s) var(--space-s);
}

.modal-overlay.hidden {
  display: none;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal--dossier {
  max-width: 980px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-xs) var(--space-s);
  border-bottom: 1px solid var(--border-light);
  background: var(--primary-100);
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: var(--fw-bold);
}

.modal-close {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.15s ease;
  padding: 0;
}

.modal-close:hover {
  background: var(--bg);
}

.modal-sub {
  margin: 0;
  padding: var(--space-xxs) var(--space-s);
  color: var(--text-light);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border-light);
}

.modal-body {
  padding: var(--space-s);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-xxs);
  padding: var(--space-xs) var(--space-s);
  border-top: 1px solid var(--border-light);
}

/* ── Form Group ────────────────────────────────────────────────────── */
.form-group {
  margin-bottom: var(--space-xs);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-3xs);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
  color: var(--text-light);
}

.form-group select,
.form-group input {
  width: 100%;
  min-height: var(--input-height);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 var(--space-xs);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
}

.form-group select:focus,
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

/* ── Badge / Status Pill ───────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.3rem 0.625rem;
  border-radius: var(--radius);
  background: var(--primary-100);
  color: var(--primary);
  border: 1px solid var(--primary-200);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
}

.status-pill {
  display: inline-block;
  padding: 0.1875rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  white-space: nowrap;
  font-weight: var(--fw-bold);
}

.status-pill--green,
.pill-green  { background: var(--success-light); color: var(--success); border: 1px solid var(--success); }
.status-pill--amber,
.pill-amber  { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning); }
.status-pill--red,
.pill-red    { background: var(--danger-light);  color: var(--danger);  border: 1px solid var(--danger); }
.status-pill--blue,
.pill-blue   { background: var(--info-light);    color: var(--info);    border: 1px solid var(--primary); }
.status-pill--default,
.pill-default { background: var(--surface-alt); color: var(--text-light); border: 1px solid var(--border-light); }

/* ── Source Badge ──────────────────────────────────────────────────── */
.source-badge {
  display: inline-block;
  padding: 0.1rem 0.375rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: var(--fw-extra);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.source-badge--justitie { background: var(--primary-100); color: var(--primary); border: 1px solid var(--primary-200); }
.source-badge--focus    { background: var(--info-light);   color: var(--info);    border: 1px solid var(--primary-200); }

/* ── Assign Button ─────────────────────────────────────────────────── */
.assign-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3xs);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease;
}

.assign-btn:hover {
  background: var(--primary-100);
}

.assign-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Dossier Section ───────────────────────────────────────────────── */
.dossier-section h4 {
  margin: 0 0 var(--space-xxs);
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: var(--fw-extra);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Clickable dossier items */
.dossier-item {
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s ease;
}

.dossier-item:hover {
  background: var(--primary-100);
}

.dossier-item-main {
  margin-bottom: 0.125rem;
}

.dossier-item-meta {
  display: flex;
  align-items: center;
  gap: var(--space-xxs);
  margin-top: 0.125rem;
}

/* ── Detail View ───────────────────────────────────────────────────── */
.detail-nav {
  padding: var(--space-xxs) var(--space-s) var(--space-xs);
}

.detail-content {
  padding: 0 var(--space-s) var(--space-s);
}

.detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-xxs);
  margin-bottom: var(--space-s);
}

.detail-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: var(--fw-extra);
}

.detail-type-badge {
  display: inline-block;
  padding: 0.1875rem 0.625rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: var(--fw-extra);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.detail-type-rapport { background: var(--info-light);    color: var(--info);    border: 1px solid var(--primary-200); }
.detail-type-zaak    { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning); }
.detail-type-bevel   { background: #fce8e8;              color: #b91c1c;        border: 1px solid #f87171; }

/* ── Dossier Foto ─────────────────────────────────────────────────── */
.dossier-foto-wrap {
  display: flex;
  justify-content: center;
  padding: 0 var(--space-s) var(--space-xs);
}

.dossier-foto {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 2px solid var(--border);
}

/* ── Dossier Section full-width ───────────────────────────────────── */
.dossier-section--full {
  margin-top: var(--space-xs);
  padding-top: var(--space-xs);
  border-top: 1px solid var(--border-light);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xs);
  margin-bottom: var(--space-s);
}

@media (max-width: 500px) {
  .detail-grid { grid-template-columns: 1fr; }
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.1875rem;
}

.detail-label {
  font-size: 0.75rem;
  font-weight: var(--fw-bold);
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.detail-value {
  font-size: 0.875rem;
  color: var(--text);
}

.detail-status-pill {
  display: inline-flex;
  width: fit-content;
  align-self: flex-start;
}

.detail-section {
  margin-top: var(--space-3xs);
}

.bevel-pdf-viewer {
  margin-top: var(--space-xxs);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
}

.bevel-pdf-viewer embed {
  display: block;
}

.bevel-pdf-fallback {
  margin: var(--space-xxs) var(--space-xs);
  font-size: 0.85rem;
}

/* ── Straffen tabel ─────────────────────────────────────────────────────── */
.straf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: var(--space-xxs);
}

.straf-table thead th {
  text-align: left;
  padding: 5px 10px;
  background: var(--surface-alt);
  border-bottom: 2px solid var(--border-light);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.straf-table tbody tr {
  border-bottom: 1px solid var(--border-light);
}

.straf-table tbody tr:last-child {
  border-bottom: none;
}

.straf-table tbody td {
  padding: 6px 10px;
  vertical-align: middle;
}

.straf-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.straf-badge--fine  { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.straf-badge--taak  { background: #e0f2fe; color: #0369a1; border: 1px solid #7dd3fc; }
.straf-badge--cel   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.straf-badge--warn  { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }

.detail-action-panel {
  margin: var(--space-3xs) 0 var(--space-s);
  padding: var(--space-xs);
  background: var(--surface-alt);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.detail-action-row {
  margin-top: var(--space-xxs);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-xxs);
  align-items: center;
}

@media (max-width: 700px) {
  .detail-action-row {
    grid-template-columns: 1fr;
  }
}

/* ── Document Composer ─────────────────────────────────────────────── */
.modal--composer {
  max-width: 900px;
}

.doc-composer {
  display: flex;
  gap: 20px;
  padding: 16px;
  min-height: 480px;
}

.doc-composer__form {
  flex: 0 0 290px;
  overflow-y: auto;
}

.doc-body-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font: inherit;
  font-size: 0.9375rem;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}

.doc-body-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.doc-composer__preview {
  flex: 1;
  min-width: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.doc-composer__preview-label {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: var(--fw-bold);
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.doc-composer__preview canvas {
  max-width: 100%;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  display: block;
}

@media (max-width: 720px) {
  .doc-composer {
    flex-direction: column;
  }
  .doc-composer__form {
    flex: none;
  }
  .modal--composer {
    max-width: 100%;
  }
}

/* ── Case Task List ────────────────────────────────────────────────── */
.case-task-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.case-task-list li {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 1.4fr;
  gap: var(--space-xs);
  padding: var(--space-xs) 0;
  border-bottom: 1px solid var(--border-light);
}

.case-task-list li:last-child {
  border-bottom: none;
}

.case-task-meta strong {
  display: block;
  color: var(--primary);
  font-size: 0.875rem;
  letter-spacing: 0.02em;
}

.case-task-meta span {
  display: block;
  margin-top: var(--space-3xs);
  color: var(--text-light);
  font-size: 0.8125rem;
}

.case-task-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xxs);
}

.case-task-main p {
  margin: 0;
  color: var(--text);
  font-size: 0.875rem;
}

.case-task-priority {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.1875rem 0.625rem;
  font-size: 0.75rem;
  font-weight: var(--fw-extra);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.case-task-priority--hoog   { background: var(--danger-light);  color: var(--danger);  border: 1px solid var(--danger); }
.case-task-priority--midden { background: var(--warning-light); color: var(--warning); border: 1px solid var(--warning); }
.case-task-priority--laag   { background: var(--success-light); color: var(--success); border: 1px solid var(--success); }

@media (max-width: 940px) {
  .case-task-list li {
    grid-template-columns: 1fr;
    gap: var(--space-xxs);
  }
  .case-task-main {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* ── Chip / Tag ────────────────────────────────────────────────────── */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3xs);
  margin-top: var(--space-xxs);
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.1875rem 0.5rem;
  border-radius: var(--radius);
  background: var(--primary-100);
  color: var(--primary-800);
  font-size: 0.8125rem;
  font-weight: var(--fw-bold);
  border: 1px solid var(--primary-200);
}

/* ── Mini Actions ──────────────────────────────────────────────────── */
.mini-actions {
  display: flex;
  gap: var(--space-3xs);
  flex-wrap: wrap;
}

/* ── Case File List ────────────────────────────────────────────────── */
.case-file-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.case-file-list li {
  padding: var(--space-xxs) 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
}

.case-file-list li:last-child {
  border-bottom: none;
}

/* ── Utilities ─────────────────────────────────────────────────────── */
.loading {
  margin: 0;
  color: var(--primary);
  font-size: 0.875rem;
  font-weight: var(--fw-bold);
}

.error {
  margin: 0;
  color: var(--danger);
  font-size: 0.875rem;
}

.empty {
  margin: 0;
  color: var(--text-light);
  font-size: 0.875rem;
}

.hidden {
  display: none;
}

.mt-1 {
  margin-top: var(--space-xs);
}

.muted {
  color: var(--text-light);
  font-size: 0.875rem;
}

/* ── Mobile Responsive Enhancements ────────────────────────────────── */

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.45);
}
.sidebar-overlay.visible {
  display: block;
}

@media (max-width: 760px) {
  /* Form actions wrap */
  .form-actions {
    flex-wrap: wrap;
  }
  .form-actions .btn {
    flex: 1 1 auto;
    min-width: 8rem;
  }

  /* Ensure table areas scroll horizontally */
  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Modal: slide up from bottom on mobile */
  .entity-modal {
    padding: var(--space-xxs);
    align-items: flex-end;
  }
  .entity-modal-card {
    max-height: 92vh;
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
  }
  .entity-modal-card--sm {
    width: 100%;
  }

  /* Topbar: ensure title does not push buttons off */
  .topbar-title {
    font-size: 0.7rem;
    flex: 1 1 0;
    text-align: center;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}

@media (max-width: 480px) {
  /* Quick actions: 2 columns */
  .quick-actions {
    grid-template-columns: 1fr 1fr;
  }

  /* Tighter padding on small screens */
  .dashboard-layout {
    padding: 0 var(--space-xxs);
  }
  .hero {
    padding: var(--space-xs);
  }
  .hero h1 {
    font-size: 1.125rem;
  }

  /* Tables need minimum width to be scrollable */
  .table-wrap table {
    min-width: 480px;
  }

  /* Panel grid single column */
  .panel-grid {
    grid-template-columns: 1fr;
  }
}
