/* ============================================================
   Beziehungskompass – Stylesheet
   DSGVO-konform: ausschliesslich Systemschriften, keine externen
   Ressourcen, responsive (Mobile-First).
   ============================================================ */

:root {
    --bg: #fdf6f6;
    --surface: #ffffff;
    --surface-2: #f6e8e8;
    --primary: #b44d5e;
    --primary-dark: #9c3d4e;
    --primary-soft: #efd0d2;
    --accent: #4d8a8a;
    --accent-soft: #d7e6e6;
    --text: #3a2f30;
    --text-soft: #8a7678;
    --border: #ead8da;
    --success: #4d7c4d;
    --success-bg: #e4efe4;
    --warn: #b8860b;
    --warn-bg: #f7efd8;
    --danger: #b03a3a;
    --danger-bg: #f7dfdf;
    --shadow: 0 2px 10px rgba(60, 40, 42, 0.08);
    --shadow-lg: 0 8px 30px rgba(60, 40, 42, 0.14);
    --radius: 16px;
    --radius-sm: 10px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }
button { font-family: inherit; }

/* ---------- Splash ---------- */
.splash {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 100vh; gap: 14px; color: var(--primary-dark);
}
.splash p { font-weight: 600; font-size: 1.1rem; letter-spacing: .5px; }
.spinner {
    width: 26px; height: 26px; border: 3px solid var(--primary-soft);
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout ---------- */
.app-header {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    background: rgba(253, 246, 246, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}
.app-header .logo {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
}
.app-header h1 { font-size: 1.05rem; font-weight: 700; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-header .badge { font-size: .68rem; background: var(--primary-soft); color: var(--primary-dark); padding: 3px 8px; border-radius: 20px; font-weight: 600; }

.app-main {
    max-width: 720px; margin: 0 auto; padding: 16px 16px calc(84px + var(--safe-bottom));
}
.app-main.wide { max-width: 960px; }

.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex; justify-content: space-around;
    padding-bottom: var(--safe-bottom);
    box-shadow: 0 -2px 12px rgba(60,40,42,.06);
    max-width: 720px; margin: 0 auto;
}
.bottom-nav button {
    flex: 1; border: 0; background: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 10px 4px 8px; color: var(--text-soft); font-size: .66rem; font-weight: 600;
}
.bottom-nav button .ic { font-size: 1.35rem; line-height: 1; }
.bottom-nav button.active { color: var(--primary); }
.bottom-nav button .nav-count {
    background: var(--primary); color: #fff; font-size: .6rem; min-width: 16px; height: 16px;
    border-radius: 8px; display: grid; place-items: center; padding: 0 4px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--surface); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px; margin-bottom: 14px;
    border: 1px solid rgba(234, 216, 218, .6);
}
.card h2 { font-size: 1.05rem; margin-bottom: 10px; }
.card h3 { font-size: .95rem; margin-bottom: 8px; }
.card .muted { color: var(--text-soft); font-size: .85rem; }

.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-soft); margin: 18px 0 8px; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border: 0; border-radius: 999px; cursor: pointer;
    padding: 12px 22px; font-weight: 600; font-size: .95rem;
    background: var(--primary); color: #fff;
    transition: transform .08s ease, opacity .15s ease, background .15s ease;
    -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.secondary { background: var(--surface-2); color: var(--primary-dark); }
