/* =========================================================
   Azubi- & Praktikantenplaner — Operations Console
   Design System v2
   ---------------------------------------------------------
   Prinzip: Monochrome Chrome, farbige Daten.
   Buttons, Nav, Headings sind neutral (slate).
   Wachen- und Dienst-Farben bleiben unangetastet — sie sind
   der einzige Farbträger im UI und tragen Bedeutung.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* =========================================
   TOKENS
   ========================================= */
:root {
    /* Skala (Slate) */
    --c-0:   #ffffff;
    --c-25:  #fbfcfd;
    --c-50:  #f8fafc;
    --c-100: #f1f5f9;
    --c-150: #e8edf3;
    --c-200: #e2e8f0;
    --c-300: #cbd5e1;
    --c-400: #94a3b8;
    --c-500: #64748b;
    --c-600: #475569;
    --c-700: #334155;
    --c-800: #1e293b;
    --c-900: #0f172a;
    --c-950: #020617;

    /* Ink = die Brand-/Aktion-Farbe (monochrome) */
    --ink:        var(--c-950);
    --ink-hover:  var(--c-800);

    /* Akzent (zurückhaltend, NUR für Links + aktive Nav-States) */
    --c-link:        #2563eb;
    --c-link-hover:  #1d4ed8;
    --c-info-soft:   #eff6ff;
    --c-info-border: #bfdbfe;

    /* Status */
    --c-success:        #15803d;
    --c-success-soft:   #f0fdf4;
    --c-success-border: #bbf7d0;
    --c-warning:        #b45309;
    --c-warning-soft:   #fffbeb;
    --c-warning-border: #fde68a;
    --c-danger:         #b91c1c;
    --c-danger-soft:    #fef2f2;
    --c-danger-border:  #fca5a5;

    /* Backward-Compat-Aliase (alte Klassen) */
    --c-primary:        var(--ink);
    --c-primary-hover:  var(--ink-hover);
    --c-primary-soft:   var(--c-100);
    --c-primary-ring:   rgba(2, 6, 23, 0.12);
    --c-gray-50:  var(--c-50);
    --c-gray-100: var(--c-100);
    --c-gray-200: var(--c-200);
    --c-gray-300: var(--c-300);
    --c-gray-400: var(--c-400);
    --c-gray-500: var(--c-500);
    --c-gray-600: var(--c-600);
    --c-gray-700: var(--c-700);
    --c-gray-800: var(--c-800);
    --c-gray-900: var(--c-900);
    --c-primary-light: var(--ink);
    --c-primary-dark:  var(--ink-hover);
    --c-secondary:        var(--c-600);
    --c-secondary-light:  var(--c-500);
    --c-secondary-dark:   var(--c-700);
    --c-success-light: var(--c-success);
    --c-success-dark:  #166534;
    --c-warning-light: var(--c-warning);
    --c-warning-dark:  #92400e;
    --c-info:          var(--c-link);

    /* Layout */
    --bg-body:           var(--c-50);
    --bg-surface:        var(--c-0);
    --bg-surface-alt:    var(--c-25);
    --bg-surface-hover:  var(--c-100);
    --bg-muted:          var(--c-100);

    /* Text */
    --text-main:      var(--c-900);
    --text-secondary: var(--c-700);
    --text-muted:     var(--c-500);
    --text-faint:     var(--c-400);
    --text-inverse:   #ffffff;

    /* Borders */
    --border-light:  var(--c-200);
    --border-medium: var(--c-300);
    --border-dark:   var(--c-400);

    /* Radien — disziplinierter */
    --radius-sm:   4px;
    --radius-md:   6px;
    --radius-lg:   8px;
    --radius-xl:   12px;
    --radius-2xl:  16px;
    --radius-full: 9999px;

    /* Schatten — sehr zurückhaltend */
    --shadow-xs:  0 1px 2px rgba(2, 6, 23, 0.04);
    --shadow-sm:  0 1px 2px rgba(2, 6, 23, 0.05), 0 1px 3px rgba(2, 6, 23, 0.04);
    --shadow-md:  0 4px 16px rgba(2, 6, 23, 0.06), 0 1px 3px rgba(2, 6, 23, 0.04);
    --shadow-lg:  0 16px 40px rgba(2, 6, 23, 0.10), 0 4px 12px rgba(2, 6, 23, 0.05);
    --shadow-xl:  0 24px 60px rgba(2, 6, 23, 0.14);

    /* Typografie */
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-head: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

    /* Strenge Type-Scale */
    --text-xs:   0.75rem;     /* 12 */
    --text-sm:   0.8125rem;   /* 13 */
    --text-base: 0.875rem;    /* 14 */
    --text-md:   0.9375rem;   /* 15 */
    --text-lg:   1rem;        /* 16 */
    --text-xl:   1.125rem;    /* 18 */
    --text-2xl:  1.25rem;     /* 20 */
    --text-3xl:  1.5rem;      /* 24 */
    --text-4xl:  1.75rem;     /* 28 */
    --text-5xl:  2rem;        /* 32 */

    /* Spacing (4/8-Skala) */
    --space-1:  0.25rem;
    --space-2:  0.5rem;
    --space-3:  0.75rem;
    --space-4:  1rem;
    --space-5:  1.25rem;
    --space-6:  1.5rem;
    --space-8:  2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;

    /* Motion */
    --transition-fast: 100ms ease-out;
    --transition-base: 160ms ease-out;
    --transition-slow: 240ms ease-out;

    /* Z-Index */
    --z-dropdown:       1000;
    --z-sticky:         1020;
    --z-fixed:          1030;
    --z-modal-backdrop: 1040;
    --z-modal:          1050;
    --z-popover:        1060;
    --z-tooltip:        1070;
}

