/* ==========================================================================
   Copnet – Design-System
   Ein Stylesheet für Login, Desktop, Fenster und alle Apps.
   ========================================================================== */

/* ---------- 1. Design-Tokens ---------- */
:root {
  color-scheme: dark;

  /* Flächen: von hinten (Hintergrund) nach vorne (erhöht) */
  --bg: #070b14;
  --surface-0: #0c1220;
  --surface-1: #111a2b;
  --surface-2: #162236;
  --surface-3: #1c2a42;
  --surface-hover: #1f2e48;

  /* Linien */
  --line: rgba(148, 170, 210, 0.14);
  --line-strong: rgba(148, 170, 210, 0.26);

  /* Text */
  --text: #e8eef9;
  --text-2: #b4c1d8;
  --muted: #8193b0;

  /* Marke & Status */
  --accent: #4f8cff;
  --accent-hover: #6a9dff;
  --accent-soft: rgba(79, 140, 255, 0.14);
  --accent-ring: rgba(79, 140, 255, 0.45);
  --success: #2fca7f;
  --success-soft: rgba(47, 202, 127, 0.14);
  --warning: #f5a524;
  --warning-soft: rgba(245, 165, 36, 0.15);
  --danger: #f2555a;
  --danger-hover: #ff6a6f;
  --danger-soft: rgba(242, 85, 90, 0.14);

  /* Form */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --control-h: 38px;
  --control-h-sm: 32px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.55);

  --taskbar-h: 64px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  /* App-Farben (Desktop-Kacheln, Fenster-Icons, Taskleiste) */
  --app-color: var(--accent);
}

[data-app="akten"] { --app-color: #4f8cff; }
[data-app="dispatch"] { --app-color: #f2555a; }
[data-app="reports"] { --app-color: #9b6bff; }
[data-app="vehicles"] { --app-color: #f5a524; }
[data-app="calendar"] { --app-color: #2fca7f; }
[data-app="lawbook"] { --app-color: #14b8a6; }
[data-app="templates"] { --app-color: #7c8db0; }
[data-app="users"] { --app-color: #22b8e6; }
[data-app="settings"] { --app-color: #94a3b8; }
[data-app="announcements"] { --app-color: #f97360; }
[data-app="mail"] { --app-color: #3aa0ff; }
[data-app="investigations"] { --app-color: #6366f1; }
[data-app="evidence"] { --app-color: #ec4899; }

/* ---------- 2. Basis ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}

h1,
h2,
h3,
h4 {
  margin: 0;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--text);
}

input,
select,
textarea,
button {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--accent-ring);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(148, 170, 210, 0.2);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 170, 210, 0.35);
  background-clip: padding-box;
  border: 2px solid transparent;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 3. Hilfsklassen ---------- */
.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12.5px;
}

.tiny {
  font-size: 11.5px;
}

.strong {
  font-weight: 600;
  color: var(--text);
}

.title {
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
}

.hint {
  font-size: 12.5px;
  color: var(--muted);
}

.warn {
  font-size: 12.5px;
  color: var(--warning);
}

.screen {
  position: relative;
  height: 100vh;
}

/* ---------- 4. Bedienelemente ---------- */

/* Primärer Button: die eine Hauptaktion pro Bereich */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--control-h);
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.12) inset, 0 6px 16px rgba(79, 140, 255, 0.25);
}

.primary-btn:hover {
  background: var(--accent-hover);
}

.primary-btn:active {
  transform: translateY(1px);
}

.primary-btn.danger {
  background: var(--danger);
  box-shadow: 0 6px 16px rgba(242, 85, 90, 0.25);
}

.primary-btn.danger:hover {
  background: var(--danger-hover);
}

.primary-btn:disabled,
.tiny-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* Sekundärer Button */
.tiny-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--control-h-sm);
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tiny-btn:hover {
  background: var(--surface-hover);
  border-color: rgba(148, 170, 210, 0.38);
}

.tiny-btn:active {
  transform: translateY(1px);
}

.tiny-btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}

.tiny-btn.ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.tiny-btn.danger {
  color: var(--danger);
  border-color: rgba(242, 85, 90, 0.4);
  background: transparent;
}

.tiny-btn.danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.tiny-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #cfe0ff;
}

/* Icon-Button (quadratisch) */
.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: var(--control-h-sm);
  height: var(--control-h-sm);
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text);
}

/* Eingabefelder */
input:where(:not([type="checkbox"]):not([type="radio"])),
:where(select, textarea) {
  width: 100%;
  min-height: var(--control-h);
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background-color: var(--surface-0);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

input::placeholder,
textarea::placeholder {
  color: #5f7091;
}

input:where(:not([type="checkbox"]):not([type="radio"])):hover,
select:hover,
textarea:hover {
  border-color: rgba(148, 170, 210, 0.4);
}

input:where(:not([type="checkbox"]):not([type="radio"])):focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
  background-color: var(--surface-1);
}

input[readonly] {
  background-color: var(--surface-2);
  font-family: var(--font-mono);
}

select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238193b0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

select option {
  background: var(--surface-1);
  color: var(--text);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  filter: invert(0.75);
  cursor: pointer;
}

.inline-check,
.remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
}

/* Formular-Aufbau: Label über Feld */
.field-stack {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}

.field-stack .label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.form-row + .form-row,
.form-row + .field-stack,
.field-stack + .form-row,
.panel > .field-stack + .field-stack {
  margin-top: 12px;
}

/* Rückmeldungen */
.form-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(242, 85, 90, 0.35);
  background: var(--danger-soft);
  color: #ffb4b6;
  font-size: 13px;
  font-weight: 500;
}

.form-hint::before {
  content: "!";
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.form-hint.success {
  border-color: rgba(47, 202, 127, 0.35);
  background: var(--success-soft);
  color: #9ff0c6;
}

.form-hint.success::before {
  content: "✓";
  background: var(--success);
}

.form-hint.info {
  border-color: rgba(79, 140, 255, 0.35);
  background: var(--accent-soft);
  color: #bcd3ff;
}

.form-hint.info::before {
  content: "i";
  background: var(--accent);
}

/* ---------- 5. Badges & Chips ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.pill.small {
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
}

.pill.tiny {
  height: 20px;
  padding: 0 7px;
  font-size: 11px;
}

.pill.ghost {
  background: transparent;
}

.pill.success {
  border-color: rgba(47, 202, 127, 0.35);
  background: var(--success-soft);
  color: #8ce9b8;
}

.pill.danger-soft {
  border-color: rgba(242, 85, 90, 0.35);
  background: var(--danger-soft);
  color: #ff9ea1;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: currentColor;
}

.status.good {
  color: var(--success);
}

.status.bad {
  color: var(--danger);
}

.law-chips,
.adjust-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.law-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
}

.law-chip.adjust {
  background: var(--warning-soft);
  color: #ffd38a;
}

/* ---------- 6. Leere Zustände ---------- */
.empty-row,
.case-empty,
.report-empty-state,
.vehicle-empty,
.dispatch-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 32px 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-row {
  padding: 20px;
}

/* ---------- 7. Login ---------- */
#login-screen {
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(79, 140, 255, 0.16), transparent 60%),
    radial-gradient(700px 500px at 90% 90%, rgba(155, 107, 255, 0.1), transparent 60%),
    var(--bg);
}

#login-screen.hidden {
  display: none !important;
}

