/* ═══════════════════════════════════════════════════════════
   THE 12414 — Shared Stylesheet
   Warm & homey design with full theme + dark/light support
═══════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base Variables ────────────────────────────────────── */
:root {
    --font: 'Georgia', 'Times New Roman', serif;
    --font-ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --transition: 0.2s ease;
    --transition-slow: 0.35s ease;

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.07);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.09);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --shadow-xl: 0 16px 48px rgba(0,0,0,0.16);
}

/* ── Color Themes ──────────────────────────────────────── */
:root,
[data-theme="forest-green"] {
    --primary:        #2d6a4f;
    --primary-dark:   #1b4332;
    --primary-light:  #52b788;
    --primary-subtle: #d8f3dc;
    --primary-rgb:    45, 106, 79;
}

[data-theme="red-black-white"] {
    --primary:        #c1121f;
    --primary-dark:   #1a1a1a;
    --primary-light:  #e63946;
    --primary-subtle: #fde8e9;
    --primary-rgb:    193, 18, 31;
}

[data-theme="purple-indigo"] {
    --primary:        #5c4db1;
    --primary-dark:   #3d3391;
    --primary-light:  #8b7fd4;
    --primary-subtle: #ede9fe;
    --primary-rgb:    92, 77, 177;
}

[data-theme="slate-gray"] {
    --primary:        #475569;
    --primary-dark:   #1e293b;
    --primary-light:  #64748b;
    --primary-subtle: #e2e8f0;
    --primary-rgb:    71, 85, 105;
}

[data-theme="sunset-orange"] {
    --primary:        #c2410c;
    --primary-dark:   #7c2d12;
    --primary-light:  #ea580c;
    --primary-subtle: #ffedd5;
    --primary-rgb:    194, 65, 12;
}

[data-theme="ocean-blue"] {
    --primary:        #0369a1;
    --primary-dark:   #075985;
    --primary-light:  #0ea5e9;
    --primary-subtle: #e0f2fe;
    --primary-rgb:    3, 105, 161;
}

/* ── Light Mode ────────────────────────────────────────── */
:root,
[data-mode="light"] {
    --bg:           #faf8f5;
    --bg-secondary: #f2ede6;
    --bg-card:      #ffffff;
    --bg-hover:     #fdfcfa;
    --bg-overlay:   rgba(0,0,0,0.4);
    --text:         #1c1917;
    --text-muted:   #78716c;
    --text-light:   #a8a29e;
    --border:       #e7e3dc;
    --border-light: #f5f3f0;
    --input-bg:     #ffffff;
    --input-border: #d6d1c9;
}

/* ── Dark Mode ─────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    :root:not([data-mode="light"]) {
        --bg:           #1c1917;
        --bg-secondary: #292524;
        --bg-card:      #292524;
        --bg-hover:     #312e2b;
        --bg-overlay:   rgba(0,0,0,0.65);
        --text:         #fafaf9;
        --text-muted:   #a8a29e;
        --text-light:   #78716c;
        --border:       #3f3a36;
        --border-light: #2c2926;
        --input-bg:     #312e2b;
        --input-border: #57534e;
    }
}

[data-mode="dark"] {
    --bg:           #1c1917;
    --bg-secondary: #292524;
    --bg-card:      #292524;
    --bg-hover:     #312e2b;
    --bg-overlay:   rgba(0,0,0,0.65);
    --text:         #fafaf9;
    --text-muted:   #a8a29e;
    --text-light:   #78716c;
    --border:       #3f3a36;
    --border-light: #2c2926;
    --input-bg:     #312e2b;
    --input-border: #57534e;
}

/* ── Body ──────────────────────────────────────────────── */
body {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    transition: background var(--transition-slow), color var(--transition-slow);
    -webkit-font-smoothing: antialiased;
}

/* ── App Header ────────────────────────────────────────── */
.app-header {
    background: var(--primary-dark);
    color: white;
    padding: 0.9rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.app-name {
    font-family: var(--font);
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    letter-spacing: -0.3px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-user {
    font-size: 0.8rem;
    opacity: 0.7;
    white-space: nowrap;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.2rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font-ui);
    line-height: 1;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-ghost {
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.25);
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
}
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,0.12); }

.btn-icon {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    font-family: var(--font-ui);
}
.btn-icon:hover { background: var(--bg-secondary); color: var(--text); }

.btn-danger {
    background: transparent;
    color: #ef4444;
    border: 1px solid #fecaca;
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-ui);
    font-weight: 600;
}
.btn-danger:hover { background: #fef2f2; }

.btn-share {
    background: transparent;
    color: var(--primary);
    border: 1px solid rgba(var(--primary-rgb), 0.3);
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-ui);
    font-weight: 600;
}
.btn-share:hover { background: var(--primary-subtle); }

