/* ==========================================================================
   ZiaNeo Corporate Design 2026
   Zentrale CSS-Datei fuer alle Widgets

   Usage: <link rel="stylesheet" href="/zianeo-corporate.css">
   ========================================================================== */

/* Local Fonts (DSGVO - keine Google Fonts) */
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/playfair-display-400.woff2) format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/playfair-display-500.woff2) format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/playfair-display-600.woff2) format('woff2'); }
@font-face { font-family: 'Playfair Display'; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/playfair-display-700.woff2) format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 300; font-display: swap; src: url(/static/fonts/poppins-300.woff2) format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url(/static/fonts/poppins-400.woff2) format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url(/static/fonts/poppins-500.woff2) format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url(/static/fonts/poppins-600.woff2) format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url(/static/fonts/poppins-700.woff2) format('woff2'); }

/* ==========================================================================
   Konstante Farben (unabhaengig vom Theme-Modus)
   ========================================================================== */
:root {
    /* =====================================================================
       IMMUTABLE Corporate Design Farben
       Diese Variablen werden NIEMALS von widget_theme.js ueberschrieben.
       Fuer alle Elemente die IMMER CD-konform sein muessen.
       ===================================================================== */
    --cd-navy: #0f1f36;
    --cd-navy-light: #1a365d;
    --cd-navy-dark: #0a1628;
    --cd-sage: #9aaba6;
    --cd-sage-light: #b8c5c1;
    --cd-sage-dark: #7a8f89;
    --cd-light: #f7fafc;
    --cd-dark: #1a202c;
    --cd-border: #e2e8f0;
    --cd-mid: #718096;
    --cd-white: #ffffff;

    /* CD Hintergrund-Varianten */
    --cd-navy-bg: rgba(15, 31, 54, 0.15);
    --cd-sage-bg: rgba(154, 171, 166, 0.15);
    --cd-sage-bg-strong: rgba(154, 171, 166, 0.3);

    /* CD Focus */
    --cd-focus-border: #0f1f36;
    --cd-focus-shadow: 0 0 0 3px rgba(15, 31, 54, 0.15);

    /* CD Typografie */
    --cd-font-heading: 'Playfair Display', Georgia, serif;
    --cd-font-body: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;

    /* =====================================================================
       Tenant-ueberschreibbare Variablen (Defaults = CD)
       widget_theme.js darf diese ueberschreiben.
       ===================================================================== */
    --primary: #0f1f36;
    --primary-light: #1a365d;
    --primary-dark: #0a1628;
    --accent: #9aaba6;
    --accent-light: #b8c5c1;
    --accent-dark: #7a8f89;

    /* Semantisch */
    --success: #48bb78;
    --success-bg: rgba(72, 187, 120, 0.12);
    --warning: #ecc94b;
    --warning-bg: rgba(236, 201, 75, 0.12);
    --error: #f56565;
    --error-bg: rgba(245, 101, 101, 0.12);
    --info: #4299e1;
    --info-bg: rgba(66, 153, 225, 0.12);

    /* Typografie */
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Noble & Cool: Semantische Status-Farben (gedaempft, passend zu Navy/Sage) */
    --status-success: #3d9970;
    --status-success-bg: rgba(61, 153, 112, 0.10);
    --status-warning: #c6922a;
    --status-warning-bg: rgba(198, 146, 42, 0.10);
    --status-danger: #c0392b;
    --status-danger-bg: rgba(192, 57, 43, 0.10);
    --status-info: #2b6cb0;
    --status-info-bg: rgba(43, 108, 176, 0.10);

    /* Noble & Cool: Font Scale (6 Stufen) */
    --fs-xs: 0.75rem;    /* 12px - Badges, Hints */
    --fs-sm: 0.85rem;    /* 13.6px - Labels, Meta */
    --fs-base: 0.95rem;  /* 15.2px - Body Text */
    --fs-md: 1.1rem;     /* 17.6px - Card Titles */
    --fs-lg: 1.35rem;    /* 21.6px - Section Headers */
    --fs-xl: 1.75rem;    /* 28px - Page Titles, Stats */

    /* Noble & Cool: Card Shadow (kein Border) */
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);

    /* Noble & Cool: Whitespace */
    --space-xs: 6px;
    --space-sm: 10px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Transitions */
    --transition-theme: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ==========================================================================
   Light Mode
   ========================================================================== */
