/* ================================================================
   CaseVault – App UI v1.0
   ================================================================ */

/* ── Variables (dark default) ────────────────────────────────── */
:root {
  --bg:         #111318;
  --bg2:        #1c1f26;
  --bg3:        #252931;
  --border:     rgba(255,255,255,.10);
  --border2:    rgba(255,255,255,.20);
  --text:       #e8eaf0;
  --text-muted: rgba(255,255,255,.50);
  --accent:     #4a90d9;
  --accent-dk:  #3a78c0;
  --danger:     #f44336;
  --ok:         #4caf50;
  --warn:       #ff9800;
  --shadow:     0 4px 24px rgba(0,0,0,.45);
  --nav-bg:     #0d1017;
  --input-bg:   #1a1e27;
  --input-bd:   #30363f;

  --pill-ok:     #81c784;
  --pill-blue:   #90caf9;
  --pill-violet: #ce93d8;
  --pill-warn:   #ffb74d;
  --pill-bad:    #ef9a9a;
  --pill-gray:   #b0bec5;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:         #f0f2f5;
    --bg2:        #ffffff;
    --bg3:        #e8eaf0;
    --border:     rgba(0,0,0,.12);
    --border2:    rgba(0,0,0,.22);
    --text:       #1a1d24;
    --text-muted: rgba(0,0,0,.50);
    --accent:     #2f6bb0;
    --accent-dk:  #255a97;
    --shadow:     0 2px 14px rgba(0,0,0,.12);
    --nav-bg:     #151a2a;
    --input-bg:   #ffffff;
    --input-bd:   #c0c5cf;

    --pill-ok:     #2e7d32;
    --pill-blue:   #1565c0;
    --pill-violet: #6a1b9a;
    --pill-warn:   #e65100;
    --pill-bad:    #b71c1c;
    --pill-gray:   #546e7a;
  }
}

html[data-theme="light"] {
  --bg: #f0f2f5; --bg2: #ffffff; --bg3: #e8eaf0;
  --border: rgba(0,0,0,.12); --border2: rgba(0,0,0,.22);
  --text: #1a1d24; --text-muted: rgba(0,0,0,.50);
  --accent: #2f6bb0; --accent-dk: #255a97;
  --shadow: 0 2px 14px rgba(0,0,0,.12);
  --nav-bg: #151a2a; --input-bg: #ffffff; --input-bd: #c0c5cf;
  --pill-ok: #2e7d32; --pill-blue: #1565c0; --pill-violet: #6a1b9a;
  --pill-warn: #e65100; --pill-bad: #b71c1c; --pill-gray: #546e7a;
}

html[data-theme="dark"] {
  --bg: #111318; --bg2: #1c1f26; --bg3: #252931;
  --border: rgba(255,255,255,.10); --border2: rgba(255,255,255,.20);
  --text: #e8eaf0; --text-muted: rgba(255,255,255,.50);
  --accent: #4a90d9; --accent-dk: #3a78c0;
  --shadow: 0 4px 24px rgba(0,0,0,.45);
  --nav-bg: #0d1017; --input-bg: #1a1e27; --input-bd: #30363f;
  --pill-ok: #81c784; --pill-blue: #90caf9; --pill-violet: #ce93d8;
  --pill-warn: #ffb74d; --pill-bad: #ef9a9a; --pill-gray: #b0bec5;
}

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navigation ───────────────────────────────────────────────── */
.nav {
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255,255,255,.07);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 16px;
}

.nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand {
  color: #fff;
  text-decoration: none;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: -.2px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 8px;
}
.nav-brand:hover { text-decoration: none; }
.nav-brand svg { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 2px;
  flex: 1;
}

.nav-links a {
  color: rgba(255,255,255,.65);
  text-decoration: none;
  padding: 7px 12px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.nav-links a:hover,
.nav-links a.active {
  background: rgba(255,255,255,.10);
  color: #fff;
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.nav-user {
  color: rgba(255,255,255,.55);
  font-size: 12.5px;
  white-space: nowrap;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  padding: 5px 7px;
  border-radius: 7px;
  line-height: 1;
  transition: background .15s;
}
.theme-toggle:hover { background: rgba(255,255,255,.10); }

/* ── Main Layout ──────────────────────────────────────────────── */
.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

/* ── Messages ─────────────────────────────────────────────────── */
.messages { margin-bottom: 20px; }

.message {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--bg2);
  border: 1px solid var(--border);
}
.message--success { border-color: rgba(76,175,80,.5); color: var(--pill-ok); }
.message--error   { border-color: rgba(244,67,54,.5); color: var(--pill-bad); }
.message--warning { border-color: rgba(255,152,0,.5); color: var(--pill-warn); }
.message--info    { border-color: rgba(74,144,217,.5); color: var(--pill-blue); }

/* ── Page Header ──────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.2;
}

.page-header .sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 3px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Breadcrumb ───────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--accent); font-weight: 600; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { opacity: .45; }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: filter .15s, background .15s, opacity .15s;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { filter: brightness(1.12); text-decoration: none; }
.btn:active { filter: brightness(.95); }

.btn--primary   { background: var(--accent); color: #fff; }
.btn--secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border2); }
.btn--danger    { background: var(--danger); color: #fff; }
.btn--ghost     { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn--sm        { padding: 6px 12px; font-size: 12.5px; }
.btn--icon      { padding: 7px 9px; font-size: 15px; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

/* ── Search ───────────────────────────────────────────────────── */
.search-form {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}
.search-form input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--input-bd);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  max-width: 400px;
}
.search-form input:focus { border-color: var(--accent); }

