/* ==========================================================================
   Zeiterfassung Verwaltung - Admin-CSS
   Inspired by Argon Dashboard (Creative Tim)
   --------------------------------------------------------------------------
   Farbpalette, Shadow- und Spacing-Tokens an Argon angelehnt.
   Bewusst handgeschrieben (kein CSS-Framework), damit Server keine externen
   Abhängigkeiten zieht und das Stylesheet schnell lädt.
   ========================================================================== */

:root {
    /* === Brand / accent === */
    --primary:        #5e72e4;
    --primary-dark:   #4756c8;
    --primary-darker: #3f4ec0;
    --primary-soft:   #e7e9fb;
    --info:           #11cdef;
    --info-dark:      #0bb0cf;
    --success:        #2dce89;
    --success-dark:   #1aae6f;
    --warning:        #fb6340;
    --warning-dark:   #f93903;
    --danger:         #f5365c;
    --danger-dark:    #ec0c38;

    --info-soft:      #d8f4fb;
    --success-soft:   #d4f8e7;
    --warning-soft:   #ffe8db;
    --danger-soft:    #fdebef;

    /* === Greys === */
    --white:    #ffffff;
    --gray-100: #f6f9fc;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #8898aa;
    --gray-700: #525f7f;
    --gray-800: #32325d;
    --gray-900: #172b4d;

    --bg-app:   #f8f9fe;

    /* === Shadows === */
    --shadow-sm:    0 0 1rem  0 rgba(136,152,170,.10);
    --shadow-card:  0 0 2rem  0 rgba(136,152,170,.15);
    --shadow-lg:    0 0 3rem  0 rgba(136,152,170,.20);
    --shadow-btn:   0 4px 6px rgba(50,50,93,.11), 0 1px 3px rgba(0,0,0,.08);
    --shadow-btn-h: 0 7px 14px rgba(50,50,93,.10), 0 3px 6px rgba(0,0,0,.08);

    /* === Misc === */
    --radius-sm: .25rem;
    --radius:    .375rem;
    --radius-lg: .5rem;
}

/* === Base === */
* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-app);
    color: var(--gray-700);
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: .875rem;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-dark); text-decoration: none; }

h1, h2, h3, h4, h5 { color: var(--gray-900); margin: 0 0 .5rem; font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
.muted { color: var(--gray-600); }
.muted.small { font-size: .8125rem; }

code {
    font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
    background: var(--gray-100);
    padding: .15rem .4rem;
    border-radius: var(--radius-sm);
    font-size: .85em;
    color: var(--gray-800);
}

/* ==========================================================================
   LAYOUT - Sidebar + Main
   ========================================================================== */

body.has-sidebar { display: flex; }

.sidebar {
    width: 260px;
    /* Feste Viewport-Hoehe (nicht min-height): nur so bleibt die fixe Sidebar
       auf den Bildschirm begrenzt und der innere Nav-Bereich kann scrollen.
       Mit min-height:100vh wuerde die Sidebar bei vielen Menuepunkten ueber
       den Viewport hinauswachsen und der untere Teil (inkl. Logout) waere bei
       position:fixed nicht mehr erreichbar. */
    height: 100vh;
    background: var(--white);
    box-shadow: var(--shadow-card);
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.5rem 1.5rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    text-decoration: none;
}

.brand-mark {
    width: 38px; height: 38px;
    border-radius: var(--radius);
    background: linear-gradient(87deg, var(--primary) 0, #825ee4 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: .9rem;
    box-shadow: 0 4px 6px rgba(94,114,228,.2);
    flex-shrink: 0;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.brand-sub  { font-size: .7rem; color: var(--gray-600); text-transform: uppercase; letter-spacing: 1px; }

.sidebar-nav {
    flex: 1 1 auto;
    /* min-height:0 ist noetig, damit der Flex-Bereich UNTER seine Inhaltshoehe
       schrumpfen darf und somit overflow-y:auto greift (Flex-Default ist
       min-height:auto, was das Scrollen verhindert). */
    min-height: 0;
    padding: 1rem 0;
    margin: 0;
    overflow-y: auto;
}

/* Kategorisierte Gruppen in der Sidebar */
.sidebar-nav .nav-group {
    margin-bottom: 0.75rem;
}
.sidebar-nav .nav-group-title {
    padding: 0.6rem 1.5rem 0.35rem;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--gray-500);
}
.sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar-nav li { margin: 0; padding: 0; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .75rem 1.5rem;
    color: var(--gray-700);
    font-weight: 600;
    font-size: .8125rem;
    border-left: 3px solid transparent;
    transition: all .15s ease;
}

.sidebar-nav a .icon {
    width: 1.25rem;
    text-align: center;
    color: var(--gray-500);
    font-size: 1rem;
    transition: color .15s;
}

.sidebar-nav a:hover {
    color: var(--primary);
    background: var(--gray-100);
}
.sidebar-nav a:hover .icon { color: var(--primary); }

.sidebar-nav a.active {
    color: var(--primary);
    border-left-color: var(--primary);
    background: var(--primary-soft);
}
.sidebar-nav a.active .icon { color: var(--primary); }

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-200);
}
.sidebar-footer a {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--danger);
    font-weight: 600;
    font-size: .8125rem;
}
.sidebar-footer a:hover { color: var(--danger-dark); }

