:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f0f3f8;
    --text: #1e293b;
    --muted: #64748b;
    --border: #dbe3ef;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --success: #16a34a;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius: 16px;
    --max-width: 1180px;
}

* {
    box-sizing: border-box;
}

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

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

img,
video {
    max-width: 100%;
}

.site-header {
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
}

.site-header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    position: relative;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text);
    text-decoration: none;
}

.brand:hover {
    text-decoration: none;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb, #38bdf8);
    display: grid;
    place-items: center;
    color: white;
    font-weight: 900;
    flex: 0 0 auto;
}

.nav-toggle {
    display: none;
    border: 1px solid var(--border);
    background: var(--primary);
    color: white;
    border-radius: 12px;
    padding: 9px 14px;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
}

.nav-toggle:hover {
    background: var(--primary-dark);
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.main-nav a,
.main-nav span {
    padding: 8px 12px;
    border-radius: 999px;
    color: var(--text);
    font-size: 0.95rem;
}

.main-nav a:hover {
    background: var(--surface-soft);
    text-decoration: none;
}

.main-nav .nav-primary {
    background: var(--primary);
    color: white;
}

.main-nav .nav-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.page {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 28px 20px 60px;
}

.hero {
    background: linear-gradient(135deg, #ffffff, #eef6ff);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 44px;
    box-shadow: var(--shadow);
    margin-bottom: 28px;
}

.hero h1 {
    margin: 0 0 14px;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.hero p {
    font-size: 1.1rem;
    color: var(--muted);
    max-width: 850px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card h2,
.card h3 {
    margin-top: 0;
}

.grid {
    display: grid;
    gap: 20px;
}

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

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.search-box {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

input,
textarea,
select {
    width: 100%;
    max-width: 520px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
    color: var(--text);
    font: inherit;
}

textarea {
    max-width: 720px;
}

button,
.button {
    border: 0;
    background: var(--primary);
    color: white;
    padding: 11px 16px;
    border-radius: 12px;
    font: inherit;
    cursor: pointer;
    display: inline-block;
}

button:hover,
.button:hover {
    background: var(--primary-dark);
    color: white;
    text-decoration: none;
}

.button-secondary {
    background: var(--surface-soft);
    color: var(--text);
}

.button-secondary:hover {
    background: #e2e8f0;
    color: var(--text);
}

.button-danger {
    background: var(--danger);
}

.status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 0.9rem;
}

.status-success {
    background: #dcfce7;
    color: #166534;
}

.property-image {
    width: 100%;
    max-height: 440px;
    object-fit: cover;
    border-radius: 22px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.floor-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 18px;
}

.floor-title {
    margin: 0 0 12px;
    font-size: 1.4rem;
}

.unit-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.unit-item {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    margin-bottom: 12px;
}

.unit-meta {
    color: var(--muted);
    font-size: 0.95rem;
}

.year-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0;
    margin: 14px 0;
    list-style: none;
}

.year-list a,
.year-list strong {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: white;
}

.year-list strong {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}

.media-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 14px;
    box-shadow: var(--shadow);
}

.media-thumb {
    width: 100%;
    height: 190px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    display: grid;
    place-items: center;
    overflow: hidden;
    cursor: pointer;
}

.media-thumb img,
.media-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-file-box {
    padding: 18px;
    text-align: center;
    color: var(--muted);
}

.media-card h3,
.media-card h4 {
    margin: 12px 0 6px;
}

.media-card p {
    color: var(--muted);
    font-size: 0.95rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

th,
td {
    border-bottom: 1px solid var(--border);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--surface-soft);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.82);
    z-index: 9999;
    padding: 28px;
}

.modal.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    width: min(1100px, 100%);
    max-height: 92vh;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    display: grid;
    grid-template-rows: auto 1fr auto;
}

.modal-header,
.modal-footer {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.modal-footer {
    border-top: 1px solid var(--border);
    border-bottom: 0;
    color: var(--muted);
}

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

.modal-body {
    min-height: 300px;
    max-height: 72vh;
    overflow: auto;
    display: grid;
    place-items: center;
    background: #0f172a;
}

.modal-body img,
.modal-body video {
    max-width: 100%;
    max-height: 72vh;
    object-fit: contain;
}

.modal-file {
    background: white;
    color: var(--text);
    padding: 28px;
    border-radius: 16px;
    text-align: center;
}

.modal-close,
.modal-prev,
.modal-next {
    position: absolute;
    border: 0;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    border-radius: 999px;
    cursor: pointer;
}

.modal-close {
    top: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
    font-size: 1.4rem;
}

.modal-prev,
.modal-next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    font-size: 1.5rem;
}

.modal-prev {
    left: 18px;
}

.modal-next {
    right: 18px;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: white;
    color: var(--muted);
    padding: 24px 20px;
}

.site-footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Haus-Darstellung für Stockwerke und Wohnungen */

.house-archive {
    margin-top: 20px;
}