/* ── Table ────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

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

th {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  white-space: nowrap;
}

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

.tr-link { cursor: pointer; }
.tr-link:hover td { background: rgba(74,144,217,.07); }

/* ── Status Pills ─────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  border: 1px solid;
  white-space: nowrap;
}
.pill--ok     { color: var(--pill-ok);     border-color: var(--pill-ok);     background: color-mix(in srgb, var(--pill-ok)     12%, transparent); }
.pill--blue   { color: var(--pill-blue);   border-color: var(--pill-blue);   background: color-mix(in srgb, var(--pill-blue)   12%, transparent); }
.pill--violet { color: var(--pill-violet); border-color: var(--pill-violet); background: color-mix(in srgb, var(--pill-violet) 12%, transparent); }
.pill--warn   { color: var(--pill-warn);   border-color: var(--pill-warn);   background: color-mix(in srgb, var(--pill-warn)   12%, transparent); }
.pill--bad    { color: var(--pill-bad);    border-color: var(--pill-bad);    background: color-mix(in srgb, var(--pill-bad)    12%, transparent); }
.pill--gray   { color: var(--pill-gray);   border-color: var(--pill-gray);   background: color-mix(in srgb, var(--pill-gray)   12%, transparent); }
.pill--xs     { padding: 1px 6px; font-size: 10px; font-weight: 700; }

/* ── Forms ────────────────────────────────────────────────────── */
.form-wrap { max-width: 760px; }

.form-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
}

.form-section {
  margin-bottom: 28px;
}

.form-section-title {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: .35px;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="datetime-local"],
.field select,
.field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--input-bd);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--accent); }
.field textarea { resize: vertical; }
.field select { cursor: pointer; }

.field input[disabled],
.field select[disabled] {
  opacity: .55;
  cursor: not-allowed;
}

.field-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.field-row .field { flex: 1 1 200px; }

.field .help-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.field .errorlist {
  list-style: none;
  color: var(--pill-bad);
  font-size: 12.5px;
  margin-top: 4px;
}
.field .errorlist li::before { content: "⚠ "; }

.nonfield-errors {
  background: color-mix(in srgb, var(--pill-bad) 10%, transparent);
  border: 1px solid var(--pill-bad);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13.5px;
  color: var(--pill-bad);
}

/* Checkbox list (multiple select) */
.checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: var(--input-bg);
  border: 1px solid var(--input-bd);
  border-radius: 7px;
  max-height: 200px;
  overflow-y: auto;
}
.checkbox-list label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--bg3);
  transition: border-color .1s;
}
.checkbox-list label:hover { border-color: var(--accent); }
.checkbox-list input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; }

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  padding-top: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* File input */
.upload-zone {
  display: block;
  position: relative;
  border: 2px dashed var(--input-bd);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  background: var(--input-bg);
  cursor: pointer;
  transition: border-color .15s;
}
.upload-zone:hover { border-color: var(--accent); }
.upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.upload-zone-label { font-size: 13.5px; color: var(--text-muted); pointer-events: none; }
.upload-zone-label strong { color: var(--accent); }

/* Custody change section (collapsible) */
.custody-detail { display: none; }
.custody-detail.visible { display: block; }

/* ── EO Block (Case Detail) ───────────────────────────────────── */
.eo-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.eo-head {
  background: var(--bg2);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.eo-title {
  font-size: 16px;
  font-weight: 900;
}
.eo-title a { color: var(--text); text-decoration: none; }
.eo-title a:hover { color: var(--accent); }

.eo-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 7px 18px;
  background: var(--bg3);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.eo-body { padding: 14px 16px; background: var(--bg); }
.eo-actions { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

/* ── Evidence Cards ───────────────────────────────────────────── */
.ev-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 11px;
}

.ev-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.ev-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 18px rgba(74,144,217,.18);
  transform: translateY(-1px);
  text-decoration: none;
}

