:root {
  color-scheme: dark;
  --bg: #080b0d;
  --panel: #12171b;
  --panel-soft: #181f24;
  --input: #0b1013;
  --border: #303940;
  --text: #f3f5f4;
  --muted: #96a1a8;
  --red: #e73127;
  --red-dark: #8f201a;
  --green: #50b57a;
  --amber: #ffbd42;
  --shadow: 0 20px 55px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { width: min(1540px, 100%); margin: 0 auto; padding: 22px 32px 48px; }
.topbar, .display-header {
  min-height: 76px; display: flex; align-items: center; justify-content: space-between;
  gap: 24px; border-bottom: 1px solid var(--border);
}
.brand, .display-brand { display: flex; align-items: center; gap: 14px; text-transform: uppercase; }
.brand-mark {
  display: grid; place-items: center; width: 48px; height: 48px;
  background: transparent; border: 0; font-size: 0; transform: none;
}
.brand-mark img { display: block; width: 48px; height: 48px; filter: drop-shadow(0 8px 18px rgba(231, 49, 39, .2)); }
.brand h1, .hero h2, .section-heading h2, .dialog-header h2 {
  margin: 1px 0 0; font-family: Impact, "Arial Narrow", sans-serif; letter-spacing: .04em;
  text-transform: uppercase; font-weight: 700;
}
.brand h1 { font-size: clamp(25px, 3vw, 38px); }
.eyebrow, .status-label {
  display: block; color: var(--muted); font-size: 12px; letter-spacing: .15em;
  text-transform: uppercase; font-weight: 800;
}
.eyebrow.red { color: var(--red); }
.topbar-actions, .hero-actions, .status-actions, .dialog-actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.workspace-picker {
  display: flex; align-items: center; gap: 8px; padding: 5px 7px 5px 10px;
  border: 1px solid var(--border); background: var(--panel-soft);
}
.workspace-picker > span {
  color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase;
}
.workspace-picker select {
  min-width: 190px; max-width: 310px; border: 0; background: var(--input);
  color: var(--text); padding: 7px 9px; outline: none; font-weight: 700;
}
.connection { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 650; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #70777c; box-shadow: 0 0 0 4px rgba(112, 119, 124, .12); }
.status-dot.online { background: var(--green); box-shadow: 0 0 0 4px rgba(80, 181, 122, .13); }
.status-dot.offline { background: var(--red); box-shadow: 0 0 0 4px rgba(231, 49, 39, .13); }
.user-chip { padding: 8px 11px; background: var(--panel-soft); border: 1px solid var(--border); color: var(--muted); font-size: 12px; }

.button {
  min-height: 38px; border: 1px solid transparent; padding: 9px 15px; color: var(--text);
  text-decoration: none; cursor: pointer; font-weight: 750; letter-spacing: .02em;
  transition: border-color .12s ease, background .12s ease;
}
.button:disabled { cursor: wait; opacity: .55; }
.button-primary { background: var(--red); border-color: var(--red); }
.button-primary:hover { background: #ff4035; }
.button-secondary { background: var(--panel-soft); border-color: var(--border); }
.button-secondary:hover { border-color: #65727a; }
.button-danger { background: #331615; border-color: #7f2a25; }
.icon-button { border: 0; background: transparent; color: var(--muted); font-size: 30px; cursor: pointer; }

.hero {
  display: flex; align-items: end; justify-content: space-between; gap: 28px;
  padding: 38px 0 24px;
}
.hero h2, .section-heading h2 { font-size: clamp(26px, 3vw, 42px); }
.hero p { color: var(--muted); margin: 8px 0 0; max-width: 760px; line-height: 1.55; }

.status-panel {
  display: flex; justify-content: space-between; align-items: center; gap: 24px;
  background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--green);
  padding: 18px 20px; margin-bottom: 24px; box-shadow: var(--shadow);
}
.status-panel.active { border-left-color: var(--red); }
.status-panel > div:first-child { display: grid; gap: 3px; }
.status-panel strong { font-family: Impact, "Arial Narrow", sans-serif; font-size: 24px; letter-spacing: .05em; text-transform: uppercase; }
.status-panel.active strong { color: var(--red); }
.status-panel #activeDetails { color: var(--muted); }
.status-countdown {
  display: grid;
  min-width: 150px;
  gap: 1px;
  padding: 7px 15px 7px 0;
  border-right: 1px solid var(--border);
}
.status-countdown[hidden] { display: none; }
.status-countdown span,
.status-countdown small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.status-countdown time {
  color: var(--red);
  font: 800 26px/1.05 ui-monospace, monospace;
  letter-spacing: .03em;
}
.status-countdown small { letter-spacing: .03em; text-transform: none; }

.alarm-folder {
  position: relative;
  padding: 18px;
  border: 1px solid var(--border);
  background: rgba(17, 23, 27, .62);
  box-shadow: var(--shadow);
}
.folder-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}
.folder-title, .folder-actions, .history-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.folder-title h2 { font-size: clamp(25px, 2.7vw, 38px); }
.folder-icon {
  position: relative;
  width: 42px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid rgba(231, 49, 39, .52);
  background: rgba(231, 49, 39, .12);
}
.folder-icon::before {
  content: "";
  position: absolute;
  top: -8px;
  left: -1px;
  width: 19px;
  height: 8px;
  border: 1px solid rgba(231, 49, 39, .52);
  border-bottom: 0;
  background: rgba(231, 49, 39, .12);
}
.planned-alarm-folder .folder-icon {
  border-color: rgba(255, 180, 67, .55);
  background: rgba(255, 180, 67, .1);
}
.planned-alarm-folder .folder-icon::before {
  border-color: rgba(255, 180, 67, .55);
  background: rgba(255, 180, 67, .1);
}
.folder-count {
  padding: 7px 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.unit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.saved-alarm-card {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 54px minmax(220px, 1.4fr) minmax(190px, .8fr) auto;
  align-items: center;
  gap: 16px;
  padding: 15px 17px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--red);
  background: var(--panel);
}
.saved-alarm-overview, .saved-alarm-facts {
  display: grid;
  min-width: 0;
  gap: 4px;
}
.saved-alarm-overview strong {
  overflow: hidden;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.saved-alarm-overview span { color: var(--text); font-weight: 700; }
.saved-alarm-overview small,
.saved-alarm-facts span { color: var(--muted); overflow-wrap: anywhere; }
.saved-alarm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.unit-card {
  background: var(--panel); border: 1px solid var(--border); padding: 18px;
  position: relative; box-shadow: var(--shadow);
}
.unit-card::before { content: ""; position: absolute; top: -1px; left: -1px; width: 90px; height: 3px; background: var(--red); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.unit-number { color: var(--muted); font: 700 22px ui-monospace, monospace; }
.card-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card-fields .full { grid-column: 1 / -1; }
.card-fields textarea { min-height: 90px; resize: vertical; }
.address-fieldset {
  min-width: 0; margin: 0; padding: 0; border: 0; grid-column: 1 / -1;
}
.address-fieldset legend {
  margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700;
  letter-spacing: .05em;
}
.address-grid {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(95px, .75fr) minmax(95px, .8fr) minmax(150px, 1.5fr);
  gap: 10px;
}

.map-location-fieldset {
  min-width: 0; margin: 0; padding: 14px; grid-column: 1 / -1;
  border: 1px solid var(--border); background: var(--input); display: grid; gap: 9px;
}
.map-location-fieldset legend {
  padding: 0 5px; color: var(--muted); font-size: 12px; font-weight: 700;
  letter-spacing: .05em;
}
.map-location-status { color: var(--text); font-weight: 700; overflow-wrap: anywhere; }
.map-location-fieldset .button { justify-self: start; }
.address-fieldset[hidden], .map-location-fieldset[hidden] { display: none; }
.card-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.vehicle-options { display: flex; flex-wrap: wrap; gap: 7px; min-height: 38px; }
.vehicle-option { display: inline-flex; align-items: center; gap: 6px; background: var(--input); border: 1px solid var(--border); padding: 7px 9px; font-size: 12px; color: var(--muted); }
.vehicle-option:has(input:checked) { border-color: var(--red); color: var(--text); }

label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .05em; }
input, textarea, select {
  width: 100%; background: var(--input); border: 1px solid var(--border); color: var(--text);
  padding: 10px 11px; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(231, 49, 39, .1); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--red); }

.empty-state {
  border: 1px dashed var(--border); background: var(--panel); padding: 42px; text-align: center;
  color: var(--muted); display: grid; gap: 8px;
}
.empty-state[hidden] { display: none; }
.empty-state strong { color: var(--text); font-size: 20px; }

.empty-state.compact { padding: 24px; }
.schedule-section, .history-section { margin-top: 36px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 12px; }
.schedule-list { display: grid; gap: 10px; }
.schedule-card {
  display: grid; grid-template-columns: minmax(210px, .7fr) minmax(220px, 1.4fr) auto;
  align-items: center; gap: 18px; padding: 15px 17px; background: var(--panel);
  border: 1px solid var(--border); border-left: 4px solid var(--amber); box-shadow: var(--shadow);
}
.schedule-time, .schedule-details { display: grid; gap: 4px; }
.schedule-time time { color: var(--text); font: 750 16px ui-monospace, monospace; }
.schedule-details strong { font-size: 17px; }
.schedule-details small { color: var(--muted); }
.schedule-actions { display: flex; justify-content: flex-end; gap: 8px; }
.table-wrap { overflow: auto; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; }
th { color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
td:first-child { white-space: nowrap; font-family: ui-monospace, monospace; }
td:last-child { color: var(--muted); }

dialog { width: min(720px, calc(100% - 28px)); padding: 0; border: 1px solid var(--border); background: transparent; color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .78); backdrop-filter: blur(3px); }
.dialog-card { padding: 22px; background: var(--panel); display: grid; gap: 18px; }
.dialog-card.wide { width: 100%; }
.dialog-header { display: flex; align-items: start; justify-content: space-between; }
.dialog-header h2 { font-size: 30px; }
.manage-list { display: grid; gap: 8px; max-height: 310px; overflow: auto; }
.manage-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--input); border: 1px solid var(--border); }
.manage-row > div { display: grid; gap: 2px; }
.manage-row small { color: var(--muted); }
.membership-form > label:not(.grow) { min-width: 150px; }
.inline-form { display: flex; align-items: end; gap: 10px; }
.grow { flex: 1; }
.settings-block { padding: 15px; border: 1px solid var(--border); background: var(--input); display: grid; gap: 13px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.toggle-row span { display: grid; gap: 3px; }
.toggle-row small { color: var(--muted); font-weight: 400; letter-spacing: 0; }
.check-row { display: flex; align-items: center; gap: 9px; }
.info-line { color: var(--muted); font-size: 12px; }
.dialog-error {
  border: 1px solid rgba(231, 49, 39, .62); border-left: 4px solid var(--red);
  background: rgba(231, 49, 39, .12); color: #ffd6d3; padding: 13px 15px;
  font-size: 14px; font-weight: 700; line-height: 1.45; overflow-wrap: anywhere;
}
.dialog-error[hidden] { display: none; }
.dialog-error:focus { outline: 2px solid rgba(231, 49, 39, .5); outline-offset: 2px; }
.monitor-audio-button.active {
  border-color: rgba(255, 180, 67, .7); color: #ffd08a;
  box-shadow: inset 0 0 0 1px rgba(255, 180, 67, .16);
}
.monitor-audio-status {
  padding: 11px 12px; border: 1px solid var(--border); background: var(--panel);
  color: var(--muted); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere;
}
.monitor-audio-status.active { border-left: 4px solid var(--amber); color: var(--text); }
.dialog-actions { justify-content: end; }
.catalog-dialog { width: min(1180px, calc(100% - 28px)); }
.catalog-dialog .dialog-card { max-height: min(900px, calc(100vh - 36px)); }
.catalog-search input { font-size: 15px; }
.catalog-base-levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; max-height: 230px; overflow: auto; }
.catalog-base-card { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--border); background: var(--input); }
.catalog-base-card > strong { color: var(--text); }
.catalog-base-card > div { display: grid; gap: 6px; }
.catalog-level-chip { display: grid; grid-template-columns: 44px 1fr; gap: 8px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.catalog-level-chip b, .catalog-level { color: var(--red); font-family: ui-monospace, monospace; white-space: nowrap; }
.catalog-table-wrap { max-height: min(460px, 48vh); }
.catalog-empty { padding: 28px; color: var(--muted); text-align: center; }

.location-dialog { width: min(980px, calc(100% - 28px)); }
.location-dialog .dialog-card { max-height: calc(100vh - 32px); overflow: auto; }
.location-search-row { display: flex; align-items: end; gap: 10px; }
.location-search-results {
  display: grid; gap: 6px; max-height: 180px; overflow: auto;
  padding: 8px; border: 1px solid var(--border); background: var(--input);
}
.location-search-results:empty { display: none; }
.location-result {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  background: var(--panel); color: var(--text); text-align: left; cursor: pointer;
}
.location-result:hover, .location-result:focus { border-color: var(--red); }
.location-map-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  color: var(--muted); font-size: 12px; font-weight: 700;
}
.location-map-toolbar > div { display: flex; gap: 6px; }
.location-picker-map {
  position: relative; height: 420px; overflow: hidden; border: 1px solid var(--border);
  background: #090d0f; cursor: grab; user-select: none; touch-action: none; isolation: isolate;
}
.location-picker-map:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(231, 49, 39, .1); }
.location-picker-map.dragging { cursor: grabbing; }
.location-picker-marker[hidden] { display: none; }
.location-picker-tiles { position: absolute; inset: 0; }
.location-picker-tiles img {
  position: absolute; width: 256px; height: 256px; max-width: none;
  pointer-events: none; user-select: none;
}
.location-picker-marker {
  position: absolute; z-index: 2; left: 50%; top: 50%; width: 30px; height: 44px;
  transform: translate(-50%, -100%); pointer-events: none;
}
.location-picker-marker::before {
  content: ""; position: absolute; top: 0; left: 0; width: 30px; height: 30px;
  box-sizing: border-box; border: 4px solid #fff; border-radius: 50%;
  background: var(--red); box-shadow: 0 3px 12px rgba(0, 0, 0, .7);
}
.location-picker-marker::after {
  content: ""; position: absolute; left: 13px; top: 26px; width: 4px; height: 18px;
  background: var(--red); box-shadow: 0 3px 8px rgba(0, 0, 0, .7);
}
.location-attribution { color: var(--muted); font-size: 10px; text-align: right; }
.location-coordinates { font-family: ui-monospace, monospace; }
.location-picker-map.map-unavailable { cursor: default; }
.location-picker-map.map-unavailable .location-picker-tiles {
  display: grid; place-items: center; color: var(--muted);
}
.toast {
  position: fixed; right: 24px; bottom: 24px; max-width: min(420px, calc(100% - 48px));
  background: #20282d; border: 1px solid var(--border); border-left: 4px solid var(--green);
  padding: 13px 16px; box-shadow: var(--shadow); transform: translateY(130%); opacity: 0;
  transition: transform .18s ease, opacity .18s ease; z-index: 30;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { border-left-color: var(--red); }

.display-page { overflow: hidden; }
.display-stage { height: 100vh; min-height: 620px; display: grid; grid-template-rows: 76px 1fr 72px; padding: 0 34px; position: relative; }
.display-header { z-index: 3; }
.idle-state { display: flex; flex-direction: column; justify-content: center; max-width: 950px; padding-left: 5vw; }
.idle-state h1 { font-family: Impact, "Arial Narrow", sans-serif; text-transform: uppercase; font-size: clamp(58px, 9vw, 138px); line-height: .86; letter-spacing: .015em; margin: 18px 0; }
.idle-state h1 strong { color: var(--red); font-weight: inherit; }
.idle-state p { max-width: 650px; color: var(--muted); font-size: 18px; line-height: 1.5; }

.alarm-state { display: none; align-items: center; justify-content: center; text-align: center; position: relative; }
.alarm-active .alarm-state { display: flex; }
.alarm-active .idle-state { display: none; }
.alarm-active::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(circle at center, rgba(231, 49, 39, .16), transparent 58%);
}
.alarm-content { width: min(1200px, 100%); z-index: 1; }
.alarm-kicker { display: flex; align-items: center; justify-content: center; gap: 16px; color: var(--red); text-transform: uppercase; letter-spacing: .22em; font-weight: 900; }
.alarm-kicker span { width: 80px; height: 2px; background: var(--red); }
.alarm-content h1 { font-family: Impact, "Arial Narrow", sans-serif; text-transform: uppercase; font-size: clamp(54px, 8vw, 120px); letter-spacing: .025em; margin: 12px 0; }
.alarm-divider { width: min(420px, 65%); height: 4px; margin: 0 auto 24px; background: var(--red); }
.alarm-message { font-size: clamp(26px, 4vw, 58px); line-height: 1.14; font-weight: 750; margin: 0 auto 16px; max-width: 1100px; }
.alarm-address { color: var(--amber); font-size: clamp(20px, 2.4vw, 34px); font-weight: 700; margin: 0 0 18px; }
.alarm-vehicles { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.alarm-vehicles span { padding: 9px 14px; border: 1px solid #666f74; background: rgba(20, 25, 29, .9); font-weight: 800; }
.restored-notice { color: var(--amber); margin-top: 18px; }
.alarm-meta { display: flex; justify-content: space-between; margin-top: 34px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.alarm-meta time { font-family: ui-monospace, monospace; }

.display-footer { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--border); z-index: 3; }
.display-footer time { margin-left: auto; font: 700 18px ui-monospace, monospace; }
.audio-notice { color: var(--amber); font-size: 13px; }
.siren-running .display-header, .siren-running .display-footer { border-color: rgba(231, 49, 39, .65); }

/* Originale Alarmanzeige der Windows-Version, mit bestehender Weblogik. */
.display-page {
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(rgba(8, 10, 12, .5), rgba(8, 10, 12, .63)),
    url("/static/assets/alarm-background.png") center / cover;
}
.display-page::before {
  position: fixed;
  inset: 0;
  content: "";
  background: radial-gradient(circle at center, transparent 10%, rgba(0, 0, 0, .5) 100%);
  pointer-events: none;
}
.display-flash {
  position: fixed;
  inset: 0;
  background: rgba(231, 23, 21, 0);
  pointer-events: none;
}
.display-page.alarm-active .display-flash { animation: flash-screen .78s infinite; }
.alarm-stage {
  position: relative;
  z-index: 1;
  display: grid;
  height: 100vh;
  min-height: 620px;
  grid-template-rows: auto 1fr auto;
  padding: 30px 40px 26px;
}
.display-page .display-header {
  display: flex;
  min-height: 0;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0;
}
.display-brand {
  gap: 12px;
  color: #dfe4e6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2em;
}
.display-brand-line { width: 42px; height: 3px; background: var(--red); }
.display-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #a9b0b4;
  font-size: 12px;
}
.idle-state {
  align-self: center;
  max-width: 860px;
  padding: 0 5vw;
}
.idle-state h1 {
  margin: 13px 0 0;
  color: rgba(255, 255, 255, .92);
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: clamp(80px, 11vw, 164px);
  font-weight: 500;
  letter-spacing: .01em;
  line-height: .78;
  text-transform: uppercase;
}
.idle-state h1 strong { color: #fff; font-weight: 800; }
.idle-state p:last-child {
  max-width: 550px;
  margin: 25px 0 0 4px;
  color: #aeb5b8;
  font-size: 15px;
  line-height: 1.7;
}
.alarm-state { display: none; }
.display-page.alarm-active .idle-state { display: none; }
.display-page.alarm-active .alarm-state {
  display: flex;
  margin: 26px -40px 20px;
}
.alarm-content {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  width: auto;
  z-index: auto;
  flex-direction: column;
  padding: 4vh 6vw;
  background: rgba(0, 0, 0, .45);
  text-align: center;
}
.alarm-kicker {
  display: flex;
  align-items: center;
  gap: 22px;
  margin: 0;
  color: #ff665c;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: clamp(42px, 4.8vw, 72px);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.alarm-kicker span { display: block; width: 76px; height: 3px; background: currentColor; }
.alarm-content h1 {
  margin: 2vh 0 0;
  color: #fff;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: clamp(86px, 13vw, 202px);
  font-weight: 800;
  letter-spacing: .01em;
  line-height: 1.08;
  text-shadow: 0 5px 28px rgba(0, 0, 0, .34);
  text-transform: uppercase;
}
.alarm-divider { width: min(360px, 56vw); height: 4px; margin: 3vh 0; background: var(--red); }
.alarm-message {
  max-width: 1280px;
  margin: 0;
  color: #fff;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: clamp(35px, 5vw, 76px);
  font-weight: 600;
  letter-spacing: .03em;
  line-height: 1.04;
  text-transform: uppercase;
}
.alarm-address {
  max-width: 1180px;
  margin: 2.4vh 0 0;
  color: rgba(255, 255, 255, .86);
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: clamp(24px, 3vw, 46px);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.alarm-vehicles { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 2.5vh; }
.alarm-vehicles span {
  padding: 11px 18px;
  border: 1px solid rgba(255, 91, 82, .72);
  background: rgba(231, 49, 39, .18);
  color: #fff;
  font-family: Impact, "Arial Narrow", sans-serif;
  font-size: clamp(26px, 2.8vw, 42px);
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.restored-notice { margin: 18px 0 0; color: var(--amber); }
.alarm-meta {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin-top: 4vh;
  color: rgba(255, 255, 255, .65);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.display-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 11px;
  border-top: 0;
}
.sound-button, .fullscreen-button {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(10, 13, 15, .58);
  color: #e9ebeb;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  padding: 11px 14px;
  text-transform: uppercase;
}
.sound-button svg, .fullscreen-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.sound-button { margin-right: auto; }
.sound-button.enabled { border-color: rgba(80, 181, 122, .5); color: #a9e0bd; }
.sound-button.pending { cursor: progress; opacity: .68; }
.sound-button:disabled { cursor: default; opacity: .82; }
.fullscreen-button { margin-left: 8px; }
.display-credit {
  margin-right: auto;
  color: rgba(255, 255, 255, .36);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.audio-notice {
  margin-right: 14px;
  color: #ffb443;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.monitor-playback-notice { color: #ffd08a; }
.display-footer time { margin-left: auto; font: 700 18px ui-monospace, monospace; }
.siren-running .display-header, .siren-running .display-footer { color: #fff; }

@keyframes flash-screen {
  0%, 100% { background: rgba(231, 23, 21, .32); }
  50% { background: rgba(231, 23, 21, 0); }
}

@media (max-width: 980px) {
  .app-shell { padding: 16px; }
  .topbar, .hero, .status-panel { align-items: stretch; flex-direction: column; }
  .topbar { padding-bottom: 14px; }
  .topbar-actions { justify-content: flex-start; }
  .unit-grid { grid-template-columns: 1fr; }
  .saved-alarm-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }
  .saved-alarm-facts, .saved-alarm-actions { grid-column: 2; }
  .saved-alarm-actions { justify-content: flex-start; flex-wrap: wrap; }
  .status-actions { justify-content: flex-start; }
}
@media (max-width: 620px) {
  .hero-actions, .hero-actions .button { width: 100%; }
  .card-fields { grid-template-columns: 1fr; }
  .card-fields .full { grid-column: auto; }
  .address-grid { grid-template-columns: 1fr 1fr; }
  .address-grid .address-wide { grid-column: 1 / -1; }
  .location-search-row { flex-direction: column; align-items: stretch; }
  .location-picker-map { height: 320px; }
  .location-map-toolbar { align-items: flex-start; }
  .card-actions { flex-direction: column-reverse; }
  .schedule-card { grid-template-columns: 1fr; align-items: start; }
  .alarm-folder { padding: 14px; }
  .folder-heading { align-items: flex-start; flex-direction: column; }
  .folder-actions { width: 100%; justify-content: space-between; }
  .saved-alarm-card {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }
  .saved-alarm-card .unit-number,
  .saved-alarm-facts,
  .saved-alarm-actions { grid-column: auto; }
  .saved-alarm-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .saved-alarm-actions .button { width: 100%; }
  .saved-alarm-actions .button:last-child { grid-column: 1 / -1; }
  .schedule-actions { justify-content: flex-start; flex-wrap: wrap; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .workspace-picker, .workspace-picker select { width: 100%; max-width: none; }
  .display-stage { padding: 0 16px; grid-template-rows: 70px 1fr auto; }
  .display-header { align-items: center; }
  .display-brand strong { display: none; }
  .display-footer { padding: 10px 0; flex-wrap: wrap; }
  .alarm-meta { gap: 16px; flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

@media (max-width: 620px) {
  .alarm-stage { padding: 22px 18px 18px; }
  .display-page.alarm-active .alarm-state { margin-right: -18px; margin-left: -18px; }
  .display-status { font-size: 0; }
  .idle-state { padding: 0; }
  .idle-state h1 { font-size: clamp(70px, 21vw, 132px); }
  .alarm-content h1 { font-size: clamp(78px, 22vw, 138px); }
  .alarm-message { font-size: clamp(33px, 10vw, 60px); }
  .sound-button, .fullscreen-button { font-size: 0; padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .display-page.alarm-active .display-flash {
    animation: none !important;
    background: rgba(231, 23, 21, .16);
  }
}

/* Mobile Leitstelle: kompakte Bedienung mit sicheren Touch-Zielen. */
@media (max-width: 980px) {
  .control-page .topbar-actions { width: 100%; }
  .control-page .topbar-actions > * { min-width: 0; }
  .control-page .workspace-picker { flex: 1 1 340px; }
  .control-page .hero-actions { width: 100%; justify-content: flex-start; }
  .control-page .hero-actions .button { flex: 1 1 150px; }
  .control-page .schedule-card {
    grid-template-columns: minmax(190px, .75fr) minmax(0, 1.25fr);
  }
  .control-page .schedule-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .control-page .history-section table { min-width: 680px; }
}

@media (max-width: 620px) {
  .control-page .app-shell {
    padding:
      max(12px, env(safe-area-inset-top))
      max(12px, env(safe-area-inset-right))
      max(28px, env(safe-area-inset-bottom))
      max(12px, env(safe-area-inset-left));
  }
  .control-page .topbar { min-height: 0; gap: 16px; padding-bottom: 16px; }
  .control-page .brand { gap: 10px; }
  .control-page .brand-mark,
  .control-page .brand-mark img { width: 42px; height: 42px; }
  .control-page .brand h1 { font-size: clamp(25px, 8vw, 31px); }
  .control-page .topbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }
  .control-page .workspace-picker {
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    padding: 8px;
  }
  .control-page .topbar-actions > .button {
    display: grid;
    width: 100%;
    place-items: center;
    text-align: center;
  }
  .control-page .connection,
  .control-page .user-chip {
    min-height: 44px;
    justify-content: center;
    padding: 8px 10px;
    border: 1px solid var(--border);
    background: var(--panel-soft);
    overflow: hidden;
  }
  .control-page .connection span:last-child,
  .control-page .user-chip {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .control-page .hero { gap: 18px; padding: 26px 0 18px; }
  .control-page .hero h2 {
    font-size: clamp(28px, 9vw, 38px);
    line-height: 1.02;
  }
  .control-page .hero p { font-size: 14px; }
  .control-page .hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .control-page .hero-actions .button { width: 100%; }
  .control-page #addUnitButton { grid-column: 1 / -1; }
  .control-page .status-panel { gap: 14px; margin-bottom: 18px; padding: 15px; }
  .control-page .status-panel strong { font-size: 22px; }
  .control-page .status-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .control-page .status-countdown {
    grid-column: 1 / -1;
    padding: 8px 0 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .control-page .status-actions .button { width: 100%; }
  .control-page .unit-card { padding: 14px; }
  .control-page .card-head { margin-bottom: 12px; }
  .control-page .card-fields { gap: 10px; }
  .control-page .map-location-fieldset { padding: 12px; }
  .control-page .vehicle-option { min-height: 44px; }
  .control-page .card-actions { gap: 8px; }
  .control-page .card-actions .button { width: 100%; }
  .control-page .schedule-section,
  .control-page .history-section { margin-top: 28px; }
  .control-page .section-heading { align-items: center; gap: 12px; }
  .control-page .section-heading h2 { font-size: clamp(27px, 8vw, 36px); }
  .control-page .empty-state { padding: 28px 16px; }
  .control-page .schedule-card { gap: 13px; padding: 14px; }
  .control-page .schedule-actions {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .control-page .schedule-actions .button { width: 100%; }
  .control-page .history-section table { min-width: 620px; }
  .control-page dialog {
    width: calc(100% - 16px);
    max-height: calc(100dvh - 16px);
  }
  .control-page .dialog-card,
  .control-page .catalog-dialog .dialog-card,
  .control-page .location-dialog .dialog-card {
    max-height: calc(100dvh - 16px);
    gap: 14px;
    overflow: auto;
    padding: 16px;
  }
  .control-page .dialog-header { gap: 12px; }
  .control-page .dialog-header h2 {
    font-size: clamp(24px, 8vw, 30px);
    line-height: 1;
  }
  .control-page .icon-button {
    min-width: 44px;
    min-height: 44px;
    padding: 4px;
  }
  .control-page .settings-block { padding: 12px; }
  .control-page .catalog-base-levels {
    max-height: 32svh;
    grid-template-columns: 1fr;
  }
  .control-page .catalog-table-wrap { max-height: 42svh; }
  .control-page .manage-row { flex-wrap: wrap; }
  .control-page .location-map-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .control-page .location-map-toolbar > div { align-self: flex-end; }
  .control-page .location-picker-map { height: clamp(260px, 42svh, 340px); }
  .control-page .dialog-actions { width: 100%; }
  .control-page .dialog-actions .button { flex: 1 1 150px; }
  .control-page .toast {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 420px) {
  .control-page .app-shell {
    padding-right: max(10px, env(safe-area-inset-right));
    padding-left: max(10px, env(safe-area-inset-left));
  }
  .control-page .topbar-actions,
  .control-page .hero-actions,
  .control-page .status-actions,
  .control-page .schedule-actions { grid-template-columns: 1fr; }
  .control-page .workspace-picker,
  .control-page #addUnitButton,
  .control-page .status-countdown { grid-column: auto; }
  .control-page .section-heading {
    align-items: stretch;
    flex-direction: column;
  }
  .control-page .folder-actions,
  .control-page .history-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }
  .control-page .folder-actions .button,
  .control-page .history-actions .button { width: 100%; }
  .control-page .section-heading .button { width: 100%; }
  .control-page .address-grid { grid-template-columns: 1fr; }
  .control-page .address-grid .address-wide { grid-column: auto; }
  .control-page .manage-row {
    align-items: stretch;
    flex-direction: column;
  }
  .control-page .manage-row .button { width: 100%; }
  .control-page .dialog-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }
  .control-page .dialog-actions .button {
    width: 100%;
    flex-basis: auto;
  }
  .control-page .location-picker-map { height: 260px; }
}

@media (pointer: coarse) and (max-width: 980px) {
  .control-page .button,
  .control-page input:not([type="checkbox"]),
  .control-page select,
  .control-page .location-result { min-height: 44px; }
  .control-page input[type="checkbox"] {
    width: 22px;
    height: 22px;
  }
}