[data-theme="light"],
:root:not([data-theme]) {
    --bg-primary: #f9fafb;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f2f5;
    --bg-hover: #e2e8f0;
    --bg-active: #cbd5e0;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-sidebar: #0f1f36;
    --bg-sidebar-hover: #1a365d;

    --text-primary: #1a202c;
    --text-secondary: #718096;
    --text-tertiary: #a0aec0;
    --text-on-primary: #ffffff;
    --text-on-sidebar: #f7fafc;
    --text-heading: #0f1f36;
    --text-link: #0f1f36;
    --text-link-hover: #1a365d;

    --border: #e2e8f0;
    --border-strong: #cbd5e0;
    --border-subtle: #edf2f7;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

    --scrollbar-track: #edf2f7;
    --scrollbar-thumb: #cbd5e0;
    --scrollbar-thumb-hover: #a0aec0;

    --overlay: rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Dim Mode (Noble & Cool)
   Warmes Anthrazit — angenehm dunkel, nicht aggressiv.
   Sage bleibt sichtbar, Navy als Akzent.
   ========================================================================== */
[data-theme="dim"] {
    --bg-primary: #1e2228;
    --bg-secondary: #252a30;
    --bg-tertiary: #2d3238;
    --bg-hover: #353b42;
    --bg-active: #3d444c;
    --bg-card: #252a30;
    --bg-input: #1e2228;
    --bg-sidebar: #161a1e;
    --bg-sidebar-hover: #252a30;

    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-on-primary: #ffffff;
    --text-on-sidebar: #e2e8f0;
    --text-heading: #e8ecf0;
    --text-link: #b8c5c1;
    --text-link-hover: #d0dbd7;

    --border: #353b42;
    --border-strong: #454c54;
    --border-subtle: #2d3238;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.4);
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.25);

    --scrollbar-track: #1e2228;
    --scrollbar-thumb: #3d444c;
    --scrollbar-thumb-hover: #4d555e;

    --overlay: rgba(0, 0, 0, 0.6);
    --glass-bg: rgba(30, 34, 40, 0.9);
    --glass-border: rgba(255, 255, 255, 0.08);

    /* Sage aufgehellt fuer bessere Sichtbarkeit */
    --cd-sage: #b0bdb8;
    --cd-sage-light: #c8d2ce;
    --cd-sage-bg: rgba(176, 189, 184, 0.15);
    --cd-sage-bg-strong: rgba(176, 189, 184, 0.25);

    /* Status-Farben aufgehellt */
    --status-success: #4db882;
    --status-warning: #d4a73a;
    --status-danger: #d4524a;
    --status-info: #4a8ad4;
}

/* ==========================================================================
   Dark Mode
   Tiefes Neutral-Dunkel — fuer Nacht/OLED.
   Kein reines Schwarz, kein uebertriebenes Blau.
   ========================================================================== */
[data-theme="dark"] {
    --bg-primary: #111316;
    --bg-secondary: #181b1f;
    --bg-tertiary: #1f2226;
    --bg-hover: #282c32;
    --bg-active: #31363c;
    --bg-card: #181b1f;
    --bg-input: #141618;
    --bg-sidebar: #0d0f12;
    --bg-sidebar-hover: #181b1f;

    --text-primary: #e2e8f0;
    --text-secondary: #8a95a5;
    --text-tertiary: #5a6577;
    --text-on-primary: #ffffff;
    --text-on-sidebar: #dde3ea;
    --text-heading: #e8ecf0;
    --text-link: #c8d2ce;
    --text-link-hover: #d8e0dc;

    --border: #282c32;
    --border-strong: #383d44;
    --border-subtle: #1f2226;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.7);
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.4);

    --scrollbar-track: #111316;
    --scrollbar-thumb: #31363c;
    --scrollbar-thumb-hover: #41464e;

    --overlay: rgba(0, 0, 0, 0.75);
    --glass-bg: rgba(17, 19, 22, 0.92);
    --glass-border: rgba(255, 255, 255, 0.05);

    /* Sage staerker aufgehellt fuer Dark */
    --cd-sage: #b8c5c1;
    --cd-sage-light: #d0dbd7;
    --cd-sage-bg: rgba(184, 197, 193, 0.12);
    --cd-sage-bg-strong: rgba(184, 197, 193, 0.22);

    /* Status-Farben aufgehellt */
    --status-success: #5ec995;
    --status-warning: #e0b84a;
    --status-danger: #e0605a;
    --status-info: #5a9ae0;
}

