/*
 * Immodetector – Designsystem
 * Angelehnt an Apples Human Interface Guidelines: ruhige Flächen, klare Hierarchie,
 * eine Akzentfarbe, weiche Materialien, automatisches Hell/Dunkel.
 */

/* ---------- Farben und Maße ---------- */
:root {
    color-scheme: light dark;

    --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Adwaita Sans", system-ui, "Segoe UI", Roboto, sans-serif;
    --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter Display", "Inter", "Adwaita Sans", system-ui, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Adwaita Mono", Menlo, Consolas, monospace;

    --bg: #f5f5f7;
    --bg-elevated: #ffffff;
    --surface: #ffffff;
    --surface-2: #f5f5f7;
    --fill: rgba(120, 120, 128, 0.12);
    --fill-strong: rgba(120, 120, 128, 0.2);
    --label: #1d1d1f;
    --label-2: #6e6e73;
    --label-3: #86868b;
    --separator: rgba(60, 60, 67, 0.12);
    --separator-strong: rgba(60, 60, 67, 0.22);

    --accent: #0071e3;
    --accent-hover: #0077ed;
    --accent-tint: rgba(0, 113, 227, 0.1);
    --on-accent: #ffffff;
    --green: #1f8a3b;
    --green-tint: rgba(52, 199, 89, 0.14);
    --red: #d70015;
    --red-tint: rgba(255, 59, 48, 0.12);
    --orange: #c45500;
    --orange-tint: rgba(255, 149, 0, 0.15);
    --teal: #0a7a8a;
    --teal-tint: rgba(48, 176, 199, 0.14);

    --glass: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.6);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 6px 24px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 2px 6px rgba(0, 0, 0, 0.05), 0 18px 48px rgba(0, 0, 0, 0.1);

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --sidebar-width: 248px;
    --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #000000;
        --bg-elevated: #1c1c1e;
        --surface: #1c1c1e;
        --surface-2: #2c2c2e;
        --fill: rgba(118, 118, 128, 0.24);
        --fill-strong: rgba(118, 118, 128, 0.36);
        --label: #f5f5f7;
        --label-2: #a1a1a6;
        --label-3: #6e6e73;
        --separator: rgba(84, 84, 88, 0.45);
        --separator-strong: rgba(84, 84, 88, 0.7);

        --accent: #0a84ff;
        --accent-hover: #409cff;
        --accent-tint: rgba(10, 132, 255, 0.18);
        --green: #30d158;
        --green-tint: rgba(48, 209, 88, 0.16);
        --red: #ff453a;
        --red-tint: rgba(255, 69, 58, 0.16);
        --orange: #ff9f0a;
        --orange-tint: rgba(255, 159, 10, 0.18);
        --teal: #40c8e0;
        --teal-tint: rgba(64, 200, 224, 0.16);

        --glass: rgba(28, 28, 30, 0.72);
        --glass-border: rgba(255, 255, 255, 0.08);
        --shadow-sm: none;
        --shadow: 0 0 0 1px rgba(255, 255, 255, 0.04);
        --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 24px 64px rgba(0, 0, 0, 0.5);
    }
}

/* ---------- Grundlagen ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.47;
    letter-spacing: -0.01em;
    color: var(--label);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "cv11", "ss01";
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--label);
    margin: 0;
}

h1:focus { outline: none; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

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

p { margin: 0 0 0.75rem; }

hr { border: 0; border-top: 1px solid var(--separator); margin: 1.25rem 0; }

::selection { background: var(--accent-tint); }

.tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--label-2); }
.faint { color: var(--label-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.positive { color: var(--green); }
.negative { color: var(--red); }
.right { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- App-Rahmen ---------- */
.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    flex: 0 0 calc(var(--sidebar-width) + 24px);
    height: 100vh;
    padding: 12px;
}

.sidebar-panel {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 18px 10px 12px;
    border-radius: var(--radius-xl);
    background: var(--glass);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 18px;
    color: var(--label);
    font-family: var(--font-display);
    font-weight: 650;
    font-size: 17px;
    letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }

