:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-soft: #eef6f4;
  --ink: #17211f;
  --muted: #66736f;
  --line: #dce5e2;
  --teal: #0f766e;
  --teal-dark: #0a4f4b;
  --amber: #b7791f;
  --blue: #2563eb;
  --red: #b42318;
  --green: #18794e;
  --shadow: 0 20px 50px rgba(23, 33, 31, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button { min-width: 0; overflow-wrap: anywhere; text-align: center; }

.auth-screen {
  position: relative;
  display: none;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: clamp(22px, 5vw, 64px);
  background: var(--bg);
}

.auth-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("assets/hvo-welcome.jpg") center / cover no-repeat;
  opacity: 1;
  pointer-events: none;
}

body[data-auth="locked"] .auth-screen {
  display: grid;
}

body[data-auth="locked"] .app-shell {
  display: none;
}

body[data-auth="active"] .auth-screen {
  display: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 20px;
  padding: 28px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.28));
  box-shadow:
    0 28px 70px rgba(18, 33, 31, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    inset 0 -1px 0 rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(24px) saturate(170%);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
}

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

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.16) 38%, rgba(255, 255, 255, 0.04) 62%),
    radial-gradient(circle at 16% 0%, rgba(255, 255, 255, 0.7), transparent 34%);
  pointer-events: none;
}

.login-card > * {
  position: relative;
  z-index: 1;
}

.login-error {
  margin: 0;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fee2e2;
  color: var(--red);
  font-size: 13px;
  font-weight: 800;
}

.login-logo {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.login-brand {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 16px;
  margin-bottom: 4px;
}

.login-brand h1 {
  margin-bottom: 4px;
  font-size: 25px;
}

.login-brand p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.welcome-clock {
  position: absolute;
  top: 22px;
  left: 22px;
  z-index: 1;
  max-width: calc(100vw - 44px);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 8px;
  padding: 10px 14px;
  background: rgba(18, 33, 31, 0.66);
  color: #ffffff;
  font-size: clamp(15px, 2vw, 22px);
  font-weight: 900;
  line-height: 1.25;
  box-shadow: 0 12px 32px rgba(18, 33, 31, 0.22);
}

body.dispo-alert-notruf::after,
body.dispo-alert-sprechwunsch::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  border: 14px solid var(--alert-color);
  box-shadow:
    inset 0 0 0 10px rgba(255, 255, 255, 0.32),
    inset 0 0 42px var(--alert-color),
    0 0 34px var(--alert-color);
  animation: screenAlertPulse 0.72s ease-in-out infinite;
}

body.dispo-alert-notruf { --alert-color: #dc2626; }
body.dispo-alert-sprechwunsch { --alert-color: #facc15; }

.dispo-alert-panel {
  position: fixed;
  top: 22px;
  left: 50%;
  z-index: 10001;
  display: none;
  grid-template-columns: auto minmax(160px, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: min(760px, calc(100vw - 44px));
  transform: translateX(-50%);
  border: 3px solid var(--alert-color);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(18, 33, 31, 0.28);
}

body.dispo-alert-notruf .dispo-alert-panel,
body.dispo-alert-sprechwunsch .dispo-alert-panel {
  display: grid;
}

.dispo-alert-panel strong {
  color: var(--alert-color);
  font-size: 22px;
  line-height: 1.1;
}

.dispo-alert-panel span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 900;
}

@keyframes screenAlertPulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.text-button,
.logout-button {
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  font-weight: 800;
}

.logout-button {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 10px 12px;
  color: #f7fbfa;
  background: rgba(255, 255, 255, 0.06);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  width: 100%;
  overflow-x: hidden;
  min-height: 100vh;
}

body[data-view="dashboard"] .app-shell {
  display: block;
}

body[data-view="dashboard"] .sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: -244px;
  z-index: 50;
  width: 260px;
  transition: left 180ms ease;
  box-shadow: 20px 0 42px rgba(18, 33, 31, 0.18);
}

body[data-view="dashboard"] .sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: -18px;
  width: 18px;
  height: 100%;
}

body[data-view="dashboard"] .sidebar:hover {
  left: 0;
}

