/* Family Recipe Book - Styles */

/* ============================================================
   THEME SYSTEM
   All colors are CSS custom properties. The active theme is
   set by [data-theme] on <html>. "aurora" is the default.
   Switching themes only changes these variables — every button,
   card, and nav item inherits them automatically.
   ============================================================ */

:root,
[data-theme="aurora"] {
    /* Brand / interactive */
    --primary-color: #00c8a8;       /* aurora teal  — CTA buttons, active nav */
    --primary-hover: #00a88c;       /* button hover */
    --primary-text: #0d1b2a;        /* text ON primary buttons */
    --secondary-color: #3dca60;     /* aurora green — publish / success actions */
    --accent-color: #7b2fbe;        /* aurora violet — badges, highlights */
    --error-color: #e85a0a;         /* aurora orange — danger / delete */
    --success-color: #3dca60;

    /* Sticky page header height — sticky panels / scroll-margin clear the banner */
    --app-header-offset: 5.75rem;

    /* Surfaces */
    --dark-color: #0d1b2a;          /* body text */
    --light-color: #e8f2f8;         /* page background */
    --card-bg: #f5f9fc;             /* card / panel background — subtle aurora blue tint */
    --input-bg: #ffffff;            /* form inputs stay white for readability */
    --border-color: #d1dce8;
    --text-muted: #6b7280;          /* secondary / helper text */
    --text-secondary: #374151;      /* body-level secondary text (list items, descriptions) */
    --warning-color: #b45309;      /* amber text on warning surfaces */
    --warning-bg: #fef3c7;         /* amber tinted surface */
    --info-color: #1d4ed8;         /* blue text on info surfaces */
    --info-bg: #dbeafe;            /* blue tinted surface */
    --success-bg: #d1fae5;         /* green tinted surface */
    --error-hover: #c2410c;        /* darker shade for error button hover */
    --surface-nested: #ddeaf5;      /* inset boxes inside a card — noticeably aurora blue */

    /* Navigation */
    --nav-bg: #0d1b2a;              /* sidebar body */
    --nav-text: #dceee8;            /* sidebar text */
    --nav-accent: #00c8a8;          /* active/hover accent */
    --nav-hover-bg: rgba(0,200,168,0.12);
    --nav-active-bg: rgba(0,200,168,0.18);
    --nav-border: rgba(255,255,255,0.08);

    /* Header (banner fallback gradient if image fails) */
    --gradient-start: #0d1b2a;
    --gradient-end: #0d3b30;
}

[data-theme="light"] {
    --primary-color: #4a90e2;
    --primary-hover: #357abd;
    --primary-text: #ffffff;
    --secondary-color: #6c757d;
    --accent-color: #7b2fbe;
    --error-color: #dc3545;
    --success-color: #28a745;

    --dark-color: #212529;
    --light-color: #f8f9fa;
    --card-bg: #ffffff;
    --input-bg: #ffffff;
    --border-color: #dee2e6;
    --text-muted: #6c757d;
    --text-secondary: #495057;      /* body-level secondary text */
    --warning-color: #92400e;
    --warning-bg: #fef3c7;
    --info-color: #1e40af;
    --info-bg: #dbeafe;
    --success-bg: #d1fae5;
    --error-hover: #b91c1c;
    --surface-nested: #f8f9fa;

    --nav-bg: #ffffff;
    --nav-text: #343a40;
    --nav-accent: #4a90e2;
    --nav-hover-bg: rgba(74,144,226,0.08);
    --nav-active-bg: rgba(74,144,226,0.15);
    --nav-border: #dee2e6;

    --gradient-start: #4a90e2;
    --gradient-end: #764ba2;
}

[data-theme="dark"] {
    --primary-color: #00c8a8;
    --primary-hover: #00a88c;
    --primary-text: #0d1b2a;
    --secondary-color: #3dca60;
    --accent-color: #9b59b6;
    --error-color: #f97316;
    --success-color: #3dca60;

    --dark-color: #e2e8f0;          /* text becomes light */
    --light-color: #1e293b;         /* page bg becomes dark */
    --card-bg: #273549;             /* cards are dark */
    --input-bg: #1e293b;
    --border-color: #334155;
    --text-muted: #94a3b8;          /* lighter muted for dark surfaces */
    --text-secondary: #cbd5e1;      /* body-level secondary text (light on dark) */
    --warning-color: #fbbf24;      /* bright amber readable on dark */
    --warning-bg: rgba(251,191,36,0.15);
    --info-color: #60a5fa;         /* bright blue readable on dark */
    --info-bg: rgba(96,165,250,0.15);
    --success-bg: rgba(61,202,96,0.15);
    --error-hover: #fb923c;
    --surface-nested: #1e293b;      /* inset boxes go darker than card in dark mode */

    --nav-bg: #0f172a;
    --nav-text: #e2e8f0;
    --nav-accent: #00c8a8;
    --nav-hover-bg: rgba(0,200,168,0.12);
    --nav-active-bg: rgba(0,200,168,0.20);
    --nav-border: rgba(255,255,255,0.06);

    --gradient-start: #0f172a;
    --gradient-end: #1e3a3a;
}

[data-theme="dark-hc"] {
    --primary-color: #00ffcc;
    --primary-hover: #00ddaa;
    --primary-text: #000000;
    --secondary-color: #60a5fa;
    --accent-color: #c084fc;
    --error-color: #fb923c;
    --success-color: #4ade80;

    --dark-color: #ffffff;
    --light-color: #000000;
    --card-bg: #111111;
    --input-bg: #111111;
    --border-color: #6b7280;
    --text-muted: #9ca3af;
    --text-secondary: #d1d5db;      /* body-level secondary text (high contrast on black) */
    --warning-color: #fde68a;
    --warning-bg: rgba(253,230,138,0.15);
    --info-color: #93c5fd;
    --info-bg: rgba(147,197,253,0.15);
    --success-bg: rgba(74,222,128,0.15);
    --error-hover: #fb923c;
    --surface-nested: #1a1a1a;

    --nav-bg: #000000;
    --nav-text: #ffffff;
    --nav-accent: #00ffcc;
    --nav-hover-bg: rgba(0,255,204,0.15);
    --nav-active-bg: rgba(0,255,204,0.25);
    --nav-border: #6b7280;

    --gradient-start: #000000;
    --gradient-end: #0a1628;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-color);
    min-height: 100vh;
    padding: 0;
    color: var(--dark-color);
}

/* Global input theming — inherits from active theme so all inputs
   adapt to Dark / Dark HC without touching each one individually */
input:not([type="color"]):not([type="range"]):not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    background: var(--input-bg);
    color: var(--dark-color);
    border-color: var(--border-color);
}

.container {
    max-width: 100%;
    margin: 0;
}

/* Header */
header {
    text-align: center;
    color: white;
    margin-bottom: 0;
    padding: 14px 20px 10px;
    position: sticky;
    top: 0;
    z-index: 998;
    /* Banner image with a dark scrim so text stays readable.
       On wide screens the center of the image (colorful aurora) shows.
       On mobile we shift the focal point slightly right where the
       warm orange/green aurora is more vivid than the dark left edge. */
    background:
        linear-gradient(to bottom, rgba(13,27,42,0.35) 0%, rgba(13,27,42,0.55) 100%),
        url('/static/branding/Banner.png') center 38% / cover no-repeat,
        linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
}

@media (max-width: 767px) {
    header {
        background:
            linear-gradient(to bottom, rgba(13,27,42,0.35) 0%, rgba(13,27,42,0.55) 100%),
            url('/static/branding/Banner.png') 58% 38% / cover no-repeat,
            linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    }
}

header h1 {
    font-size: 1.8em;
    margin-bottom: 4px;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.6);
}

.tagline {
    font-size: 1em;
    opacity: 0.95;
    margin-bottom: 0;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* User Info in Header */
.user-info {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.15);
    padding: 10px 20px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
}

.user-info span {
    font-weight: 500;
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.85em;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
}

.btn-small:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ==================== AUTHENTICATION VIEWS ==================== */

.auth-view {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 40px 20px;
}

.auth-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 0;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-tabs {
    display: flex;
    background: var(--light-color);
}

.auth-tab {
    flex: 1;
    padding: 18px;
    border: none;
    background: transparent;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-muted);
    position: relative;
}

.auth-tab.active {
    background: var(--card-bg);
    color: var(--primary-color);
}

.auth-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

.auth-form {
    padding: 40px;
}