.btn-full { width: 100%; }

.btn-back {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    line-height: 1;
    opacity: 0.85;
    transition: opacity var(--transition);
    font-family: var(--font-ui);
}
.btn-back:hover { opacity: 1; }

/* ── Inputs ────────────────────────────────────────────── */
.input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    color: var(--text);
    font-family: var(--font-ui);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}
.input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
}
.input::placeholder { color: var(--text-light); }

/* ── Page Layout ───────────────────────────────────────── */
.page-content {
    padding: 1.25rem;
    max-width: 600px;
    margin: 0 auto;
}

/* ── Section Labels ────────────────────────────────────── */
.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* ── Badges ────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
}
.badge-shared {
    background: var(--primary-subtle);
    color: var(--primary);
}

/* ── Empty State ───────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; display: block; opacity: 0.55; }
.empty-state p { font-size: 0.9rem; }

/* ── Loading ───────────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ── Messages ──────────────────────────────────────────── */
.msg { font-size: 0.875rem; text-align: center; min-height: 1.25rem; padding: 0.25rem 0; }
.msg-error   { color: #ef4444; }
.msg-success { color: #22c55e; }

/* ── Theme Panel ───────────────────────────────────────── */
.theme-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}
.theme-overlay.open { display: flex; }

.theme-panel {
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 1.5rem 1.5rem 2rem;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.28s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.theme-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.theme-panel-header h3 {
    font-family: var(--font);
    font-size: 1.15rem;
}

.theme-swatches {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
    margin-bottom: 1.5rem;
}

.theme-swatch {
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.7rem 0.5rem;
    cursor: pointer;
    text-align: center;
    background: var(--bg-secondary);
    transition: all var(--transition);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-ui);
}
.theme-swatch:hover  { border-color: var(--primary-light); color: var(--text); }
.theme-swatch.active { border-color: var(--primary); color: var(--primary); background: var(--primary-subtle); }

.swatch-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    margin: 0 auto 0.4rem;
    box-shadow: var(--shadow-xs);
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.mode-btn {
    padding: 0.65rem 0.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all var(--transition);
    font-family: var(--font-ui);
}
.mode-btn:hover  { border-color: var(--primary-light); color: var(--text); }
.mode-btn.active { border-color: var(--primary); background: var(--primary-subtle); color: var(--primary); }

/* ── Login Page ────────────────────────────────────────── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg);
}

.login-box { width: 100%; max-width: 360px; }

.login-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.login-title {
    font-family: var(--font);
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.5px;
    line-height: 1;
    margin-bottom: 0.35rem;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 600;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
}

.login-card .input { margin-bottom: 0.85rem; }

.login-footer {
    text-align: center;
    margin-top: 1.25rem;
}

.login-footer button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: var(--font-ui);
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition);
}
.login-footer button:hover { color: var(--text); }

/* ── Welcome Banner ────────────────────────────────────── */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    padding: 1.5rem 1.25rem 2rem;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    margin-bottom: 1.25rem;
}

.welcome-banner h2 {
    font-family: var(--font);
    font-size: 1.45rem;
    margin-bottom: 0.2rem;
    font-weight: 700;
}

.welcome-banner p {
    font-size: 0.82rem;
    opacity: 0.75;
}

/* ── Feature Grid ──────────────────────────────────────── */
.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.feature-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    cursor: pointer;
    text-decoration: none;
    display: block;
    color: var(--text);
    transition: all var(--transition);
}
.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--bg-hover);
}
.feature-card.wide { grid-column: 1 / -1; }
.feature-card.coming-soon { opacity: 0.55; cursor: default; }
.feature-card.coming-soon:hover { transform: none; box-shadow: var(--shadow-sm); }

.feature-icon { font-size: 1.8rem; margin-bottom: 0.55rem; display: block; }

.feature-card h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    font-family: var(--font-ui);
}

.feature-card p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.coming-tag {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    background: var(--bg-secondary);
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
}

/* ── Sub-page Header ───────────────────────────────────── */
.sub-header {
    background: var(--primary-dark);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.sub-header h2 {
    font-family: var(--font);
    font-size: 1.1rem;
    flex: 1;
    font-weight: 700;
}

/* ── List Tabs ─────────────────────────────────────────── */
.list-tabs {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
    background: var(--bg-secondary);
    padding: 0.3rem;
    border-radius: var(--radius-md);
}

.list-tab {
    flex: 1;
    padding: 0.6rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: all var(--transition);
}
.list-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
}

/* ── Add Row ───────────────────────────────────────────── */
.add-row {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}
.add-row .input { flex: 1; }
.add-row .btn   { flex-shrink: 0; padding: 0.7rem 1rem; }

