:root {
    --app-bg: #f7f6fb;
    --card-bg: #ffffff;
    --text-dark: #201f3a;
    --text-muted: #8d8ca3;
    --radius-lg: 22px;
    --radius-md: 16px;
    --shadow-card: 0 6px 20px rgba(60, 50, 110, 0.08);

    --purple: #7c6fee;
    --purple-bg: #ece8ff;
    --amber: #f2994a;
    --amber-bg: #fdefdd;
    --green: #23a26d;
    --green-bg: #e2f7ec;
    --pink: #ee6f9e;
    --pink-bg: #fde5ee;
    --blue: #4a90d9;
    --blue-bg: #e4f0fd;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: var(--app-bg);
    color: var(--text-dark);
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0I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MuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

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

.login-screen {
    max-width: 320px;
    margin: 20vh auto 0 auto;
    text-align: center;
}

.login-screen h1 {
    color: var(--text-dark);
}

.login-screen input {
    display: block;
    width: 100%;
    margin: 1rem 0;
    padding: 0.6rem 0.8rem;
    border: 1px solid #e2e0f0;
    border-radius: var(--radius-md);
    box-sizing: border-box;
}

.login-screen button {
    border: none;
    background: var(--purple);
    color: white;
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 92px;
}

.login-screen button:disabled {
    opacity: 0.75;
    cursor: default;
}

.login-error {
    color: #c0392b;
    margin-top: 1rem;
}

/* ---------- Page shell ---------- */

.page {
    max-width: 480px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 8rem 1.25rem;
    box-sizing: border-box;
}

.status-text {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 0;
}

/* ---------- Hero header ---------- */

.hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 0.75rem;
}

.greeting-eyebrow {
    margin: 0 0 0.15rem 0;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.hero-text h1 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-dark);
}

.icon-button {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--card-bg);
    box-shadow: var(--shadow-card);
    font-size: 1.1rem;
    cursor: pointer;
}

.search-input {
    flex: 1;
    max-width: 220px;
    border-radius: 999px;
    border: 1px solid #e2e0f0;
    padding: 0.5rem 1rem;
    box-sizing: border-box;
}

/* ---------- Stat cards ---------- */

.stat-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    flex: 1;
    border-radius: var(--radius-lg);
    padding: 0.9rem 0.6rem;
    text-align: center;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.stat-icon {
    font-size: 1.1rem;
    margin-bottom: 0.15rem;
}

.stat-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-dark);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.stat-purple { background: var(--purple-bg); }
.stat-amber { background: var(--amber-bg); }
.stat-green { background: var(--green-bg); }

/* ---------- Tabs + add panel ---------- */

.tab-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tabs {
    display: flex;
    gap: 1.25rem;
}

.tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 0 0 0.35rem 0;
    font-size: 1rem;
    color: var(--text-muted);
    cursor: pointer;
}

.tab-active {
    color: var(--text-dark);
    font-weight: 700;
    border-bottom-color: var(--purple);
}

.new-button {
    border: none;
    background: var(--card-bg);
    box-shadow: var(--shadow-card);
    color: var(--text-dark);
    font-weight: 600;
    border-radius: 999px;
    padding: 0.45rem 1rem;
    cursor: pointer;
}

.add-panel {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 1rem;
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.add-panel input, .add-panel select {
    border: 1px solid #e2e0f0;
    border-radius: var(--radius-md);
    padding: 0.55rem 0.75rem;
    box-sizing: border-box;
    font-size: 0.95rem;
    width: 100%;
}

.add-panel-row {
    display: flex;
    gap: 0.5rem;
}

.add-panel-row > * {
    flex: 1;
    min-width: 0;
}

.add-panel-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.mic-inline {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--purple-bg);
    font-size: 1.1rem;
    cursor: pointer;
}

.mic-inline.listening {
    background: #fde2e2;
    animation: pulse 1.2s infinite;
}

.add-button {
    flex: 1;
    border: none;
    background: var(--text-dark);
    color: white;
    font-weight: 600;
    border-radius: 999px;
    padding: 0.6rem 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.add-button:disabled {
    opacity: 0.4;
    cursor: default;
}

.add-button:disabled .spinner {
    opacity: 1;
}

.brain-dump-summary {
    background: var(--purple-bg);
    color: var(--purple);
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    padding: 0.6rem 0.9rem;
    margin: 0 0 1rem 0;
    animation: fadeInUp 0.25s ease;
}

.voice-error {
    color: #c0392b;
    font-size: 0.85rem;
    margin: 0;
}

/* ---------- Timeline ---------- */

.timeline {
    list-style: none;
    padding: 0;
    margin: 0;
}

.timeline-item {
    display: grid;
    grid-template-columns: 44px 24px minmax(0, 1fr);
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}

.timeline-time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-start;
    padding-top: 0.9rem;
    text-align: right;
}