.app-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    color: #fff;
    background: linear-gradient(160deg, #3ea0ff 0%, #0063d1 100%);
    box-shadow: 0 1px 3px rgba(0, 80, 180, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    flex: none;
}
.app-icon svg { width: 18px; height: 18px; }
.app-icon.large { width: 64px; height: 64px; border-radius: 15px; }
.app-icon.large svg { width: 36px; height: 36px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section {
    padding: 14px 10px 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--label-3);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    color: var(--label);
    font-size: 14px;
    font-weight: 500;
    border: 0;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: inherit;
    transition: background-color 0.15s var(--ease);
}
.nav-link:hover { background: var(--fill); text-decoration: none; }
.nav-link.active { background: var(--accent-tint); color: var(--accent); }
.nav-link svg { width: 18px; height: 18px; flex: none; color: var(--accent); }
.nav-link .nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sidebar-footer { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--separator); }
.sidebar-footer form { margin: 0; }

.content {
    flex: 1;
    min-width: 0;
    padding: 36px 44px 64px 28px;
}

.page { max-width: 1240px; margin: 0 auto; }

/* Schmale Bildschirme: Seitenleiste wird zur Leiste oben */
@media (max-width: 860px) {
    .app { flex-direction: column; }
    .sidebar { position: sticky; top: 0; z-index: 20; height: auto; flex: none; padding: 8px; }
    .sidebar-panel { flex-direction: row; align-items: center; padding: 6px 8px; border-radius: 18px; overflow-x: auto; }
    .brand { padding: 0 8px 0 2px; }
    .brand-name, .nav-section, .nav-link .nav-label, .sidebar-footer .nav-link .nav-label { display: none; }
    .nav { flex-direction: row; }
    .nav-link { width: auto; }
    .sidebar-footer { margin: 0 0 0 auto; padding: 0; border: 0; display: flex; }
    .content { padding: 20px 16px 48px; }
}

/* ---------- Seitenkopf ---------- */
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 20px;
    margin-bottom: 24px;
}
.page-header .titles { flex: 1; min-width: 240px; }
.large-title {
    font-size: 34px;
    line-height: 1.12;
    font-weight: 700;
    letter-spacing: -0.025em;
}
.page-subtitle { margin-top: 4px; color: var(--label-2); font-size: 15px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; margin-bottom: 10px; }
.back-link svg { width: 14px; height: 14px; }

.section-title {
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -0.02em;
    margin: 32px 0 12px;
}
.section-title:first-child { margin-top: 0; }
.section-header { display: flex; align-items: baseline; gap: 12px; margin: 32px 0 12px; }
.section-header .section-title { margin: 0; flex: 1; }

/* ---------- Karten und gruppierte Listen ---------- */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card-body { padding: 18px 20px; }
.card + .card { margin-top: 16px; }
.card-title { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; margin-bottom: 10px; }

.group-label {
    padding: 0 20px 6px;
    font-size: 13px;
    color: var(--label-2);
    font-weight: 500;
}
.group-footer { padding: 8px 20px 0; font-size: 12px; color: var(--label-3); }