.login-bg {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-1);
  box-shadow: var(--shadow-lg);
  animation: rise 0.35s ease;
}

.login-header {
  display: grid;
  gap: 6px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #7b5cff);
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 8px 20px rgba(79, 140, 255, 0.35);
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.08em;
}

.login-header h1 {
  font-size: 24px;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 6px;
}

.login-form label > span:first-child {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.login-form .remember {
  display: inline-flex;
}

.login-form .remember > span {
  font-size: 13px;
  font-weight: 500;
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 92px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--text);
}

.login-actions {
  display: grid;
  gap: 14px;
}

.login-actions .primary-btn {
  width: 100%;
  height: 42px;
  font-size: 15px;
}

.login-note {
  display: grid;
  gap: 4px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.info-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-0);
}

.info-card .title {
  font-size: 13.5px;
}

.info-card p {
  font-size: 12.5px;
}

/* ---------- 8. Desktop ---------- */
#desktop-screen {
  display: grid;
  grid-template-rows: minmax(0, 1fr) var(--taskbar-h);
  height: 100vh;
  overflow: hidden;
}

.wallpaper {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1100px 600px at 10% 0%, rgba(79, 140, 255, 0.14), transparent 60%),
    radial-gradient(900px 600px at 100% 100%, rgba(155, 107, 255, 0.08), transparent 60%),
    linear-gradient(180deg, #0a1020, var(--bg));
}

.wallpaper::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(148, 170, 210, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 85%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.8), transparent 85%);
}

.desktop-overlay {
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow: auto;
  padding: 28px 32px;
}

.desktop-widgets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  max-width: 900px;
}

.widget-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(17, 26, 43, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  text-align: left;
  color: inherit;
}

button.widget-card {
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

button.widget-card:hover {
  border-color: var(--line-strong);
  background: rgba(22, 34, 54, 0.9);
}

.widget-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #7b5cff);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
}

.widget-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  background: var(--surface-3);
  font-size: 22px;
}

.widget-body {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.widget-body .title {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.widget-body .value {
  font-size: 17px;
  font-weight: 650;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-body .meta {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duty-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--muted);
  vertical-align: 1px;
}

.duty-dot.on {
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.duty-dot.off {
  background: var(--warning);
  box-shadow: 0 0 0 4px var(--warning-soft);
}

.widget-card.has-alert {
  border-color: rgba(242, 85, 90, 0.55);
}

.widget-card.has-alert .widget-icon {
  background: var(--danger-soft);
}

.desktop-section-title {
  margin: 28px 0 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.desktop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 124px);
  gap: 8px;
}

.desktop-icon {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: none;
  color: inherit;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
  animation: rise 0.3s ease backwards;
  animation-delay: calc(var(--i, 0) * 0.03s);
}

.desktop-icon:hover {
  background: rgba(22, 34, 54, 0.75);
  border-color: var(--line);
}

.desktop-icon:hover .icon {
  transform: translateY(-2px);
}

.desktop-icon .icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  font-size: 26px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 55%),
    var(--app-color);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--app-color) 35%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease;
}

.desktop-icon .label {
  max-width: 100%;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  text-align: center;
  color: var(--text);
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* ---------- 9. Taskleiste & Startmenü ---------- */
.taskbar {
  position: relative;
  z-index: 50;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  height: var(--taskbar-h);
  padding: 0 14px;
  border-top: 1px solid var(--line);
  background: rgba(10, 16, 28, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.taskbar-left,
.taskbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.taskbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 14px 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.taskbar-btn:hover,
.taskbar-btn[aria-expanded="true"] {
  background: var(--surface-hover);
  border-color: var(--line-strong);
}

/* 2x2-Kacheln als App-Symbol */
.start-icon {
  position: relative;
  width: 16px;
  height: 16px;
}

.start-icon span {
  display: none;
}

.start-icon::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 9px 0 0 #9b6bff, 0 9px 0 #2fca7f, 9px 9px 0 #f5a524;
}

.taskbar-center {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.taskbar-center::-webkit-scrollbar {
  display: none;
}

.taskbar-app {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 190px;
  height: 42px;
  padding: 0 12px 0 6px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.taskbar-app:hover {
  background: var(--surface-2);
  color: var(--text);
}

.taskbar-app .mini-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--app-color);
  font-size: 15px;
}

.taskbar-app .taskbar-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.taskbar-app::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 6px;
  height: 3px;
  border-radius: 999px;
  background: var(--muted);
  transform: translateX(-50%);
  transition: width 0.2s ease, background 0.2s ease;
}

.taskbar-app.active {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

.taskbar-app.active::after {
  width: 18px;
  background: var(--accent);
}

.task-info {
  display: grid;
  justify-items: end;
  line-height: 1.2;
  color: var(--muted);
  font-size: 12px;
}

.task-info .strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.start-menu {
  position: fixed;
  left: 14px;
  bottom: calc(var(--taskbar-h) + 10px);
  z-index: 60;
  display: grid;
  gap: 14px;
  width: min(560px, calc(100vw - 28px));
  max-height: calc(100vh - var(--taskbar-h) - 30px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background: var(--surface-1);
  box-shadow: var(--shadow-lg);
  animation: rise 0.18s ease;
}

.start-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.start-user {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.start-user .widget-avatar {
  width: 40px;
  height: 40px;
  font-size: 14px;
}

.start-sync-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.start-sync-row .form-hint {
  margin: 0;
}

.start-apps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.start-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.start-item:hover {
  background: var(--surface-2);
  border-color: var(--line);
}

.start-item .mini-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--app-color);
  font-size: 18px;
}

.start-item .text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.start-item .name {
  font-weight: 600;
  color: var(--text);
}

.start-item .muted {
  font-size: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.start-footer {
  display: flex;
  justify-content: flex-end;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.start-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: var(--control-h-sm);
  padding: 0 14px;
  border: 1px solid rgba(242, 85, 90, 0.4);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--danger);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.start-logout-btn:hover {
  background: var(--danger-soft);
}

/* ---------- 10. Fenster ---------- */
#window-layer {
  position: fixed;
  inset: 0 0 var(--taskbar-h) 0;
  z-index: 10;
  pointer-events: none;
}

.window {
  position: absolute;
  display: flex;
  flex-direction: column;
  min-width: 360px;
  min-height: 240px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-0);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  pointer-events: auto;
  animation: windowIn 0.18s ease;
}

.window.active {
  border-color: rgba(148, 170, 210, 0.34);
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.25), var(--shadow-lg);
}