.ev-thumb {
  height: 130px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
}
.ev-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ev-thumb-ph { color: var(--text-muted); opacity: .3; font-size: 52px; }
.ev-thumb-count {
  position: absolute; bottom: 6px; right: 7px;
  background: rgba(0,0,0,.72); color: #fff;
  font-size: 10.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
}

.ev-body { padding: 10px 12px; flex: 1; }
.ev-bnr { font-size: 10.5px; font-weight: 800; color: var(--text-muted); text-transform: uppercase; margin-bottom: 2px; }
.ev-name { font-size: 13.5px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.ev-detail { font-size: 11.5px; color: var(--text-muted); margin-bottom: 7px; }
.ev-pills { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── Detail Layout ────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 20px;
  margin-bottom: 20px;
}
.detail-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  margin-bottom: 1px;
}
.detail-value {
  font-size: 14px;
  word-break: break-word;
}
.detail-value.mono { font-family: "Courier New", monospace; font-size: 13px; }

/* ── Photo Gallery ────────────────────────────────────────────── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.photo-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--bg3);
}
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-del {
  position: absolute; top: 5px; right: 5px;
  background: rgba(0,0,0,.75); border: none; color: #fff;
  border-radius: 50%; width: 25px; height: 25px;
  cursor: pointer; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.photo-item:hover .photo-del { opacity: 1; }
.photo-kommentar {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.65); color: #fff;
  font-size: 10.5px; padding: 3px 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Maßnahme erfassen ──────────────────────────────────────────── */
.action-add-wrap { border-top: 1px solid var(--border); margin-top: 12px; }
.action-add-summary {
  list-style: none; cursor: pointer;
  padding: 8px 0 4px;
  font-size: 13px; color: var(--accent);
  user-select: none;
}
.action-add-summary::-webkit-details-marker { display: none; }
.action-add-form { padding-top: 10px; }

/* ── Timeline / Log ───────────────────────────────────────────── */
.timeline { list-style: none; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  margin-top: 5px;
}
.timeline-time { font-size: 11.5px; color: var(--text-muted); margin-bottom: 2px; }
.timeline-text { font-size: 13.5px; }
.timeline-sub  { font-size: 12px; color: var(--text-muted); }

/* ── Sections ─────────────────────────────────────────────────── */
.section-title {
  font-size: 12.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.divider { height: 1px; background: var(--border); margin: 24px 0; }

/* ── Empty State ──────────────────────────────────────────────── */
.empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.empty p { font-size: 14.5px; margin-bottom: 14px; }

/* ── Einsatzplan Block ────────────────────────────────────────── */
.einsatzplan-block { margin-bottom: 20px; }

.ep-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 860px) { .ep-grid { grid-template-columns: 1fr; } }

.ep-meta, .ep-stats { display: flex; flex-direction: column; gap: 0; }

.ep-fields { display: flex; flex-direction: column; gap: 0; flex: 1; }

.ep-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}
.ep-row:last-of-type { border-bottom: none; }
.ep-label {
  flex: 0 0 130px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
}
.ep-val { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; }

.ep-plan-section {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}
.ep-plan-file {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  flex: 1;
}
.ep-upload-btn {
  cursor: pointer;
  position: relative;
}
.ep-upload-btn form { position: absolute; inset: 0; overflow: hidden; }
.ep-upload-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* Stats grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 500px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-item { text-align: center; }
.stat-val  { font-size: 26px; font-weight: 900; color: var(--accent); line-height: 1.1; }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); margin-top: 2px; }

/* Reports collapsible */
.reports-section { margin-top: 4px; }
.reports-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  padding: 4px 0;
}
.reports-summary::-webkit-details-marker { display: none; }
.reports-summary::before { content: '▶'; font-size: 10px; color: var(--text-muted); transition: transform .2s; }
details[open] .reports-summary::before { transform: rotate(90deg); }

/* ── Stat Bar (Dashboard) ─────────────────────────────────────── */
.stat-bar {
  display: flex;
  align-items: stretch;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}
.stat-bar-sep {
  width: 1px;
  background: var(--border2);
  margin: 10px 0;
  flex-shrink: 0;
}
.stat-bar-item {
  flex: 1;
  padding: 14px 12px 12px;
  text-align: center;
  border-right: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background .12s;
}
.stat-bar-item:last-child { border-right: none; }
.stat-bar-item--link:hover {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  text-decoration: none;
  color: inherit;
}
.stat-bar-val {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.1;
  color: var(--text);
}
.stat-bar-val--ok   { color: var(--pill-ok); }
.stat-bar-val--warn { color: var(--pill-warn); }
.stat-bar-lbl {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  margin-top: 2px;
}
@media (max-width: 700px) {
  .stat-bar { flex-wrap: wrap; }
  .stat-bar-item { flex: 1 1 33%; min-width: 80px; }
  .stat-bar-sep { display: none; }
}