/* === Main column === */
.main {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* === Page header (Gradient) === */
.page-header {
    background: linear-gradient(87deg, var(--info) 0, #1171ef 100%);
    color: white;
    padding: 3rem 2rem 7rem;
    position: relative;
}

.page-header h1 {
    color: white;
    margin: 0 0 .25rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.page-header .breadcrumb {
    color: rgba(255,255,255,.85);
    font-size: .8125rem;
    margin: 0;
}

.page-header.compact { padding: 2.5rem 2rem 4.5rem; }

/* Header als Flex: Titel links, Quick-Actions rechts */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.page-header-text { min-width: 0; }
.page-eyebrow {
    color: rgba(255,255,255,.7);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    margin-bottom: .15rem;
}
.page-header-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}
/* Action-Buttons im Header lesen auf dem blauen Verlauf */
.page-header-actions .btn {
    background: rgba(255,255,255,.16);
    border-color: rgba(255,255,255,.3);
    color: white;
    box-shadow: none;
}
.page-header-actions .btn:hover {
    background: rgba(255,255,255,.28);
    border-color: rgba(255,255,255,.5);
}
.page-header-actions .btn.primary {
    background: white;
    color: var(--info, #11cdef);
    border-color: white;
}
.page-header-actions .btn.primary:hover { background: rgba(255,255,255,.9); }

/* === Toast (Flash-Feedback) === */
.toast-root {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    pointer-events: none;
}
.toast {
    background: var(--gray-900, #1a2233);
    color: white;
    padding: .8rem 1.1rem;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
    font-size: .9rem;
    max-width: 360px;
    pointer-events: auto;
    animation: toast-in .25s ease both;
    border-left: 4px solid var(--success, #2dce89);
}
.toast.hide { animation: toast-out .3s ease forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(12px); } }
@media (max-width: 720px) {
    .toast-root { left: 1rem; right: 1rem; bottom: 1rem; }
    .toast { max-width: none; }
}

/* Body floats up over header */
.page-body {
    padding: 0 2rem 2rem;
    margin-top: -5rem;
    flex: 1;
    position: relative;
    z-index: 1;
}
.page-body.no-overlap { margin-top: 1.5rem; }

/* === Footer === */
.page-footer {
    text-align: center;
    color: var(--gray-600);
    padding: 1.5rem;
    font-size: .8125rem;
}
.page-footer a { color: var(--gray-700); font-weight: 600; }

/* ==========================================================================
   CARDS
   ========================================================================== */

.card {
    background: var(--white);
    border: 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: white;
}

.card-header h2,
.card-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--gray-900);
}

.card-body { padding: 1.5rem; }

/* === Stat card === */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.stat-card .stat-label {
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: .65rem;
    font-weight: 700;
    color: var(--gray-600);
}

.stat-card .stat-value {
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-card .stat-icon {
    width: 48px; height: 48px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 4px 6px rgba(0,0,0,.07);
}
.stat-icon.primary { background: linear-gradient(87deg, var(--primary), #825ee4); }
.stat-icon.success { background: linear-gradient(87deg, var(--success), #1ec78a); }
.stat-icon.warning { background: linear-gradient(87deg, var(--warning), #fbb140); }
.stat-icon.danger  { background: linear-gradient(87deg, var(--danger),  #f56036); }
.stat-icon.info    { background: linear-gradient(87deg, var(--info),    #1171ef); }

/* ==========================================================================
   FORMS
   ========================================================================== */

label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--gray-700);
    font-size: .8125rem;
}

label.checkbox {
    font-weight: 400;
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .75rem;
    cursor: pointer;
    color: var(--gray-700);
}

input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary);
    cursor: pointer;
}

input[type="text"], input[type="email"], input[type="tel"], input[type="url"],
input[type="search"], input[type="password"], input[type="number"],
input[type="file"], textarea, select {
    display: block;
    margin-top: .25rem;
    width: 100%;
    padding: .625rem .75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    color: var(--gray-700);
    font: inherit;
    font-size: .875rem;
    box-shadow: 0 1px 3px rgba(50,50,93,.04);
    transition: border-color .15s, box-shadow .15s;
}

input[type="text"]:focus, input[type="email"]:focus, input[type="tel"]:focus,
input[type="url"]:focus, input[type="search"]:focus, input[type="password"]:focus,
input[type="number"]:focus, textarea:focus, select:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(94,114,228,.18);
}

input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 4px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: white;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(50,50,93,.05);
}

input[type="file"] {
    padding: .35rem;
    cursor: pointer;
}

textarea { min-height: 110px; resize: vertical; }

/* === Form layouts === */
.form-grid label { display: block; }
/* Ausnahmen: Karten-Labels (Color-Picker, Layout-Mockup, Backend-Switch) muessen
   ihr eigenes Flex-Layout behalten, sonst kippen Swatch/Mockup neben dem Text
   weg. Spezifitaet 0,2,1 schlaegt die 0,1,1-Regel "form-grid label". */
.form-grid .color-card  { display: flex; }
.form-grid .layout-card { display: flex; }

.row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.row > .grow { flex: 1 1 220px; min-width: 0; }
.row > * { margin-bottom: 0 !important; }

/* Form-Action-Bar: zieht sich zum Card-Rand und sitzt mit grauem Hintergrund
   auf wie die Footer-Leiste eines Material-Dialogs. */
.form-actions {
    display: flex;
    gap: .75rem;
    margin: 2.5rem -1.5rem -1.5rem;
    padding: 1.25rem 1.75rem;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-100);
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

/* === Section heading inside card === */
.section { margin-bottom: 2rem; }
.section + .section { margin-top: 2.5rem; }
.section-head {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin-bottom: 1.25rem;
    padding-bottom: .85rem;
    border-bottom: 1px solid var(--gray-200);
}
.section-icon {
    width: 38px; height: 38px;
    border-radius: var(--radius);
    background: var(--primary-soft);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}
.section-icon.warm   { background: var(--warning-soft); color: var(--warning-dark); }
.section-icon.info   { background: var(--info-soft);    color: var(--info-dark); }
.section-icon.green  { background: var(--success-soft); color: var(--success-dark); }
.section-icon.red    { background: var(--danger-soft);  color: var(--danger-dark); }
.section-head .section-text { flex: 1; min-width: 0; }
.section-head h3 { margin: 0; }
.section-head .section-desc {
    font-size: .8125rem;
    color: var(--gray-600);
    margin: .125rem 0 0;
}

/* === Asset cards === */
.asset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin-bottom: .75rem;
}
.asset-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: .65rem;
    transition: border-color .15s, box-shadow .15s;
}
.asset-card:hover { border-color: var(--gray-400); box-shadow: var(--shadow-sm); }

.asset-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
}
.asset-name {
    font-weight: 700;
    color: var(--gray-900);
    font-size: .875rem;
}
.asset-meta {
    font-size: .7rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.asset-preview-img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
}
.asset-preview-empty {
    width: 100%;
    height: 130px;
    border-radius: var(--radius-sm);
    background: var(--gray-100);
    border: 2px dashed var(--gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);
    font-size: 1.5rem;
}
.asset-card audio { width: 100%; margin: 0; }

.asset-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: auto;
}
.asset-card input[type="file"] {
    position: absolute;
    width: .1px; height: .1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}
.file-label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .85rem;
    background: white;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    font-size: .75rem;
    font-weight: 700;
    transition: background .15s, color .15s;
    line-height: 1;
}
.file-label:hover { background: var(--primary); color: white; }
.file-label-text { display: inline-block; }
.asset-remove {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .75rem;
    color: var(--gray-600);
    cursor: pointer;
}
.asset-remove input { accent-color: var(--danger); }

/* === Color-Picker-Grid ===
   Statt das Native-Color-Input zu zeigen (variiert pro Browser), legen wir es
   transparent über ein eigenes Swatch-Element. Das Swatch bekommt seinen
   Hintergrund per inline-style oder JS - so sieht man die ausgewählte Farbe
   auf jeden Fall in voller Größe. Beim Klick öffnet sich der Native-Picker. */
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: .85rem;
    margin-bottom: .5rem;
}
.color-card {
    position: relative;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: .85rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s, transform .15s;
}
.color-card:hover {
    box-shadow: var(--shadow-card);
    border-color: var(--gray-400);
    transform: translateY(-1px);
}

/* Großer Farb-Swatch: 56x56px, weißer 3px-Innenrand + Schatten = "schwebend" */
.color-card .swatch {
    width: 56px;
    height: 56px;
    border-radius: var(--radius);
    flex-shrink: 0;
    position: relative;
    box-shadow:
        inset 0 0 0 3px white,
        0 0 0 1px var(--gray-300),
        0 4px 8px rgba(0,0,0,.10);
    background: var(--gray-100);    /* Fallback - wird durch inline-style überschrieben */
    background-image: linear-gradient(45deg, rgba(0,0,0,.04) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.04) 75%),
                      linear-gradient(45deg, rgba(0,0,0,.04) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.04) 75%);
    background-size: 12px 12px;
    background-position: 0 0, 6px 6px;
}