/* ── Todo Items ────────────────────────────────────────── */
.todo-items { display: flex; flex-direction: column; gap: 0.6rem; }

.todo-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    transition: opacity var(--transition);
}
.todo-item.done-item { opacity: 0.55; }

.todo-checkbox {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary);
    margin-top: 0.15rem;
}

.todo-body { flex: 1; min-width: 0; }

.todo-text {
    font-size: 0.92rem;
    word-break: break-word;
    line-height: 1.4;
}
.todo-text.done { text-decoration: line-through; color: var(--text-muted); }

.todo-meta {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.todo-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
    align-items: center;
}

/* ── Calendar ──────────────────────────────────────────── */
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.cal-month-label {
    font-family: var(--font);
    font-size: 1.1rem;
    font-weight: 700;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 1.5rem;
}

.cal-day-label {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 0.4rem 0;
    letter-spacing: 0.04em;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    font-size: 0.82rem;
    position: relative;
    font-family: var(--font-ui);
}
.cal-day:hover         { background: var(--bg-secondary); }
.cal-day.other-month   { color: var(--text-light); }
.cal-day.today         { background: var(--primary-subtle); color: var(--primary); font-weight: 700; }
.cal-day.has-events::after {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--primary);
    border-radius: 50%;
    position: absolute;
    bottom: 4px;
}

.cal-event-list { display: flex; flex-direction: column; gap: 0.6rem; }

.cal-event-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
}

.cal-event-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.cal-event-body { flex: 1; min-width: 0; }
.cal-event-title { font-size: 0.9rem; font-weight: 600; }
.cal-event-meta  { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }

/* ── Modal ─────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 300;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-xl);
    animation: fadeScale 0.2s ease;
}

@keyframes fadeScale {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1);    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}
.modal-header h3 { font-family: var(--font); font-size: 1.05rem; }

.modal .input { margin-bottom: 0.75rem; }

.modal-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
}
.modal-actions .btn { flex: 1; }

/* ── Utility ───────────────────────────────────────────── */
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem;   }
.mt-3 { margin-top: 1.5rem; }

/* ═══════════════════════════════════════════════════════════
   DINNER MENU — Additional Styles
═══════════════════════════════════════════════════════════ */

/* ── Dinner Tabs ───────────────────────────────────────── */
.dinner-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    background: var(--bg-secondary);
    padding: 0.3rem;
    border-radius: var(--radius-md);
    overflow-x: auto;
    scrollbar-width: none;
}
.dinner-tabs::-webkit-scrollbar { display: none; }

.dinner-tab {
    flex: 1;
    min-width: 70px;
    padding: 0.55rem 0.4rem;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: all var(--transition);
    white-space: nowrap;
    text-align: center;
}
.dinner-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: var(--shadow-xs);
}

/* ── Week Strip ─────────────────────────────────────────── */
.week-strip {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.week-day {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.2rem;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition);
    min-height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}
.week-day:hover       { border-color: var(--primary-light); }
.week-day.today       { border-color: var(--primary); background: var(--primary-subtle); }
.week-day.has-meal    { background: var(--bg-card); }
.week-day.selected    { border-color: var(--primary); box-shadow: var(--shadow-sm); }

.week-day-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}
.week-day-num {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}
.week-day.today .week-day-num { color: var(--primary); }

.week-day-meal {
    font-size: 0.58rem;
    color: var(--text-muted);
    line-height: 1.3;
    word-break: break-word;
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.week-day-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: auto;
}

/* ── Meal Detail Card ───────────────────────────────────── */
.meal-detail-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: 1rem;
}

.meal-detail-date {
    font-family: var(--font);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

.meal-slot {
    margin-bottom: 1rem;
}

.meal-slot-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.meal-slot-picker {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meal-slot-value {
    flex: 1;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    font-size: 0.88rem;
    color: var(--text);
    border: 1px solid var(--border);
    min-height: 2.4rem;
    cursor: pointer;
    transition: background var(--transition);
}
.meal-slot-value:hover        { background: var(--border-light); }
.meal-slot-value.placeholder  { color: var(--text-light); font-style: italic; }

.meal-notes-input {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text);
    font-family: var(--font-ui);
    resize: none;
    outline: none;
    transition: border-color var(--transition);
}
.meal-notes-input:focus { border-color: var(--primary); }

.meal-detail-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}
.meal-detail-actions .btn { flex: 1; }

/* ── Dish Library ───────────────────────────────────────── */
.library-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

.library-search {
    flex: 1;
    padding: 0.65rem 0.9rem;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text);
    font-family: var(--font-ui);
    outline: none;
    transition: border-color var(--transition);
}
.library-search:focus { border-color: var(--primary); }
.library-search::placeholder { color: var(--text-light); }