/* System preference fallback — maps to Dim (the popular middle ground) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) {
        --bg-primary: #1e2228;
        --bg-secondary: #252a30;
        --bg-tertiary: #2d3238;
        --bg-hover: #353b42;
        --bg-active: #3d444c;
        --bg-card: #252a30;
        --bg-input: #1e2228;
        --bg-sidebar: #161a1e;
        --bg-sidebar-hover: #252a30;

        --text-primary: #e2e8f0;
        --text-secondary: #94a3b8;
        --text-tertiary: #64748b;
        --text-on-primary: #ffffff;
        --text-on-sidebar: #e2e8f0;
        --text-heading: #e8ecf0;
        --text-link: #b8c5c1;
        --text-link-hover: #d0dbd7;

        --border: #353b42;
        --border-strong: #454c54;
        --border-subtle: #2d3238;

        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.35);
        --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.4);
        --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);

        --scrollbar-track: #1e2228;
        --scrollbar-thumb: #3d444c;
        --scrollbar-thumb-hover: #4d555e;

        --overlay: rgba(0, 0, 0, 0.6);
        --glass-bg: rgba(30, 34, 40, 0.9);
        --glass-border: rgba(255, 255, 255, 0.08);

        --cd-sage: #b0bdb8;
        --cd-sage-light: #c8d2ce;
        --cd-sage-bg: rgba(176, 189, 184, 0.15);
    }
}

/* ==========================================================================
   Theme Transition
   ========================================================================== */
body,
.widget-header,
.btn, button,
input, select, textarea,
.card, .badge, .modal,
.zn-card, .zn-card-flat, .zn-stat,
.zn-table th, .zn-table td,
nav, aside, header, footer,
table, th, td {
    transition: var(--transition-theme);
}

/* ==========================================================================
   Base Styles
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    margin: 0;
    padding: 0;
}

/* ==========================================================================
   Typography
   ========================================================================== */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--text-heading);
    font-weight: 700;
    line-height: 1.3;
    margin: 0 0 0.5em 0;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

h5, h6 {
    font-family: var(--font-body);
    color: var(--text-primary);
    font-weight: 600;
    margin: 0 0 0.5em 0;
}

h5 { font-size: 0.9rem; }
h6 { font-size: 0.8rem; }

p {
    margin: 0 0 1em 0;
    color: var(--text-primary);
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--text-link-hover);
}

/* Ampersand Regel - & in Playfair ist zu verschnoerkelt */
.amp {
    font-family: var(--font-body);
    font-style: normal;
}

small, .text-sm {
    font-size: 0.85rem;
}

.text-secondary {
    color: var(--text-secondary);
}

.text-tertiary {
    color: var(--text-tertiary);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.2s ease;
    line-height: 1.4;
}

.btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.btn:active {
    background: var(--bg-active);
}

.btn-primary {
    background: var(--primary);
    color: var(--text-on-primary);
    border: 1px solid var(--primary);
}

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

.btn-primary:active {
    background: var(--primary-dark);
}

.btn-accent {
    background: var(--accent);
    color: var(--primary-dark);
    border: 1px solid var(--accent);
}

.btn-accent:hover {
    background: var(--accent-light);
    border-color: var(--accent-light);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
}

.btn-danger {
    background: var(--error);
    color: #fff;
    border: 1px solid var(--error);
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 1rem;
}

/* ==========================================================================
   Inputs / Forms
   ========================================================================== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border-strong, #cbd5e0);
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    width: 100%;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.12);
}

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

select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

/* ==========================================================================
   Cards
   ========================================================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Tables
   ========================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

th {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    text-align: left;
    padding: 10px 14px;
    border-bottom: 2px solid var(--border);
    background: var(--bg-tertiary);
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

tr:hover td {
    background: var(--bg-hover);
}

/* ==========================================================================
   Badges
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-primary {
    background: var(--primary);
    color: var(--text-on-primary);
}

.badge-accent {
    background: var(--accent);
    color: var(--primary-dark);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-error {
    background: var(--error-bg);
    color: var(--error);
}

.badge-info {
    background: var(--info-bg);
    color: var(--info);
}

.badge-neutral {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 560px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Tabs
   ========================================================================== */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 18px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

