/* =========================================================
   SplitPal — Aurora Bento (V2, light)
   Liquid Glass · Mesh Gradient · Spotlight Cards
   ========================================================= */

:root {
    color-scheme: light;

    /* Brand palette */
    --c1: #ff7ab6;   /* pink   */
    --c2: #ff9d5a;   /* orange */
    --c3: #ffd866;   /* yellow */
    --c4: #6ee7b7;   /* mint   */
    --c5: #5fb6ff;   /* sky    */
    --c6: #8a7cff;   /* indigo */
    --c7: #c87bff;   /* violet */

    --ink: #0d0d14;
    --ink-soft: #1c1c24;
    --muted: #5c5c66;
    --muted-2: #8d8d96;
    /* legacy alias used by inline styles in PHP files */
    --gray: #5c5c66;

    --blue: #0a84ff;
    --blue-2: #5b5bf0;
    --green: #1aaf6e;
    --red:   #ff385c;
    --orange: #ff8a3c;

    /* Glass tokens (light) */
    --glass-bg:        rgba(255,255,255,0.55);
    --glass-bg-strong: rgba(255,255,255,0.78);
    --glass-bg-soft:   rgba(255,255,255,0.32);
    --glass-border:    rgba(255,255,255,0.85);
    --glass-border-soft: rgba(255,255,255,0.45);

    --glass-shadow:    0 12px 36px rgba(40, 30, 80, 0.10), 0 2px 8px rgba(40, 30, 80, 0.05);
    --glass-shadow-lg: 0 28px 60px rgba(40, 30, 80, 0.18), 0 8px 18px rgba(40, 30, 80, 0.08);
    --glass-inset:     inset 0 1px 0 rgba(255,255,255,0.95), inset 0 -1px 0 rgba(255,255,255,0.30);

    --radius-2xl: 26px;
    --radius-xl: 22px;
    --radius: 18px;
    --radius-sm: 14px;

    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

html, body { overflow-x: hidden; }

/* Scrollbalken ausblenden (Scrollen funktioniert weiter) */
html, body, .modal-content {
    scrollbar-width: none;          /* Firefox */
    -ms-overflow-style: none;       /* alte Edge/IE */
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
.modal-content::-webkit-scrollbar { width: 0; height: 0; display: none; }   /* Chrome/Safari */

/* App-Feel: keine Text-Markierung / kein I-Beam-Cursor außerhalb echter Eingabefelder */
body {
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;   /* iOS: kein Halten-Menü auf Text/Bildern */
    cursor: default;
}
input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
    cursor: text;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink-soft);
    line-height: 1.5;
    padding-top: var(--safe-top);
    padding-bottom: 30px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: #f6f5fb;
    min-height: 100vh;
    position: relative;
    isolation: isolate;
}

/* =========================================================
   Mesh-gradient aurora background
   Two layers: vivid blobs (subtle) + soft white veil
   ========================================================= */

body::before {
    content: '';
    position: fixed;
    inset: -10vmax;
    z-index: -2;
    background:
        radial-gradient(38vmax 32vmax at 12% 8%,  var(--c1) 0%,   transparent 60%),
        radial-gradient(34vmax 30vmax at 92% 14%, var(--c6) 0%,   transparent 60%),
        radial-gradient(40vmax 36vmax at 88% 86%, var(--c5) 0%,   transparent 60%),
        radial-gradient(36vmax 32vmax at 8%  92%, var(--c4) 0%,   transparent 60%);
    filter: blur(70px) saturate(110%);
    opacity: 0.42;
    /* Animation entfernt: der bewegte, weichgezeichnete Hintergrund zwang alle
       backdrop-filter-Elemente zu Neuberechnung pro Frame → extremes Lag auf Desktop */
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(120vmax 80vmax at 50% -10%, rgba(255,255,255,0.70), rgba(255,255,255,0) 60%),
        radial-gradient(120vmax 80vmax at 50% 110%, rgba(255,255,255,0.78), rgba(255,255,255,0) 60%),
        linear-gradient(180deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0.20) 50%, rgba(255,255,255,0.45) 100%);
    pointer-events: none;
}

@keyframes meshDrift {
    0%   { transform: translate3d(-2vmax, -2vmax, 0) rotate(0deg);   }
    50%  { transform: translate3d( 3vmax,  2vmax, 0) rotate(6deg);   }
    100% { transform: translate3d(-1vmax,  3vmax, 0) rotate(-4deg);  }
}

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

.container {
    max-width: 520px;
    margin: 0 auto;
    padding: 16px;
    position: relative;
}

.container > .card,
.container > .view > .card,
#dynamic-lists-root > .card {
    animation: cardIn 0.55s var(--ease-out) both;
}
.container > .card:nth-child(2),     .container > .view > .card:nth-child(2)     { animation-delay: 60ms; }
.container > .card:nth-child(3),     .container > .view > .card:nth-child(3)     { animation-delay: 120ms; }
.container > .card:nth-child(4),     .container > .view > .card:nth-child(4)     { animation-delay: 180ms; }
.container > .card:nth-child(5),     .container > .view > .card:nth-child(5)     { animation-delay: 240ms; }
.container > .card:nth-child(n+6),   .container > .view > .card:nth-child(n+6)   { animation-delay: 300ms; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* =========================================================
   Logo / nav header
   ========================================================= */

.nav-header {
    display: flex;
    align-items: center;
    margin: 14px 0 22px;
    position: relative;
}

.back-btn {
    all: unset;
    width: 44px;
    height: 44px;
    border-radius: 16px;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow), var(--glass-inset);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 22px;
    color: var(--ink);
    transition: transform 0.25s var(--spring), background 0.2s var(--ease);
    flex-shrink: 0;
    position: absolute;
    left: 0;
    z-index: 1;
}

.back-btn:hover  { transform: translateX(-2px) scale(1.04); }
.back-btn:active { transform: translateX(-2px) scale(0.94); }

h1 {
    font-size: 34px;
    font-weight: 900;
    letter-spacing: -0.6px;
    margin: 18px 0 26px;
    text-align: center;
    color: var(--ink);
    line-height: 1.1;
}

.logo-text  { display: inline-block; vertical-align: middle; }
.logo-emoji { display: inline-block; vertical-align: middle; margin-left: 8px; }

.nav-header h1 { margin: 0; font-size: 22px; flex: 1; min-width: 0; }