.dish-list { display: flex; flex-direction: column; gap: 0.6rem; }

.dish-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    cursor: pointer;
    transition: all var(--transition);
}
.dish-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--border);
}

.dish-card-top {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.dish-info { flex: 1; min-width: 0; }

.dish-name {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    color: var(--text);
}

.dish-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.dish-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.45rem;
}

.dish-tag {
    background: var(--bg-secondary);
    color: var(--text-muted);
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 600;
}

.dish-avg-rating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    flex-shrink: 0;
}

.dish-avg-stars {
    font-size: 0.9rem;
    color: #f59e0b;
    letter-spacing: -1px;
}

.dish-avg-num {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ── Star Rating ────────────────────────────────────────── */
.star-rating {
    display: flex;
    gap: 0.15rem;
}

.star {
    font-size: 1.4rem;
    cursor: pointer;
    transition: transform var(--transition);
    color: #d1d5db;
    line-height: 1;
    user-select: none;
}
.star:hover          { transform: scale(1.15); }
.star.filled         { color: #f59e0b; }

.member-ratings {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin: 0.75rem 0;
}

.member-rating-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.member-rating-name {
    font-size: 0.82rem;
    font-weight: 600;
    width: 70px;
    flex-shrink: 0;
    color: var(--text);
}

/* ── Insights ───────────────────────────────────────────── */
.insight-section {
    margin-bottom: 1.5rem;
}

.insight-section-title {
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.insight-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.insight-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.insight-card-body { flex: 1; min-width: 0; }
.insight-card-name { font-size: 0.9rem; font-weight: 600; }
.insight-card-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }
.insight-card-stat {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}

.suggest-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.suggest-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}
.suggest-card:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}
.suggest-card-name { font-size: 0.88rem; font-weight: 700; margin-bottom: 0.25rem; }
.suggest-card-stars { font-size: 0.8rem; color: #f59e0b; }
.suggest-card-meta  { font-size: 0.68rem; color: var(--text-muted); margin-top: 0.2rem; }

.shuffle-btn {
    width: 100%;
    margin-top: 0.25rem;
}

/* ── Grocery from Meals ─────────────────────────────────── */
.grocery-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    margin-bottom: 1rem;
}

.grocery-section h3 {
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.grocery-section p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.ingredient-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.ingredient-chip {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.3rem 0.75rem;
    font-size: 0.78rem;
    color: var(--text);
    cursor: pointer;
    transition: all var(--transition);
}
.ingredient-chip.selected {
    background: var(--primary-subtle);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* ── Dish Modal ─────────────────────────────────────────── */
.tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.tag-option {
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--transition);
    font-family: var(--font-ui);
}
.tag-option.selected {
    background: var(--primary-subtle);
    border-color: var(--primary);
    color: var(--primary);
}

.modal-scroll {
    max-height: 70vh;
    overflow-y: auto;
    padding-right: 0.25rem;
}

/* ── Picker Modal ───────────────────────────────────────── */
.picker-list {
    max-height: 55vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 0.75rem 0;
}

.picker-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    transition: all var(--transition);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-ui);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.picker-item:hover  { border-color: var(--primary-light); }
.picker-item.selected { border-color: var(--primary); background: var(--primary-subtle); color: var(--primary); }

.picker-item-stars { font-size: 0.75rem; color: #f59e0b; }

.picker-search {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text);
    font-family: var(--font-ui);
    outline: none;
    margin-bottom: 0.5rem;
    transition: border-color var(--transition);
}
.picker-search:focus { border-color: var(--primary); }

/* ═══════════════════════════════════════════════════════════
   GROCERY LIST — Additional Styles
═══════════════════════════════════════════════════════════ */

/* ── Category Sections ──────────────────────────────────── */
.grocery-category {
    margin-bottom: 1.25rem;
}

.grocery-category-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.grocery-category-icon {
    font-size: 1.1rem;
}

.grocery-category-name {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    flex: 1;
}

.grocery-category-count {
    font-size: 0.72rem;
    color: var(--text-light);
    font-weight: 600;
}

/* ── Grocery Items ───────────────────────────────────────── */
.grocery-item {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    margin-bottom: 0.45rem;
    transition: opacity var(--transition);
}

.grocery-item.checked {
    opacity: 0.45;
}

.grocery-item.checked .grocery-item-text {
    text-decoration: line-through;
    color: var(--text-muted);
}

.grocery-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary);
}

.grocery-item-text {
    flex: 1;
    font-size: 0.9rem;
    min-width: 0;
    word-break: break-word;
}

.grocery-item-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
    align-items: center;
}

/* ── Category Badge ─────────────────────────────────────── */
.cat-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all var(--transition);
    white-space: nowrap;
    font-family: var(--font-ui);
}
.cat-badge:hover {
    background: var(--primary-subtle);
    color: var(--primary);
    border-color: var(--primary);
}

