:root {
    --bg: #eef3fb;
    --bg-elevated: #f8fbff;
    --surface: #ffffff;
    --surface-soft: #f5f8fd;
    --surface-strong: #ffffff;
    --text: #182130;
    --text-soft: #68758a;
    --text-muted: #8b97aa;
    --border: #dde6f0;
    --border-strong: #cfd9e6;
    --shadow: 0 18px 40px rgba(35, 56, 92, 0.10);
    --shadow-soft: 0 10px 24px rgba(35, 56, 92, 0.08);
    --accent: #2f84eb;
    --accent-soft: rgba(47, 132, 235, 0.12);
    --accent-glow: rgba(47, 132, 235, 0.18);
    --success: #2e9a58;
    --success-soft: rgba(46, 154, 88, 0.12);
    --warning: #c98a1f;
    --warning-soft: rgba(201, 138, 31, 0.12);
    --danger: #d95a5a;
    --danger-soft: rgba(217, 90, 90, 0.12);
    --radius: 26px;
    --radius-sm: 18px;
    --nav-height: 96px;
    --max-width: 460px;
}

html[data-theme="dark"] {
    --bg: #020306;
    --bg-elevated: #06080f;
    --surface: #0a0d15;
    --surface-soft: #0e1320;
    --surface-strong: #101726;
    --text: #f7f9ff;
    --text-soft: #a5b0c3;
    --text-muted: #7e899c;
    --border: #171e2c;
    --border-strong: #243047;
    --shadow: 0 18px 42px rgba(0, 0, 0, 0.54);
    --shadow-soft: 0 10px 26px rgba(0, 0, 0, 0.36);
    --accent: #66a3ff;
    --accent-soft: rgba(102, 163, 255, 0.16);
    --accent-glow: rgba(102, 163, 255, 0.26);
    --success: #72d78f;
    --success-soft: rgba(114, 215, 143, 0.14);
    --warning: #ffbf47;
    --warning-soft: rgba(255, 191, 71, 0.15);
    --danger: #ff7676;
    --danger-soft: rgba(255, 118, 118, 0.16);
}

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

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

body {
    margin: 0;
    background:
        radial-gradient(circle at top center, rgba(47, 132, 235, 0.08), transparent 26%),
        linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 100%);
    color: var(--text);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.45;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input {
    font: inherit;
}

svg {
    display: block;
}

.app-shell {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
}

.page-content {
    padding: 14px 14px calc(var(--nav-height) + 38px);
}

.card {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0.98) 100%),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.topbar {
    margin: 10px 14px 0;
    padding: 18px 18px 16px;
    background:
        radial-gradient(circle at top right, rgba(47, 132, 235, 0.08), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 1));
}

.topbar__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar__titles h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.02;
    letter-spacing: -0.04em;
}

.topbar__titles p {
    margin: 8px 0 0;
    color: var(--text-soft);
    font-size: 1rem;
}

.topbar__date-link {
    color: inherit;
    text-decoration: none;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-button {
    width: 48px;
    height: 48px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(244, 248, 253, 1)),
        var(--surface-soft);
    box-shadow: var(--shadow-soft);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ui-icon {
    width: 22px;
    height: 22px;
}

.ui-icon--search {
    width: 24px;
    height: 24px;
}

.welcome {
    padding: 22px;
    margin-bottom: 14px;
    background:
        radial-gradient(circle at top right, rgba(47, 132, 235, 0.10), transparent 34%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 255, 1));
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--text-soft);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.welcome h2,
.section-head h2,
.month-overview h2,
.recent-receipts h2,
.insights h2,
.attention h2 {
    margin: 0;
    font-size: 1.95rem;
    line-height: 1.06;
    letter-spacing: -0.04em;
}

.welcome__heading-wrap {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: nowrap;
}

.welcome__heading-wrap h2 {
    margin: 0;
    flex: 1 1 0%;
    min-width: 0;
}

.welcome__greeting {
    font-size: 1.18rem;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.welcome__greeting-line1 {
    display: block;
}

.welcome__greeting-name {
    white-space: nowrap;
    color: var(--accent);
}

.welcome-help-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    flex-shrink: 0;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.welcome-help-link:hover,
.welcome-help-link:focus-visible {
    color: var(--accent);
    background: var(--accent-soft);
    border-color: var(--accent);
    outline: none;
}

button.welcome-help-link {
    cursor: pointer;
    margin: 0;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
}

.welcome .muted {
    margin: 10px 0 0;
    max-width: 30ch;
    color: var(--text-soft);
    font-size: 1.04rem;
}

.dashboard-entry-block {
    margin-bottom: 14px;
}

.entry-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.entry-card {
    min-height: 116px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(245, 248, 253, 1));
}