/* Colored gradient on the SplitPal text — emoji stays in its native color */
.logo-text {
    background: linear-gradient(120deg, #5b9eff 0%, #8b5bff 55%, #c267ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 180% 100%;
    animation: shineSlide 14s var(--ease-out) infinite;
    filter: drop-shadow(0 2px 8px rgba(120, 100, 220, 0.14));
}

.logo-emoji {
    display: inline-block;
    transform-origin: 70% 70%;
    animation: emojiBob 6s var(--ease-out) infinite;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.10));
}

@keyframes shineSlide {
    0%   { background-position:   0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position:   0% 50%; }
}

@keyframes emojiBob {
    0%, 100% { transform: rotate(-2deg) translateY(0); }
    50%      { transform: rotate( 3deg) translateY(-2px); }
}

/* =========================================================
   Glass cards with rainbow edge + pointer spotlight
   ========================================================= */

.card {
    position: relative;
    background: rgba(255,255,255,0.38);            /* durchscheinender → mehr Glas */
    -webkit-backdrop-filter: blur(36px) saturate(195%);
    backdrop-filter: blur(36px) saturate(195%);
    border: 1px solid rgba(255,255,255,0.65);
    border-radius: var(--radius-2xl);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow:
        var(--glass-shadow),
        inset 0 2px 1px rgba(255,255,255,0.95),     /* dicke helle Glaskante oben */
        inset 0 -2px 4px rgba(255,255,255,0.48),    /* Licht an der Unterkante */
        inset 0 0 42px rgba(255,255,255,0.13);      /* innerer Glanz */
    overflow: hidden;
    transition: transform 0.4s var(--spring), box-shadow 0.3s var(--ease);
}

/* Soft top-edge highlight (replaces full rainbow border) */
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 14px; right: 14px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.95), transparent);
    pointer-events: none;
}

/* Pointer-tracked spotlight — JS sets --mx / --my */
.card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(260px 260px at var(--mx, 50%) var(--my, -20%),
        rgba(255,255,255,0.45), transparent 60%);
    opacity: 0;
    transition: opacity 0.35s var(--ease);
    pointer-events: none;
}

.card:hover::after { opacity: 1; }

a.card {
    display: block;
    text-decoration: none;
    color: inherit;
}

a.card:hover  { transform: translateY(-3px); box-shadow: var(--glass-shadow-lg), var(--glass-inset); }
a.card:active { transform: translateY(0) scale(0.98); transition-duration: 0.12s; }

h3 {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--ink);
    letter-spacing: -0.2px;
}

/* =========================================================
   Segmented control with sliding glass pill
   ========================================================= */

.segmented-control {
    position: relative;
    display: flex;
    background: rgba(120,120,128,0.12);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    backdrop-filter: blur(22px) saturate(160%);
    padding: 4px;
    border-radius: 14px;
    margin: 16px 0;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.45);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.55), inset 0 -1px 2px rgba(40,30,80,0.05);
}

.segmented-control::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: linear-gradient(180deg, rgba(255,255,255,0.96), rgba(246,246,251,0.86));
    border-radius: 11px;
    box-shadow:
        0 4px 12px rgba(40,30,80,0.14),
        inset 0 1.5px 1px rgba(255,255,255,0.98),     /* glänzende Oberkante */
        inset 0 -2px 4px rgba(40,30,80,0.07);          /* sanfte Tiefe unten */
    transition: transform 0.5s var(--spring);
    z-index: 0;
    pointer-events: none;
}

.segmented-control[data-active="1"]::before { transform: translateX(100%); }

.segmented-control button {
    all: unset;
    flex: 1;
    text-align: center;
    padding: 10px 0;
    font-size: 13px;
    font-weight: 700;
    border-radius: 11px;
    cursor: pointer;
    color: var(--muted);
    transition: color 0.3s var(--ease);
    position: relative;
    z-index: 1;
}

.segmented-control button.active { color: var(--ink); }

/* =========================================================
   Inputs
   ========================================================= */

input, select, textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius);
    border: 1.5px solid transparent;
    font-size: 16px;
    margin-bottom: 12px;
    background: rgba(255,255,255,0.44);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-appearance: none;
    appearance: none;
    color: var(--ink);
    font-family: inherit;
    transition: border-color 0.2s var(--ease), box-shadow 0.25s var(--ease), background 0.2s var(--ease);
    box-shadow:
        inset 0 1px 1px rgba(255,255,255,0.95),     /* helle Glaskante oben */
        inset 0 -1px 2px rgba(255,255,255,0.35),    /* Licht unten */
        0 2px 5px rgba(40,30,80,0.06);
}

input:hover, select:hover { background-color: rgba(255,255,255,0.72); }

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--blue);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(10,132,255,0.18), inset 0 1px 0 rgba(255,255,255,0.95);
}

input::placeholder { color: var(--muted-2); }

select {
    /* ein sauberes Chevron in weichem Grau-Violett — fügt sich in die Palette ein,
       statt zweier schräger Dreiecke die "verschoben" wirken */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a8aa6' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-position: calc(100% - 14px) 50%;
    background-size: 14px 14px;
    background-repeat: no-repeat;
    padding-right: 40px;
}

/* =========================================================
   Buttons
   ========================================================= */