.auth-form h2 {
    color: var(--dark-color);
    margin-bottom: 8px;
    font-size: 1.8em;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.auth-error {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid var(--error-color);
    color: var(--error-color);
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95em;
}

.auth-success {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid var(--success-color);
    color: var(--success-color);
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.95em;
}

.btn-full {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    margin-top: 10px;
}

.auth-footer {
    text-align: center;
    margin-top: 25px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* Registration Type Toggle */
.register-type-toggle {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.toggle-btn {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    background: var(--light-color);
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: all 0.3s ease;
    color: var(--text-muted);
}

.toggle-btn:hover {
    border-color: var(--secondary-color);
    background: var(--card-bg);
}

.toggle-btn.active {
    border-color: var(--primary-color);
    background: var(--nav-active-bg);
    color: var(--primary-color);
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 0.85em;
    color: var(--text-muted, #888);
}

/* ==================== DASHBOARD ==================== */

.dashboard-total-label {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 12px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    font-size: 3em;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 15px;
}

.stat-content {
    flex: 1;
}

.stat-number {
    font-size: 2.5em;
    font-weight: 700;
    color: var(--dark-color);
    line-height: 1;
}

.stat-label {
    color: var(--text-muted, #666);
    font-size: 1em;
    margin-top: 5px;
}

.stat-sub {
    font-size: 0.8em;
    color: var(--text-muted, #888);
    margin-top: 4px;
}

.stat-number-sm {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--dark-color);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-weather-row {
    margin-bottom: 20px;
}

.dashboard-weather-row .weather-card {
    cursor: default;
}

/* ── Weather card ────────────────────────────────────────── */
.weather-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 16px 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    /* Three panels that wrap: current | hourly | daily */
    display: flex;
    flex-wrap: wrap;
    gap: 14px 0;
    align-items: center;
}

/* Current conditions panel */
.weather-current {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 0 0 auto;
    padding-right: 20px;
    border-right: 1px solid var(--border-color);
    align-self: stretch;
    align-items: center;
}

/* Hourly + daily panels */
.weather-hourly-section,
.weather-daily-section {
    border-top: none;
    margin-top: 0;
    padding-top: 0;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.weather-hourly-section {
    flex: 1 1 220px;
    padding-right: 20px;
    border-right: 1px solid var(--border-color);
    align-self: stretch;
    justify-content: center;
}

.weather-daily-section {
    flex: 1 1 160px;
}

.weather-icon-big {
    font-size: 3em;
    line-height: 1;
    flex-shrink: 0;
}

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

.weather-temp-big {
    font-size: 2em;
    font-weight: 700;
    color: var(--dark-color);
    line-height: 1.1;
}

.weather-desc {
    font-size: 0.95em;
    color: var(--text-muted);
    margin-top: 2px;
}

.weather-location {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-top: 4px;
}

.weather-section-label {
    font-size: 0.78em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 8px;
}

.weather-hourly-strip {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
}

.hour-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    min-width: 52px;
    padding: 6px 8px;
    border-radius: 10px;
    background: transparent;
    text-align: center;
    flex-shrink: 0;
}

.hour-cell-now {
    background: color-mix(in srgb, var(--primary-color) 12%, transparent);
}

.hour-time {
    font-size: 0.74em;
    color: var(--text-muted);
    white-space: nowrap;
}

.hour-cell-now .hour-time {
    color: var(--primary-color);
    font-weight: 600;
}

.hour-icon {
    font-size: 1.3em;
    line-height: 1;
}

.hour-temp {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--dark-color);
}

.hour-precip {
    font-size: 0.7em;
    color: #4a90e2;
    background: rgba(74, 144, 226, 0.12);
    border-radius: 6px;
    padding: 1px 5px;
    white-space: nowrap;
}

.weather-daily-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.day-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.day-icon {
    font-size: 1.5em;
    line-height: 1;
    width: 30px;
    text-align: center;
    flex-shrink: 0;
}

.day-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.day-name {
    font-size: 0.9em;
    color: var(--dark-color);
    min-width: 70px;
}

.day-range {
    display: flex;
    gap: 6px;
    font-size: 0.88em;
    font-weight: 600;
}

.day-hi {
    color: var(--dark-color);
}

.day-lo {
    color: var(--text-muted);
}

/* ── Members card ────────────────────────────────────────── */
.members-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px 25px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.members-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.members-card .members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88em;
}

.members-card .member-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 700;
    flex-shrink: 0;
}

.member-avatar-private {
    background: var(--border-color) !important;
    color: var(--text-muted) !important;
}

.member-name-private {
    color: var(--text-muted) !important;
    font-style: italic;
}

.members-card .member-name {
    flex: 1;
    color: var(--dark-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-status {
    font-size: 0.82em;
    white-space: nowrap;
    flex-shrink: 0;
}

.member-status-active {
    color: var(--success-color);
    font-weight: 600;
}

.member-status-active::before {
    content: '● ';
    font-size: 0.7em;
}

.member-status-away {
    color: var(--text-muted);
}


.members-view-all {
    font-size: 0.82em;
    color: var(--primary-color);
    text-decoration: none;
    margin-top: auto;
    padding-top: 4px;
}

.members-view-all:hover {
    text-decoration: underline;
}

.dashboard-grid-insights,
.dashboard-grid-life {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card-wide {
    grid-column: span 2;
}

.category-top-list,
.event-list {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    font-size: 0.83em;
}

.category-top-list li,
.event-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
}

.category-top-list li:last-child,
.event-list li:last-child {
    border-bottom: none;
}

.cat-bucket-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 0.76em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 8px;
    padding-top: 6px;
    border-bottom: none !important;
    border-top: 1px solid var(--border-color);
}

.cat-bucket-header:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.cat-bucket-link {
    color: inherit;
    text-decoration: none;
}
.cat-bucket-link:hover {
    text-decoration: underline;
    opacity: 0.8;
}

.cat-bucket-total {
    font-weight: 400;
    font-size: 0.95em;
    text-transform: none;
    letter-spacing: 0;
}

/* ── Dashboard Suggestions Card ─────────────────────────────────── */
.dashboard-suggestions-row {
    margin-bottom: 20px;
}

.suggestions-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 16px 20px 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.suggestions-card-header {
    margin-bottom: 16px;
}

.suggestions-card-title {
    font-size: 1em;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 2px;
}

.suggestions-card-subtitle {
    font-size: 0.82em;
    color: var(--text-muted, var(--text-color));
    opacity: 0.75;
}

.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.suggestion-tile {
    background: var(--bg-color, var(--card-bg));
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
    border-radius: 10px;
    padding: 14px 16px;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.1s;
    min-height: 90px;
}

.suggestion-tile:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.13);
    transform: translateY(-1px);
}

.suggestion-tile-loading {
    background: var(--bg-color, var(--card-bg));
    animation: suggestion-shimmer 1.4s infinite;
}

@keyframes suggestion-shimmer {
    0%   { opacity: 0.5; }
    50%  { opacity: 0.9; }
    100% { opacity: 0.5; }
}

.suggestion-slot-label {
    font-size: 0.7em;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent-color, #5a7fa8);
    margin-bottom: 4px;
}

.suggestion-recipe-name {
    font-size: 0.95em;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.suggestion-category {
    display: inline-block;
    font-size: 0.72em;
    background: var(--tag-bg, rgba(90, 127, 168, 0.12));
    color: var(--tag-color, var(--accent-color, #5a7fa8));
    border-radius: 20px;
    padding: 2px 8px;
    margin-bottom: 4px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.suggestion-meta {
    font-size: 0.72em;
    color: var(--text-muted, var(--text-color));
    opacity: 0.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .suggestions-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Dashboard Category Card (full-width) ───────────────────────── */
.dashboard-category-row {
    margin-bottom: 20px;
}

.category-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 16px 20px 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.category-card-header {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 16px;
}

.category-card-icon {
    font-size: 1.4em;
    line-height: 1;
}

.category-card-total {
    font-size: 2em;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1;
}

.category-card-label {
    font-size: 0.9em;
    color: var(--text-muted, var(--text-color));
    opacity: 0.75;
}

/* Three-column group layout */
.category-card-groups {
    display: flex;
    flex-wrap: wrap;
}

.category-group {
    flex: 1 1 180px;
    padding: 0 20px;
    border-left: 1px solid var(--border-color);
}

.category-group:first-child {
    padding-left: 0;
    border-left: none;
}

.category-group:last-child {
    padding-right: 0;
}

/* Group header — FAMILY · N categories › */
.category-group-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.category-group-link {
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.6;
}

.category-group-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.category-group-count {
    font-size: 0.72em;
    font-weight: 400;
    color: var(--text-color);
    opacity: 0.5;
}

/* Scrollable category list — fixed height shows ~3 rows */
.category-group-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 96px;
    overflow-y: auto;
    font-size: 0.83em;
}

.category-group-list li {
    border-bottom: none;
    padding: 0;
}

.category-group-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--border-color);
    color: inherit;
    text-decoration: none;
    gap: 8px;
}

.category-group-row:last-child {
    border-bottom: none;
}

.category-group-row:hover .category-group-row-name {
    text-decoration: underline;
    opacity: 0.8;
}

.category-group-row-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-color);
}

.category-group-row-count {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--primary-color, var(--text-color));
}

/* Mobile: groups stack full-width */
@media (max-width: 600px) {
    .category-group {
        flex: 1 1 100%;
        padding: 12px 0 0;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .category-group:first-child {
        padding-top: 0;
        border-top: none;
    }
}

.cat-count {
    font-weight: 600;
    color: var(--primary-color);
}

.event-date {
    font-size: 0.85em;
    color: var(--text-muted, #888);
    white-space: nowrap;
    margin-left: 8px;
}

.card-loading {
    opacity: 0.5;
    font-style: italic;
    font-size: 0.9em;
}

.ticket-breakdown {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    font-size: 0.83em;
}

.ticket-breakdown li {
    display: flex;
    justify-content: space-between;
    padding: 3px 0;
}

.location-form-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 10px;
}

/* Add a Recipe */
.add-recipe-actions {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

.add-recipe-actions h3 {
    color: var(--dark-color);
    margin-bottom: 25px;
    font-size: 1.4em;
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    background: linear-gradient(135deg, var(--light-color) 0%, var(--surface-nested) 100%);
    border: 2px solid transparent;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.action-btn:hover {
    background: var(--nav-hover-bg);
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.action-icon {
    font-size: 2.5em;
    margin-bottom: 12px;
}

.action-text {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--dark-color);
}

/* Back Button */
.back-btn {
    background: none;
    border: none;
    color: var(--secondary-color);
    font-size: 1em;
    cursor: pointer;
    padding: 8px 0;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.back-btn:hover {
    color: var(--primary-color);
}

.card-header {
    margin-bottom: 20px;
}

.card-header h2 {
    margin-bottom: 0;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab {
    flex: 1;
    min-width: 150px;
    padding: 15px 20px;
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--secondary-color);
}

.tab:hover {
    background: var(--nav-hover-bg);
    transform: translateY(-2px);
}

.tab.active {
    background: var(--card-bg);
    font-weight: bold;
    color: var(--primary-color);
    border-color: var(--primary-color);
    border-bottom: 2px solid var(--card-bg);
}

/* Tab Content */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.card h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.6em;
}

.card h3 {
    color: var(--dark-color);
    margin: 30px 0 15px;
    font-size: 1.5em;
}

.card h4 {
    color: var(--secondary-color);
    margin-bottom: 15px;
}

/* Drop Zone */
/* Scan Type Selector */
.scan-type-selector {
    background: var(--light-color);
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
}

.scan-type-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
}

.smart-scans-badge {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
}

.smart-scans-badge.unlimited {
    background: linear-gradient(135deg, var(--success-color), var(--secondary-color));
}

.smart-scans-badge.exhausted {
    background: #9ca3af;
}

.scan-type-options {
    display: flex;
    gap: 10px;
}

.scan-type-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--input-bg);
    cursor: pointer;
    transition: all 0.2s ease;
}

.scan-type-btn:hover {
    border-color: var(--primary-color);
    background: var(--nav-hover-bg);
}

.scan-type-btn.active {
    border-color: var(--primary-color);
    background: var(--nav-active-bg);
}

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

.scan-icon {
    font-size: 1.5em;
    margin-bottom: 4px;
}

.scan-label {
    font-size: 0.9em;
    font-weight: 500;
}

.scan-type-desc {
    margin-top: 10px;
    font-size: 0.85em;
    color: var(--text-muted);
    text-align: center;
}

/* Update Available Banner */
#update-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--info-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 10px 20px;
    font-size: 0.95em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

#update-banner button {
    background: var(--card-bg);
    color: var(--info-color);
    border: none;
    border-radius: 5px;
    padding: 5px 14px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9em;
}

#update-banner button:hover {
    background: var(--info-bg);
}

#update-banner .dismiss {
    background: transparent;
    color: rgba(255,255,255,0.7);
    font-weight: 400;
    padding: 5px 8px;
    font-size: 1.1em;
}

#update-banner .dismiss:hover {
    color: #fff;
    background: transparent;
}

/* Scan Mode Banner */
.scan-mode-banner {
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.scan-mode-banner.smart {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.scan-mode-banner.basic {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.scan-mode-banner .banner-icon {
    font-size: 1.2em;
}

.scan-mode-banner .banner-text {
    flex: 1;
}

.scan-mode-banner .banner-text strong {
    display: block;
}

.scan-mode-banner .banner-text small {
    color: var(--text-muted);
}

.drop-zone {
    border: 3px dashed var(--border-color);
    border-radius: 10px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--light-color);
}

.drop-zone.drag-over {
    border-color: var(--primary-color);
    background: var(--nav-hover-bg);
}

.upload-icon {
    font-size: 4em;
    display: block;
    margin-bottom: 20px;
}

.drop-zone p {
    font-size: 1.2em;
    margin: 10px 0;
}

.or-text {
    color: var(--text-muted);
    font-style: italic;
}

/* Hide camera-capture button on non-touch devices (desktops/laptops).
   pointer:coarse targets touchscreens; pointer:fine targets mouse-driven devices. */
#camera-input-label {
    display: none;
}
@media (pointer: coarse) {
    #camera-input-label {
        display: inline-flex;
    }
}

.file-info {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-top: 15px;
}

/* Preview */
.preview-container {
    margin-top: 20px;
    position: relative;
}

.image-navigation-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.preview-container img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.image-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 28px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.image-nav-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.image-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.image-nav-btn.prev {
    left: -55px;
}

.image-nav-btn.next {
    right: -55px;
}

.image-nav-btn span {
    display: block;
    margin-top: -2px;
}

.multi-image-indicator {
    text-align: center;
    margin-top: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.hidden {
    display: none !important;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 5px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--primary-text);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,200,168,0.35);
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: var(--primary-text);
}

.btn-danger {
    background: var(--error-color);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: var(--error-hover);
}

.btn-reject {
    background: var(--error-color);
    color: white;
    border: none;
}

.btn-reject:hover {
    background: var(--error-hover);
}

.btn-large {
    padding: 15px 40px;
    font-size: 1.2em;
}

