:root {
    --bg: #f4f5f3;
    --surface: #ffffff;
    --surface-2: #eef0ec;
    --border: #dcded8;
    --text: #24261f;
    --text-muted: #6b6d64;
    --primary: #3c6e4a;
    --primary-dark: #2a4f35;
    --danger: #a32d2d;
    --danger-bg: #fcebeb;
    --warning: #854f0b;
    --warning-bg: #faeeda;
    --radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
}

a { color: var(--primary-dark); }

h1, h2, h3 { font-weight: 600; margin: 0 0 0.5em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15px; }

.hidden { display: none !important; }

button, input, select, textarea { font-family: inherit; font-size: 14px; }

.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 16px; border-radius: var(--radius); border: 1px solid transparent;
    background: var(--primary); color: #fff; cursor: pointer; font-weight: 500;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #7a2323; }
.btn-sm { padding: 5px 10px; font-size: 13px; }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 13px; }
.field input, .field select, .field textarea {
    width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text);
}
.field textarea { resize: vertical; min-height: 80px; }
.field-help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 38px; }
.eye-toggle {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px;
}

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

.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 14px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-info { background: var(--surface-2); color: var(--text); }

/* --- Login --- */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-box { width: 100%; max-width: 380px; }
.login-box h1 { text-align: center; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 24px; }

/* --- App shell --- */
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar-nav { display: flex; gap: 4px; }
.topbar-nav button {
    background: none; border: none; padding: 8px 14px; border-radius: var(--radius);
    cursor: pointer; color: var(--text-muted); font-weight: 500;
}
.topbar-nav button.active, .topbar-nav button:hover { background: var(--surface-2); color: var(--text); }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted); }

.main { max-width: 1000px; margin: 0 auto; padding: 24px; }

.screen { display: none; }
.screen.active { display: block; }

.stat-row { display: flex; gap: 16px; margin-bottom: 20px; }
.stat-tile { flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.stat-tile .num { font-size: 28px; font-weight: 600; }
.stat-tile .label { font-size: 13px; color: var(--text-muted); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface-2); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-offen { background: var(--surface-2); color: var(--text-muted); }
.badge-in_bearbeitung { background: var(--warning-bg); color: var(--warning); }
.badge-abgeschlossen { background: #eaf3de; color: #3b6d11; }

/* --- Wizard --- */
.wizard-steps { display: flex; gap: 8px; margin-bottom: 20px; }
.wizard-step {
    flex: 1; text-align: center; padding: 8px; border-radius: var(--radius); font-size: 13px;
    background: var(--surface-2); color: var(--text-muted);
}
.wizard-step.active { background: var(--primary); color: #fff; font-weight: 500; }
.wizard-step.done { background: #eaf3de; color: #3b6d11; }

.checklist-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; }
.checklist-item .question { font-weight: 500; margin-bottom: 6px; }
.checklist-item .help { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.yesno-group { display: flex; gap: 8px; margin-bottom: 8px; }
.yesno-group button {
    flex: 1; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); cursor: pointer;
}
.yesno-group button.selected-ja { background: #eaf3de; border-color: #97c459; }
.yesno-group button.selected-nein { background: var(--danger-bg); border-color: #f09595; }
.yesno-group button.selected-unklar { background: var(--warning-bg); border-color: #f0a94d; }

.path-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.path-card.recommended { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.path-card h3 { display: flex; justify-content: space-between; align-items: center; }
.cost-row { display: flex; gap: 10px; }
.cost-row .field { flex: 1; }
.cost-total { font-weight: 600; margin-top: 8px; }

.warn-block { background: var(--danger-bg); color: var(--danger); padding: 10px 14px; border-radius: var(--radius); font-size: 13px; margin: 10px 0; }

.similar-hint { background: var(--surface-2); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }

.photo-grid { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.photo-thumb { width: 120px; }
.photo-thumb img { width: 120px; height: 90px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tabs button { background: none; border: none; padding: 10px 16px; cursor: pointer; color: var(--text-muted); font-weight: 500; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--primary-dark); border-color: var(--primary); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 10px; }
.toolbar input[type=search] { flex: 1; max-width: 320px; }

.actions-row { display: flex; gap: 8px; margin-top: 20px; justify-content: space-between; }

.modal-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
    display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px;
}
.modal-box {
    background: var(--surface); border-radius: 12px; width: 100%; max-width: 900px; height: 90vh;
    display: flex; flex-direction: column; overflow: hidden;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.modal-box iframe { flex: 1; border: none; width: 100%; }
