/* ============================================================
   BuildSnap.de — Stylesheet
   Aesthetic: Glassmorphism – frosted glass, translucent layers
   ============================================================ */

/* --- Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- Custom Properties --- */
:root {
    --color-primary: #1B2A4A;
    --color-primary-light: #243558;
    --color-primary-dark: #111D35;
    --color-accent: #E8721C;
    --color-accent-hover: #D4620F;
    --color-accent-glow: rgba(232, 114, 28, 0.15);
    --color-bg: #D8DFE9;
    --color-bg-warm: #F0EDE8;
    --color-card: rgba(255, 255, 255, 0.55);
    --color-card-hover: rgba(255, 255, 255, 0.7);
    --color-text: #1E1E1E;
    --color-text-secondary: #4A5260;
    --color-text-muted: #6B7280;
    --color-border: rgba(27, 42, 74, 0.1);
    --color-border-light: rgba(27, 42, 74, 0.06);
    --color-success: #16A34A;
    --color-success-bg: #dff5e6;
    --color-warning: #CA8A04;
    --color-warning-bg: #fdf5d7;
    --color-danger: #DC2626;
    --color-danger-bg: #fce4e4;

    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --radius-sm: 5px;
    --radius: 5px;
    --radius-lg: 5px;
    --radius-xl: 5px;

    /* Glass surfaces */
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-bg-strong: rgba(255, 255, 255, 0.6);
    --glass-bg-subtle: rgba(255, 255, 255, 0.25);
    --glass-border: 1px solid rgba(255, 255, 255, 0.55);
    --glass-border-subtle: 1px solid rgba(255, 255, 255, 0.35);
    --glass-blur: blur(14px);
    --glass-blur-strong: blur(20px);

    /* Shadows */
    --shadow-xs: 0 1px 4px rgba(27, 42, 74, 0.1);
    --shadow-sm: 0 2px 10px rgba(27, 42, 74, 0.12);
    --shadow: 0 4px 20px rgba(27, 42, 74, 0.14);
    --shadow-md: 0 8px 28px rgba(27, 42, 74, 0.16);
    --shadow-lg: 0 12px 44px rgba(27, 42, 74, 0.2);
    --shadow-accent: 0 4px 20px rgba(232, 114, 28, 0.35);

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--color-text);
    background:
        radial-gradient(ellipse at 10% 0%, rgba(232, 114, 28, 0.15) 0%, transparent 45%),
        radial-gradient(ellipse at 90% 50%, rgba(27, 42, 74, 0.14) 0%, transparent 45%),
        radial-gradient(ellipse at 40% 100%, rgba(232, 114, 28, 0.08) 0%, transparent 40%),
        var(--color-bg);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--color-accent-hover);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-primary);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
}

h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }
h2 { font-size: 1.375rem; margin-bottom: 0.5rem; }
h3 { font-size: 1.125rem; margin-bottom: 0.375rem; }
h4 { font-size: 1rem; margin-bottom: 0.25rem; }

p { margin-bottom: 0.75rem; }
p:last-child { margin-bottom: 0; }

small, .text-small { font-size: 0.8125rem; }
.text-muted { color: var(--color-text-secondary); }
.text-mono { font-family: var(--font-mono); font-size: 0.875em; }

/* --- Layout --- */
.container {
    width: 100%;
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.25rem;
    padding-right: 1.25rem;
}

.main-content {
    flex: 1;
    padding: 2rem 0;
}

.main-content > .container:first-child,
.main-content > .alert:first-child {
    /* flash messages sit inside main */
}

/* Page header area */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-header h1 {
    margin-bottom: 0;
}

.page-header .actions {
    display: flex;
    gap: 0.625rem;
    align-items: center;
}

/* --- Navbar --- */
.navbar {
    background: rgba(27, 42, 74, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08),
                0 4px 20px rgba(17, 29, 53, 0.25);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 3.5rem;
}