.window.maximized {
  border-radius: var(--radius);
}

.window-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  height: 46px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
  cursor: grab;
  user-select: none;
}

.window-header:active {
  cursor: grabbing;
}

.window.maximized .window-header {
  cursor: default;
}

.window-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 600;
  color: var(--text);
}

.window-title span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.window-title .mini-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--app-color);
  font-size: 14px;
}

.window:not(.active) .window-title {
  color: var(--text-2);
}

.window-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.window-actions .icon-btn {
  width: 32px;
  height: 30px;
  font-size: 15px;
}

.window-actions [data-close]:hover,
.window-actions .utility-window-close:hover {
  background: var(--danger);
  color: #fff;
}

.window-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 20px;
  color: var(--text-2);
}

.window-body > h3 {
  font-size: 20px;
}

.window-body > h3 + .muted {
  margin: 4px 0 18px;
}

.resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 50%, var(--line-strong) 50%, var(--line-strong) 58%, transparent 58%, transparent 70%, var(--line-strong) 70%, var(--line-strong) 78%, transparent 78%);
}

.window.maximized .resize-handle {
  display: none;
}

/* ---------- 11. Dialoge ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(640px, calc(100vw - 40px));
  max-height: calc(100vh - var(--taskbar-h) - 40px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-card.wide {
  width: min(1100px, calc(100vw - 24px));
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.modal-title {
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
}

.modal-card > form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}

.modal-body {
  display: grid;
  align-content: start;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
}

.modal-body .hint-text {
  font-size: 12.5px;
  color: var(--muted);
}

/* Abschnittsüberschriften in Dialogen */
.modal-body > .pill.small.ghost,
.entry-section > .pill.small.ghost,
.entry-split-main > .pill.small.ghost,
.entry-split-side > .pill.small.ghost {
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-1);
}

.modal-actions .form-hint {
  flex: 1 1 100%;
  order: 3;
  margin: 0;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Schwebende Dialoge (eigene Taskleisten-Einträge) */
.modal.floating-modal {
  display: block;
  padding: 0;
  pointer-events: none;
}

.modal.floating-modal.hidden {
  display: none !important;
}

.modal.floating-modal .modal-backdrop {
  display: none;
}

.modal.floating-modal .modal-card {
  position: fixed;
  left: 24px;
  top: 24px;
  width: min(var(--floating-modal-width, 760px), calc(100vw - 32px));
  min-width: min(var(--floating-modal-min-width, 360px), calc(100vw - 32px));
  max-width: min(var(--floating-modal-max-width, 1180px), calc(100vw - 32px));
  max-height: calc(100vh - var(--taskbar-h) - 28px);
  pointer-events: auto;
  box-shadow: 0 0 0 1px rgba(79, 140, 255, 0.2), var(--shadow-lg);
  animation: windowIn 0.18s ease;
}

.modal.floating-modal .modal-head {
  cursor: grab;
  user-select: none;
}

.modal.floating-modal .modal-head .window-actions {
  margin-left: auto;
}

.modal.floating-modal .modal-head > .icon-btn[data-close],
.modal.floating-modal .modal-head > .icon-btn.entry-close {
  order: 10;
}

/* ---------- 12. App-Grundlayout (Liste + Detail) ---------- */
.case-shell {
  display: grid;
  gap: 18px;
}

.case-main {
  display: grid;
  gap: 18px;
}

.case-main > br {
  display: none;
}

.case-header,
.calendar-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.case-header .title,
.calendar-top .title {
  font-size: 20px;
}

.case-header .muted.small,
.calendar-top .muted.small {
  margin-top: 2px;
}

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

.case-actions input {
  width: 300px;
  padding-left: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%238193b0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px center;
}

.case-actions .icon-btn {
  width: var(--control-h);
  height: var(--control-h);
  border-color: var(--line-strong);
}

/* Kennzahlen sind im neuen Layout ausgeblendet (Info steht im Detail) */
.case-metrics {
  display: none !important;
}

.case-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.case-shell:not(.detail-open) .case-detail-view,
.case-shell.detail-open .case-header,
.case-shell.detail-open .case-list-view {
  display: none;
}

.case-list-view,
.case-detail-view {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  overflow: hidden;
}

.case-detail-view {
  padding: 22px;
}

/* Tabellen-Listen (Akten, Berichte, Fahrzeuge, Dispatch) */
.case-table-panel {
  display: grid;
}

.case-table-head,
.case-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) 1fr 1fr 1fr;
  align-items: center;
  gap: 12px;
}

.case-table-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.case-table-body,
.report-table-body,
.vehicle-table-body,
.dispatch-table-body {
  display: grid;
}

.case-row,
.report-row,
.vehicle-row,
.dispatch-row {
  position: relative;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.12s ease;
}

.case-row:last-child,
.report-row:last-child,
.vehicle-row:last-child,
.dispatch-row:last-child {
  border-bottom: 0;
}

.case-row:hover,
.report-row:hover,
.vehicle-row:hover,
.dispatch-row:hover {
  background: var(--surface-2);
}

