/* ==========================================================================
   DESIGN SYSTEM FRAMEWORK: APPLE Glassmorphism "Sequoia" Dashboard Style
   Enterprise Agency Production-Grade Stylesheet - Pure CSS (No Frameworks)
   Author: Principal UI Developer / Senior UX Architect
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS (Variables & Palette)
   -------------------------------------------------------------------------- */
:root {
    color-scheme: light;

    /* Base brand color scale */
    --accent:          #007aff; /* Apple iOS Blue */
    --accent-2:        #985eff; /* Apple Deep Purple */
    --ok:              #34c759; /* Apple Emerald Green */
    --danger:          #ff3b30; /* Apple Coral Red */

    /* Light Theme Palette */
    --bg-1:            #e9effd;
    --bg-2:            #f8ebf9;
    --bg-3:            #e0fbf6;

    --blob-1:          rgba(0, 122, 255, 0.35);
    --blob-2:          rgba(152, 94, 255, 0.28);
    --blob-3:          rgba(52, 199, 89, 0.25);

    --text:            #0f172a; /* Slate 900 */
    --text-soft:       rgba(15, 23, 42, 0.65); /* Slate 900 translucent */

    /* Sequoia Glass Settings: High blur, micro borders, bright specular shine */
    --glass-bg:        rgba(255, 255, 255, 0.25);
    --glass-2:         rgba(0, 122, 255, 0.04);
    --glass-brd:       rgba(255, 255, 255, 0.40);
    --divider-color:   rgba(15, 23, 42, 0.12); /* Visible slate divider lines */
    --glass-hi:        rgba(255, 255, 255, 0.85);
    --glass-shadow:    0 0.5rem 2rem rgba(15, 23, 42, 0.05), 0 0.125rem 0.5rem rgba(15, 23, 42, 0.03), inset 0 1px 0 rgba(255, 255, 255, 0.60);
}

[data-theme="dark"] {
    color-scheme: dark;

    /* Dark Theme Palette */
    --bg-1:            #080c14;
    --bg-2:            #11091a;
    --bg-3:            #03110e;

    --blob-1:          rgba(0, 122, 255, 0.22);
    --blob-2:          rgba(152, 94, 255, 0.18);
    --blob-3:          rgba(48, 209, 88, 0.14);

    --text:            #f8fafc; /* Slate 50 */
    --text-soft:       rgba(248, 250, 252, 0.68); /* Slate 50 translucent */

    /* Sequoia Dark Glass Settings: Translucent obsidian, fine hairline borders */
    --glass-bg:        rgba(18, 24, 38, 0.45);
    --glass-2:         rgba(255, 255, 255, 0.04);
    --glass-brd:       rgba(255, 255, 255, 0.15);
    --divider-color:   rgba(255, 255, 255, 0.15); /* Visible silver dividers */
    --glass-hi:        rgba(255, 255, 255, 0.18);
    --glass-shadow:    0 1rem 2.5rem rgba(0, 0, 0, 0.35), 0 0.25rem 1rem rgba(0, 0, 0, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* --------------------------------------------------------------------------
   2. GLOBAL RESET & BASE TYPOGRAPHY
   -------------------------------------------------------------------------- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-size: 100%; /* Responsive rem context (16px base) */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--bg-1);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Static gradient field underneath animated layer to avoid flash */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    background: linear-gradient(135deg, var(--bg-1), var(--bg-2) 50%, var(--bg-3));
}

/* --------------------------------------------------------------------------
   3. ANIMATED SEQUOIA LIQUID BLOBS (Pure CSS Layering)
   -------------------------------------------------------------------------- */
.blob {
    position: fixed;
    border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
    filter: blur(6.25rem);
    z-index: -1;
    pointer-events: none;
    user-select: none;
    animation:
        float-blob 28s infinite alternate ease-in-out,
        blob-morph 19s infinite alternate ease-in-out; /* Organic gel shape-shifting */
}

/* Slowly reshapes the blobs so they read as fluid gel rather than circles. */
@keyframes blob-morph {
    0% { border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; }

    50% { border-radius: 62% 38% 41% 59% / 56% 63% 37% 44%; }

    100% { border-radius: 50% 50% 55% 45% / 48% 52%; }
}

.blob-1 {
    top: 5%;
    left: 8%;
    width: 48vw;
    height: 48vw;
    background: radial-gradient(circle, var(--blob-1) 0%, rgba(0, 122, 255, 0) 70%);
    animation-duration: 26s;
}