.list { list-style: none; margin: 0; padding: 0; }
.list-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 48px;
    padding: 10px 20px;
    color: var(--label);
}
.list-row + .list-row::before {
    content: "";
    position: absolute;
    top: 0;
    left: 20px;
    right: 0;
    border-top: 1px solid var(--separator);
}
.list-row.with-thumb + .list-row.with-thumb::before { left: 106px; }
a.list-row:hover, .list-row.clickable:hover { background: var(--fill); text-decoration: none; }
.list-row .grow { flex: 1; min-width: 0; }
.row-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-subtitle { font-size: 13px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-value { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row-value .primary { font-weight: 600; }
.row-value .secondary { font-size: 13px; color: var(--label-2); }
.chevron { width: 8px; height: 13px; color: var(--label-3); flex: none; }

.kv { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; }
.kv > div { padding: 11px 0; border-top: 1px solid var(--separator); }
.kv > div:nth-child(-n + 2) { border-top: 0; }
.kv > div:nth-child(odd) { color: var(--label-2); }
.kv > div:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Kennzahlen ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 16px 18px;
}
.stat-label { font-size: 13px; color: var(--label-2); font-weight: 500; }
.stat-value {
    margin-top: 4px;
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 650;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}
.stat-value .unit { font-size: 15px; font-weight: 500; color: var(--label-2); letter-spacing: -0.01em; }
.stat.good .stat-value { color: var(--green); }
.stat.bad .stat-value { color: var(--red); }
.stat.compact { padding: 12px 16px; }
.stat.compact .stat-value { font-size: 20px; }

/* ---------- Schaltflächen ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 16px;
    border-radius: 999px;
    border: 0;
    font: inherit;
    font-size: 14px;
    font-weight: 550;
    letter-spacing: -0.01em;
    white-space: nowrap;
    cursor: pointer;
    text-decoration: none;
    color: var(--accent);
    background: var(--fill);
    transition: background-color 0.15s var(--ease), transform 0.1s var(--ease), opacity 0.15s;
}
.btn:hover { text-decoration: none; background: var(--fill-strong); }
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn.disabled { opacity: 0.4; cursor: default; transform: none; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-plain { background: transparent; padding: 0 8px; }
.btn-plain:hover { background: var(--fill); }
.btn-danger { color: var(--red); }
.btn-danger.btn-primary { background: var(--red); color: #fff; }
.btn-sm { height: 28px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Formulare ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--label-2); }
.field-help { font-size: 12px; color: var(--label-3); }

.input, .select, .form-control, .form-select {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: var(--fill);
    color: var(--label);
    font: inherit;
    font-size: 15px;
    letter-spacing: inherit;
    transition: background-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
    appearance: none;
    -webkit-appearance: none;
}
.input::placeholder, .form-control::placeholder { color: var(--label-3); }
.input:focus, .select:focus, .form-control:focus, .form-select:focus {
    outline: none;
    background: var(--surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-tint);
}
.select, .form-select {
    padding-right: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 16'%3E%3Cpath d='M1.5 6 5 2.5 8.5 6M1.5 10 5 13.5 8.5 10' fill='none' stroke='%2386868b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    background-size: 8px 14px;
    cursor: pointer;
}
.input-sm { height: 30px; font-size: 14px; border-radius: 8px; }
textarea.input { height: auto; padding: 8px 12px; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

.search {
    position: relative;
}
.search svg {
    position: absolute;
    left: 11px;
    top: 50%;
    width: 15px;
    height: 15px;
    transform: translateY(-50%);
    color: var(--label-3);
    pointer-events: none;
}
.search .input { padding-left: 33px; }

.input-unit { position: relative; }
.input-unit .input { padding-right: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.input-unit .unit {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--label-3);
    font-size: 14px;
    pointer-events: none;
}

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input, .form-check-input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

/* Schalter im iOS-Stil */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; width: 42px; height: 26px; border-radius: 999px; background: var(--fill-strong); position: relative; cursor: pointer; transition: background 0.2s var(--ease); margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); transition: transform 0.2s var(--ease); }
.switch input:checked { background: #34c759; }
.switch input:checked::after { transform: translateX(16px); }

/* Formular als gruppierte Liste (wie in den Einstellungen) */
.form-rows { margin: 0; }
.form-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    min-height: 46px;
    padding: 6px 16px 6px 20px;
}
.form-row + .form-row::before { content: ""; position: absolute; top: 0; left: 20px; right: 0; border-top: 1px solid var(--separator); }
.form-row > label, .form-row > .label { flex: 1; min-width: 0; font-size: 15px; }
.form-row .hint { display: block; font-size: 12px; color: var(--label-3); line-height: 1.3; margin-top: 1px; }
.form-row .input-unit { flex: 0 0 150px; }
.form-row .input-unit .input { background: transparent; height: 34px; }
.form-row .input-unit .input:focus { background: var(--surface-2); }

/* Segmentierte Auswahl */
.segmented {
    display: inline-flex;
    padding: 2px;
    border-radius: 10px;
    background: var(--fill);
    gap: 2px;
}
.segmented button, .segmented a {
    height: 28px;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--label);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}
.segmented .selected { background: var(--bg-elevated); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); font-weight: 600; }

/* ---------- Abzeichen ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
    white-space: nowrap;
    vertical-align: middle;
    background: var(--fill);
    color: var(--label-2);
}
.badge-green { background: var(--green-tint); color: var(--green); }
.badge-red { background: var(--red-tint); color: var(--red); }
.badge-orange { background: var(--orange-tint); color: var(--orange); }
.badge-blue { background: var(--accent-tint); color: var(--accent); }
.badge-teal { background: var(--teal-tint); color: var(--teal); }

/* ---------- Hinweise ---------- */
.banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    font-size: 14px;
    margin-bottom: 20px;
}
.banner .grow { flex: 1; min-width: 0; }
.banner > svg { width: 20px; height: 20px; flex: none; }
.banner-info { background: var(--accent-tint); box-shadow: none; }
.banner-warning { background: var(--orange-tint); box-shadow: none; }
.banner-danger { background: var(--red-tint); box-shadow: none; color: var(--red); }
.banner-success { background: var(--green-tint); box-shadow: none; }

.spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid var(--accent-tint);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
    flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--label-2);
}
.empty svg { width: 40px; height: 40px; color: var(--label-3); margin: 0 auto 12px; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--label); margin-bottom: 4px; }

/* ---------- Tabellen ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--label-2);
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--separator);
}
.table td { padding: 10px 12px; border-top: 1px solid var(--separator); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table .right { text-align: right; }
.table tr.highlight td { background: var(--accent-tint); }
.table-compact td, .table-compact th { padding-top: 7px; padding-bottom: 7px; font-size: 13px; }

/* QuickGrid */
.grid-host table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.grid-host thead th {
    padding: 0 12px;
    height: 40px;
    font-size: 12px;
    font-weight: 600;
    color: var(--label-2);
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--separator);
}
.grid-host .col-header-content { display: flex; align-items: center; }
.grid-host th.col-justify-end .col-header-content { justify-content: flex-end; }
.grid-host td.col-justify-end { text-align: right; }
.grid-host button.col-title {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    width: auto;
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
}
.grid-host th.col-justify-end button.col-title { flex-direction: row-reverse; }
.grid-host button.col-title:hover { color: var(--label); }
.grid-host .col-title-text { flex: none; }
.grid-host .col-options-button, .grid-host .col-width-draghandle { display: none; }
.grid-host .sort-indicator { width: 10px; height: 12px; display: inline-block; color: var(--accent); font-size: 12px; line-height: 12px; }
.grid-host th.col-sort-asc .sort-indicator::before { content: "↑"; }
.grid-host th.col-sort-desc .sort-indicator::before { content: "↓"; }
.grid-host th.col-sort-asc, .grid-host th.col-sort-desc { color: var(--label); }
.grid-host tbody td { padding: 10px 12px; border-top: 1px solid var(--separator); vertical-align: middle; }
.grid-host tbody tr:first-child td { border-top: 0; }
.grid-host tbody tr:hover td { background: var(--fill); }
.grid-host th:first-child, .grid-host td:first-child { padding-left: 16px; }
.grid-host th:last-child, .grid-host td:last-child { padding-right: 20px; }
/* QuickGrid füllt die Seite mit leeren Platzhalterzeilen auf – Datenzeilen enthalten immer einen Link. */
.grid-host tbody tr:not(:has(a)) { display: none; }

.listing-cell { display: flex; align-items: center; gap: 14px; color: var(--label); min-width: 280px; }
.listing-cell:hover { text-decoration: none; }
.listing-cell .grow { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.listing-cell .row-title { max-width: 520px; }
.grid-host tbody tr { cursor: default; }

/* ---------- Bilder ---------- */
.thumb {
    width: 72px;
    height: 54px;
    border-radius: 10px;
    object-fit: cover;
    background: var(--fill);
    flex: none;
}
.thumb-placeholder { display: grid; place-items: center; color: var(--label-3); }
.thumb-placeholder svg { width: 22px; height: 22px; }

.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.gallery .hero { grid-column: 1 / -1; aspect-ratio: 16 / 10; }
.gallery a { display: block; border-radius: var(--radius); overflow: hidden; background: var(--fill); aspect-ratio: 4 / 3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s var(--ease); }
.gallery a:hover img { transform: scale(1.03); }
.gallery .removed img { opacity: 0.35; }

/* ---------- Werkzeugleiste ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .search { flex: 1 1 180px; }
.toolbar .select { width: auto; min-width: 140px; }
.toolbar .input-unit { width: 150px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 0 4px; font-size: 13px; color: var(--label-2); }

/* ---------- Raster ---------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; align-items: start; }
.split-wide { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 24px; align-items: start; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 24px; }
.sticky-col { position: sticky; top: 24px; }
@media (max-width: 1100px) {
    .split, .split-wide { grid-template-columns: 1fr; }
    .sticky-col { position: static; }
}
@media (max-width: 700px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .large-title { font-size: 28px; }
    .gallery { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Kleinigkeiten ---------- */
.inline-icon { width: 12px; height: 12px; display: inline-block; vertical-align: -1px; }
.price-change { font-size: 12px; font-weight: 600; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 999px; background: var(--fill); font-size: 13px; }
.chip-remove { display: inline-grid; place-items: center; width: 18px; height: 18px; margin: 0 -5px 0 6px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--label-3); cursor: pointer; }
.chip-remove:hover { background: var(--fill-strong); color: var(--label); }
.chip-remove svg { width: 15px; height: 15px; }
.description { white-space: pre-wrap; line-height: 1.6; font-size: 15px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; color: var(--label-2); font-size: 14px; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--separator); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.fact { background: var(--surface); padding: 14px 16px; }
.fact-label { font-size: 12px; color: var(--label-2); font-weight: 500; }
.fact-value { font-size: 17px; font-weight: 600; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.price-hero { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }

/* ---------- Anmeldeseiten ---------- */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 380px; text-align: center; }
.auth-card .app-icon { margin: 0 auto 18px; }
.auth-card h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.025em; }
.auth-card .page-subtitle { margin-bottom: 28px; }
.auth-card form { text-align: left; }
.auth-card .stack > * + * { margin-top: 12px; }

