@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 300 600;
    font-display: swap;
    src: url('fonts/cormorant-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 300 600;
    font-display: swap;
    src: url('fonts/cormorant-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 300 600;
    font-display: swap;
    src: url('fonts/dmsans-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 300 600;
    font-display: swap;
    src: url('fonts/dmsans-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --ivory: #FFFFF0;
    --ivory-dark: #E8E4D4;
    --ivory-mid: #F5F2E4;
    --anthracite: #2C2C2C;
    --anthracite-light: #4A4A4A;
    --anthracite-mid: #3A3A3A;
    --gold: #B8A47A;
    --gold-light: #D4C49A;
    --white: #FFFFFF;
    --text-body: #3A3A3A;
    --text-light: #6B6B6B;
    --red: #A5402F;
    --red-light: #FBEEEC;
    --yellow: #A17A1E;
    --yellow-light: #FBF4E4;
    --green: #3C6E4A;
    --green-light: #EBF3ED;
    --shadow: 0 2px 16px rgba(44,44,44,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--ivory);
    color: var(--text-body);
    min-height: 100vh;
}

h1, h2, h3 { font-family: 'Cormorant Garamond', serif; font-weight: 400; color: var(--anthracite); }

.icon { flex-shrink: 0; vertical-align: -3px; }
.card-title .icon { color: var(--gold); margin-right: 2px; }
button .icon { vertical-align: -3px; margin-right: 6px; }
.mode-tile .icon { color: var(--gold); width: 30px; height: 30px; }
.login-access-note { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--text-light); font-size: 12px; margin-top: 10px; }
.login-access-note a { color: var(--anthracite-light); text-decoration: underline; }
.login-access-note a:hover { color: var(--anthracite); }
.login-logo:hover { opacity: 0.85; }

/* ─── TOPBAR ─── */
.topbar {
    background: var(--ivory);
    border-bottom: 1px solid var(--ivory-dark);
    padding: 0 20px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left { display: flex; align-items: center; gap: 14px; }
.topbar-logo { display: flex; align-items: center; text-decoration: none; }
.topbar-logo svg { height: 34px; width: auto; display: block; }
.topbar-title { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; color: var(--anthracite); }

.topbar-right { display: flex; align-items: center; gap: 12px; }

.user-badge {
    font-size: 12px;
    color: var(--text-light);
    background: var(--ivory-mid);
    padding: 5px 12px;
    border-radius: 20px;
}

.btn-logout {
    background: transparent;
    color: var(--anthracite);
    border: 1px solid var(--anthracite-light);
    padding: 8px 16px;
    border-radius: 2px;
    font-size: 12px;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
}

.btn-logout:hover { background: var(--anthracite); color: var(--ivory); }

/* ─── LAYOUT ─── */
.main-layout {
    max-width: 720px;
    margin: 0 auto;
    padding: 28px 18px 80px;
}

/* ─── LOGIN ─── */
#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--anthracite) 0%, #1a1a1a 60%, #0d0d0d 100%);
    padding: 20px;
}

.login-card {
    background: var(--ivory);
    border-radius: 6px;
    padding: 44px 36px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.3);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo svg { height: 60px; width: auto; }

.login-title { font-family: 'Cormorant Garamond', serif; font-size: 1.6rem; color: var(--anthracite); text-align: center; margin-bottom: 4px; }
.login-subtitle { font-size: 0.85rem; color: var(--text-light); text-align: center; margin-bottom: 28px; }

.login-error { color: var(--red); font-size: 13px; text-align: center; margin-top: 12px; min-height: 18px; }

/* ─── CARDS ─── */
.card {
    background: var(--white);
    border: 1px solid var(--ivory-dark);
    border-radius: 6px;
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.25rem;
    color: var(--anthracite);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── FORM ELEMENTS ─── */
input, select, textarea {
    width: 100%;
    padding: 13px 14px;
    border: 1.5px solid var(--ivory-dark);
    border-radius: 4px;
    font-size: 15px;
    font-family: 'DM Sans', sans-serif;
    color: var(--text-body);
    background: var(--white);
    min-height: 48px;
}

input:focus, select:focus, textarea:focus { outline: none; border-color: var(--anthracite); }

.field-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-group label { font-size: 12px; font-weight: 500; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.06em; }

.input-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 6px; }

/* ─── BUTTONS ─── */
button {
    padding: 13px 22px;
    min-height: 48px;
    border-radius: 2px;
    border: none;
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.06em;
    cursor: pointer;
    background: var(--anthracite);
    color: var(--ivory);
    transition: background 0.15s, transform 0.1s;
}

button:hover { background: var(--anthracite-light); }
button:active { transform: scale(0.98); }

.btn-block { width: 100%; }
.btn-lg { min-height: 60px; font-size: 15px; }

.btn-secondary { background: transparent; color: var(--anthracite); border: 1.5px solid var(--anthracite); }
.btn-secondary:hover { background: var(--ivory-mid); }

.btn-gray { background: var(--ivory-dark); color: var(--anthracite); }
.btn-gray:hover { background: #d8d4c0; }

.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover { background: #8a3527; }

/* ─── ZUSTAND TOGGLE (große Touch-Buttons) ─── */
.zustand-toggle { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }

.zustand-btn {
    min-height: 56px;
    border-radius: 4px;
    border: 1.5px solid var(--ivory-dark);
    background: var(--white);
    color: var(--text-body);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.zustand-btn.gut.active { background: var(--green-light); border-color: var(--green); color: var(--green); }
.zustand-btn.leicht.active { background: var(--yellow-light); border-color: var(--yellow); color: var(--yellow); }
.zustand-btn.mangel.active { background: var(--red-light); border-color: var(--red); color: var(--red); }

/* ─── PROJECT / VORGANG LIST ─── */
.vorgang-card {
    background: var(--white);
    border: 1.5px solid var(--ivory-dark);
    border-radius: 6px;
    padding: 16px 18px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.vorgang-card:hover { border-color: var(--gold); }
.vorgang-name { font-weight: 600; color: var(--anthracite); }
.vorgang-meta { font-size: 12px; color: var(--text-light); margin-top: 3px; }

.vorgang-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.vorgang-badge.uebernahme { background: var(--gold-light); color: var(--anthracite-mid); }
.vorgang-badge.einzug { background: var(--green-light); color: var(--green); }
.vorgang-badge.auszug { background: var(--yellow-light); color: var(--yellow); }

/* ─── MODE PICKER (Startseite) ─── */
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 28px; }

.mode-tile {
    background: var(--anthracite);
    color: var(--ivory);
    border-radius: 8px;
    padding: 32px 20px;
    text-align: center;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: background 0.15s;
}

.mode-tile:hover { background: var(--anthracite-light); }
.mode-tile .mode-icon { font-size: 2.2rem; }
.mode-tile .mode-label { font-family: 'Cormorant Garamond', serif; font-size: 1.2rem; }
.mode-tile .mode-sub { font-size: 11.5px; color: var(--gold-light); }

@media (max-width: 480px) {
    .mode-grid { grid-template-columns: 1fr; }
}

/* ─── RAUM / SCHLÜSSEL CARDS ─── */
.raum-card {
    background: var(--ivory-mid);
    border: 1px solid var(--ivory-dark);
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
}

.raum-card-title { font-family: 'Cormorant Garamond', serif; font-size: 1.1rem; color: var(--anthracite); margin-bottom: 10px; }

.bereich-wohnung { border-left: 3px solid var(--gold); }
.raum-nested { background: var(--ivory); margin-left: 6px; }

.bereich-name-input {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.1rem;
    color: var(--anthracite);
    border: none;
    border-bottom: 1.5px dashed var(--ivory-dark);
    border-radius: 0;
    padding: 4px 2px;
    margin-bottom: 12px;
    background: transparent;
}

.bereich-name-input:focus { border-bottom-color: var(--anthracite); }

.remove-btn {
    position: absolute;
    top: 12px;
    right: 14px;
    cursor: pointer;
    color: var(--text-light);
    font-size: 18px;
    line-height: 1;
}

.remove-btn:hover { color: var(--red); }

.photo-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo-thumb { width: 84px; height: 84px; object-fit: cover; border-radius: 4px; border: 1px solid var(--ivory-dark); }
.photo-thumb.loading { display: flex; align-items: center; justify-content: center; background: var(--ivory-dark); font-size: 11px; color: var(--text-light); }

.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.photo-item { width: 100px; display: flex; flex-direction: column; gap: 4px; }
.photo-item .photo-thumb { width: 100px; height: 100px; }
.photo-comment { width: 100px; font-size: 11px; padding: 5px 6px; min-height: 0; }

.btn-photo {
    background: var(--anthracite-mid);
    color: var(--ivory);
    font-size: 12px;
    padding: 10px 14px;
    min-height: 42px;
}

/* ─── ZÄHLERSTÄNDE ─── */
.zaehler-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.zaehler-field { display: flex; flex-direction: column; gap: 6px; }
.zaehler-field label { font-size: 12px; font-weight: 500; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.06em; }
.zaehler-input-row { display: flex; gap: 8px; }
.zaehler-input-row input { flex: 1; }
.zaehler-input-row button { padding: 0 14px; min-width: 48px; }

.zaehler-entry {
    background: var(--ivory-mid);
    border: 1px solid var(--ivory-dark);
    border-radius: 6px;
    padding: 14px;
    margin-bottom: 10px;
    position: relative;
}

.remove-btn-inline {
    position: absolute;
    top: 10px;
    right: 12px;
    cursor: pointer;
    color: var(--text-light);
    font-size: 18px;
    line-height: 1;
}

.remove-btn-inline:hover { color: var(--red); }

/* ─── CAMERA MODAL ─── */
.camera-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 1000;
    flex-direction: column;
}

.camera-modal.active { display: flex; }

.camera-modal video { flex: 1; width: 100%; object-fit: cover; background: #000; }

.camera-controls {
    background: rgba(0,0,0,0.85);
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.btn-capture {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--white);
    border: 4px solid var(--gold);
    font-size: 24px;
    cursor: pointer;
}

/* ─── SIGNATURE ─── */
.sig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sig-box { display: flex; flex-direction: column; gap: 8px; }
.sig-box label { font-size: 12px; font-weight: 500; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.06em; }
.sig-canvas { width: 100%; height: 140px; background: var(--white); border: 1.5px dashed var(--ivory-dark); border-radius: 4px; touch-action: none; }

@media (max-width: 520px) {
    .sig-grid { grid-template-columns: 1fr; }
}

/* ─── STEP HEADER (Übernahme-Fortschritt) ─── */
.active-header {
    background: linear-gradient(135deg, var(--anthracite), var(--anthracite-mid));
    color: var(--ivory);
    border-radius: 8px;
    padding: 20px 22px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.active-header h2 { font-family: 'Cormorant Garamond', serif; font-size: 1.35rem; color: var(--ivory); font-weight: 400; }
.active-header-sub { font-size: 12px; color: var(--gold-light); margin-top: 3px; }
.active-header-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.empty-hint { color: var(--text-light); font-size: 13px; padding: 8px 0; }

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--anthracite);
    color: var(--ivory);
    padding: 12px 22px;
    border-radius: 4px;
    font-size: 13px;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.toast.show { opacity: 1; }

/* ─── DATENSCHUTZ-HINWEISBANNER ─── */
.privacy-banner {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 3000;
    background: var(--anthracite);
    color: var(--ivory);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
    font-size: 12.5px;
    line-height: 1.5;
    box-shadow: 0 -4px 16px rgba(0,0,0,0.2);
}

.privacy-banner span { max-width: 720px; }
.privacy-banner a { color: var(--gold-light); text-decoration: underline; }

.privacy-banner button {
    background: var(--gold);
    color: var(--anthracite);
    padding: 9px 18px;
    min-height: 0;
    font-size: 12.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.privacy-banner button:hover { background: var(--gold-light); }

/* ─── FUSSZEILE ─── */
.app-footer {
    max-width: 720px;
    margin: 0 auto;
    padding: 10px 18px 50px;
    text-align: center;
    font-size: 12px;
    color: var(--text-light);
}

.app-footer a { color: var(--anthracite-light); text-decoration: none; border-bottom: 1px solid var(--ivory-dark); }
.app-footer a:hover { color: var(--anthracite); border-bottom-color: var(--anthracite-light); }
.app-footer .sep { margin: 0 8px; color: var(--ivory-dark); }