/* Status */
.status {
    text-align: center;
    padding: 30px;
}

.loader {
    border: 4px solid var(--light-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Progress List for Upload Status */
.progress-list {
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.progress-item {
    padding: 8px 12px;
    margin: 4px 0;
    background: var(--surface-nested);
    border-radius: 6px;
    font-size: 0.9em;
    line-height: 1.4;
    transition: all 0.2s ease;
    animation: slideIn 0.3s ease;
}

.progress-item:last-child {
    animation: slideIn 0.3s ease, pulse 0.5s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

/* Two Column Layout */
.two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 20px 0;
}

.column h4 {
    margin-bottom: 10px;
}

.result-image {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* OCR Comparison Grid */
.ocr-info {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 1.05em;
}

.image-preview-section {
    margin: 20px 0;
    text-align: center;
    background: var(--light-color);
    padding: 20px;
    border-radius: 10px;
}

.image-preview-section h4 {
    margin-bottom: 15px;
    color: var(--secondary-color);
}

.ocr-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
}

.ocr-result-card {
    background: var(--light-color);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.ocr-result-card:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.ocr-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.ocr-icon {
    font-size: 1.5em;
}

.ocr-header h4 {
    flex: 1;
    margin: 0;
    color: var(--dark-color);
    font-size: 1.1em;
}

.ocr-badge {
    padding: 4px 10px;
    border-radius: 5px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
}

.ocr-badge.free {
    background: var(--success-color);
    color: white;
}

.ocr-badge.premium {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
}

.ocr-badge.enhanced {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.ocr-textarea {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    resize: vertical;
    margin-bottom: 10px;
    flex: 1;
    background: var(--input-bg);
}

.btn-parse {
    width: 100%;
    font-size: 0.95em;
}

.parse-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
}

/* Forms */
.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.account-settings-limits-row.form-row {
    grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 900px) {
    .account-settings-limits-row.form-row {
        grid-template-columns: 1fr;
    }
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--dark-color);
    opacity: 0.75;
}

.form-section {
    margin-bottom: 30px;
    padding: 20px;
    background: var(--light-color);
    border-radius: 10px;
}

.ingredient-item,
.instruction-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.ingredient-item .ingredient-quantity {
    flex: 0 0 85px;
}

.ingredient-item .ingredient-unit {
    flex: 0 0 130px;
}

.ingredient-item .ingredient-name {
    flex: 3;
    min-width: 120px;
}

.ingredient-item .ingredient-prep {
    flex: 1;
    min-width: 80px;
}

.instruction-item .step-number {
    width: 50px;
    text-align: center;
    padding: 12px;
    background: var(--secondary-color);
    color: white;
    border-radius: 5px;
    font-weight: bold;
}

.instruction-item textarea {
    flex: 1;
}

/* Drag handle for ingredient and instruction reordering */
.ingredient-item .drag-handle,
.instruction-item .drag-handle {
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: var(--text-muted);
    font-size: 16px;
    letter-spacing: -2px;
    user-select: none;
    flex-shrink: 0;
}

.ingredient-item .drag-handle:hover,
.instruction-item .drag-handle:hover {
    color: var(--text-muted);
}

.ingredient-item .drag-handle:active,
.instruction-item .drag-handle:active {
    cursor: grabbing;
}

/* Drag-and-drop visual feedback */
.ingredient-item.dragging,
.instruction-item.dragging {
    opacity: 0.5;
    background: var(--surface-nested);
    border-radius: 5px;
}

.ingredient-item.drag-over,
.instruction-item.drag-over {
    border-top: 3px solid var(--primary-color);
    padding-top: 7px;
    margin-top: -3px;
}

.remove-btn {
    background: var(--error-color);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
}

.remove-btn:hover {
    background: var(--error-color);
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* Alerts */
.alert {
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
}

.alert-success {
    background: rgba(81, 207, 102, 0.1);
    border: 2px solid var(--success-color);
}

.alert-success h3 {
    color: var(--success-color);
}

/* Recipes Grid */
.recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.recipe-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    border-color: var(--primary-color);
}

.recipe-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
}

.recipe-card .category {
    display: inline-block;
    background: var(--secondary-color);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.recipe-card .source {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.9em;
}

.recipe-card .date {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 8px;
}

.recipe-card .image-count {
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 4px;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.status-badge.draft {
    background: var(--warning-bg);
    color: var(--warning-color);
}

/* ==================== FAMILY MANAGEMENT ==================== */

.family-section {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    margin-top: 20px;
}

.family-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.family-header h3 {
    color: var(--dark-color);
    margin: 0;
    font-size: 1.3em;
}

.members-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.member-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--light-color);
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.member-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.9em;
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95em;
}

.member-role {
    font-size: 0.8em;
    color: var(--text-muted, #888);
    text-transform: capitalize;
}

/* Invite Modal */
.modal-small {
    max-width: 450px;
}

.modal-subtitle {
    color: var(--text-muted);
    margin-bottom: 25px;
}

.invite-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: var(--light-color);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
}

.invite-code-display span {
    font-size: 1.8em;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 3px;
    color: var(--primary-color);
}

.invite-instructions {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95em;
    line-height: 1.5;
}

.invite-expiry {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 10px;
}

.invite-email-welcome {
    background: rgba(180, 83, 9, 0.08);
    border: 1px solid rgba(180, 83, 9, 0.25);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.invite-email-welcome p {
    margin: 0 0 8px;
    color: var(--text-secondary);
}

.invite-send-results {
    margin-bottom: 16px;
}

.invite-send-results .result-item {
    padding: 8px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    font-size: 0.9em;
}

.invite-send-results .result-success {
    background: rgba(81, 207, 102, 0.15);
    color: var(--success-color);
}

.invite-send-results .result-error {
    background: rgba(255, 107, 107, 0.15);
    color: var(--danger-color);
}

.invite-rows-header {
    display: grid;
    grid-template-columns: 1fr 140px 28px;
    gap: 8px;
    margin-bottom: 4px;
    padding: 0 2px;
}

.invite-rows-label {
    font-size: 0.85em;
    font-weight: 600;
    color: var(--text-secondary);
}

.invite-row {
    display: grid;
    grid-template-columns: 1fr 140px 28px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.invite-row .form-control {
    margin: 0;
}

.btn-remove-invite-row {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4em;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 38px;
}

.btn-remove-invite-row:hover {
    color: var(--danger-color);
}

.btn-add-invite-row {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.9em;
    cursor: pointer;
    padding: 4px 0 16px;
    display: block;
    text-align: left;
}

.btn-add-invite-row:hover {
    text-decoration: underline;
}

.invite-list-section {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.invite-list-section h3 {
    margin-bottom: 12px;
    font-size: 1.1em;
}

.invites-manager {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.invites-manager h4 {
    margin-bottom: 4px;
}

.invite-status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: capitalize;
}

.invite-status-pending {
    background: rgba(255, 193, 7, 0.2);
    color: var(--warning-color);
}

.invite-status-accepted {
    background: rgba(81, 207, 102, 0.2);
    color: var(--success-color);
}

.invite-status-expired,
.invite-status-cancelled {
    background: rgba(134, 142, 150, 0.2);
    color: var(--text-secondary);
}

.invite-actions {
    display: flex;
    gap: 6px;
}

.invite-list-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.invite-list-item:last-child {
    border-bottom: none;
}

.invite-list-item .invite-status-badge {
    margin-left: 8px;
}

/* Invite validation in registration form */
.invite-valid {
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(81, 207, 102, 0.15);
    border-radius: 6px;
    color: var(--success-color);
    font-size: 0.9em;
}

/* ==================== CREATE RECIPE - IMAGE UPLOADS ==================== */

.section-help {
    color: var(--text-muted, #666);
    font-size: 0.95em;
    margin-bottom: 20px;
}

.header-subtitle {
    color: var(--text-muted, #666);
    font-size: 0.95em;
    margin-top: 8px;
}

.image-upload-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 10px;
}

.image-upload-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.image-preview-box {
    width: 100%;
    aspect-ratio: 4/3;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--light-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

.image-preview-box:hover {
    border-color: var(--secondary-color);
    background: rgba(78, 205, 196, 0.05);
}

.image-preview-box.has-image {
    border-style: solid;
    border-color: var(--success-color);
}

.image-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-box .placeholder-icon {
    font-size: 2.5em;
    margin-bottom: 8px;
}

.image-preview-box .placeholder-text {
    font-size: 0.9em;
    color: var(--text-muted);
}

/* Recipe Images Gallery in Modal */
.recipe-images-gallery {
    display: flex;
    gap: 15px;
    margin: 20px 0;
    overflow-x: auto;
    padding-bottom: 10px;
}

.gallery-image {
    flex: 0 0 auto;
    width: 200px;
    position: relative;
}

.gallery-image img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.gallery-image .image-label {
    display: block;
    text-align: center;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ==================== SAVE ACTIONS ==================== */

.save-help {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9em;
    color: var(--text-muted);
    line-height: 1.6;
}

/* ==================== SELECT WITH ADD NEW ==================== */

.select-with-add {
    display: flex;
    gap: 8px;
    align-items: center;
}

.select-with-add select,
.select-with-add input {
    flex: 1;
}

.btn-add-new {
    width: 40px;
    height: 40px;
    border: 2px solid var(--secondary-color);
    background: var(--input-bg);
    color: var(--secondary-color);
    border-radius: 8px;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-add-new:hover:not(:disabled) {
    background: var(--secondary-color);
    color: white;
}

.btn-add-new:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-add-new.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ==================== FULL PAGE RECIPE VIEW ==================== */

.recipe-full-view {
    min-height: 60vh;
}

.recipe-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--light-color);
}

.recipe-header h1 {
    font-size: 2.2em;
    color: var(--dark-color);
    margin: 0;
}

.recipe-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.recipe-meta .meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95em;
    color: var(--text-muted);
}

.recipe-status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
}

.recipe-status-badge.draft {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.recipe-status-badge.published {
    background: rgba(81, 207, 102, 0.2);
    color: var(--success-color);
}

.recipe-status-badge.personal {
    background: var(--info-bg);
    color: var(--info-color);
}

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

.recipe-images-section {
    margin: 25px 0;
}

.recipe-image-navigation-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.recipe-main-image {
    width: 100%;
    max-height: 500px;
    object-fit: contain;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    background: var(--surface-nested);
}

.recipe-image-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 32px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.recipe-image-nav-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.recipe-image-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.recipe-image-nav-btn.prev {
    left: 10px;
}

.recipe-image-nav-btn.next {
    right: 10px;
}

.recipe-image-nav-btn span {
    display: block;
    margin-top: -2px;
}

.recipe-image-counter {
    text-align: center;
    margin: 12px 0;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.recipe-thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.recipe-thumbnail {
    width: 100px;
    height: 75px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
}

.recipe-thumbnail:hover,
.recipe-thumbnail.active {
    border-color: var(--primary-color);
}

.recipe-description {
    font-size: 1.1em;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 20px 0;
    padding: 20px;
    background: var(--light-color);
    border-radius: 10px;
    border-left: 4px solid var(--secondary-color);
}

.recipe-content-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
    margin-top: 25px;
}

.recipe-ingredients-section,
.recipe-instructions-section,
.recipe-nutrition-section,
.recipe-notes-section {
    background: var(--card-bg);
}

/* Section headers within ingredient/instruction lists */
.recipe-section-header {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 14px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

/* Compact inline button group (e.g. Add Ingredient + Add Section side-by-side) */
.btn-group-compact {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* Section divider row in editor */
.section-divider-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    margin: 8px 0 2px;
    border-top: 2px dashed var(--border-color);
}

.section-divider-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.section-divider-item .section-name-input {
    flex: 1;
    font-weight: 600;
}

.recipe-ingredients-section h3,
.recipe-instructions-section h3,
.recipe-nutrition-section h3,
.recipe-notes-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.4em;
}

.ingredients-list {
    list-style: none;
    padding: 0;
}

.ingredients-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
}

.ingredients-list li:last-child {
    border-bottom: none;
}

.ingredient-amount {
    font-weight: 600;
    color: var(--secondary-color);
    min-width: 80px;
}

.instructions-list {
    list-style: none;
    padding: 0;
    counter-reset: step;
}

.instructions-list li {
    padding: 15px 0 15px 60px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    line-height: 1.6;
}

.instructions-list li:last-child {
    border-bottom: none;
}

.instructions-list li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 15px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.nutrition-info,
.recipe-notes {
    padding: 15px;
    background: var(--surface-nested);
    border-left: 4px solid var(--primary-color);
    border-radius: 4px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.recipe-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 25px;
}

.recipe-tag {
    background: var(--light-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9em;
    color: var(--text-muted);
}

/* Similar Recipes Section */
.similar-recipes-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.similar-recipes-section h3 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.similar-recipes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.similar-recipe-card {
    background: var(--light-color);
    padding: 15px;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.similar-recipe-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.similar-recipe-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.similar-recipe-score {
    font-size: 0.85em;
    color: var(--primary-color);
}

.similarity-badge {
    background: var(--primary-color);
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    margin-left: 8px;
}

.ingredient-match-badge {
    display: block;
    background: var(--success-color);
    color: white;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.85em;
    margin-top: 8px;
}

/* Confirmation Modal */
.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

@media (max-width: 768px) {
    .recipe-content-grid {
        grid-template-columns: 1fr;
    }
    
    .recipe-header {
        flex-direction: column;
    }
    
    .recipe-actions {
        width: 100%;
    }
    
    .recipe-actions .btn {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .image-upload-grid {
        grid-template-columns: 1fr;
    }
    
    .image-preview-box {
        aspect-ratio: 16/9;
    }
    
    .gallery-image {
        width: 150px;
    }
    
    .gallery-image img {
        height: 110px;
    }
}

/* Search Box */
.search-box {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

.search-box .form-control {
    flex: 2;
}

.search-box select {
    flex: 1;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    color: var(--dark-color);
    padding: 30px;
    border-radius: 10px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2em;
    cursor: pointer;
    color: var(--text-muted);
}

.close:hover {
    color: var(--primary-color);
}

/* ==================== ADD IMAGE MODAL ==================== */

/* Hide modal by default and only show when create view is active */
#create-view:not(.active) .add-image-modal {
    display: none !important;
}

.add-image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.add-image-modal.active {
    display: flex;
    visibility: visible;
    opacity: 1;
}

.add-image-modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    position: relative;
}

.add-image-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
}

.add-image-modal-header h3 {
    margin: 0;
    font-size: 1.5em;
    color: var(--dark-color);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 2em;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close-btn:hover {
    background: var(--surface-nested);
    color: var(--primary-color);
}

.add-image-form-group {
    padding: 20px 25px;
}

.add-image-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark-color);
}

.add-image-form-group input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: var(--light-color);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.add-image-form-group input[type="file"]:hover {
    border-color: var(--secondary-color);
}

.add-image-form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1em;
    background: var(--input-bg);
    cursor: pointer;
}

.add-image-preview {
    margin-top: 15px;
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light-color);
    border-radius: 8px;
    border: 2px dashed var(--border-color);
    overflow: hidden;
}

.add-image-preview img {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    display: none;
}

.add-image-preview img[src]:not([src=""]) {
    display: block;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    padding: 20px 25px;
    border-top: 1px solid var(--border-color);
}

.btn-modal-cancel,
.btn-modal-upload {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-cancel {
    background: var(--surface-nested);
    color: var(--dark-color);
}

.btn-modal-cancel:hover {
    background: var(--light-color);
}

.btn-modal-upload {
    background: var(--primary-color);
    color: white;
}

.btn-modal-upload:hover {
    background: var(--error-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-modal-upload:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Recipe Image Management */
.recipe-image-management {
    margin-bottom: 20px;
}

.existing-images-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.existing-image-card {
    position: relative;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: var(--card-bg);
    transition: all 0.2s ease;
}

.existing-image-card:hover {
    border-color: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.existing-image-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.existing-image-card-info {
    padding: 10px;
    background: var(--light-color);
}

.existing-image-card-type {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.existing-image-card-actions {
    display: flex;
    gap: 5px;
}

.existing-image-card-actions button {
    flex: 1;
    padding: 5px;
    border: none;
    border-radius: 4px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.existing-image-card-delete {
    background: var(--error-color);
    color: white;
}

.existing-image-card-delete:hover {
    background: var(--error-hover);
}

.existing-images-order-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0 8px;
    width: 100%;
}

.existing-image-card-order {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    font-size: 0.85em;
}

.existing-image-card-order label {
    font-weight: 600;
    color: var(--text-muted);
}

.existing-image-card-order input {
    width: 50px;
    padding: 4px 6px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
    font-size: 0.9em;
}

.images-reorder-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
    padding-top: 15px;
    border-top: 2px solid var(--border-color);
}

.btn-update-order {
    padding: 10px 20px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-update-order:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(78, 205, 196, 0.3);
}

.btn-update-order:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.add-image-btn {
    width: 100%;
    padding: 30px;
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    background: var(--light-color);
    color: var(--dark-color);
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.add-image-btn:hover {
    border-color: var(--secondary-color);
    background: var(--surface-nested);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ==================== ORIGINAL RECIPE CARDS SECTION ==================== */

.original-cards-section {
    background: var(--surface-nested);
    border: 2px solid var(--accent-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
}

.original-cards-gallery {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    min-height: 300px;
}

.original-card-display {
    flex: 1;
    max-width: 600px;
    text-align: center;
}

.original-card-display img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    cursor: zoom-in;
    transition: transform 0.2s ease;
}

.original-card-display img:hover {
    transform: scale(1.02);
}

.original-card-counter {
    margin-top: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.card-nav-btn {
    background: rgba(0,0,0,0.6);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.card-nav-btn:hover:not(:disabled) {
    background: rgba(0,0,0,0.8);
    transform: scale(1.1);
}

.card-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.original-card-thumbnails {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 15px;
}

.original-card-thumbnail {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.original-card-thumbnail:hover {
    border-color: var(--secondary-color);
    transform: scale(1.05);
}

.original-card-thumbnail.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color);
}

/* ==================== APP NAVIGATION SIDEBAR ==================== */

/* Hamburger Menu Button */
.hamburger-menu {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 1.5em;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: none; /* Hidden on desktop by default */
}

.hamburger-menu:hover {
    background: var(--card-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.hamburger-icon {
    display: block;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* App Sidebar */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    height: 100dvh;
    background: var(--nav-bg);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    z-index: 999;
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
}

/* Desktop: sidebar visible by default */
@media (min-width: 1025px) {
    .app-sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 280px;
    }

    /* Collapsed sidebar state on desktop */
    body.sidebar-collapsed .app-sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-collapsed .main-content {
        margin-left: 0 !important;
    }

    body.sidebar-collapsed .hamburger-menu {
        display: block;
    }
}

.app-sidebar.active {
    transform: translateX(0);
}

/* Sidebar Header — matches the page header banner exactly */
.nav-header {
    padding: 20px;
    min-height: 87px;
    border-bottom: 1px solid var(--nav-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background:
        linear-gradient(to bottom, rgba(13,27,42,0.35) 0%, rgba(13,27,42,0.55) 100%),
        url('/static/branding/Banner.png') 58% 38% / cover no-repeat,
        linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    color: white;
}

.nav-header h2 {
    font-size: 1.5em;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}

.sidebar-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5em;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.sidebar-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Global Search Bar */
.global-search-container {
    padding: 15px;
    border-bottom: 1px solid var(--nav-border);
    background: rgba(0,0,0,0.15);
    position: relative;
}

.global-search-box {
    position: relative;
    width: 100%;
}

.global-search-input {
    width: 100%;
    padding: 10px 35px 10px 15px;
    border: 2px solid var(--nav-border);
    border-radius: 25px;
    font-size: 0.95em;
    transition: all 0.3s;
    background: rgba(255,255,255,0.12);
    color: var(--nav-text);
}

.global-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.2);
}

.clear-search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5em;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 25px;
    height: 25px;
    line-height: 1;
    transition: color 0.2s;
}

.clear-search-btn:hover {
    color: var(--dark-color);
}

.global-search-results {
    position: absolute;
    top: 100%;
    left: 15px;
    right: 15px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 5px;
}

.global-search-results.hidden {
    display: none;
}

.global-search-result-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.global-search-result-item:last-child {
    border-bottom: none;
}

.global-search-result-item:hover {
    background: var(--nav-hover-bg);
}

.search-result-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 3px;
}

.search-result-meta {
    font-size: 0.85em;
    color: var(--text-muted);
}

.search-result-match-type {
    display: inline-block;
    padding: 2px 6px;
    background: var(--info-bg);
    color: var(--info-color);
    border-radius: 3px;
    font-size: 0.75em;
    margin-left: 5px;
}

.search-result-match-type.hybrid {
    background: var(--info-bg);
    color: var(--info-color);
}

.search-result-match-type.ingredient {
    background: var(--success-bg);
    color: var(--success-color);
}

.search-result-match-type.keyword {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
}

.search-loading {
    padding: 15px;
    text-align: center;
    color: var(--text-muted);
}

/* Navigation Items */
.nav-items {
    flex: 1;
    padding: 10px 0;
    overflow-y: auto;
}

.nav-item {
    width: 100%;
    padding: 14px 20px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 1em;
    color: var(--nav-text);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: var(--nav-hover-bg);
    border-left-color: var(--nav-accent);
}

.nav-item.active {
    background: var(--nav-active-bg);
    border-left-color: var(--nav-accent);
    color: var(--nav-accent);
    font-weight: 600;
}

/* Navigation Badge */
.nav-badge {
    background: var(--nav-accent);
    color: var(--primary-text);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: auto;
}

.nav-item.active .nav-badge {
    background: var(--nav-accent);
    opacity: 0.85;
}

/* Support user navigation — toggled via body.support-user */
.support-only-nav {
    display: none !important;
}

body.support-user .support-only-nav {
    display: flex !important;
}

body.support-user .support-hidden-nav {
    display: none !important;
}

/* While support is viewing a family, show read-oriented nav items */
body.support-user.support-viewing-family .support-hidden-nav {
    display: flex !important;
}

body.support-user.support-viewing-family .nav-group.support-hidden-nav {
    display: block !important;
}

/* Navigation Groups */
.nav-group {
    margin: 5px 0;
}

.nav-group-header {
    width: 100%;
    padding: 14px 20px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 1em;
    color: var(--nav-text);
    font-weight: 600;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-left: 3px solid transparent;
}

.nav-group-header:hover {
    background: var(--nav-hover-bg);
}

.nav-group-header::after {
    content: '▼';
    font-size: 0.7em;
    transition: transform 0.3s ease;
    margin-left: auto;
    margin-right: 5px;
}

.nav-group.expanded .nav-group-header::after {
    transform: rotate(180deg);
}

.nav-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-group.expanded .nav-group-items {
    max-height: 500px;
}

.nav-sub-item {
    padding-left: 40px;
    font-size: 0.9em;
    font-weight: normal;
}

/* Startup overlay */
#startup-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--gradient-start, #667eea), var(--gradient-end, #764ba2));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    color: white;
    transition: opacity 0.4s ease;
}

#startup-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.startup-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: startup-spin 0.8s linear infinite;
    margin-bottom: 20px;
}

@keyframes startup-spin {
    to { transform: rotate(360deg); }
}

#startup-message {
    font-size: 1em;
    opacity: 0.85;
    margin: 0;
    letter-spacing: 0.02em;
}

/* Help Page — two-panel layout */
.help-layout {
    display: grid;
    grid-template-columns: 210px 1fr;
    gap: 24px;
    align-items: start;
    max-width: 960px;
}

.help-nav {
    position: sticky;
    top: calc(var(--app-header-offset, 5.75rem) + 12px);
    max-height: calc(100vh - var(--app-header-offset, 5.75rem) - 24px);
    overflow-y: auto;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 8px;
}

.help-search-wrap {
    position: relative;
    padding: 10px 10px 8px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.help-search {
    width: 100%;
    padding: 5px 26px 5px 8px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: 6px;
    font-size: 0.82rem;
    background: var(--input-bg, #f8fafc);
    color: var(--dark-color);
    box-sizing: border-box;
}

.help-search:focus {
    outline: none;
    border-color: var(--primary-color, #2d6a4f);
}

.help-search-clear {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-60%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-secondary, #888);
    padding: 0 2px;
}

.help-search-clear.hidden { display: none; }

.help-tree {
    padding: 8px 0;
}

.help-group {
    margin-bottom: 2px;
}

.help-group-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-secondary, #64748b);
    text-align: left;
}

.help-group-title:hover { color: var(--dark-color); }

.help-group-chevron {
    font-size: 0.75rem;
    transition: transform 0.18s;
}

.help-group.collapsed .help-group-chevron { transform: rotate(-90deg); }

.help-group-items { overflow: hidden; }
.help-group.collapsed .help-group-items { display: none; }

.help-nav-link {
    display: block;
    padding: 4px 12px 4px 22px;
    font-size: 0.84rem;
    color: var(--text-secondary, #475569);
    cursor: pointer;
    border-left: 2px solid transparent;
    text-decoration: none;
    transition: color 0.15s, background 0.15s;
}

.help-nav-link:hover {
    color: var(--primary-color, #2d6a4f);
    background: var(--surface-nested);
}

.help-nav-link.active {
    color: var(--primary-color, #2d6a4f);
    border-left-color: var(--primary-color, #2d6a4f);
    background: var(--surface-nested);
    font-weight: 500;
}

.help-nav-link.help-link-dimmed { opacity: 0.35; }

/* Right content column */
.help-content-area { max-width: 680px; }

.help-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color, #e2e8f0);
    scroll-margin-top: calc(var(--app-header-offset, 5.75rem) + 16px);
}

.help-header h2 { margin-bottom: 4px; }

.help-intro {
    color: var(--text-muted, #94a3b8);
    margin-bottom: 12px;
}

.help-header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.help-tours-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.help-tours-label {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    margin-right: 2px;
}

.help-contact-prompt {
    margin-top: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
    font-size: 0.88rem;
}

.help-contact-prompt a {
    color: var(--primary-color);
    text-decoration: none;
}

.help-contact-prompt a:hover { text-decoration: underline; }

.help-no-results {
    padding: 16px 0;
    color: var(--text-secondary, #64748b);
    font-size: 0.9rem;
}

.help-no-results.hidden { display: none; }

.help-section {
    padding-bottom: 28px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    scroll-margin-top: calc(var(--app-header-offset, 5.75rem) + 16px);
}

.help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.help-section.help-hidden { display: none; }

.help-section h3 {
    margin-bottom: 10px;
    font-size: 1.05em;
}

.help-section p,
.help-section ul {
    color: var(--text-secondary, #475569);
    line-height: 1.75;
    margin-bottom: 8px;
}

.help-section ul { padding-left: 20px; }

.help-section.help-section-current > h3 {
    color: var(--primary-color, #2d6a4f);
}

.help-tour-settings p {
    color: var(--text-secondary, #475569);
    margin-bottom: 12px;
}

@media (max-width: 640px) {
    .help-layout {
        grid-template-columns: 1fr;
    }
    .help-nav {
        position: static;
    }
}

/* Shepherd.js theme overrides — follow app theme CSS variables */
.shepherd-element {
    background: var(--card-bg);
    color: var(--dark-color);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.shepherd-text {
    color: var(--dark-color);
}

.shepherd-text a {
    color: var(--primary-color);
}

.shepherd-arrow::before {
    background: var(--card-bg);
}

.shepherd-button {
    background: var(--primary-color);
    color: var(--primary-text);
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 0.9em;
    cursor: pointer;
}

.shepherd-button:not(:disabled):hover {
    background: var(--primary-hover);
    color: var(--primary-text);
    opacity: 1;
}

.shepherd-button-secondary {
    background: transparent;
    color: var(--dark-color);
    border: 1px solid var(--border-color);
}

.shepherd-button-secondary:not(:disabled):hover {
    background: var(--surface-nested);
    color: var(--dark-color);
    opacity: 1;
}

.shepherd-header {
    background: var(--primary-color);
    border-radius: 8px 8px 0 0;
}

.shepherd-has-title .shepherd-content .shepherd-header {
    background: var(--primary-color);
}

.shepherd-title {
    color: var(--primary-text);
    font-weight: 600;
}

.shepherd-cancel-icon {
    color: var(--primary-text);
    opacity: 0.85;
}

.shepherd-cancel-icon:hover {
    opacity: 1;
    color: var(--primary-text);
}

.shepherd-modal-overlay-container.shepherd-modal-is-visible {
    opacity: 0.55;
}

/* Release Notes Page */
.release-notes-page {
    max-width: 760px;
}

.release-notes-container h2 {
    margin-bottom: 4px;
}

.release-notes-intro {
    color: var(--text-muted, #94a3b8);
    margin-bottom: 32px;
}

.release-notes-container .link-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--primary-color);
    cursor: pointer;
    font-size: inherit;
    text-decoration: underline;
}

.release-version {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0 28px;
    padding-bottom: 28px;
    margin-bottom: 28px;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
}

.release-version:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.release-version-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-top: 3px;
}

.release-badge {
    background: linear-gradient(135deg, var(--gradient-start, #667eea), var(--gradient-end, #764ba2));
    color: white;
    font-size: 0.8em;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.release-date {
    color: var(--text-muted, #94a3b8);
    font-size: 0.8em;
}

.release-version-body h3 {
    margin: 0 0 10px;
    font-size: 1.05em;
}

.release-version-body ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary, #475569);
    line-height: 1.8;
}

@media (max-width: 600px) {
    .release-version {
        grid-template-columns: 1fr;
    }

    .release-version-header {
        flex-direction: row;
        align-items: center;
        margin-bottom: 10px;
    }
}

/* Nav Footer — version + release notes link */
.nav-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--nav-border);
    text-align: center;
}

.nav-version-link {
    font-size: 0.75em;
    color: var(--nav-text);
    opacity: 0.55;
    letter-spacing: 0.03em;
    padding: 6px 12px;
    border: none;
    background: none;
    cursor: pointer;
}

.nav-version-link:hover {
    opacity: 0.9;
}

.nav-version-link:hover {
    color: var(--gradient-start, #667eea);
}

/* Main Content Area */
.main-content {
    margin-left: 0;
    transition: margin-left 0.3s ease;
    min-height: calc(100vh - 70px);
    padding: 24px;
    background: var(--light-color);
}

@media (min-width: 1025px) {
    .main-content {
        margin-left: 280px;
    }

    body.sidebar-collapsed .main-content {
        margin-left: 0 !important;
    }
}

/* View Panels */
.view-panel {
    display: none;
}

.view-panel.active {
    display: block;
}

/* ==================== SETTINGS NAVIGATION ==================== */

.settings-container {
    display: flex;
    gap: 20px;
    min-height: 600px;
}

.settings-sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--card-bg);
    border-radius: 8px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 100px;
    align-self: flex-start;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.settings-nav-item {
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.95em;
    color: var(--dark-color);
    border-radius: 6px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.settings-nav-item:hover {
    background: var(--nav-hover-bg);
    border-left-color: var(--primary-color);
}

.settings-nav-item.active {
    background: var(--nav-active-bg);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
    font-weight: 600;
}

.settings-content {
    flex: 1;
    background: var(--card-bg);
    color: var(--dark-color);
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.settings-content-panel {
    display: none;
}

.settings-content-panel.active {
    display: block;
}

.settings-content .section-header {
    margin-bottom: 30px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.settings-content .section-header h3 {
    font-size: 1.8em;
    margin-bottom: 8px;
    color: var(--dark-color);
}

.settings-content .section-header p {
    color: var(--text-muted, #666);
    font-size: 0.95em;
}

/* General Settings */
.general-settings-form {
    max-width: 600px;
}

.profile-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background: var(--light-color);
    border-radius: 8px;
}

.profile-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.profile-field:last-child {
    border-bottom: none;
}

.field-label {
    font-weight: 600;
    color: var(--dark-color);
}

.field-value {
    color: var(--text-muted, #666);
}

.status-active {
    color: var(--success-color);
    font-weight: 600;
}

.appearance-placeholder {
    padding: 30px;
    background: var(--light-color);
    border-radius: 8px;
    text-align: center;
    color: var(--text-muted);
}

/* Theme picker */
.theme-picker-row {
    margin-bottom: 16px;
}

.theme-picker-select {
    max-width: 280px;
}

.theme-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.theme-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--card-bg);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
    min-width: 110px;
}

.theme-swatch:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.theme-swatch.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.theme-swatch span {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.1);
}

.theme-swatch small {
    font-size: 0.75em;
    color: var(--dark-color);
    white-space: nowrap;
}

/* Tags Manager */
.tags-manager {
    max-width: 800px;
}

.add-tag-form {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    align-items: center;
}

.tag-color-picker {
    width: 60px;
    height: 40px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--light-color);
    border-radius: 20px;
    border: 2px solid var(--border-color);
}

.tag-color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, 0.1);
}

.tag-name {
    font-weight: 500;
}

.tag-count {
    color: var(--text-muted);
    font-size: 0.85em;
}

.tag-actions {
    display: flex;
    gap: 5px;
    margin-left: 5px;
}

.btn-icon-small {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.btn-icon-small:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Responsive */
@media (max-width: 1024px) {
    .ocr-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .action-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 1024px) {
    /* Sidebar hidden by default on tablet/mobile */
    .app-sidebar {
        transform: translateX(-100%);
    }
    
    .app-sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0 !important;
    }
    
    .hamburger-menu {
        display: block;
    }
    
    .sidebar-close {
        display: flex;
    }
}

@media (max-width: 768px) {
    .two-column {
        grid-template-columns: 1fr;
    }
    
    .ocr-grid {
        grid-template-columns: 1fr;
    }
    
    .parse-buttons {
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .ingredient-item {
        flex-wrap: wrap;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid-insights,
    .dashboard-grid-life {
        grid-template-columns: 1fr;
    }

    .stat-card-wide {
        grid-column: span 1;
    }

    .location-form-row {
        grid-template-columns: 1fr;
    }

    /* Weather card: stack vertically on mobile */
    .weather-card {
        flex-direction: column;
        gap: 0;
    }

    .weather-current {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 12px;
        align-self: auto;
    }

    .weather-hourly-section {
        padding-right: 0;
        padding-left: 0;
        border-right: none;
        border-top: none;
        border-bottom: 1px solid var(--border-color);
        padding-top: 12px;
        padding-bottom: 12px;
        align-self: auto;
    }

    .weather-daily-section {
        padding-left: 0;
        padding-top: 12px;
    }

    .weather-hourly-strip {
        -webkit-overflow-scrolling: touch;
    }

    .weather-temp-big {
        font-size: 1.8em;
    }

    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-icon {
        font-size: 2.5em;
        width: 60px;
        height: 60px;
    }
    
    .stat-number {
        font-size: 2em;
    }
    
    .user-info {
        position: static;
        margin-top: 15px;
        justify-content: center;
    }
    
    .auth-card {
        margin: 0 10px;
    }
    
    .auth-form {
        padding: 25px;
    }
    
    .app-sidebar {
        width: 260px;
    }
    
    .main-content {
        padding: 15px;
    }
    
    .settings-container {
        flex-direction: column;
    }
    
    .settings-sidebar {
        width: 100%;
    }
    
    .settings-nav {
        flex-direction: row;
        overflow-x: auto;
    }
    
    .settings-nav-item {
        white-space: nowrap;
        min-width: fit-content;
    }
}

/* ==================== CATEGORY MANAGEMENT STYLES ==================== */

.category-manager {
    max-width: 800px;
}

.category-manager > .btn {
    margin-bottom: 25px;
}

/* Expandable Categories List */
.categories-list.expandable {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    background: var(--light-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.category-item:hover {
    border-color: var(--secondary-color);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 18px;
    cursor: pointer;
    background: var(--card-bg);
    transition: background 0.2s ease;
}

.category-header:hover {
    background: var(--nav-hover-bg);
}

.category-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.category-name {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1.05em;
    cursor: pointer;
    transition: color 0.2s ease;
}

.category-name:hover {
    color: var(--primary-color);
}

.category-count {
    font-size: 0.85em;
    color: var(--text-muted);
    background: var(--light-color);
    padding: 3px 10px;
    border-radius: 12px;
}

.category-actions {
    display: flex;
    gap: 5px;
}

.category-expand {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
    transition: transform 0.3s ease;
    color: var(--text-muted);
}

.category-item.expanded .category-expand {
    transform: rotate(180deg);
}

/* Subcategories List */
.subcategories-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: var(--light-color);
    padding: 0 18px;
}

.category-item.expanded .subcategories-list {
    max-height: 500px;
    padding: 10px 18px 15px;
}

.subcategory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin-left: 20px;
    background: var(--card-bg);
    border-radius: 6px;
    margin-bottom: 6px;
    border-left: 3px solid var(--secondary-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.subcategory-item:hover {
    background: var(--nav-hover-bg);
    border-left-color: var(--primary-color);
}

.subcategory-item span {
    cursor: pointer;
    color: var(--dark-color);
}

.subcategory-item:hover span {
    color: var(--primary-color);
}

.subcategory-actions {
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.subcategory-item:hover .subcategory-actions {
    opacity: 1;
}

/* Add Subcategory Button */
.btn-add-sub {
    display: block;
    width: calc(100% - 36px);
    margin: 8px 18px 15px;
    padding: 10px;
    background: none;
    border: 2px dashed var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
}

.btn-add-sub:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    background: var(--nav-hover-bg);
}

/* Icon buttons */
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1em;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* ==================== USAGE STATISTICS ==================== */

.usage-stats-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 25px 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    margin-bottom: 20px;
}

.usage-stats-card h3 {
    color: var(--dark-color);
    margin: 0 0 20px 0;
    font-size: 1.3em;
}

.usage-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 25px;
}

.usage-stat-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.usage-stat-label {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 0.95em;
}

.usage-stat-bar {
    height: 10px;
    background: var(--light-color);
    border-radius: 5px;
    overflow: hidden;
}

.usage-progress {
    height: 100%;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border-radius: 5px;
    transition: width 0.5s ease;
}

.usage-progress.warning {
    background: linear-gradient(135deg, #f39c12, #e74c3c);
}

.usage-stat-text {
    font-size: 0.9em;
    color: var(--text-muted);
}

.usage-stat-reset {
    font-size: 0.78em;
    color: var(--text-muted);
    margin-top: 2px;
    opacity: 0.75;
}

.usage-stat-sub {
    font-size: 0.78em;
    color: var(--text-muted);
    margin-top: 2px;
    opacity: 0.75;
}

/* Pending Batches Section */
.pending-batches-card {
    background: var(--warning-bg);
    border: 2px solid var(--warning-color);
    border-radius: 15px;
    padding: 20px 25px;
    margin-bottom: 20px;
}

.pending-batches-card h3 {
    color: var(--warning-color);
    margin: 0 0 5px 0;
    font-size: 1.2em;
}

.pending-batches-subtitle {
    color: var(--warning-color);
    margin: 0 0 15px 0;
    font-size: 0.9em;
}

.pending-batches-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pending-batch-item {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pending-batch-info {
    flex: 1;
}

.pending-batch-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 5px;
}

.pending-batch-meta {
    font-size: 0.85em;
    color: var(--text-muted);
}

.pending-batch-actions {
    display: flex;
    gap: 10px;
}

.pending-batch-actions .btn {
    padding: 8px 16px;
    font-size: 0.9em;
}

/* Active Batches Section */
.dashboard-section {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 20px 25px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h3 {
    margin: 0;
    color: var(--dark-color);
    font-size: 1.2em;
}

.view-all-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}

.view-all-link:hover {
    text-decoration: underline;
}

.active-batches-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.batch-card {
    background: var(--light-color);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.batch-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.batch-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.batch-card-title {
    font-weight: 600;
    color: var(--dark-color);
    font-size: 1.05em;
    flex: 1;
}

.batch-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    white-space: nowrap;
}

.batch-status.processing {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.batch-status.pending_review {
    background: var(--info-bg);
    color: var(--info-color);
}

.batch-status.completed {
    background: var(--success-bg);
    color: var(--success-color);
}

.batch-card-meta {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.batch-progress {
    margin-bottom: 10px;
}

.batch-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--surface-nested);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.batch-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

/* Parsing phase — animated shimmer to show work is ongoing */
@keyframes batch-shimmer {
    0%   { opacity: 1; }
    50%  { opacity: 0.6; }
    100% { opacity: 1; }
}
.batch-progress-fill.batch-progress-parsing {
    animation: batch-shimmer 1.4s ease-in-out infinite;
}

.batch-progress-text {
    font-size: 0.8em;
    color: var(--text-muted);
    text-align: right;
}

.batch-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.batch-card-actions .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.85em;
}

.batch-shared-badge {
    color: var(--info-color);
    font-weight: 600;
}

.batch-review-visibility-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 16px;
    padding: 12px 16px;
    background: var(--surface-nested);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.visibility-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.visibility-badge.private {
    background: var(--info-bg);
    color: var(--info-color);
}

.visibility-badge.family {
    background: var(--success-bg);
    color: var(--success-color);
}

.review-lock-badge {
    display: inline-block;
    margin-bottom: 8px;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--warning-bg);
    color: var(--warning-color);
    font-size: 0.82em;
    font-weight: 600;
}

.review-card-actions .btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--card-bg);
    color: var(--dark-color);
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
    margin: 0 0 15px 0;
    color: var(--dark-color);
}

.modal-content p {
    margin: 10px 0;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
    padding: 12px;
}

/* Badge Styles */
.badge {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75em;
    font-weight: 600;
    margin-left: 6px;
    min-width: 20px;
    text-align: center;
}

/* ==================== BATCH HISTORY STYLES ==================== */

.batch-history-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.batch-history-header-row .header-subtitle {
    margin: 0;
}

.batch-history-cancelled-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.batch-history-cancelled-toggle input[type="checkbox"] {
    cursor: pointer;
    width: 15px;
    height: 15px;
    accent-color: var(--primary-color, #6c7a9c);
}

.batch-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.batch-history-table thead {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
}

.batch-history-table th {
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.batch-history-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.batch-history-table tbody tr:hover {
    background-color: var(--nav-hover-bg);
}

.batch-history-table tbody tr:last-child {
    border-bottom: none;
}

.batch-history-table td {
    padding: 12px;
    font-size: 0.9em;
    color: var(--dark-color);
    vertical-align: middle;
}

.batch-history-table td strong {
    color: var(--dark-color);
    font-weight: 600;
}

.batch-history-table td small {
    font-size: 0.85em;
    color: var(--text-muted);
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    white-space: nowrap;
}

.status-badge.approved {
    background: var(--success-bg);
    color: var(--success-color);
}

.status-badge.pending {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.status-badge.rejected {
    background: var(--error-color);
    color: white;
}

.status-badge.status-completed {
    background: var(--info-bg);
    color: var(--info-color);
}

.status-badge.status-processing {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.status-badge.status-pending {
    background: var(--info-bg);
    color: var(--info-color);
}

.status-badge.status-other {
    background: var(--surface-nested);
    color: var(--text-secondary);
}

.status-badge.status-cancelled {
    background: var(--error-color);
    color: white;
}

.loading-message,
.empty-message {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-message p {
    margin-bottom: 20px;
    font-size: 1.1em;
}

/* Batch Review View Styles */
#batch-review-queue-container {
    padding: 20px 0;
}

#batch-review-queue-container .review-header {
    margin-bottom: 20px;
}

#batch-review-queue-container .review-header h3 {
    margin: 0 0 10px 0;
    color: var(--dark-color);
    font-size: 1.3em;
}

#batch-review-queue-container .review-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

#batch-review-queue-container .review-legend {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

#batch-review-queue-container .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    color: var(--text-muted);
}

#batch-review-queue-container .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

#batch-review-queue-container .legend-item.pending .legend-dot {
    background: var(--warning-color);
}

#batch-review-queue-container .legend-item.approved .legend-dot {
    background: var(--success-color);
}

#batch-review-queue-container .legend-item.rejected .legend-dot {
    background: var(--error-color);
}

#batch-review-queue-container .review-actions {
    margin-top: 25px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Batch review Recipes / Duplicates tabs */
#batch-review-queue-container .batch-review-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

#batch-review-queue-container .batch-review-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
    position: relative;
}

#batch-review-queue-container .batch-review-tab.active {
    color: var(--primary-color);
}

#batch-review-queue-container .batch-review-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary-color);
}

#batch-review-queue-container .batch-review-tab .tab-count {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 0.85em;
    font-weight: 600;
    background: var(--surface-nested);
    color: var(--text-secondary);
}

#batch-review-queue-container .batch-review-tab.active .tab-count {
    background: color-mix(in srgb, var(--primary-color) 18%, white);
    color: var(--primary-color);
}

.batch-review-browse-chrome {
    margin: 12px 0 16px;
}

#batch-review-queue-container .review-duplicates-help {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.95em;
}

#batch-review-queue-container .review-duplicate-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

#batch-review-queue-container .review-duplicate-card .review-card-status {
    background: #607d8b;
    color: white;
}

#batch-review-queue-container .review-duplicate-match {
    margin-top: 8px;
    font-size: 0.92em;
    color: var(--text-secondary);
    line-height: 1.4;
}

#batch-review-queue-container .review-duplicate-match strong {
    color: var(--dark-color);
}

/* Review recipe cards (batch review page) */
#batch-review-queue-container .review-recipes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

#batch-review-queue-container .review-recipe-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

#batch-review-queue-container .review-recipe-card.pending {
    border-color: var(--warning-color);
}

#batch-review-queue-container .review-recipe-card.approved {
    border-color: var(--success-color);
    background: var(--success-bg);
}