.case-row.active,
.report-row.active,
.vehicle-row.active,
.dispatch-row.active {
  background: var(--accent-soft);
}

.case-row::before,
.report-row::before,
.vehicle-row::before,
.dispatch-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
}

.case-row.active::before,
.report-row.active::before,
.vehicle-row.active::before,
.dispatch-row.active::before {
  background: var(--accent);
}

.case-row.wanted::before,
.vehicle-row.stolen::before,
.vehicle-row.wanted::before {
  background: var(--danger);
}

.case-row .strong,
.report-row .strong,
.vehicle-row .strong,
.dispatch-row .strong {
  font-size: 14.5px;
}

.meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.case-table-body > .empty-row,
.report-table-body > .empty-row,
.vehicle-table-body > .empty-row,
.dispatch-table-body > .empty-row {
  margin: 16px;
}

.case-table-panel > .form-hint {
  margin: 12px 16px;
}

.report-table-head,
.report-row,
.dispatch-table-head,
.dispatch-row {
  grid-template-columns: minmax(0, 1fr) 150px;
}

.report-row,
.dispatch-row,
.vehicle-row {
  display: grid;
  align-items: center;
  gap: 12px;
}

.vehicle-table-head,
.vehicle-row {
  grid-template-columns: minmax(180px, 1.1fr) minmax(160px, 1fr) minmax(120px, 0.7fr);
}

.cell.right,
.report-row .cell.right,
.dispatch-row .cell.right {
  text-align: right;
}

.preview {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Detail-Kopf */
.case-full-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

.case-full-head .title {
  font-size: 22px;
}

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

.full-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.back-btn {
  margin-bottom: 14px;
}

.case-detail-content,
.report-detail,
.vehicle-detail,
.dispatch-detail {
  display: grid;
  gap: 18px;
}

.case-detail-content > .case-full-head,
.report-detail > .case-full-head,
.vehicle-detail > .case-full-head,
.dispatch-detail > .case-full-head {
  margin-bottom: 0;
}

/* Personendaten */
.bio-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-0);
}

.avatar-photo {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border-radius: var(--radius);
  background-color: var(--surface-3);
  background-size: cover;
  background-position: center;
  color: var(--text-2);
  font-size: 34px;
  font-weight: 700;
}

.avatar-photo.has-image {
  color: transparent;
}

.bio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px 18px;
  align-content: center;
}

.bio-grid > div > div:last-child {
  color: var(--text);
  font-weight: 500;
}

/* Einträge (Zeitstrahl) */
.entries-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.case-entries {
  position: relative;
  display: grid;
  gap: 12px;
  padding-left: 22px;
}

.case-entries::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: var(--line-strong);
}

.case-entries > .empty-row {
  margin-left: -22px;
}

.entry-line {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-0);
}

.case-entries .entry-line::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 18px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--surface-1);
  border: 3px solid var(--accent);
}

.entry-line.is-wanted {
  border-color: rgba(242, 85, 90, 0.45);
  background: linear-gradient(180deg, rgba(242, 85, 90, 0.08), transparent), var(--surface-0);
}

.case-entries .entry-line.is-wanted::before {
  border-color: var(--danger);
}

.entry-line.is-redacted {
  border-style: dashed;
}

.case-entries .entry-line.is-redacted::before {
  border-color: var(--muted);
}

.entry-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.entry-main .strong {
  font-size: 15px;
}

.entry-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.entry-content {
  color: var(--text);
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.entry-content p {
  margin: 0 0 6px;
}

.entry-line.is-redacted .entry-content {
  color: var(--muted);
  font-style: italic;
}

.entry-meta {
  display: grid;
  gap: 8px;
}

.change-log {
  display: grid;
  gap: 4px;
}

.change-row {
  padding: 5px 10px;
  border-left: 2px solid var(--line-strong);
  color: var(--muted);
  font-size: 12px;
}

.change-row .log-name,
.change-row .log-action {
  color: var(--text-2);
}

.change-row .log-name {
  font-weight: 600;
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.entry-actions:empty {
  display: none;
}

/* Eintrags-Dialog */
.entry-stack {
  gap: 22px;
}

.entry-section {
  display: grid;
  gap: 10px;
}

.entry-split {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.8fr);
  gap: 20px;
  align-items: start;
}

.entry-split-main,
.entry-split-side {
  display: grid;
  gap: 10px;
}

.adjust-box {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-0);
}

.adjust-box .form-row {
  grid-template-columns: 1fr;
}

.totals {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.template-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.template-select-row select {
  flex: 1 1 auto;
}

/* Paragrafen-Auswahl */
.law-search {
  padding-left: 34px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%238193b0' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 11px center;
}

.law-accordion {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow-y: auto;
  padding: 2px;
}

.law-book-accordion {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-0);
  overflow: hidden;
}

.law-book-accordion.open {
  border-color: var(--line-strong);
}

.law-book-accordion .accordion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
}

.law-book-accordion .accordion-body {
  display: grid;
  gap: 4px;
  padding: 0 8px 8px;
}

.law-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}

.law-row:hover {
  background: var(--surface-2);
}

.law-row:has(input:checked) {
  background: var(--accent-soft);
}

.law-row input[type="checkbox"] {
  margin-top: 3px;
}

.law-row .strong {
  font-size: 13.5px;
}

/* ---------- 13. Panels & klassische Tabellen ---------- */
.admin-grid,
.templates-shell,
.settings-shell,
.calendar-shell {
  display: grid;
  gap: 16px;
}

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}

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

.actions-row > input {
  flex: 1 1 200px;
  width: auto;
}

.card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-0);
  color: var(--text);
  line-height: 1.6;
}

.list {
  display: grid;
  gap: 10px;
}

.table,
.template-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-0);
}

.table-head,
.table-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) 1fr 1fr 0.8fr minmax(220px, 1.4fr);
  align-items: center;
}

.template-head,
.template-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.8fr) 0.9fr 0.7fr minmax(180px, 1fr);
  align-items: center;
}