.entry-card__icon {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.entry-icon {
    width: 26px;
    height: 26px;
}

.entry-card__icon--store {
    background: linear-gradient(180deg, rgba(47, 132, 235, 0.16), rgba(47, 132, 235, 0.08));
    color: #2f84eb;
}

.entry-card__icon--category {
    background: linear-gradient(180deg, rgba(201, 138, 31, 0.14), rgba(201, 138, 31, 0.08));
    color: #c98a1f;
}

.entry-card__icon--prices {
    background: linear-gradient(180deg, rgba(46, 154, 88, 0.16), rgba(46, 154, 88, 0.08));
    color: #2e9a58;
}

.entry-card__label {
    font-size: 1.08rem;
    font-weight: 800;
    line-height: 1.15;
}

.global-search {
    min-height: 66px;
    padding: 0 18px;
    display: grid;
    grid-template-columns: 26px 1fr;
    align-items: center;
    gap: 12px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(245, 248, 253, 1));
    box-shadow: var(--shadow-soft);
}

.global-search__icon {
    color: var(--text-soft);
}

.global-search input {
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
}

.global-search input::placeholder {
    color: var(--text-soft);
}

.attention,
.month-overview,
.recent-receipts,
.insights {
    padding: 18px;
    margin-bottom: 14px;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-link {
    color: var(--accent);
    font-weight: 800;
    white-space: nowrap;
}

.attention__list {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
}

.attention__item {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(245, 248, 253, 1));
}

.attention__item strong {
    display: block;
    margin-bottom: 3px;
    font-size: 1rem;
}

.attention__item p {
    margin: 0;
    color: var(--text-soft);
    font-size: 0.95rem;
}

.attention__dot {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
}

.attention__item.warning .attention__dot {
    background: var(--warning-soft);
    color: var(--warning);
}

.attention__item.danger .attention__dot {
    background: var(--danger-soft);
    color: var(--danger);
}

.primary-button {
    display: block;
    width: 100%;
    padding: 15px 18px;
    border-radius: 999px;
    background: linear-gradient(180deg, #f7e5be 0%, #f1d394 100%);
    color: #8c6217;
    text-align: center;
    font-weight: 800;
    font-size: 1.12rem;
    border: 1px solid rgba(201, 138, 31, 0.20);
    box-shadow: 0 10px 24px rgba(201, 138, 31, 0.10);
}

.month-hint {
    margin: -6px 0 14px;
    color: var(--text-soft);
    font-size: 0.92rem;
}

.month-switcher {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.month-nav {
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(245, 248, 253, 1));
    color: var(--text);
    font-size: 1.4rem;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
}

.month-overview__content {
    min-height: 184px;
}

.month-panel {
    display: grid;
    gap: 14px;
}

.month-total {
    font-size: 2.55rem;
    line-height: 1;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.month-delta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--success);
    font-weight: 800;
    font-size: 1.05rem;
}

.month-delta.is-neutral {
    color: var(--text-soft);
}

.month-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.month-stat {
    padding: 14px;
    border-radius: var(--radius-sm);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(245, 248, 253, 1));
    border: 1px solid var(--border);
}

.month-stat__label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-soft);
    font-size: 0.92rem;
}

.month-stat__value {
    font-size: 1.25rem;
    font-weight: 800;
}

.month-empty {
    min-height: 184px;
    display: grid;
    align-content: center;
    gap: 10px;
    padding: 18px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border-strong);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(245, 248, 253, 1));
    text-align: center;
}

.month-empty__icon {
    font-size: 2rem;
}

.month-empty h3 {
    margin: 0;
    font-size: 1.38rem;
}

.month-empty p {
    margin: 0;
    color: var(--text-soft);
}

.empty-link {
    display: inline-flex;
    justify-self: center;
    align-items: center;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 800;
}

.receipt-strip,
.insights-track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 82%;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px;
    scrollbar-width: none;
}

.receipt-strip::-webkit-scrollbar,
.insights-track::-webkit-scrollbar {
    display: none;
}

.receipt-card,
.insight-card {
    scroll-snap-align: start;
    border: 1px solid var(--border);
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(245, 248, 253, 1));
}

.receipt-card {
    padding: 15px;
    min-height: 122px;
    display: grid;
    gap: 16px;
}

.receipt-card__top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.receipt-card__top h3 {
    margin: 0 0 4px;
    font-size: 1.3rem;
}

.receipt-card__top p {
    margin: 0;
    color: var(--text-soft);
}

.receipt-card__top strong {
    font-size: 1.4rem;
    white-space: nowrap;
    letter-spacing: -0.02em;
}

.receipt-card__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 800;
    border: 1px solid transparent;
}

.status-badge.is-ok {
    background: var(--success-soft);
    color: var(--success);
    border-color: rgba(46, 154, 88, 0.10);
}

.status-badge.is-review {
    background: var(--warning-soft);
    color: var(--warning);
    border-color: rgba(201, 138, 31, 0.10);
}

.receipt-meta {
    color: var(--text-soft);
    font-size: 0.92rem;
}

