/* ============================================================
   CSS Variables
   ============================================================ */
:root {
    --bg: #f0f4e8;
    --bg-card: #ffffff;
    --primary: #22c55e;
    --primary-hover: #16a34a;
    --primary-light: #dcfce7;
    --sidebar-width: 240px;
    --text: #1a1a1a;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Inter', system-ui, -apple-system, sans-serif;
}

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

html { font-size: 16px; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img, svg { display: block; }

/* ============================================================
   Layout — no-sidebar (auth pages)
   ============================================================ */
body.no-sidebar {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

/* ============================================================
   Layout — with-sidebar (app pages)
   ============================================================ */
body.with-sidebar .app-layout {
    display: flex;
    min-height: 100vh;
}

body.with-sidebar .main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px;
    max-width: 1200px;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 16px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-footer {
    padding: 8px;
    border-top: 1px solid var(--border);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background .15s, color .15s;
    text-decoration: none;
}

.nav-item:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--primary-light); color: var(--primary); }
.nav-item.active svg { stroke: var(--primary); }

.nav-item svg { flex-shrink: 0; }

/* Admin nav item */
.nav-item-admin { color: #7c3aed; }
.nav-item-admin svg { stroke: #7c3aed; }
.nav-item-admin:hover { background: #f5f3ff; color: #6d28d9; }
.nav-item-admin.active { background: #ede9fe; color: #6d28d9; }
.nav-item-admin.active svg { stroke: #6d28d9; }

.nav-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 8px;
}

/* Chevron */
.chevron { margin-left: auto; transition: transform .2s; }
.nav-group.open .chevron { transform: rotate(180deg); }

/* Submenu */
.nav-submenu {
    display: none;
    padding-left: 32px;
    gap: 2px;
    flex-direction: column;
}
.nav-group.open .nav-submenu { display: flex; }

.nav-subitem {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: .875rem;
    font-weight: 500;
    transition: background .15s, color .15s;
}
.nav-subitem:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.nav-subitem.active { background: var(--primary-light); color: var(--primary); }

/* Hamburger — hidden on desktop */
.hamburger {
    display: none;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 200;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}
.hamburger span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 99;
}
.sidebar-overlay.visible { display: block; }

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 9999px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background .15s, transform .1s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); color: #fff; }

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

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-light); color: var(--primary); }