.blob-2 {
    bottom: 10%;
    right: 5%;
    width: 44vw;
    height: 44vw;
    background: radial-gradient(circle, var(--blob-2) 0%, rgba(152, 94, 255, 0) 70%);
    animation-duration: 34s;
    animation-delay: -6s;
}

.blob-3 {
    top: 45%;
    left: 55%;
    width: 38vw;
    height: 38vw;
    background: radial-gradient(circle, var(--blob-3) 0%, rgba(52, 199, 89, 0) 70%);
    animation-duration: 30s;
    animation-delay: -12s;
}

@keyframes float-blob {
    0% { transform: translate3d(0, 0, 0) scale(1); }

    50% { transform: translate3d(3vw, -4vh, 0) scale(1.06); }

    100% { transform: translate3d(-2vw, 2vh, 0) scale(0.95); }
}

/* Respect users who prefer reduced motion: freeze the Liquid Glass motion. */
@media (prefers-reduced-motion: reduce) {
    .blob {
        animation: none;
    }

    .btn::after,
    .glass::after {
        transition: none;
    }
}

/* --------------------------------------------------------------------------
   4. GLASS SURFACES / COMPONENT WRAPPERS
   -------------------------------------------------------------------------- */
.glass, .card {
    position: relative;
    isolation: isolate; /* Contain the Liquid Glass lensing layers */
    background: var(--glass-bg);
    border: 1px solid var(--glass-brd);
    border-radius: 1.5rem; /* Sequoia soft corner style */
    box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: blur(2.5rem) saturate(1.4) brightness(1.02);
    backdrop-filter: blur(2.5rem) saturate(1.4) brightness(1.02);
}

/* --------------------------------------------------------------------------
   4b. LIQUID GLASS — REAL-TIME LENSING & LIGHT REFRACTION
   The ::before is a fixed specular rim (light caught on the wet edge); the
   ::after is a soft lens glint that tracks the pointer (--px/--py set in JS).
   Both sit on a negative layer so card content always stays crisp on top.
   -------------------------------------------------------------------------- */
.glass::before,
.glass::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    pointer-events: none;
}

.glass::before {
    background:
        linear-gradient(180deg, var(--glass-hi) 0%, transparent 22%),
        radial-gradient(120% 80% at 50% -20%, rgba(255, 255, 255, 0.35), transparent 60%);
    opacity: 0.7;
    mix-blend-mode: screen;
}

.glass::after {
    background: radial-gradient(
        16rem 16rem at var(--px, 50%) var(--py, -30%),
        rgba(255, 255, 255, 0.6),
        rgba(255, 255, 255, 0.15) 35%,
        transparent 65%
    );
    opacity: 0;
    mix-blend-mode: screen;
    transition: opacity 0.35s ease;
}

.glass:hover::after {
    opacity: 1;
}

[data-theme="dark"] .glass::after {
    background: radial-gradient(
        16rem 16rem at var(--px, 50%) var(--py, -30%),
        rgba(120, 170, 255, 0.4),
        rgba(120, 170, 255, 0.1) 38%,
        transparent 64%
    );
}

.card {
    padding: 1.5rem;
    margin-bottom: 1.125rem;
}

/* --------------------------------------------------------------------------
   5. DASHBOARD LAYOUT (Compact Sequoia Menu Architecture)
   -------------------------------------------------------------------------- */
.app {
    display: grid;
    grid-template-columns: 16rem minmax(0, 1fr);
    align-items: start; /* Keep sidebar and main top-aligned; don't stretch either */
    gap: 1.125rem;
    max-width: 80rem;
    margin: 0 auto;
    padding: 1.125rem; /* Consistent breathing room on all sides */
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 1.125rem;
    align-self: start; /* Sidebar is only as tall as its content, not full height */
    padding: 1.125rem 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.main {
    min-width: 0;
}

.content {
    margin-top: 1.125rem; /* Match the grid gap for a uniform rhythm around content */
}

/* ---------- BRAND ---------- */
.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0.5rem;
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
}

.brand small {
    display: block;
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--text-soft);
}

.brand .dot, .login-card .dot {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    border-radius: 0.625rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 0.375rem 1rem rgba(0, 122, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* ---------- SIDEBAR NAV ---------- */
.nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

/* Group heading between navigation sections. */
.nav-section {
    margin: 0.875rem 0 0.125rem;
    padding: 0 0.75rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6875rem 0.75rem;
    border-radius: 0.875rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    font-size: 0.875rem;
    transition: background 0.18s ease, transform 0.12s ease;
}

.nav-item svg {
    width: 1.25rem;
    height: 1.25rem;
    stroke: var(--text-soft);
    flex: 0 0 auto;
}

.nav-item span:first-of-type {
    flex: 1 1 auto;
}

.nav-item .ext {
    color: var(--text-soft);
    font-size: 0.75rem;
}

.nav-item:hover {
    background: var(--glass-2);
}

.nav-item.active {
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.12), rgba(152, 94, 255, 0.12));
    box-shadow: inset 0 0 0 1px rgba(0, 122, 255, 0.25);
}