.time-main {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-dark);
}

.time-ampm {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.time-icon {
    font-size: 1rem;
}

.timeline-marker {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 1rem;
    flex-shrink: 0;
}

.timeline-line {
    flex: 1;
    width: 2px;
    background: #e7e5f2;
    margin-top: 0.25rem;
}

.timeline-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 0.75rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.timeline-card-main {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.avatar {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.timeline-card-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.timeline-title {
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-title.done {
    text-decoration: line-through;
    color: var(--text-muted);
}

.timeline-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.check-circle {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #d8d6ea;
    background: none;
    color: transparent;
    cursor: pointer;
    font-size: 0.8rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.check-circle.checked {
    border-color: var(--green);
    background: var(--green);
    color: white;
}

.check-circle:disabled {
    cursor: default;
}

.check-circle .spinner {
    color: var(--purple);
}

.delete-link {
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.2rem;
}

.delete-link:hover {
    color: #c0392b;
}

/* ---------- Grocery list ---------- */

.grocery-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}

.grocery-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 0.75rem 0.9rem;
    margin-bottom: 0.6rem;
}

.grocery-name {
    flex: 1;
    font-weight: 600;
    color: var(--text-dark);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.grocery-name.done {
    text-decoration: line-through;
    color: var(--text-muted);
    font-weight: 400;
}

.grocery-quantity {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--app-bg);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    flex-shrink: 0;
}

.grocery-section-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 0.5rem 0.25rem;
}

/* Category colors, shared by timeline dots and avatars */
.cat-household { background: var(--purple-bg); color: var(--purple); }
.cat-kid { background: var(--pink-bg); color: var(--pink); }
.cat-business { background: var(--blue-bg); color: var(--blue); }
.cat-daycare { background: var(--amber-bg); color: var(--amber); }

.timeline-dot.cat-household { background: var(--purple); }
.timeline-dot.cat-kid { background: var(--pink); }
.timeline-dot.cat-business { background: var(--blue); }
.timeline-dot.cat-daycare { background: var(--amber); }

/* ---------- Floating voice button ---------- */

.fab {
    position: fixed;
    right: 1.5rem;
    bottom: 5.5rem;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 10px 24px rgba(124, 111, 238, 0.45);
    cursor: pointer;
    z-index: 10;
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    justify-content: center;
    gap: 3rem;
    background: var(--card-bg);
    box-shadow: 0 -4px 16px rgba(60, 50, 110, 0.08);
    padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom, 0px));
    z-index: 20;
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
}

.bottom-nav-link.active {
    color: var(--purple);
    font-weight: 600;
    background: var(--purple-bg);
}

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

.fab.listening {
    animation: pulse 1.2s infinite;
    background: linear-gradient(135deg, #e74c3c, #f2994a);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.5); }
    70% { box-shadow: 0 0 0 12px rgba(231, 76, 60, 0); }
    100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* ---------- Loading indicators ---------- */

.spinner {
    display: inline-block;
    width: 1em;
    height: 1em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    opacity: 0.9;
    flex-shrink: 0;
}

.spinner-lg {
    width: 28px;
    height: 28px;
    border-width: 3px;
    color: var(--purple);
}

.spinner-xs {
    width: 12px;
    height: 12px;
    border-width: 2px;
    color: var(--purple);
}

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

.status-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2.5rem 0;
    color: var(--text-muted);
}

.status-loading p {
    margin: 0;
}

/* ---------- List item enter/exit animation ---------- */

.timeline-item, .grocery-item {
    animation: fadeInUp 0.25s ease;
}

.timeline-item.item-removing, .grocery-item.item-removing {
    animation: fadeOutShrink 0.2s ease forwards;
    overflow: hidden;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutShrink {
    from {
        opacity: 1;
        max-height: 80px;
        margin-bottom: 0.9rem;
    }
    to {
        opacity: 0;
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
        transform: translateY(-4px) scale(0.98);
    }
}
