:root {
    color-scheme: light dark;
    --bg: #f5f1ea;
    --surface: rgba(255, 255, 255, 0.82);
    --surface-strong: #ffffff;
    --text: #1f2320;
    --muted: #66706a;
    --accent: #1d6b52;
    --accent-soft: #dceddf;
    --border: rgba(31, 35, 32, 0.09);
    --danger: #a03f34;
    --shadow: 0 16px 40px rgba(31, 35, 32, 0.08);
    --radius: 24px;
}

:root[data-theme='dark'] {
    --bg: #101412;
    --surface: rgba(24, 30, 27, 0.92);
    --surface-strong: #1b211e;
    --text: #edf2ee;
    --muted: #a2afa8;
    --accent: #6fc8a0;
    --accent-soft: rgba(111, 200, 160, 0.18);
    --border: rgba(237, 242, 238, 0.08);
    --danger: #f28d81;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

html, body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at top right, rgba(111, 200, 160, 0.15), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.3), transparent 45%),
        var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

* {
    box-sizing: border-box;
}

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

button, input, textarea, select {
    font: inherit;
}

#app {
    min-height: 100vh;
}

#blazor-error-ui {
    display: none;
}

#blazor-error-ui,
#blazor-error-ui.show {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 2000;
    max-width: 72rem;
    margin: 0 auto;
    padding: 1rem 1.25rem;
    background: rgba(160, 63, 52, 0.96);
    color: #fff;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}

#blazor-error-ui.show {
    display: block;
}

#blazor-error-ui .reload {
    color: inherit;
    font-weight: 700;
    text-decoration: underline;
    margin-left: 0.5rem;
}

.shell {
    padding:
        calc(1rem + env(safe-area-inset-top, 0px))
        1rem
        calc(6rem + env(safe-area-inset-bottom, 0px));
    max-width: 960px;
    margin: 0 auto;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 0;
}

.install-btn,
.install-hint {
    align-self: start;
}

.install-hint {
    display: grid;
    gap: 0.2rem;
    max-width: 16rem;
    padding: 0.85rem 1rem;
    border-radius: 20px;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    color: var(--text);
}

.install-hint span {
    font-size: 0.82rem;
    color: var(--muted);
}

.install-guide-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1450;
    background: rgba(10, 15, 13, 0.56);
    backdrop-filter: blur(10px);
    display: grid;
    place-items: center;
    padding: 1rem;
}

.install-guide {
    width: min(100%, 34rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.24);
    padding: 1.15rem;
    display: grid;
    gap: 1rem;
}

.install-guide-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 0.75rem;
}

.install-guide-head h3 {
    margin: 0.15rem 0 0;
}

.install-guide-steps {
    margin: 0;
    padding-left: 1.2rem;
    display: grid;
    gap: 0.7rem;
    color: var(--text);
}

.install-guide-steps li {
    padding-left: 0.15rem;
    line-height: 1.45;
}

.install-guide-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.eyebrow {
    margin: 0;
    color: var(--accent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.content {
    display: grid;
    gap: 1rem;
}

.card {
    background: var(--surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem;
    box-shadow: var(--shadow);
}

.hero h2,
.card h2,
.card h3 {
    margin: 0 0 0.5rem;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
}

.section-head h3 {
    margin: 0;
}

.muted,
.status,
.action-card span,
.list-link span,
.favorite-card span {
    color: var(--muted);
}

.action-grid,
.stack {
    display: grid;
    gap: 0.85rem;
}

.action-card,
.favorite-card,
.list-link {
    display: grid;
    gap: 0.3rem;
    padding: 1rem;
    border-radius: 20px;
    background: var(--surface-strong);
    border: 1px solid var(--border);
}

.cta-card {
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.9rem;
    min-height: 104px;
    padding: 1rem 1.05rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.cta-card:hover,
.cta-card:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(111, 200, 160, 0.34);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.08);
}

.cta-message {
    background:
        linear-gradient(135deg, rgba(111, 200, 160, 0.18), transparent 55%),
        var(--surface-strong);
}

.cta-occasion {
    background:
        linear-gradient(135deg, rgba(249, 196, 117, 0.16), transparent 55%),
        var(--surface-strong);
}

.cta-favorites {
    background:
        linear-gradient(135deg, rgba(125, 165, 255, 0.16), transparent 55%),
        var(--surface-strong);
}

.cta-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(31, 35, 32, 0.08);
    color: var(--text);
    font-size: 1.1rem;
}

.cta-copy {
    display: grid;
    gap: 0.28rem;
}

.cta-copy strong {
    font-size: 1.03rem;
    line-height: 1.2;
}

.cta-copy span {
    line-height: 1.35;
}

.cta-arrow {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.9rem;
}

.favorite-open {
    display: grid;
    gap: 0.3rem;
    text-align: left;
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
    cursor: pointer;
}

.big-input,
textarea,
input,
select,
.title-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 0.95rem 1rem;
    background: var(--surface-strong);
    color: var(--text);
}