.btn-danger {
    background: #fee2e2;
    color: #dc2626;
}
.btn-danger:hover { background: #fca5a5; }

.btn-lg {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
    font-size: 1rem;
    border-radius: 9999px;
}

.btn-sm { padding: 6px 14px; font-size: .8rem; }

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.recipe-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    cursor: pointer;
    transition: box-shadow .2s, transform .2s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.recipe-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.recipe-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.recipe-card-desc {
    font-size: .875rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recipe-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-private  { background: #f3f4f6; color: #6b7280; }
.badge-community{ background: #ede9fe; color: #7c3aed; }
.badge-public   { background: var(--primary-light); color: var(--primary); }

/* ============================================================
   Forms
   ============================================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.form-label {
    font-size: .875rem;
    font-weight: 500;
    color: var(--text);
}

.form-control {
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-family: var(--font);
    background: #fff;
    color: var(--text);
    transition: border-color .15s;
    width: 100%;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control { cursor: pointer; }

/* ============================================================
   Login / Auth Pages
   ============================================================ */
.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    gap: 24px;
    padding: 48px 16px;
    box-sizing: border-box;
}

.auth-hero {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card-wrap {
    width: 100%;
    display: flex;
    justify-content: center;
}

.auth-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 32px;
    width: 100%;
    max-width: 420px;
}

.auth-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
    font-size: .875rem;
}

.auth-divider {
    color: var(--border);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    font-size: .9rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}
.form-check input[type="checkbox"] {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.form-check label { cursor: pointer; }

/* Potato SVG */
.potato-mascot {
    width: 180px;
    height: 180px;
}

/* ============================================================
   Recipe Detail
   ============================================================ */
.recipe-detail-header {
    margin-bottom: 24px;
}

.recipe-detail-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.recipe-detail-desc {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 16px;
}

.recipe-detail-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.ingredients-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.ingredients-table th {
    text-align: left;
    padding: 8px 12px;
    background: var(--bg);
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}

.ingredients-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}

.ingredients-table tr:last-child td { border-bottom: none; }

.instructions-text {
    white-space: pre-line;
    font-size: .9rem;
    color: var(--text);
    line-height: 1.8;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .875rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-weight: 500;
    transition: color .15s;
}
.back-btn:hover { color: var(--text); text-decoration: none; }
.back-btn svg { stroke: currentColor; }

/* ============================================================
   Recipe Form
   ============================================================ */
.ingredient-row {
    display: grid;
    grid-template-columns: 1fr 120px 160px 40px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.ingredient-row .btn-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: #fee2e2;
    border: none;
    cursor: pointer;
    color: #dc2626;
    font-size: 1.2rem;
    line-height: 1;
    transition: background .15s;
    flex-shrink: 0;
}
.ingredient-row .btn-remove:hover { background: #fca5a5; }

/* ============================================================
   Shopping List
   ============================================================ */
.shopping-list-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.shopping-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
}

/* Item content — wraps name row + note text + note editor */
.item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.item-name-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.shopping-item-name {
    flex: 1;
    font-size: .9rem;
    font-weight: 500;
    color: var(--text);
    min-width: 0;
    word-break: break-word;
}

/* Note icon button */
.note-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: color .15s, background .15s;
    padding: 0;
}

.note-icon-btn:hover,
.note-icon-btn.active {
    color: var(--primary);
    background: var(--primary-light);
}

/* Note text (displayed below item name) */
.item-note {
    font-size: .78rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.3;
    word-break: break-word;
}

/* Inline note editor */
.note-editor {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.note-input {
    flex: 1;
    font-size: .8rem;
    font-family: inherit;
    border: 1.5px solid var(--primary);
    border-radius: 6px;
    padding: 4px 8px;
    outline: none;
    color: var(--text);
    background: #fff;
    min-width: 0;
}

.note-save-btn {
    font-size: .75rem;
    font-family: inherit;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s;
    flex-shrink: 0;
    line-height: 1.4;
}

.note-save-btn:hover {
    background: var(--primary-hover);
}

.note-cancel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    font-size: .85rem;
    padding: 0;
    flex-shrink: 0;
    transition: color .15s, background .15s;
    line-height: 1;
}

.note-cancel-btn:hover {
    color: #dc2626;
    background: #fee2e2;
}

/* Secondary controls row — holds unit toggle + delete on desktop, expands on mobile */
.item-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Mobile inline note input — hidden on desktop, shown inside expanded row on mobile */
.note-inline-input {
    display: none;
}

/* Unit hint shown in qty-controls on mobile only */
.qty-unit-hint {
    display: none;
}

.shopping-item.picked {
    opacity: .6;
}

.shopping-item.picked .shopping-item-name {
    color: #6b7280 !important;
    text-decoration: line-through !important;
}

.item-check {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.qty-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1.5px solid #d1d5db;
    border-radius: 50%;
    background: #fff;
    color: #374151;
    font-size: .95rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s, background .15s, color .15s;
    padding: 0;
    user-select: none;
}

.qty-btn:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.qty-display {
    min-width: 28px;
    width: 40px;
    text-align: center;
    font-size: .9rem;
    font-weight: 600;
    color: var(--text);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    outline: none;
    padding: 0 2px;
    border-radius: 0;
    cursor: text;
    -moz-appearance: textfield;
    transition: border-color .15s;
}
.qty-display::-webkit-outer-spin-button,
.qty-display::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.qty-display:hover {
    border-bottom-color: #9ca3af;
}
.qty-display:focus {
    border-bottom-color: var(--primary);
}

/* Unit segmented control — iOS-style pill */
.unit-toggle {
    display: inline-flex;
    background: #f3f4f6;
    border-radius: 7px;
    padding: 2px;
    gap: 1px;
    flex-shrink: 0;
}

.unit-btn {
    border: none;
    background: transparent;
    font-size: .72rem;
    font-family: inherit;
    font-weight: 500;
    padding: 3px 6px;
    border-radius: 5px;
    cursor: pointer;
    color: #6b7280;
    transition: background .15s, color .15s, box-shadow .15s;
    line-height: 1.3;
    white-space: nowrap;
    user-select: none;
}

.unit-btn.active {
    background: #fff;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,.12);
}

.unit-btn:hover:not(.active) {
    color: var(--text);
}

.btn-icon-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s, color .15s;
    padding: 0;
}

.btn-icon-remove:hover {
    background: #fee2e2;
    color: #dc2626;
}

/* Legacy shopping category styles (kept for recipe integrations) */
.shopping-category {
    margin-bottom: 24px;
}

.shopping-category-title {
    font-size: .8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    padding: 8px 0 6px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 8px;
}