body[data-view="dashboard"] .workspace {
  padding-left: 34px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: #12211f;
  color: #f7fbfa;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-logo {
  flex: 0 0 32px;
  display: block;
  width: 32px;
  height: 32px;
  padding: 2px;
  border-radius: 999px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.brand strong {
  display: block;
  font-size: 15px;
  line-height: 1.15;
}

.brand span {
  display: block;
  color: #a8b9b5;
  font-size: 11px;
  line-height: 1.2;
}

.role-switch {
  display: grid;
  gap: 8px;
  color: #a8b9b5;
  font-size: 12px;
  font-weight: 800;
}

.role-switch select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.role-switch option { color: var(--ink); }

.nav-tabs {
  display: grid;
  gap: 6px;
  overflow-y: auto;
}

.nav-tab {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: #d8e5e1;
  text-align: left;
}

.nav-tab.active, .nav-tab:hover {
  background: rgba(255, 255, 255, 0.11);
  color: #ffffff;
}

.shift-box {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.eyebrow, .shift-box small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.sidebar .eyebrow, .sidebar small { color: #a8b9b5; }

.workspace {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 28px; }
h2 { margin-bottom: 0; font-size: 20px; }
h3 { margin-bottom: 10px; }

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

.global-search { width: min(320px, 28vw); }

.live-pill, .status-badge, .priority, .mission-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface-soft);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #16a34a;
  box-shadow: 0 0 0 6px rgba(22, 163, 74, 0.15);
}

.primary-action, .secondary-action, .navigation-button {
  border: 0;
  border-radius: 8px;
  padding: 12px 16px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 800;
}

.secondary-action, .navigation-button.alt {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
}

.navigation-button.confirm:disabled {
  background: #d8e5e1;
  color: #52615d;
  cursor: default;
}

.view { display: none; }
.view.active { display: block; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric, .panel, .vehicle-card, .mission-card, .history-item, .role-card, .module-item, .table-row, .planning-column, .billing-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric {
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.dispatch-layout {
  display: grid;
  grid-template-columns: 1fr 1.25fr 0.9fr;
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.search, .select, input, select, textarea {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #ffffff;
  color: var(--ink);
}

.vehicle-list, .mission-board, .history-list, .module-list, .role-grid, .data-table, .chart-list, .billing-grid {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.vehicle-card, .mission-card, .history-item, .role-card, .module-item, .table-row, .billing-card {
  padding: 14px;
}

.vehicle-card, .mission-card { display: grid; gap: 10px; }

.vehicle-top, .mission-top, .table-row, .planning-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.call-sign { font-size: 18px; font-weight: 800; }

.vehicle-meta, .mission-meta, .history-item p, .module-item p, .billing-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status {
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status.freiaufwache, .status.frei { background: #dcfce7; color: var(--green); }
.status.einsatzangenommen, .status.ameinsatzort, .status.sprechwunsch { background: #dbeafe; color: var(--blue); }
.status.pataufgenommen, .status.amzielort { background: #fef3c7; color: var(--amber); }
.status.reinigung, .status.pause, .status.ausserdienst, .status.notruf { background: #fee2e2; color: var(--red); }

.priority.hoch { background: #fee2e2; color: var(--red); }
.priority.planbar { background: #fef3c7; color: var(--amber); }

.mission-route {
  display: grid;
  gap: 4px;
  font-weight: 800;
}

.mission-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mission-actions button, .small-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 700;
}

.small-button.danger {
  border-color: #fecaca;
  color: var(--red);
}

.mission-actions button.danger {
  border-color: #fecaca;
  color: var(--red);
}

.fleet-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.archived-row {
  background: #f8faf9;
  opacity: 0.78;
}

.map-canvas {
  position: relative;
  height: 340px;
  margin: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef6f4;
}

.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.dashboard-clock {
  font-size: 42px;
  font-weight: 900;
  color: var(--teal-dark);
  font-variant-numeric: tabular-nums;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: start;
}

.dashboard-map-panel {
  min-width: 0;
  overflow: hidden;
}

.dashboard-map {
  position: relative;
  height: clamp(300px, calc(100vh - 400px), 480px);
  min-height: 300px;
  max-height: 480px;
  margin: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef6f4;
}

.map-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.map-canvas.leaflet-container,
.dashboard-map.leaflet-container {
  font-family: inherit;
}

.leaflet-vehicle-icon {
  border: 0;
  background: transparent;
}

.vehicle-map-dot {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: var(--teal);
  color: #ffffff;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.vehicle-map-badge {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 8px;
  min-width: 165px;
  max-width: 210px;
  border: 3px solid #ffffff;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--teal);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.vehicle-map-emote {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 18px;
  line-height: 1;
}

.vehicle-map-dot small {
  margin-top: -4px;
  font-size: 9px;
  line-height: 1;
}

.vehicle-map-badge strong {
  display: block;
  font-size: 14px;
  line-height: 1.1;
}

.vehicle-map-badge small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.vehicle-map-dot.pataufgenommen,
.vehicle-map-dot.amzielort,
.vehicle-map-badge.pataufgenommen,
.vehicle-map-badge.amzielort {
  background: var(--amber);
}

.vehicle-map-dot.pause,
.vehicle-map-dot.ausserdienst,
.vehicle-map-dot.notruf,
.vehicle-map-badge.pause,
.vehicle-map-badge.ausserdienst,
.vehicle-map-badge.notruf {
  background: var(--red);
}

.dashboard-marker {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 2px;
  min-width: 132px;
  max-width: 170px;
  transform: translate(-50%, -50%);
  border: 3px solid #ffffff;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--teal);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.dashboard-marker span {
  font-size: 12px;
  font-weight: 800;
}

.dashboard-marker.pataufgenommen,
.dashboard-marker.amzielort {
  background: var(--amber);
}

.dashboard-marker.pause,
.dashboard-marker.ausserdienst,
.dashboard-marker.notruf {
  background: var(--red);
}

.dashboard-status-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.dashboard-status-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
}

.dashboard-status-card div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dashboard-status-card span:not(.status),
.dashboard-status-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.map-pin {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: var(--teal);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.map-pin.pataufgenommen, .map-pin.amzielort { background: var(--amber); }
.map-pin.pause, .map-pin.ausserdienst, .map-pin.notruf { background: var(--red); }

.timeline {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.mobile-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.mobile-toolbar label, .stacked-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tablet-shell {
  max-width: 920px;
  margin: 0 auto;
  border: 12px solid #1f2a28;
  border-radius: 18px;
  background: #f7fbfa;
  box-shadow: var(--shadow);
  padding: 22px;
}

.tablet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.vehicle-gps-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #ffffff;
}

.vehicle-gps-panel strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.vehicle-gps-panel.gps-ok {
  border-color: rgba(24, 121, 78, 0.35);
  background: #f0fdf4;
}

.vehicle-gps-panel.gps-error {
  border-color: rgba(180, 35, 24, 0.45);
  background: #fff5f5;
}

.incoming-job {
  border: 2px solid var(--teal);
  border-radius: 8px;
  padding: 22px;
  background: #ffffff;
}

.incoming-job.attention {
  border-color: #b91c1c;
  box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.14);
  animation: incomingPulse 1.2s ease-in-out infinite;
}

@keyframes incomingPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(185, 28, 28, 0.12); }
  50% { box-shadow: 0 0 0 8px rgba(185, 28, 28, 0.22); }
}

.incoming-job h3 { margin-bottom: 10px; font-size: 26px; }

.tablet-mission-details {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  font-size: 16px;
}

.tablet-mission-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tablet-mission-grid article {
  display: grid;
  gap: 4px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7fbfa;
}

.tablet-mission-grid article.wide {
  grid-column: 1 / -1;
}

.tablet-mission-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tablet-mission-grid strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.vehicle-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.navigation-button {
  width: 100%;
  margin-top: 12px;
  padding: 18px;
  font-size: 20px;
}

.status-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.status-buttons button {
  min-height: 82px;
  border: 0;
  border-radius: 8px;
  background: #12211f;
  color: #ffffff;
  font-size: 18px;
  font-weight: 900;
}

.status-buttons button.active {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.18);
}

.status-buttons button.complete-mission {
  grid-column: 1 / -1;
  background: #166534;
}

.planning-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding: 14px;
}

.planning-column {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  min-height: 320px;
  background: #fbfdfc;
}

.plan-item {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #ffffff;
  text-align: left;
}

.plan-item span, .empty-state { color: var(--muted); font-size: 13px; }

.map-empty {
  position: absolute;
  z-index: 500;
  inset: 50% auto auto 50%;
  width: min(280px, calc(100% - 28px));
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.clinic-layout, .stats-grid, .settings-grid, .admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.wide-panel { grid-column: 1 / -1; }

.stacked-form {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.billing-grid {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.billing-card {
  display: grid;
  gap: 8px;
}

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

.billing-card b {
  color: var(--teal-dark);
  font-size: 22px;
}

.chart-row {
  display: grid;
  grid-template-columns: 140px 1fr 36px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--teal);
}

.form-grid, .detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.wide { grid-column: 1 / -1; }

.mission-dialog {
  width: min(820px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.mission-dialog::backdrop { background: rgba(18, 33, 31, 0.55); }

.dialog-header, .dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
}

.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.detail-grid article {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-grid span { color: var(--muted); font-size: 12px; }

@media (max-width: 1280px) {
  .dispatch-layout {
    grid-template-columns: 0.9fr 1.1fr;
  }
  .map-panel {
    grid-column: 1 / -1;
  }
  .dashboard-layout,
  .clinic-layout, .stats-grid, .settings-grid, .admin-grid {
    grid-template-columns: 1fr;
  }
  .billing-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }
  .topbar-actions {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto auto;
    width: 100%;
  }
  .global-search { width: 100%; }
}

@media (max-width: 780px) {
  .auth-screen {
    place-items: center;
    padding: 82px 16px 16px;
  }

  .login-card {
    padding: 24px;
  }

  .welcome-clock {
    top: 14px;
    left: 14px;
    font-size: 15px;
  }

  body.dispo-alert-notruf::after,
  body.dispo-alert-sprechwunsch::after {
    border-width: 10px;
  }

  .dispo-alert-panel {
    top: 12px;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .login-brand {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .app-shell {
    display: block;
    width: 100vw;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100vw;
    padding: 12px;
    gap: 10px;
  }

  .brand-logo {
    width: 28px;
    height: 28px;
    flex-basis: 28px;
  }

  .role-switch, .shift-box { display: none; }

  .nav-tabs {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-tab {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 10px 12px;
  }

  .workspace {
    width: 100vw;
    padding: 14px;
  }
  .workspace, .tablet-shell, .incoming-job {
    max-width: 100%;
    overflow-x: hidden;
  }

  .topbar, .panel-header, .tablet-header, .mobile-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions, .vehicle-action-grid {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .topbar-actions > *,
  .primary-action,
  .secondary-action,
  .navigation-button {
    width: 100%;
  }

  .live-pill {
    justify-content: center;
  }

  body[data-view="vehicle"] .topbar-actions {
    display: none;
  }

  .global-search { width: 100%; }
  .metrics-grid, .form-grid, .detail-grid, .status-buttons, .billing-grid, .tablet-mission-grid, .vehicle-gps-panel { grid-template-columns: 1fr; }
  .metric strong { font-size: 24px; }
  h1 { font-size: 23px; }
  .dashboard-hero {
    align-items: stretch;
    flex-direction: column;
  }
  .dashboard-clock {
    font-size: 32px;
  }
  .dashboard-map {
    height: min(420px, 58vh);
    min-height: 300px;
    margin: 10px;
  }
  .dashboard-marker {
    min-width: 112px;
    max-width: 132px;
    padding: 8px;
    font-size: 12px;
  }

  .tablet-shell {
    width: calc(100vw - 28px);
    max-width: calc(100vw - 28px);
    margin: 0;
    border-width: 6px;
    border-radius: 12px;
    padding: 14px;
  }

  .incoming-job { padding: 16px; }
  .incoming-job h3 { font-size: 20px; }
  .status-buttons button { min-height: 68px; font-size: 16px; }
}