#batch-review-queue-container .review-recipe-card.rejected {
    border-color: var(--error-color);
    background: var(--card-bg);
    opacity: 0.7;
}

#batch-review-queue-container .review-card-thumbnail {
    width: 100%;
    height: 200px;
    object-fit: contain;
    background: var(--surface-nested);
}

#batch-review-queue-container .review-card-content {
    padding: 15px;
}

#batch-review-queue-container .review-card-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 10px;
}

#batch-review-queue-container .review-card-status.pending {
    background: var(--warning-bg);
    color: var(--warning-color);
}

#batch-review-queue-container .review-card-status.approved {
    background: var(--success-bg);
    color: var(--success-color);
}

#batch-review-queue-container .review-card-status.rejected {
    background: var(--error-color);
    color: white;
}

#batch-review-queue-container .review-card-title {
    font-size: 1.1em;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark-color);
}

#batch-review-queue-container .review-card-meta {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

#batch-review-queue-container .review-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

#batch-review-queue-container .review-card-actions .btn {
    flex: 1;
    min-width: 70px;
    padding: 8px 12px;
    font-size: 0.85em;
}

#batch-review-queue-container .btn-approve {
    background: var(--success-color);
    color: white;
    border: none;
}

#batch-review-queue-container .btn-approve:hover {
    background: var(--success-color);
}