/* =========================================
   RESET & BASE
   ========================================= */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    background: var(--bg-body);
    overflow-x: hidden;
    font-feature-settings: "ss01", "cv11";
}

img, svg, video, canvas, audio, iframe, embed, object {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--c-link);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}
a:hover { color: var(--c-link-hover); }

button { font-family: inherit; cursor: pointer; }
input, textarea, select, button { font: inherit; }
table { border-collapse: collapse; border-spacing: 0; }
ul, ol { list-style: none; }

/* Tabular Nums — alle Zahlen in Daten-Kontext */
.tabular,
table tbody td,
.persons-table input[type="number"],
.month-table td,
.persons-table td {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum", "ss01";
}

/* =========================================
   TYPOGRAPHY
   ========================================= */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-head);
    color: var(--text-main);
    line-height: 1.25;
    letter-spacing: -0.011em;
    font-weight: 600;
}

h1 { font-size: var(--text-4xl); font-weight: 700; letter-spacing: -0.022em; }
h2 { font-size: var(--text-2xl); font-weight: 600; }
h3 { font-size: var(--text-xl); font-weight: 600; }
h4 { font-size: var(--text-lg); font-weight: 600; }
h5 { font-size: var(--text-base); font-weight: 600; }
h6 {
    font-size: var(--text-xs); font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted);
}

p { line-height: 1.55; }

.display-text { font-size: var(--text-5xl); line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; }
.lead-text    { font-size: var(--text-lg); color: var(--text-secondary); max-width: 60ch; }

.text-xs    { font-size: var(--text-xs); }
.text-sm    { font-size: var(--text-sm); }
.text-base  { font-size: var(--text-base); }
.text-lg    { font-size: var(--text-lg); }
.text-xl    { font-size: var(--text-xl); }
.text-2xl   { font-size: var(--text-2xl); }
.text-3xl   { font-size: var(--text-3xl); }
.text-4xl   { font-size: var(--text-4xl); }
.text-left  { text-align: left; }
.text-center{ text-align: center; }
.text-right { text-align: right; }
.text-muted    { color: var(--text-muted); }
.text-primary  { color: var(--text-main); }
.text-secondary{ color: var(--text-secondary); }
.text-success  { color: var(--c-success); }
.text-warning  { color: var(--c-warning); }
.text-danger   { color: var(--c-danger); }
.text-link     { color: var(--c-link); }

.font-mono     { font-family: var(--font-mono); }
.font-light    { font-weight: 300; }
.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }

.uppercase   { text-transform: uppercase; letter-spacing: 0.04em; }
.lowercase   { text-transform: lowercase; }
.capitalize  { text-transform: capitalize; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* =========================================
   LAYOUT
   ========================================= */
.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: var(--space-8) var(--space-5);
}

.container-fluid {
    width: 100%;
    padding: var(--space-6) var(--space-5);
}

/* Grid */
.grid { display: grid; gap: var(--space-6); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 768px) {
    .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .grid-bento   { grid-template-columns: 2fr 1fr; }
    .grid-sidebar { grid-template-columns: 280px minmax(0, 1fr); }
}
.grid-gap-sm { gap: var(--space-2); }
.grid-gap-md { gap: var(--space-4); }
.grid-gap-lg { gap: var(--space-8); }