.btn.ghost { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.btn.success { background: var(--success); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 7px 14px; font-size: .82rem; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 5px; color: var(--text); }
.field input, .field select, .field textarea {
    width: 100%; padding: 11px 13px; border: 1.5px solid var(--border);
    border-radius: var(--radius-sm); font-size: .95rem; background: #fff; color: var(--text);
    font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(180,77,94,.12);
}
.checkline { display: flex; gap: 10px; align-items: flex-start; font-size: .82rem; color: var(--text-soft); }
.checkline input { margin-top: 3px; }

.error-box, .info-box, .success-box {
    padding: 11px 13px; border-radius: var(--radius-sm); font-size: .85rem; margin-bottom: 12px;
}
.error-box { background: var(--danger-bg); color: var(--danger); }
.info-box { background: var(--accent-soft); color: #2e5c5c; }
.success-box { background: var(--success-bg); color: var(--success); }

/* ---------- Auth ---------- */
.auth-wrap { max-width: 400px; margin: 0 auto; padding: 24px 16px; }
.auth-logo {
    width: 72px; height: 72px; margin: 10px auto 12px; border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: grid; place-items: center; color: #fff; font-size: 2rem; font-weight: 700;
}
.auth-wrap h1 { text-align: center; font-size: 1.3rem; margin-bottom: 4px; }
.auth-wrap .tagline { text-align: center; color: var(--text-soft); font-size: .88rem; margin-bottom: 20px; }
.auth-tabs { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; margin-bottom: 18px; }
.auth-tabs button {
    flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 999px;
    font-weight: 600; font-size: .88rem; color: var(--text-soft); cursor: pointer;
}
.auth-tabs button.active { background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.form-foot { text-align: center; font-size: .78rem; color: var(--text-soft); margin-top: 14px; }

/* ---------- Dashboard ---------- */
.welcome-card { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border: 0; }
.welcome-card h2 { font-size: 1.15rem; }
.welcome-card .muted { color: rgba(255,255,255,.85); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-grid .card { margin: 0; padding: 14px; }
.stat-grid .num { font-size: 1.5rem; font-weight: 700; color: var(--primary-dark); }
.stat-grid .lbl { font-size: .75rem; color: var(--text-soft); }

.partner-box { display: flex; align-items: center; gap: 12px; }
.avatar {
    width: 46px; height: 46px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
    display: grid; place-items: center; font-weight: 700; flex-shrink: 0;
}
.partner-box .avatar.g { background: var(--primary-soft); color: var(--primary-dark); }
.partner-box .info { flex: 1; min-width: 0; }
.partner-box .info .name { font-weight: 600; }
.partner-box .info .sub { font-size: .78rem; color: var(--text-soft); }

/* ---------- Categories ---------- */
.cat-list { display: grid; gap: 10px; }
.cat-item {
    display: flex; align-items: center; gap: 14px; padding: 15px 16px;
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
    cursor: pointer; border: 1px solid transparent;
}
.cat-item.locked { background: var(--surface-2); cursor: pointer; }
.cat-item .cat-ic {
    width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary-dark); font-size: 1.3rem; flex-shrink: 0;
}
.cat-item .cat-txt { flex: 1; min-width: 0; }
.cat-item .cat-txt .name { font-weight: 600; font-size: .95rem; }
.cat-item .cat-txt .prog { font-size: .75rem; color: var(--text-soft); }
.cat-item .chev { color: var(--text-soft); font-size: 1.1rem; }

.lock-chip {
    font-size: .66rem; background: #b8860b; color: #fff; padding: 2px 8px; border-radius: 20px; font-weight: 600;
}
.free-chip {
    font-size: .66rem; background: var(--success); color: #fff; padding: 2px 8px; border-radius: 20px; font-weight: 600;
}

/* ---------- Question flow ---------- */
.q-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.q-progress { flex: 1; margin: 0 12px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.q-progress .bar { height: 100%; background: var(--primary); border-radius: 3px; transition: width .25s ease; }
.q-count { font-size: .8rem; font-weight: 600; color: var(--text-soft); white-space: nowrap; }

.q-card {
    background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    padding: 26px 20px; text-align: center; min-height: 320px; display: flex;
    flex-direction: column; justify-content: space-between; gap: 22px;
    border: 1px solid rgba(234,216,218,.5);
}
.q-cat-tag { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--primary); }
.q-text { font-size: 1.18rem; font-weight: 600; line-height: 1.4; }

.q-scale { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.q-scale button {
    border: 1.5px solid var(--border); background: #fff; border-radius: 12px;
    padding: 10px 2px; cursor: pointer; transition: all .12s ease;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.q-scale button .n { font-weight: 700; font-size: 1.05rem; color: var(--text); }
.q-scale button .l { font-size: .58rem; color: var(--text-soft); line-height: 1.1; }
.q-scale button:hover { border-color: var(--primary); transform: translateY(-2px); }
.q-scale button.selected { background: var(--primary); border-color: var(--primary); }
.q-scale button.selected .n, .q-scale button.selected .l { color: #fff; }
.q-scale button.skip { border-style: dashed; }

.q-nav { display: flex; justify-content: space-between; gap: 10px; }

/* ---------- Compare ---------- */
.cmp-hero { text-align: center; padding: 22px 16px; }
.cmp-hero .pct { font-size: 2.6rem; font-weight: 800; color: var(--primary-dark); }
.cmp-hero .lbl { font-size: .85rem; color: var(--text-soft); }
.pct-ring {
    width: 120px; height: 120px; margin: 0 auto 12px; border-radius: 50%;
    background: conic-gradient(var(--primary) var(--p, 0%), var(--surface-2) 0);
    display: grid; place-items: center;
}
.pct-ring .inner {
    width: 92px; height: 92px; border-radius: 50%; background: var(--surface);
    display: grid; place-items: center; font-size: 1.7rem; font-weight: 800; color: var(--primary-dark);
}

.cmp-legend { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
.cmp-legend .item { display: flex; align-items: center; gap: 8px; font-size: .78rem; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.dot.match { background: var(--success); }
.dot.partial { background: var(--accent); }
.dot.difference { background: var(--warn); }
.dot.nonmatch { background: var(--danger); }
.dot.unknown { background: var(--text-soft); }
.dot.blindspot { background: var(--primary); }

.cmp-item {
    display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); align-items: flex-start;
}
.cmp-item:last-child { border-bottom: 0; }
.cmp-item .tag {
    width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
    display: grid; place-items: center; font-size: 1.15rem; font-weight: 700;
}
.cmp-item .body { flex: 1; min-width: 0; }
.cmp-item .body .txt { font-size: .9rem; font-weight: 600; line-height: 1.35; }
.cmp-item .body .cat { font-size: .72rem; color: var(--text-soft); margin-top: 2px; }
.cmp-item .vals { display: flex; gap: 6px; margin-top: 6px; }
.cmp-item .vals span {
    font-size: .7rem; padding: 2px 8px; border-radius: 12px; background: var(--surface-2); font-weight: 600;
}
.cmp-item .vals span.me { background: var(--primary-soft); color: var(--primary-dark); }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; }
.tabs button {
    border: 1.5px solid var(--border); background: #fff; border-radius: 999px;
    padding: 8px 14px; font-size: .82rem; font-weight: 600; color: var(--text-soft); cursor: pointer; white-space: nowrap;
}
.tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Kategorie-Balken */
.cat-bar-row { margin-bottom: 10px; }
.cat-bar-row .lbl { display: flex; justify-content: space-between; font-size: .8rem; margin-bottom: 4px; }
.cat-bar-row .track { height: 9px; background: var(--surface-2); border-radius: 5px; overflow: hidden; }
.cat-bar-row .track .fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--primary)); border-radius: 5px; transition: width .4s ease; }

/* Progress-Chart (einfache Balken) */
.prog-chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.prog-chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.prog-chart .bar { width: 100%; max-width: 34px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.prog-chart .day { font-size: .6rem; color: var(--text-soft); }
.prog-chart .val { font-size: .6rem; font-weight: 700; color: var(--primary-dark); }

/* ---------- Guide ---------- */
.guide-box { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 12px 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: .86rem; margin-top: 8px; color: #2e5c5c; }

/* ---------- Upgrades / Premium ---------- */
.plan-grid { display: grid; gap: 12px; }
.plan {
    border: 2px solid var(--border); border-radius: var(--radius); padding: 18px;
    background: var(--surface); position: relative;
}
.plan.hot { border-color: var(--primary); }
.plan .p-name { font-weight: 700; font-size: 1rem; }
.plan .p-price { font-size: 1.5rem; font-weight: 800; color: var(--primary-dark); margin: 4px 0; }
.plan .p-price small { font-size: .75rem; color: var(--text-soft); font-weight: 400; }
.plan ul { margin: 10px 0 14px 18px; font-size: .84rem; }
.plan .p-badge { position: absolute; top: -10px; right: 12px; background: var(--primary); color: #fff; font-size: .65rem; padding: 3px 10px; border-radius: 12px; font-weight: 700; }

/* ---------- Modal ---------- */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(40,25,27,.5); z-index: 50;
    display: flex; align-items: flex-end; justify-content: center;
}
.modal {
    background: var(--surface); width: 100%; max-width: 520px;
    border-radius: 20px 20px 0 0; padding: 22px 20px calc(20px + var(--safe-bottom));
    max-height: 86vh; overflow-y: auto; animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h2 { margin-bottom: 8px; }
.modal .close-x { float: right; background: none; border: 0; font-size: 1.4rem; cursor: pointer; color: var(--text-soft); }

/* ---------- Toast ---------- */
#toast {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-bottom));
    background: var(--text); color: #fff; padding: 11px 18px; border-radius: 999px;
    font-size: .85rem; z-index: 60; opacity: 0; pointer-events: none;
    transition: opacity .2s ease, transform .2s ease; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
#toast.err { background: var(--danger); }

/* ---------- Pill-Code ---------- */
.pill-code {
    font-size: 1.6rem; letter-spacing: 5px; font-weight: 800; color: var(--primary-dark);
    text-align: center; padding: 14px; background: var(--surface-2); border-radius: var(--radius-sm); margin: 10px 0;
}

/* ---------- DSGVO-Status ---------- */
.consent-badge { font-size: .72rem; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; background: var(--success-bg); color: var(--success); font-weight: 600; }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 30px 16px; color: var(--text-soft); }
.empty .big { font-size: 2.2rem; margin-bottom: 8px; }

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
    .app-main { padding-top: 24px; }
    .stat-grid { grid-template-columns: repeat(4, 1fr); }
    .plan-grid { grid-template-columns: repeat(3, 1fr); }
    .modal { border-radius: 20px; margin-bottom: 24px; }
    .q-scale button .l { font-size: .66rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Print ---------- */
@media print {
    .bottom-nav, .app-header, .btn { display: none !important; }
    .app-main { padding: 0; max-width: 100%; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}