.insight-card {
    min-height: 176px;
    padding: 16px;
}

.insight-card h3 {
    margin: 0 0 14px;
    font-size: 1.2rem;
}

.mini-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.mini-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 1rem;
}

.mini-list li span {
    color: var(--text-soft);
}

.mini-list li strong {
    color: var(--text);
    font-size: 1.05rem;
}

.insight-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 14px;
}

.insight-dots span {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(104, 117, 138, 0.22);
}

.insight-dots span.is-active {
    width: 20px;
    background: var(--accent);
    box-shadow: 0 0 14px var(--accent-glow);
}

@keyframes slideUpNav {
    from { transform: translateX(-50%) translateY(100%); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}


/*#######################################################################SKJULT MENY BOKS START !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!######################*/
/* Bottom navigation slide-up menu */
.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: -400px; /* Her gemmer vi skuffen */
    transform: translateX(-50%);
    animation: slideUpNav 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
    /* RETTET: Vi bruger 'bottom' her, og du kan styre hastigheden (f.eks. 0.8s) */
    transition: bottom 0.8s cubic-bezier(0.22, 1, 0.36, 1); 
    width: 100%;
    max-width: var(--max-width);
    min-height: var(--nav-height);
    padding: 10px 10px calc(12px + env(safe-area-inset-bottom, 0px));
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(228, 234, 245, 0.96));
    backdrop-filter: blur(22px) saturate(165%);
    -webkit-backdrop-filter: blur(22px) saturate(165%);
    border-top: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: var(--radius) var(--radius) 0 0;
    box-shadow:
        0 -12px 30px rgba(35, 56, 92, 0.12),
        0 -1px 0 rgba(255, 255, 255, 0.8) inset;
    display: flex;
    flex-direction: column;
    gap: 0;
    align-items: stretch;
    z-index: 30;
}

/* VORES NYE BOKS DER FYLDER HULLET */
.bottom-nav__panel {
    width: 100%;
    height: 400px; /*HER HIVER VI SKUFFEN OP */
    padding: 24px 10px;
    position: relative;
    z-index: 1;
    color: var(--text);
}

/*#######################################################################SKJULT MENY BOKS SLUT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!######################*/


html[data-theme="dark"] .bottom-nav {
    background:
        linear-gradient(180deg, rgba(8, 11, 18, 0.76), rgba(2, 4, 8, 0.98));
    border-top-color: rgba(111, 142, 194, 0.10);
    box-shadow:
        0 -18px 44px rgba(0, 0, 0, 0.46),
        0 1px 0 rgba(255, 255, 255, 0.03) inset,
        0 -1px 0 rgba(102, 163, 255, 0.08) inset;
}

/* Når "Mere" knappen klikkes, tilføjes is-expanded, som trækker bunden op! */
.bottom-nav.is-expanded {
    bottom: 0 !important; /* RETTET: Trækker skuffen op ved at ændre bottom i stedet for transform */
}

.bottom-nav__bar {
    display: grid;
    grid-template-columns: 1fr 1fr auto 1fr 1fr;
    align-items: end;
    gap: 4px;
    margin-top: auto;
    position: relative;
    z-index: 1;
}

.bottom-nav__item,
.bottom-nav__cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    min-height: 72px;
    border-radius: 22px;
    color: var(--text-soft);
    font-size: 0.74rem;
    letter-spacing: 0.01em;
    transition: transform 180ms ease, color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.bottom-nav__item {
    padding: 8px 6px 6px;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav__item span:last-child {
    font-weight: 700;
}

.bottom-nav__item.is-active span:last-child {
    font-weight: 800;
}

.bottom-nav__item:hover,
.bottom-nav__item:focus-visible {
    color: var(--text);
    background: rgba(255, 255, 255, 0.26);
    transform: translateY(-1px);
    outline: none;
}

html[data-theme="dark"] .bottom-nav__item:hover,
html[data-theme="dark"] .bottom-nav__item:focus-visible {
    background: rgba(255, 255, 255, 0.04);
}

.bottom-nav__item.is-active {
    color: var(--accent);
    font-weight: 800;
}

html[data-theme="dark"] .bottom-nav__item.is-active {
    color: var(--accent);
}

.bottom-nav__icon {
    width: 34px;
    height: 34px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-icon {
    width: 22px;
    height: 22px;
}

.bottom-nav__cta {
    min-height: auto;
    justify-content: center;
    justify-self: center;
    transform: translateY(-18px);
    color: var(--accent);
    font-weight: 800;
    gap: 0;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav__cta:hover,
.bottom-nav__cta:focus-visible {
    transform: translateY(-20px) scale(1.02);
    outline: none;
}

.bottom-nav__cta-ring {
    width: 78px;
    height: 78px;
    border-radius: 999px;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.38) 36%, rgba(47, 132, 235, 0.12) 100%),
        linear-gradient(180deg, #ffffff 0%, #eaf2fd 100%);
    border: 1px solid rgba(47, 132, 235, 0.18);
    box-shadow:
        0 0 0 8px rgba(238, 243, 251, 0.98),
        0 18px 34px rgba(47, 132, 235, 0.22),
        0 0 28px rgba(47, 132, 235, 0.12);
}

html[data-theme="dark"] .bottom-nav__cta-ring {
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.03) 34%, rgba(102, 163, 255, 0.16) 100%),
        linear-gradient(180deg, #111827 0%, #0d1420 100%);
    border-color: rgba(102, 163, 255, 0.22);
    box-shadow:
        0 0 0 8px rgba(2, 3, 6, 0.96),
        0 18px 42px rgba(0, 0, 0, 0.52),
        0 0 38px rgba(102, 163, 255, 0.18);
}

.bottom-nav__cta-inner {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0.2) 28%, rgba(47, 132, 235, 0.10) 100%),
        linear-gradient(180deg, #fafdff 0%, #dbe9fb 100%);
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.95),
        inset 0 -12px 18px rgba(47, 132, 235, 0.10),
        0 8px 18px rgba(47, 132, 235, 0.16);
}