.nav-brand {
    display: flex;
    align-items: center;
    font-size: 1.625rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.nav-brand:hover {
    color: #fff;
}

.brand-icon {
    color: var(--color-accent);
    flex-shrink: 0;
}

.brand-icon-large {
    color: var(--color-accent);
    display: block;
    margin: 0 auto 0.25rem;
}

.brand-accent {
    color: var(--color-accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.nav-link.active {
    color: #fff;
    background: rgba(232, 114, 28, 0.2);
    box-shadow: inset 0 -2px 0 var(--color-accent);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1rem;
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-username {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8125rem;
    font-weight: 500;
}

.nav-role-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-accent);
    background: rgba(232, 114, 28, 0.12);
    border: 1px solid rgba(232, 114, 28, 0.25);
    border-radius: 5px;
}

.nav-logout {
    color: rgba(255, 255, 255, 0.5) !important;
    font-size: 0.8125rem;
}

.nav-logout:hover {
    color: #fff !important;
    background: rgba(220, 38, 38, 0.15);
}

/* --- Nav Dropdown --- */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.375rem;
    border-radius: var(--radius);
    transition: background var(--transition-fast);
    font-family: var(--font-body);
    line-height: 1.4;
}

.nav-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

.nav-dropdown-chevron {
    color: rgba(255, 255, 255, 0.4);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.nav-dropdown-menu.open ~ .nav-dropdown-toggle .nav-dropdown-chevron,
.nav-dropdown-toggle[aria-expanded="true"] .nav-dropdown-chevron {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: rgba(27, 42, 74, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(17, 29, 53, 0.4);
    padding: 0.375rem;
    z-index: 200;
    animation: dropdownIn 150ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.nav-dropdown-menu.open {
    display: block;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    text-decoration: none;
}

.nav-dropdown-item:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.nav-dropdown-item .nav-icon {
    width: 15px;
    height: 15px;
    color: rgba(255, 255, 255, 0.5);
}

.nav-dropdown-item:hover .nav-icon {
    color: rgba(255, 255, 255, 0.8);
}

.nav-dropdown-item-danger:hover {
    color: #fca5a5;
    background: rgba(220, 38, 38, 0.15);
}

.nav-dropdown-item-danger:hover .nav-icon {
    color: #fca5a5;
}

.nav-dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 0.25rem 0.5rem;
}

/* --- Settings Page Grid --- */
.settings-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.25rem;
    align-items: start;
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5625rem 1.25rem;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    color: #fff;
    background: var(--color-accent);
    box-shadow: var(--shadow-sm), 0 0 0 1px rgba(232, 114, 28, 0.15);
}

.btn-primary:hover {
    background: var(--color-accent-hover);
    color: #fff;
    box-shadow: var(--shadow-accent);
}

.btn-primary:active {
    box-shadow: var(--shadow-xs);
    transform: scale(0.97);
}

.btn-secondary {
    color: var(--color-primary);
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.75);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-xs);
}

.btn-danger {
    color: #fff;
    background: var(--color-danger);
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: #B91C1C;
    color: #fff;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.3);
}

.btn-danger:active {
    box-shadow: var(--shadow-xs);
    transform: scale(0.97);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: 0.8125rem;
}

.btn-full {
    width: 100%;
}

.btn-icon {
    padding: 0.4375rem;
    border-radius: var(--radius);
}

/* --- Cards --- */
.card {
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(27, 42, 74, 0.08);
}

.card-body {
    padding: 1rem;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid rgba(27, 42, 74, 0.08);
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* --- Project Cards Grid --- */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.25rem;
}

.project-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-accent);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0;
    transition: opacity var(--transition);
}

.project-card:hover::before {
    opacity: 1;
}

.project-card:hover {
    border-color: rgba(232, 114, 28, 0.25);
    box-shadow: 0 6px 20px rgba(27, 42, 74, 0.1);
}

.project-card .card-body {
    flex: 1;
}

.project-card-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.project-card-address {
    color: var(--color-text-secondary);
    font-size: 0.8125rem;
    line-height: 1.5;
    margin-bottom: 0.75rem;
}