[data-theme="dark"] .tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ==========================================================================
   Widget Header (ersetzt widget_header.css fuer corporate Widgets)
   ========================================================================== */
.zn-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.zn-widget-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.zn-widget-header-icon {
    width: 42px;
    height: 42px;
    background: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-on-primary);
    font-size: 18px;
    font-weight: 700;
    font-family: var(--font-body);
    flex-shrink: 0;
}

.zn-widget-header-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-heading);
    margin: 0;
    line-height: 1.2;
}

.zn-widget-header-subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 2px;
}

.zn-widget-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ==========================================================================
   SVG Icons (Lucide-Style)
   ========================================================================== */
.icon-svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    flex-shrink: 0;
}

.icon-svg.icon-sm { width: 16px; height: 16px; }
.icon-svg.icon-lg { width: 24px; height: 24px; }
.icon-svg.icon-xl { width: 32px; height: 32px; }

/* ==========================================================================
   Scrollbar
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: 8px; }
.gap-md { gap: 14px; }
.gap-lg { gap: 20px; }

.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }
.mb-lg { margin-bottom: 24px; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }

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

/* ==========================================================================
   Status Dot
   ========================================================================== */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot-success { background: var(--success); }
.status-dot-warning { background: var(--warning); }
.status-dot-error { background: var(--error); }
.status-dot-info { background: var(--info); }
.status-dot-neutral { background: var(--text-tertiary); }

/* ==========================================================================
   Empty State
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    stroke: var(--text-tertiary);
    margin-bottom: 12px;
}

.empty-state h3 {
    font-family: var(--font-heading);
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* ==========================================================================
   ZN Layout Components (Theme Nr. 1)
   Wiederverwendbare Klassen fuer einheitliches Widget-Layout.
   Referenz: Emotia/ImmoZia-Standard
   ========================================================================== */

/* --- Cards (Noble & Cool: Border + Shadow) --- */
.zn-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
    transition: var(--transition-theme);
}

.zn-card-flat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.75rem;
    transition: var(--transition-theme);
}

.zn-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.zn-card-header h3,
.zn-card-header .zn-card-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-heading);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.zn-card-header h3 .mdi,
.zn-card-header .zn-card-title .mdi {
    color: var(--cd-sage);
}

.zn-card-body {
    padding: 0;
}

.zn-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}

/* --- Grids (Noble & Cool: Mehr Whitespace) --- */
.zn-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.zn-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.zn-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.zn-grid-sidebar {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
}

@media (max-width: 968px) {
    .zn-grid-2,
    .zn-grid-3,
    .zn-grid-4,
    .zn-grid-sidebar {
        grid-template-columns: 1fr;
    }
}

/* --- Tabellen --- */
.zn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.zn-table th {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--border);
    background: var(--bg-tertiary);
}

.zn-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
}

.zn-table tr:hover td {
    background: var(--bg-hover);
}

.zn-table tr {
    transition: background 0.15s ease;
}

/* --- Toolbar (Action-Bar ueber Tabellen/Listen) --- */
.zn-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.zn-toolbar-spacer {
    flex: 1;
}

/* --- Formular-Gruppen --- */
.zn-form-group {
    margin-bottom: 1rem;
}

.zn-form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.zn-form-row {
    display: flex;
    gap: 1rem;
}

.zn-form-row > * {
    flex: 1;
}

@media (max-width: 640px) {
    .zn-form-row {
        flex-direction: column;
    }
}

/* --- Stat Cards (Kennzahlen, Noble & Cool) --- */
.zn-stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: var(--transition-theme);
}

.zn-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.2;
    font-family: var(--font-body);
}

.zn-stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.zn-stat-trend {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
}

.zn-stat-trend.up { color: var(--success); }
.zn-stat-trend.down { color: var(--error); }
.zn-stat-trend.neutral { color: var(--text-tertiary); }