html[data-theme="dark"] .bottom-nav__cta-inner {
    background:
        radial-gradient(circle at 30% 28%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02) 26%, rgba(102, 163, 255, 0.10) 100%),
        linear-gradient(180deg, #172033 0%, #111827 100%);
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.08),
        inset 0 -12px 20px rgba(102, 163, 255, 0.10),
        0 8px 20px rgba(0, 0, 0, 0.34);
}



.bottom-nav__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.20);
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
    z-index: 20;
}

.receipt-icon {
    width: 28px;
    height: 28px;
    color: var(--accent);
}

.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;
}

/* Installed PWA: fullscreen splash until body.pwa-boot-splash-done (includes/pwa_boot_splash.php + app.js). */
.pwa-boot-splash {
    display: none;
}

@media (display-mode: standalone) {
    .pwa-boot-splash {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 2147483646;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        overflow: hidden;
        background: #000000;
        align-items: stretch;
        justify-content: stretch;
    }

    .pwa-boot-splash img {
        width: 100%;
        height: 100%;
        max-width: none;
        object-fit: cover;
        object-position: center center;
        display: block;
    }
}

body.pwa-boot-splash-done .pwa-boot-splash {
    display: none !important;
    visibility: hidden;
    pointer-events: none;
}

/* Login page – topbar and login card same rounded design and width */
.login-page .topbar {
    margin: 14px 14px 0;
    padding: 18px 18px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.78) 0%, rgba(255, 255, 255, 0.98) 100%),
        var(--surface);
}

.login-page .topbar__content {
    justify-content: center;
}

.login-page .topbar__titles {
    text-align: center;
}

.login-page .page-content {
    padding: 24px 14px 38px;
}

.login-content {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 0;
}

.login-page .login-card {
    width: 100%;
    max-width: 100%;
    padding: 24px;
}

.login-card__title {
    margin: 0 0 8px;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.login-card__subtitle {
    margin: 0 0 20px;
    color: var(--text-soft);
    font-size: 1rem;
}

.login-error {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 0.95rem;
}

.login-form {
    display: grid;
    gap: 18px;
}

.form-group {
    display: grid;
    gap: 6px;
}

.form-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.form-input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-size: 1rem;
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-soft);
}

.login-submit {
    margin-top: 4px;
}

.login-card__back {
    margin: 20px 0 0;
    text-align: center;
}

.login-card__back a {
    color: var(--accent);
    font-weight: 700;
}

@media (max-width: 600px) {
    .app-shell {
        width: 98%;
        max-width: none;
    }
    .bottom-nav {
        width: 98%;
        max-width: none;
    }
    .page-content {
        padding-left: 0;
        padding-right: 0;
    }
    .topbar {
        margin-left: 0;
        margin-right: 0;
    }
    .login-page .topbar {
        margin-left: 14px;
        margin-right: 14px;
    }
    .login-page .page-content {
        padding-left: 14px;
        padding-right: 14px;
    }
}

@media (min-width: 768px) {
    .app-shell {
        width: 100%;
        max-width: 520px;
    }

    .bottom-nav {
        max-width: 520px;
    }

    .receipt-strip,
    .insights-track {
        grid-auto-columns: 68%;
    }
}

/* -----------------------------------------------------------------------------
   Admin area – desktop-only UX. Not mobile-first.
   Access is enforced server-side; this is layout/UX only.
   ----------------------------------------------------------------------------- */

.admin-body {
    background: var(--bg);
}

.admin-page .admin-desktop-required {
    display: none;
}

.admin-page .admin-shell {
    display: block;
}

