:root {
  --bg: #111315;
  --surface: #181b1f;
  --surface-2: #20252a;
  --surface-3: #282f35;
  --text: #f4f6f8;
  --muted: #a8b0b8;
  --line: #363e46;
  --fire: #d7261e;
  --fire-dark: #9d1712;
  --amber: #f2b84b;
  --green: #33b36b;
  --blue: #4d9de0;
  --danger: #ef5b5b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(215, 38, 30, 0.08), transparent 34%),
    var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: 268px;
  padding: 24px;
  background: #14171a;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 6px;
  background: var(--fire);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.22);
  color: white;
  font-weight: 900;
}

.brand small,
.muted,
.hint,
.item small,
.vehicle-card small {
  color: var(--muted);
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  padding: 12px 14px;
  border-radius: 6px;
  color: var(--muted);
}

nav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.content {
  width: 100%;
  padding: 32px;
}

.centered {
  display: grid;
  place-items: center;
}

.login-panel,
.panel,
.table-panel,
.overview-panel,
.vehicle-card,
.stat {
  width: 100%;
  background: rgba(24, 27, 31, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-panel {
  max-width: 420px;
  padding: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 34px;
}

h2 {
  font-size: 20px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101316;
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--fire);
  color: white;
  cursor: pointer;
  font-weight: 800;
  padding: 11px 14px;
}

button:hover {
  background: var(--fire-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.ghost-button:hover {
  background: var(--surface-3);
}

.danger-button {
  border-color: rgba(239, 91, 91, 0.55);
  color: #ffb8b8;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 11px;
  font-size: 14px;
  font-weight: 800;
}

.ghost-link:hover {
  background: var(--surface-3);
}

.alert {
  border-radius: 6px;
  background: rgba(239, 91, 91, 0.14);
  color: #ffb8b8;
  padding: 12px;
}

.page-header,
.section-title,
.item,
.inline-form,
.vehicle-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-header {
  margin-bottom: 24px;
}

.operator,
.badge,
.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 7px 10px;
  white-space: nowrap;
}

.status-pill {
  border-color: rgba(255, 255, 255, 0.12);
  background: var(--surface-3);
  color: white;
  font-weight: 800;
}

.status-1,
.status-2,
.status-9 {
  background: rgba(51, 179, 107, 0.18);
  border-color: rgba(51, 179, 107, 0.5);
}

.status-3,
.status-4,
.status-7,
.status-8 {
  background: rgba(77, 157, 224, 0.18);
  border-color: rgba(77, 157, 224, 0.5);
}

.status-5 {
  background: rgba(242, 184, 75, 0.18);
  border-color: rgba(242, 184, 75, 0.55);
}

.status-6 {
  background: rgba(239, 91, 91, 0.18);
  border-color: rgba(239, 91, 91, 0.55);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.dashboard-stats {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.stats-grid.compact .stat {
  padding: 14px 16px;
}

.stat {
  padding: 18px;
  border-left: 4px solid var(--fire);
  min-width: 0;
}

.stat small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat strong {
  display: block;
  font-size: 32px;
  line-height: 1;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}

.two-column.spaced {
  margin-top: 24px;
}

.spaced {
  margin-top: 24px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 24px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.admin-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.incident-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 24px;
  align-items: start;
}

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

.management-list,
.compact-list {
  display: grid;
  gap: 10px;
}

.item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.item div {
  display: grid;
  gap: 5px;
}

.incident-item {
  border-left: 4px solid var(--fire);
}

.priority-high,
.priority-urgent {
  border-color: var(--amber);
  color: #ffd28c;
}

.table-panel,
.panel,
.overview-panel {
  padding: 18px;
}

.overview-panel {
  position: sticky;
  top: 24px;
}

.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 420px));
  gap: 18px;
  align-items: start;
  justify-content: start;
}

.vehicle-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border-top: 4px solid var(--fire);
  max-width: 420px;
}

.vehicle-head div {
  display: grid;
  gap: 4px;
}

.radio-display {
  display: grid;
  gap: 4px;
  min-height: 72px;
  border-radius: 6px;
  background: #0d1114;
  border: 1px solid #303942;
  padding: 14px;
}

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

.radio-display strong {
  font-size: 18px;
}

.radio-keypad {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.radio-keypad button {
  background: #2b3239;
  border: 1px solid #414b55;
  color: var(--text);
  width: 34px;
  height: 32px;
  min-height: 0;
  padding: 0;
  aspect-ratio: auto;
  font-size: 14px;
}

.radio-keypad button:hover,
.radio-keypad button.active {
  background: var(--fire);
  border-color: var(--fire);
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-chip {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 32px;
  min-height: 0;
  border-radius: 6px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

.status-chip:hover,
.status-chip.active {
  background: var(--fire);
  border-color: var(--fire);
}

.status-board {
  display: grid;
  gap: 9px;
}

.status-row {
  display: grid;
  grid-template-columns: 52px 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161a;
  padding: 9px;
}

.status-row strong {
  font-size: 20px;
  text-align: right;
}

.status-row small {
  color: var(--muted);
}

.dispatch-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.dispatch-box legend {
  color: var(--amber);
  font-weight: 800;
  padding: 0 8px;
}

fieldset[disabled] {
  border: 0;
  margin: 0;
  padding: 0;
  opacity: 0.82;
}

.dispatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.dispatch-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #11161a;
  color: var(--text);
  padding: 10px;
}

.dispatch-option input {
  width: auto;
  margin-top: 3px;
}

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

.assigned-list {
  display: flex !important;
  flex-wrap: wrap;
  gap: 6px;
}

.assigned-list span {
  border-radius: 999px;
  background: rgba(215, 38, 30, 0.16);
  border: 1px solid rgba(215, 38, 30, 0.38);
  color: #ffd0ce;
  padding: 5px 8px;
  font-size: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px;
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 700;
}

.inline-form select {
  min-width: 210px;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}

.management-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #13171b;
  overflow: hidden;
}

.management-row summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 13px 14px;
  list-style: none;
}

.management-row summary::-webkit-details-marker {
  display: none;
}

.management-row summary span:first-child {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.management-row summary strong,
.management-row summary small {
  display: block;
  min-width: 0;
}

.management-row summary strong {
  overflow-wrap: anywhere;
}

.management-row summary .badge,
.management-row summary .status-pill {
  justify-self: end;
}

.management-row summary::before {
  content: "Bearbeiten";
  grid-column: 1 / -1;
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.compact-form {
  border-top: 1px solid var(--line);
  padding: 14px;
}

.password-reset-form {
  border-top-style: dashed;
}

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

.empty {
  color: var(--muted);
  padding: 16px 0;
}

@media (max-width: 1100px) {
  .incident-layout,
  .two-column,
  .dashboard-layout,
  .admin-grid,
  .admin-grid.two,
  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .overview-panel {
    position: static;
  }
}

@media (max-width: 900px) {
  .app-shell,
  .page-header,
  .item,
  .inline-form {
    align-items: stretch;
    flex-direction: column;
  }

  .management-row summary {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 20px;
  }

  .vehicle-grid {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .vehicle-card {
    max-width: none;
  }

  .status-chip,
  .radio-keypad button {
    width: 38px;
    height: 34px;
  }
}