/* Flex */
.flex          { display: flex; }
.inline-flex   { display: inline-flex; }
.flex-col      { flex-direction: column; }
.flex-row      { flex-direction: row; }
.flex-wrap     { flex-wrap: wrap; }
.flex-nowrap   { flex-wrap: nowrap; }
.flex-1        { flex: 1 1 0; }
.items-start   { align-items: flex-start; }
.items-center  { align-items: center; }
.items-end     { align-items: flex-end; }
.items-stretch { align-items: stretch; }
.justify-start   { justify-content: flex-start; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around  { justify-content: space-around; }
.gap-1 { gap: var(--space-1); } .gap-2 { gap: var(--space-2); } .gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); } .gap-6 { gap: var(--space-6); } .gap-8 { gap: var(--space-8); }

.m-0 { margin: 0; }
.m-1 { margin: var(--space-1); } .m-2 { margin: var(--space-2); } .m-3 { margin: var(--space-3); }
.m-4 { margin: var(--space-4); } .m-6 { margin: var(--space-6); } .m-8 { margin: var(--space-8); }
.m-auto { margin: auto; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: var(--space-1); } .mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); } .mt-6 { margin-top: var(--space-6); } .mt-8 { margin-top: var(--space-8); }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: var(--space-1); } .mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); } .mb-6 { margin-bottom: var(--space-6); } .mb-8 { margin-bottom: var(--space-8); }
.ml-auto { margin-left: auto; } .mr-auto { margin-right: auto; }

.p-0 { padding: 0; }
.p-1 { padding: var(--space-1); } .p-2 { padding: var(--space-2); } .p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); } .p-6 { padding: var(--space-6); } .p-8 { padding: var(--space-8); }
.px-2 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }

.block        { display: block; }
.inline-block { display: inline-block; }
.inline       { display: inline; }
.hidden       { display: none; }
@media (max-width: 767px)  { .hidden-mobile  { display: none; } }
@media (min-width: 768px)  { .hidden-desktop { display: none; } }

.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }

.w-full { width: 100%; }
.h-full { height: 100%; }

/* =========================================
   APP SHELL — geteilte Top-Leiste
   ========================================= */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
}

.app-topbar {
    background: #0a1628;
    border-bottom: 1px solid #0a1628;
    padding: 0 var(--space-5);
    height: 80px;
    min-height: 80px;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    line-height: 0;
    height: 100%;
}
.app-brand-logo {
    height: 64px;
    width: auto;
    display: block;
}

.app-nav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    margin-left: var(--space-6);
}
.app-nav-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 10px;
    font-size: var(--text-sm);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast), color var(--transition-fast);
}
.app-nav-item:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.app-nav-item.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 600;
}
.app-nav-item svg { width: 15px; height: 15px; }

.app-user-zone {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.75);
    font-size: var(--text-sm);
}

/* Sync-Status-Dot in der Topbar — nur auf Mobile sichtbar */
.topbar-sync-dot {
    display: none;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.35);
    flex-shrink: 0;
    margin-right: 2px;
}
.topbar-sync-dot.is-error {
    background: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.4);
}
.topbar-sync-dot.is-stale {
    background: #f59e0b;
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.4);
}
.app-user-name {
    font-weight: 500;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-user-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.7);
    transition: background var(--transition-fast), color var(--transition-fast);
}
.app-user-action:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.app-user-action svg { width: 15px; height: 15px; }

.app-user-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    margin-left: 4px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.08);
    font-size: var(--text-sm);
    font-weight: 500;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.app-user-logout:hover {
    background: rgba(239, 68, 68, 0.22);
    color: #fecaca;
}
.app-user-logout svg { width: 15px; height: 15px; }
@media (max-width: 640px) {
    .app-user-logout span { display: none; }
    .app-user-logout { padding: 6px 8px; }
}

