:root {
    /* Color Palette */
    --bg-color: #080808;
    --surface-color: #121212;
    --surface-light: #1e1e1e;
    --accent-color: #f2b90d;
    --accent-gradient: linear-gradient(135deg, #f2b90d 0%, #b88b0b 100%);
    --accent-hover: #ffffff;
    --text-primary: #ffffff;
    --text-secondary: #e6e6e6;
    --text-muted: #b3b3b3;

    /* Semantic Colors */
    --color-emergency: #ff4d4d;
    --color-functional: #ffcc00;
    --color-aesthetic: #00f2ff;

    /* Typography */
    --font-main: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;

    /* Spacing & Borders */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --border-premium: 1px solid rgba(255, 255, 255, 0.08);
    --shadow-premium: 0 10px 30px rgba(0, 0, 0, 0.4);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 700;
}

/* App Container */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Loader */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 20px;
}

.loader {
    width: 48px;
    height: 48px;
    border: 3px solid var(--surface-light);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Layout Components */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* Cards & Buttons */
.card {
    background: var(--surface-color);
    border-radius: var(--radius-md);
    padding: 24px;
    border: var(--border-premium);
    box-shadow: var(--shadow-premium);
    margin-bottom: 24px;
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(242, 185, 13, 0.4);
    background: #181818;
    transform: translateY(-2px);
}

/* KPI Active Status */
.card.active-kpi {
    background: rgba(42, 42, 42, 0.3) !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 20px rgba(242, 185, 13, 0.1), inset 0 0 10px rgba(242, 185, 13, 0.05);
    transform: translateY(-2px);
}

.card.active-kpi h2 {
    color: var(--accent-color);
}

/* Action Pill Bar */
.action-pill-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 20px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.action-pill-label {
    font-size: 0.6rem;
    color: var(--accent-color);
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    padding-right: 15px;
    line-height: 1.2;
    white-space: nowrap;
}

.admin-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    width: 100%;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 0.85rem;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.btn-full {
    width: 100%;
}

.btn-primary {
    background: var(--accent-gradient);
    color: #000;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(242, 185, 13, 0.2);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
}

.btn-outline:hover {
    border-color: var(--accent-color);
    color: white;
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 255, 255, 0.05);
}

/* Header */
.header {
    margin-bottom: 48px;
}

/* Status Badges */
.badge {
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-emergency {
    background: rgba(255, 59, 59, 0.15);
    color: #ff3b3b;
    border: 1px solid rgba(255, 59, 59, 0.2);
}

.badge-functional {
    background: rgba(255, 204, 0, 0.15);
    color: #ffcc00;
    border: 1px solid rgba(255, 204, 0, 0.2);
}

.badge-aesthetic {
    background: rgba(0, 242, 255, 0.15);
    color: #00f2ff;
    border: 1px solid rgba(0, 242, 255, 0.2);
}

/* UI Patterns */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-2-1 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
}

.grid-1-2 {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 32px;
}

.user-management-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
}

/* Responsive Handling */
@media (max-width: 1024px) {

    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {

    .responsive-grid,
    .user-management-grid,
    .grid-3,
    .grid-4,
    .grid-2,
    .grid-2-1,
    .grid-1-2 {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    /* Prevent iOS auto-zoom on focus */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    .container {
        padding: 16px;
    }

    h1 {
        font-size: 2rem !important;
    }

    h2 {
        font-size: 1.5rem !important;
    }

    .btn {
        padding: 8px 16px;
        font-size: 0.75rem;
    }

    /* Table Responsiveness */
    .table-ziel {
        display: block;
        width: 100%;
        max-width: calc(100vw - 32px);
        /* respect container padding */
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    /* Mobile Header/Nav Fixes */
    nav {
        padding: 20px 5% !important;
    }

    .hero-title {
        font-size: 2.2rem !important;
        line-height: 1.2 !important;
    }

    .landing-hero {
        height: auto !important;
        min-height: 100svh !important;
        padding: 100px 5% !important;
    }

    .header-title-section {
        margin-top: 20px !important;
        padding-left: 15px !important;
    }

    .header-title-section h1 {
        font-size: 1.5rem !important;
    }

    .header-title-section p {
        font-size: 0.65rem !important;
        letter-spacing: 1px !important;
    }

    /* Tabs handling for mobile */
    .tabs {
        overflow-x: auto;
        white-space: nowrap;
        gap: 20px;
        padding-bottom: 10px;
        scrollbar-width: none;
        /* Firefox */
    }

    .tabs::-webkit-scrollbar {
        display: none;
        /* Chrome/Safari */
    }

    .tab {
        padding: 10px 0;
        flex: 0 0 auto;
    }

    /* Header Mobile Optimization */
    .header-top {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start !important;
        padding-bottom: 20px !important;
    }

    .header-nav-container {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px !important;
        width: 100%;
    }

    .header-nav-container nav {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px !important;
    }

    .header-nav-container nav .btn {
        width: 100%;
        font-size: 0.75rem;
        padding: 12px 10px;
        text-align: center;
    }

    .header-user-panel {
        width: 100%;
        justify-content: space-between !important;
        flex-wrap: wrap;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        padding-top: 15px;
    }

    .header-user-info {
        text-align: left !important;
    }

    /* Adjust Property Switcher for space */
    .property-switcher {
        max-width: 120px;
    }

    .action-pill-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .action-pill-label {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.15);
        padding-right: 0;
        padding-bottom: 10px;
        text-align: center;
        white-space: normal;
    }

    .mobile-stack {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade {
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Tables */
.table-ziel {
    width: 100%;
    border-collapse: collapse;
}

.table-ziel th {
    text-align: left;
    padding: 16px;
    font-size: 0.75rem;
    color: #c0c0c0;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--surface-light);
}

.table-ziel td {
    padding: 16px;
    border-bottom: 1px solid var(--surface-light);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 32px;
    border-bottom: 1px solid var(--surface-light);
    margin-bottom: 32px;
}

.tab {
    padding: 16px 0;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.tab.active {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}

/* Print Mode for Technical Reports */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    header,
    nav,
    .btn,
    .no-print {
        display: none !important;
    }

    .container {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }

    .card {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        color: black !important;
    }

    * {
        color: black !important;
    }
}