.shopping-item-amount {
    font-size: .85rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.shopping-item-recipe {
    font-size: .75rem;
    background: var(--bg);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 9999px;
    white-space: nowrap;
}

/* ============================================================
   Modal dialog
   ============================================================ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-box {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
    padding: 28px 24px 22px;
    max-width: 360px;
    width: 100%;
    animation: modalIn .15s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.95) translateY(-8px); }
    to   { opacity: 1; transform: scale(1)   translateY(0);    }
}

.modal-message {
    font-size: .95rem;
    color: var(--text);
    margin-bottom: 22px;
    line-height: 1.5;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* ============================================================
   Admin pages
   ============================================================ */

/* Inline inputs inside admin tables */
.admin-inline-input {
    font-size: .85rem;
    font-family: inherit;
    border: 1.5px solid var(--primary);
    border-radius: 6px;
    padding: 4px 8px;
    outline: none;
    color: var(--text);
    background: #fff;
    width: 100%;
    box-sizing: border-box;
}
.admin-inline-input:focus { border-color: var(--primary-hover); }

/* Category section heading in ingredients list */
.ing-category-section { margin-bottom: 28px; }
.ing-category-title {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    padding: 0 0 6px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 0;
}
.ing-category-empty {
    padding: 12px 14px;
    color: var(--text-muted);
    font-size: .85rem;
    font-style: italic;
}

/* "＋ Naujas produktas" link-style button at bottom of each category table */
.cat-add-link {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 700;
    font-size: .875rem;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    transition: color .15s;
}
.cat-add-link:hover { color: var(--primary-hover); text-decoration: underline; }

/* Quick-access cards on admin overview */
.admin-section-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow .15s, transform .15s;
}
.admin-section-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    text-decoration: none;
    color: var(--text);
}
.admin-section-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Admin data table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.admin-table thead tr {
    border-bottom: 2px solid var(--border);
    background: var(--bg);
}
.admin-table th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
.admin-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover { background: var(--bg); }
.admin-table-muted { color: var(--text-muted); }

/* Category list */
.cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: background .1s;
    cursor: default;
}
.cat-row:last-child { border-bottom: none; }
.cat-row:hover { background: var(--bg); }
.cat-row.dragging { opacity: .4; }
.cat-row.drag-over { background: var(--primary-light); }

.cat-drag-handle {
    color: #d1d5db;
    cursor: grab;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    user-select: none;
}
.cat-drag-handle:active { cursor: grabbing; }
.cat-drag-handle:hover  { color: var(--text-muted); }

.cat-name {
    flex: 1;
    font-size: .9rem;
    font-weight: 500;
}

.cat-editor {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
}

.cat-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.cat-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    transition: background .15s, color .15s;
    padding: 0;
}
.cat-action-btn:hover { background: var(--bg); color: var(--text); }
.cat-delete-btn:hover { background: #fee2e2; color: #dc2626; }

/* ============================================================
   Communities
   ============================================================ */
.community-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow .2s, transform .2s;
}
.community-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.community-card-name {
    font-size: 1rem;
    font-weight: 600;
}

.community-card-desc {
    font-size: .875rem;
    color: var(--text-muted);
    flex: 1;
}

.community-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.community-members {
    font-size: .8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ============================================================
   Empty State
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: .5;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 6px;
    color: var(--text);
}

/* ============================================================
   Alerts & Flash Messages
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    margin-bottom: 16px;
    line-height: 1.5;
}
.alert-error  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success{ background: var(--primary-light); color: #166534; border: 1px solid #86efac; }
.alert-info   { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ============================================================
   Password Rules
   ============================================================ */