.project-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

.project-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.project-card .card-footer {
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* Stat chip on card footer */
.stat-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.1875rem 0.5rem;
    background: rgba(255, 255, 255, 0.5);
    border: var(--glass-border-subtle);
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    box-shadow: var(--shadow-xs);
}

/* --- Tabs (Component Categories) --- */
/* --- Tabs: Sticky Pill Navigation --- */

/* Volle-Breite Sticky-Leiste */
.tabs-sticky {
    position: sticky;
    top: 3.5rem;
    z-index: 50;
    margin-top: -2rem;
    background: rgba(216, 223, 233, 0.7);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: var(--shadow-sm);
}

/* Innerer Container: max-width wie .container */
.tabs-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Scrollbarer Pill-Track */
.tabs-track {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem;
    background: rgba(255, 255, 255, 0.35);
    border: var(--glass-border-subtle);
    border-radius: 5px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex: 1;
    min-width: 0;
    box-shadow: inset 0 1px 3px rgba(27, 42, 74, 0.04);
}

.tabs-track::-webkit-scrollbar {
    display: none;
}

/* Download-Button rechts */
.tabs-action {
    flex-shrink: 0;
}

/* --- Download Dropdown --- */
.download-dropdown {
    position: relative;
}

.download-dropdown-toggle {
    min-width: 2.25rem;
    padding: 0.375rem;
}

.download-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.375rem);
    right: 0;
    min-width: 180px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(27, 42, 74, 0.12);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(17, 29, 53, 0.15);
    padding: 0.375rem;
    z-index: 200;
    animation: dropdownIn 150ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.download-dropdown-menu.open {
    display: block;
}

.download-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.download-dropdown-item:hover {
    color: var(--color-accent);
    background: rgba(232, 114, 28, 0.08);
}

.download-dropdown-item svg {
    color: var(--color-text-muted);
    flex-shrink: 0;
    transition: color var(--transition-fast);
}

.download-dropdown-item:hover svg {
    color: var(--color-accent);
}

/* Spacer unter der sticky Leiste */
.tabs-spacer {
    height: 0.5rem;
}

.tab-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* Einzelner Tab-Pill */
.tab {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-secondary);
    background: transparent;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: color var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
    text-decoration: none;
    font-family: var(--font-body);
    white-space: nowrap;
    flex-shrink: 0;
}

.tab:hover {
    color: var(--color-primary);
    background: rgba(255, 255, 255, 0.55);
    box-shadow: var(--shadow-xs);
}

.tab.active {
    color: #fff;
    background: var(--color-primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* Häkchen für ausgefüllte Tabs */
.tab-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.875rem;
    height: 0.875rem;
    font-size: 0.5rem;
    border-radius: 50%;
    background: var(--color-success);
    color: #fff;
    line-height: 1;
}

.tab.active .tab-check {
    background: rgba(255, 255, 255, 0.3);
}

/* Tab-Panele */
.tab-panel {
    display: none;
    animation: fadeSlideIn 200ms ease forwards;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: none; }
}

/* --- Sub-Tabs (Kellerdecke / Bodenplatte) --- */
.subtabs-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.subtabs-bar .btn {
    flex: 1;
    text-align: center;
    justify-content: center;
}

.subtab-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* --- Component Cards --- */
.component-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.component-card {
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition);
}

.component-card:hover {
    box-shadow: var(--shadow);
}

.component-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    gap: 1rem;
    cursor: pointer;
}

.component-card-header:hover {
    background: rgba(255, 255, 255, 0.3);
}

.component-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.component-card-expand {
    color: var(--color-text-muted);
    font-size: 1.25rem;
    transition: transform var(--transition-fast);
    line-height: 1;
}

.component-card.open .component-card-expand {
    transform: rotate(180deg);
}

.component-card-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    margin-top: 0.375rem;
}

