*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ──────────────────────────────────────────────── */
:root {
    color-scheme: dark;
    --bg: #141A22;
    --panel: rgba(26,38,54,0.82);
    --panel-alt: rgba(36,50,68,0.90);
    --border: rgba(255,255,255,0.10);
    --accent: #488CC8;
    --accent-soft: rgba(72,140,200,0.15);
    --accent-light: #60A4E0;
    --text: rgba(235,244,255,0.92);
    --text-muted: rgba(235,244,255,0.50);
    --bg-hover: rgba(72,140,200,0.12);
    --input-bg: rgba(255,255,255,0.08);
    --shadow: 0 2px 12px rgba(0,0,0,0.30);
    --shadow-hover: 0 8px 28px rgba(0,0,0,0.40);
}

/* ── Base ───────────────────────────────────────────────────────── */
body {
    font-family: 'Inter', system-ui, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.5;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 15% 85%, rgba(72,140,200,0.20) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 10%, rgba(0,0,0,0.65) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(72,140,200,0.09) 0%, transparent 45%),
        #141A22;
    background-attachment: fixed;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* ── Gradient noise ────────────────────────────────────────────── */
.gradient-noise {
    position: fixed;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cpath fill='%23ffffff0d' d='M0 0h20v20H0z'/%3E%3C/svg%3E");
    opacity: 0.6;
    pointer-events: none;
    z-index: 0;
}

/* ── Site header ───────────────────────────────────────────────── */
.site-header {
    background: rgba(20,26,34,0.94);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    padding: 0 1.5rem;
}

.site-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.site-logo:hover {
    color: var(--accent-light);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ── User menu ─────────────────────────────────────────────────── */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    background: none;
    border: 1px solid transparent;
    border-radius: 50%;
    padding: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.user-menu-trigger:hover {
    background: var(--bg-hover);
}

.user-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.5);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: all 0.2s;
    z-index: 200;
}

.user-menu.open .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s;
    cursor: pointer;
}

.user-menu-item:hover {
    background: var(--bg-hover);
}

/* ── Main content (desktop area) ──────────────────────────────── */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    padding-bottom: 120px;
    position: relative;
    z-index: 1;
    min-height: calc(100vh - 60px);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Desktop overlay + floating panel ─────────────────────────── */
.desktop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 50;
    animation: fadeIn 0.2s ease;
}

