/* SpotOn Base — Reset, Typo, Layout, Navigation */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    font-size: 14px;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 var(--space-3); font-weight: 600; letter-spacing: -0.015em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.95rem; }
p { margin: 0 0 var(--space-3); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, .mono {
    font-family: var(--font-mono);
    font-size: 0.92em;
    letter-spacing: 0;
}

/* Kleine Sektions-Labels — der einzige Uppercase-Einsatz */
.label-caps {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.container {
    width: 100%;
    max-width: 1024px;
    margin: 0 auto;
    padding: var(--space-5) var(--space-4) calc(var(--nav-h) + var(--space-8));
}

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }

/* ---------- Topbar ---------- */

.topbar {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-4);
    height: 54px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    letter-spacing: -0.01em;
}
.brand:hover { text-decoration: none; }
.brand svg { color: var(--accent); }

.topbar nav {
    display: none;
    gap: 0;
    margin-left: var(--space-4);
    height: 100%;
}
.topbar nav a {
    color: var(--text-dim);
    padding: 0 var(--space-3);
    font-size: 0.87rem;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 100%;
    border-bottom: 2px solid transparent;
    transition: color 0.15s;
}
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar nav a.aktiv { color: var(--text); border-bottom-color: var(--accent); }

.topbar-rechts {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-1);
}
.user-chip {
    color: var(--text-faint);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    display: none;
    margin-right: var(--space-2);
}

/* ---------- Bottom-Tab-Bar (Mobil) ---------- */

.tabbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
    display: flex;
    z-index: 60;
    padding-bottom: env(safe-area-inset-bottom);
}

.tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-faint);
    font-size: 0.63rem;
    font-weight: 500;
    font-family: var(--font-mono);
    letter-spacing: 0.04em;
    text-decoration: none !important;
}
.tabbar a svg { width: 20px; height: 20px; }
.tabbar a.aktiv { color: var(--accent); }

@media (min-width: 768px) {
    .topbar nav { display: flex; }
    .user-chip { display: inline; }
    .tabbar { display: none; }
    .container { padding-bottom: var(--space-8); }
}

/* ---------- Icons ---------- */

.icon {
    width: 1.05em;
    height: 1.05em;
    flex-shrink: 0;
    vertical-align: -0.15em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- LED-Status-Punkt (Patchbay-Feel) ---------- */

.led {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 2px;
    flex-shrink: 0;
}
.led-ok { background: var(--ok); }
.led-warn { background: var(--warn); }
.led-bad { background: var(--bad); }
.led-off { background: var(--border-strong); }

/* ---------- Scanner ---------- */

#qr-reader {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: #000;
}
#qr-reader video { display: block; }
#qr-reader img { display: none; }

.scan-zaehler {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dim);
}

.scan-steuerelemente {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    flex-wrap: wrap;
}
.scan-steuerelemente select { width: auto; min-height: 40px; }

.scan-manuell {
    max-width: 520px;
    margin: 0 auto;
}
.scan-manuell .aktionen { flex-wrap: nowrap; }
.scan-manuell .btn { flex: 0 0 auto; }

/* ---------- Print ---------- */

@media print {
    .topbar, .tabbar, .no-print { display: none !important; }
    body { background: #fff; color: #000; }
    .container { max-width: none; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Nav-Gruppen (Dropdowns) ---------- */

.nav-gruppe { position: relative; height: 100%; display: flex; }
.nav-gruppe summary {
    list-style: none;
    cursor: pointer;
    color: var(--text-dim);
    padding: 0 var(--space-3);
    font-size: 0.87rem;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 100%;
    border-bottom: 2px solid transparent;
    user-select: none;
}
.nav-gruppe summary::-webkit-details-marker { display: none; }
.nav-gruppe summary::after {
    content: "";
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
}
.nav-gruppe summary:hover { color: var(--text); }
.nav-gruppe summary.aktiv { color: var(--text); border-bottom-color: var(--accent); }
.nav-gruppe[open] summary { color: var(--text); }
.nav-gruppe[open] summary::after { transform: rotate(225deg) translateY(-1px); }

.nav-menu {
    position: absolute;
    top: calc(100% - 2px);
    left: 0;
    min-width: 220px;
    background: var(--bg-overlay);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: var(--space-1);
    display: flex;
    flex-direction: column;
    z-index: 70;
}
.nav-menu a {
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: 0.87rem;
}
.nav-menu a:hover { background: var(--bg-raised); color: var(--text); text-decoration: none; }

/* Sektions-Label (kleine Caps-Überschrift über Bereichen) */
.label-caps {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin: var(--space-5) 0 var(--space-2);
}