#batch-review-queue-container .btn-reject {
    background: var(--error-color);
    color: white;
    border: none;
}

#batch-review-queue-container .btn-reject:hover {
    background: var(--error-hover);
}

#batch-review-queue-container .btn-edit {
    background: var(--info-color);
    color: white;
    border: none;
}

#batch-review-queue-container .review-recipes-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
#batch-review-queue-container .review-recipes-grid.view-list .review-recipe-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
}
#batch-review-queue-container .review-recipes-grid.view-list .review-card-thumbnail {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 6px;
}
#batch-review-queue-container .review-recipes-grid.view-list .review-card-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.75rem;
    padding: 0;
    flex: 1;
    min-width: 0;
}
#batch-review-queue-container .review-recipes-grid.view-list .review-card-title {
    flex: 0 0 var(--name-col-width, 200px);
    font-size: 0.95rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#batch-review-queue-container .review-recipes-grid.view-list .review-card-status {
    margin: 0;
    flex-shrink: 0;
}
#batch-review-queue-container .review-recipes-grid.view-list .review-card-meta {
    margin: 0;
    font-size: 0.75rem;
    white-space: nowrap;
}
#batch-review-queue-container .review-recipes-grid.view-list .review-validation-flags {
    flex: 1 1 100%;
    white-space: normal;
}
#batch-review-queue-container .review-recipes-grid.view-list .review-card-actions {
    margin-left: auto;
    flex-shrink: 0;
}
#batch-review-queue-container .review-recipes-grid.view-list .review-card-actions .btn {
    flex: 0 0 auto;
    min-width: 0;
    padding: 6px 10px;
}
#batch-review-queue-container .review-recipes-grid.view-list .review-lock-badge {
    flex-shrink: 0;
}
@media (max-width: 768px) {
    #batch-review-queue-container .review-recipes-grid.view-list .review-card-title {
        flex: 1 1 100%;
        max-width: 100%;
    }
    #batch-review-queue-container .review-recipes-grid.view-list .review-card-actions {
        margin-left: 0;
        width: 100%;
    }
}