@media (max-width: 1023px) {
    .admin-page .admin-desktop-required {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 100vh;
        padding: 24px;
        text-align: center;
        background: var(--bg-elevated);
    }

    .admin-page .admin-shell {
        display: none;
    }
}

@media (min-width: 1024px) {
    .admin-page .admin-desktop-required {
        display: none;
    }

    .admin-page .admin-shell {
        display: block;
    }
}

.admin-desktop-required__inner {
    max-width: 420px;
}

.admin-desktop-required__title {
    margin: 0 0 12px;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
}

.admin-desktop-required__text {
    margin: 0 0 20px;
    color: var(--text-soft);
    font-size: 1rem;
    line-height: 1.5;
}

.admin-desktop-required__back a {
    color: var(--accent);
    font-weight: 700;
}

.admin-shell {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    min-height: 100vh;
}

.admin-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    margin-bottom: 0;
}

.admin-header__content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.admin-header__titles {
    flex-shrink: 0;
}

.admin-header__title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.admin-header__subtitle {
    margin: 4px 0 0;
    font-size: 0.875rem;
    color: var(--text-soft);
}

.admin-header__nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-header__nav-link {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-soft);
}

.admin-header__nav-link:hover,
.admin-header__nav-link:focus-visible {
    color: var(--text);
    background: var(--surface-soft);
    outline: none;
}

.admin-header__nav-link.is-active {
    color: var(--accent);
    background: var(--accent-soft);
}

.admin-header__user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-soft);
}

.admin-main {
    padding: 24px;
    display: grid;
    gap: 24px;
}

.admin-welcome {
    padding: 22px 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 255, 1));
}

.admin-welcome .muted {
    margin: 10px 0 0;
    color: var(--text-soft);
    font-size: 1rem;
}

.admin-stats {
    display: grid;
    gap: 16px;
}

.admin-section-title {
    margin: 0 0 12px;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
}

.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.admin-stat-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.admin-stat-card__label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-stat-card__value {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
}

.admin-section {
    padding: 20px 24px;
}

.admin-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.admin-section-head .admin-section-title {
    margin: 0;
}

.admin-section-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-empty-state {
    padding: 32px 24px;
    text-align: center;
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    color: var(--text-soft);
    font-size: 0.95rem;
}

.admin-empty-state p {
    margin: 0;
}

/* Admin users table – list only; no horizontal scroll. Full details on user view page. */
.admin-users-table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    max-width: 100%;
    overflow-x: hidden;
}

.admin-users-list-hint {
    margin: 0 0 10px 0;
    font-size: 0.8125rem;
    color: var(--text-soft);
}

.admin-users-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    table-layout: fixed;
}

.admin-users-table__th {
    text-align: left;
    padding: 12px 10px;
    font-weight: 700;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: 0.7rem;
    background: var(--surface-soft);
    border-bottom: 2px solid var(--border-strong);
}

.admin-users-table__td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-users-table__row:hover {
    background: var(--surface-soft);
}

.admin-users-table__row:last-child .admin-users-table__td {
    border-bottom: none;
}

.admin-users-table__name {
    width: 22%;
}

.admin-users-table__email {
    width: 28%;
}

.admin-users-table__role {
    width: 12%;
}

.admin-users-table__status {
    width: 14%;
}

.admin-users-table__actions {
    width: 24%;
    text-align: right;
}

.admin-users-table__action-link {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border-radius: 10px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}

.admin-users-table__action-link:hover,
.admin-users-table__action-link:focus-visible {
    background: var(--accent);
    color: var(--surface);
}

/* Admin user detail view – structured sections, no inline styles */
.admin-view-dl {
    display: grid;
    gap: 12px;
    margin: 0;
}

.admin-view-dl__row {
    display: grid;
    gap: 4px;
}

.admin-view-dl__dt {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-soft);
    font-weight: 700;
}

.admin-view-dl__dd {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}

.admin-view-code {
    font-size: 0.85rem;
    font-family: ui-monospace, monospace;
}

.admin-view-hint {
    margin: 0 0 14px;
    color: var(--text-soft);
    font-size: 0.9rem;
    line-height: 1.4;
}

.admin-view-form-group {
    margin-bottom: 12px;
}

.admin-view-form-group:last-of-type {
    margin-bottom: 20px;
}

.admin-view-error {
    margin-bottom: 0;
}

.admin-view-error__text {
    margin: 0;
    color: var(--danger);
}

.admin-view-deleted-badge {
    margin: 10px 0 0;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--warning-soft);
    color: var(--warning);
    font-size: 0.9rem;
    font-weight: 700;
}

.admin-action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.admin-action-form {
    display: inline-block;
}

.admin-action-btn {
    padding: 8px 14px;
    width: auto;
    display: inline-block;
}

.admin-danger-zone {
    border-color: var(--danger);
    background: linear-gradient(180deg, var(--surface) 0%, var(--danger-soft) 100%);
}