.btn {
    all: unset;
    display: block;
    width: 100%;
    /* Liquid-Glass-Blau: deutlich durchscheinend, der Hintergrund schimmert durch */
    background: linear-gradient(135deg, rgba(77,141,255,0.80) 0%, rgba(110,107,240,0.80) 100%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    backdrop-filter: blur(10px) saturate(160%);
    color: #fff;
    text-shadow: 0 1px 2px rgba(20,30,90,0.35);    /* hält die Schrift über dem Glas knackig */
    text-align: center;
    padding: 15px 0;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 10px 24px rgba(78, 95, 220, 0.34),
        inset 0 1.5px 1px rgba(255,255,255,0.65),    /* helle Glanzkante oben */
        inset 0 -3px 8px rgba(30,40,130,0.30),        /* tiefe Kante unten */
        inset 0 0 20px rgba(255,255,255,0.16);        /* innerer Schimmer */
    transition: transform 0.25s var(--spring), box-shadow 0.25s var(--ease), filter 0.2s var(--ease);
    letter-spacing: 0.1px;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    /* glänzende Glas-Reflexion über der oberen Hälfte (statt Punkt-Highlight) */
    background: linear-gradient(180deg, rgba(255,255,255,0.42) 0%, rgba(255,255,255,0.08) 42%, transparent 62%);
    opacity: 1;
    pointer-events: none;
}

.btn:hover  { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(78, 95, 220, 0.36), 0 3px 8px rgba(78, 95, 220, 0.18), inset 0 1px 0 rgba(255,255,255,0.50); }
.btn:active { transform: translateY(0) scale(0.97); filter: brightness(0.96); transition-duration: 0.1s; }

.btn-secondary {
    all: unset;
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid var(--glass-border-soft);
    color: var(--blue);
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-block;
    box-sizing: border-box;
    text-align: center;
    box-shadow: var(--glass-inset), 0 2px 6px rgba(40,30,80,0.06);
    transition: transform 0.25s var(--spring), background 0.2s var(--ease);
}

.btn-secondary:hover  { background: rgba(255,255,255,0.92); }
.btn-secondary:active { transform: scale(0.96); }

.btn-create-list {
    all: unset;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1.5px dashed rgba(91,91,240,0.32);
    color: var(--blue-2);
    font-weight: 700;
    font-size: 15px;
    border-radius: var(--radius-xl);
    width: 100%;
    height: 60px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: var(--glass-inset);
    transition: background 0.2s var(--ease), transform 0.2s var(--spring), border-color 0.2s var(--ease);
}

.btn-create-list:hover  { background: rgba(255,255,255,0.85); border-color: rgba(91,91,240,0.7); }
.btn-create-list:active { transform: scale(0.98); }

.btn.btn-secondary-colors {
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
    color: var(--blue);
    box-shadow: var(--glass-inset), 0 2px 8px rgba(40,30,80,0.06);
    border: 1px solid var(--glass-border-soft);
}
.btn.btn-secondary-colors::after { display: none; }

.btn-danger {
    all: unset;
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #ff6688 0%, #ff385c 100%);
    color: #fff;
    text-align: center;
    padding: 16px 0;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: 0 10px 24px rgba(255,56,92,0.36), inset 0 1px 0 rgba(255,255,255,0.4);
    transition: transform 0.25s var(--spring), box-shadow 0.25s var(--ease), filter 0.2s var(--ease);
}
.btn-danger:hover  { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(255,56,92,0.45), inset 0 1px 0 rgba(255,255,255,0.45); }
.btn-danger:active { transform: scale(0.97); filter: brightness(0.95); }

/* =========================================================
   Icon picker — squircle tiles with vivid active state
   ========================================================= */

.icon-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    /* großzügiger Vorlauf links → erstes Icon samt Häkchen klar sichtbar, kein Fade/Abschnitt */
    padding: 16px 16px 16px 34px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x proximity;
    scroll-padding-left: 15px;
}
.icon-grid::-webkit-scrollbar { display: none; }

.icon-item {
    font-size: 26px;
    padding: 14px;
    background: rgba(255,255,255,0.42);
    -webkit-backdrop-filter: blur(18px) saturate(170%);
    backdrop-filter: blur(18px) saturate(170%);
    border-radius: 16px;
    border: 1.5px solid rgba(255,255,255,0.75);
    min-width: 60px;
    text-align: center;
    cursor: pointer;
    box-shadow:
        0 4px 14px rgba(40,30,80,0.07),
        inset 0 1.5px 1px rgba(255,255,255,0.92),
        inset 0 -2px 4px rgba(255,255,255,0.40);
    transition: transform 0.4s var(--spring), border-color 0.25s var(--ease), background 0.25s var(--ease), box-shadow 0.3s var(--ease);
    scroll-snap-align: start;
    position: relative;
}

.icon-item:hover { transform: translateY(-2px); background: rgba(255,255,255,0.75); }

.icon-item.active {
    background: linear-gradient(135deg, #4d8dff 0%, #6e6bf0 100%);
    border-color: transparent;
    color: #fff;
    transform: scale(1.06);
    box-shadow: 0 10px 22px rgba(78, 95, 220, 0.36), inset 0 1px 0 rgba(255,255,255,0.40);
    animation: iconPop 0.45s var(--spring);
}

/* kein Hoch-Versatz mehr → ragt nicht über die obere Kante des Scroll-Containers */
@keyframes iconPop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.13); }
    100% { transform: scale(1.06); }
}

/* Häkchen-Badge auf der aktiven Kategorie → sofort sichtbar was gewählt ist.
   Sitzt INNERHALB des Tiles, damit es nie über den Scroll-Rand ragt. */
.icon-item.active::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #1aaf6e;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.25);
    animation: checkBadge 0.4s var(--spring);
}
@keyframes checkBadge {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.25); }
    100% { transform: scale(1); }
}

/* Erfolgs-Puls am Ausgaben-Formular nach dem Speichern */
#expense-form-card.saved-pulse { animation: savedPulse 0.7s var(--ease-out); }
@keyframes savedPulse {
    0%   { box-shadow: var(--glass-shadow), var(--glass-inset); }
    30%  { box-shadow: 0 0 0 3px rgba(26,175,110,0.55), 0 8px 24px rgba(26,175,110,0.30), var(--glass-inset); }
    100% { box-shadow: var(--glass-shadow), var(--glass-inset); }
}

#icon-label {
    display: inline-block;
    transition: transform 0.3s var(--spring);
    font-weight: 700 !important;
    color: var(--blue-2);
}

/* =========================================================
   List items
   ========================================================= */

.list-item {
    display: flex;
    align-items: center;
    padding: 14px 8px;
    border-bottom: 0.5px solid rgba(120,120,128,0.18);
    cursor: pointer;
    min-height: 48px;
    border-radius: 12px;
    margin: 0 -4px;
    transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover  { background: rgba(255,255,255,0.55); }
.list-item:active { background: rgba(120,120,128,0.16); transform: scale(0.99); }

.item-content { flex-grow: 1; font-size: 16px; }

.checkbox {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid rgba(120,120,128,0.40);
    margin-right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.4s var(--spring), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), transform 0.4s var(--spring);
    flex-shrink: 0;
    position: relative;
    background: rgba(255,255,255,0.5);
}

.checkbox::after {
    content: '\2713';
    color: white;
    font-size: 14px;
    font-weight: bold;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.25s var(--ease), transform 0.45s var(--spring);
}

.checkbox.checked {
    background: linear-gradient(135deg, #4cdf94, #1aaf6e);
    border-color: transparent;
    box-shadow: 0 6px 14px rgba(26,175,110,0.42), inset 0 1px 0 rgba(255,255,255,0.45);
    animation: checkPop 0.55s var(--spring);
}
.checkbox.checked::after { opacity: 1; transform: scale(1); }

@keyframes checkPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.32); }
    70%  { transform: scale(0.92); }
    100% { transform: scale(1); }
}