#batch-review-queue-container .btn-edit:hover {
    background: var(--info-color);
}

/* ==================== BATCH FIX MODAL ==================== */

.bfm-dialog {
    width: min(520px, 92vw);
    max-height: 90vh;
    overflow-y: auto;
}

.bfm-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 16px;
}

.bfm-tab {
    padding: 7px 14px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: .875em;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 4px 4px 0 0;
    transition: color .15s, border-color .15s;
}

.bfm-tab:hover { color: var(--text-primary); }

.bfm-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.bfm-panel { padding: 4px 0; }

.bfm-hint {
    margin: 0 0 14px;
    font-size: .875em;
    color: var(--text-secondary);
    line-height: 1.5;
}

.bfm-select {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 7px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg, var(--bg-secondary));
    color: var(--text-primary);
    font-size: .9em;
}

.bfm-direction-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.bfm-direction-option {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: .875em;
    line-height: 1.4;
}

.bfm-direction-option input[type="radio"] {
    margin-top: 2px;
    flex-shrink: 0;
}

.bfm-direction-option em {
    color: var(--text-secondary);
    font-style: normal;
}

.bfm-img-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-secondary);
    min-height: 80px;
    align-items: center;
}

.bfm-img-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 4px;
    border: 2px solid transparent;
    border-radius: 6px;
    transition: border-color .15s;
}