.big-input {
    min-height: 160px;
    resize: vertical;
}

.title-input {
    font-size: 1.4rem;
    font-weight: 700;
    padding-left: 0;
    border: none;
    background: transparent;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
    border: none;
    border-radius: 999px;
    padding: 0.9rem 1.15rem;
    min-height: 48px;
    cursor: pointer;
}

.primary-btn {
    background: var(--accent);
    color: white;
}

.secondary-btn {
    background: var(--accent-soft);
    color: var(--text);
}

.ghost-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
}

.ghost-btn.danger {
    color: var(--danger);
}

button:disabled {
    opacity: 0.52;
    cursor: not-allowed;
    box-shadow: none;
}

.compact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.icon,
.nav-icon {
    font-size: 0.92rem;
    line-height: 1;
    opacity: 0.92;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.full-width {
    grid-column: 1 / -1;
}

.chip-grid {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.chip {
    border-radius: 999px;
    padding: 0.7rem 0.95rem;
    border: 1px solid var(--border);
    background: var(--surface-strong);
    color: var(--text);
}

.chip.selected {
    background: var(--accent-soft);
    border-color: transparent;
}

.list-item {
    display: grid;
    gap: 0.85rem;
    padding: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface-strong);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.list-item.checked {
    opacity: 0.65;
}

.list-item.checked .list-item-summary strong,
.list-item.checked .list-item-summary span {
    text-decoration: line-through;
    text-decoration-thickness: 1.5px;
}

.list-item.actions-visible {
    border-color: rgba(111, 200, 160, 0.4);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.08);
}

.list-item-main {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

.list-item-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 1.7rem;
    height: 1.7rem;
    margin: 0;
    border-radius: 50%;
    border: 1.5px solid rgba(111, 200, 160, 0.45);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
    display: inline-grid;
    place-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}

.list-item-checkbox:hover {
    transform: scale(1.04);
}

.list-item-checkbox:checked {
    border-color: transparent;
    background-color: var(--accent);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M4.5 10.5 8 14l7.5-8' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-position: center;
    background-repeat: no-repeat;
    background-size: 0.95rem;
}

.list-item-summary {
    display: grid;
    gap: 0.2rem;
    text-align: left;
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
}

.list-item-summary strong {
    font-size: 1rem;
    line-height: 1.25;
}

.list-item-summary span {
    color: var(--muted);
    font-size: 0.88rem;
}

.list-item-more {
    min-height: 40px;
    padding: 0.65rem 0.9rem;
}

.list-item-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.list-item-actions .compact-btn {
    flex: 1 1 9rem;
}

.list-item-actions .ghost-btn {
    min-height: 40px;
    padding: 0.65rem 0.9rem;
}

.item-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1400;
    background: rgba(10, 15, 13, 0.5);
    backdrop-filter: blur(10px);
    display: grid;
    place-items: center;
    padding: 1rem;
}

.item-modal {
    width: min(100%, 36rem);
    margin: 0 auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px 28px 20px 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
    padding: 1rem;
    display: grid;
    gap: 1rem;
}