/* ==========================================================================
   ZN Sidebar Layout (ImmoZia-Referenz)
   Wiederverwendbar fuer alle Widgets mit Sidebar-Navigation.
   ========================================================================== */

/* Container: Sidebar + Content */
.zn-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    height: 100vh;
    gap: 0;
}

@media (max-width: 900px) {
    .zn-layout { grid-template-columns: 1fr; }
    .zn-layout > .zn-sidebar { display: none; }
}

/* Sidebar */
.zn-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.zn-sidebar-header {
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    min-height: 56px;
    box-sizing: border-box;
    background: var(--cd-navy);
}

.zn-sidebar-header .logo {
    width: 32px;
    height: 32px;
    background: rgba(154, 171, 166, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cd-sage);
    flex-shrink: 0;
}

.zn-sidebar-header h1 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--cd-white);
    font-family: var(--cd-font-heading);
    margin: 0;
}

.zn-sidebar-nav {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow-y: auto;
}

.zn-sidebar-section {
    padding: 16px;
    border-bottom: 1px solid var(--border);
}

.zn-sidebar-section-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    padding: 8px 12px 4px;
    letter-spacing: 0.05em;
    font-weight: 600;
}

/* Nav Items */
.zn-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border: none;
    border-left: 3px solid transparent;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.92rem;
    font-family: var(--font-body);
    transition: all 0.2s;
    text-align: left;
    width: 100%;
}

.zn-nav-item:hover {
    background: var(--cd-sage-bg);
    color: var(--cd-navy);
}

.zn-nav-item.active {
    background: rgba(154, 171, 166, 0.15);
    color: var(--cd-navy);
    font-weight: 600;
    border-left-color: var(--cd-sage);
}

.zn-nav-item .mdi {
    width: 18px;
    text-align: center;
    font-size: 1rem;
}

.zn-nav-item span {
    font-size: 0.92rem;
}

.zn-nav-item .badge {
    margin-left: auto;
    background: var(--cd-sage-bg);
    color: var(--cd-navy);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: var(--radius-md);
    font-weight: 600;
}

[data-theme="dark"] .zn-nav-item {
    color: var(--text-secondary);
}

[data-theme="dark"] .zn-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

[data-theme="dark"] .zn-nav-item.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-left-color: var(--cd-sage);
}

/* Content Area */
.zn-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

.zn-content-header {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    min-height: 56px;
    box-sizing: border-box;
    background: var(--cd-navy);
}

.zn-content-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--cd-white);
    font-family: var(--cd-font-heading);
    margin: 0;
}

.zn-content-header .subtitle {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.78rem;
    margin-top: 1px;
}

.zn-content-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    background: rgba(154, 171, 166, 0.04);
}

[data-theme="dark"] .zn-content-scroll {
    background: var(--bg-primary);
}

/* ==========================================================================
   ZN Icon-Standards
   KI/Automatisierung: mdi-auto-fix (Zauberstab) in Sage
   Manuell: mdi-account in Navy
   ========================================================================== */
.zn-icon-ki {
    color: var(--cd-sage);
}

.zn-icon-ki::before {
    content: "\F0068"; /* mdi-auto-fix */
}

.zn-icon-manual {
    color: var(--cd-navy);
}

[data-theme="dark"] .zn-icon-ki {
    color: var(--cd-sage-light);
}

[data-theme="dark"] .zn-icon-manual {
    color: var(--text-secondary);
}

/* ==========================================================================
   Dim + Dark Mode Overrides fuer bestehende Komponenten
   ========================================================================== */
[data-theme="dim"] .zn-card,
[data-theme="dim"] .zn-card-flat,
[data-theme="dim"] .zn-stat,
[data-theme="dim"] .card,
[data-theme="dark"] .zn-card,
[data-theme="dark"] .zn-card-flat,
[data-theme="dark"] .zn-stat,
[data-theme="dark"] .card {
    border-color: var(--border);
}

[data-theme="dim"] .badge-accent,
[data-theme="dark"] .badge-accent {
    color: var(--text-primary);
}

[data-theme="dim"] input:focus,
[data-theme="dim"] textarea:focus,
[data-theme="dim"] select:focus,
[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    border-color: var(--cd-sage);
    box-shadow: 0 0 0 3px rgba(154, 171, 166, 0.15);
}