/* Color-Input ist unsichtbar darüber, fängt aber den Klick und öffnet den Native-Picker */
.color-card .swatch input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    background: transparent;
    opacity: 0;
    box-shadow: none;
}

.color-info { flex: 1; min-width: 0; }
.color-info .label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-600);
    font-weight: 700;
    margin-bottom: .2rem;
}
.color-info .hex {
    font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
    font-size: .9rem;
    color: var(--gray-900);
}

/* === Layout-Mode-Auswahl ===
 * Visuelle Radio-Karten, die den jeweiligen Modus als kleines Mockup zeigen.
 * Die Karten verhalten sich wie Color-Cards (Hover-Effekt, Auswahl-Border). */
.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .85rem;
    margin-bottom: .5rem;
}
.layout-card {
    position: relative;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: .85rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: box-shadow .15s, border-color .15s, transform .15s;
}
.layout-card:hover {
    box-shadow: var(--shadow-card);
    border-color: var(--gray-400);
    transform: translateY(-1px);
}
.layout-card.selected {
    border-color: #5e72e4;
    box-shadow: 0 0 0 2px rgba(94,114,228,.20);
}
.layout-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
/* Mockup: kleiner stilisierter Kiosk-Bildschirm */
.layout-mockup {
    flex-shrink: 0;
    width: 64px;
    height: 44px;
    border-radius: 4px;
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    position: relative;
    overflow: hidden;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    align-items: stretch;
    justify-content: space-between;
}
.layout-mockup .lm-row {
    background: #f8fafc;
    border-radius: 1.5px;
    height: 6px;
}
.layout-mockup .lm-row.mid { flex: 1; background: #1f2937; }
.layout-mockup .lm-row.bot { background: rgba(248,250,252,.55); height: 4px; }
/* Schmaler Modus: Padding der Mockup-Reihen vergrößern, damit man "Wallpaper-
 * Streifen" links/rechts sieht. */
.layout-mockup.narrow {
    padding-left: 14px;
    padding-right: 14px;
}
.layout-mockup.default {
    background: var(--gray-100);
    color: var(--gray-500);
    align-items: center;
    justify-content: center;
}
.layout-mockup.default .lm-default {
    font-size: 1.4rem;
    font-weight: 700;
}
.layout-info { flex: 1; min-width: 0; }
.layout-info strong {
    display: block;
    font-size: .9rem;
    color: var(--gray-900);
    font-weight: 700;
    margin-bottom: .15rem;
}

/* === API-Test-Bar === */
.api-test-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    margin: 1rem 0 0;
}
.api-test-status {
    flex: 1;
    font-size: .8125rem;
    color: var(--gray-600);
    line-height: 1.4;
}
.api-test-status.testing { color: var(--gray-700); font-style: italic; }
.api-test-status.success {
    color: var(--success-dark);
    font-weight: 600;
}
.api-test-status.danger {
    color: var(--danger-dark);
    font-weight: 600;
}
.api-test-status .icon { margin-right: .35rem; }