.password-rules {
    list-style: none;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.password-rules li {
    font-size: .8rem;
    color: var(--text-muted);
    padding-left: 20px;
    position: relative;
}

.password-rules li::before {
    content: '○';
    position: absolute;
    left: 0;
    color: var(--text-muted);
}

.password-rules li.rule-ok {
    color: #166534;
}
.password-rules li.rule-ok::before {
    content: '✓';
    color: var(--primary);
}

.password-rules li.rule-fail {
    color: #991b1b;
}
.password-rules li.rule-fail::before {
    content: '✗';
    color: #dc2626;
}

.match-msg {
    font-size: .8rem;
    margin-top: 5px;
}
.match-ok   { color: #166534; }
.match-fail { color: #991b1b; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .hamburger { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
    }
    .sidebar.open { transform: translateX(0); }

    body.with-sidebar .main-content {
        margin-left: 0;
        padding: 20px 16px;
        padding-top: 64px;
    }

    .ingredient-row {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto auto;
    }
    .ingredient-row .btn-remove {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    .card-grid { grid-template-columns: 1fr; }

    .recipe-detail-actions { flex-direction: column; }
    .recipe-detail-actions .btn { justify-content: center; }

    .auth-card { padding: 24px 20px; }
    .potato-mascot { width: 130px; height: 130px; }

    .cookie-banner { flex-direction: column; align-items: flex-start; gap: 12px; }
    .cookie-banner-actions { width: 100%; }

    /* ── Shopping list responsive ── */
    .shopping-item {
        flex-wrap: wrap;
        gap: 6px 8px;
        cursor: pointer;
        /* keep row 1 items vertically centred */
        align-items: center;
    }
    /* Hide desktop-only note chrome on mobile */
    .note-icon-btn,
    .note-editor { display: none !important; }
    /* Note text stays visible on mobile when present — tappable to edit */
    .item-note {
        cursor: pointer;
        padding: 1px 0;
        border-bottom: 1px dashed #d1d5db;
        display: inline-block; /* so dashed underline only spans text width */
    }
    /* Hide the display-only note text once the editable row is open */
    .shopping-item.expanded .item-note {
        display: none !important;
    }
    /* Secondary row: full width, hidden until expanded */
    .item-secondary {
        flex: 0 0 100%;
        display: none;
        padding-top: 8px;
        border-top: 1px solid var(--border);
        gap: 8px;
        align-items: center;
    }
    .shopping-item.expanded .item-secondary { display: flex; }
    /* Inline note input shown in expanded row */
    .note-inline-input {
        display: block;
        flex: 1;
        font-size: .82rem;
        font-family: inherit;
        border: 1.5px solid var(--border);
        border-radius: 6px;
        padding: 5px 8px;
        outline: none;
        color: var(--text);
        background: #fff;
        min-width: 0;
        transition: border-color .15s;
        cursor: text;
    }
    .note-inline-input:focus { border-color: var(--primary); }
    /* Qty controls — push to right on mobile */
    .qty-controls { margin-left: auto; }
    /* Unit hint — small muted label before the + button */
    .qty-unit-hint {
        display: inline-block;
        font-size: .72rem;
        color: var(--text-muted);
        margin-right: 2px;
        user-select: none;
    }
}

/* ============================================================
   Form hint
   ============================================================ */
.form-hint {
    font-size: .8rem;
    color: var(--text-muted);
    margin-top: 5px;
    margin-bottom: 0;
}

/* ============================================================
   Settings Page
   ============================================================ */
.settings-page {
    max-width: 640px;
}
.settings-top {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 20px;
}
.settings-top .page-title {
    margin: 0 !important;
}
.settings-section {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 0 28px;
    margin-bottom: 24px;
}
.settings-section-title {
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    padding: 16px 0 12px;
    border-bottom: 1px solid #efefef;
    margin: 0;
}
.settings-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 24px;
    padding: 13px 0;
    border-bottom: 1px solid #f5f5f5;
}
.settings-row:last-child {
    border-bottom: none;
}
.settings-label {
    width: 220px;
    min-width: 220px;
    font-size: .9rem;
    color: var(--text);
    font-weight: 500;
    margin: 0;
}
.settings-input {
    width: 260px;
    min-width: 0;
    flex-shrink: 0;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-family: var(--font);
    background: #fff;
    color: var(--text);
    transition: border-color .15s;
    box-sizing: border-box;
}
.settings-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}
/* ============================================================
   Cookie Banner
   ============================================================ */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 12px rgba(0,0,0,.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 24px;
    font-size: .875rem;
    color: var(--text);
}
.cookie-banner p { margin: 0; flex: 1; color: var(--text-muted); }
.cookie-banner-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    white-space: nowrap;
    flex-shrink: 0;
}
.cookie-banner-actions .btn { padding: 8px 20px; font-size: .875rem; }

/* ============================================================
   Cookie Policy Page
   ============================================================ */
.cookie-policy-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 48px 24px;
}
.cookie-policy-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.cookie-policy-updated {
    font-size: .875rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}
.cookie-policy-card h2 {
    font-size: 1rem;
    font-weight: 600;
    margin: 24px 0 8px;
}
.cookie-policy-card p, .cookie-policy-card li {
    font-size: .9rem;
    color: var(--text);
    line-height: 1.7;
}
.cookie-policy-card ul { padding-left: 20px; margin: 8px 0; }
.cookie-policy-card hr { border: none; border-top: 1px solid #e5e7eb; margin: 20px 0; }