.table-head,
.template-head {
  background: var(--surface-2);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-row,
.template-row {
  border-top: 1px solid var(--line);
  transition: background 0.12s ease;
}

.table-row:hover,
.template-row:hover {
  background: var(--surface-1);
}

.cell {
  min-width: 0;
  padding: 10px 14px;
}

.table-head .cell,
.template-head .cell {
  padding: 10px 14px;
}

.cell.actions,
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.table-head .cell.actions,
.template-head .cell:last-child {
  justify-content: flex-end;
  text-align: right;
}

.table-row .cell.actions,
.template-row .cell.actions {
  justify-content: flex-end;
}

.group-panel .table-head,
.group-panel .table-row {
  grid-template-columns: minmax(180px, 1.5fr) 0.8fr 1fr minmax(180px, 1fr);
}

.scrollable {
  max-height: 440px;
  overflow-y: auto;
}

.user-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.user-system-meta {
  margin-top: 6px;
}

/* ---------- 14. Gesetzbuch ---------- */
.law-grid {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.law-books,
.law-paragraphs {
  display: grid;
  gap: 6px;
  max-height: 520px;
  overflow-y: auto;
}

.list-item {
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.list-item:hover {
  background: var(--surface-2);
}

.list-item.active {
  background: var(--accent-soft);
  border-color: rgba(79, 140, 255, 0.4);
}

.law-book-create,
.law-paragraph-create {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.law-book-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.accordion {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-0);
}

.accordion > .accordion-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.accordion > .accordion-body {
  display: grid;
  gap: 4px;
  padding: 0 14px 12px;
}

.law-paragraphs .table-row {
  grid-template-columns: minmax(140px, 1.2fr) 0.7fr 1.3fr 0.7fr 0.7fr auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-0);
}

.law-paragraphs .table-row .cell {
  padding: 8px 6px;
}

.law-paragraphs input {
  min-height: var(--control-h-sm) !important;
  padding: 4px 8px !important;
}

/* ---------- 15. Kalender ---------- */
.cal-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-month-label {
  min-width: 150px;
  font-weight: 650;
  font-size: 15px;
  color: var(--text);
  text-align: center;
  text-transform: capitalize;
}

.calendar-grid-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-day {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 78px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-0);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.cal-day:hover {
  background: var(--surface-2);
}

.cal-day.muted {
  opacity: 0.45;
}

.cal-day .day-number {
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.cal-day.today .day-number {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
}

.cal-day.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.day-dots {
  display: none;
}

.day-labels {
  display: grid;
  gap: 3px;
}

.day-label-chip {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--success-soft);
  color: #8ce9b8;
  font-size: 11px;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.day-more {
  padding-left: 2px;
  color: var(--muted);
  font-size: 11px;
}

.calendar-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr);
  gap: 16px;
  align-items: start;
  scroll-margin-top: 12px;
  border-radius: var(--radius-lg);
}

.calendar-detail.single {
  grid-template-columns: minmax(0, 1fr);
}

/* kurzes Aufleuchten nach Klick auf einen Tag, damit man sieht, wo es weitergeht */
.calendar-detail.flash > .panel {
  animation: calFlash 1.2s ease;
}

@keyframes calFlash {
  0% {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
  }
  100% {
    border-color: var(--line);
    box-shadow: none;
  }
}

.cal-create {
  display: grid;
  gap: 14px;
}

.cal-create > .primary-btn {
  justify-self: start;
}

.cal-event.is-signed {
  border-color: rgba(47, 202, 127, 0.45);
}

.cal-event-info {
  color: var(--text-2);
  white-space: pre-wrap;
}

.cal-event-meta {
  display: grid;
  grid-template-columns: minmax(120px, 0.6fr) minmax(0, 1.4fr);
  gap: 16px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-1);
}

.cal-event-meta .label {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cal-visibility {
  color: var(--text);
  font-weight: 500;
}

.attendee-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attendee-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 12.5px;
}

.attendee-chip.me {
  background: var(--success-soft);
  color: #8ce9b8;
  font-weight: 600;
}

/* ---------- 16. Systemeinstellungen ---------- */
.settings-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-home,
.settings-page {
  display: grid;
  gap: 16px;
}

.settings-home > div:first-child p,
.settings-page > div:first-child p {
  margin-top: 4px;
}

.settings-category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.settings-category-card {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.settings-category-card:hover:not(:disabled) {
  border-color: rgba(79, 140, 255, 0.45);
  background: var(--surface-2);
}

.settings-category-card:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.settings-category-title .pill {
  margin-left: 6px;
  vertical-align: 2px;
}

.settings-category-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 6px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: #bcd3ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.settings-category-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
}

.settings-category-text {
  color: var(--muted);
  font-size: 13px;
}

.settings-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.system-settings-form,
.settings-stack {
  display: grid;
  gap: 14px;
}

.settings-section-title {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
}

.settings-code {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.settings-overrides summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  cursor: pointer;
}

.settings-overrides summary::-webkit-details-marker {
  display: none;
}

.settings-overrides summary::after {
  content: "▾";
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-2);
  transition: transform 0.2s ease;
}

.settings-overrides[open] summary {
  margin-bottom: 12px;
}

.settings-overrides[open] summary::after {
  transform: rotate(180deg);
}

.settings-overrides-subtitle,
.settings-override-note {
  margin-bottom: 12px;
}

.settings-sync-block + .settings-sync-block {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.settings-actions {
  position: sticky;
  bottom: -20px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.settings-actions .form-hint {
  flex: 1 1 auto;
  margin: 0;
}

.settings-actions .form-hint.hidden {
  display: block !important;
  visibility: hidden;
}

.settings-placeholder {
  min-height: 160px;
}

/* ---------- 17. Benutzer-Dialoge ---------- */
.password-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.password-row input {
  flex: 1 1 auto;
}

.dn-prefix-label {
  height: var(--control-h) !important;
  font-family: var(--font-mono);
}

.player-list {
  display: grid;
  gap: 2px;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-0);
}

.player-list > .muted {
  padding: 10px;
}

.player-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.player-row:hover {
  background: var(--surface-2);
}

.player-row.active {
  background: var(--accent-soft);
  border-color: rgba(79, 140, 255, 0.4);
}

/* Technische Diagnosezeile nur bei Bedarf (z. B. per Entwicklerkonsole) einblenden */
.player-debug {
  display: none;
  font-size: 11px;
}

.player-link-btn {
  justify-self: start;
}

.perm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.perm-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.perm-chip::before {
  content: "+";
  font-weight: 700;
  color: var(--muted);
}

.perm-chip:hover {
  background: var(--surface-2);
}

.perm-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #cfe0ff;
}