/* ---------- Kompatibilität für die Konto-Seiten (Identity-Vorlage) ---------- */
.row { display: flex; flex-wrap: wrap; gap: 24px; }
.row > [class*="col"] { flex: 1 1 320px; min-width: 0; }
.mb-3 { margin-bottom: 14px; }
.mt-3 { margin-top: 14px; }
.w-100 { width: 100%; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--label-2); margin-bottom: 5px; }
.form-floating { display: flex; flex-direction: column-reverse; gap: 5px; margin-bottom: 14px; }
.form-floating > label { font-size: 13px; font-weight: 500; color: var(--label-2); }
.form-floating > .form-control::placeholder { color: transparent; }
.form-check, .checkbox { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.text-danger, .validation-message { color: var(--red); font-size: 13px; }
.validation-summary-errors ul, ul.validation-errors { margin: 0 0 12px; padding-left: 18px; color: var(--red); font-size: 13px; }
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; background: var(--fill); }
.alert-success { background: var(--green-tint); }
.alert-danger { background: var(--red-tint); color: var(--red); }
.alert-warning { background: var(--orange-tint); }
.alert-info { background: var(--accent-tint); }
.btn-link { background: none; color: var(--accent); padding: 0; height: auto; }
.btn-link:hover { background: none; text-decoration: underline; }
.btn-secondary, .btn-outline-secondary { background: var(--fill); color: var(--label); }
.nav-pills { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.nav-pills .nav-link { color: var(--label); }
.nav-pills .nav-link.active { background: var(--accent-tint); color: var(--accent); }
.list-group { display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.list-group-item { padding: 10px 16px; border: 0; border-top: 1px solid var(--separator); background: none; text-align: left; font: inherit; color: var(--label); }
.list-group-item:first-child { border-top: 0; }
.list-group-item-action { cursor: pointer; }
.list-group-item-action:hover { background: var(--fill); }
.manage-layout { display: grid; grid-template-columns: 220px 1fr; gap: 32px; }
@media (max-width: 760px) { .manage-layout { grid-template-columns: 1fr; } }
kbd { font-family: var(--font-mono); background: var(--fill); border-radius: 6px; padding: 2px 6px; font-size: 13px; }
.recovery-codes { font-family: var(--font-mono); }

/* ---------- Blazor ---------- */
.valid.modified:not([type=checkbox]) { border-color: transparent; }
.invalid { border-color: var(--red) !important; }

#blazor-error-ui {
    display: none;
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    z-index: 1000;
    padding: 12px 44px 12px 18px;
    border-radius: var(--radius);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-lg);
    color: var(--label);
    font-size: 14px;
}
#blazor-error-ui .dismiss { position: absolute; right: 14px; top: 11px; cursor: pointer; color: var(--label-3); }
#blazor-error-ui .reload { margin-left: 8px; }

.blazor-error-boundary { padding: 16px 20px; border-radius: var(--radius); background: var(--red-tint); color: var(--red); }
.blazor-error-boundary::after { content: "Hier ist ein Fehler aufgetreten."; }

/* Überschriften innerhalb von Karten (Konto-Seiten) */
.card-body h2, .card-body h3 { font-size: 17px; font-weight: 650; letter-spacing: -0.015em; margin-bottom: 16px; }

