/* Small, standalone visual system for the rebuilt empty shell. */
:root {
    color-scheme: light;
    --page: #f7f8fc;
    --surface: #fff;
    --ink: #20243a;
    --muted: #7f879c;
    --line: #e8eaf2;
    --accent: #636bd1;
    --green: var(--accent);
    --danger: #dc3c3c;
    /* Compatibility alias for the existing shell. */
    --field-bg: #fff;
    --label: #454b61;
    --focus: #9299e4;
    --focus-ring: rgba(99, 107, 209, .22);
    --card-bg: rgba(255, 255, 255, .92);
    --header-bg: rgba(255, 255, 255, .84);
    --glow-one: #e9eaff;
    --glow-two: #f8e8ed;
    --shadow: 0 16px 44px rgba(38, 44, 74, .09);
    --radius: 20px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--page);
    font-synthesis: none;
    text-rendering: optimizeLegibility;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background: var(--page);
}

button,
input {
    font: inherit;
}

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

.app-shell {
    min-height: 100vh;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 60;
    height: 70px;
    padding: 0 max(24px, calc((100vw - 960px) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: var(--header-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 20px;
    font-weight: 820;
    letter-spacing: -.055em;
}

.brand-dot {
    color: #d6a46d;
}

.brand-mark {
    display: grid;
    width: 35px;
    height: 35px;
    place-items: center;
}

.brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 11px;
}

.icon-button {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    transition: transform .16s, border-color .16s, background .16s;
}

.icon-button:hover {
    transform: translateY(-1px);
    border-color: #c8cbea;
}

.icon-button svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sync-pill {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
}

.sync-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #64a77a;
    box-shadow: 0 0 0 3px rgba(100, 167, 122, .13);
}

.sync-pill.offline .sync-dot {
    background: #dc9a55;
}

.sync-pill.error .sync-dot {
    background: #c96357;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 6px;
}

.user-avatar {
    display: grid;
    width: 29px;
    height: 29px;
    place-items: center;
    border-radius: 50%;
    background: #e4e5ed;
    color: var(--green);
    font-size: 12px;
    font-weight: 800;
}

.user-name {
    max-width: 110px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 700;
}

.logout-form {
    display: flex;
}

.content-shell {
    width: min(960px, calc(100% - 48px));
    margin: 0 auto;
}

.welcome-row {
    position: relative;
    display: flex;
    min-height: 198px;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    padding: 35px 9px 27px;
}

.welcome-row h1 {
    margin: 10px 0;
    font-size: 42px;
    font-weight: 790;
    line-height: 1.06;
    letter-spacing: -.06em;
}

.welcome-row h1 span {
    color: var(--green);
}

.welcome-subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.welcome-art {
    position: relative;
    width: 200px;
    height: 140px;
    margin-right: 40px;
    flex-shrink: 0;
}

.art-circle {
    position: absolute;
    border-radius: 50%;
}

.art-circle-one {
    top: 0;
    left: 30px;
    width: 130px;
    height: 130px;
    background: rgba(114, 121, 196, .16);
}

.art-circle-two {
    right: 0;
    bottom: 4px;
    width: 68px;
    height: 68px;
    background: rgba(235, 162, 104, .24);
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    align-items: start;
    padding-bottom: 40px;
}

.panel {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.list-panel {
    min-width: 0;
    width: 100%;
    max-width: 960px;
    margin-inline: auto;
    padding: 22px 22px 22px;
}

.panel-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 0 15px;
}

.panel-heading-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 100%;
    margin-left: auto;
}

.panel-heading h2 {
    margin: 0;
    font-size: 17px;
    letter-spacing: -.025em;
}

.panel-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 12px;
}

[data-shopping-list] {
    --simple-view-accent: #37885c;
    --group-view-accent: #c36548;
}

.list-view-tabs {
    --view-accent: var(--simple-view-accent);

    position: relative;
    display: flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    gap: 3px;
    margin: 0 0 14px auto;
    padding: 4px;
    border: 1px solid color-mix(in srgb, var(--view-accent) 20%, var(--line));
    border-radius: 12px;
    background: color-mix(in srgb, var(--view-accent) 7%, var(--page));
    box-shadow: inset 0 1px 2px rgba(32, 36, 58, .04);
}