.nav-item.active svg {
    stroke: var(--accent);
}

/* Burger toggle – only visible on mobile (see media query) */
.nav-toggle {
    display: none;
    appearance: none;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-left: auto;
    flex: 0 0 auto;
    border: 1px solid var(--glass-brd);
    border-radius: 0.75rem;
    background: var(--glass-2);
    color: var(--text);
    cursor: pointer;
    transition: background 0.18s ease;
}

.nav-toggle:hover {
    background: var(--glass-bg);
}

.nav-toggle svg {
    width: 1.5rem;
    height: 1.5rem;
    stroke: currentcolor;
}

/* ---------- TOPBAR ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.75rem; /* Gives the header real presence instead of a flat strip */
    padding: 0.75rem 1.375rem;
}

.topbar h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-actions .who {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-soft);
    max-width: 10rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Compact specific button stylings for topbar menu */
.topbar .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8125rem;
    border-radius: 0.625rem;
}

.topbar .icon-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.625rem;
}

/* --------------------------------------------------------------------------
   6. ACTIONS & BUTTONS
   -------------------------------------------------------------------------- */
.btn {
    appearance: none;
    position: relative;
    overflow: hidden; /* Clip the morphing gel sheen to the button shape */
    border: 1px solid var(--glass-brd);
    background: var(--glass-2);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.625rem 1rem;
    border-radius: 0.875rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    -webkit-backdrop-filter: blur(0.625rem);
    backdrop-filter: blur(0.625rem);
    transition: transform 0.16s ease, box-shadow 0.2s ease, background 0.2s ease;
}

/* Liquid Glass sheen that sweeps across on hover. */
.btn::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(
        115deg,
        transparent 30%,
        rgba(255, 255, 255, 0.45) 50%,
        transparent 70%
    );
    transform: translateX(-120%);
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn:hover {
    transform: translateY(-0.09375rem) scale(1.015);
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.3);
}

.btn:hover::after {
    transform: translateX(120%);
}

.btn:active {
    transform: translateY(0) scale(1);
}

.btn.disabled {
    opacity: 0.45;
    pointer-events: none;
}

.btn-primary {
    border: none;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 0.625rem 1.5rem rgba(0, 122, 255, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 0.75rem 1.75rem rgba(0, 122, 255, 0.42);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    filter: brightness(1.08);
}

.icon-btn {
    width: 2.625rem;
    height: 2.625rem;
    padding: 0;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

/* ---------- FILTER BAR (Anmeldeversuche) ---------- */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.875rem 1rem;
}

.filters .field {
    flex: 1 1 8rem; /* Share the line; shrink/grow as needed */
    min-width: 7rem;
    margin-bottom: 0;
}

/* Buttons stay on the same line, at the end */
.filters .btn-row {
    flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   7. STANDALONE LOGIN SCREEN
   -------------------------------------------------------------------------- */
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    position: relative;
    z-index: 10;
}

.login-card {
    width: 100%;
    max-width: 23.75rem;
    padding: 2.25rem 1.875rem 1.875rem;
    text-align: center;
}

.login-card .dot {
    width: 3.5rem;
    height: 3.5rem;
    margin: 0 auto 1.125rem;
    border-radius: 1.125rem;
}

.login-card h1 {
    margin: 0 0 0.25rem;
    font-size: 1.375rem;
    letter-spacing: -0.02em;
}

.login-card p  {
    margin: 0 0 1.5rem;
    color: var(--text-soft);
    font-size: 0.875rem;
}

.login-card .btn-primary {
    width: 100%;
    padding: 0.8125rem;
    font-size: 1rem;
}

/* --------------------------------------------------------------------------
   8. FORM CONTROLS (ISOLATED SYSTEM)
   -------------------------------------------------------------------------- */
.field {
    text-align: left;
    margin-bottom: 0.875rem;
    min-width: 0;
}

.field label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-soft);
    margin: 0 0 0.375rem 0.25rem;
}