/* Dim + Dark: Nav Items */
[data-theme="dim"] .zn-nav-item,
[data-theme="dark"] .zn-nav-item {
    color: var(--text-secondary);
}

[data-theme="dim"] .zn-nav-item:hover,
[data-theme="dark"] .zn-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

[data-theme="dim"] .zn-nav-item.active,
[data-theme="dark"] .zn-nav-item.active {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-left-color: var(--cd-sage);
}

/* Dim + Dark: Tabs */
[data-theme="dim"] .tab.active,
[data-theme="dark"] .tab.active {
    color: var(--cd-sage);
    border-bottom-color: var(--cd-sage);
}

/* Dim + Dark Mode: Inline-Style Overrides (fuer hardcoded Farben in Widgets) */
[data-theme="dim"] [style*="background: #f7fafc"],
[data-theme="dim"] [style*="background:#f7fafc"],
[data-theme="dim"] [style*="background-color: #f7fafc"],
[data-theme="dim"] [style*="background: #f9fafb"],
[data-theme="dim"] [style*="background:#f9fafb"],
[data-theme="dark"] [style*="background: #f7fafc"],
[data-theme="dark"] [style*="background:#f7fafc"],
[data-theme="dark"] [style*="background-color: #f7fafc"],
[data-theme="dark"] [style*="background: #f9fafb"],
[data-theme="dark"] [style*="background:#f9fafb"] {
    background: var(--bg-tertiary) !important;
}

[data-theme="dim"] [style*="background: #ffffff"],
[data-theme="dim"] [style*="background:#ffffff"],
[data-theme="dim"] [style*="background: #fff"],
[data-theme="dim"] [style*="background:#fff"],
[data-theme="dim"] [style*="background-color: #ffffff"],
[data-theme="dark"] [style*="background: #ffffff"],
[data-theme="dark"] [style*="background:#ffffff"],
[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background-color: #ffffff"] {
    background: var(--bg-card) !important;
}

[data-theme="dim"] [style*="background: white"],
[data-theme="dim"] [style*="background:white"],
[data-theme="dim"] [style*="background-color: white"],
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background:white"],
[data-theme="dark"] [style*="background-color: white"] {
    background: var(--bg-card) !important;
}

[data-theme="dim"] [style*="color: #1a202c"],
[data-theme="dim"] [style*="color:#1a202c"],
[data-theme="dim"] [style*="color: #2d3748"],
[data-theme="dim"] [style*="color:#2d3748"],
[data-theme="dark"] [style*="color: #1a202c"],
[data-theme="dark"] [style*="color:#1a202c"],
[data-theme="dark"] [style*="color: #2d3748"],
[data-theme="dark"] [style*="color:#2d3748"] {
    color: var(--text-primary) !important;
}

[data-theme="dim"] [style*="color: #718096"],
[data-theme="dim"] [style*="color:#718096"],
[data-theme="dark"] [style*="color: #718096"],
[data-theme="dark"] [style*="color:#718096"] {
    color: var(--text-secondary) !important;
}

[data-theme="dim"] [style*="border: 1px solid #e2e8f0"],
[data-theme="dim"] [style*="border:1px solid #e2e8f0"],
[data-theme="dim"] [style*="border-color: #e2e8f0"],
[data-theme="dim"] [style*="border-bottom: 1px solid #e2e8f0"],
[data-theme="dim"] [style*="border-top: 1px solid #e2e8f0"],
[data-theme="dark"] [style*="border: 1px solid #e2e8f0"],
[data-theme="dark"] [style*="border:1px solid #e2e8f0"],
[data-theme="dark"] [style*="border-color: #e2e8f0"],
[data-theme="dark"] [style*="border-bottom: 1px solid #e2e8f0"],
[data-theme="dark"] [style*="border-top: 1px solid #e2e8f0"] {
    border-color: var(--border) !important;
}

[data-theme="dim"] [style*="background: #edf2f7"],
[data-theme="dim"] [style*="background:#edf2f7"],
[data-theme="dim"] [style*="background-color: #edf2f7"],
[data-theme="dark"] [style*="background: #edf2f7"],
[data-theme="dark"] [style*="background:#edf2f7"],
[data-theme="dark"] [style*="background-color: #edf2f7"] {
    background: var(--bg-tertiary) !important;
}

