/* MaxPack – Design-System. Mobile-first, zwei Farbschemata (dark/light),
   iOS-Safe-Areas, Chart-Farben nach validierter Referenz-Palette. */

/* ---------------------------------------------------------------- Themes */

:root {
    color-scheme: dark;
    /* Flächen & Tinte (dark: schwarzer Hintergrund, weiße Schrift) */
    --page:        #0d0d0d;
    --surface:     #1a1a19;
    --surface-2:   #242423;
    --ink:         #ffffff;
    --ink-2:       #c3c2b7;
    --ink-muted:   #898781;
    --hairline:    #2c2c2a;
    --baseline:    #383835;
    --ring:        rgba(255, 255, 255, 0.10);
    --accent:      #3987e5;
    --accent-ink:  #ffffff;
    --danger:      #e66767;
    --good:        #0ca30c;
    --shadow:      0 6px 24px rgba(0, 0, 0, 0.45);

    /* Kategoriale Chart-Slots (dark-Stufen) */
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --series-8: #e66767;
    --series-other: #6b6a64;

    --nav-h: 58px;
    --radius: 14px;
    --radius-s: 9px;
}

:root[data-theme="light"] {
    color-scheme: light;
    --page:        #f9f9f7;
    --surface:     #fcfcfb;
    --surface-2:   #f0efec;
    --ink:         #0b0b0b;
    --ink-2:       #52514e;
    --ink-muted:   #898781;
    --hairline:    #e1e0d9;
    --baseline:    #c3c2b7;
    --ring:        rgba(11, 11, 11, 0.10);
    --accent:      #2a78d6;
    --accent-ink:  #ffffff;
    --danger:      #e34948;
    --good:        #006300;
    --shadow:      0 6px 24px rgba(11, 11, 11, 0.12);

    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --series-4: #eda100;
    --series-5: #e87ba4;
    --series-6: #008300;
    --series-7: #4a3aa7;
    --series-8: #e34948;
    --series-other: #a4a29a;
}

/* Logo-Varianten je Theme */
.only-light { display: none; }
.only-dark  { display: block; }
:root[data-theme="light"] .only-light { display: block; }
:root[data-theme="light"] .only-dark  { display: none; }

/* ---------------------------------------------------------------- Basis */

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

html, body {
    height: 100%;
    background: var(--page);
    color: var(--ink);
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-y: none;
}

#app {
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

.boot-splash {
    flex: 1;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--ink-muted);
}
.boot-logo { width: 130px; height: auto; opacity: 0.9; }

h1 { font-size: 1.45rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
a  { color: var(--accent); text-decoration: none; }
small, .muted { color: var(--ink-muted); }

/* ---------------------------------------------------------------- Header */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: color-mix(in srgb, var(--page) 88%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--hairline);
}
.topbar .logo-mark { width: 30px; height: auto; }
.topbar h1 { flex: 1; font-size: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .icon-btn { flex: 0 0 auto; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--ink);
    font-size: 1.25rem;
    cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }

/* ---------------------------------------------------------------- Inhalt */

.content { padding: 16px; display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 760px) {
    .content { max-width: 760px; width: 100%; margin: 0 auto; }
}