/* CRITICAL SPECIFICITY ISOLATION: Only target standard inputs. Do not style checkboxes or radio elements! */
.field input:not([type="checkbox"], [type="radio"]),
.field select {
    width: 100%;
    font: inherit;
    font-size: 0.9375rem;
    padding: 0.75rem 0.875rem;
    color: var(--text);
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.875rem;
    outline: none;
    -webkit-backdrop-filter: blur(0.5rem);
    backdrop-filter: blur(0.5rem);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.field input:not([type="checkbox"], [type="radio"])::placeholder {
    color: var(--text-soft);
}

.field input:not([type="checkbox"], [type="radio"]):focus,
.field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.25rem rgba(0, 122, 255, 0.22);
    background-color: rgba(255, 255, 255, 0.25);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
    align-items: start; /* Labels/Inputs oben ausgerichtet; Hinweise hängen unten an */
    gap: 0 1rem;
}

/* Kleiner Hinweis unter einem Eingabefeld. */
.field-hint {
    display: block;
    margin: 0.3rem 0 0 0.25rem;
    font-size: 0.75rem;
    color: var(--text-soft);
}

.card-lead {
    margin: 0 0 1.125rem;
    color: var(--text-soft);
    font-size: 0.875rem;
    line-height: 1.5;
}

.alert {
    margin: 0 0 1.125rem;
    padding: 0.6875rem 0.875rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: rgba(226, 61, 91, .14);
    border: 1px solid rgba(226, 61, 91, .35);
    color: var(--danger);
}

.alert-ok {
    background: rgba(52, 199, 89, 0.14);
    border-color: rgba(52, 199, 89, 0.4);
    color: var(--ok);
}

.alert-warn {
    background: rgba(255, 159, 10, 0.14);
    border-color: rgba(255, 159, 10, 0.45);
    color: var(--text);
}

/* --------------------------------------------------------------------------
   9. MODERN COLUMN-BASED CHECKBOX PREFERENCES (Bulletproof Flexbox)
   -------------------------------------------------------------------------- */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2 clean equal-width columns on desktop */
    gap: 0.75rem;
    margin-top: 0.75rem;
}

@media (max-width: 600px) {
    .checkbox-grid {
        grid-template-columns: 1fr; /* 1 simple clean column on mobile */
    }
}

/* Flexbox guarantees checkbox strictly on the left, text strictly on the right, perfectly vertically aligned */
.checkbox-label {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important; /* perfectly middle vertical alignment */
    gap: 0.75rem !important;
    padding: 0.75rem 1rem !important;
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.75rem;
    cursor: pointer;
    user-select: none;
    width: 100% !important;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.checkbox-label:hover {
    background-color: rgba(255, 255, 255, 0.25);
    border-color: var(--accent);
}

[data-theme="dark"] .checkbox-label:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

/* 100% stable, custom webkit accent-color driven checkbox. Built-in native perfect graphics on left. */
.checkbox-label input[type="checkbox"] {
    appearance: checkbox !important;
    -webkit-appearance: checkbox !important;
    width: 1.125rem !important;
    height: 1.125rem !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    flex-shrink: 0 !important;
    accent-color: var(--accent) !important;
}

.checkbox-label span {
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1; /* Pure horizontal text line centering */
    color: var(--text);
}

/* "Stay logged in" toggle on the standalone login card. */
.remember-label {
    margin-top: 0.75rem;
    margin-bottom: 1.5rem;
}

/* --------------------------------------------------------------------------
   10. RESULT FIELDS (KEY-VALUE PAIRS & WRAPPING)
   -------------------------------------------------------------------------- */
.kv {
    display: grid;
    grid-template-columns: 8.125rem minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--divider-color); /* Premium visible divider line */
}

.kv:last-child { border-bottom: none; }

.kv-key {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-soft);
}

.kv-value-container {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    width: 100%;
}

.kv-val {
    flex: 1;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.75rem;
    padding: 0.625rem 0.875rem;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.btn-copy {
    padding: 0.625rem 0.875rem;
    font-size: 0.75rem;
    border-radius: 0.75rem;
    white-space: nowrap;
    background: var(--glass-2) !important;
    cursor: pointer;
    transition: all 0.2s ease !important;
}

.btn-copy:hover {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: transparent !important;
}

.btn-copy.copied {
    background: var(--ok) !important;
    color: #fff !important;
    border-color: transparent !important;
}

/* --------------------------------------------------------------------------
   11. METRICS & COMPONENT GRIDS
   -------------------------------------------------------------------------- */
.section-title {
    margin: 0.5rem 0.25rem 0.875rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-soft);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
    gap: 1rem;
}

.tool {
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
    padding: 1.25rem;
    margin: 0;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.18s ease, box-shadow 0.25s ease;
}

.tool:hover {
    transform: translateY(-0.1875rem);
}

.tool .ico {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    border-radius: 0.8125rem;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.18), rgba(152, 94, 255, 0.18));
    border: 1px solid var(--glass-brd);
}