.component-card-summary dt {
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.component-card-summary dd {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    font-family: var(--font-mono);
}

.component-card-body {
    padding: 0 1.25rem 1.25rem;
    border-top: 1px solid var(--color-border-light);
}

.component-card-body.collapsed {
    display: none;
}

/* Data grid within component */
.data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    padding-top: 1rem;
}

.data-item label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: 0.1875rem;
}

.data-item .value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text);
}

.data-item .value.mono {
    font-family: var(--font-mono);
    font-size: 0.875rem;
}

/* --- Condition Badges --- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 5px;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow-xs);
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-sehr-gut {
    color: #15803D;
    background: #DCFCE7;
}
.badge-sehr-gut .badge-dot { background: #16A34A; }

.badge-gut {
    color: #15803D;
    background: #DCFCE7;
}
.badge-gut .badge-dot { background: #16A34A; }

.badge-maessig {
    color: #A16207;
    background: #FEF9C3;
}
.badge-maessig .badge-dot { background: #CA8A04; }

.badge-schlecht {
    color: #C2410C;
    background: #FFEDD5;
}
.badge-schlecht .badge-dot { background: #EA580C; }

.badge-mangelhaft {
    color: #991B1B;
    background: #FEE2E2;
}
.badge-mangelhaft .badge-dot { background: #DC2626; }

/* --- Bemerkung (notes block) --- */
.notes-block {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-left: 3px solid var(--color-accent);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 0.75rem;
}

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 0.25rem;
    letter-spacing: 0.01em;
}

.form-label .required {
    color: var(--color-danger);
    margin-left: 0.125rem;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.25rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 400;
    color: var(--color-text);
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius);
    box-shadow: inset 0 1px 2px rgba(27, 42, 74, 0.04);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(232, 114, 28, 0.4);
    box-shadow: 0 0 0 3px rgba(232, 114, 28, 0.12);
}

.form-input.autofilled {
    border-color: rgba(22, 163, 74, 0.4);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
    transition: all 300ms;
}