/* =========================================================
   Balance pills
   ========================================================= */

.balance-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 4px;
    border-bottom: 0.5px solid rgba(120,120,128,0.18);
}
.balance-row:last-child { border-bottom: none; }

.balance-name { font-weight: 700; font-size: 15px; color: var(--ink); }

.balance-amount {
    font-weight: 800;
    font-size: 15px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: transform 0.25s var(--spring);
}
.balance-amount:hover { transform: scale(1.04); }

.balance-amount.positive {
    color: #0e8050;
    background: linear-gradient(135deg, rgba(76,223,148,0.22), rgba(26,175,110,0.16));
    border-color: rgba(26,175,110,0.30);
}
.balance-amount.negative {
    color: #c8264c;
    background: linear-gradient(135deg, rgba(255,102,136,0.22), rgba(255,56,92,0.16));
    border-color: rgba(255,56,92,0.32);
}

/* =========================================================
   Expense items — categorical color tiles
   ========================================================= */

.expense-item {
    display: flex;
    align-items: center;
    padding: 14px 8px;
    border-bottom: 0.5px solid rgba(120,120,128,0.18);
    gap: 12px;
    transition: background 0.2s var(--ease);
    border-radius: 12px;
    margin: 0 -4px;
}
.expense-item:last-child { border-bottom: none; }
.expense-item:hover { background: rgba(255,255,255,0.55); }

.expense-icon {
    font-size: 24px;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, rgba(91,158,255,0.22), rgba(139,91,255,0.22));
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    backdrop-filter: blur(10px) saturate(160%);
    border: 1px solid rgba(255,255,255,0.7);
    box-shadow:
        0 6px 14px rgba(40,30,80,0.10),
        inset 0 1.5px 1px rgba(255,255,255,0.85),
        inset 0 -2px 4px rgba(40,30,80,0.06);
    position: relative;
    overflow: hidden;
}
.expense-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.4), transparent 45%);
    pointer-events: none;
}

.expense-info { flex: 1; min-width: 0; }
.expense-info strong { display: block; font-size: 15px; font-weight: 700; color: var(--ink); }
.expense-info small { color: var(--muted); font-size: 13px; }

.expense-amount {
    font-weight: 800;
    font-size: 17px;
    color: var(--ink);
    white-space: nowrap;
}

.repayment-item .expense-amount { color: var(--green); }

/* =========================================================
   Settle up
   ========================================================= */

.settle-item {
    padding: 14px 16px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, rgba(91,158,255,0.12), rgba(139,91,255,0.10));
    border: 1px solid rgba(91,91,240,0.20);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--glass-inset);
}

/* =========================================================
   Tab bar — floating frosted with colored active pill
   ========================================================= */

body:has(.tab-bar) { padding-bottom: calc(110px + var(--safe-bottom)); }

.tab-bar {
    position: fixed;
    bottom: calc(14px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 28px);
    max-width: 470px;
    height: 68px;
    /* liquid glass: sehr klarer Kern (Hintergrund scheint durch), nur feine Glaskanten — kein weißer Schleier */
    background: rgba(255,255,255,0.05);
    -webkit-backdrop-filter: blur(18px) saturate(170%);
    backdrop-filter: blur(18px) saturate(170%);
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 28px;
    box-shadow:
        0 12px 30px rgba(40,30,80,0.20),           /* Schlagschatten → "schwebt" */
        inset 0 1px 1px rgba(255,255,255,0.55),     /* feines Licht an der Oberkante */
        inset 0 -1px 1px rgba(255,255,255,0.22);    /* feines Licht an der Unterkante */
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 8px 12px;                              /* Innenabstand → aktive Pille sitzt sauber, Glasrand bleibt rundum sichtbar */
    z-index: 1000;
    overflow: hidden;
}

/* nur ein feiner Lichtsaum an der Oberkante — kein Streifen, kein Schleier */
.tab-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 20px; right: 20px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
    pointer-events: none;
}

.tab-item {
    all: unset;
    flex: 1;
    text-align: center;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    padding: 8px 0;
    border-radius: 16px;
    transition: color 0.3s var(--ease), transform 0.4s var(--spring), background 0.3s var(--ease);
    position: relative;
}

.tab-item i {
    display: block;
    font-size: 22px;
    margin-bottom: 2px;
    font-style: normal;
    transition: transform 0.45s var(--spring);
}

.tab-item:hover { color: var(--ink); }
.tab-item:active { transform: scale(0.92); }

.tab-item.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(77,141,255,0.80), rgba(110,107,240,0.80));
    text-shadow: 0 1px 2px rgba(20,30,90,0.35);
    box-shadow:
        0 6px 16px rgba(78, 95, 220, 0.30),
        inset 0 1px 1px rgba(255,255,255,0.55),
        inset 0 -2px 5px rgba(30,40,130,0.22);
}

.tab-item.active i { transform: translateY(-1px) scale(1.08); }

.hidden { display: none !important; }