/* === PORTRAIT-WARNING (Vollbild-Overlay auf schmalen Geräten im Hochformat) === */
.portrait-warning {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #0a1628 0%, #1e293b 100%);
    color: #fff;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}
.portrait-warning-inner {
    max-width: 360px;
}
.portrait-warning-icon {
    color: rgba(255,255,255,0.85);
    margin-bottom: 1.25rem;
    animation: portrait-rotate 2.5s ease-in-out infinite;
}
@keyframes portrait-rotate {
    0%, 30%, 100% { transform: rotate(0deg); }
    50%, 80%      { transform: rotate(-90deg); }
}
.portrait-warning h2 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    letter-spacing: -0.012em;
    color: #ffffff !important;
}
.portrait-warning p {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.85) !important;
    line-height: 1.5;
    margin: 0 0 0.85rem;
}
.portrait-warning strong { color: #ffffff !important; }
.portrait-warning-hint {
    font-size: 0.85rem !important;
    color: rgba(255,255,255,0.6) !important;
    margin-top: 1rem !important;
}
/* Nur auf Phone-Hochformat zeigen. Tablets (>= 768px Breite) bleiben in Hochformat normal. */
@media (max-width: 767px) and (orientation: portrait) {
    .portrait-warning { display: flex; }
    .app-topbar, .app-main { display: none !important; }
    body { overflow: hidden; }
}

/* === LANDSCAPE-MOBILE-OPTIMIERUNG === */
/* Schmale Geräte im Querformat (iPhone-Landscape ist 852x393) */
@media (max-width: 932px) and (orientation: landscape) {
    .app-topbar {
        height: 48px;
        min-height: 48px;
        padding: 0 12px;
    }
    .app-brand-logo {
        height: 36px;
    }
    .app-nav {
        margin-left: 12px;
        gap: 2px;
    }
    .app-nav-item {
        padding: 4px 8px;
        font-size: 12px;
    }
    .app-nav-item svg {
        width: 13px;
        height: 13px;
    }
    .app-user-zone {
        gap: 4px;
        padding-left: 8px;
    }
    .app-user-name {
        max-width: 80px;
        font-size: 12px;
    }
    .app-user-action {
        width: 26px;
        height: 26px;
    }
    .app-user-logout {
        padding: 4px 8px;
        font-size: 12px;
    }
    .app-user-logout span { display: none; }
    .app-main {
        padding: 8px;
        max-width: 100% !important;
    }
    .app-main.wide {
        padding: 4px !important;
        max-width: 100% !important;
    }

    /* Settings, Personal-Form, Statistik etc. — Page-Header weg, Padding runter */
    .page-header h1 { font-size: 1.05rem; margin: 0; }
    .page-header p.page-subtitle { font-size: 11px; margin: 2px 0 0; }
    .page-header { padding: 6px 0 8px; margin-bottom: 8px; }
    .settings-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 8px; }
    .settings-card { padding: 12px 14px; }
    .settings-card h3 { font-size: 13px; }
    .settings-card p { font-size: 11px; }
    .card { padding: 10px 12px; }
    .btn { padding: 5px 10px; font-size: 12px; }
    .btn-sm { padding: 3px 8px; font-size: 11px; }
    .form-input, input[type="text"], input[type="password"], input[type="number"], select, textarea {
        font-size: 14px; padding: 6px 10px;
    }
}

.app-topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.app-main {
    flex: 1;
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: var(--space-6) var(--space-5);
}

.app-main.wide {
    max-width: none;
    padding: var(--space-5) var(--space-5);
}

/* =========================================
   PAGE HEADER (Lead + Aktionen)
   ========================================= */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    flex-wrap: wrap;
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
}
.page-header h1 { margin: 0; font-size: var(--text-3xl); }
.page-header .page-subtitle {
    margin: 4px 0 0;
    font-size: var(--text-sm);
    color: var(--text-muted);
}

/* =========================================
   CARDS / PANELS
   ========================================= */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: none;
    transition: border-color var(--transition-fast);
}
.card + .card { margin-top: var(--space-4); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: var(--space-4);
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-light);
    gap: var(--space-3);
}
.card-header h2, .card-header h3 { margin: 0; font-size: var(--text-lg); }
.card-header .icon { color: var(--text-muted); }

/* =========================================
   ICONS
   ========================================= */
.icon {
    display: inline-block;
    width: 16px;
    height: 16px;
    color: currentColor;
    flex-shrink: 0;
    vertical-align: -2px;
}
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 24px; height: 24px; }