.card {
    background: var(--surface);
    border: 1px solid var(--ring);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.card + .card { margin-top: 0; }
.card h2 { margin-bottom: 8px; }
.card.notice {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.empty {
    text-align: center;
    color: var(--ink-muted);
    padding: 34px 16px;
}
.empty .big { font-size: 2.2rem; margin-bottom: 8px; }

/* ---------------------------------------------------------------- Listen */

.list { display: flex; flex-direction: column; gap: 8px; }

.row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--ring);
    border-radius: var(--radius-s);
    padding: 10px 12px;
    min-height: 56px;
    cursor: pointer;
    color: inherit;
    text-align: left;
    width: 100%;
    font: inherit;
}
.row:active { background: var(--surface-2); }
.row .thumb {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    overflow: hidden;
}
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.row .grow { flex: 1; min-width: 0; }
.row .grow .title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .grow .sub { font-size: 0.82rem; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { flex: 0 0 auto; text-align: right; font-variant-numeric: tabular-nums; }
.row .end .w { font-weight: 700; }
.row .end .sub { font-size: 0.78rem; color: var(--ink-muted); }

.group-head {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin: 10px 2px 2px;
}
.group-head .g-name { font-weight: 700; font-size: 0.95rem; }
.group-head .g-sum { margin-left: auto; font-size: 0.85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- Chips */

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
    flex: 0 0 auto;
    border: 1px solid var(--hairline);
    background: var(--surface);
    color: var(--ink-2);
    border-radius: 999px;
    padding: 7px 14px;
    font-size: 0.88rem;
    cursor: pointer;
    white-space: nowrap;
}
.chip.on {
    background: var(--ink);
    color: var(--page);
    border-color: var(--ink);
    font-weight: 600;
}

/* Gast-Hinzufügen-Zeile im Ausgabe-Formular */
.guest-add { display: flex; gap: 8px; align-items: stretch; }
.guest-add input { flex: 1; min-width: 0; }
.guest-add .btn { flex: 0 0 auto; }

/* Kompakte Tab-Leiste (5 Tabs im Tour-Detail) */
.seg.seg-tabs button {
    padding-left: 4px;
    padding-right: 4px;
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ------------------------------------------------- Tour-Titelbild */

.card.trip-head { position: relative; }
.trip-photo {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 82px;
    height: 82px;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--hairline);
    cursor: zoom-in;
}

/* ------------------------------------------------- Pack-o-Meter 🎒 */

.packmeter-card { display: flex; gap: 14px; align-items: center; overflow: hidden; }
.packmeter-card .grow { flex: 1; min-width: 0; }
.packmeter { flex: 0 0 62px; width: 62px; }
.packmeter svg { width: 100%; height: auto; display: block; }
.packmeter .pm-bg { fill: var(--surface-2); }
.packmeter .pm-fill { fill: var(--accent); opacity: 0.85; transition: y 0.6s cubic-bezier(.2,.8,.3,1); }
.packmeter .pm-line { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.summit-ready {
    margin-top: 8px;
    font-weight: 800;
    color: var(--good);
    animation: summit-pop 0.5s cubic-bezier(.2,1.6,.4,1);
}
@keyframes summit-pop {
    0% { transform: scale(0.6); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Häkchen-Pop beim Abhaken */
.list .row input[type="checkbox"]:checked { animation: check-pop 0.25s ease-out; }
@keyframes check-pop {
    0% { transform: scale(1); }
    45% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* Konfetti-Regen (alles gepackt) */
.confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.confetti span {
    position: absolute;
    top: -12px;
    width: 8px;
    height: 12px;
    border-radius: 2px;
    opacity: 0;
    animation: confetti-fall 1.2s ease-in forwards;
}
@keyframes confetti-fall {
    0% { opacity: 1; transform: translateY(0) rotate(0deg); }
    100% { opacity: 0.9; transform: translateY(140px) rotate(320deg); }
}

/* Tour-Countdown */
.countdown { font-weight: 700; color: var(--ink-2); }
.countdown.soon, .countdown.today { color: var(--accent); }
.countdown.today { display: inline-block; animation: countdown-pulse 1.6s ease-in-out infinite; }
.countdown.active { color: var(--good); }
@keyframes countdown-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

/* Runde Länderflaggen (Sprachumschalter) – Inline-SVG, kreisförmig
   beschnitten; feiner Rand, damit helle Segmente immer sichtbar sind. */
.flag-ico {
    display: inline-flex;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid var(--hairline);
    vertical-align: -4px;
    margin-right: 7px;
    flex: 0 0 auto;
}
.flag-ico svg { width: 100%; height: 100%; display: block; }
.seg .flag-ico { vertical-align: -4px; }

/* Mini-Avatar in Personen-Chips (Tour-Packliste: Rucksack-Auswahl) */
.chip .chip-av { margin-right: 5px; }
.chip .chip-av img.avatar-photo {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: -4px;
}

.badge {
    display: inline-block;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--ink-2);
}

/* Vereins-Code (Einladungscode) gut lesbar & auswählbar */
.invite-code {
    display: block;
    text-align: center;
    font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
    font-size: 1.7rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    padding: 14px 10px 14px 18px;
    background: var(--surface-2);
    border: 1px dashed var(--baseline);
    border-radius: 12px;
    color: var(--ink);
    user-select: all;
    -webkit-user-select: all;
}
.badge.accent { background: var(--accent); color: var(--accent-ink); }

/* ---------------------------------------------------------------- Avatar */

.avatar-xl {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.7rem;
    line-height: 1;
    overflow: hidden;
    padding: 0;
}
.avatar-xl img.avatar-photo { width: 100%; height: 100%; object-fit: cover; }
.avatar-xl.tappable { cursor: pointer; }

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.avatar-pick {
    aspect-ratio: 1 / 1;
    border: 1px solid var(--hairline);
    background: var(--surface);
    border-radius: 12px;
    font-size: 1.55rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.avatar-pick.on {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 2px var(--accent);
    background: var(--surface-2);
}

/* ---------------------------------------------------------------- Einladung */

.card.invite { border: 1px solid var(--accent); }
.invite-head {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.link-title {
    display: block;
    background: none;
    border: none;
    padding: 0;
    margin-top: 2px;
    font: inherit;
    font-weight: 700;
    font-size: 1.08rem;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}
.invite-inline {
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    border-radius: 12px;
    padding: 12px;
}
.row .grow .sub.warn { color: var(--accent); font-weight: 600; }

/* Flag-Pills auf Packlisten-Einträgen */
.flag {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.72rem;
    padding: 1px 7px;
    border-radius: 999px;
    border: 1px solid var(--hairline);
    color: var(--ink-2);
}

/* Einpacken-Auswahl: „+"-Kreis (einpacken) bzw. „✓"/„✓×N" (schon dabei).
   min-width statt fixer Breite: „✓×12" wächst zur Pille statt überzulaufen. */
.pack-badge {
    flex: 0 0 auto;
    min-width: 30px;
    height: 30px;
    padding: 0 5px;
    white-space: nowrap;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    background: var(--surface-2);
    color: var(--accent);
    border: 1px solid var(--ring);
}
.pack-badge.on { background: transparent; border-color: transparent; color: var(--good); }
.row.packed { opacity: 0.55; }
.row.pack-row:active:not(.packed) { background: var(--surface-2); }

/* ---------------------------------------------------------------- Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    background: var(--ink);
    color: var(--page);
    width: 100%;
}
.btn:active { opacity: 0.85; }
.btn.secondary {
    background: transparent;
    color: var(--ink);
    border-color: var(--baseline);
}
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.small { min-height: 36px; padding: 6px 14px; width: auto; font-size: 0.9rem; border-radius: 10px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.fab {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 18px);
    z-index: 40;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: var(--ink);
    color: var(--page);
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
}
.fab:active { transform: scale(0.94); }

/* ---------------------------------------------------------------- Formulare */

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea {
    font: inherit;
    color: var(--ink);
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    border-radius: 10px;
    padding: 12px 12px;
    min-height: 46px;
    width: 100%;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 0;
    border-color: transparent;
}
.field .hint { font-size: 0.78rem; color: var(--ink-muted); }
.field .hint.status-ok       { color: var(--good); font-weight: 600; }
.field .hint.status-bad      { color: var(--danger); font-weight: 600; }
.field .hint.status-checking { color: var(--ink-muted); }
form .field + .field, .form-gap { margin-top: 12px; }

/* Zwei Felder nebeneinander (z. B. Von/Bis) – gleiche Oberkante, kein
   vertikaler Stapel-Abstand am zweiten Feld. */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
.field-row > .field { margin-top: 0 !important; }

.check {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    cursor: pointer;
}
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

.seg {
    display: flex;
    background: var(--surface-2);
    border-radius: 12px;
    padding: 3px;
    gap: 3px;
}
.seg button {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--ink-2);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 9px 6px;
    border-radius: 10px;
    cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,0.18); }

/* ---------------------------------------------------------------- Login */

.auth-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 20px calc(28px + env(safe-area-inset-bottom));
    gap: 20px;
    min-height: 92vh;
}
.auth-wrap .logo { width: min(240px, 60vw); height: auto; }
.auth-card { width: 100%; max-width: 400px; }

/* ---------------------------------------------------------------- Bottom-Nav */

.bottom-nav {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 50;
    display: flex;
    height: calc(var(--nav-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--hairline);
}
.bottom-nav button {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--ink-muted);
    font: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
}
.bottom-nav button .ico { display: flex; align-items: center; justify-content: center; height: 24px; }
.bottom-nav button .ico svg { width: 24px; height: 24px; display: block; }
.bottom-nav button.on { color: var(--ink); }

/* ---------------------------------------------------------------- Sheets & Toasts */

.sheet-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(0, 0, 0, 0.55);
    animation: fadeIn 0.18s ease;
}
.sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 100;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--surface);
    border-radius: 18px 18px 0 0;
    padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
    animation: slideUp 0.22s ease;
}
@media (min-width: 760px) {
    .sheet { left: 50%; right: auto; transform: translateX(-50%); width: 560px; }
}
.sheet .grip {
    width: 42px; height: 5px;
    border-radius: 3px;
    background: var(--baseline);
    margin: 4px auto 12px;
}
.sheet h2 { margin-bottom: 14px; }
.sheet .sheet-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }

@keyframes slideUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (min-width: 760px) {
    @keyframes slideUp { from { transform: translate(-50%, 40px); opacity: 0.6; } to { transform: translateX(-50%); opacity: 1; } }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

#toast-root {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}
.toast {
    background: var(--ink);
    color: var(--page);
    padding: 11px 20px;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 600;
    box-shadow: var(--shadow);
    animation: fadeIn 0.2s ease;
    max-width: 88vw;
    text-align: center;
}
.toast.err { background: var(--danger); color: #fff; }

/* ---------------------------------------------------------------- Statistik */

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.stat-tile {
    background: var(--surface);
    border: 1px solid var(--ring);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.stat-tile .label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ink-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat-tile .label .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.stat-tile .value { font-size: 1.45rem; font-weight: 750; margin-top: 2px; }
.stat-tile .value small { font-size: 0.85rem; font-weight: 600; color: var(--ink-muted); }

.chart-card svg { display: block; width: 100%; height: auto; }
.chart-legend { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.chart-legend .lg-row {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.88rem;
}
.chart-legend .lg-row .dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; }
.chart-legend .lg-row .lg-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-legend .lg-row .lg-val { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart-legend .lg-row .lg-pct { color: var(--ink-muted); width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

.viz-tooltip {
    position: fixed;
    z-index: 300;
    pointer-events: none;
    background: var(--ink);
    color: var(--page);
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 8px;
    padding: 6px 10px;
    box-shadow: var(--shadow);
    transform: translate(-50%, calc(-100% - 10px));
    white-space: nowrap;
}

.hbar-row { margin-bottom: 12px; }
.hbar-top {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.88rem;
    margin-bottom: 4px;
}
.hbar-top .name { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-top .val { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.hbar-track {
    display: flex;
    gap: 2px;
    height: 14px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface-2);
}
.hbar-seg { height: 100%; min-width: 2px; }

/* Fortschritt (gepackt) */
.progress {
    height: 8px;
    border-radius: 4px;
    background: var(--surface-2);
    overflow: hidden;
}
.progress > div { height: 100%; background: var(--good); border-radius: 4px; }

/* ---------------------------------------------------------------- Tagebuch */

.journal-entry .j-head { display: flex; align-items: baseline; gap: 8px; }
.journal-entry .j-date { font-size: 0.8rem; color: var(--ink-muted); white-space: nowrap; }
.journal-entry .j-body { margin-top: 6px; white-space: pre-wrap; color: var(--ink-2); }
.journal-photos { display: flex; gap: 8px; overflow-x: auto; margin-top: 10px; }
.journal-photos img {
    width: 110px; height: 110px;
    object-fit: cover;
    border-radius: 10px;
    flex: 0 0 auto;
}

/* Foto-Viewer */
.photo-viewer {
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
}
.photo-viewer img { max-width: 100vw; max-height: 100vh; object-fit: contain; }

/* Pull-to-Refresh-Indikator (mobil): oben ziehen zum Aktualisieren */
.ptr {
    position: fixed;
    top: calc(env(safe-area-inset-top) + 2px);
    left: 50%;
    margin-left: -19px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--ring);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 45;
    transform: translateY(-60px);
    transition: transform 0.18s ease;
    pointer-events: none;
}
.ptr-spin {
    width: 18px;
    height: 18px;
    border: 2px solid var(--hairline);
    border-top-color: var(--ink-muted);
    border-radius: 50%;
    transition: border-top-color 0.15s;
}
.ptr.ready .ptr-spin { border-top-color: var(--accent); }
.ptr.active .ptr-spin { border-top-color: var(--ink); animation: rot 0.8s linear infinite; }

/* ---------------------------------------------------------------- Diverses */

.hr { border: none; border-top: 1px solid var(--hairline); margin: 12px 0; }
.center { text-align: center; }
.spin {
    width: 26px; height: 26px;
    border: 3px solid var(--hairline);
    border-top-color: var(--ink);
    border-radius: 50%;
    margin: 30px auto;
    animation: rot 0.8s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