.tool .ico svg {
    width: 1.375rem;
    height: 1.375rem;
    stroke: var(--accent);
}

.tool-text {
    min-width: 0;
}

.tool h3 {
    margin: 0.125rem 0 0.25rem;
    font-size: 1rem;
    letter-spacing: -0.01em;
    overflow-wrap: anywhere;
}

.tool p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-soft);
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.muted {
    color: var(--text-soft);
    font-size: 0.8125rem;
}

/* System info list */
.info {
    display: grid;
}

.info > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.6875rem 0.125rem;
    border-bottom: 1px solid var(--divider-color);
    font-size: 0.875rem;
}

.info > div:last-child {
    border-bottom: none;
}

.info .k {
    color: var(--text-soft);
    font-weight: 600;
}

.info .v {
    text-align: right;
    overflow-wrap: anywhere;
}

/* ---------- CARD HEADER + COPYABLE REPORT (Benchmark) ---------- */
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

/* Results table: metric / value / detail */
.results-table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    white-space: nowrap;
}

.results-table .unit {
    color: var(--text-soft);
    font-weight: 500;
    margin-left: 0.15rem;
}

.results-table .detail {
    color: var(--text-soft);
}

.results-table .metric-cell {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-weight: 600;
}

.results-table .dot-ico {
    flex: 0 0 auto;
    width: 1.75rem;
    height: 1.75rem;
    display: grid;
    place-items: center;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, rgba(0, 122, 255, 0.16), rgba(152, 94, 255, 0.16));
    border: 1px solid var(--glass-brd);
}

.results-table .dot-ico svg {
    width: 1rem;
    height: 1rem;
    stroke: var(--accent);
}

.report {
    margin: 0;
    font-family: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--text);
    white-space: pre;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.875rem;
    padding: 1rem 1.125rem;
}

.copied {
    color: var(--ok);
    border-color: rgba(52, 199, 89, 0.4);
}

/* --------------------------------------------------------------------------
   12. COGNITIVE READABILITY: HIGH-CONTRAST DIVIDER TABLES EXCLUDING METADATA PAD
   -------------------------------------------------------------------------- */
.table-card {
    padding: 0; /* Let table stretch fully to edges for maximum mobile layout space */
    overflow: hidden;
}

.table-meta {
    font-size: 0.8125rem;
    color: var(--text-soft);
    margin: 1rem 1.25rem 0.75rem; /* Margin on table meta to stay clean */
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem; /* Reduced to standard premium high-density 13px */
}

.table th {
    font-size: 0.8125rem;
    font-weight: 700;
    text-transform: none; /* Modern smallcaps feel */
    letter-spacing: 0.02em;
    color: var(--text);
    background: rgba(15, 23, 42, 0.03); /* visible layout bg */
    border-bottom: 2px solid var(--divider-color); /* Double-thickness column borders */
    padding: 0.5rem 1.25rem; /* Tight, compact, high-density padding */
    text-align: left;
}

[data-theme="dark"] .table th {
    background: rgba(255, 255, 255, 0.02);
}

.table td {
    padding: 0.5rem 1.25rem; /* Extremely tight compact vertical padding of 8px */
    border-bottom: 1px solid var(--divider-color); /* Highly visible row borders */
    color: var(--text);
    white-space: normal; /* Let long user agents and cells warp cleanly if needed */
    vertical-align: middle;
}

/* Alternate brand - softest corporate blue tint shading for extreme column tracking */
.table tbody tr:nth-child(even) {
    background: rgba(0, 122, 255, 0.02) !important;
}

[data-theme="dark"] .table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02) !important;
}

/* Hover highlights for active interaction reference */
.table tbody tr:hover {
    background: rgba(0, 122, 255, 0.05) !important;
}

[data-theme="dark"] .table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05) !important;
}

.table tr:last-child td {
    border-bottom: none;
}

.table td.empty {
    color: var(--text-soft);
    padding: 2rem 1.25rem;
    text-align: center;
}

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2vh 0.5rem;
    border-radius: 62.4375rem;
}

.badge-ok {
    color: var(--ok);
    background: rgba(52, 199, 89, 0.14);
}

.badge-fail {
    color: var(--danger);
    background: rgba(255, 69, 58, 0.14);
}

.badge-todo {
    color: var(--text-soft);
    background: rgba(120, 120, 128, 0.16);
}

.badge-progress {
    color: #b26b00;
    background: rgba(255, 159, 10, 0.16);
}

[data-theme="dark"] .badge-progress {
    color: #ffc14d;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    flex-wrap: wrap;
}