/* =========================================
   BUTTONS
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 6px 12px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-main);
    font-weight: 500;
    font-size: var(--text-sm);
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--c-primary-ring);
}
.btn:disabled, .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn .icon { color: currentColor; }

.btn-primary {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-hover); border-color: var(--ink-hover); color: #fff; }

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-color: var(--border-medium);
}
.btn-secondary:hover {
    background: var(--c-50);
    border-color: var(--border-dark);
    color: var(--text-main);
}

.btn-tertiary,
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-tertiary:hover,
.btn-ghost:hover {
    background: var(--c-100);
    color: var(--text-main);
}

.btn-alert {
    background: var(--bg-surface);
    color: var(--c-danger);
    border-color: var(--c-danger-border);
}
.btn-alert:hover { background: var(--c-danger-soft); border-color: var(--c-danger); }

.btn-alert-solid {
    background: var(--c-danger);
    color: #fff;
    border-color: var(--c-danger);
}
.btn-alert-solid:hover { background: #991b1b; border-color: #991b1b; color: #fff; }

.btn-sm { padding: 4px 8px; height: 26px; font-size: var(--text-xs); border-radius: var(--radius-sm); }
.btn-md { padding: 6px 12px; height: 32px; font-size: var(--text-sm); }
.btn-lg { padding: 8px 16px; height: 38px; font-size: var(--text-base); }

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border-radius: var(--radius-md);
}
.btn-icon.btn-sm { width: 26px; height: 26px; }

.btn-group {
    display: inline-flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.btn-group.right { justify-content: flex-end; }

/* =========================================
   FORMS
   ========================================= */
.form-group { margin-bottom: var(--space-4); }

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    line-height: 1.3;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="url"],
input[type="tel"],
input[type="search"],
select,
textarea {
    width: 100%;
    height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--text-main);
    background: var(--bg-surface);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    font-family: inherit;
}
input[type="date"] { line-height: 1.2; }
textarea {
    height: auto;
    min-height: 96px;
    padding: 8px 10px;
    resize: vertical;
    line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px var(--c-primary-ring);
}

input::placeholder, textarea::placeholder {
    color: var(--text-faint);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--c-50);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Required-Marker dezent */
.label-required::after {
    content: "*";
    color: var(--c-danger);
    margin-left: 3px;
}

/* Field-Hint */
.field-hint {
    margin-top: 6px;
    display: block;
    font-size: var(--text-xs);
    color: var(--text-muted);
    line-height: 1.45;
}

/* Form-Row (z.B. zwei nebeneinander) */
.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
}
@media (min-width: 640px) {
    .form-row-2 { grid-template-columns: 1fr 1fr; }
    .form-row-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Switch */
input[type="checkbox"].switch {
    appearance: none;
    width: 32px; height: 18px;
    background: var(--c-300);
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
    transition: background var(--transition-base);
}
input[type="checkbox"].switch::before {
    content: '';
    position: absolute;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: #fff;
    top: 3px; left: 3px;
    transition: transform var(--transition-base);
}
input[type="checkbox"].switch:checked { background: var(--ink); }
input[type="checkbox"].switch:checked::before { transform: translateX(14px); }

/* =========================================
   TABLES
   ========================================= */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
}

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

thead { background: var(--c-50); }

th {
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border-light);
}

td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
    font-size: var(--text-sm);
    line-height: 1.4;
}

tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition-fast); }
tbody tr:hover { background: var(--c-50); }

/* =========================================
   BADGES & PILLS
   ========================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    line-height: 1.5;
    border: 1px solid transparent;
}
.badge-primary  { background: var(--c-100);         color: var(--ink);             border-color: var(--c-200); }
.badge-secondary{ background: var(--c-100);         color: var(--text-secondary);  border-color: var(--c-200); }
.badge-success  { background: var(--c-success-soft); color: var(--c-success-dark);  border-color: var(--c-success-border); }
.badge-warning  { background: var(--c-warning-soft); color: var(--c-warning-dark);  border-color: var(--c-warning-border); }
.badge-danger   { background: var(--c-danger-soft);  color: var(--c-danger);        border-color: var(--c-danger-border); }
.badge-info     { background: var(--c-info-soft);    color: var(--c-link);          border-color: var(--c-info-border); }

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
}
.pill-success { background: var(--c-success-soft); color: var(--c-success-dark); }
.pill-warning { background: var(--c-warning-soft); color: var(--c-warning-dark); }
.pill-neutral { background: var(--c-100);          color: var(--text-secondary); }

/* =========================================
   AVATARS
   ========================================= */
.avatar {
    width: 32px; height: 32px;
    border-radius: var(--radius-full);
    background: var(--c-200);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-weight: 600;
    font-size: var(--text-xs);
    color: var(--text-secondary);
}
.avatar-lg { width: 56px; height: 56px; font-size: var(--text-base); }
.avatar svg { width: 60%; height: 60%; fill: var(--c-500); }

/* =========================================
   FEATURE ICONS
   ========================================= */
