/* ============================================================
   Drag Drop Drink – Wikipedia-inspired Theme
   Light & Dark mode via prefers-color-scheme + manual toggle.
   All colours use CSS custom properties for easy theming.
   ============================================================ */

/* ── CSS Variables ── */
:root {
    /* Light mode (default) */
    --bg-primary:       #f8f9fa;
    --bg-secondary:     #ffffff;
    --bg-tertiary:      #f0f2f5;
    --bg-hover:         #e8eaed;
    --bg-card:          #ffffff;
    --bg-modal:         #ffffff;
    --bg-input:         #ffffff;
    --bg-code:          #f5f5f5;
    --bg-nav:           #ffffff;
    --bg-nav-active:    #eaecf0;
    --bg-badge:         #eaecf0;

    --text-primary:     #202122;
    --text-secondary:   #54595d;
    --text-muted:       #72777d;
    --text-link:        #3366cc;
    --text-link-hover:  #2a4b8d;
    --text-link-visited:#795cb2;
    --text-on-accent:   #ffffff;

    --border-color:     #a2a9b1;
    --border-light:     #c8ccd1;
    --border-card:      #c8ccd1;

    --accent:           #3366cc;
    --accent-hover:     #2a4b8d;
    --accent-light:     #eaf3ff;
    --success:          #00af89;
    --danger:           #d33;
    --danger-hover:     #b32424;
    --warning:          #fc3;
    --warning-bg:       #fef6e7;

    --shadow-sm:        0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:        0 2px 8px rgba(0,0,0,0.12);
    --shadow-lg:        0 8px 32px rgba(0,0,0,0.18);

    --radius-sm:        4px;
    --radius-md:        6px;
    --radius-lg:        10px;

    --font-body:        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-heading:     'Linux Libertine', Georgia, 'Times New Roman', serif;
    --font-mono:        'Menlo', 'Consolas', 'DejaVu Sans Mono', monospace;

    --header-height:    56px;
    --sidebar-width:    220px;
    --max-content:      1200px;

    --sprite-size:      60px;
    --sprite-width:     64px;

    --transition:       0.2s ease;
}

/* ── Dark mode ── */
[data-theme="dark"] {
    --bg-primary:       #1a1a2e;
    --bg-secondary:     #16213e;
    --bg-tertiary:      #1a1a2e;
    --bg-hover:         #262640;
    --bg-card:          #1e1e36;
    --bg-modal:         #1e1e36;
    --bg-input:         #262640;
    --bg-code:          #262640;
    --bg-nav:           #16213e;
    --bg-nav-active:    #262640;
    --bg-badge:         #2d2d50;

    --text-primary:     #e0e0e0;
    --text-secondary:   #a8a8c0;
    --text-muted:       #8888a0;
    --text-link:        #6699ff;
    --text-link-hover:  #88bbff;
    --text-link-visited:#b088e0;

    --border-color:     #3a3a5c;
    --border-light:     #2d2d50;
    --border-card:      #3a3a5c;

    --accent:           #6699ff;
    --accent-hover:     #88bbff;
    --accent-light:     #1a2744;

    --shadow-sm:        0 1px 3px rgba(0,0,0,0.3);
    --shadow-md:        0 2px 8px rgba(0,0,0,0.4);
    --shadow-lg:        0 8px 32px rgba(0,0,0,0.5);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg-primary:       #1a1a2e;
        --bg-secondary:     #16213e;
        --bg-tertiary:      #1a1a2e;
        --bg-hover:         #262640;
        --bg-card:          #1e1e36;
        --bg-modal:         #1e1e36;
        --bg-input:         #262640;
        --bg-code:          #262640;
        --bg-nav:           #16213e;
        --bg-nav-active:    #262640;
        --bg-badge:         #2d2d50;

        --text-primary:     #e0e0e0;
        --text-secondary:   #a8a8c0;
        --text-muted:       #8888a0;
        --text-link:        #6699ff;
        --text-link-hover:  #88bbff;
        --text-link-visited:#b088e0;

        --border-color:     #3a3a5c;
        --border-light:     #2d2d50;
        --border-card:      #3a3a5c;

        --accent:           #6699ff;
        --accent-hover:     #88bbff;
        --accent-light:     #1a2744;

        --shadow-sm:        0 1px 3px rgba(0,0,0,0.3);
        --shadow-md:        0 2px 8px rgba(0,0,0,0.4);
        --shadow-lg:        0 8px 32px rgba(0,0,0,0.5);
    }
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--text-primary);
    background: var(--bg-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--text-link);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover { color: var(--text-link-hover); }

img { max-width: 100%; height: auto; }

/* ── Layout ── */
#app-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-nav);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
}