.form-input.error,
.form-select.error,
.form-textarea.error {
    border-color: rgba(220, 38, 38, 0.4);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.form-error {
    font-size: 0.8125rem;
    color: var(--color-danger);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Password toggle */
.input-password-wrap {
    position: relative;
}

.input-password-wrap .form-input {
    padding-right: 2.75rem;
}

.password-toggle {
    position: absolute;
    right: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0.25rem;
    line-height: 1;
    display: flex;
    align-items: center;
    transition: color var(--transition-fast);
}

.password-toggle:hover {
    color: var(--color-primary);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%235A6270' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
    background-color: rgba(255, 255, 255, 0.5);
}

.form-textarea {
    resize: vertical;
    min-height: 4rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.form-group-narrow {
    max-width: 200px;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding-top: 0.25rem;
}

/* Inline form layout for filters */
.form-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.form-inline .form-group {
    margin-bottom: 0;
}

/* --- Autocomplete (Custom Typ Search) --- */
.autocomplete-wrap {
    position: relative;
}

.autocomplete-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 60;
    max-height: 300px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(27, 42, 74, 0.12);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    margin-top: 0.25rem;
    padding: 0.25rem;
    scrollbar-width: thin;
}

.autocomplete-list.open {
    display: block;
    animation: dropdownIn 120ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    cursor: pointer;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: rgba(232, 114, 28, 0.08);
}

.autocomplete-item-name {
    font-weight: 500;
    color: var(--color-text);
    line-height: 1.35;
}

.autocomplete-item-name mark {
    background: rgba(232, 114, 28, 0.18);
    color: inherit;
    padding: 0 1px;
    border-radius: 2px;
    font-weight: 600;
}

.autocomplete-item-uwert {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--color-accent);
    background: rgba(232, 114, 28, 0.08);
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.autocomplete-empty {
    padding: 0.75rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.8125rem;
}

/* Optgroup styling for select dropdowns */
.form-select optgroup {
    font-weight: 600;
    font-style: normal;
    color: var(--color-text-secondary);
}

/* --- Form Sections (within a card) --- */
.form-section {
    padding-top: 1rem;
    margin-top: 1rem;
    border-top: 1px solid rgba(27, 42, 74, 0.08);
}

.form-section:first-child {
    padding-top: 0;
    margin-top: 0;
    border-top: none;
}

.form-section-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    margin-bottom: 0.625rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(27, 42, 74, 0.06);
}

.sanierung-fields {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border-left: 3px solid var(--color-accent);
    background: rgba(232, 114, 28, 0.04);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.form-section-subtitle {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: 0.625rem;
}

.photo-section-hint {
    padding: 1rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
    background: rgba(255, 255, 255, 0.25);
    border-radius: var(--radius);
    border: 1px dashed rgba(27, 42, 74, 0.1);
}

/* --- Toggle Buttons (Ja/Nein Radio) --- */
.form-toggle-group {
    display: inline-flex;
    gap: 0.375rem;
}

.form-toggle-option {
    position: relative;
    cursor: pointer;
}

.form-toggle-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.form-toggle-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4375rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(27, 42, 74, 0.12);
    border-radius: var(--radius);
    transition: all var(--transition-fast);
    user-select: none;
    min-width: 3.5rem;
}

.form-toggle-label:hover {
    background: rgba(255, 255, 255, 0.65);
    border-color: rgba(27, 42, 74, 0.2);
}

/* Active state: default (neutral) */
.form-toggle-option input[type="radio"]:checked + .form-toggle-label {
    color: #fff;
    background: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

/* Active state: danger (for "Ja" bei Feuchteschäden) */
.form-toggle-option input[type="radio"]:checked + .form-toggle-label-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

/* Active state: accent (for "Ja" bei Sanierung) */
.form-toggle-option input[type="radio"]:checked + .form-toggle-label-accent {
    background: var(--color-accent);
    border-color: var(--color-accent);
    box-shadow: 0 2px 8px rgba(232, 114, 28, 0.25);
}

/* Focus ring for accessibility */
.form-toggle-option input[type="radio"]:focus-visible + .form-toggle-label {
    box-shadow: 0 0 0 3px rgba(232, 114, 28, 0.2);
}

/* --- Form Group Header (Sanierung inline) --- */
.form-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.625rem 1rem;
    background: rgba(232, 114, 28, 0.06);
    border-left: 3px solid var(--color-accent);
    border-radius: 0 var(--radius) var(--radius) 0;
}

.form-group-header .form-label {
    margin-bottom: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary);
    white-space: nowrap;
}

/* --- Toast Notifications --- */
.toast-wrapper {
    position: fixed;
    top: 4.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 480px;
    padding: 0 1rem;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    pointer-events: auto;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    box-shadow: var(--shadow-md);
    animation: toastIn 350ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.toast-success {
    color: #15803D;
    background: rgba(255, 255, 255, 0.85);
    border-left: 3px solid var(--color-success);
}

.toast-error {
    color: #991B1B;
    background: rgba(255, 255, 255, 0.85);
    border-left: 3px solid var(--color-danger);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Legacy .alert still used for inline errors (e.g. CSRF) */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
    border: none;
}

.alert-success {
    color: #15803D;
    background: var(--color-success-bg);
}

.alert-error {
    color: #991B1B;
    background: var(--color-danger-bg);
}

.alert-warning {
    color: #854D0E;
    background: var(--color-warning-bg);
}

/* --- Photo Grid --- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.photo-thumb {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: var(--radius);
    overflow: hidden;
    border: var(--glass-border);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.photo-thumb:hover {
    box-shadow: var(--shadow);
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition);
}

.photo-thumb:hover img {
    transform: scale(1.05);
}

.photo-thumb-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(27, 42, 74, 0.6) 100%);
    opacity: 0;
    transition: opacity var(--transition-fast);
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0.5rem;
}

.photo-thumb:hover .photo-thumb-overlay {
    opacity: 1;
}

.photo-delete-btn {
    background: var(--color-danger);
    color: #fff;
    border: none;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.photo-delete-btn:hover {
    background: #B91C1C;
}

/* Always-visible X overlay for AJAX delete */
.photo-thumb-overlay-visible {
    opacity: 0.7;
    background: none;
}

.photo-thumb:hover .photo-thumb-overlay-visible {
    opacity: 1;
    background: linear-gradient(180deg, transparent 50%, rgba(27, 42, 74, 0.6) 100%);
}

/* Loading state during upload */
.photo-thumb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(27, 42, 74, 0.06);
}