/* === Preview === */
.preview {
    margin: 0 0 1rem;
    padding: 1rem;
    background: var(--gray-100);
    border-radius: var(--radius);
    text-align: center;
}
.preview img {
    max-width: 280px;
    max-height: 160px;
    border-radius: var(--radius-sm);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.preview audio { width: 100%; }

/* ==========================================================================
   TABS
   ========================================================================== */
.tabs {
    display: flex;
    gap: .25rem;
    background: var(--gray-100);
    padding: .375rem;
    margin: -1.5rem -1.5rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    overflow-x: auto;
}

.tab {
    background: transparent;
    border: 0;
    padding: .55rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 600;
    color: var(--gray-700);
    font-size: .8125rem;
    transition: background .15s, color .15s, box-shadow .15s;
    white-space: nowrap;
}
.tab:hover { color: var(--primary); }
.tab.active {
    background: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
fieldset.tab-panel { border: 0; padding: 0; margin: 0; }

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .55rem 1.125rem;
    border: 1px solid var(--gray-300);
    background: white;
    color: var(--gray-700);
    border-radius: var(--radius);
    font: inherit;
    font-size: .8125rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    box-shadow: var(--shadow-btn);
    transition: transform .12s, box-shadow .15s, background .15s, color .15s;
    line-height: 1.4;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-btn-h); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn.primary { background: var(--primary); border-color: var(--primary); color: white; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: white; }

.btn.success { background: var(--success); border-color: var(--success); color: white; }
.btn.success:hover { background: var(--success-dark); border-color: var(--success-dark); color: white; }

.btn.danger { background: white; border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: white; }

.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--gray-100); }

.btn.small { padding: .35rem .75rem; font-size: .75rem; }
.btn.block { width: 100%; }

/* Aktions-Zelle: bewusst KEIN display:flex auf dem <td> — ein Flex-Tabellen-
   zelle wird aus dem Tabellen-Layout geloest, streckt sich nicht auf die
   Zeilenhoehe und die Buttons/Trennlinie sitzen dann versetzt zur restlichen
   Zeile. Stattdessen bleibt das <td> eine echte Tabellenzelle (vertical-align
   middle) und die Buttons werden inline-block mit fester Mittel-Ausrichtung
   nebeneinander gelegt. */
.row-actions {
    white-space: nowrap;
    vertical-align: middle;
}
.row-actions > a.btn,
.row-actions > .inline,
.row-actions > button,
.row-actions > .row-menu {
    display: inline-block;
    vertical-align: middle;
    margin: 0;
}
.row-actions > * + * { margin-left: .375rem; }

/* === Per-Zeile Aktionsmenue (JS-frei via <details>) ===
   Native <details>/<summary> — ueberlebt den AJAX-Austausch der tbody-Zeilen
   ohne Re-Binding. Das Popup ist absolut positioniert; damit es nicht vom
   overflow:hidden des Tabellen-Wraps abgeschnitten wird, schaltet das Wrap
   per :has() auf overflow:visible, sobald ein Menue offen ist. */