.admin-danger-btn {
    padding: 8px 14px;
    width: auto;
    display: inline-block;
    background: linear-gradient(180deg, var(--danger) 0%, #c94a4a 100%);
    color: var(--surface);
    border-color: var(--danger);
}

.admin-danger-btn:hover,
.admin-danger-btn:focus-visible {
    background: var(--danger);
    color: var(--surface);
}

.admin-view-meta .admin-view-dl__dd {
    font-size: 0.9rem;
    color: var(--text-soft);
}

/* ----- Categories drill-down (page=categories) ----- */
.categories-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.02em;
}

.categories-breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.categories-breadcrumb a:hover,
.categories-breadcrumb a:focus-visible {
    text-decoration: underline;
}

.categories-breadcrumb__sep {
    color: var(--text-muted);
    font-weight: 400;
}

.topbar__subtitle {
    margin: 6px 0 0;
    color: var(--text-soft);
    font-size: 0.95rem;
}

.categories-intro {
    margin-bottom: 14px;
}

.categories-overview {
    padding: 18px;
}

.categories-main-list,
.categories-sub-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
}

.category-main-card,
.category-sub-card {
    display: block;
    padding: 16px 18px;
    text-align: left;
    border-radius: var(--radius-sm);
    background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(245, 248, 253, 1));
    border: 1px solid var(--border);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.category-main-card:hover,
.category-main-card:focus-visible,
.category-sub-card:hover,
.category-sub-card:focus-visible {
    border-color: var(--accent);
    box-shadow: var(--shadow-soft);
    outline: none;
}

.category-main-card__name,
.category-sub-card__name {
    display: block;
    font-weight: 800;
    font-size: 1.08rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.category-main-card__stats,
.category-sub-card__stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 8px;
    color: var(--text-soft);
    font-size: 0.92rem;
}

.categories-empty {
    margin: 0;
    padding: 14px 0;
}

.categories-review-hint {
    margin: 10px 0 0;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--warning-soft);
    color: var(--text);
    font-size: 0.95rem;
}

.categories-line-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.category-line-row {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 10px 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 0;
}

.category-line-row:last-child {
    border-bottom: none;
}

.category-line-row__main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-line-row__name {
    min-width: 0;
    font-size: 1rem;
    font-weight: 700;
}

.category-line-row__behavior {
    font-size: 0.9rem;
    color: var(--text-soft);
}

.category-line-row__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
}

.category-line-row__amount {
    font-size: 0.9rem;
    color: var(--text-soft);
    white-space: nowrap;
}

.category-line-row__meta .category-line-row__amount {
    font-weight: 600;
}

.category-line-row .status-badge {
    flex-shrink: 0;
}

/* -------------------------------------------------------------------------- */
/* Receipt upload dialog (home — matches entry cards & tokens)                */
/* -------------------------------------------------------------------------- */

#receiptUploadDialog.receipt-upload-dialog {
    width: calc(100vw - 28px);
    max-width: min(404px, var(--max-width));
    margin: auto;
    padding: 18px 18px 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow-x: hidden;
    color: var(--text);
}

#receiptUploadDialog.receipt-upload-dialog::backdrop {
    background: rgba(15, 23, 42, 0.42);
}

html[data-theme="dark"] #receiptUploadDialog.receipt-upload-dialog::backdrop {
    background: rgba(0, 0, 0, 0.62);
}

.receipt-upload-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.receipt-upload-dialog__title-block {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.receipt-upload-dialog__title {
    margin: 0;
    font-size: 1.42rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--text);
    flex: 1;
    min-width: 0;
}

/* Same-size circles: help (?) + close (×); close uses danger red */
#receiptUploadDialog .receipt-upload-dialog__header .icon-button {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--danger-soft);
    background: var(--danger-soft);
    color: var(--danger);
    box-shadow: none;
}

#receiptUploadDialog .receipt-upload-dialog__header .icon-button:hover,
#receiptUploadDialog .receipt-upload-dialog__header .icon-button:focus-visible {
    background: rgba(217, 90, 90, 0.22);
    border-color: var(--danger);
    color: var(--danger);
    outline: none;
}

html[data-theme="dark"] #receiptUploadDialog .receipt-upload-dialog__header .icon-button:hover,
html[data-theme="dark"] #receiptUploadDialog .receipt-upload-dialog__header .icon-button:focus-visible {
    background: rgba(255, 118, 118, 0.2);
    border-color: var(--danger);
}

#receiptUploadDialog .receipt-upload-dialog__header .icon-button .ui-icon {
    width: 18px;
    height: 18px;
}

#receiptUploadDialog .receipt-upload-dialog__help-btn.welcome-help-link {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    flex-shrink: 0;
    font-size: 1.05rem;
    font-weight: 800;
}

.receipt-upload-dialog__help-panel {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-soft);
}

.receipt-upload-dialog__help-panel-text {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.45;
}