.desktop-panel {
    position: relative;
    z-index: 51;
    width: 100%;
    max-width: 560px;
    max-height: 70vh;
    background: var(--panel-alt);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: panelSlideUp 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes panelSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.panel-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

.panel-title .ph {
    font-size: 1.4rem;
}
.panel-title .ph-checks       { color: #B06474; }
.panel-title .ph-calendar     { color: #8066A8; }
.panel-title .ph-shopping-bag { color: #489CB0; }

.panel-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.panel-close:hover {
    background: var(--bg-hover);
    color: var(--text);
}

.panel-content {
    overflow-y: auto;
    flex: 1;
}

/* ── List tabs ─────────────────────────────────────────────────── */
.list-tabs {
    display: flex;
    gap: 2px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.list-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}
.list-tab:hover { background: var(--bg-hover); color: var(--text); }
.list-tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.list-tab-count {
    font-size: 0.7rem;
    background: rgba(255,255,255,0.08);
    padding: 1px 6px;
    border-radius: 8px;
    min-width: 18px;
    text-align: center;
}
.list-tab.active .list-tab-count { background: rgba(255,255,255,0.12); }

/* ── Status badge ─────────────────────────────────────────────── */
.status-tag {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.status-tag.pending    { background: rgba(255,255,255,0.08); color: var(--text-muted); }
.status-tag.in-progress { background: rgba(66,165,245,0.15); color: #64b5f6; }
.status-tag.running    { background: rgba(66,165,245,0.15); color: #64b5f6; }
.status-tag.done       { background: rgba(56,142,60,0.15); color: #81c784; }
.status-tag.failed     { background: rgba(229,57,53,0.15); color: #ff6b6b; }

/* ── Item description ─────────────────────────────────────────── */
.item-description {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 2px;
}

/* ── Item list ─────────────────────────────────────────────────── */
.item-list { list-style: none; }

.item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 11px 22px;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.item:last-child { border-bottom: none; }
.item:hover { background: var(--bg-hover); }
.item.completed .item-title { text-decoration: line-through; color: var(--text-muted); }

.item-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.item-title {
    font-size: 0.9rem;
    color: var(--text);
}

.item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.item-location {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.item-qty {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    padding: 1px 6px;
    border-radius: 4px;
}

/* ── Urgency tags ──────────────────────────────────────────────── */
.urgency-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 5px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.urgency-tag.critical { background: rgba(229,57,53,0.15); color: #ff6b6b; }
.urgency-tag.high     { background: rgba(255,152,0,0.15); color: #ffb74d; }
.urgency-tag.medium   { background: var(--accent-soft); color: var(--accent); }
.urgency-tag.low      { background: rgba(56,142,60,0.15); color: #81c784; }

/* ── Shopping ──────────────────────────────────────────────────── */
.shopping-list {
    padding: 14px 22px;
    border-bottom: 1px solid var(--border);
}

.shopping-list:last-child { border-bottom: none; }

.list-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.store-name {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.shopping-list .item-list { margin-left: 4px; }

.shopping-list .item {
    padding: 5px 8px;
    border-radius: 6px;
    border-bottom: none;
    margin-bottom: 1px;
}

/* ── Empty state ───────────────────────────────────────────────── */
.empty-state {
    padding: 52px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
}

/* ── Dock bar (bottom of screen) ──────────────────────────────── */
.dock-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    padding: 0 16px 12px;
    z-index: 90;
    pointer-events: none;
}

.dock {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(45, 45, 45, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.4),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}

.dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
}

.dock-active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
}

.dock-icon-wrap {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.dock-icon {
    width: 100%;
    height: 100%;
    border-radius: 11px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.dock-icon-fallback {
    width: 100%;
    height: 100%;
    border-radius: 11px;
    background: var(--accent);
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.dock-sprite {
    width: 100%;
    height: 100%;
    border-radius: 11px;
    background-image: url('/app-sprite.svg');
    background-size: auto 100%;
    background-repeat: no-repeat;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.dock-icon-app {
    width: 100%;
    height: 100%;
    border-radius: 11px;
    color: #fff;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.dock-badge {
    position: absolute;
    top: -4px;
    right: -2px;
    background: #EF4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 5;
}

.dock-label {
    font-size: 0.65rem;
    font-weight: 500;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 64px;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}

.dock-item:hover .dock-label {
    opacity: 1;
    transform: translateY(0);
}

.dock-separator {
    width: 1px;
    height: 48px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 4px;
    align-self: center;
    flex-shrink: 0;
}

.dock-item-wrapper {
    position: relative;
    display: inline-flex;
}

.remove-form {
    position: absolute;
    top: -2px;
    right: -2px;
    z-index: 10;
}

.remove-btn {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.2s;
}

.dock-item-wrapper:hover .remove-btn { display: flex; }
.remove-btn:hover { background: #B91C1C; }

/* ── Auth ───────────────────────────────────────────────────────── */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 60px);
    padding: 2rem;
}

.auth-card {
    background: var(--panel);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 44px 48px;
    width: 400px;
    box-shadow: 0 16px 56px rgba(0,0,0,0.28);
    border: 1px solid var(--border);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 36px;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-mark-icon {
    font-size: 16px;
    color: #fff;
    line-height: 1;
}

.brand-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.3px;
}

.auth-card h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.4px;
    margin-bottom: 4px;
    color: var(--text);
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    background: var(--input-bg);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input::placeholder { color: var(--text-muted); }

.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn-primary {
    width: 100%;
    margin-top: 8px;
    padding: 11px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s, transform 0.2s;
}

.btn-primary:hover  { filter: brightness(1.1); }
.btn-primary:active { transform: scale(.99); }

.error-message {
    background: rgba(229,57,53,0.15);
    color: #ff6b6b;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 16px;
    border: 1px solid rgba(229,57,53,0.30);
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .header-content {
        padding: 0 1rem;
    }

    .main-content {
        padding: 1rem;
        padding-bottom: 100px;
    }

    .desktop-panel {
        max-width: 100%;
        max-height: 60vh;
        margin: 0 0.5rem;
    }

    .dock {
        gap: 4px;
        padding: 6px 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .dock-icon-wrap {
        width: 40px;
        height: 40px;
    }

    .dock-separator {
        height: 40px;
    }
}