/* Anzeigenliste auf dem Telefon: nur Wohnung und Preis */
@media (max-width: 700px) {
    .grid-host th:nth-child(n + 3), .grid-host td:nth-child(n + 3) { display: none; }
    .grid-host table { table-layout: fixed; }
    .grid-host th:nth-child(2), .grid-host td:nth-child(2) { width: 92px; }
    .grid-host td:first-child { overflow: hidden; }
    .listing-cell { min-width: 0; gap: 10px; }
    .listing-cell .thumb { width: 56px; height: 44px; }
    .listing-cell .row-title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 14px; }
    .grid-host th:first-child, .grid-host td:first-child { padding-left: 12px; }
    .grid-host th:last-child, .grid-host td:last-child { padding-right: 14px; }
    .grid-host td:nth-child(2) { padding-left: 4px; }
    .toolbar .select, .toolbar .input-unit { flex: 1 1 140px; width: auto; min-width: 0; }
}

/* ---------- Merkliste / Aussortieren ---------- */
:root { --star: #e6a100; --star-tint: rgba(255, 179, 0, 0.16); }
@media (prefers-color-scheme: dark) { :root { --star: #ffcc00; --star-tint: rgba(255, 204, 0, 0.18); } }

.rating-buttons { display: inline-flex; gap: 6px; align-items: center; }
.rate-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 14px; border-radius: 999px; border: 0;
    background: var(--fill); color: var(--label-2);
    font: inherit; font-size: 14px; font-weight: 550; cursor: pointer;
    transition: background-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.1s var(--ease);
}
.rate-btn:hover { background: var(--fill-strong); color: var(--label); }
.rate-btn:active { transform: scale(0.92); }
.rate-btn svg { width: 17px; height: 17px; }
.rate-btn.on-fav, .rate-btn.on-fav:hover { background: var(--star-tint); color: var(--star); }
.rate-btn.on-reject, .rate-btn.on-reject:hover { background: var(--red-tint); color: var(--red); }
.rating-buttons.compact { gap: 4px; }
.rating-buttons.compact .rate-btn { width: 32px; height: 32px; padding: 0; justify-content: center; background: transparent; }
.rating-buttons.compact .rate-btn:hover { background: var(--fill); }
.rating-buttons.compact .rate-btn.on-fav { background: var(--star-tint); }
.rating-buttons.compact .rate-btn.on-reject { background: var(--red-tint); }
.fav-star { width: 14px; height: 14px; color: var(--star); display: inline-block; vertical-align: -2px; margin-right: 5px; }

/* Anzeigenliste: aussortierte Zeilen rot überdeckt, gemerkte mit gelbem Rand */
.grid-host tbody tr.is-rejected td { background: rgba(255, 59, 48, 0.07); }
.grid-host tbody tr.is-rejected td > * { opacity: 0.45; }
.grid-host tbody tr.is-rejected td:last-child > * { opacity: 1; }
.grid-host tbody tr.is-rejected:hover td { background: rgba(255, 59, 48, 0.11); }
.grid-host tbody tr.is-favorite td:first-child { box-shadow: inset 3px 0 0 var(--star); }
.grid-host td:last-child { width: 1%; white-space: nowrap; }
.listing-cell .thumb { width: 112px; height: 80px; border-radius: 12px; }
.listing-cell .row-title { max-width: none; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.listing-cell .row-subtitle { white-space: normal; margin-top: 2px; }

.rejected-banner {
    display: flex; align-items: center; gap: 10px;
    margin: -8px 0 20px; padding: 12px 16px;
    border-radius: var(--radius); background: var(--red-tint); color: var(--red);
    font-size: 14px; font-weight: 550;
}
.rejected-banner svg { width: 20px; height: 20px; flex: none; }
.note-input { width: 100%; resize: vertical; min-height: 76px; line-height: 1.45; font: inherit; }

/* ---------- Kacheln ---------- */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.tile-grid.compact { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tile {
    position: relative;
    display: flex; flex-direction: column;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tile-link { display: flex; flex-direction: column; flex: 1; color: var(--label); }
.tile-link:hover { text-decoration: none; }
.tile-media { position: relative; aspect-ratio: 4 / 3; background: var(--fill); overflow: hidden; }
.tile-media img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s var(--ease); }
.tile:hover .tile-media img { transform: scale(1.03); }
.tile-placeholder { position: absolute; inset: 0; display: grid; place-items: center; color: var(--label-3); }
.tile-placeholder svg { width: 32px; height: 32px; }
.tile-badge {
    position: absolute; left: 10px; top: 10px;
    padding: 3px 9px; border-radius: 999px;
    background: rgba(0, 0, 0, 0.55); color: #fff;
    font-size: 12px; font-weight: 600;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.tile-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile-price { display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.tile-price > span:first-child { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.tile-sqm { font-size: 13px; color: var(--label-2); font-weight: 500; }
.tile-title { font-weight: 550; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile-meta, .tile-extra { font-size: 13px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-extra { color: var(--label-3); }
.tile-note {
    display: flex; gap: 6px; align-items: flex-start;
    margin-top: 6px; padding: 7px 9px; border-radius: var(--radius-sm);
    background: var(--fill); font-size: 13px; color: var(--label-2);
}
.tile-note svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.tile-note span { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }

/* Stern/X schweben als Glas über dem Bild */
.tile-actions { position: absolute; right: 10px; top: 10px; z-index: 2; }
.tile-actions .rating-buttons {
    padding: 3px; border-radius: 999px;
    background: var(--glass);
    backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}
.tile-actions .rate-btn { color: var(--label); }
.tile-actions .rate-btn.on-fav { color: var(--star); }
.tile-actions .rate-btn.on-reject { color: var(--red); }

/* Aussortierte Kachel: rot überdeckt, Bild entsättigt, Knöpfe bleiben bedienbar */
.tile.is-rejected .tile-link { opacity: 0.55; }
.tile.is-rejected .tile-media img { filter: grayscale(0.7); }
.tile.is-rejected .tile-media::after { content: ""; position: absolute; inset: 0; background: rgba(255, 59, 48, 0.28); }
.tile.is-rejected { box-shadow: 0 0 0 1.5px rgba(255, 59, 48, 0.45), var(--shadow); }

/* Auswahl im Rechner */
.pick-section { border-top: 1px solid var(--separator); padding-top: 14px; }
.tile-pick { border: 0; padding: 0; font: inherit; text-align: left; color: var(--label); cursor: pointer; background: var(--surface-2); box-shadow: none; }
.tile-pick:hover { box-shadow: 0 0 0 2px var(--accent); }
.tile-pick .tile-body { padding: 8px 10px 10px; }
.tile-pick .tile-price > span:first-child { font-size: 15px; }
.tile-pick .tile-title { font-size: 13px; }

@media (max-width: 700px) {
    .tile-grid { grid-template-columns: 1fr; gap: 16px; }
    .tile-grid.compact { grid-template-columns: repeat(2, 1fr); }
    /* Anzeigenliste: Stern/X bleibt neben dem Preis sichtbar */
    .grid-host th:last-child, .grid-host td:last-child { display: table-cell; width: 44px; padding-left: 0; padding-right: 8px; }
    .grid-host td:last-child .rating-buttons { flex-direction: column; }
    .listing-cell .thumb { width: 60px; height: 46px; }
    /* Kennzahlen zweispaltig, damit die Bilder schneller kommen */
    .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stats .stat { padding: 12px 14px; }
    .stats .stat-value { font-size: 24px; }
    .stats .stat:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* ---------- Erweiterung ---------- */
.steps { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.steps code, .card-body p code { font-family: var(--font-mono); font-size: 13px; background: var(--fill); padding: 1px 6px; border-radius: 6px; }
.token-box { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--fill); font-family: var(--font-mono); font-size: 13px; word-break: break-all; user-select: all; }

/* ---------- Karte (wwwroot/js/geomap.js) ---------- */
.geomap-host { position: relative; width: 100%; border-radius: var(--radius); overflow: hidden; background: #e8e4dc; }
.geomap { touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.geomap:active { cursor: grabbing; }
.geomap-tiles { position: absolute; inset: 0; overflow: hidden; }
.geomap-tiles img { position: absolute; left: 0; top: 0; width: 256px; height: 256px; max-width: none; pointer-events: none; }
@media (prefers-color-scheme: dark) {
    .geomap-host { background: #2b2b2e; }
    .geomap-tiles { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.85) saturate(0.6); }
}
.geomap-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.geomap-circle { fill: var(--accent); fill-opacity: 0.12; stroke: var(--accent); stroke-width: 2; }
.geomap-center { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.geomap-handle { fill: #fff; stroke: var(--accent); stroke-width: 3; pointer-events: all; cursor: ew-resize; filter: drop-shadow(0 1px 2px rgba(0,0,0,.3)); }
.geomap-label { font: 600 13px var(--font); fill: var(--label); text-anchor: middle; paint-order: stroke; stroke: var(--bg-elevated); stroke-width: 4px; stroke-linejoin: round; }
.geomap-controls { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.geomap-controls button {
    width: 34px; height: 34px; border: 0; border-radius: 10px; cursor: pointer;
    display: grid; place-items: center; font: 600 18px var(--font); color: var(--label);
    background: var(--glass); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}
.geomap-controls button:hover { color: var(--accent); }
.geomap-controls button.busy { animation: geomap-pulse 1s ease-in-out infinite; }
@keyframes geomap-pulse { 50% { opacity: 0.4; } }
.geomap-attribution { position: absolute; right: 0; bottom: 0; padding: 2px 6px; font-size: 11px; color: #333; background: rgba(255, 255, 255, 0.75); border-top-left-radius: 6px; }
.geomap-attribution a { color: inherit; }
.geomap-hint { position: absolute; left: 10px; bottom: 8px; padding: 3px 8px; border-radius: 6px; font-size: 12px; color: var(--label-2); background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); pointer-events: none; }
.geomap-hint:empty { display: none; }
.suggest-list { display: grid; gap: 6px; margin-top: 10px; }
.suggest-list label { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* ---------- Abruf-Protokoll ---------- */
.fetch-log { margin-top: 24px; }
.fetch-log summary { cursor: pointer; font-weight: 600; font-size: 15px; padding: 4px 0; }
.fetch-log summary .muted { font-weight: 500; font-size: 14px; }

/* ---------- Dubletten ---------- */
.dup-card { padding: 16px; }
.dup-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.dup-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dup-side { display: flex; gap: 12px; padding: 10px; border-radius: var(--radius); background: var(--surface-2); color: var(--label); min-width: 0; }
.dup-side:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--accent); }
.dup-side img, .dup-noimg { width: 132px; height: 99px; border-radius: 10px; object-fit: cover; flex: none; background: var(--fill); }
.dup-noimg { display: grid; place-items: center; color: var(--label-3); }
.dup-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dup-reason { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--fill); font-size: 14px; line-height: 1.45; white-space: pre-line; }
.dup-actions { margin-top: 12px; }
@media (max-width: 700px) {
    .dup-sides { grid-template-columns: 1fr; }
    .dup-side img, .dup-noimg { width: 96px; height: 72px; }
}
.siblings .list-row { padding: 8px 0; }
.dup-noimg svg { width: 28px; height: 28px; }

/* ---------- KI-Auswertung ---------- */
.analysis-summary { margin: 0 0 12px; line-height: 1.5; }
.analysis-warnings { display: grid; gap: 8px; margin-bottom: 12px; }
.analysis-warning { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.analysis-quote { font-size: 13px; color: var(--label-2); font-style: italic; line-height: 1.4; }
.analysis-kv > div { padding: 8px 0; font-size: 14px; }
.analysis-kv > div:nth-child(even) { text-align: right; }
.tile-warning {
    position: absolute; left: 10px; bottom: 10px;
    padding: 3px 9px; border-radius: 999px;
    background: rgba(215, 0, 21, 0.85); color: #fff;
    font-size: 12px; font-weight: 600;
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.tile-also { font-size: 12.5px; color: var(--accent); font-weight: 550; }
.switch-row { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: -4px 0 16px; }
.row-subtitle .also { color: var(--accent); font-weight: 550; }

/* ---------- Bewertung ---------- */
.score { display: inline-grid; place-items: center; min-width: 34px; height: 24px; padding: 0 7px; border-radius: 999px; font-weight: 650; font-size: 13px; font-variant-numeric: tabular-nums; }
.score-good { background: var(--green-tint); color: var(--green); }
.score-mid { background: var(--orange-tint); color: var(--orange); }
.score-low { background: var(--fill); color: var(--label-2); }
.score-lg { min-width: 44px; height: 30px; font-size: 16px; }

/* Telefon: alle Menüpunkte in der oberen Leiste sichtbar; Hinweiskästen mit Knopf umbrechen */
@media (max-width: 860px) {
    .sidebar .brand { display: none; }
    .sidebar .nav { gap: 0; }
    .sidebar .nav-link { padding-left: 5px; padding-right: 5px; }
}
@media (max-width: 700px) {
    .banner { flex-wrap: wrap; }
    .banner > .grow { flex-basis: calc(100% - 40px); }
}

/* Zensus-Vergleich in der Bewertung */
.zensus-line { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--separator); line-height: 1.5; }