.view { animation: viewIn 0.55s var(--ease-out); }
@keyframes viewIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInRight {
    from { opacity: 0; transform: translateX(28px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-28px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* =========================================================
   Toasts
   ========================================================= */

.toast-container {
    position: fixed;
    top: calc(20px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    width: calc(100% - 30px);
    max-width: 420px;
}

.toast {
    background: rgba(28,28,32,0.82);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.16);
    color: #fff;
    padding: 13px 22px;
    border-radius: 18px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    animation: toastIn 0.5s var(--spring), toastOut 0.35s var(--ease) 2.3s forwards;
    box-shadow: 0 18px 40px rgba(0,0,0,0.30), inset 0 1px 0 rgba(255,255,255,0.12);
    width: 100%;
}

.toast.success { background: linear-gradient(135deg, rgba(76,223,148,0.92), rgba(26,175,110,0.92)); }
.toast.error   { background: linear-gradient(135deg, rgba(255,102,136,0.92), rgba(255,56,92,0.92)); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-26px) scale(0.9); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes toastOut {
    from { opacity: 1; transform: translateY(0)    scale(1); }
    to   { opacity: 0; transform: translateY(-12px) scale(0.95); }
}

/* =========================================================
   Modal — bottom sheet glass
   ========================================================= */

.modal {
    position: fixed;
    inset: 0;
    height: 100dvh;                 /* dynamische Viewport-Höhe → Sheet reicht bis zur sichtbaren Unterkante (Mobile-Browserleiste) */
    background: rgba(20,12,40,0.30);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    z-index: 1500;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: modalFade 0.3s var(--ease-out);
}
.modal.hidden { display: none !important; }

@keyframes modalFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    max-height: 92dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 520px;
    border-radius: 28px 28px 0 0;
    padding: 28px 22px calc(94px + var(--safe-bottom));   /* 70px Überschuss unten */
    margin-bottom: -70px;                                  /* Sheet schießt unter die Bildschirmkante → garantiert kein Spalt */
    background: rgba(255,255,255,0.85);
    -webkit-backdrop-filter: blur(34px) saturate(200%);
    backdrop-filter: blur(34px) saturate(200%);
    border: 1px solid rgba(255,255,255,0.85);
    border-bottom: none;
    box-shadow: 0 -20px 60px rgba(40,30,80,0.22), var(--glass-inset);
    animation: sheetUp 0.55s var(--spring);
    position: relative;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 5px;
    border-radius: 999px;
    background: rgba(120,120,128,0.40);
}

@keyframes sheetUp {
    0%   { transform: translateY(110%); }
    72%  { transform: translateY(-8px); }
    100% { transform: translateY(0); }
}

/* =========================================================
   Group cards on index — colorful hero ticket
   ========================================================= */

.group-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.group-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #4d8dff 0%, #6e6bf0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #fff;
    flex-shrink: 0;
    box-shadow:
        0 8px 18px rgba(78, 95, 220, 0.30),
        0 2px 6px rgba(78, 95, 220, 0.14),
        inset 0 1px 0 rgba(255,255,255,0.40);
    position: relative;
    overflow: hidden;
}

.group-card-icon::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.35), transparent 45%);
    pointer-events: none;
}

a.card:nth-child(2) .group-card-icon  { background: linear-gradient(135deg, #ff8f5e, #ff5fa2);          box-shadow: 0 8px 18px rgba(255,95,162,0.28), inset 0 1px 0 rgba(255,255,255,0.40); }
a.card:nth-child(3) .group-card-icon  { background: linear-gradient(135deg, #4cdf94, #1aaf6e);          box-shadow: 0 8px 18px rgba(26,175,110,0.28),  inset 0 1px 0 rgba(255,255,255,0.40); }
a.card:nth-child(4) .group-card-icon  { background: linear-gradient(135deg, #c267ff, #8b5bff);          box-shadow: 0 8px 18px rgba(139,91,255,0.28),  inset 0 1px 0 rgba(255,255,255,0.40); }
a.card:nth-child(5) .group-card-icon  { background: linear-gradient(135deg, #5fb6ff, #4cdf94);          box-shadow: 0 8px 18px rgba(76,223,148,0.28),  inset 0 1px 0 rgba(255,255,255,0.40); }

.group-card-info { flex: 1; min-width: 0; }
.group-card-info .name {
    font-size: 18px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.2px;
}
.group-card-info .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }

.group-card-arrow {
    color: rgba(120,120,128,0.55);
    font-size: 24px;
    transition: transform 0.3s var(--spring), color 0.25s var(--ease);
}

a.card:hover .group-card-arrow { transform: translateX(5px); color: #6e6bf0; }

/* =========================================================
   Multi-pay rows
   ========================================================= */

#multi-pay-container .list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border-bottom: 0.5px solid rgba(120,120,128,0.18);
    border-radius: 0;
    margin: 0;
    animation: rowIn 0.4s var(--spring);
}
@keyframes rowIn {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}
#multi-pay-container .list-item:last-of-type { border-bottom: none; }
#multi-pay-container .list-item select,
#multi-pay-container .list-item input {
    width: auto;
    margin-bottom: 0;
    padding: 9px 12px;
    font-size: 15px;
    height: auto;
}
#multi-pay-container .list-item select.p-name { flex-grow: 1; min-width: 80px; }
#multi-pay-container .list-item input.p-amount { width: 86px; text-align: right; flex-shrink: 0; }

/* =========================================================
   Empty state
   ========================================================= */

.empty-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--muted);
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 10px;
    animation: floaty 4.4s ease-in-out infinite;
    display: inline-block;
    filter: drop-shadow(0 6px 14px rgba(40,30,80,0.14));
}
@keyframes floaty {
    0%, 100% { transform: translateY(0)    rotate(-2deg); }
    50%      { transform: translateY(-7px) rotate( 3deg); }
}
.empty-state-text { font-size: 14px; }

/* =========================================================
   Stats / category bars / donut / person bars
   ========================================================= */

.stat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 0.5px solid rgba(120,120,128,0.18);
}
.stat-row:last-child { border-bottom: none; }
.stat-icon { font-size: 22px; width: 32px; text-align: center; flex-shrink: 0; }
.stat-name { font-weight: 700; font-size: 14px; width: 70px; flex-shrink: 0; }
.stat-bar-wrap { flex: 1; min-width: 0; }
.stat-label { font-size: 11px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }

.stat-bar {
    height: 8px;
    background: rgba(120,120,128,0.18);
    border-radius: 4px;
    overflow: hidden;
}
.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4cdf94, #1aaf6e);
    border-radius: 4px;
    transition: width 0.8s var(--ease-out);
    min-width: 4px;
    box-shadow: 0 0 12px rgba(26,175,110,0.50);
}

.stat-value { font-weight: 800; font-size: 14px; white-space: nowrap; min-width: 70px; text-align: right; }

.donut-wrap { display: flex; justify-content: center; margin-bottom: 20px; }
.donut-chart { width: 170px; height: 170px; filter: drop-shadow(0 8px 20px rgba(40,30,80,0.16)); }
.donut-chart path, .donut-chart circle { transition: transform 0.3s var(--spring); transform-origin: 90px 90px; }

.donut-legend { display: flex; flex-direction: column; gap: 2px; }
.donut-legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    transition: background 0.2s var(--ease), transform 0.25s var(--spring);
}
.donut-legend-row:hover  { background: rgba(255,255,255,0.55); transform: translateX(2px); }
.donut-legend-row:active { background: rgba(120,120,128,0.16); }

.donut-dot { width: 12px; height: 12px; border-radius: 5px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.05), 0 2px 4px rgba(0,0,0,0.08); }
.donut-icon { font-size: 22px; flex-shrink: 0; }
.donut-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.donut-pct { font-size: 13px; color: var(--muted-2); flex: 1; text-align: right; }
.donut-val { font-weight: 800; font-size: 15px; min-width: 70px; text-align: right; color: var(--ink); }