.pagination .btn {
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
}

.pagination .pages {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.page-link {
    display: inline-grid;
    place-items: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.625rem;
    border-radius: 0.75rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text);
    border: 1px solid transparent;
    transition: background 0.15s ease;
}

.page-link:hover {
    background: var(--glass-2);
}

.page-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 0.375rem 1rem rgba(0, 122, 255, 0.35);
}

.page-gap {
    padding: 0 0.25rem;
    color: var(--text-soft);
}

/* --------------------------------------------------------------------------
   13. MARKDOWN CONTENT (Prose System)
   -------------------------------------------------------------------------- */
.prose {
    line-height: 1.6;
}

.prose h1 {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    margin: 0 0 0.75rem;
}

.prose h2 {
    font-size: 1.125rem;
    margin: 1.5rem 0 0.625rem;
}

.prose h3 {
    font-size: 0.9375rem;
    margin: 1.125rem 0 0.5rem;
}

.prose p {
    margin: 0 0 0.75rem;
    color: var(--text);
}

.prose ul, .prose ol {
    margin: 0 0 0.875rem;
    padding-left: 1.375rem;
}

.prose li {
    margin: 0.25rem 0;
}

.prose a {
    color: color-mix(in srgb, var(--accent) 55%, var(--text));
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--accent) 30%, transparent);
    text-underline-offset: 0.15em;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.prose a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

.prose code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.9em;
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.375rem;
    padding: 0.0625rem 0.375rem;
}

.prose pre {
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    overflow-x: auto;
}

.prose pre code {
    background: none;
    border: none;
    padding: 0;
}

.prose blockquote {
    margin: 0 0 0.875rem;
    padding: 0.625rem 1rem;
    border-left: 3px solid var(--accent);
    background: var(--glass-2);
    border-radius: 0 0.625rem 0.625rem 0;
    color: var(--text-soft);
}

.prose hr {
    border: none;
    border-top: 1px solid var(--glass-brd);
    margin: 1.25rem 0;
}

/* --------------------------------------------------------------------------
   14. RESPONSIVE DESIGN (Media Queries)
   -------------------------------------------------------------------------- */
@media (max-width: 56rem) {
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr; /* Sidebar = content height, main fills the rest */
        padding: 0.25rem 0.75rem;
        gap: 0.75rem;
    }

    .sidebar {
        position: static;
        align-self: start; /* Don't stretch the sidebar to fill the viewport */
        height: auto;
        padding: 0.75rem 0.875rem;
        border-radius: 1.25rem;
        width: 100%;
        gap: 0;
    }

    /* Burger menu visible; brand row holds it on the right */
    .nav-toggle {
        display: inline-flex;
    }

    .brand {
        width: 100%;
        padding: 0.25rem;
    }

    /* Vertical dropdown nav, hidden until toggled open */
    .nav {
        display: none;
        flex-direction: column;
        gap: 0.25rem;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid var(--divider-color);
    }

    .sidebar.nav-open .nav {
        display: flex;
    }

    .nav-item {
        padding: 0.75rem 0.875rem;
        border-radius: 0.75rem;
        font-size: 0.9375rem;
    }

    .nav-item span:first-of-type {
        flex: 1 1 auto;
    }

    .main {
        margin-top: 0;
    }

    .topbar {
        min-height: 3.25rem;
        padding: 0.75rem 1rem;
        border-radius: 1.25rem;
    }

    .topbar h1 {
        font-size: 1.125rem;
    }

    .card {
        padding: 1.125rem;
        border-radius: 1.25rem;
        margin-bottom: 0.75rem;
    }

    .content {
        margin-top: 0.75rem;
    }

    /* Result Rows alignment stack for maximum space */
    .kv {
        grid-template-columns: 1fr;
        gap: 0.375rem;
        align-items: flex-start;
        padding: 1rem 0;
    }

    .kv-key {
        margin-left: 0.25rem;
    }

    .kv-value-container {
        flex-direction: row; /* Keep copier tool on the right */
    }
}