/* ── Investigator search ──────────────────────────────────────── */
.inv-search-wrap {
  display: flex; align-items: center; gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--input-bd);
  border-radius: 6px;
  background: var(--input-bg);
  margin-bottom: 6px;
}
.inv-search-wrap:focus-within { border-color: var(--accent); }
.inv-search-icon {
  color: var(--text-muted); pointer-events: none;
  display: flex; align-items: center; flex-shrink: 0;
}
.inv-search {
  flex: 1;
  padding: 7px 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.checkbox-list label.hidden { display: none; }

/* Custom searchable select (Einsatzleiter) */
.inv-combo { position: relative; }
.inv-combo-display {
  display: flex; align-items: center;
  padding: 9px 36px 9px 12px;
  border: 1px solid var(--input-bd);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  user-select: none;
  position: relative;
  min-height: 38px;
}
.inv-combo-display:focus-within,
.inv-combo.open .inv-combo-display { border-color: var(--accent); }
.inv-combo-input {
  border: none; background: transparent; outline: none;
  color: var(--text); font-size: 14px; font-family: inherit;
  flex: 1; min-width: 0; cursor: text;
}
.inv-combo-input::placeholder { color: var(--text-muted); }
.inv-combo-chevron {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none; transition: transform .2s;
  display: flex; align-items: center;
}
.inv-combo.open .inv-combo-chevron { transform: translateY(-50%) rotate(180deg); }
.inv-combo-dropdown {
  display: none;
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  max-height: 220px; overflow-y: auto;
  z-index: 200;
}
.inv-combo.open .inv-combo-dropdown { display: block; }
.inv-combo-opt {
  padding: 8px 12px;
  font-size: 13.5px; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.inv-combo-opt:last-child { border-bottom: none; }
.inv-combo-opt:hover,
.inv-combo-opt.focused { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.inv-combo-opt.is-selected { color: var(--accent); font-weight: 700; }
.inv-combo-opt.hidden { display: none; }
.inv-combo-empty {
  padding: 10px 12px;
  color: var(--text-muted); font-size: 13px; font-style: italic;
}

/* ── Date/Time split widget ───────────────────────────────────── */
.dt-split {
  display: flex;
  gap: 12px;
}
.dt-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dt-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .35px;
}
.dt-col input[type="date"],
.dt-col input[type="time"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--input-bd);
  border-radius: 7px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.dt-col input:focus { border-color: var(--accent); }

/* ── Person list (investigators w/ phone) ─────────────────────── */
.person-list { display: flex; flex-direction: column; gap: 3px; }
.person-item { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; }
.person-name { font-weight: 600; }
.person-phone { font-size: 12px; color: var(--text-muted); }
.person-eos   { display: flex; gap: 3px; flex-wrap: wrap; margin-left: 2px; }

/* ── Einsatzplan file list ────────────────────────────────────── */
.ep-plans-drop { width: 100%; }
.ep-plans-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  padding: 4px 0;
  user-select: none;
}
.ep-plans-summary::-webkit-details-marker { display: none; }
.ep-plans-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
  font-weight: 600;
}
.ep-plans-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
  padding: 8px;
  background: var(--bg3);
  border-radius: 7px;
}
.ep-plan-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 5px;
  color: var(--text);
  text-decoration: none;
}
.ep-plan-row:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); text-decoration: none; }
.ep-phone {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 6px;
}

/* ── Handover Form ────────────────────────────────────────────── */
.ev-check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 7px;
  background: var(--bg3);
  cursor: pointer;
  transition: border-color .1s;
}
.ev-check-item:hover { border-color: var(--border2); }
.ev-check-item.disabled { opacity: .35; pointer-events: none; }
.ev-check-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px; height: 15px;
  flex-shrink: 0;
  margin-top: 2px;
}
.ev-check-label { flex: 1; }
.ev-check-name { font-size: 13.5px; font-weight: 700; }
.ev-check-meta { font-size: 12px; color: var(--text-muted); }

.mode-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.mode-tab {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg3);
  cursor: pointer;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.mode-tab.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg3));
  color: var(--accent);
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-user  { display: none; }
  .main { padding: 14px 12px 50px; }
  .page-header { gap: 12px; }
  .form-card { padding: 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .ev-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

@media (max-width: 480px) {
  .ev-grid { grid-template-columns: repeat(2, 1fr); }
  .photo-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Login Page ───────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
}
.login-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px;
  width: 100%;
  max-width: 380px;
}
.login-title {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.login-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 28px; }

/* ── Misc ─────────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-sm    { font-size: 12.5px; }
.mt-1  { margin-top:  6px; }
.mt-2  { margin-top: 12px; }
.mt-3  { margin-top: 20px; }
.mb-2  { margin-bottom: 12px; }
.mb-3  { margin-bottom: 20px; }
.gap-2 { gap: 8px; }
.flex  { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