/* ── Add Row with Suggestion ─────────────────────────────── */
.add-row-with-hint {
    margin-bottom: 1.25rem;
}

.category-hint {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    min-height: 1.5rem;
}

.category-hint-icon { font-size: 0.9rem; }

/* ── Grocery Toolbar ─────────────────────────────────────── */
.grocery-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.grocery-toolbar .btn {
    flex: 1;
    min-width: 0;
    font-size: 0.8rem;
    padding: 0.6rem 0.5rem;
}

/* ── Category Picker ─────────────────────────────────────── */
.cat-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.cat-picker-btn {
    padding: 0.75rem 0.5rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: all var(--transition);
    font-family: var(--font-ui);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.cat-picker-btn:hover {
    border-color: var(--primary-light);
    color: var(--text);
}
.cat-picker-btn.active {
    border-color: var(--primary);
    background: var(--primary-subtle);
    color: var(--primary);
}

/* ── Progress Bar ────────────────────────────────────────── */
.shopping-progress {
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    height: 6px;
    margin-bottom: 1.25rem;
    overflow: hidden;
}

.shopping-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.shopping-progress-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   REFINED TO-DO LIST — Additional Styles
═══════════════════════════════════════════════════════════ */

/* ── Filter / Sort Bar ───────────────────────────────────── */
.filter-bar {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: none;
}
.filter-bar.open { display: block; }

.filter-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}
.filter-row:last-child { margin-bottom: 0; }

.filter-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    width: 52px;
    flex-shrink: 0;
}

.filter-options {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.filter-option {
    padding: 0.3rem 0.65rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: all var(--transition);
}
.filter-option:hover { border-color: var(--primary-light); color: var(--text); }
.filter-option.active {
    background: var(--primary-subtle);
    border-color: var(--primary);
    color: var(--primary);
}

/* ── Todo Controls Row ───────────────────────────────────── */
.todo-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.todo-controls .list-tabs { margin-bottom: 0; flex: 1; }

.filter-toggle-btn {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.7rem;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-weight: 600;
    transition: all var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}
.filter-toggle-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-toggle-btn.active { background: var(--primary-subtle); border-color: var(--primary); color: var(--primary); }

/* ── Refined Todo Item ───────────────────────────────────── */
.todo-item-v2 {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    margin-bottom: 0.55rem;
    overflow: hidden;
    transition: box-shadow var(--transition);
    border-left: 3px solid transparent;
}
.todo-item-v2:hover { box-shadow: var(--shadow-sm); }
.todo-item-v2.overdue { border-left-color: #ef4444; }
.todo-item-v2.done-item { opacity: 0.55; }
.todo-item-v2.expanded { box-shadow: var(--shadow-md); }

.todo-item-main {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.8rem 0.9rem;
}

.todo-drag-handle {
    color: var(--text-light);
    font-size: 1rem;
    cursor: grab;
    padding: 0.1rem 0;
    flex-shrink: 0;
    user-select: none;
    line-height: 1.4;
}

.todo-checkbox-v2 {
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--primary);
    margin-top: 0.18rem;
}

.todo-body-v2 {
    flex: 1;
    min-width: 0;
}

/* Inline edit — text becomes input */
.todo-text-v2 {
    font-size: 0.92rem;
    line-height: 1.4;
    word-break: break-word;
    color: var(--text);
    cursor: text;
    border-radius: var(--radius-xs);
    padding: 0.05rem 0.2rem;
    margin: -0.05rem -0.2rem;
    transition: background var(--transition);
    display: block;
    width: 100%;
}
.todo-text-v2:hover { background: var(--bg-secondary); }
.todo-text-v2.done  { text-decoration: line-through; color: var(--text-muted); }

.todo-inline-input {
    font-size: 0.92rem;
    line-height: 1.4;
    width: 100%;
    background: var(--bg-secondary);
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 0.15rem 0.4rem;
    color: var(--text);
    font-family: var(--font-ui);
    outline: none;
}

.todo-note-preview {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.todo-meta-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.todo-due-date {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.2rem;
}
.todo-due-date.overdue { color: #ef4444; }

.todo-shared-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-full);
    background: var(--primary-subtle);
    color: var(--primary);
}

.todo-source-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-muted);
}

/* ── Item Action Strip ───────────────────────────────────── */
.todo-item-actions-v2 {
    display: flex;
    flex-shrink: 0;
    gap: 0.25rem;
    align-items: flex-start;
}

.todo-expand-btn {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 0.2rem 0.3rem;
    border-radius: var(--radius-xs);
    transition: all var(--transition);
    font-family: var(--font-ui);
    line-height: 1;
}
.todo-expand-btn:hover { color: var(--text); background: var(--bg-secondary); }