@media (max-width: 30rem) {
    .app {
        padding: 0.125rem 0.5rem;
        gap: 0.5rem;
    }

    .sidebar, .topbar {
        padding: 0.75rem;
        border-radius: 1rem;
    }

    .card {
        padding: 1rem;
        border-radius: 1rem;
        margin-bottom: 0.5rem;
    }

    .topbar h1 {
        font-size: 1rem;
    }

    .topbar-actions .who {
        display: none; /* Hide username on very small screens to fit buttons */
    }

    /* Filters stack into a single clean column; buttons go full width */
    .filters .field {
        flex-basis: 100%;
    }

    .filters .btn-row {
        width: 100%;
        justify-content: stretch;
    }

    .filters .btn-row .btn {
        flex: 1 1 auto;
    }

    .kv-val {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    .btn-copy {
        font-size: 0.6875rem;
        padding: 0.5rem 0.75rem;
    }

    .checkbox-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .checkbox-label {
        padding: 0.625rem 0.875rem;
    }
}

/* --------------------------------------------------------------------------
   12. AJAX FEEDBACK, NOTES & USER MANAGEMENT
   -------------------------------------------------------------------------- */
.flash {
    margin-bottom: 1.125rem;
}

.flash:empty {
    display: none;
}

.flash .alert {
    margin-bottom: 0;
}

/* ---------- Small + danger button variants ---------- */
.btn-sm {
    padding: 0.4rem 0.7rem;
    font-size: 0.8125rem;
    border-radius: 0.625rem;
}

.btn-danger {
    border: none;
    color: #fff;
    background: linear-gradient(135deg, #ff5b52, var(--danger));
    box-shadow: 0 0.5rem 1.25rem rgba(255, 59, 48, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff5b52, var(--danger));
    box-shadow: 0 0.6rem 1.5rem rgba(255, 59, 48, 0.4);
    filter: brightness(1.07);
}

/* ---------- Textarea + file input (form controls) ---------- */
.field textarea {
    width: 100%;
    min-height: 3.5rem;
    font: inherit;
    font-size: 0.9375rem;
    padding: 0.75rem 0.875rem;
    color: var(--text);
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.875rem;
    outline: none;
    resize: vertical;
    -webkit-backdrop-filter: blur(0.5rem);
    backdrop-filter: blur(0.5rem);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.field textarea::placeholder {
    color: var(--text-soft);
}

.field textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.18);
}

.field input[type="file"] {
    width: 100%;
    font: inherit;
    font-size: 0.875rem;
    color: var(--text-soft);
}

.field input[type="file"]::file-selector-button {
    margin-right: 0.75rem;
    padding: 0.45rem 0.8rem;
    font: inherit;
    font-weight: 600;
    color: var(--text);
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.625rem;
    cursor: pointer;
}

/* ---------- User table: row actions + inline edit ---------- */
.col-actions,
.cell-actions {
    width: 1%;
    white-space: nowrap;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.cell-username .edit-username,
.cell-username .edit-password {
    width: 100%;
    margin: 0.125rem 0;
    padding: 0.4rem 0.6rem;
    font: inherit;
    font-size: 0.875rem;
    color: var(--text);
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.625rem;
    outline: none;
}

.cell-username .edit-username:focus,
.cell-username .edit-password:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.18);
}

/* ---------- Notes table ---------- */
.col-status,
.cell-status {
    width: 1%;
    white-space: nowrap;
}

.note-status {
    font: inherit;
    font-size: 0.8125rem;
    padding: 0.3rem 0.5rem;
    color: var(--text);
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.5rem;
    cursor: pointer;
}

/* Editable status on the note detail page. */
.note-head-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
}

.note-status-edit {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.note-status-edit.status-todo .note-status {
    border-left: 3px solid var(--text-soft);
}

.note-status-edit.status-progress .note-status {
    border-left: 3px solid #ff9f0a;
}

.note-status-edit.status-done .note-status {
    border-left: 3px solid var(--ok);
}

/* Colour-coded left edge per workflow state. */
.note-row.status-todo .cell-status {
    box-shadow: inset 0.2rem 0 0 -0.05rem var(--text-soft);
}

.note-row.status-progress .cell-status {
    box-shadow: inset 0.2rem 0 0 -0.05rem #ff9f0a;
}

.note-row.status-done .cell-status {
    box-shadow: inset 0.2rem 0 0 -0.05rem var(--ok);
}

.cell-note {
    max-width: 34rem;
}

.cell-note .note-link {
    display: block;
}

.note-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    margin-top: 0.15rem;
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-soft);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.note-excerpt:hover {
    color: var(--accent);
}

.cell-comments {
    white-space: nowrap;
}

.comment-count {
    color: var(--text-soft);
    text-decoration: none;
}

.comment-count:hover {
    color: var(--accent);
}

.note-row.status-done .note-link,
.note-row.status-done .note-excerpt {
    text-decoration: line-through;
    opacity: 0.7;
}

/* "In Arbeit" rows get a subtle amber tint (overrides striping/hover). */
.table tbody tr.status-progress {
    background: rgba(255, 159, 10, 0.09) !important;
}

