/* CamKon Control Center – Basis-Design-System (v2.2) */
:root {
    --bg: #0b1210;
    --bg-glow: #12332a;
    --surface: #101b18;
    --surface-2: #15231f;
    --surface-3: #1a2b26;
    --line: #243731;
    --line-strong: #31473f;
    --text: #eef6f2;
    --text-soft: #c3d2cc;
    --muted: #8fa39c;
    --green: #57e6a4;
    --green-soft: rgba(87, 230, 164, 0.12);
    --green-strong: #2fbf7f;
    --red: #ff7b72;
    --red-soft: rgba(255, 123, 114, 0.12);
    --amber: #fbbf24;
    --amber-soft: rgba(251, 191, 36, 0.12);
    --radius-sm: 9px;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-panel: 0 10px 34px rgba(0, 0, 0, 0.28);
    --focus-ring: 0 0 0 3px rgba(87, 230, 164, 0.22);
    --sidebar: 248px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color-scheme: dark;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background:
        radial-gradient(1100px 520px at 80% -12%, rgba(28, 82, 66, 0.55) 0%, transparent 60%),
        radial-gradient(900px 480px at -10% 110%, rgba(20, 56, 46, 0.4) 0%, transparent 55%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 25px; font-weight: 750; letter-spacing: -0.03em; margin-top: 4px; }
h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }
a { color: var(--green); }