/* ── Expanded Panel ─────────────────────────────────────── */
.todo-expanded-panel {
    border-top: 1px solid var(--border-light);
    padding: 0.75rem 0.9rem;
    background: var(--bg-secondary);
    display: none;
}
.todo-expanded-panel.open { display: block; }

.expanded-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}
.expanded-row:last-child { margin-bottom: 0; }

.expanded-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    width: 48px;
    flex-shrink: 0;
}

.expanded-input {
    flex: 1;
    padding: 0.45rem 0.7rem;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text);
    font-family: var(--font-ui);
    outline: none;
    transition: border-color var(--transition);
}
.expanded-input:focus { border-color: var(--primary); }

.expanded-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}

/* ── Order Buttons ───────────────────────────────────────── */
.order-btns {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex-shrink: 0;
}

.order-btn {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 0.05rem 0.2rem;
    line-height: 1;
    transition: color var(--transition);
    font-family: var(--font-ui);
}
.order-btn:hover { color: var(--primary); }
.order-btn:disabled { opacity: 0.2; cursor: default; }

/* ── Clear Completed ─────────────────────────────────────── */
.todo-list-footer {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

/* ═══════════════════════════════════════════════════════════
   AVATAR SYSTEM — Phase 1
═══════════════════════════════════════════════════════════ */

/* ── Avatar Base ─────────────────────────────────────────── */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-family: var(--font-ui);
    flex-shrink: 0;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.25);
    background: var(--primary);
    color: white;
    user-select: none;
    position: relative;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ── Avatar Sizes ────────────────────────────────────────── */
.avatar-xs  { width: 24px;  height: 24px;  font-size: 0.6rem;  border-width: 1.5px; }
.avatar-sm  { width: 32px;  height: 32px;  font-size: 0.8rem;  border-width: 2px;   }
.avatar-md  { width: 42px;  height: 42px;  font-size: 1rem;    border-width: 2px;   }
.avatar-lg  { width: 64px;  height: 64px;  font-size: 1.5rem;  border-width: 3px;   }
.avatar-xl  { width: 96px;  height: 96px;  font-size: 2.2rem;  border-width: 3px;   }
.avatar-xxl { width: 120px; height: 120px; font-size: 2.8rem;  border-width: 4px;   }

/* ── Avatar Stack (multiple avatars overlapping) ─────────── */
.avatar-stack {
    display: flex;
    align-items: center;
}
.avatar-stack .avatar {
    margin-left: -8px;
    border: 2px solid var(--bg-card);
}
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ── Avatar in Header ────────────────────────────────────── */
.header-avatar-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: var(--radius-full);
    transition: opacity var(--transition);
}
.header-avatar-btn:hover { opacity: 0.85; }

/* ── Color Picker Grid ───────────────────────────────────── */
.color-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.color-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all var(--transition);
    position: relative;
}
.color-swatch:hover  { transform: scale(1.12); }
.color-swatch.active {
    border-color: var(--text);
    transform: scale(1.12);
}
.color-swatch.active::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.7rem;
    font-weight: 900;
}

/* ── Profile Page ────────────────────────────────────────── */
.profile-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 2rem 1.25rem 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    margin-bottom: 1.5rem;
    position: relative;
}

.profile-avatar-wrap {
    position: relative;
    cursor: pointer;
}

.profile-avatar-wrap:hover .avatar-edit-badge { opacity: 1; }

.avatar-edit-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    box-shadow: var(--shadow-sm);
    opacity: 0.9;
    transition: opacity var(--transition);
    cursor: pointer;
}

.profile-name {
    font-family: var(--font);
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-align: center;
}

.profile-name-input {
    font-family: var(--font);
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    text-align: center;
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.4);
    border-radius: var(--radius-md);
    padding: 0.3rem 0.75rem;
    outline: none;
    width: 100%;
    max-width: 220px;
}

.profile-login-name {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.6);
}

/* ── Profile Sections ────────────────────────────────────── */
.profile-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.profile-section-title {
    font-family: var(--font);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
}