.table tbody tr.status-progress:hover {
    background: rgba(255, 159, 10, 0.16) !important;
}

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 12rem;
    margin: 0.1rem 0.2rem 0.1rem 0;
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text);
    white-space: nowrap;
    text-decoration: none;
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.5rem;
}

.file-chip:hover {
    border-color: var(--accent);
}

/* ---------- Files overview ---------- */
.file-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    color: var(--text);
    text-decoration: none;
}

.file-thumb {
    flex: 0 0 auto;
    width: 2.5rem;
    height: 2.5rem;
    object-fit: cover;
    border-radius: 0.5rem;
}

.file-ico {
    flex: 0 0 auto;
    font-size: 1.5rem;
}

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

/* ---------- Note title link + detail page ---------- */
.note-link {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.note-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.note-detail-body {
    margin: 0.75rem 0 0;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

.detail-files {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.detail-files .file-link {
    padding: 0.5rem 0.75rem;
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.75rem;
}

.detail-files .file-thumb {
    width: 3.5rem;
    height: 3.5rem;
}

/* ---------- Comments ---------- */
.comment-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.125rem;
}

.comment {
    padding: 0.75rem 0.875rem;
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.875rem;
}

.comment-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.comment-author {
    font-size: 0.875rem;
    font-weight: 600;
}

.comment-date {
    font-size: 0.75rem;
}

.comment-actions {
    display: flex;
    gap: 0.35rem;
    margin-left: auto;
}

.comment-action {
    padding: 0 0.25rem;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-soft);
    background: transparent;
    border: none;
    cursor: pointer;
}

.comment-action:hover {
    color: var(--accent);
}

.js-comment-delete:hover {
    color: var(--danger);
}

.comment-edit-field {
    width: 100%;
    margin-bottom: 0.5rem;
    padding: 0.6rem 0.7rem;
    font: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--glass-2);
    border: 1px solid var(--glass-brd);
    border-radius: 0.625rem;
    outline: none;
    resize: vertical;
}

.comment-edit-field:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.18);
}

.comment-body {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
   13. RESPONSIVE TABLES — stack rows into cards on small screens
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    /* No horizontal scroll needed once rows are stacked. */
    .table-scroll {
        overflow-x: visible;
    }

    /* Header is replaced by per-cell data-label captions. */
    .table thead {
        display: none;
    }

    .table,
    .table tbody,
    .table tr,
    .table td {
        display: block;
        width: 100%;
    }

    .table tr {
        padding: 0.875rem 1.25rem;
        border-bottom: 1px solid var(--divider-color);
    }

    .table td {
        padding: 0.45rem 0;
        border: none;
        text-align: left;
    }

    /* Column name above each value. */
    .table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 0.2rem;
        font-size: 0.6875rem;
        font-weight: 700;
        letter-spacing: 0.03em;
        text-transform: uppercase;
        color: var(--text-soft);
    }

    /* Cells without a label (and the empty-state row) show no caption. */
    .table td:not([data-label])::before,
    .table td.empty::before {
        content: none;
    }

    .table td.empty {
        padding: 1.5rem 0;
        text-align: center;
    }

    /* The desktop left status-edge bar makes the stacked cell unreadable. */
    .note-row .cell-status {
        box-shadow: none !important;
    }

    .cell-status .note-status {
        width: 100%;
    }

    /* Action buttons need real breathing room and bigger tap targets. */
    .row-actions {
        justify-content: flex-start;
        gap: 0.625rem;
    }

    .row-actions .btn {
        padding: 0.5rem 0.9rem;
    }

    .cell-note {
        max-width: none;
    }
}

/* IP-Adresse + ⓘ-Hinweis nie umbrechen (Icon bleibt neben der IP).
   Spezifischer als `.table td { white-space: normal }`, sonst greift es nicht. */
.table td.cell-ip {
    white-space: nowrap;
}

/* === Log-Daten-Modal ===================================================== */
body.modal-open {
    overflow: hidden;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.modal-overlay[hidden] {
    display: none;
}

.modal {
    width: min(720px, 100%);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-radius: 1.25rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-brd);
    box-shadow: var(--glass-shadow);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.modal-head h3 {
    margin: 0;
    font-size: 1.05rem;
}

.modal-body {
    margin: 0;
    overflow: auto;
    max-height: 60vh;
    padding: 1rem;
    border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid var(--divider-color);
}

[data-theme="dark"] .modal-body {
    background: rgba(0, 0, 0, 0.35);
}

.modal-body code {
    display: block;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--text);
}

/* Roh-Payload in der Tabelle bleibt verborgen (Quelle für das Modal). */
.log-payload {
    display: none;
}
