:root {
    --bg-body: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-sidebar: #0f172a;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --revisor: #7c3aed;
    --revisor-light: #f3e8ff;
    --radius: 8px;
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08);

    /* Farb-Aliase */
    --color-primary: var(--primary);
    --color-success: var(--success);
    --color-warning: var(--warning);
    --color-danger: var(--danger);
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.5;
}

/* SVG Icon System */
.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.icon-spin {
    animation: icon-spin 1.2s infinite linear;
}

@keyframes icon-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.text-info { color: #0284c7; }

/* Guest / Login Layout */
.layout-guest {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.guest-container {
    width: 100%;
    max-width: 440px;
}

/* App Layout */
.layout-app {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    transition: grid-template-columns 0.2s ease;
}

.layout-app.sidebar-collapsed {
    grid-template-columns: 72px minmax(0, 1fr);
}

.app-sidebar {
    background-color: var(--bg-sidebar);
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1rem;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
    transition: width 0.2s ease, padding 0.2s ease;
    z-index: 100;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.brand-icon {
    font-size: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #60a5fa;
    flex-shrink: 0;
}

.brand-icon .icon {
    width: 1.65rem;
    height: 1.65rem;
}

.brand-name {
    font-weight: 700;
    font-size: 1.15rem;
    white-space: nowrap;
}

.sidebar-toggle-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background-color 0.15s;
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    color: #f8fafc;
    background-color: rgba(255, 255, 255, 0.08);
}

.sidebar-toggle-btn .icon {
    width: 1.2rem;
    height: 1.2rem;
}

.sidebar-nav {
    flex: 1 1 0%;
    min-height: 0;
    margin-top: 1rem;
    margin-right: -0.25rem;
    padding-right: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.sidebar-nav:hover {
    scrollbar-color: rgba(255, 255, 255, 0.35) transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    transition: background 0.2s ease;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.38);
}

.nav-group {
    border-radius: 6px;
}

.nav-group summary.nav-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    padding: 0.5rem 0.65rem;
    margin: 0;
    cursor: pointer;
    user-select: none;
    border-radius: 6px;
    list-style: none;
    transition: color 0.15s, background-color 0.15s;
}

.nav-section-title {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.nav-section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    width: 1.2rem;
    height: 1.2rem;
    flex-shrink: 0;
}

.nav-section-icon .icon {
    width: 1.15rem;
    height: 1.15rem;
}

.nav-group summary.nav-section::-webkit-details-marker {
    display: none;
}

.nav-group summary.nav-section::marker {
    display: none;
    content: "";
}

.nav-group summary.nav-section:hover {
    color: #f8fafc;
    background-color: rgba(255, 255, 255, 0.06);
}

.nav-group summary.nav-section:hover .nav-section-icon {
    color: #f8fafc;
}

.nav-group summary.nav-section:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 1px;
}

.nav-section-arrow {
    width: 6px;
    height: 6px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.2s ease;
    margin-right: 0.25rem;
    display: inline-block;
    flex-shrink: 0;
}

.nav-group[open] > summary.nav-section .nav-section-arrow {
    transform: rotate(45deg);
}

.nav-group-items {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-left: 0.5rem;
    margin-top: 0.25rem;
    margin-bottom: 0.35rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.88rem;
    transition: background-color 0.15s, color 0.15s;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(37, 99, 235, 0.25);
    color: #ffffff;
}

.nav-link.active {
    font-weight: 500;
}

.sidebar-footer {
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #64748b;
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Collapsed Sidebar behavior */
.layout-app.sidebar-collapsed .brand-text,
.layout-app.sidebar-collapsed .nav-section-title > span:not(.nav-section-icon),
.layout-app.sidebar-collapsed .nav-section-arrow,
.layout-app.sidebar-collapsed .sidebar-footer {
    display: none;
}

.layout-app.sidebar-collapsed .sidebar-brand {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.65rem;
    padding-bottom: 0.85rem;
}

.layout-app.sidebar-collapsed .sidebar-brand .brand-link {
    justify-content: center;
}

.layout-app.sidebar-collapsed .sidebar-brand .sidebar-toggle-btn {
    display: inline-flex;
    transform: rotate(180deg);
}

.layout-app.sidebar-collapsed .topbar-location .sidebar-toggle-btn .icon {
    transform: rotate(180deg);
}

.layout-app.sidebar-collapsed .app-sidebar {
    padding: 1.25rem 0.5rem;
}

.layout-app.sidebar-collapsed .sidebar-nav {
    margin-right: 0;
    padding-right: 0;
}

.layout-app.sidebar-collapsed .nav-group summary.nav-section {
    justify-content: center;
    padding: 0.65rem 0;
}

.layout-app.sidebar-collapsed .nav-group-items {
    padding-left: 0;
}

.layout-app.sidebar-collapsed .nav-link {
    justify-content: center;
    padding: 0.5rem 0;
    font-size: 0.75rem;
    text-align: center;
}

.app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    max-height: 100%;
    overflow: hidden;
}

.app-topbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-shrink: 0;
    z-index: 50;
    height: 60px;
    box-sizing: border-box;
}

.topbar-location {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-title-text {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

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

.topbar-icon-btn,
.topbar-avatar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    padding: 0;
}

.topbar-icon-btn:hover,
.topbar-avatar-btn:hover {
    background: #f8fafc;
    color: var(--primary);
    border-color: #cbd5e1;
}

.topbar-icon-btn .icon,
.topbar-avatar-btn .icon {
    width: 1.25rem;
    height: 1.25rem;
}

.sidebar-mobile-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.35rem;
    cursor: pointer;
    color: var(--text-main);
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    .sidebar-mobile-toggle {
        display: inline-flex;
    }
    .layout-app {
        grid-template-columns: 1fr;
    }
    .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: -280px;
        width: 260px;
        transition: left 0.25s ease;
    }
    .layout-app.sidebar-mobile-open .app-sidebar {
        left: 0;
    }
    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 90;
    }
    .layout-app.sidebar-mobile-open .sidebar-backdrop {
        display: block;
    }
}

.app-scroll-area {
    flex: 1 1 0%;
    min-height: 0;
    height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.45) transparent;
}

.app-scroll-area:hover {
    scrollbar-color: rgba(100, 116, 139, 0.65) transparent;
}

.app-scroll-area::-webkit-scrollbar {
    width: 6px;
}

.app-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}

.app-scroll-area::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 999px;
    transition: background 0.2s ease;
}

.app-scroll-area::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.65);
}

.app-content {
    padding: 1.75rem;
    max-width: 1440px;
    width: 100%;
    box-sizing: border-box;
}

/* Grids & Utilities */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.grid-two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.25rem;
}

.grid-admin-users {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .grid-admin-users {
        grid-template-columns: 1fr;
    }
}

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

.mt-lg { margin-top: 1.5rem; }
.mb-lg { margin-bottom: 1.5rem; }
.text-muted { color: var(--text-muted); }
.text-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 0.85rem; }
.text-center { text-align: center; }