.person-row { padding: 14px 0; border-bottom: 0.5px solid rgba(120,120,128,0.18); }
.person-row:last-child { border-bottom: none; }
.person-header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }

.person-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.16), inset 0 1px 0 rgba(255,255,255,0.40);
}

.person-name { font-weight: 700; font-size: 15px; flex: 1; color: var(--ink); }
.person-amount { font-weight: 800; font-size: 15px; color: var(--ink); }

.person-bar {
    height: 8px;
    background: rgba(120,120,128,0.18);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}
.person-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.9s var(--ease-out);
    min-width: 3px;
    position: relative;
}
.person-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.45) 50%, transparent 100%);
    animation: shimmer 2.4s linear infinite;
    border-radius: 5px;
}

@keyframes shimmer {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* =========================================================
   Hero total card (Bilanz)
   ========================================================= */

#view-stats > .card:first-child {
    background:
        radial-gradient(120% 120% at 0% 0%, rgba(91,158,255,0.10), transparent 55%),
        radial-gradient(120% 120% at 100% 100%, rgba(139,91,255,0.10), transparent 55%),
        rgba(255,255,255,0.65);
}
#view-stats > .card:first-child #total-amount {
    background: linear-gradient(135deg, #4d8dff 0%, #6e6bf0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 3px 10px rgba(110, 107, 240, 0.22));
}

/* =========================================================
   Admin
   ========================================================= */

.admin-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 8px;
    border-bottom: 0.5px solid rgba(120,120,128,0.18);
    min-height: 46px;
    border-radius: 12px;
    margin: 0 -4px;
    transition: background 0.2s var(--ease);
}
.admin-list-item:last-child { border-bottom: none; }
.admin-list-item:hover { background: rgba(255,255,255,0.55); }

/* Admin-Tabs */
.admin-tabs { display: flex; gap: 8px; margin: 4px 0 18px; }
.admin-tab {
    all: unset;
    flex: 1;
    text-align: center;
    padding: 11px 0;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
    background: var(--glass-bg-strong);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid var(--glass-border-soft);
    box-shadow: var(--glass-inset);
    cursor: pointer;
    transition: transform 0.2s var(--spring), background 0.2s var(--ease), color 0.2s var(--ease);
    touch-action: manipulation;
}
.admin-tab.active {
    color: #fff;
    background: linear-gradient(135deg, #4d8dff, #6e6bf0);
    box-shadow: 0 6px 16px rgba(78,95,220,0.30), inset 0 1px 0 rgba(255,255,255,0.4);
}
.admin-tab:active { transform: scale(0.97); }
.admin-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: 6px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    vertical-align: middle;
}
.dev-group-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 4px; }

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 380px) {
    .container { padding: 12px; }
    h1 { font-size: 30px; }
    .nav-header h1 { font-size: 22px; }
    .card { padding: 18px; }
    .icon-item { min-width: 54px; padding: 12px; font-size: 23px; }
    .tab-bar { height: 64px; }
    .group-card-icon { width: 52px; height: 52px; font-size: 23px; }
}

@media (min-width: 768px) {
    .container { max-width: 580px; }
    .tab-bar { max-width: 540px; }
}

/* =========================================================
   A11y / polish
   ========================================================= */

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Tabular numerals so amounts align in columns */
.balance-amount,
.expense-amount,
.person-amount,
.donut-val,
.donut-pct,
.stat-value,
#total-amount,
#total-per-person {
    font-variant-numeric: tabular-nums;
}

/* No double-tap zoom delay on interactive elements */
.btn, .btn-secondary, .btn-danger, .btn-create-list,
.back-btn, .tab-item, .icon-item, .checkbox,
.list-item, .expense-item, a.card,
.segmented-control button {
    touch-action: manipulation;
}

/* Modal sheet shouldn't bounce-scroll the page behind it */
.modal-content { overscroll-behavior: contain; }

/* =========================================================
   Kassenzettel-Scan
   ========================================================= */

/* Kamera-Icon direkt in der Betragsleiste */
.amount-with-scan { position: relative; margin-bottom: 12px; }
.amount-with-scan input { margin-bottom: 0; padding-right: 54px; }

.amount-scan-btn {
    all: unset;
    position: absolute;
    top: 50%;
    right: 7px;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #4d8dff 0%, #6e6bf0 100%);   /* Brand-Blau→Violett, passend zum Speichern-Button & Tab */
    box-shadow: 0 4px 12px rgba(78,95,220,0.30), inset 0 1px 0 rgba(255,255,255,0.45);
    transition: transform 0.2s var(--spring), filter 0.2s var(--ease);
    touch-action: manipulation;
}
.amount-scan-btn:active { transform: translateY(-50%) scale(0.9); filter: brightness(0.96); }

/* Vollbild-Insel statt Bottom-Sheet */
.scan-modal {
    align-items: stretch;
    justify-content: stretch;
    background: rgba(8,6,16,0.65);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.scan-sheet {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: #0d0d14;
    color: #fff;
    padding: calc(14px + var(--safe-top)) 18px calc(18px + var(--safe-bottom));
    animation: sheetUp 0.5s var(--spring);
}

.scan-close {
    all: unset;
    position: absolute;
    top: calc(12px + var(--safe-top));
    right: 14px;
    z-index: 5;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.14);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    cursor: pointer;
    touch-action: manipulation;
}
.scan-close:active { transform: scale(0.92); }

.scan-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

/* --- Live-Kamera --- */
.scan-viewport {
    position: relative;
    width: 100%;
    flex: 1;
    border-radius: 22px;
    overflow: hidden;
    background: #000;
    margin: 8px 0 22px;
    min-height: 0;
}
#scan-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Zielrahmen mit Ecken */
.scan-frame {
    position: absolute;
    inset: 10% 8%;
    border-radius: 16px;
    box-shadow: 0 0 0 100vmax rgba(0,0,0,0.35);
    overflow: hidden;
}
.scan-frame::before, .scan-frame::after,
.scan-viewport > .scan-frame { pointer-events: none; }
.scan-frame::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    border: 2px solid rgba(255,255,255,0.55);
}

/* laufende Scan-Linie */
.scan-line {
    position: absolute;
    left: 6%;
    right: 6%;
    top: 0;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, transparent, #4cdf94, #5fb6ff, transparent);
    box-shadow: 0 0 14px 3px rgba(95,182,255,0.6);
    animation: scanSweep 2.4s var(--ease-in-out, ease-in-out) infinite;
}
@keyframes scanSweep {
    0%   { top: 4%;  opacity: 0; }
    12%  { opacity: 1; }
    88%  { opacity: 1; }
    100% { top: 96%; opacity: 0; }
}