.list-view-tabs[data-active-view="group"] {
    --view-accent: var(--group-view-accent);
}

.list-view-tabs[data-active-view="aisle"] {
    --view-accent: #287d83;
}

.list-view-indicator {
    position: absolute;
    z-index: 0;
    border-radius: 9px;
    background: color-mix(in srgb, var(--view-accent) 12%, var(--surface));
    pointer-events: none;
    transition: left .28s cubic-bezier(.2, .8, .2, 1), top .2s ease, width .2s ease, height .2s ease, background-color .2s ease;
}

html:not([data-theme="dark"]) .list-view-indicator {
    border: 1px solid color-mix(in srgb, var(--view-accent) 40%, var(--line));
    background: color-mix(in srgb, var(--view-accent) 25%, var(--surface));
    box-shadow: 0 1px 3px color-mix(in srgb, var(--view-accent) 18%, transparent);
}

.list-view-tab {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 78px;
    min-height: 36px;
    padding: 7px 12px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    cursor: pointer;
    transition: color .18s ease;
}

.list-view-tab svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.list-view-tab.is-active {
    color: var(--view-accent);
}

.list-view-tab:not(.is-active):hover {
    color: var(--ink);
}

.list-view-tab:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--view-accent) 55%, transparent);
    outline-offset: 2px;
}