[data-theme="dim"] [style*="background: #e2e8f0"],
[data-theme="dim"] [style*="background:#e2e8f0"],
[data-theme="dark"] [style*="background: #e2e8f0"],
[data-theme="dark"] [style*="background:#e2e8f0"] {
    background: var(--bg-hover) !important;
}

/* Dim + Dark Mode: Box-Shadow neutralisieren */
[data-theme="dim"] [style*="box-shadow: 0 2px"],
[data-theme="dim"] [style*="box-shadow: 0 4px"],
[data-theme="dim"] [style*="box-shadow: 0 1px"],
[data-theme="dark"] [style*="box-shadow: 0 2px"],
[data-theme="dark"] [style*="box-shadow: 0 4px"],
[data-theme="dark"] [style*="box-shadow: 0 1px"] {
    box-shadow: var(--shadow-sm) !important;
}

/* ==========================================================================
   Animations (Theme Nr. 1 Standard)
   ========================================================================== */
@keyframes zn-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.zn-fade-in {
    animation: zn-fade-in 0.3s ease;
}

/* ==========================================================================
   Noble & Cool: Skeleton Loading (Shimmer statt Spinner)
   ========================================================================== */
@keyframes zn-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.zn-skeleton {
    background: linear-gradient(90deg,
        var(--bg-tertiary) 25%,
        rgba(255, 255, 255, 0.6) 50%,
        var(--bg-tertiary) 75%
    );
    background-size: 200% 100%;
    animation: zn-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

.zn-skeleton-text {
    height: 14px;
    margin-bottom: 10px;
    border-radius: 4px;
}

.zn-skeleton-text:last-child {
    width: 60%;
}

.zn-skeleton-title {
    height: 22px;
    width: 45%;
    margin-bottom: 14px;
    border-radius: 4px;
}

.zn-skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.zn-skeleton-card {
    height: 120px;
    border-radius: var(--radius-md);
}

.zn-skeleton-stat {
    height: 90px;
    border-radius: var(--radius-md);
}

.zn-skeleton-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

/* Noble & Cool: Status-Badges (semantische Farben) */
.zn-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
    font-weight: 600;
    font-family: var(--font-body);
}

.zn-status-success {
    background: var(--status-success-bg);
    color: var(--status-success);
}

.zn-status-warning {
    background: var(--status-warning-bg);
    color: var(--status-warning);
}

.zn-status-danger {
    background: var(--status-danger-bg);
    color: var(--status-danger);
}

.zn-status-info {
    background: var(--status-info-bg);
    color: var(--status-info);
}

.zn-status-neutral {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Noble & Cool: Collapsible Sidebar */
.zn-layout.sidebar-collapsed {
    grid-template-columns: 64px 1fr;
}

.zn-layout.sidebar-collapsed .zn-sidebar {
    width: 64px;
    overflow: visible;
}

.zn-layout.sidebar-collapsed .zn-sidebar-header h1,
.zn-layout.sidebar-collapsed .zn-sidebar-section-title,
.zn-layout.sidebar-collapsed .zn-nav-item span,
.zn-layout.sidebar-collapsed .zn-nav-item .badge {
    display: none;
}

.zn-layout.sidebar-collapsed .zn-sidebar-header {
    justify-content: center;
    padding: 12px;
}

.zn-layout.sidebar-collapsed .zn-nav-item {
    justify-content: center;
    padding: 12px;
    border-left: none;
    border-radius: var(--radius-md);
    position: relative;
}

.zn-layout.sidebar-collapsed .zn-nav-item:hover::after {
    content: attr(title);
    position: absolute;
    left: 68px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--cd-navy);
    color: white;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: var(--fs-xs);
    white-space: nowrap;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ==========================================================================
   Login Autofill Override (Browser setzt sonst weißen Hintergrund)
   ========================================================================== */
.login-input-wrap input:-webkit-autofill,
.login-input-wrap input:-webkit-autofill:hover,
.login-input-wrap input:-webkit-autofill:focus,
.login-input-wrap input:-webkit-autofill:active {
    -webkit-text-fill-color: #ffffff !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    caret-color: #ffffff !important;
}

/* ==========================================================================
   Print
   ========================================================================== */
@media print {
    .zn-card, .zn-card-flat, .card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
}