.scan-hint {
    position: absolute;
    bottom: 14px;
    left: 0; right: 0;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* Auslöser */
.scan-shutter {
    all: unset;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: #fff;
    border: 5px solid rgba(255,255,255,0.35);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s var(--ease);
    touch-action: manipulation;
}
.scan-shutter:active { transform: scale(0.9); }

/* --- Fallback --- */
.scan-fallback-box { text-align: center; max-width: 320px; }
.scan-fallback-icon { font-size: 56px; margin-bottom: 14px; }
.scan-fallback-box p { color: rgba(255,255,255,0.82); font-size: 15px; margin-bottom: 22px; line-height: 1.5; }
.scan-fallback-box .btn { background: linear-gradient(135deg, #1aaf6e, #0a84ff); }

/* --- Verarbeitung: "wird analysiert" --- */
.scan-analyzer {
    position: relative;
    width: 130px;
    height: 168px;
    margin-bottom: 22px;
    animation: analyzerFloat 3s ease-in-out infinite;
}
@keyframes analyzerFloat {
    0%, 100% { transform: translateY(0) rotate(-1.5deg); }
    50%      { transform: translateY(-6px) rotate(1.5deg); }
}

/* stilisierter Kassenzettel */
.scan-doc {
    position: absolute;
    inset: 0;
    background: #fff;
    border-radius: 8px;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 11px;
    overflow: hidden;
    box-shadow: 0 18px 40px rgba(0,0,0,0.45);
    /* gezackte Unterkante wie bei echten Belegen */
    -webkit-mask: linear-gradient(#000 0 0) top/100% calc(100% - 7px) no-repeat,
        radial-gradient(5px at 7px bottom, transparent 98%, #000) bottom left/14px 14px repeat-x;
            mask: linear-gradient(#000 0 0) top/100% calc(100% - 7px) no-repeat,
        radial-gradient(5px at 7px bottom, transparent 98%, #000) bottom left/14px 14px repeat-x;
}
.scan-doc-line {
    height: 7px;
    border-radius: 3px;
    background: #d8d8e0;
}
.scan-doc-line.short { width: 55%; }
.scan-doc-total {
    margin-top: auto;
    height: 13px;
    width: 70%;
    align-self: flex-end;
    border-radius: 3px;
    background: linear-gradient(90deg, #1aaf6e, #0a84ff);
    box-shadow: 0 0 10px rgba(10,132,255,0.45);
}

/* Scan-Strahl, der über den Beleg wandert */
.scan-doc-beam {
    position: absolute;
    left: 0; right: 0;
    height: 26px;
    top: -26px;
    background: linear-gradient(180deg, transparent, rgba(95,182,255,0.55), transparent);
    box-shadow: 0 0 16px 4px rgba(95,182,255,0.5);
    animation: docBeam 1.5s ease-in-out infinite;
}
@keyframes docBeam {
    0%   { top: -26px; }
    100% { top: 168px; }
}

/* Lupe, die das Dokument "absucht" */
.scan-lens {
    position: absolute;
    font-size: 34px;
    right: -14px;
    top: 8px;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.4));
    animation: lensHunt 2.6s var(--ease-in-out, ease-in-out) infinite;
}
@keyframes lensHunt {
    0%   { transform: translate(0, 0)     rotate(0deg); }
    25%  { transform: translate(-92px, 36px) rotate(-8deg); }
    50%  { transform: translate(-30px, 96px) rotate(6deg); }
    75%  { transform: translate(-86px, 70px) rotate(-4deg); }
    100% { transform: translate(0, 0)     rotate(0deg); }
}

.scan-progress-label { font-size: 15px; font-weight: 600; color: rgba(255,255,255,0.9); }

/* --- Ergebnis --- */
#scan-results { justify-content: flex-start; padding-top: 18px; }
.scan-results-title { color: #fff; font-size: 18px; margin: 6px 0 16px; text-align: center; }

.scan-cat-badge {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    margin-bottom: 8px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    color: #cdebff;
    background: rgba(10,132,255,0.18);
    border: 1px solid rgba(95,182,255,0.4);
}

.scan-price-list {
    width: 100%;
    max-width: 420px;
    align-self: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 6px;
}

.scan-price {
    all: unset;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    cursor: pointer;
    transition: transform 0.2s var(--spring), background 0.2s var(--ease);
    touch-action: manipulation;
}
.scan-price:active { transform: scale(0.98); }
.scan-price:hover { background: rgba(255,255,255,0.14); }
.scan-price.best {
    background: linear-gradient(135deg, rgba(26,175,110,0.30), rgba(10,132,255,0.28));
    border-color: rgba(95,182,255,0.55);
}
.scan-price-val { font-size: 22px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.scan-price-tag {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #bff0d4;
    background: rgba(26,175,110,0.35);
    padding: 4px 10px;
    border-radius: 999px;
}

.scan-empty { color: rgba(255,255,255,0.7); text-align: center; font-size: 14px; line-height: 1.6; padding: 20px 0; }

.scan-retry {
    align-self: center;
    margin-top: 22px;
    color: #fff;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
}

/* =========================================================
   Picker-Feld + iPhone-Style Scrollrad
   ========================================================= */
.picker-select { display: none; }

.picker-field {
    all: unset;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.44);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    backdrop-filter: blur(20px) saturate(160%);
    border: 1.5px solid transparent;
    box-shadow:
        inset 0 1px 1px rgba(255,255,255,0.95),
        inset 0 -1px 2px rgba(255,255,255,0.35),
        0 2px 5px rgba(40,30,80,0.06);
    font-size: 16px;
    color: var(--ink);
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
.picker-field:active { transform: scale(0.99); }
.picker-value { font-weight: 600; }
.picker-chevron { color: #8a8aa6; font-size: 18px; line-height: 1; }

/* Multi-Pay-Zeile: Picker-Feld kompakt + flexibel */
#multi-pay-container .list-item .picker-field {
    flex-grow: 1;
    min-width: 0;
    margin-bottom: 0;
    padding: 9px 14px;
    font-size: 15px;
}

/* Picker-Sheet mit Scrollrad */
.picker-sheet { padding-bottom: calc(98px + var(--safe-bottom)); }
.picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.picker-title { font-weight: 700; font-size: 16px; color: var(--ink); }
.picker-done {
    all: unset;
    color: var(--blue);
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    padding: 6px 8px;
    touch-action: manipulation;
}
.picker-done:active { opacity: 0.6; }

.picker-wheel-wrap { position: relative; height: 220px; }

.wheel {
    height: 100%;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Namen faden weich zur Mitte hin — kein harter Rand, unabhängig vom Hintergrund */
    -webkit-mask: linear-gradient(180deg, transparent 0, #000 34%, #000 66%, transparent 100%);
            mask: linear-gradient(180deg, transparent 0, #000 34%, #000 66%, transparent 100%);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-list { padding: 88px 0; }   /* (220 - 44) / 2 → erstes/letztes Item zentrierbar */

.wheel-item {
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: center;
    scroll-snap-stop: always;   /* hartes Einrasten pro Name — nicht über mehrere flutschen */
    font-size: 20px;
    font-weight: 600;
    color: var(--muted-2);
    opacity: 0.55;
    cursor: pointer;
    transition: color 0.2s var(--ease), transform 0.2s var(--spring), opacity 0.2s var(--ease);
}
.wheel-item.sel {
    color: var(--ink);
    font-weight: 800;
    transform: scale(1.08);
    opacity: 1;
}

/* mittiges Auswahlband */
.wheel-band {
    position: absolute;
    top: 50%;
    left: 10px;
    right: 10px;
    height: 44px;
    transform: translateY(-50%);
    border-radius: 12px;
    background: rgba(120,120,128,0.07);    /* nur ein leiser Akzent, fügt sich ins Sheet ein */
    pointer-events: none;
}
/* weiche Ausblendung oben/unten */
/* alte Overlay-Streifen entfernt — die Maske auf .wheel macht den Fade jetzt weich */
.wheel-fade { display: none; }

/* =========================================================
   Feine Animationen
   ========================================================= */

/* Donut zeichnet sich beim Öffnen der Bilanz ein */
@keyframes donutDraw {
    from { transform: rotate(-110deg) scale(0.6); opacity: 0; }
    to   { transform: rotate(0)       scale(1);   opacity: 1; }
}
.donut-chart.draw { animation: donutDraw 0.7s var(--spring); transform-origin: 50% 50%; }

/* einfacher Dreh-Spinner (Gate-Warte-Anzeige) */
@keyframes scanSpin { to { transform: rotate(360deg); } }

/* Einladungs-Banner (in-app) */
.invite-card { overflow: hidden; }
.invite-hero {
    margin: 0 -22px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #5fb6ff 0%, #8a7cff 55%, #c87bff 100%);
    position: relative;
    overflow: hidden;
}
.invite-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.30), transparent 55%);
    pointer-events: none;
}
.invite-hero-emoji {
    font-size: 66px;
    position: relative;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,0.22));
    animation: emojiBob 6s var(--ease-out) infinite;
}

/* Konfetti bei "alles ausgeglichen" */
.confetti-piece {
    position: fixed;
    top: -16px;
    width: 9px;
    height: 14px;
    border-radius: 2px;
    z-index: 3000;
    pointer-events: none;
    animation: confettiFall 2s cubic-bezier(0.3, 0.6, 0.5, 1) forwards;
}
@keyframes confettiFall {
    0%   { transform: translateY(0) rotate(0);          opacity: 1; }
    100% { transform: translateY(105dvh) rotate(560deg); opacity: 0.85; }
}

/* Skeleton-Loader (Startseite) */
.skeleton-card {
    height: 88px;
    border-radius: var(--radius-2xl);
    margin-bottom: 18px;
    border: 1px solid rgba(255,255,255,0.5);
    box-shadow: var(--glass-shadow);
    background: linear-gradient(100deg,
        rgba(255,255,255,0.35) 30%,
        rgba(255,255,255,0.75) 50%,
        rgba(255,255,255,0.35) 70%);
    background-size: 220% 100%;
    animation: skeletonShimmer 1.3s linear infinite;
}
@keyframes skeletonShimmer {
    from { background-position: 220% 0; }
    to   { background-position: -220% 0; }
}

/* =========================================================
   Touch-Geräte: Hover-Effekte nicht "kleben" lassen
   Ohne echten Zeiger bleibt :hover nach dem Tippen aktiv → wirkt unsmooth.
   :active (Tap-Feedback) bleibt erhalten.
   ========================================================= */
@media (hover: none) {
    /* Pointer-Spotlight komplett aus */
    .card::after { opacity: 0 !important; }

    /* Keine "eingefrorenen" Lift-/Scale-Transforms nach dem Tippen */
    .back-btn:hover,
    a.card:hover,
    .btn:hover,
    .btn-danger:hover,
    .icon-item:hover:not(.active),
    .balance-amount:hover,
    .donut-legend-row:hover,
    .scan-price:hover,
    a.card:hover .group-card-arrow { transform: none; }

    /* Schatten im Hover-Zustand auf den Normalwert zurück */
    .btn:hover {
        box-shadow:
            0 8px 20px rgba(78, 95, 220, 0.26),
            0 2px 6px rgba(78, 95, 220, 0.12),
            inset 0 1px 0 rgba(255,255,255,0.40);
    }
    .btn-danger:hover { box-shadow: 0 10px 24px rgba(255,56,92,0.36), inset 0 1px 0 rgba(255,255,255,0.4); }
    a.card:hover { box-shadow: var(--glass-shadow), var(--glass-inset); }

    /* Background-Hover nicht hängen lassen → auf Basiswerte zurück */
    .icon-item:hover:not(.active) { background: rgba(255,255,255,0.55); }
    input:hover, select:hover   { background-color: rgba(255,255,255,0.6); }
    .btn-secondary:hover        { background: var(--glass-bg-strong); }
    .btn-create-list:hover      { background: var(--glass-bg); border-color: rgba(91,91,240,0.32); }
    .list-item:hover,
    .expense-item:hover,
    .donut-legend-row:hover,
    .admin-list-item:hover      { background: transparent; }
    .scan-price:hover           { background: rgba(255,255,255,0.08); }
    .tab-item:hover:not(.active) { color: var(--muted); }
    .back-btn:hover             { background: var(--glass-bg-strong); }
}

/* Visible keyboard focus on all interactive elements */
.btn:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.btn-create-list:focus-visible,
.tab-item:focus-visible,
.icon-item:focus-visible,
.back-btn:focus-visible,
.segmented-control button:focus-visible,
.list-item:focus-visible,
a.card:focus-visible {
    outline: none;
    box-shadow:
        0 0 0 3px #fff,
        0 0 0 6px rgba(78, 95, 220, 0.55);
}