.perm-chip.active::before {
  content: "✓";
  color: var(--accent);
}

/* Rechte-Editor: Rechte pro App */
.perm-editor {
  display: grid;
  gap: 10px;
}

.perm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

:where(.perm-toolbar) .perm-search {
  flex: 1 1 220px;
}

.perm-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
}

:where(.perm-copy) .perm-copy-select {
  flex: 0 1 280px;
  width: auto;
}

.perm-copy-hint {
  flex-basis: 100%;
}

.perm-copy-hint:empty {
  display: none;
}

.perm-admin-note {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 13px;
}

.perm-editor.is-admin .perm-apps {
  opacity: 0.4;
  pointer-events: none;
}

.perm-apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  align-items: start;
}

.perm-app {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-0);
  transition: border-color 0.15s ease;
}

.perm-app.has-perms {
  border-color: rgba(79, 140, 255, 0.45);
}

.perm-app-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.perm-app-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.perm-app-icon {
  font-size: 16px;
  line-height: 1;
}

.perm-app-note {
  margin-top: -2px;
}

.perm-list {
  display: grid;
  gap: 2px;
}

.perm-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 6px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}

.perm-item:hover {
  background-color: var(--surface-hover);
}

.perm-item input,
.perm-app-toggle input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.perm-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.perm-label {
  color: var(--text);
  font-size: 13px;
}

.perm-hint,
.perm-req {
  color: var(--muted);
  font-size: 11.5px;
}

.perm-req {
  font-style: italic;
}

.perm-app-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.perm-app-chip {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-0);
  color: var(--text-2);
  font-size: 11.5px;
  white-space: nowrap;
}

.owner-lock-note {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--warning-soft);
  color: #ffd38a !important;
}

/* ---------- 18. Dispatch ---------- */
.dispatch-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.dispatch-tabs .tiny-btn {
  border-color: transparent;
  background: transparent;
  color: var(--text-2);
}

.dispatch-tabs .tiny-btn.active {
  background: var(--accent-soft);
  border-color: rgba(79, 140, 255, 0.4);
  color: #cfe0ff;
}

.dispatch-table-head {
  order: -1;
}

.dispatch-locked {
  display: grid;
  justify-items: start;
  gap: 10px;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
}

.dispatch-detail-card {
  display: grid;
  gap: 12px;
}

.dispatch-message {
  white-space: pre-wrap;
}

.dispatch-coords {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
}

.dispatch-ack {
  display: grid;
  gap: 4px;
}

.dispatch-alert {
  position: fixed;
  right: 18px;
  bottom: calc(var(--taskbar-h) + 14px);
  z-index: 55;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border: 1px solid rgba(242, 85, 90, 0.55);
  border-radius: 999px;
  background: var(--surface-1);
  box-shadow: var(--shadow);
  color: var(--text);
  cursor: pointer;
}

.dispatch-alert .label {
  font-size: 12.5px;
  font-weight: 600;
}

.dispatch-alert .count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.dispatch-alert.pulse {
  animation: pulse 0.8s ease;
}

/* ---------- 19. Berichte & Fahrzeuge ---------- */
.report-content {
  min-height: 240px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-0);
  color: var(--text);
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.report-content h1,
.report-content h2,
.report-content h3 {
  margin: 12px 0 8px;
}

.report-content ul,
.report-content ol {
  padding-left: 22px;
}

.report-content a {
  color: var(--accent-hover);
}

.report-content.redacted {
  color: var(--muted);
  font-style: italic;
}

.vehicle-detail-form {
  display: grid;
  gap: 14px;
}

.vehicle-detail-form textarea {
  min-height: 130px;
}

.vehicle-detail-form .modal-actions {
  padding: 0;
  border: 0;
  background: none;
}

/* ---------- 19b. Zähler für Ungelesenes ---------- */
.desktop-icon .icon,
.start-item .mini-icon,
.taskbar-app .mini-icon {
  position: relative;
}

.app-badge {
  position: absolute;
  top: -6px;
  right: -8px;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border: 2px solid var(--surface-0);
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.taskbar-app .app-badge,
.start-item .app-badge {
  top: -5px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  font-size: 10px;
}

#news-widget.has-news {
  border-color: rgba(79, 140, 255, 0.55);
}

#news-widget.has-news .widget-icon {
  background: var(--accent-soft);
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-hover);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.small-avatar {
  width: 36px !important;
  height: 36px !important;
  font-size: 13px !important;
}

/* ---------- 19c. Ankündigungen ---------- */
.ann-create-body {
  padding: 0;
}

.ann-list {
  display: grid;
  gap: 12px;
}

.announcement {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
}

.announcement.is-new {
  border-color: rgba(79, 140, 255, 0.55);
  background: linear-gradient(180deg, rgba(79, 140, 255, 0.08), transparent 60%), var(--surface-1);
}

.announcement.is-new::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.announcement.is-pinned {
  border-color: rgba(245, 165, 36, 0.45);
}

.announcement-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.announcement-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
}

.new-pill {
  border-color: rgba(79, 140, 255, 0.5);
  background: var(--accent-soft);
  color: #cfe0ff;
}

.announcement-body {
  color: var(--text);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- 19d. E-Mail ---------- */
.window[data-app="mail"] .window-body {
  padding: 0;
  overflow: hidden;
}

.mail-shell {
  position: relative;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  height: 100%;
}

.mail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface-1);
}

.mail-sidebar .mail-new {
  width: 100%;
}

.mail-folders {
  display: grid;
  gap: 2px;
}

.mail-folder {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-2);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.mail-folder:hover {
  background: var(--surface-2);
  color: var(--text);
}

.mail-folder.active {
  background: var(--accent-soft);
  color: #cfe0ff;
  font-weight: 600;
}

.mail-inbox-count:not(:empty) {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.mail-address {
  display: grid;
  gap: 2px;
  margin-top: auto;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-0);
}

.mail-me {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.mail-main {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  min-height: 0;
}

.mail-list-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--line);
}

.mail-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 8px 14px;
  border-bottom: 1px solid var(--line);
}

.mail-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.mail-list > .empty-row {
  margin: 14px;
}

.mail-item {
  position: relative;
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 12px 14px 12px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
}

.mail-item:hover {
  background: var(--surface-2);
}