.receipt-upload-dialog__help-panel-text strong {
    color: var(--text);
    font-weight: 800;
}

.receipt-upload-dialog__actions {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: stretch;
    gap: 12px;
    margin-top: 14px;
    width: 100%;
    max-width: 100%;
}

.receipt-upload-dialog__action {
    flex: 1;
    min-width: 0;
    max-width: 168px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 10px 12px;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(245, 248, 253, 1));
    box-shadow:
        var(--shadow-soft),
        0 5px 16px rgba(35, 56, 92, 0.1);
    -webkit-tap-highlight-color: transparent;
    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        border-color 160ms ease;
}

.receipt-upload-dialog__action--gem {
    /* In the gem-row we place the button in a 2-column grid and span both columns. */
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
}

.receipt-upload-dialog__actions--gem-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 168px));
    gap: 12px;
    justify-content: flex-start;
    align-items: stretch;
}

html[data-theme="dark"] .receipt-upload-dialog__action {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    box-shadow:
        var(--shadow-soft),
        0 6px 20px rgba(0, 0, 0, 0.32);
}

.receipt-upload-dialog__action:hover,
.receipt-upload-dialog__action:focus-visible {
    border-color: var(--accent-glow);
    box-shadow:
        0 12px 28px rgba(47, 132, 235, 0.14),
        0 6px 18px rgba(35, 56, 92, 0.08);
    transform: translateY(-1px);
    outline: none;
}

html[data-theme="dark"] .receipt-upload-dialog__action:hover,
html[data-theme="dark"] .receipt-upload-dialog__action:focus-visible {
    box-shadow:
        0 14px 32px rgba(0, 0, 0, 0.48),
        0 6px 20px rgba(0, 0, 0, 0.28);
}

.receipt-upload-dialog__action:active {
    transform: translateY(0);
}

.receipt-upload-dialog__action-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    color: var(--accent);
}

.receipt-upload-dialog__svg {
    width: 30px;
    height: 30px;
}

.receipt-upload-dialog__svg--sm {
    width: 24px;
    height: 24px;
}

.receipt-upload-dialog__action-label {
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-soft);
}

.receipt-upload-dialog__subtype {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    overflow-x: hidden;
}

.receipt-upload-dialog__subtype-eyebrow {
    text-align: left;
    margin-bottom: 4px;
}

.receipt-upload-dialog__subtype-lead {
    margin: 0 0 10px;
    font-size: 0.92rem;
    text-align: left;
    font-weight: 600;
}

.receipt-upload-dialog__subtype-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.receipt-upload-dialog__subtype-btn {
    flex: 1;
    min-width: 132px;
    max-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 12px 10px;
    cursor: pointer;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(245, 248, 253, 1));
    box-shadow:
        var(--shadow-soft),
        0 4px 14px rgba(35, 56, 92, 0.09);
    -webkit-tap-highlight-color: transparent;
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        box-shadow 160ms ease;
}

html[data-theme="dark"] .receipt-upload-dialog__subtype-btn {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
    box-shadow:
        var(--shadow-soft),
        0 5px 16px rgba(0, 0, 0, 0.28);
}

.receipt-upload-dialog__subtype-btn:hover,
.receipt-upload-dialog__subtype-btn:focus-visible {
    border-color: var(--accent-glow);
    outline: none;
    transform: translateY(-1px);
    box-shadow:
        0 12px 26px rgba(47, 132, 235, 0.12),
        0 5px 14px rgba(35, 56, 92, 0.07);
}

html[data-theme="dark"] .receipt-upload-dialog__subtype-btn:hover,
html[data-theme="dark"] .receipt-upload-dialog__subtype-btn:focus-visible {
    box-shadow:
        0 12px 28px rgba(0, 0, 0, 0.38),
        0 5px 16px rgba(0, 0, 0, 0.22);
}

.receipt-upload-dialog__subtype-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    color: var(--accent);
}

.receipt-upload-dialog__subtype-label {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}

.receipt-upload-dialog__subtype-hint {
    font-size: 0.78rem;
    font-weight: 600;
}

.receipt-upload-dialog__pool {
    margin-top: 12px;
}

.receipt-upload-dialog__pool-title {
    margin: 0 0 8px;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-soft);
}

.receipt-upload-dialog__fan {
    position: relative;
    min-height: 132px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    overflow: hidden;
}

.receipt-upload-dialog__fan-card {
    position: absolute;
    top: 12px;
    width: 84px;
    height: 108px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: linear-gradient(180deg, #fff, #f8fafc);
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.16);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

html[data-theme="dark"] .receipt-upload-dialog__fan-card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.04));
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.38);
}

.receipt-upload-dialog__fan-card:hover,
.receipt-upload-dialog__fan-card:focus-visible {
    border-color: var(--accent-glow);
    box-shadow: 0 12px 22px rgba(47, 132, 235, 0.2);
    outline: none;
}