.photo-thumb-spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid rgba(27, 42, 74, 0.15);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 600ms linear infinite;
    position: relative;
    z-index: 2;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Deleting state */
.photo-thumb-deleting {
    opacity: 0.4;
    pointer-events: none;
}

/* Photo upload zone */
.upload-zone {
    border: 2px dashed rgba(27, 42, 74, 0.15);
    border-radius: var(--radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--color-accent);
    background: rgba(232, 114, 28, 0.06);
    box-shadow: 0 0 0 3px rgba(232, 114, 28, 0.1);
}

.upload-zone-icon {
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.upload-zone-icon svg {
    display: block;
    margin: 0 auto;
}

.upload-zone-text {
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.upload-zone-text strong {
    color: var(--color-accent);
}

/* --- Tables --- */
.table-wrap {
    overflow-x: auto;
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-sm);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 0.75rem 1rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    background: rgba(27, 42, 74, 0.04);
    border-bottom: 2px solid rgba(27, 42, 74, 0.1);
    text-align: left;
    white-space: nowrap;
}

tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(27, 42, 74, 0.06);
    vertical-align: middle;
}

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

tbody tr:hover {
    background: rgba(255, 255, 255, 0.3);
}

tbody tr td:first-child {
    font-weight: 500;
}

/* Table action buttons */
.table-actions {
    display: flex;
    gap: 0.375rem;
}

/* Active/Inactive badge in tables */
.status-active {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--color-success);
    font-weight: 500;
    font-size: 0.8125rem;
}

.status-active::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-inactive {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.8125rem;
}

.status-inactive::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

/* --- Login Page --- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(232, 114, 28, 0.18) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(27, 42, 74, 0.16) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(232, 114, 28, 0.06) 0%, transparent 60%),
        var(--color-bg);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 1.25rem;
}

.login-card {
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur-strong);
    -webkit-backdrop-filter: var(--glass-blur-strong);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    border: var(--glass-border);
}

.login-header {
    background: var(--color-primary);
    padding: 2rem 2rem 1.75rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-accent), rgba(232, 114, 28, 0.3));
}

.login-header h1 {
    color: #fff;
    font-size: 2.25rem;
    margin-bottom: 0.25rem;
    letter-spacing: -0.03em;
}

.login-subtitle {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.875rem;
    margin-bottom: 0;
}

.login-form {
    padding: 1.75rem 2rem 2rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-form .btn-primary {
    margin-top: 0.5rem;
    padding: 0.6875rem 1.25rem;
    font-size: 0.9375rem;
}

.login-form .alert {
    margin-bottom: 1.25rem;
}

/* --- Project Detail --- */
.project-detail-header {
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
}

.project-detail-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--color-accent);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.project-detail-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.project-detail-address {
    color: var(--color-text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 1rem;
}

.project-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border-light);
}

.project-detail-meta .meta-item {
    display: flex;
    flex-direction: column;
}

.project-detail-meta .meta-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.project-detail-meta .meta-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text);
}