.header-brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    cursor: pointer;
}
.header-brand span {
    color: var(--accent);
}
.brand-emoji {
    margin-right: 6px;
}

.header-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}
.header-nav .nav-btn {
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}
.header-nav .nav-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.header-nav .nav-btn.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-wrap: nowrap;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}
.btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
}
.btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover {
    background: var(--danger-hover);
    border-color: var(--danger-hover);
}
.btn-sm {
    padding: 4px 10px;
    font-size: 0.8rem;
}
.btn-cabinet-clear {
    padding: 10px 18px;
    font-size: 0.9rem;
}
.btn-icon {
    padding: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    line-height: 1;
}
.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ── Theme toggle ── */
.theme-toggle {
    font-size: 1.3rem;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ── Main content ── */
#main-content {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 24px 20px 60px;
    min-height: calc(100vh - var(--header-height) - 40px);
}

/* ── Page titles ── */
.page-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 400;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 4px;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 400;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 2px;
    margin: 24px 0 12px;
    color: var(--text-primary);
}

/* ── Search & Filter bar ── */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

.recipe-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color var(--transition);
}
.search-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}
.search-input::placeholder {
    color: var(--text-muted);
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
}
.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* ── Cards Grid ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.recipe-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 16px;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
}
.recipe-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.recipe-card-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-link);
    margin-bottom: 6px;
}
.recipe-card-style {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: capitalize;
}
.recipe-card-ingredients {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}
.recipe-card-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 10px;
}

/* ── Sprite icons ── */
.sprite-icon {
    width: 40px;
    height: 40px;
    background-size: auto 40px;
    background-repeat: no-repeat;
    display: inline-block;
    border-radius: var(--radius-sm);
}
.sprite-icon-lg {
    width: 54px;
    height: 54px;
    background-size: auto 54px;
}

/* ── Alphabet Jump ── */
.alpha-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-bottom: 16px;
    padding: 8px 0;
}
.alpha-nav button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-link);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}
.alpha-nav button:hover,
.alpha-nav button.active {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: var(--accent);
}
.alpha-nav button:disabled {
    opacity: 0.3;
    cursor: default;
}

.letter-group-heading {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 2px;
    margin: 24px 0 12px;
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.modal-overlay.show { opacity: 1; }

.modal {
    background: var(--bg-modal);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    transform: translateY(-10px);
    transition: transform 0.2s ease;
}
.modal-overlay.show .modal { transform: translateY(0); }

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 12px;
    border-bottom: 1px solid var(--border-light);
}
.modal-header h2 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--text-primary);
    flex: 1;
}
.modal-close {
    font-size: 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    line-height: 1;
}
.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.modal-body {
    padding: 16px 24px 24px;
}
.modal-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ── Recipe detail ── */
.recipe-detail-style {
    display: inline-block;
    background: var(--bg-badge);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-transform: capitalize;
}

.recipe-detail-section {
    margin-bottom: 16px;
}
.recipe-detail-section h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    padding-bottom: 2px;
}

.ingredient-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.ingredient-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 6px 10px;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.ingredient-chip .sprite-icon {
    width: 30px;
    height: 30px;
    background-size: auto 30px;
}
.ingredient-chip.missing {
    border-color: var(--danger);
    background: rgba(221,51,51,0.06);
}

.recipe-instructions {
    white-space: pre-wrap;
    line-height: 1.8;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* ── Articles list ── */
.article-list {
    list-style: none;
}
.article-list li {
    border-bottom: 1px solid var(--border-light);
}
.article-list li:last-child { border-bottom: none; }
.article-list a {
    display: block;
    padding: 10px 12px;
    transition: background var(--transition);
    border-radius: var(--radius-sm);
}
.article-list a:hover {
    background: var(--accent-light);
}

/* ── Tabs ── */
.tabs {
    display: flex;
    gap: 6px;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 20px;
    flex-wrap: wrap;
    overflow: visible;
}
.tab-btn {
    padding: 10px 18px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
    white-space: nowrap;
}

#btn-saved {
    background: var(--bg-tertiary);
    border-color: var(--border-light);
}
.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

/* ── Ingredient Grid (Cabinet) ── */
.ingredient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
}
.ingredient-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    position: relative;
    text-align: center;
}
.ingredient-item:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}
.ingredient-item .sprite-icon {
    margin-bottom: 6px;
}
.ingredient-item-name {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.3;
    word-break: break-word;
}
.ingredient-item .action-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 1.1rem;
    cursor: pointer;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    line-height: 1;
    padding: 0;
}
.ingredient-item .action-btn:hover {
    transform: scale(1.15);
}
.ingredient-item .action-btn.add-btn:hover {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.ingredient-item .action-btn.remove-btn:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.ingredient-item.in-cabinet {
    border-color: var(--success);
    background: rgba(0, 175, 137, 0.05);
}

/* ── What Can I Make – Toggle Buttons ── */
.filter-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}
.toggle-btn {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-body);
}
.toggle-btn:hover {
    border-color: var(--accent);
    color: var(--text-primary);
}
.toggle-btn.active {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: var(--accent);
}