.item-modal-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 0.75rem;
}

.item-modal-head h3 {
    margin: 0.15rem 0 0;
}

.item-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.item-modal-grid label {
    display: grid;
    gap: 0.35rem;
}

.item-modal-grid span {
    color: var(--muted);
    font-size: 0.8rem;
}

.item-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.list-card {
    display: grid;
    gap: 1rem;
}

.list-header {
    display: grid;
    gap: 0.35rem;
}

.list-stack {
    gap: 0.7rem;
}

.list-actions {
    position: sticky;
    bottom: 5rem;
    padding-top: 0.35rem;
    background: linear-gradient(180deg, transparent, var(--surface) 24%);
}

.bottom-nav {
    position: fixed;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: min(92vw, 760px);
    background: rgba(18, 24, 21, 0.88);
    color: white;
    border-radius: 999px;
    padding: 0.55rem;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.35rem;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}

.bottom-nav a {
    display: grid;
    gap: 0.18rem;
    padding: 0.85rem 0.6rem;
    border-radius: 999px;
    text-align: center;
    font-size: 0.8rem;
}

.bottom-nav a.active {
    background: rgba(255, 255, 255, 0.14);
}

.bottom-nav .nav-icon {
    font-size: 0.88rem;
}

.preview-row {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.list-tools {
    display: grid;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
}

.list-search {
    width: 100%;
}

.list-count {
    margin: 0;
}

.status {
    margin-top: 0.75rem;
}

.loading-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 15, 13, 0.42);
    backdrop-filter: blur(8px);
    display: grid;
    place-items: center;
    z-index: 1200;
    padding: 1.25rem;
}

.loading-modal {
    width: min(92vw, 360px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    display: grid;
    gap: 0.75rem;
    justify-items: center;
    text-align: center;
}

.spinner {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 4px solid var(--accent-soft);
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 740px) {
    .form-grid,
    .item-modal-grid {
        grid-template-columns: 1fr;
    }

    .topbar {
        align-items: stretch;
    }

    .install-hint {
        max-width: none;
    }

    .install-guide {
        width: 100%;
        max-width: 32rem;
        padding: 1rem;
    }

    .install-guide-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .cta-card {
        grid-template-columns: auto 1fr auto;
        min-height: 92px;
        padding: 0.95rem;
    }

    .cta-icon {
        width: 2.75rem;
        height: 2.75rem;
        border-radius: 16px;
    }

    .cta-copy strong {
        font-size: 0.98rem;
    }

    .cta-copy span {
        font-size: 0.88rem;
    }

    .list-item-main {
        grid-template-columns: auto 1fr;
        gap: 0.9rem;
        align-items: start;
    }

    .list-item-more {
        grid-column: 1 / -1;
        justify-self: start;
        min-width: 42px;
        min-height: 42px;
        padding: 0.7rem 0.9rem;
    }

    .list-item-more span {
        display: none;
    }

    .list-item-checkbox {
        width: 1.95rem;
        height: 1.95rem;
        margin-top: 0.15rem;
    }

    .list-item-summary strong {
        font-size: 1.02rem;
    }

    .list-item-summary span {
        font-size: 0.92rem;
        line-height: 1.35;
    }

    .list-item-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .list-item-actions .compact-btn {
        width: 100%;
    }

    .list-item-actions .danger {
        grid-column: 1 / -1;
    }

    .compact-btn span:last-child {
        font-size: 0.88rem;
    }

    .item-modal-backdrop {
        padding: 0.75rem;
    }

    .item-modal {
        width: 100%;
        max-width: 32rem;
        border-radius: 28px;
        padding: 1rem 1rem 1.15rem;
    }

    .item-modal-head {
        align-items: center;
    }

    .list-actions {
        position: static;
        bottom: auto;
        padding-top: 0;
        background: none;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .list-actions .compact-btn {
        width: 100%;
    }

    .list-actions .danger {
        grid-column: 1 / -1;
    }

    .bottom-nav {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        font-size: 0.78rem;
    }
}