.bfm-img-option:has(input:checked) {
    border-color: var(--primary-color);
    background: color-mix(in srgb, var(--primary-color) 10%, transparent);
}

.bfm-img-option input[type="radio"] {
    display: none;
}

.bfm-img-option img {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg-tertiary, #ccc);
}

/* ==================== USER MANAGEMENT STYLES ==================== */

.user-manager {
    max-width: 900px;
}

.user-manager-header {
    margin-bottom: 20px;
}

.role-info-box {
    background: var(--light-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 25px;
}

.role-info-box h4 {
    margin: 0 0 12px 0;
    color: var(--dark-color);
}

.role-info-box ul {
    margin: 0;
    padding-left: 20px;
}

.role-info-box li {
    padding: 5px 0;
    color: var(--text-secondary);
    font-size: 0.95em;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.users-table th,
.users-table td {
    padding: 15px 18px;
    text-align: left;
}

.users-table th {
    background: var(--light-color);
    font-weight: 600;
    color: var(--dark-color);
    border-bottom: 2px solid var(--border-color);
}

.users-table td {
    border-bottom: 1px solid var(--border-color);
}

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

.users-table tr:hover td {
    background: var(--nav-hover-bg);
}

.current-user-row td {
    background: var(--nav-active-bg) !important;
}

.badge-you {
    display: inline-block;
    background: var(--gradient-start);
    color: white;
    font-size: 0.7em;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.role-select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9em;
    cursor: pointer;
}

.role-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
    text-transform: capitalize;
}

.role-badge.role-owner {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
}

.role-badge.role-admin {
    background: var(--info-bg);
    color: var(--info-color);
}

.role-badge.role-member {
    background: var(--success-bg);
    color: var(--secondary-color);
}

.role-badge.role-viewer {
    background: var(--light-color);
    color: var(--text-muted);
}

/* ==================== MODAL ENHANCEMENTS ==================== */

.form-info {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-top: 8px;
    padding: 10px 12px;
    background: var(--warning-bg);
    border-radius: 6px;
    border-left: 3px solid var(--warning-color);
}

.color-picker-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.tag-color-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Tags clickable items */
.tags-list .tag-item {
    cursor: pointer;
    transition: all 0.2s ease;
}

.tags-list .tag-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* No data placeholder */
.no-data {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 1em;
}

/* Account Settings Usage Stats */
.subscription-info {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid var(--border-color);
}

.subscription-info h4 {
    margin-bottom: 20px;
    color: var(--dark-color);
}

.usage-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.usage-stat {
    background: var(--light-color);
    padding: 15px;
    border-radius: 8px;
}

.usage-stat .usage-label {
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.usage-stat .usage-value {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--dark-color);
}

.usage-stat .usage-sub {
    font-size: 0.78em;
    color: var(--text-muted);
    margin-top: 3px;
}

@media (max-width: 768px) {
    .usage-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .usage-stats {
        grid-template-columns: 1fr;
    }
    
    .users-table {
        font-size: 0.9em;
    }
    
    .users-table th,
    .users-table td {
        padding: 10px 12px;
    }
}

/* ==================== HIERARCHICAL BROWSE ==================== */

/* Breadcrumb Navigation */
.browse-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 0;
    font-size: 0.95em;
    flex-wrap: wrap;
}

.breadcrumb-item {
    color: var(--primary-color);
    cursor: pointer;
    transition: color 0.2s ease;
}

.breadcrumb-item:hover {
    color: var(--dark-color);
    text-decoration: underline;
}

.breadcrumb-item.active {
    color: var(--dark-color);
    font-weight: 600;
    cursor: default;
}

.breadcrumb-item.active:hover {
    text-decoration: none;
}

.breadcrumb-separator {
    color: var(--border-color);
    font-size: 0.9em;
}

/* Browse Search */
.browse-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0 0.25rem;
}

.browse-search-input {
    flex: 1;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg, var(--card-bg));
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s;
}

.browse-search-input:focus {
    border-color: var(--accent-primary);
}

.browse-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    line-height: 1;
}

.browse-search-clear:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

.browse-search-clear.hidden {
    display: none;
}

.browse-search-scope-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    padding: 0 0.1rem;
}

.browse-search-scope-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--accent-primary);
    width: 13px;
    height: 13px;
    margin: 0;
}

.browse-search-scope-label.hidden {
    display: none;
}

/* Match count label on category/subcategory cards during active search */
.subcategory-card .search-match-label,
.category-card .search-match-label {
    font-size: 0.78rem;
    font-style: italic;
    color: var(--accent-primary);
}

/* Browse Header */
.browse-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.browse-stats {
    color: var(--text-muted);
    font-size: 0.95em;
}

.browse-view-toggle {
    display: flex;
    gap: 8px;
}

.browse-view-toggle .toggle-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9em;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.browse-view-toggle .toggle-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.browse-view-toggle .toggle-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* Categories Grid */
.browse-categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    padding: 10px 0;
}

.category-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 25px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.category-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--gradient-end) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.category-card:hover::before {
    opacity: 1;
}

.category-card-icon {
    font-size: 2.5em;
    margin-bottom: 12px;
}