/* ── Home page ── */
.home-hero {
    text-align: center;
    padding: 40px 20px;
    margin-bottom: 32px;
}
.home-hero h1 {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 400;
    margin-bottom: 8px;
}
.home-hero .tagline {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.home-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin: 24px 0 32px;
}
.home-signup {
    display: none;
    text-align: center;
    margin-top: 12px;
}
.stat-box {
    text-align: center;
}
.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}
.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.featured-recipe {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 600px;
    margin: 0 auto;
}
.featured-recipe h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 4px;
    color: var(--text-link);
    cursor: pointer;
}
.featured-recipe h3:hover { color: var(--text-link-hover); }
.featured-label {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

/* ── Info sections ── */
.info-section {
    margin-top: 24px;
}
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}
.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}
.info-card h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    margin-bottom: 6px;
}
.info-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.steps {
    padding-left: 20px;
    color: var(--text-secondary);
}
.steps li {
    margin-bottom: 8px;
}
.tip-list {
    padding-left: 18px;
    color: var(--text-secondary);
}
.tip-list li {
    margin-bottom: 6px;
}

/* ── Profile ── */
.profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}
.profile-form {
    max-width: 420px;
}

/* ── Auth forms ── */
.auth-form {
    max-width: 380px;
    margin: 40px auto;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 32px;
}
.auth-form h2 {
    font-family: var(--font-heading);
    text-align: center;
    margin-bottom: 20px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 600;
}
.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
}
.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}
.form-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 8px;
    text-align: center;
}
.form-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── Admin tables ── */
.admin-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.admin-table th,
.admin-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    vertical-align: top;
}
.admin-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.admin-table tr:hover td {
    background: var(--bg-hover);
}
.admin-table tr:last-child td {
    border-bottom: none;
}

/* ── Loading & empty states ── */
.loading {
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
    font-size: 1.1rem;
}
.loading::after {
    content: '';
    display: block;
    width: 28px;
    height: 28px;
    margin: 16px auto 0;
    border: 3px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state .emoji {
    font-size: 3rem;
    margin-bottom: 12px;
}

/* ── User badge ── */
.user-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.user-badge .username {
    font-weight: 600;
}

/* ── Footer ── */
#app-footer {
    text-align: center;
    padding: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .header-nav { display: none; }
    .header-nav.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        background: var(--bg-nav);
        border-bottom: 1px solid var(--border-light);
        padding: 8px;
        box-shadow: var(--shadow-md);
        z-index: 999;
    }
    .mobile-menu-btn {
        display: flex !important;
    }
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    .ingredient-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    .home-stats {
        gap: 16px;
    }
    .modal {
        margin: 10px;
        max-height: 90vh;
    }
    .modal-overlay {
        padding: 20px 8px;
    }
    .brand-text {
        display: none;
    }
    .brand-emoji {
        margin-right: 0;
    }
    .user-badge .username {
        display: none;
    }
    .btn-signup {
        display: none;
    }
    .home-signup {
        display: block;
    }
}

.mobile-menu-btn {
    display: none;
    font-size: 1.4rem;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-primary);
    padding: 6px;
}

/* ── Utility ── */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.gap-8 { gap: 8px; }
.hidden { display: none !important; }

/* ── Notification toast ── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 3000;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    color: var(--text-primary);
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 340px;
}
.toast.show {
    transform: translateY(0);
    opacity: 1;
}
.toast.success {
    border-left: 4px solid var(--success);
}
.toast.error {
    border-left: 4px solid var(--danger);
}

/* ── Save / heart button ── */
.save-btn {
    font-size: 0.95rem;
    cursor: pointer;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    transition: background var(--transition), border-color var(--transition);
    color: var(--text-primary);
    white-space: nowrap;
}
.save-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-muted);
}
.save-btn .btn-emoji {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 1.1rem;
}
.save-btn:hover .btn-emoji {
    transform: scale(1.3);
}

/* ── Admin form in modal ── */
.admin-form .form-group {
    margin-bottom: 12px;
}
.admin-form textarea {
    width: 100%;
    min-height: 120px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    resize: vertical;
}
.admin-form textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}

/* Scrollbar styling for modal */
.modal::-webkit-scrollbar {
    width: 6px;
}
.modal::-webkit-scrollbar-track {
    background: transparent;
}
.modal::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