.house-roof {
    width: 0;
    height: 0;
    border-left: min(420px, 42vw) solid transparent;
    border-right: min(420px, 42vw) solid transparent;
    border-bottom: 90px solid #334155;
    margin: 0 auto;
    filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.16));
}

.house-chimney {
    width: 46px;
    height: 64px;
    background: #475569;
    border-radius: 8px 8px 0 0;
    margin-left: calc(50% + 180px);
    margin-bottom: -32px;
}

.house-body {
    max-width: 900px;
    margin: 0 auto;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border: 1px solid var(--border);
    border-radius: 0 0 26px 26px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.house-floor {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 18px;
    padding: 18px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.92);
}

.house-floor:last-child {
    border-bottom: 0;
}

.house-floor-label {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #bae6fd;
    border-radius: 16px;
    font-weight: 800;
    font-size: 1.25rem;
    min-height: 92px;
    text-align: center;
}

.house-floor-content {
    min-width: 0;
}

.house-floor-description {
    color: var(--muted);
    margin-top: 0;
}

.house-windows {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    align-items: stretch;
}

.house-window {
    background: linear-gradient(180deg, #eff6ff, #ffffff);
    border: 2px solid #bfdbfe;
    border-radius: 18px;
    padding: 14px;
    min-height: 120px;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
    position: relative;
    overflow: hidden;
}

.house-window-content {
    position: relative;
    z-index: 1;
}

.house-window h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.house-window .unit-meta {
    margin: 0 0 8px;
}

.house-basement .house-floor-label {
    background: #f1f5f9;
    color: #475569;
    border-color: #cbd5e1;
}

.house-basement .house-window {
    background: linear-gradient(180deg, #f8fafc, #ffffff);
    border-color: #cbd5e1;
}

.house-ground .house-floor-label {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.house-empty {
    color: var(--muted);
    background: var(--surface-soft);
    border-radius: 14px;
    padding: 14px;
}

@media (max-width: 760px) {
    body {
        font-size: 15px;
    }

    .site-header-inner {
        padding: 10px 14px;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .brand {
        font-size: 1.05rem;
        gap: 8px;
    }

    .brand-mark {
        width: 32px;
        height: 32px;
        border-radius: 10px;
        font-size: 0.95rem;
    }

    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: auto;
        max-width: none;
        min-width: 0;
        padding: 8px 12px;
        font-size: 0.9rem;
        flex: 0 0 auto;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        left: 14px;
        right: 14px;
        width: auto;
        background: white;
        border: 1px solid var(--border);
        border-radius: 16px;
        box-shadow: var(--shadow);
        padding: 10px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        z-index: 200;
    }

    .main-nav.is-open {
        display: flex;
    }

    .main-nav a,
    .main-nav span {
        display: block;
        width: 100%;
        border-radius: 12px;
        background: var(--surface-soft);
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    .main-nav .nav-primary {
        background: var(--primary);
        color: white;
    }

    .page {
        padding: 20px 14px 48px;
    }

    .hero {
        padding: 24px 20px;
        border-radius: 22px;
        margin-bottom: 18px;
    }

    .hero h1 {
        font-size: clamp(1.8rem, 9vw, 2.5rem);
        line-height: 1.08;
    }

    .hero p {
        font-size: 1rem;
    }

    .card {
        padding: 18px;
        border-radius: 18px;
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .search-box {
        flex-direction: column;
    }

    input,
    textarea,
    select {
        max-width: 100%;
        width: 100%;
    }

    .card button,
    .card .button,
    .hero .button,
    form button,
    form .button {
        width: auto;
        max-width: 100%;
    }

    .property-image {
        max-height: 280px;
        border-radius: 18px;
    }

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

    .media-thumb {
        height: 180px;
    }

    .year-list {
        flex-direction: column;
        align-items: stretch;
    }

    .year-list a,
    .year-list strong {
        width: 100%;
        justify-content: flex-start;
    }

    .floor-section {
        padding: 16px;
    }

    .unit-item {
        padding: 14px;
    }

    .house-chimney {
        width: 34px;
        height: 46px;
        margin-left: calc(50% + 90px);
        margin-bottom: -24px;
    }

    .house-roof {
        border-left-width: 44vw;
        border-right-width: 44vw;
        border-bottom-width: 62px;
    }

    .house-body {
        border-radius: 0 0 20px 20px;
    }

    .house-floor {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px;
    }

    .house-floor-label {
        min-height: auto;
        padding: 12px;
        font-size: 1.1rem;
    }

    .house-windows {
        grid-template-columns: 1fr;
    }

    .house-window {
        min-height: 110px;
    }

    .modal {
        padding: 10px;
    }

    .modal-content {
        max-height: 94vh;
        border-radius: 16px;
    }

    .modal-body {
        max-height: 68vh;
    }

    .modal-prev,
    .modal-next {
        width: 42px;
        height: 42px;
    }

    .modal-prev {
        left: 8px;
    }

    .modal-next {
        right: 8px;
    }

    .modal-close {
        top: 8px;
        right: 8px;
    }
}