/* ── Avatar Upload Preview ───────────────────────────────── */
.avatar-upload-area {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.avatar-upload-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

/* ── Streak Display ──────────────────────────────────────── */
.streak-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.streak-flame {
    font-size: 1.75rem;
    line-height: 1;
}

.streak-info { flex: 1; }
.streak-count {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}
.streak-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Sign Out Button ─────────────────────────────────────── */
.signout-btn {
    width: 100%;
    padding: 0.85rem;
    background: transparent;
    color: #ef4444;
    border: 2px solid #fecaca;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: all var(--transition);
    margin-top: 0.5rem;
}
.signout-btn:hover { background: #fef2f2; }

/* ═══════════════════════════════════════════════════════════
   HOME DASHBOARD — Phase 2
═══════════════════════════════════════════════════════════ */

/* ── Dashboard Hero ──────────────────────────────────────── */
.dashboard-hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 1.25rem 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.dashboard-hero-avatar {
    flex-shrink: 0;
    cursor: pointer;
    transition: transform var(--transition);
}
.dashboard-hero-avatar:hover { transform: scale(1.05); }

.dashboard-hero-info { flex: 1; min-width: 0; }

.dashboard-greeting {
    font-family: var(--font);
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    line-height: 1.2;
    margin-bottom: 0.2rem;
}

.dashboard-date {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.65);
    font-weight: 500;
}

.dashboard-streak {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: rgba(255,255,255,0.85);
    font-weight: 600;
}

.dashboard-streak-flame { font-size: 0.95rem; }

/* ── At a Glance Row ─────────────────────────────────────── */
.glance-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    margin-bottom: 1.25rem;
}

.glance-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 0.85rem 0.6rem;
    text-align: center;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    cursor: pointer;
    text-decoration: none;
    display: block;
    transition: all var(--transition);
}
.glance-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.glance-card.urgent { border-color: #fecaca; background: #fef2f2; }
.glance-card.urgent .glance-number { color: #ef4444; }

.glance-number {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 0.2rem;
    font-family: var(--font-ui);
}

.glance-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* ── Tonight's Dinner Card ───────────────────────────────── */
.tonight-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
}
.tonight-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.tonight-icon { font-size: 1.75rem; flex-shrink: 0; }

.tonight-body { flex: 1; min-width: 0; }

.tonight-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.tonight-meal {
    font-size: 1rem;
    font-weight: 700;
    font-family: var(--font);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tonight-sides {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tonight-arrow {
    color: var(--text-light);
    font-size: 1rem;
    flex-shrink: 0;
}

/* ── Feature Cards with Badges ───────────────────────────── */
.feature-card-inner {
    position: relative;
}

.feature-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
    font-family: var(--font-ui);
}

/* ── Next Event Banner ───────────────────────────────────── */
.next-event-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
}
.next-event-card:hover { box-shadow: var(--shadow-sm); }

.next-event-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
}

.next-event-body { flex: 1; min-width: 0; }

.next-event-title {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.next-event-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.next-event-soon {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}

/* ── Grocery Progress Mini ───────────────────────────────── */
.grocery-mini {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.35rem;
}

.grocery-mini-bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.grocery-mini-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.grocery-mini-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   MESSAGE BOARD — Phase 3
═══════════════════════════════════════════════════════════ */

/* ── Compose Area ────────────────────────────────────────── */
.compose-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1rem 1.1rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
}

.compose-top {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.compose-textarea {
    flex: 1;
    padding: 0.65rem 0.85rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text);
    font-family: var(--font-ui);
    resize: none;
    outline: none;
    transition: border-color var(--transition);
    line-height: 1.5;
    min-height: 72px;
}
.compose-textarea:focus { border-color: var(--primary); }
.compose-textarea::placeholder { color: var(--text-light); }

.compose-bottom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.compose-emoji-btn {
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.6rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-ui);
    line-height: 1;
}
.compose-emoji-btn:hover { background: var(--border); }
.compose-emoji-btn.has-emoji { border-color: var(--primary); background: var(--primary-subtle); }

.compose-char-count {
    font-size: 0.72rem;
    color: var(--text-light);
    margin-left: auto;
    font-weight: 600;
    transition: color var(--transition);
}
.compose-char-count.near-limit { color: #f59e0b; }
.compose-char-count.at-limit   { color: #ef4444; }

/* ── Emoji Picker ────────────────────────────────────────── */
.emoji-picker-panel {
    display: none;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding: 0.6rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-top: 0.5rem;
    border: 1px solid var(--border);
}
.emoji-picker-panel.open { display: flex; }

.emoji-option {
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.2rem 0.3rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    line-height: 1;
    border: 2px solid transparent;
}
.emoji-option:hover    { background: var(--border); }
.emoji-option.selected { border-color: var(--primary); background: var(--primary-subtle); }

/* ── Post Feed ───────────────────────────────────────────── */
.post-feed {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.post-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--border-light);
    transition: box-shadow var(--transition);
}
.post-card:hover { box-shadow: var(--shadow-sm); }

.post-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}

.post-author-info { flex: 1; min-width: 0; }

.post-author-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.post-timestamp {
    font-size: 0.68rem;
    color: var(--text-light);
    font-weight: 500;
}