.mono { font-family: "JetBrains Mono", Consolas, "Cascadia Code", monospace; color: #7d968d; font-size: 11px; letter-spacing: 0.02em; }

/* ---------- Grundgerüst ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
    padding: 26px 16px 18px;
    border-right: 1px solid var(--line);
    background: rgba(8, 15, 13, 0.9);
    backdrop-filter: blur(18px);
}

.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; padding: 0 10px 26px; }
.brand-mark {
    display: grid; place-items: center; width: 42px; height: 42px;
    border: 1px solid rgba(87, 230, 164, 0.45); border-radius: 12px;
    background: linear-gradient(150deg, #1d5643 0%, #0d1f1a 90%);
    color: var(--green); font-weight: 800; font-size: 13px; letter-spacing: 0.08em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: -0.01em; }
.brand small { font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--muted); margin-top: 3px; }

.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 12px;
    color: #a4b6af; text-decoration: none;
    padding: 11px 13px; border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 600;
    border: 1px solid transparent;
    transition: background 0.15s ease, color 0.15s ease;
}
.sidebar nav a span { width: 20px; text-align: center; color: #647d74; font-size: 15px; transition: color 0.15s ease; }
.sidebar nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.035); }
.sidebar nav a.active {
    color: var(--text);
    background: linear-gradient(120deg, rgba(87, 230, 164, 0.14) 0%, rgba(87, 230, 164, 0.05) 100%);
    border-color: rgba(87, 230, 164, 0.28);
}
.sidebar nav a.active span, .sidebar nav a:hover span { color: var(--green); }

.sidebar-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); display: flex; gap: 11px; align-items: center; }
.sidebar-foot strong, .sidebar-foot small { display: block; }
.sidebar-foot strong { font-size: 12.5px; }
.sidebar-foot small { font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.pulse, .live-dot {
    width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none;
    box-shadow: 0 0 0 4px rgba(87, 230, 164, 0.14), 0 0 16px rgba(87, 230, 164, 0.8);
    animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(87, 230, 164, 0.05), 0 0 16px rgba(87, 230, 164, 0.55); } }

main { min-width: 0; }

.topbar {
    min-height: 96px; padding: 22px 38px;
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    border-bottom: 1px solid var(--line);
    background: rgba(9, 17, 15, 0.6);
    backdrop-filter: blur(10px);
}
.eyebrow { text-transform: uppercase; color: var(--green); letter-spacing: 0.16em; font-size: 10.5px; font-weight: 800; }
.top-actions { display: flex; align-items: center; gap: 16px; }
.clock { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hint { font-size: 12.5px; color: var(--muted); }
.logout {
    font-size: 13px; font-weight: 650; color: var(--text-soft); text-decoration: none;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 9px 14px;
    transition: border-color 0.15s ease, color 0.15s ease;
}
.logout:hover { border-color: var(--green-strong); color: var(--text); }

.content { padding: 30px 38px 60px; max-width: 1560px; margin: 0 auto; }

/* ---------- Hinweise / Flash ---------- */
.notice {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px; border-radius: var(--radius-sm); margin: 0 0 18px;
    background: var(--green-soft); border: 1px solid rgba(87, 230, 164, 0.3);
    color: #a7f3cf; font-size: 13.5px; font-weight: 550;
}
.notice::before { content: "✓"; font-weight: 800; color: var(--green); }
.notice.error { background: var(--red-soft); border-color: rgba(255, 123, 114, 0.35); color: #ffb4ae; }
.notice.error::before { content: "!"; color: var(--red); }

/* ---------- Leitstand ---------- */
.hero { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; color: var(--green); font-size: 13px; font-weight: 700; }
.hero div { display: flex; align-items: center; gap: 10px; }
.hero p { color: var(--muted); font-size: 12px; font-weight: 500; }

.metrics { display: grid; grid-template-columns: repeat(6, minmax(140px, 1fr)); gap: 14px; margin-bottom: 24px; }
.metric {
    min-height: 118px; padding: 18px 20px;
    border: 1px solid var(--line); border-radius: var(--radius);
    background: linear-gradient(160deg, rgba(23, 40, 35, 0.95) 0%, rgba(12, 22, 19, 0.92) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.metric span, .metric small { display: block; color: var(--muted); }
.metric span { font-size: 12.5px; font-weight: 600; }
.metric strong { display: block; font-size: 32px; font-weight: 750; margin: 12px 0 8px; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.metric small { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; }

.grid-two { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr); gap: 18px; }

/* ---------- Panels ---------- */
.panel {
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    background: rgba(14, 26, 22, 0.88);
    box-shadow: var(--shadow-panel);
    overflow: hidden;
}
.panel + .panel { margin-top: 18px; }
.panel > header {
    min-height: 68px; padding: 16px 22px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.015);
}
.panel > header h2 { margin-top: 3px; }
.panel > header a { color: var(--green); font-size: 12.5px; font-weight: 700; text-decoration: none; }
.panel > header a:hover { text-decoration: underline; }

.camera-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding: 16px; }
.camera-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.camera-card h3 { font-size: 14px; margin: 12px 0 4px; }
.camera-card code { font-family: Consolas, monospace; color: #7d968d; font-size: 11px; }
.camera-card dl { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); padding-top: 12px; margin: 14px 0 0; }
.camera-card dl div + div { border-left: 1px solid var(--line); padding-left: 14px; }
.camera-card dt { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.camera-card dd { margin: 5px 0 0; font-size: 13.5px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Status-Badges ---------- */
.status {
    display: inline-flex; align-items: center; gap: 7px;
    border-radius: 999px; padding: 5px 11px;
    font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: 0.06em;
    background: var(--surface-3); color: var(--muted); white-space: nowrap;
    border: 1px solid var(--line-strong);
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.online { background: var(--green-soft); color: var(--green); border-color: rgba(87, 230, 164, 0.35); }
.status.offline { background: var(--red-soft); color: var(--red); border-color: rgba(255, 123, 114, 0.35); }
.status.neutral { background: var(--amber-soft); color: var(--amber); border-color: rgba(251, 191, 36, 0.3); }

/* ---------- Timeline (Leitstand) ---------- */
.timeline { padding: 6px 20px; }
.timeline article {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center;
    padding: 13px 0; border-bottom: 1px solid var(--line);
}
.timeline article:last-child { border-bottom: 0; }
.timeline strong, .timeline small { display: block; }
.timeline strong { font-size: 13.5px; }
.timeline small { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timeline time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.tag {
    display: inline-grid; place-items: center;
    border: 1px solid rgba(87, 230, 164, 0.35); border-radius: 8px;
    background: rgba(87, 230, 164, 0.08); color: var(--green);
    min-width: 46px; height: 30px; padding: 0 8px;
    font: 700 12px Consolas, monospace;
}

/* ---------- Tabellen ---------- */
.table-panel { min-height: 200px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { text-align: left; padding: 13px 18px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
td:first-child, th:first-child { padding-left: 22px; }
td:last-child, th:last-child { padding-right: 22px; }
th { color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; background: rgba(8, 16, 14, 0.75); position: sticky; top: 0; }
td strong { font-size: 14px; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: rgba(87, 230, 164, 0.035); }
tbody tr:last-child td { border-bottom: 0; }
.block { display: block; margin-top: 4px; }
.error-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 42px 20px !important; font-size: 13.5px; white-space: normal; }

.flash { animation: flash 0.65s ease; }
@keyframes flash { 50% { color: var(--green); } }

/* ---------- Login ---------- */
.login-page {
    min-height: 100vh; display: grid; place-items: center; padding: 26px;
    background: radial-gradient(900px 480px at 50% 6%, rgba(26, 77, 62, 0.5) 0%, transparent 55%), var(--bg);
}
.login-card {
    width: min(440px, 100%); padding: 42px 40px;
    border: 1px solid var(--line-strong); border-radius: 20px;
    background: rgba(12, 23, 19, 0.95);
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.login-brand { padding: 0 0 34px; }
.login-card h1 { margin: 8px 0 10px; font-size: 28px; }
.login-copy { color: var(--muted); font-size: 14px; line-height: 1.6; margin-bottom: 26px; }
.login-card form { display: grid; gap: 8px; }
.login-card label { font-size: 12.5px; color: var(--text-soft); font-weight: 650; margin-top: 10px; }
.login-card input[type="text"], .login-card input[type="password"] {
    width: 100%; height: 48px;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    padding: 0 14px; background: #0a1512; color: var(--text);
    font: inherit; font-size: 14.5px; outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-card input:focus { border-color: var(--green-strong); box-shadow: var(--focus-ring); }
.login-card .remember { display: flex; align-items: center; gap: 9px; color: var(--muted); font-weight: 500; font-size: 13px; }
.login-card .remember input { accent-color: var(--green-strong); width: 16px; height: 16px; }
.login-card button {
    height: 49px; margin-top: 14px; border: 0; border-radius: var(--radius-sm);
    background: linear-gradient(160deg, #63eda9 0%, #2fbf7f 100%);
    color: #06281a; font: inherit; font-size: 15px; font-weight: 800; cursor: pointer;
    transition: filter 0.15s ease, transform 0.05s ease;
}
.login-card button:hover { filter: brightness(1.07); }
.login-card button:active { transform: translateY(1px); }
.login-foot { display: block; text-align: center; color: #5d766c; margin-top: 24px; font-size: 11.5px; }

/* ---------- Responsiv ---------- */
@media (max-width: 1180px) {
    .metrics { grid-template-columns: repeat(3, 1fr); }
    .grid-two { grid-template-columns: 1fr; }
    .shell { --sidebar: 210px; }
    .content, .topbar { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 760px) {
    .shell { display: block; }
    .sidebar { position: relative; width: 100%; height: auto; padding: 14px; }
    .sidebar .brand { padding-bottom: 14px; }
    .sidebar nav { grid-template-columns: repeat(6, 1fr); }
    .sidebar nav a { font-size: 0; justify-content: center; padding: 11px 4px; }
    .sidebar nav a span { font-size: 18px; width: auto; }
    .sidebar-foot { display: none; }
    .topbar { padding: 16px; min-height: 80px; }
    .clock { display: none; }
    h1 { font-size: 21px; }
    .content { padding: 18px 14px 40px; }
    .metrics { grid-template-columns: repeat(2, 1fr); }
    .camera-grid { grid-template-columns: 1fr; }
    .hero p { display: none; }
    th, td { padding: 11px 12px; }
    td:first-child, th:first-child { padding-left: 14px; }
}