.mail-item.active {
  background: var(--accent-soft);
}

.mail-item.is-unread .mail-who,
.mail-item.is-unread .mail-subject {
  color: var(--text);
  font-weight: 700;
}

.mail-item.is-unread::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 17px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
}

.mail-item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.mail-who,
.mail-subject,
.mail-preview {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mail-subject {
  color: var(--text);
}

.mail-reader {
  min-height: 0;
  overflow-y: auto;
  padding: 22px 24px;
}

.mail-reader-empty {
  display: grid;
  place-items: center;
  height: 100%;
}

.mail-read-head {
  display: grid;
  gap: 10px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.mail-read-subject {
  font-size: 19px;
  font-weight: 650;
  color: var(--text);
}

.mail-from {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mail-recipients {
  font-size: 13px;
}

.mail-person {
  color: var(--text);
}

.mail-body {
  padding: 18px 0;
  color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mail-read-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.mail-lists-view {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
}

.mail-lists {
  display: grid;
  gap: 10px;
}

.list-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-1);
}

.list-form {
  display: grid;
  gap: 14px;
}

.list-members {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-0);
}

.member-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  color: var(--text);
  cursor: pointer;
}

.member-option:hover {
  background: var(--surface-2);
}

.member-option:has(input:checked) {
  background: var(--accent-soft);
}

.member-option .muted {
  margin-left: auto;
}

.address-input {
  display: flex;
  align-items: center;
  gap: 6px;
}

.address-input .muted {
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: nowrap;
}

.mail-shell > .mail-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 5;
  margin: 0;
  transform: translateX(-50%);
  box-shadow: var(--shadow);
}

/* Verfassen */
.compose-body {
  gap: 10px;
}

.compose-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.compose-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.compose-extra {
  display: grid;
  gap: 10px;
}

.compose-toggle-cc {
  justify-self: start;
  margin-left: 74px;
}

.compose-body textarea {
  min-height: 220px;
}

.recipient-field {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: var(--control-h);
  padding: 4px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-0);
  cursor: text;
}

.recipient-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.recipient-tokens {
  display: contents;
}

.recipient-field input {
  flex: 1 1 160px;
  width: auto !important;
  min-height: 28px !important;
  padding: 2px 4px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.recipient-token {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 4px 0 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text);
  font-size: 12.5px;
}

.recipient-token.is-list {
  background: rgba(155, 107, 255, 0.2);
}

.recipient-token button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}

.recipient-token button:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text);
}

.recipient-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  display: grid;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.recipient-option {
  display: grid;
  gap: 1px;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.recipient-option:hover,
.recipient-option.active {
  background: var(--accent-soft);
}

.recipient-empty {
  padding: 8px 10px;
}

/* ---------- 19e. Ermittlungen ---------- */
.status.closed {
  color: var(--muted);
}

.inv-description {
  white-space: pre-wrap;
}

.inv-columns {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: start;
}

.inv-participants {
  display: grid;
  gap: 14px;
}

.inv-role {
  display: grid;
  gap: 6px;
}

.inv-role-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-2);
}

.inv-person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-0);
}

.inv-none {
  padding: 4px 2px;
}

.inv-participant-add {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.inv-participant-add .tiny-btn[type="submit"] {
  justify-self: start;
}

.inv-entry-form {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.inv-entry-form .primary-btn {
  justify-self: start;
}

.inv-timeline {
  display: grid;
  gap: 10px;
}

.inv-entry.is-system {
  padding: 10px 14px;
  border-style: dashed;
  background: transparent;
}

.inv-entry.is-system .strong {
  color: var(--text-2);
  font-weight: 500;
}

.inv-entry-text {
  white-space: pre-wrap;
}

.icon-btn.confirm {
  background: var(--danger);
  color: #fff;
}

/* ---------- 19f. Beweise ---------- */
.evidence-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.evidence-panel.dragging {
  border-color: var(--accent);
  border-style: dashed;
  background: var(--accent-soft);
}

.evidence-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.evidence-upload-row {
  display: flex;
  gap: 8px;
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.evidence-grid > .empty-row {
  grid-column: 1 / -1;
}

.evidence-tile {
  position: relative;
  display: grid;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-0);
  overflow: hidden;
}

.evidence-thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background: var(--surface-3);
  cursor: zoom-in;
}

.evidence-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.evidence-thumb:hover img {
  transform: scale(1.04);
}

.evidence-source {
  position: absolute;
  left: 6px;
  top: 6px;
  background: rgba(7, 11, 20, 0.8);
}

.evidence-tile figcaption {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
}

.evidence-desc {
  color: var(--text);
  font-size: 13px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.evidence-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  background: rgba(7, 11, 20, 0.75);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.evidence-tile:hover .evidence-delete,
.evidence-delete:focus-visible,
.evidence-delete.confirm {
  opacity: 1;
}

.evidence-delete:hover,
.evidence-delete.confirm {
  background: var(--danger);
}

.evidence-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 6, 12, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: rise 0.15s ease;
}

.evidence-lightbox,
.evidence-picker {
  display: grid;
  gap: 12px;
  max-width: min(1100px, 100%);
  max-height: 100%;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-1);
  box-shadow: var(--shadow-lg);
}

.evidence-picker {
  width: min(820px, 100%);
  overflow-y: auto;
}