.row-menu { position: relative; }
.row-menu > summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
    padding: .35rem .6rem;
    font-size: .9rem;
    line-height: 1;
    border: 1px solid var(--gray-300, #d3d6e0);
    border-radius: 6px;
    background: white;
    color: var(--gray-700, #45506b);
}
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu[open] > summary { background: var(--gray-100, #f0f2f7); border-color: var(--gray-400, #b7bcce); }
.row-menu-pop {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    z-index: 40;
    min-width: 190px;
    background: white;
    border: 1px solid var(--gray-200, #e6e8ef);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(15,23,42,.18);
    padding: .35rem;
    text-align: left;
    white-space: nowrap;
}
.row-menu-pop form { margin: 0; display: block; }
.row-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: .5rem .65rem;
    border: none;
    background: none;
    border-radius: 6px;
    font-size: .85rem;
    color: var(--gray-800, #2b3450);
    cursor: pointer;
    text-decoration: none;
    box-shadow: none;
}
.row-menu-item:hover { background: var(--gray-100, #f0f2f7); }
.row-menu-item.danger { color: var(--danger, #f5365c); }
.row-menu-item.danger:hover { background: #fde8ec; }
.row-menu-sep { height: 1px; background: var(--gray-200, #e6e8ef); margin: .35rem .25rem; }
/* Wrap nicht clippen, solange ein Menue offen ist (modernes :has()). */
.data-table-wrap:has(.row-menu[open]) { overflow: visible; }
.card:has(.row-menu[open]) { overflow: visible; }

/* === Sprung-Navigation fuer lange Settings-Seiten ===
   Rein additiv: Pills scrollen zum jeweiligen Abschnitt. Aendert NICHTS an
   Formular-Struktur oder -Uebermittlung. */
.section-jumpnav {
    position: sticky;
    top: .5rem;
    z-index: 20;
    display: flex;
    gap: .4rem;
    flex-wrap: wrap;
    padding: .5rem .6rem;
    margin-bottom: 1rem;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(6px);
    border: 1px solid var(--gray-200, #e6e8ef);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
}
.section-jumpnav a {
    padding: .35rem .7rem;
    border-radius: 6px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray-700, #45506b);
    text-decoration: none;
    white-space: nowrap;
}
.section-jumpnav a:hover { background: var(--gray-100, #f0f2f7); color: var(--primary, #5e72e4); }
/* Scroll-Ziel-Offset, damit die sticky Sprung-Nav den Abschnitt nicht verdeckt */
.globals-stack > .card[id] { scroll-margin-top: 4.5rem; }
html { scroll-behavior: smooth; }

/* ==========================================================================
   TABLES
   ========================================================================== */
.data-table-wrap {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

.data-table thead { background: var(--gray-100); }

.data-table th {
    padding: .85rem 1.5rem;
    text-align: left;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.data-table td {
    padding: 1rem 1.5rem;
    color: var(--gray-700);
    font-size: .8125rem;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--gray-100); }
.data-table tbody tr:last-child td { border-bottom: 0; }

.data-table td a { color: var(--primary); font-weight: 600; }

/* ==========================================================================
   STATUS DOTS / BADGES
   ========================================================================== */
.dot {
    display: inline-block;
    width: .55rem;
    height: .55rem;
    border-radius: 50%;
    margin-right: .55rem;
    vertical-align: middle;
}
.dot-ok      { background: var(--success); box-shadow: 0 0 0 3px rgba(45,206,137,.18); }
.dot-warn    { background: var(--warning); box-shadow: 0 0 0 3px rgba(251,99,64,.18); }
.dot-down    { background: var(--danger);  box-shadow: 0 0 0 3px rgba(245,54,92,.18); }
.dot-unknown { background: var(--gray-400); }

.ok-text   { color: var(--success);  font-weight: 600; }
.warn-text { color: var(--warning);  font-weight: 600; }
.down-text { color: var(--danger);   font-weight: 600; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: .25rem .55rem;
    font-size: .6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-radius: 10rem;
    background: var(--gray-200);
    color: var(--gray-700);
}
.badge.ok      { background: var(--success-soft); color: var(--success-dark); }
.badge.warn    { background: var(--warning-soft); color: var(--warning-dark); }
.badge.danger  { background: var(--danger-soft);  color: var(--danger-dark); }
.badge.info    { background: var(--info-soft);    color: var(--info-dark); }
.badge.primary { background: var(--primary-soft); color: var(--primary-dark); }

/* ==========================================================================
   KIOSK-PREVIEW: Live-Render im Browser, der dem Tablet-Kiosk nachempfunden ist.
   Wird im Terminal-Form, Group-Form und in den Globals angezeigt. Reagiert
   live (per JS) auf Änderungen an Color-Pickern, File-Inputs und Statustext.
   Zwei Tablets nebeneinander: links Stempel-Modus, rechts Bildschirmschoner.
   ========================================================================== */
.kp-preview-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-start;
    justify-content: center;
}
.kp-preview-cell {
    flex: 1 1 360px;
    min-width: 260px;
    max-width: 760px;
}

/* Kompakter Modus: wird in /terminals/* und /groups/* benutzt, wo die
   Vorschau direkt unter den Tabs sitzt. Tablets etwa zwei Drittel der vollen
   Groesse - sichtbar kleiner als auf /globals, aber lesbar. */
.kp-compact .kp-preview-cell { max-width: 480px; flex-basis: 320px; }
.kp-compact .kiosk-preview   { max-width: 480px; border-width: 5px; border-radius: 14px; }
.kp-compact .kp-preview-label { font-size: .75rem; }
.kp-compact .kp-status-preview-row { max-width: 980px; margin-left: auto; margin-right: auto; }
.kp-compact .kp-status-tile        { padding: .7rem .6rem; gap: .2rem; }
.kp-compact .kp-status-tile-icon   { font-size: 23px; }
.kp-compact .kp-status-tile-label  { font-size: 12px; }
.kp-compact .kp-status-tile-sub    { font-size: 10px; }
.kp-compact .kp-status-preview-label { margin-top: 1rem; font-size: .75rem; }
/* Innenmasse im Stempel-Modus proportional zu den 480px Tablet-Breite. */
.kp-compact .kp-content { padding: 11px; gap: 6px; }
.kp-compact .kp-header  { height: 50px; padding: 0 10px; gap: 7px; }
.kp-compact .kp-logo    { max-height: 34px; max-width: 70px; }
.kp-compact .kp-status-line { font-size: 9px; }
.kp-compact .kp-name        { font-size: 13.5px; }
.kp-compact .kp-pill        { height: 32px; padding: 0 10px; font-size: 10px; }
.kp-compact .kp-hint-main   { font-size: 10px; }
.kp-compact .kp-hint-sub    { font-size: 8.5px; }
.kp-compact .kp-idle-logo   { max-height: 38%; }
.kp-compact .kp-idle-fallback { font-size: 46px; margin-bottom: .75rem; }
.kp-compact .kp-idle-main   { font-size: 12.5px; }
.kp-compact .kp-idle-sub    { font-size: 10px; }
.kp-preview-label {
    text-align: center;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
    margin-bottom: .5rem;
}
.kiosk-preview {
    position: relative;
    aspect-ratio: 16 / 10;
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    background: #0f172a;
    border: 6px solid #1f2937;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(15,23,42,.18);
}

/* === Status-Overlay-Mini-Vorschauen (Kommen / Gehen / Queued / Fehler) === */
.kp-status-preview-label {
    margin: 1.5rem 0 .5rem;
    text-align: center;
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #64748b;
}
.kp-status-preview-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: .75rem;
    width: 100%;
}
.kp-status-tile {
    aspect-ratio: 4 / 3;
    border-radius: 10px;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: .9rem .75rem;
    gap: .3rem;
    box-shadow: 0 8px 22px rgba(15,23,42,.15);
    transition: background-color .2s;
    overflow: hidden;
}
.kp-status-tile-icon {
    font-size: 28px;
    line-height: 1;
    opacity: .95;
}
.kp-status-tile-label {
    font-size: 13px;
    font-weight: 800;
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.kp-status-tile-sub {
    font-size: 10.5px;
    line-height: 1.2;
    opacity: .85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
@media (max-width: 700px) {
    .kp-status-preview-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === Idle (Bildschirmschoner) — Zweite Vorschau === */
.kiosk-preview.kp-idle {
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color .2s;
}
.kp-idle-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0 1.5rem;
    transition: color .2s;
    width: 100%;
}
.kp-idle-content[hidden] { display: none; }
.kp-idle-logo {
    max-height: 38%;
    max-width: 60%;
    object-fit: contain;
    margin-bottom: .9rem;
}
.kp-idle-fallback {
    font-size: 56px;
    line-height: 1;
    margin-bottom: .9rem;
    opacity: .9;
}
.kp-idle-main {
    font-weight: 800;
    font-size: 14px;
    line-height: 1.25;
    margin-bottom: .35rem;
}
.kp-idle-sub {
    font-size: 11px;
    opacity: .75;
    line-height: 1.3;
}
.kp-wallpaper {
    position: absolute; inset: 0;
    background-size: cover;
    background-position: center;
    background-color: #111827;
    transition: background-image .2s;
}
.kp-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.05), rgba(0,0,0,.2));
    pointer-events: none;
}
.kp-content {
    position: relative;
    z-index: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 14px;
    gap: 8px;
    transition: padding .25s ease;
}

/* Schmaler Modus: zusätzliches Innen-Padding links/rechts, damit links und
 * rechts mehr vom Wallpaper sichtbar bleibt. Header, Camera-Frame und Footer
 * werden so alle gleichmäßig schmaler. */
.kiosk-preview.kp-mode-narrow .kp-content {
    padding-left: 14%;
    padding-right: 14%;
}

/* === Header === */
.kp-header {
    background: white;
    color: #111827;
    border-radius: 4px;
    padding: 0 12px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 6px 16px rgba(15,23,42,.20);
}
.kp-logo {
    max-height: 40px;
    max-width: 80px;
    object-fit: contain;
    display: none;
}
.kp-logo.visible { display: block; }
.kp-status {
    flex: 1;
    min-width: 0;
}
.kp-status-line {
    font-size: 10px;
    font-weight: 700;
    line-height: 1.2;
    opacity: .55;
    text-transform: uppercase;
    letter-spacing: .3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kp-name {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.kp-pill {
    height: 38px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    background: white;
    color: #334155;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
.kp-pill.bemerkung {
    background: #fff8e1;
    border-color: #e4c766;
    color: #5f4300;
}

/* === Camera === */
.kp-camera {
    flex: 1;
    background: #111827;
    border-radius: 4px;
    border: 1px solid #94a3b8;
    position: relative;
    overflow: hidden;
}
.kp-camera::before {
    content: "📷 Kamera-Bereich";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #475569;
    font-size: 12px;
    font-weight: 600;
}
.kp-camera-frame {
    position: absolute;
    inset: 12% 6%;
    border: 2px solid rgba(255,255,255,.85);
    border-radius: 2px;
    box-shadow: 0 0 0 9999px rgba(0,0,0,.30);
}

/* === Footer === */
.kp-footer {
    text-align: center;
    color: white;
}
.kp-hint-main {
    font-size: 11px;
    font-weight: 700;
    line-height: 1.3;
}
.kp-hint-sub {
    font-size: 9px;
    line-height: 1.3;
    margin-top: 2px;
    opacity: .85;
}
.kp-hint-sub:empty { display: none; }

/* ==========================================================================
   ALERTS / FLASH
   ========================================================================== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
    font-weight: 500;
}
.alert.error   { background: var(--danger-soft);  color: var(--danger-dark);  border-color: rgba(245,54,92,.2); }
.alert.success { background: var(--success-soft); color: var(--success-dark); border-color: rgba(45,206,137,.2); }
.alert.warn    { background: var(--warning-soft); color: var(--warning-dark); border-color: rgba(251,99,64,.2); }

.flash {
    background: var(--success-soft);
    color: var(--success-dark);
    padding: .875rem 1.25rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(45,206,137,.25);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* ==========================================================================
   LOGIN / SETUP (Vollbild-Gradient)
   ========================================================================== */
.login-body {
    background: linear-gradient(87deg, var(--primary) 0, #825ee4 100%) fixed;
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--gray-700);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2.75rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 50px 100px rgba(50,50,93,.2);
}

.login-card.wide { max-width: 580px; }

.login-card .login-mark {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: linear-gradient(87deg, var(--primary), #825ee4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    box-shadow: 0 6px 12px rgba(94,114,228,.3);
    margin-bottom: 1.25rem;
}

.login-card h1 {
    margin: 0 0 .35rem;
    font-size: 1.5rem;
    color: var(--gray-900);
}
.login-card .login-sub {
    color: var(--gray-600);
    margin: 0 0 2rem;
    font-size: .875rem;
}

/* ==========================================================================
   PAIRING
   ========================================================================== */
.pair-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 760px) { .pair-grid { grid-template-columns: 1fr; } }

.pair-qr {
    text-align: center;
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pair-qr svg, .pair-qr img { width: 100%; max-width: 320px; height: auto; }

.pair-code {
    text-align: center;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.code-label {
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--gray-600);
    font-size: .7rem;
    font-weight: 700;
}
.code-large {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: .25rem;
    color: var(--primary);
    font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
    margin: .75rem 0 .5rem;
    line-height: 1;
}

/* ==========================================================================
   EMPTY STATE
   ========================================================================== */
.empty-state {
    background: white;
    border-radius: var(--radius-lg);
    padding: 3.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-card);
    color: var(--gray-700);
}
.empty-state h2 { color: var(--gray-900); margin-bottom: .5rem; }
.empty-state p  { color: var(--gray-600); margin: 0 0 1.5rem; }

/* ==========================================================================
   PAGE HEAD INSIDE BODY (für Subpages mit eigener Card-Reihe)
   ========================================================================== */
.section-title {
    color: white;
    margin: 0 0 1rem;
}
.actions { display: flex; gap: .75rem; flex-wrap: wrap; }

/* ==========================================================================
   BEMERKUNGEN-EDITOR (Drag-Drop)
   Progressive Enhancement fuer <textarea data-remarks-editor>: JS versteckt
   die Textarea und zeigt stattdessen eine sortierbare Liste mit Drag-Handle,
   Up/Down-Buttons (Touch-friendly) und Loesch-Knopf.
   ========================================================================== */
.remarks-editor {
    display: flex;
    flex-direction: column;
    gap: .35rem;
}
.remarks-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: .35rem .55rem;
    transition: box-shadow .12s, border-color .12s;
}
.remarks-item:hover { border-color: var(--gray-400); }
.remarks-item.dragging { opacity: .5; }
.remarks-item.drop-target { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.remarks-handle {
    cursor: grab;
    color: var(--gray-500);
    user-select: none;
    padding: .25rem .35rem;
    font-size: 1.1rem;
    line-height: 1;
}
.remarks-handle:active { cursor: grabbing; }
.remarks-text {
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    padding: .35rem 0;
    font: inherit;
    color: var(--gray-900);
    min-width: 0;
}
.remarks-item button {
    background: transparent;
    border: 0;
    color: var(--gray-500);
    cursor: pointer;
    padding: .25rem .4rem;
    border-radius: 4px;
    font-size: 1rem;
    line-height: 1;
}
.remarks-item button:hover { background: var(--gray-100); color: var(--gray-900); }
.remarks-item .remarks-del:hover { background: #fee2e2; color: #7f1d1d; }
.remarks-add {
    align-self: flex-start;
    margin-top: .25rem;
    background: var(--gray-100);
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius);
    padding: .5rem .85rem;
    cursor: pointer;
    color: var(--gray-600);
    font-size: .9rem;
}
.remarks-add:hover { background: var(--primary-soft); color: var(--primary-dark); border-color: var(--primary); }
.remarks-empty {
    color: var(--gray-500);
    font-style: italic;
    padding: .5rem 0;
}

/* ==========================================================================
   GLOBALE SUCHE (Cmd+K / Ctrl+K Palette)
   ========================================================================== */
.search-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
}
.search-overlay[hidden] { display: none; }
.search-modal {
    width: 100%;
    max-width: 620px;
    margin: 0 1rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 60px rgba(0,0,0,.35);
    overflow: hidden;
}
.search-input-wrap {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .85rem 1.1rem;
    border-bottom: 1px solid var(--gray-200);
}
.search-icon {
    font-size: 1.25rem;
    color: var(--gray-500);
    flex-shrink: 0;
}
#search-input {
    flex: 1;
    border: 0;
    outline: 0;
    font-size: 1.05rem;
    padding: .35rem 0;
    background: transparent;
    color: var(--gray-900);
}
.search-kbd {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: .75rem;
    color: var(--gray-600);
    flex-shrink: 0;
}
.search-results {
    max-height: 50vh;
    overflow-y: auto;
}
.search-hint {
    color: var(--gray-500);
    text-align: center;
    margin: 0;
    padding: 1.5rem 1rem;
    font-size: .9rem;
}
.search-result {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: .7rem 1.1rem;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid var(--gray-100);
}
.search-result:hover,
.search-result.active {
    background: var(--primary-soft);
}
.search-result-icon {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-100);
    border-radius: 6px;
    font-size: 1rem;
    flex-shrink: 0;
}
.search-result-text {
    flex: 1;
    min-width: 0;
}
.search-result-title {
    font-weight: 600;
    color: var(--gray-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-result-sub {
    font-size: .82rem;
    color: var(--gray-600);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.search-result-kind {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 2px 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 900px) {
    .sidebar { width: 220px; }
    .main { margin-left: 220px; }
    .page-header { padding: 2rem 1.25rem 5rem; }
    .page-body { padding: 0 1.25rem 1.5rem; margin-top: -3.5rem; }
}

/* === Hamburger-Toggle + Drawer-Backdrop (Mobile) === */
.sidebar-toggle {
    display: none;       /* nur per Media-Query unter 720px sichtbar */
    position: fixed;
    top: .85rem;
    left: .85rem;
    z-index: 1100;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 0;
    background: var(--primary);
    color: white;
    font-size: 1.35rem;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0,0,0,.25);
}
.sidebar-toggle:focus-visible { outline: 2px solid white; outline-offset: 2px; }
.sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.55);
    z-index: 1050;
}
.sidebar-backdrop[hidden] { display: none; }

@media (max-width: 720px) {
    .sidebar-toggle { display: flex; align-items: center; justify-content: center; }

    /* Sidebar wird Off-Canvas-Drawer: slidet von links rein, wenn body.sidebar-open */
    body.has-sidebar .sidebar {
        position: fixed;
        top: 0; left: 0;
        width: 280px;
        max-width: 80vw;
        height: 100vh;
        z-index: 1080;
        transform: translateX(-100%);
        transition: transform .2s ease;
        overflow-y: auto;
        box-shadow: 0 8px 28px rgba(0,0,0,.4);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }

    .main { margin-left: 0; }
    .page-header { padding: 4rem 1rem 4rem; }   /* Platz fuer Hamburger oben */
    .page-body { padding: 0 1rem 1.5rem; }

    /* Tabellen scrollbar machen, statt das Layout zu sprengen */
    .card-body { padding: 1rem; }
    .card-body table { display: block; overflow-x: auto; max-width: 100%; }

    /* Row stackt vertikal auf Mobile */
    .row { flex-direction: column; align-items: stretch; }
    .row > .grow { width: 100%; flex-basis: auto; }

    /* Form-Actions umbrechen lassen */
    .form-actions { flex-wrap: wrap; }
    .form-actions .btn { flex: 1 1 auto; min-width: 0; }

    /* Tabs scrollen horizontal, falls zu viele */
    .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .tab { white-space: nowrap; }
}

/* ==========================================================================
   CHANGELOG-MODAL (Footer-Link)
   ========================================================================== */
.footer-link {
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.footer-link:hover { color: var(--primary, #5e72e4); }

.cl-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8vh;
}
.cl-overlay[hidden] { display: none; }
body.modal-open { overflow: hidden; }
.cl-modal {
    width: 100%;
    max-width: 760px;
    margin: 0 1rem;
    max-height: 84vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 60px rgba(0,0,0,.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.cl-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem .35rem;
    flex-shrink: 0;
}
.cl-tabs {
    display: flex;
    gap: .25rem;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    flex-shrink: 0;
}
.cl-tab {
    border: 0;
    background: transparent;
    padding: .55rem .85rem;
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.cl-tab:hover { color: var(--gray-800); }
.cl-tab.active {
    color: var(--primary, #5e72e4);
    border-bottom-color: var(--primary, #5e72e4);
}
.cl-tab-ver {
    font-weight: 600;
    font-size: .78rem;
    color: var(--gray-400, #94a3b8);
    margin-left: .3rem;
}
.cl-tab.active .cl-tab-ver { color: var(--primary, #5e72e4); }
.cl-pane[hidden] { display: none; }
.cl-modal-head h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--gray-900);
}
.cl-ver {
    color: var(--gray-500);
    font-weight: 600;
    font-size: .82rem;
    margin-left: .35rem;
}
.cl-close {
    border: 0;
    background: transparent;
    font-size: 1.05rem;
    line-height: 1;
    color: var(--gray-500);
    cursor: pointer;
    padding: .3rem .45rem;
    border-radius: 6px;
    flex-shrink: 0;
}
.cl-close:hover { background: var(--gray-100); color: var(--gray-900); }
.cl-modal-body {
    overflow-y: auto;
    padding: .5rem 1.5rem 1.5rem;
}
.cl-modal-body h2 { font-size: 1.05rem; margin: 1.35rem 0 .5rem; color: var(--gray-900); }
.cl-modal-body h3 { font-size: .98rem;  margin: 1.1rem 0 .35rem; color: var(--primary, #5e72e4); }
.cl-modal-body h4 { font-size: .9rem;   margin: .9rem 0 .3rem;   color: var(--gray-700); }
.cl-modal-body p  { margin: .4rem 0; color: var(--gray-700); font-size: .9rem; line-height: 1.55; }
.cl-modal-body ul { margin: .35rem 0 .85rem; padding-left: 1.25rem; }
.cl-modal-body li { margin: .22rem 0; color: var(--gray-700); font-size: .9rem; line-height: 1.5; }
.cl-modal-body code {
    background: var(--gray-100);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: .85em;
}
.cl-modal-body hr { border: 0; border-top: 1px solid var(--gray-200); margin: 1rem 0; }
.cl-modal-body a  { color: var(--primary, #5e72e4); }
.cl-modal-body > h2:first-child,
.cl-modal-body > h3:first-child { margin-top: .25rem; }