.list-view-tab.is-active svg {
    animation: list-view-pop .28s cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes list-view-pop {
    0% {
        transform: scale(.82) rotate(-5deg);
    }

    68% {
        transform: scale(1.13);
    }

    100% {
        transform: scale(1) rotate(0);
    }
}

@media (max-width: 540px) {
    .list-view-tabs {
        gap: 2px;
        padding: 3px;
    }

    .list-view-tab {
        min-width: 0;
        min-height: 36px;
        padding-inline: 8px;
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {

    .list-view-indicator,
    .list-view-tab,
    .list-view-tab.is-active svg {
        animation: none;
        transition: none;
    }
}

.empty-shell-panel {
    grid-column: 1 / -1;
    min-height: 360px;
}

.empty-shell-content {
    display: grid;
    min-height: 280px;
    place-items: center;
}

.empty-shell-state {
    display: grid;
    width: 100%;
    justify-items: center;
    align-content: center;
    text-align: center;
}

.empty-shell-state p {
    margin-bottom: 0;
}

.empty-illustration svg {
    width: 80px;
    height: 80px;
    fill: none;
    stroke: #aeb3c9;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.theme-toggle.spin-once {
    animation: spin-once .42s ease;
}

@keyframes spin-once {
    to {
        transform: rotate(180deg);
    }
}

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 28px;
    background: radial-gradient(ellipse at 18% 10%, var(--glow-one) 0, transparent 42%), radial-gradient(ellipse at 88% 92%, var(--glow-two) 0, transparent 38%), var(--page);
}

.auth-shell {
    position: relative;
    width: min(100%, 440px);
}

.brand-auth {
    display: flex;
    justify-content: center;
    margin: 0 auto 22px;
}

.auth-theme-toggle {
    position: absolute;
    top: 0;
    right: 0;
}

.auth-card {
    padding: 34px;
    border-radius: 24px;
    background: var(--card-bg);
}

.auth-card h1 {
    margin: 10px 0 8px;
    font-size: clamp(30px, 6vw, 40px);
    line-height: 1.08;
    letter-spacing: -.05em;
}

.auth-card>.muted {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.eyebrow {
    color: #8b9990;
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .16em;
}

.stack-form {
    display: grid;
    gap: 10px;
}

.stack-form label {
    color: var(--label);
    font-size: 12px;
    font-weight: 700;
}

.stack-form input:not([type="checkbox"]) {
    width: 100%;
    min-height: 46px;
    padding: 11px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--field-bg);
    color: var(--ink);
}

.stack-form input:focus {
    border-color: var(--focus);
}

.remember-device {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.remember-device input {
    accent-color: var(--green);
}

.remember-device-help {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 42px;
    padding: 10px 15px;
    border: 1px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.button-soft {
    gap: 7px;
    min-height: 36px;
    padding: 7px 10px;
    border-color: var(--line);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 74%, var(--page));
    color: var(--ink);
    font-size: 12px;
}

.button-soft svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.button-soft:hover {
    border-color: color-mix(in srgb, var(--green) 26%, var(--line));
    background: color-mix(in srgb, var(--green) 8%, var(--surface));
    color: var(--green);
}

.button-soft:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.button-primary {
    background: var(--green);
    color: #fff;
    box-shadow: 0 8px 18px rgba(99, 107, 209, .22);
}

.button-primary:hover {
    filter: brightness(1.04);
}

.button-wide {
    width: 100%;
}

.notice {
    margin: 12px 0;
    padding: 11px 12px;
    border: 1px solid;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.45;
}

.notice-error {
    border-color: #f3d7d2;
    background: #fff0ee;
    color: #a8443a;
}

.notice-success {
    border-color: #d9eadb;
    background: #edf7ee;
    color: #366a44;
}

code {
    padding: 2px 5px;
    border-radius: 5px;
    background: #f0f1f6;
}

html[data-theme="dark"] {
    --page: #11131b;
    --surface: #1a1d28;
    --ink: #eff0f6;
    --muted: #a1a6b7;
    --line: #303342;
    --danger: #e55353;
    --field-bg: #11131b;
    --label: #d9dbea;
    --card-bg: rgba(26, 29, 40, .94);
    --header-bg: rgba(26, 29, 40, .86);
    --glow-one: #252844;
    --glow-two: #32232d;
    --shadow: 0 16px 44px rgba(0, 0, 0, .22);
    color-scheme: dark;
}

html[data-theme="dark"] code {
    background: #2a2d3a;
}

html[data-theme="dark"] .art-circle-one {
    background: rgba(124, 134, 228, .15);
}

html[data-theme="dark"] .art-circle-two {
    background: rgba(237, 158, 96, .18);
}

/* Shared primitives: future screens should reuse these before adding variants. */
:where(button, a, input):focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    box-shadow: 0 0 0 5px var(--focus-ring);
}

.form-field {
    display: grid;
    gap: 7px;
}

.field-hint {
    margin: 0;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
}

.muted {
    color: var(--muted);
    line-height: 1.5;
}

.auth-footer {
    margin: 20px 0 0;
    text-align: center;
    color: var(--muted);
    font-size: 12px;
}

.empty-state {
    display: grid;
    min-height: 280px;
    justify-items: center;
    align-content: center;
    padding: 28px 12px;
    text-align: center;
}

.empty-state h3 {
    margin: 14px 0 0;
    font-size: 19px;
}

.empty-state p {
    margin: 8px 0 0;
    font-size: 13px;
}

.empty-illustration {
    display: grid;
    width: 152px;
    height: 122px;
    place-items: center;
    border-radius: 26px;
    background: color-mix(in srgb, var(--green-soft) 54%, var(--surface));
}

.empty-illustration img {
    display: block;
    width: 142px;
    height: 110px;
    object-fit: contain;
}

.content-shell {
    padding-bottom: 40px;
}

@media(max-width:720px) {
    .topbar {
        height: 62px;
        padding: 0 14px;
    }

    .brand {
        gap: 8px;
        font-size: 18px;
    }

    .brand-mark {
        width: 32px;
        height: 32px;
    }

    .topbar-right {
        gap: 5px;
    }

    .sync-pill {
        padding: 7px;
    }

    .sync-pill #sync-label {
        display: none;
    }

    .user-chip {
        gap: 5px;
        padding-left: 2px;
    }

    .user-name {
        max-width: 84px;
        font-size: 13px;
        font-weight: 650;
    }

    .icon-button {
        width: 38px;
        height: 38px;
        position: relative;
    }

    .icon-button::before {
        position: absolute;
        inset: -4px;
        content: "";
    }

    .content-shell {
        width: 100%;
    }

    .welcome-row {
        min-height: 150px;
        padding: 22px 18px;
    }

    .welcome-row h1 {
        font-size: 34px;
    }

    .welcome-art {
        width: 145px;
        height: 118px;
        margin-right: 0;
        transform: scale(.85);
        transform-origin: right center;
    }

    .list-panel {
        padding: 18px 15px 18px;
        border-inline: 0;
        border-radius: 0;
    }

    .auth-page {
        padding: 18px;
    }

    .auth-card {
        padding: 27px 22px;
    }
}

@media(prefers-reduced-motion:reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}