.evidence-lightbox img {
  max-width: 100%;
  max-height: calc(100vh - 170px);
  justify-self: center;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.evidence-lightbox-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.picker-grid .evidence-thumb {
  cursor: pointer;
}

/* Kleinigkeiten in den Einstellungen */
.setup-steps {
  display: grid;
  gap: 4px;
  margin: 0 0 14px;
  padding-left: 18px;
}

.settings-advanced {
  margin-top: 12px;
}

.settings-advanced summary {
  cursor: pointer;
}

.settings-advanced .field-stack {
  margin-top: 10px;
}

.evidence-status.ok {
  color: var(--success);
}

.feature-settings-form .action-buttons {
  margin-top: 14px;
}

@media (max-width: 1100px) {
  .inv-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .mail-shell {
    grid-template-columns: 1fr;
  }

  .mail-sidebar {
    flex-direction: row;
    flex-wrap: wrap;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .mail-main {
    grid-template-columns: 1fr;
  }
}

/* Fotos pro Eintrag (Akten-Einträge, Informationen im Ermittlungsverlauf) */
.entry-photos-slot:empty {
  display: none;
}

.entry-photos {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.entry-photos-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.entry-photo {
  position: relative;
  width: 72px;
  height: 54px;
}

.entry-photo-thumb {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-0);
  overflow: hidden;
  cursor: zoom-in;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.entry-photo-thumb:hover,
.entry-photo-thumb:focus-visible {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.entry-photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.entry-photo-delete {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  background: var(--surface-3);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.entry-photo:hover .entry-photo-delete,
.entry-photo-delete:focus-visible,
.entry-photo-delete.confirm {
  opacity: 1;
}

.entry-photo-delete:hover,
.entry-photo-delete.confirm {
  background: var(--danger);
}

.entry-photo-add {
  height: 54px;
  padding: 0 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.entry-photo-add:hover,
.entry-photo-add:focus-visible {
  border-color: var(--accent);
  color: var(--text);
  background-color: var(--accent-soft);
}

@media (hover: none) {
  .entry-photo-delete {
    opacity: 1;
  }
}

/* ---------- 19g. App „Beweise“ (Bibliothek, Freigaben, Auswahl) ---------- */
.ev-app {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  min-height: 0;
}

.ev-app.dragging::after {
  content: "Bilder hier ablegen zum Hochladen";
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: rgba(79, 140, 255, 0.12);
  color: var(--text);
  font-weight: 600;
  pointer-events: none;
}

.ev-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ev-scope {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-0);
}

.ev-scope-btn {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ev-scope-btn:hover {
  color: var(--text);
  background-color: var(--surface-hover);
}

.ev-scope-btn.active {
  background-color: var(--accent);
  color: #fff;
}

:where(.ev-filters) .ev-hours {
  width: auto;
  min-width: 170px;
}

:where(.ev-filters) .ev-search {
  flex: 1 1 200px;
  min-width: 160px;
}

.ev-upload {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-0);
}

:where(.ev-upload) .ev-upload-desc {
  flex: 1 1 260px;
}

/* Galerie und Details scrollen getrennt, Filter bleiben oben stehen */
.ev-body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
}

.ev-body > .ev-grid {
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  padding: 2px;
}

.ev-body.detail-open {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.ev-tile .evidence-thumb {
  cursor: pointer;
}

.ev-tile.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.ev-tile.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.ev-check {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: rgba(7, 11, 20, 0.55);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.ev-tile.is-selected .ev-check {
  border-color: var(--accent);
  background: var(--accent);
}

.ev-badges {
  position: absolute;
  left: 6px;
  bottom: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.ev-badges .pill {
  background: rgba(7, 11, 20, 0.8);
  color: #fff;
}

.ev-badges .ev-pill-used {
  background: rgba(47, 202, 127, 0.85);
}

.ev-badges .ev-pill-shared {
  background: rgba(79, 140, 255, 0.9);
}

.ev-empty {
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.ev-empty-help {
  grid-column: 1 / -1;
  text-align: center;
}

/* Detail-Spalte */
.ev-detail {
  align-content: start;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-auto-rows: max-content;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-0);
}

.ev-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ev-detail-image {
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  overflow: hidden;
  cursor: zoom-in;
}

.ev-detail-image img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
}

.ev-detail-section {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.ev-desc-row {
  display: flex;
  gap: 8px;
}

.ev-desc-row .ev-desc {
  flex: 1;
  min-width: 0;
}

.ev-share-targets {
  display: grid;
  gap: 8px;
}

.ev-share-targets.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.ev-people {
  position: relative;
  display: grid;
  gap: 6px;
}

.ev-people-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 3;
  display: grid;
  margin-top: 4px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.ev-person {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.ev-person:hover,
.ev-person:focus-visible {
  background-color: var(--surface-hover);
}

.ev-links {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.ev-detail-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

/* Auswahl-Dialog */
.ev-picker {
  width: min(1000px, 100%);
  max-height: calc(100vh - 48px);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.ev-picker .picker-grid {
  min-height: 200px;
  overflow-y: auto;
  padding: 2px;
}

.ev-picker-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.ev-picker-foot .picker-hint {
  flex-basis: 100%;
}

/* Auswahlfeld in Formularen */
.ev-select-field {
  display: grid;
  gap: 6px;
}

.ev-select-field .entry-photo-thumb {
  cursor: default;
}

@media (max-width: 900px) {
  .ev-body.detail-open {
    grid-template-columns: minmax(0, 1fr);
  }

  .ev-app {
    height: auto;
  }

  .ev-body {
    grid-template-rows: none;
  }

  .ev-body > .ev-grid,
  .ev-detail {
    overflow: visible;
  }

  .ev-detail {
    order: -1;
  }
}

/* Geheimhaltungsstufen (Akten-Einträge, Ermittlungen) */
.pill.classified {
  background: rgba(245, 165, 36, 0.14);
  color: #ffc56b;
}

.pill.classified[data-level="3"],
.pill.classified[data-level="4"] {
  background: rgba(242, 85, 90, 0.16);
  color: #ff9a9d;
}

.entry-line.is-classified {
  border-style: dashed;
  background: repeating-linear-gradient(135deg, rgba(245, 165, 36, 0.04) 0 12px, transparent 12px 24px), var(--surface-0);
}

/* ---------- 20. Animationen ---------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes windowIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.08);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- 21. Kleinere Fenster / Tablet ---------- */
@media (max-width: 1100px) {
  .law-grid,
  .calendar-detail {
    grid-template-columns: 1fr;
  }

  .entry-split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  :root {
    --taskbar-h: 58px;
  }

  .desktop-overlay {
    padding: 18px;
  }

  .taskbar-btn .start-label,
  .taskbar-app .taskbar-label {
    display: none;
  }

  .start-apps {
    grid-template-columns: 1fr;
  }

  .case-actions input {
    width: 100%;
  }

  .case-table-head {
    display: none;
  }

  .case-row,
  .vehicle-row,
  .report-row,
  .dispatch-row {
    grid-template-columns: 1fr 1fr;
  }

  .bio-card {
    grid-template-columns: 1fr;
  }

  .table-head {
    display: none;
  }

  .table-row,
  .group-panel .table-row,
  .template-row {
    grid-template-columns: 1fr 1fr;
  }
}