.post-delete-btn {
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.2rem 0.35rem;
    border-radius: var(--radius-xs);
    transition: all var(--transition);
    font-family: var(--font-ui);
    opacity: 0;
    transition: opacity var(--transition);
}
.post-card:hover .post-delete-btn { opacity: 1; }
.post-delete-btn:hover { color: #ef4444; background: #fef2f2; }

.post-body {
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text);
    word-break: break-word;
    white-space: pre-wrap;
}

.post-emoji-prefix {
    font-size: 1.15rem;
    margin-right: 0.3rem;
    vertical-align: -0.1em;
}

/* ── Reactions ───────────────────────────────────────────── */
.post-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.65rem;
}

.reaction-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    border: 1.5px solid var(--border);
    background: var(--bg-secondary);
    cursor: pointer;
    font-size: 0.82rem;
    font-family: var(--font-ui);
    font-weight: 600;
    color: var(--text-muted);
    transition: all var(--transition);
    line-height: 1;
}
.reaction-btn:hover  { border-color: var(--primary-light); color: var(--text); }
.reaction-btn.mine   { border-color: var(--primary); background: var(--primary-subtle); color: var(--primary); }

.reaction-emoji { font-size: 0.95rem; }
.reaction-count { font-size: 0.75rem; }

.add-reaction-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-full);
    border: 1.5px dashed var(--border);
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-light);
    transition: all var(--transition);
    font-family: var(--font-ui);
}
.add-reaction-btn:hover { border-color: var(--primary-light); color: var(--text); }

/* ── Reaction Picker ─────────────────────────────────────── */
.reaction-picker {
    display: none;
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    gap: 0.25rem;
    flex-wrap: wrap;
    max-width: 200px;
}
.reaction-picker.open { display: flex; }

.reaction-picker-wrap {
    position: relative;
    display: inline-block;
}

/* ── Load More ───────────────────────────────────────────── */
.load-more-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-ui);
    transition: all var(--transition);
    margin-top: 0.5rem;
}
.load-more-btn:hover { background: var(--border); color: var(--text); }

/* House Dash */
.game-page {
    padding: 1rem;
}

.game-shell {
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
}

.game-topbar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

.game-stat {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.75rem;
    box-shadow: var(--shadow-xs);
}

.game-stat span {
    display: block;
    font-size: 0.63rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    font-weight: 700;
}

.game-stat strong {
    display: block;
    color: var(--primary);
    font-size: 1.1rem;
    line-height: 1.2;
}

.game-canvas-wrap {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 0.6rem;
    box-shadow: var(--shadow-md);
}

#house-dash-canvas {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
    background: #f7efe5;
}

.game-overlay-panel {
    position: absolute;
    inset: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem;
    text-align: center;
    background: rgba(28, 25, 23, 0.55);
    color: white;
    border-radius: var(--radius-md);
}

.game-overlay-panel h3 {
    font-family: var(--font);
    font-size: 1.6rem;
    line-height: 1.1;
}

.game-overlay-panel p {
    max-width: 420px;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.86);
}

.game-controls {
    display: grid;
    grid-template-columns: 1fr 1.2fr 1fr 1fr;
    gap: 0.55rem;
    margin: 0.8rem 0 1rem;
}

.game-control-btn {
    min-height: 48px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text);
    font-weight: 800;
    font-family: var(--font-ui);
    box-shadow: var(--shadow-xs);
    touch-action: none;
}

.game-control-btn:active {
    background: var(--primary-subtle);
    color: var(--primary);
    border-color: var(--primary);
}

.game-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
}

.game-card,
.arcade-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-sm);
}

.game-card-title,
.arcade-summary-title {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.game-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.84rem;
}

.game-list.muted {
    color: var(--text-muted);
    font-size: 0.84rem;
}

.game-list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-light);
}

.game-list-row:last-child {
    border-bottom: none;
}

.game-list-row span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.game-list-row strong {
    color: var(--primary);
    flex-shrink: 0;
}

.arcade-summary-card {
    display: block;
    margin-bottom: 1.25rem;
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition);
}

.arcade-summary-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.arcade-summary-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.arcade-summary-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-subtle);
    color: var(--primary);
    font-weight: 900;
    flex-shrink: 0;
}

.arcade-summary-body {
    min-width: 0;
    flex: 1;
}

.arcade-summary-name {
    font-weight: 800;
    font-size: 0.98rem;
}

.arcade-summary-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 0.1rem;
}

.arcade-summary-score {
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    flex-shrink: 0;
}

@media (max-width: 560px) {
    .game-page {
        padding: 0.75rem;
    }

    .game-topbar {
        grid-template-columns: repeat(2, 1fr);
    }

    .game-meta-grid {
        grid-template-columns: 1fr;
    }

    .game-overlay-panel h3 {
        font-size: 1.35rem;
    }
}
