:root {
    --bg: #1c1f24;
    --bg-panel: #262a31;
    --bg-panel-header: #31363f;
    --border: #3a3f47;
    --text: #e6e8ea;
    --text-muted: #9aa0a8;
    --accent: #3d8bfd;
    --green: #2e7d32;
    --orange: #fb8c00;
    --red: #c62828;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

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

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    background: var(--bg-panel-header);
    border-bottom: 1px solid var(--border);
    padding: 10px 16px;
    flex-wrap: wrap;
}
.topbar-brand { font-weight: bold; }
.topbar-nav { display: flex; gap: 14px; flex: 1; }
.topbar-nav a { color: var(--text-muted); padding: 6px 4px; }
.topbar-nav a.active { color: var(--text); border-bottom: 2px solid var(--accent); }
.topbar-user { color: var(--text-muted); font-size: 0.9em; }

.content { padding: 16px; flex: 1; display: flex; flex-direction: column; min-height: 0; }

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

/* Übersicht: gesamte verfügbare Höhe nutzen statt feste Panel-Höhen mit viel Leerraum darunter */
.dashboard {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 0;
}
.dashboard-top {
    flex: 1 1 55%;
    min-height: 220px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}
.dashboard-top .panel { height: 100%; }
.dashboard-map { flex: 1 1 45%; min-height: 240px; display: flex; flex-direction: column; }
.dashboard-map .panel-body { flex: 1; min-height: 0; }
#mini-map { height: 100%; }

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.panel-header {
    background: var(--bg-panel-header);
    padding: 8px 12px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    flex: 0 0 auto;
}
.panel-body { padding: 10px 12px; max-height: 420px; overflow: auto; flex: 1; min-height: 0; }
.dashboard-top .panel-body { max-height: none; }

table { width: 100%; border-collapse: collapse; }
table td, table th { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: left; }
table th { color: var(--text-muted); font-weight: normal; }

.status-dot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    font-size: 0.7em;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0,0,0,0.4);
}
.status-1, .status-2 { background: var(--green); }
.status-3 { background: var(--orange); }
.status-4 { background: var(--red); }
.status-5 { background: var(--accent); }
.status-6 { background: #757575; }

/* Gesamtbild: alle Feuerwehren mit Fahrzeugen+Status, möglichst dicht auf einem Bildschirm */
.gesamtbild-grid {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    grid-auto-rows: 1fr;
    gap: 8px;
}
.gb-card { font-size: 0.85em; }
.gb-card .panel-header { padding: 5px 8px; font-size: 0.95em; }
.gb-card .panel-body { padding: 6px 8px; max-height: none; }
.ds-block { margin-bottom: 6px; }
.ds-name { color: var(--text-muted); font-size: 0.85em; margin-bottom: 2px; }
.ds-fahrzeuge { display: flex; flex-wrap: wrap; gap: 4px; }
.fz-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px 1px 2px;
    color: var(--text);
    font-size: 0.85em;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fz-chip:hover { border-color: var(--accent); text-decoration: none; }
.fz-chip .status-dot { width: 14px; height: 14px; font-size: 0.65em; margin-right: 0; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
    background: var(--accent);
    color: #fff;
}

#map { width: 100%; height: 480px; border-radius: 6px; }
#mini-map { width: 100%; height: 220px; border-radius: 6px; }

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.login-box {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px;
    width: 320px;
}
.login-box h1 { font-size: 1.1em; margin-top: 0; }
.login-box label { display: block; margin-bottom: 12px; }
.login-box input {
    width: 100%;
    padding: 8px;
    margin-top: 4px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text);
}
.login-box button {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    border: none;
    border-radius: 4px;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}
.error { color: var(--red); }
.flash-ok { color: var(--green); }

form.inline { display: inline; }
.toolbar { margin-bottom: 12px; display: flex; gap: 8px; align-items: center; }
.toolbar select, .toolbar input { background: var(--bg); color: var(--text); border: 1px solid var(--border); padding: 6px; border-radius: 4px; }
.muted { color: var(--text-muted); }