.receipt-upload-dialog__fan-card--image {
    background: #fff;
}

.receipt-upload-dialog__fan-card-thumb {
    width: 100%;
    height: 74px;
    object-fit: cover;
    display: block;
}

.receipt-upload-dialog__fan-card-pdf {
    height: 74px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--accent);
    background: var(--surface-soft);
}

.receipt-upload-dialog__fan-card-name {
    margin: 0;
    padding: 8px 7px 6px;
    font-size: 0.68rem;
    line-height: 1.2;
    color: var(--text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.receipt-upload-dialog__mini-preview {
    margin-top: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-soft);
    padding: 8px;
}

.receipt-upload-dialog__mini-preview[hidden] {
    display: none;
}

.receipt-upload-dialog__mini-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.receipt-upload-dialog__mini-preview-title {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text);
}

#receiptUploadDialog .receipt-upload-dialog__mini-preview-close.icon-button {
    width: 30px;
    height: 30px;
    min-width: 30px;
    min-height: 30px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-soft);
}

.receipt-upload-dialog__mini-preview-body {
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #fff;
    min-height: 140px;
}

.receipt-upload-dialog__mini-preview-image {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    display: block;
    background: #fff;
}

.receipt-upload-dialog__mini-preview-pdf {
    width: 100%;
    height: 260px;
    border: 0;
    display: block;
    background: #fff;
}

.receipt-upload-dialog__status {
    margin-top: 10px;
    margin-bottom: 0;
    font-size: 0.88rem;
    line-height: 1.35;
    text-align: center;
}

.receipt-upload-dialog__status:empty {
    display: none;
}

/* -------------------------------------------------------------------------- */
/* Notifications dialog (home)                                                */
/* -------------------------------------------------------------------------- */

#notificationsDialog.notifications-dialog {
    width: calc(100vw - 24px);
    max-width: min(448px, calc(var(--max-width) + 12px));
    margin: auto;
    padding: 18px 18px 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow-x: hidden;
    color: var(--text);
}

#notificationsDialog.notifications-dialog::backdrop {
    background: rgba(15, 23, 42, 0.42);
}

html[data-theme="dark"] #notificationsDialog.notifications-dialog::backdrop {
    background: rgba(0, 0, 0, 0.62);
}

.notifications-dialog__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.notifications-dialog__title-wrap {
    min-width: 0;
    flex: 1;
}

.notifications-dialog__title {
    margin: 0;
    font-size: 1.55rem;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.notifications-dialog__subtitle {
    margin: 6px 0 0;
    color: var(--text-soft);
    font-size: 0.9rem;
}

.notifications-dialog__close.icon-button {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 999px;
}

.notifications-dialog__body {
    margin-top: 12px;
}

.notifications-settings {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0 12px;
}

.notifications-settings__text strong {
    display: block;
}

.notifications-settings__text .muted {
    margin-top: 4px;
    font-size: 0.9rem;
}

.notifications-switch {
    position: relative;
    display: inline-flex;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
}

.notifications-switch input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.notifications-switch__slider {
    width: 100%;
    height: 100%;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface-soft);
    box-shadow: var(--shadow-soft);
    transition: background 0.15s ease, border-color 0.15s ease;
    position: relative;
}

.notifications-switch__slider::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(2, 6, 23, 0.2);
    transition: transform 0.15s ease;
}

.notifications-switch input:checked + .notifications-switch__slider {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.notifications-switch input:checked + .notifications-switch__slider::after {
    transform: translateX(22px);
}

.notifications-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0 12px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.notifications-toolbar__counts {
    font-size: 0.9rem;
}

.notifications-list {
    display: grid;
    gap: 10px;
    padding-top: 12px;
}

.notifications-item {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(245, 248, 253, 1));
}

.notifications-item.is-unread {
    border-color: rgba(47, 132, 235, 0.4);
    box-shadow: 0 0 0 1px rgba(47, 132, 235, 0.12) inset;
}

.notifications-item__title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.notifications-item__meta {
    font-size: 0.82rem;
    white-space: nowrap;
}

.notifications-item__message {
    margin: 6px 0 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.notifications-item__delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
    border-radius: 999px;
    border: 1px solid var(--danger-soft);
    background: var(--danger-soft);
    color: var(--danger);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
}

.notifications-item__delete-btn:hover,
.notifications-item__delete-btn:focus-visible {
    border-color: var(--danger);
    background: rgba(217, 90, 90, 0.2);
    outline: none;
}

.notifications-item__title {
    padding-right: 28px;
}

.notifications-action-btn {
    margin-top: 10px;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid rgba(47, 132, 235, 0.25);
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 700;
    cursor: pointer;
}

.notifications-action-btn--secondary {
    margin-top: 0;
    background: var(--surface-soft);
    color: var(--text-soft);
    border-color: var(--border);
}

.notifications-action-btn:disabled {
    opacity: 0.55;
    cursor: default;
}