.feature-icon {
    width: 36px; height: 36px;
    border-radius: var(--radius-md);
    background: var(--c-100);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-3);
}
.feature-icon svg { width: 18px; height: 18px; }

/* =========================================
   ALERTS
   ========================================= */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
    line-height: 1.5;
}
.alert .icon { margin-top: 2px; flex-shrink: 0; }
.alert-success { background: var(--c-success-soft); border-color: var(--c-success-border); color: var(--c-success-dark); }
.alert-warning { background: var(--c-warning-soft); border-color: var(--c-warning-border); color: var(--c-warning-dark); }
.alert-danger,
.alert-error   { background: var(--c-danger-soft);  border-color: var(--c-danger-border);  color: var(--c-danger); }
.alert-info    { background: var(--c-info-soft);    border-color: var(--c-info-border);    color: var(--c-link); }

/* =========================================
   MODALS
   ========================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-backdrop);
    padding: var(--space-4);
}
.modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    max-width: 520px;
    width: 100%;
    box-shadow: var(--shadow-xl);
}

/* =========================================
   COLLAPSIBLE
   ========================================= */
.collapsible-header { cursor: pointer; user-select: none; }
.collapse-icon {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.18s ease;
}
.collapsible-card.open .collapse-icon,
.collapsible-header.open .collapse-icon { transform: rotate(180deg); }

/* =========================================
   NAV (alte Klassen, abwärtskompatibel)
   ========================================= */
.navbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    padding: var(--space-3) 0;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}
.nav-brand {
    font-weight: 700;
    font-size: var(--text-lg);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.nav-links { display: flex; gap: var(--space-1); align-items: center; }
.nav-item {
    color: var(--text-secondary);
    font-weight: 500;
    padding: 6px 10px;
    border-radius: var(--radius-md);
    transition: background var(--transition-fast), color var(--transition-fast);
    font-size: var(--text-sm);
}
.nav-item:hover { color: var(--text-main); background: var(--c-100); }
.nav-item.active { color: var(--ink); background: var(--c-100); font-weight: 600; }

/* =========================================
   TOASTS / TOOLTIPS (minimal)
   ========================================= */
.toast-container {
    position: fixed;
    top: var(--space-5);
    right: var(--space-5);
    z-index: var(--z-tooltip);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.toast {
    background: var(--ink);
    color: #fff;
    border-radius: var(--radius-md);
    padding: 10px 14px;
    box-shadow: var(--shadow-lg);
    min-width: 240px;
    font-size: var(--text-sm);
}

.tooltip-wrapper { position: relative; display: inline-block; }
.tooltip {
    position: absolute;
    background: var(--c-900);
    color: #fff;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 500;
    white-space: nowrap;
    z-index: var(--z-tooltip);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease;
    pointer-events: none;
    box-shadow: var(--shadow-md);
}
.tooltip-wrapper:hover .tooltip { opacity: 1; visibility: visible; }
.tooltip::before { content: ''; position: absolute; width: 0; height: 0; border-style: solid; }
.tooltip-top    { bottom: calc(100% + 5px); left: 50%; transform: translateX(-50%); }
.tooltip-top::before    { top: 100%; left: 50%; transform: translateX(-50%); border-width: 4px 4px 0; border-color: var(--c-900) transparent transparent; }
.tooltip-bottom { top: calc(100% + 5px); left: 50%; transform: translateX(-50%); }
.tooltip-bottom::before { bottom: 100%; left: 50%; transform: translateX(-50%); border-width: 0 4px 4px; border-color: transparent transparent var(--c-900); }
.tooltip-left   { right: calc(100% + 5px); top: 50%; transform: translateY(-50%); }
.tooltip-right  { left: calc(100% + 5px); top: 50%; transform: translateY(-50%); }
.tooltip-wide   { white-space: normal; max-width: 220px; }

/* =========================================
   FOOTER (abwärtskompatibel, kaum genutzt)
   ========================================= */
.footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-light);
    padding: var(--space-6) 0;
    margin-top: var(--space-12);
    color: var(--text-muted);
    font-size: var(--text-sm);
}

/* =========================================
   UTILITY
   ========================================= */
.muted     { color: var(--text-muted); }
.small     { font-size: var(--text-sm); }
.tiny      { font-size: var(--text-xs); }
.divider   { height: 1px; background: var(--border-light); margin: var(--space-4) 0; border: none; }

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

::selection {
    background: var(--ink);
    color: #fff;
}