.project-detail-actions {
    display: flex;
    gap: 0.625rem;
    margin-top: 1.25rem;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--color-text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--color-text-secondary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

/* --- Confirm Dialog (Delete) --- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 29, 53, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 1.25rem;
    animation: fadeIn 200ms ease;
}

.confirm-dialog {
    background: var(--glass-bg-strong);
    backdrop-filter: var(--glass-blur-strong);
    -webkit-backdrop-filter: var(--glass-blur-strong);
    border: var(--glass-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    max-width: 420px;
    width: 100%;
    padding: 1.75rem;
    animation: dialogSlideIn 250ms ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dialogSlideIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.confirm-dialog h3 {
    margin-bottom: 0.5rem;
}

.confirm-dialog p {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

.confirm-dialog .form-actions {
    justify-content: flex-end;
}

/* --- Footer --- */
.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    padding: 1.25rem 0;
    margin-top: auto;
    background: rgba(216, 223, 233, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.site-footer p {
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    text-align: center;
    margin: 0;
}

/* --- Utility Classes --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-accent { color: var(--color-accent); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }

.fw-400 { font-weight: 400; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mr-1 { margin-right: 0.5rem; }
.ml-1 { margin-left: 0.5rem; }
.ml-auto { margin-left: auto; }

.p-0 { padding: 0; }
.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }

.d-flex { display: flex; }
.d-grid { display: grid; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.flex-wrap { flex-wrap: wrap; }

.w-full { width: 100%; }
.hidden { display: none; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Kundendaten Tab --- */
.kundendaten-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(27, 42, 74, 0.1);
}

.kundendaten-field {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.kundendaten-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.kundendaten-value {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--color-text);
}

.kundendaten-images {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.kundendaten-image-box {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kundendaten-img-preview {
    position: relative;
    border-radius: 5px;
    overflow: hidden;
}

.kundendaten-img-preview img {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    display: block;
    border-radius: 5px;
}

.kundendaten-img-logo img {
    max-height: 120px;
    object-fit: contain;
    background: #f8f9fa;
    padding: 0.75rem;
}

.kundendaten-img-remove {
    margin-top: 0.375rem;
}

.upload-zone-compact {
    padding: 1.25rem 1rem;
}

.upload-zone-compact .upload-zone-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.upload-zone-compact .upload-zone-text {
    font-size: 0.8125rem;
}

/* --- Hamburger Menu (Mobile) --- */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0.5rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition-fast);
}
.nav-hamburger:active { background: rgba(255,255,255,0.15); }
.nav-hamburger-line {
    display: block;
    width: 100%;
    height: 2px;
    background: rgba(255,255,255,0.85);
    border-radius: 1px;
    transition: transform 200ms ease, opacity 200ms ease;
}
.nav-hamburger.active .nav-hamburger-line:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.active .nav-hamburger-line:nth-child(2) { opacity: 0; }
.nav-hamburger.active .nav-hamburger-line:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* --- Responsive --- */
@media (max-width: 768px) {
    .toast-wrapper {
        top: 1rem;
        max-width: 100%;
    }

    .nav-hamburger { display: flex; }

    .nav-container {
        flex-wrap: wrap;
        height: auto;
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
        gap: 0;
    }

    .nav-brand { font-size: 1.25rem; }

    .nav-links {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0.125rem;
        padding-top: 0.75rem;
        margin-top: 0.5rem;
        border-top: 1px solid rgba(255,255,255,0.08);
    }
    .nav-links.nav-open {
        display: flex;
        animation: navSlideDown 200ms ease forwards;
    }

    @keyframes navSlideDown {
        from { opacity: 0; transform: translateY(-8px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .nav-link {
        padding: 0.75rem;
        font-size: 0.9375rem;
        border-radius: var(--radius);
    }

    .nav-user {
        width: 100%;
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        padding-top: 0.5rem;
        border-top: 1px solid rgba(255,255,255,0.08);
    }

    .nav-dropdown-menu {
        right: auto;
        left: 0;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header .actions {
        width: 100%;
    }

    .project-grid {
        grid-template-columns: 1fr;
    }

    .tabs-sticky {
        position: sticky;
        top: 0;
        z-index: 50;
        margin-top: -1rem;
        box-shadow: 0 4px 12px rgba(27,42,74,0.08);
    }

    .tabs-bar {
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .tabs-track {
        order: 1;
        width: 100%;
    }

    .tabs-action {
        order: 0;
        margin-left: auto;
    }

    .tabs-spacer {
        display: none;
    }

    .tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
        min-height: 2.5rem;
    }

    .tab-label {
        display: none;
    }

    .tab .tab-icon {
        width: 18px;
        height: 18px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .form-group-narrow {
        max-width: none;
    }

    .project-detail-meta {
        gap: 1rem;
    }

    .project-detail-actions {
        flex-wrap: wrap;
    }

    .data-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }

    .kundendaten-images {
        grid-template-columns: 1fr;
    }

    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.25rem; }

    .login-form {
        padding: 1.25rem 1.5rem 1.5rem;
    }

    .login-header {
        padding: 1.5rem 1.5rem 1.25rem;
    }

    /* Sub-Tabs: fixed bottom bar on mobile */
    .subtabs-bar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 90;
        margin-bottom: 0;
        padding: 0.5rem 1rem;
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
        background: rgba(255, 255, 255, 0.75);
        backdrop-filter: var(--glass-blur-strong);
        -webkit-backdrop-filter: var(--glass-blur-strong);
        border-top: var(--glass-border);
        box-shadow: 0 -4px 20px rgba(27, 42, 74, 0.1);
    }

    .subtabs-bar .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
        min-height: 2.75rem;
    }

    .subtab-icon {
        width: 18px;
        height: 18px;
    }

    /* Platz am unteren Rand damit Inhalt nicht hinter der Bar versteckt wird */
    #tab-kellerdecke {
        padding-bottom: 5rem;
    }

    /* Buttons: min 44px touch target */
    .btn { min-height: 2.75rem; }
    .btn-sm { min-height: 2.5rem; padding: 0.5rem 0.875rem; font-size: 0.875rem; }

    /* Toggle labels: bigger */
    .form-toggle-group { gap: 0.5rem; }
    .form-toggle-label {
        padding: 0.5625rem 1rem;
        min-height: 2.75rem;
        font-size: 0.875rem;
    }

    /* Autocomplete: bigger items on touch */
    .autocomplete-item { padding: 0.75rem; font-size: 0.875rem; min-height: 2.75rem; }

    /* Component card: less padding on mobile */
    .component-card-header { padding: 0.75rem 1rem; }
    .component-card-body { padding: 0 1rem 1rem; }
}

@media (max-width: 480px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .main-content {
        padding: 1rem 0;
    }

    .tabs-sticky {
        margin-top: -0.5rem;
    }

    .tabs-track {
        padding: 0.25rem;
        gap: 0.25rem;
    }

    .tab {
        padding: 0.4375rem 0.625rem;
        font-size: 0.75rem;
        min-height: 2.25rem;
        gap: 0.2rem;
    }

    .tab .tab-icon {
        width: 16px;
        height: 16px;
    }

    .tab-check {
        width: 0.75rem;
        height: 0.75rem;
        font-size: 0.4375rem;
    }

    .tabs-action {
        padding: 0.4375rem 0.625rem;
        font-size: 0.75rem;
        min-height: 2.25rem;
    }

    .form-group-header {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .subtabs-bar {
        padding: 0.375rem 0.75rem;
        padding-bottom: calc(0.375rem + env(safe-area-inset-bottom, 0px));
    }

    .data-grid {
        grid-template-columns: 1fr;
    }

    .card-body {
        padding: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
    }

    h2 {
        font-size: 1.125rem;
    }

    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .form-actions .btn {
        width: 100%;
        text-align: center;
    }

    .upload-zone {
        padding: 1.25rem;
    }

    .btn-full-mobile {
        width: 100%;
    }
}

/* --- Print Styles --- */
@media print {
    .navbar,
    .site-footer,
    .btn,
    .form-actions,
    .photo-thumb-overlay {
        display: none !important;
    }

    body {
        background: #fff;
        font-size: 11pt;
    }

    .main-content {
        padding: 0;
    }

    .card,
    .component-card,
    .project-detail-header {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}