.category-card-name {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.category-card-stats {
    font-size: 0.85em;
    color: var(--text-muted, #888);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.category-card-stats .recipe-count {
    color: var(--primary-color);
    font-weight: 500;
}

.category-card-stats .subcat-count {
    font-size: 0.9em;
}

.category-card.empty {
    opacity: 0.6;
    border-style: dashed;
}

.category-card.empty:hover {
    opacity: 0.8;
    transform: none;
    box-shadow: none;
}

/* Subcategories Grid */
.browse-subcategories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    padding: 10px 0;
}

.subcategory-card {
    background: var(--surface-nested);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 18px 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.subcategory-card:hover {
    border-color: var(--primary-color);
    background: var(--card-bg);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.subcategory-card-name {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 6px;
}

.subcategory-card-count {
    font-size: 0.85em;
    color: var(--primary-color);
}

.subcategory-card.empty {
    opacity: 0.5;
    border-style: dashed;
}

/* Browse Sections */
.browse-section {
    margin-bottom: 30px;
}

.browse-section h3 {
    font-size: 1.1em;
    color: var(--dark-color);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.browse-category-detail {
    padding-top: 10px;
}

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

.browse-empty-icon {
    font-size: 4em;
    margin-bottom: 15px;
    opacity: 0.5;
}

.browse-empty-title {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.browse-empty-text {
    font-size: 0.95em;
}

/* Browse Toolbar */
.browse-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.browse-toolbar.hidden {
    display: none;
}
.browse-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.browse-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.browse-toolbar-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.browse-toolbar-select {
    font-size: 0.85rem;
    padding: 0.2rem 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
}
.browse-toolbar-filter-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.browse-toolbar-filter-group.hidden {
    display: none;
}
.browse-view-mode-toggle {
    display: flex;
    gap: 0.25rem;
}

/* Browse List View */
.recipes-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.recipes-grid.view-list .recipe-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    border-radius: 6px;
}
.recipes-grid.view-list .recipe-card h3 {
    flex: 0 0 var(--name-col-width, 200px);
    font-size: 0.95rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.recipes-grid.view-list .recipe-card .category {
    flex: 0 0 90px;
    text-align: center;
    font-size: 0.75rem;
}
.recipes-grid.view-list .recipe-card .source,
.recipes-grid.view-list .recipe-card .date,
.recipes-grid.view-list .recipe-card .image-count {
    flex-shrink: 0;
    font-size: 0.75rem;
    margin: 0;
    color: var(--text-muted);
    white-space: nowrap;
}
.recipes-grid.view-list .recipe-card .recipe-plan-toggle {
    flex-shrink: 0;
    margin-left: auto;
}
.recipes-grid.view-list .recipe-card .status-badge {
    flex-shrink: 0;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .recipes-grid.view-list .recipe-card {
        flex-wrap: wrap;
        align-items: baseline;
        gap: 0.15rem 0.5rem;
    }
    .recipes-grid.view-list .recipe-card h3 {
        flex: 1 1 100%;
        max-width: 100%;
        font-size: 0.9rem;
    }
    .recipes-grid.view-list .recipe-card .category {
        flex: 0 0 auto;
        width: auto;
    }
    .recipes-grid.view-list .recipe-card .source {
        flex: 1 1 auto;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.7rem;
    }
    .recipes-grid.view-list .recipe-card .date,
    .recipes-grid.view-list .recipe-card .image-count {
        flex: 1 1 100%;
        font-size: 0.7rem;
    }
    .recipes-grid.view-list .recipe-card .recipe-plan-toggle {
        flex-shrink: 0;
        margin-left: auto;
    }

    .browse-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .browse-view-toggle {
        justify-content: center;
    }
    
    .browse-categories-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .category-card {
        padding: 18px 12px;
    }
    
    .category-card-icon {
        font-size: 2em;
    }
    
    .category-card-name {
        font-size: 1em;
    }
    
    .browse-subcategories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .breadcrumb-item {
        font-size: 0.9em;
    }
}

/* ==================== UNIFIED RECIPE EDITOR ==================== */

/* Unified Editor Container - supports both modal and full-page modes */
.unified-editor-container {
    background: var(--card-bg);
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

.unified-editor-container.modal-mode {
    max-width: 100%;
    max-height: none;
    margin: 0;
    border-radius: 0;
}

.unified-editor-container.full-page-mode {
    width: 100%;
    max-width: none;
    margin: 0;
}

/* Modal wrapper for unified editor */
#unified-editor-modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

#unified-editor-modal-wrapper.hidden {
    display: none;
}

#unified-editor-modal-wrapper .modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 1400px;
    width: 100%;
    max-height: 95vh;
    overflow-y: auto;
    position: relative;
}

.unified-editor-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.unified-editor-header h2 {
    margin: 0;
    color: var(--dark-color);
    flex: 1;
}

.unified-editor-history-btn {
    margin-left: auto;
}

.unified-editor-header.hidden {
    display: none;
}

/* Split Panel Layout */
.unified-editor-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}

.unified-editor-left-panel {
    flex: 0 0 400px;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: visible;
    transition: flex-basis 0.2s ease;
}

.unified-editor-left-panel.panel-collapsed {
    flex: 0 0 auto;
    width: auto;
    overflow: visible;
}

/* Collapse toggle button */
.left-panel-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 12px;
    margin-left: auto;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
}
.left-panel-collapse-btn:hover {
    background: var(--hover-bg);
    color: var(--text-color);
}

.unified-editor-right-panel {
    flex: 1;
    min-width: 0;
}

/* Source Images Panel */
.unified-editor-section {
    margin-bottom: 24px;
    overflow: visible; /* Ensure buttons aren't clipped */
}

.unified-editor-section h4 {
    margin-bottom: 12px;
    color: var(--dark-color);
    font-size: 1.1em;
}

.unified-editor-image-navigation {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 0;
    width: 100%;
}

.unified-editor-source-images {
    flex: 1;
    min-height: 200px;
    display: block; /* Changed from flex */
}

.unified-editor-source-image {
    width: 100%;
    border-radius: 8px;
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: box-shadow 0.2s;
    display: none !important; /* Hidden by default, show only active */
    background: var(--card-bg);
    padding: 4px;
}

.unified-editor-source-image.active {
    display: block !important;
}

.unified-editor-source-image:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.unified-editor-source-image img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    background: var(--surface-nested);
}

.unified-image-nav-btn {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 26px;
    line-height: 1;
    display: flex !important; /* Force display */
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
    z-index: 10;
}

.unified-image-nav-btn:hover:not(:disabled) {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.unified-image-nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(0, 0, 0, 0.4);
}

.unified-image-nav-btn span {
    display: block;
    margin-top: -3px;
}

.unified-image-counter {
    text-align: center;
    margin-top: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
    display: inline-block;
    box-shadow: 0 3px 10px rgba(0,0,0,0.4);
}

/* OCR Text Display */
.unified-ocr-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.unified-editor-section .unified-ocr-section-header h4 {
    margin: 0;
}

.unified-editor-ocr-text {
    background: var(--surface-nested);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.875em;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-secondary);
}

.unified-editor-ocr-text:empty::before {
    content: 'No OCR text available';
    color: var(--text-muted);
    font-style: italic;
}

/* Left-panel action buttons */
.unified-editor-left-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.btn-left-action {
    width: 100%;
    padding: 11px 16px;
    font-size: 0.95em;
    font-weight: 600;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-left-action:active {
    transform: scale(0.98);
}

.btn-outline,
.btn-outline-secondary {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--dark-color);
}

.btn-outline:hover,
.btn-outline-secondary:hover {
    background: var(--surface-nested);
    border-color: var(--border-color);
}

/* Responsive: Stack panels on mobile */
@media (max-width: 1024px) {
    .unified-editor-layout {
        flex-direction: column;
    }
    
    .unified-editor-left-panel {
        flex: 1;
        position: static;
        max-height: none;
        width: 100%;
    }
    
    .unified-editor-source-images {
        flex-direction: column; /* Keep column for proper navigation */
    }
    
    .unified-editor-source-image {
        flex: 0 0 200px;
    }
}

/* Drag and Drop Styles */
.unified-ingredient-item,
.unified-instruction-item {
    position: relative;
    transition: background-color 0.2s;
}

.unified-ingredient-item.dragging,
.unified-instruction-item.dragging {
    opacity: 0.5;
    background-color: var(--surface-nested);
}

.unified-ingredient-item.drag-over,
.unified-instruction-item.drag-over {
    background-color: var(--nav-hover-bg);
    border-top: 2px solid var(--primary-color);
}

.drag-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 1.2em;
    padding: 4px 8px;
    user-select: none;
}

.drag-handle:active {
    cursor: grabbing;
}

/* ==================== RESPONSIVE: UNIFIED EDITOR ==================== */

@media (max-width: 768px) {
    .unified-editor-image-navigation {
        gap: 5px;
    }
    
    .unified-image-nav-btn {
        width: 35px;
        height: 35px;
        font-size: 20px;
    }
}

/* ==================== SHOPPING LIST / PACKAGE LIBRARY ==================== */

.pkg-toolbar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.pkg-search-input {
    flex: 1;
    min-width: 0;
}

.pkg-filter-select {
    width: 160px;
    flex-shrink: 0;
}

.pkg-table-wrap {
    overflow-x: auto;
}

.pkg-table th,
.pkg-table td {
    white-space: nowrap;
    font-size: 0.87rem;
}

.pkg-table td:nth-child(1) {
    white-space: normal;
    min-width: 140px;
}

.pkg-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.pkg-badge-seed {
    background: var(--info-bg);
    color: var(--info-color);
}

.pkg-badge-llm {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.pkg-badge-user {
    background: var(--success-bg);
    color: var(--success-color);
}

.pkg-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 0.85rem;
}

.pkg-page-info {
    color: var(--text-muted, #6b7280);
    margin-right: 4px;
}

.pkg-sizes-editor {
    font-family: monospace;
    font-size: 0.82rem;
    resize: vertical;
}

.pkg-alias-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    min-height: 28px;
}

.pkg-alias-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--surface-nested);
    border-radius: 12px;
    padding: 2px 8px 2px 10px;
    font-size: 0.82rem;
}

.pkg-alias-remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
}

.pkg-alias-remove:hover {
    color: var(--error-color);
}

.pkg-alias-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
}

.pkg-alias-add-row .form-control {
    flex: 1;
}

.pkg-bracket-card {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--surface-nested);
    font-size: 0.88rem;
}

.pkg-bracket-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}

.pkg-bracket-line:last-child {
    margin-bottom: 0;
}

.pkg-sentence-text {
    color: var(--text-muted, #6b7280);
    white-space: nowrap;
    font-size: 0.85rem;
}

.pkg-sentence-label {
    font-weight: 600;
    color: var(--dark-color);
    white-space: nowrap;
}

.pkg-bracket-card .form-control {
    padding: 4px 8px;
    font-size: 0.85rem;
    height: auto;
}

.pkg-bracket-min,
.pkg-bracket-max {
    width: 68px;
    flex-shrink: 0;
}

.pkg-bracket-row-unit {
    flex-shrink: 0;
    padding: 4px 6px;
    font-size: 0.85rem;
    height: auto;
}

.pkg-bracket-pkg-select {
    flex: 1;
    min-width: 160px;
    font-size: 0.85rem;
    padding: 4px 6px;
    height: auto;
}

.pkg-bracket-custom-unit {
    flex: 1;
    min-width: 140px;
}

.pkg-bracket-unit {
    flex: 1;
    min-width: 140px;
}

.pkg-bracket-remove {
    margin-left: auto;
    flex-shrink: 0;
}

@keyframes pkgQtyFlash {
    0%   { background: var(--success-bg); }
    100% { background: transparent; }
}
.pkg-qty-flash {
    animation: pkgQtyFlash 0.6s ease-out;
}


/* ==================== RECIPE HISTORY ==================== */

.recipe-history-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
    align-items: start;
}

.recipe-history-sidebar {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    overflow: hidden;
}

.recipe-history-sidebar-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-nested);
}

.recipe-history-sidebar-header h3 {
    margin: 0;
    font-size: 1rem;
}

.recipe-history-version-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 70vh;
    overflow-y: auto;
}

.recipe-history-version-item {
    width: 100%;
    text-align: left;
    border: none;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.recipe-history-version-item:hover,
.recipe-history-version-item.active {
    background: var(--nav-hover-bg);
}

.recipe-history-version-item.current-version {
    border-left: 3px solid var(--primary-color);
}

.recipe-history-version-label {
    display: block;
    font-weight: 600;
    color: var(--dark-color);
}

.recipe-history-version-meta {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.recipe-history-version-summary {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #8a6d3b;
}

.recipe-history-detail {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    min-height: 420px;
    padding: 20px;
}

.recipe-history-detail-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.recipe-history-detail-header h3 {
    margin: 0 0 6px;
}

.recipe-history-meta {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.recipe-history-detail-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.recipe-history-compare-label {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.9rem;
}

.recipe-history-change-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.recipe-history-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #efe8dc;
    color: #5c4a32;
    font-size: 0.82rem;
}

.recipe-history-chip.added {
    background: var(--success-bg);
    color: var(--success-color);
}

.recipe-history-chip.removed {
    background: var(--error-color);
    color: white;
}

.recipe-history-chip.edited {
    background: var(--info-bg);
    color: var(--info-color);
}

.recipe-history-diff-details {
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-nested);
}

.recipe-history-diff-details h4 {
    margin: 0 0 6px;
}

.recipe-history-diff-details h5 {
    margin: 12px 0 6px;
    font-size: 0.9rem;
}

.recipe-history-diff-block ul {
    margin: 0;
    padding-left: 18px;
}

.recipe-history-diff-item {
    margin: 4px 0;
}

.recipe-history-diff-item.added {
    color: var(--success-color);
}

.recipe-history-diff-item.removed {
    color: var(--error-color);
}

.recipe-history-diff-item.edited {
    color: var(--info-color);
}

.recipe-history-diff-old {
    text-decoration: line-through;
    opacity: 0.75;
}

.recipe-history-diff-new {
    font-weight: 600;
}

.recipe-history-snapshot-preview h4 {
    margin: 18px 0 8px;
    color: var(--dark-color);
}

.recipe-history-snapshot-preview ul,
.recipe-history-snapshot-preview ol {
    margin: 0 0 12px 18px;
}

.recipe-history-field-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.recipe-history-field {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-nested);
}

.recipe-history-field-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.recipe-history-field-value {
    color: var(--dark-color);
    white-space: pre-wrap;
}

@media (max-width: 900px) {
    .recipe-history-layout {
        grid-template-columns: 1fr;
    }

    .recipe-history-version-list {
        max-height: 240px;
    }
}
