:root {
    --primary: #d97706;
    --primary-dark: #b45309;
    --primary-light: #fbbf24;
    --bg: #fffbf0;
    --bg-card: #ffffff;
    --text: #1a1a1a;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border: #e5e7eb;
    --success: #16a34a;
    --danger: #dc2626;
    --danger-light: #fee2e2;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

.container { max-width: 900px; margin: 0 auto; padding: 0 16px; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 0 16px; }

/* Header */
.header {
    background: linear-gradient(135deg, #92400e, #d97706, #b45309);
    color: white;
    padding: 20px 0;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.header h1 { font-size: 1.6rem; font-weight: 700; }
.header p { font-size: 0.9rem; opacity: 0.9; margin-top: 4px; }
.header-logo {
    width: 64px;
    height: 64px;
    margin-bottom: 8px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-tertiary);
    font-size: 0.8rem;
    margin-top: 40px;
    border-top: 1px solid var(--border);
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.card-title { font-size: 1.2rem; font-weight: 600; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--primary); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f3f4f6; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: #f3f4f6; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text);
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    font-family: inherit;
    background: white;
    transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.15);
}
.form-textarea { min-height: 80px; resize: vertical; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
}
.badge-vegan { background: #dcfce7; color: #166534; }
.badge-vegetarian { background: #fef9c3; color: #854d0e; }
.badge-warning { background: #fff7ed; color: #9a3412; font-size: 0.7rem; }
.badge-taken { background: #fee2e2; color: #991b1b; }
.badge-published { background: #dbeafe; color: #1e40af; }
.badge-draft { background: #f3f4f6; color: #6b7280; }
.badge-archived { background: #e5e7eb; color: #4b5563; }
.badge-primary { background: #fff7ed; color: #9a3412; }
.badge-coordinator { background: #ede9fe; color: #6d28d9; }
.badge-custom { background: #f0fdf4; color: #15803d; border: 1px dashed #86efac; }
.badge-stat { background: #dbeafe; color: #1e40af; font-size: 0.8rem; padding: 4px 10px; }

/* Meal Cards with theme gradients */
.meal-card {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    background: white;
    border: 1px solid var(--border);
}
.meal-header {
    padding: 16px 20px;
    color: white;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}
.meal-header h2 { font-size: 1.1rem; font-weight: 600; }
.meal-header .meta { font-size: 0.8rem; opacity: 0.9; }
.meal-body { padding: 16px 20px; }
.meal-body.collapsed { display: none; }

/* Theme Gradients */
.theme-haystacks { background: linear-gradient(135deg, #92400e, #d97706); }
.theme-italian { background: linear-gradient(135deg, #065f46, #059669); }
.theme-american { background: linear-gradient(135deg, #1e3a5f, #2563eb); }
.theme-asian { background: linear-gradient(135deg, #7c2d12, #dc2626); }
.theme-mexican { background: linear-gradient(135deg, #065f46, #d97706); }
.theme-south_american { background: linear-gradient(135deg, #4338ca, #7c3aed); }
.theme-caribbean { background: linear-gradient(135deg, #0e7490, #06b6d4); }
.theme-african { background: linear-gradient(135deg, #92400e, #ea580c); }
.theme-mediterranean { background: linear-gradient(135deg, #1e40af, #3b82f6); }
.theme-middle_eastern { background: linear-gradient(135deg, #78350f, #d97706); }
.theme-special { background: linear-gradient(135deg, #7c2d12, #d97706, #92400e); }

/* Item list */
.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    flex-wrap: wrap;
}
.item-row:last-child { border-bottom: none; }
.item-name { font-weight: 500; flex: 1; min-width: 150px; }
.item-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.item-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.item-claims { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.claim-detail { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin: 2px 0; }
.claim-info { font-size: 0.8rem; color: var(--text-secondary); }

/* Coordinators */
.coordinator-list { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.coordinator-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 0.875rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.tab {
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Modal */
.modal-overlay {
    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;
    padding: 16px;
}
.modal-overlay.active { display: flex; }
.modal {
    background: white;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 16px; }

/* Setup */
.setup-container {
    max-width: 500px;
    margin: 60px auto;
    padding: 0 16px;
}
.setup-step { display: none; }
.setup-step.active { display: block; }
.setup-progress {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    justify-content: center;
}
.setup-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--border);
}
.setup-dot.active { background: var(--primary); }
.setup-dot.done { background: var(--success); }

/* Theme picker (animated selection cards) */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin: 12px 0;
}
.theme-card {
    padding: 12px;
    border-radius: 8px;
    color: white;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 3px solid transparent;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.theme-card:hover { transform: scale(1.04); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.theme-card.selected { border-color: white; box-shadow: 0 0 0 3px var(--primary), 0 4px 12px rgba(0,0,0,0.3); transform: scale(1.06); }

/* Admin table */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}
.admin-table th, .admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.admin-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
}
.admin-table tr:hover { background: #fafafa; }

/* Allergen checklist */
.allergen-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fafafa;
    max-height: 120px;
    overflow-y: auto;
}
.allergen-check-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.78rem;
    cursor: pointer;
    background: white;
    border: 1px solid var(--border);
    transition: background 0.15s;
    margin: 0 !important;
}
.allergen-check-item:hover { background: #fef3c7; }
.allergen-check-item input { margin: 0; }
.allergen-check-item input:checked + span,
.allergen-check-item:has(input:checked) { background: #fef3c7; border-color: #f59e0b; }

/* Stats section */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}
.stat-card h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary-dark);
}
.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.85rem;
}
.stat-item:last-child { border-bottom: none; }
.stat-rank {
    font-weight: 700;
    color: var(--primary);
    min-width: 20px;
}
.stat-bar {
    height: 6px;
    border-radius: 3px;
    background: #f3f4f6;
    flex: 1;
    max-width: 80px;
    overflow: hidden;
}
.stat-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--primary);
}

/* Misc */
.text-center { text-align: center; }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-1 { gap: 4px; }
.hidden { display: none; }
.w-full { width: 100%; }

/* Pin login bar */
.pin-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}
.pin-bar .member-info { font-weight: 500; }

/* Allergen badges */
.allergen-badge {
    display: inline-flex;
    padding: 1px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    background: #fef3c7;
    color: #92400e;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Print */
@media print {
    .header, .footer, .pin-bar, .btn, .no-print { display: none !important; }
    .meal-body.collapsed { display: block !important; }
    body { background: white; }
    .print-header { display: block !important; }
}

/* Responsive */
@media (max-width: 600px) {
    .header h1 { font-size: 1.3rem; }
    .header-logo { width: 48px; height: 48px; }
    .card { padding: 14px; }
    .meal-header { padding: 12px 14px; }
    .meal-body { padding: 12px 14px; }
    .tabs { overflow-x: auto; flex-wrap: nowrap; }
    .tab { white-space: nowrap; padding: 8px 14px; }
    .theme-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .admin-table { font-size: 0.8rem; }
    .admin-table th, .admin-table td { padding: 8px 6px; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* Admin Dashboard nav */
.admin-header {
    background: linear-gradient(135deg, #1f2937, #374151);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.admin-header h1 { font-size: 1.2rem; font-weight: 600; }
.admin-header .nav-links { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.admin-header a { color: rgba(255,255,255,0.8); text-decoration: none; font-size: 0.85rem; }
.admin-header a:hover { color: white; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-secondary);
}
.empty-state p { margin-top: 8px; }

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 16px;
    border-radius: 6px;
    color: white;
    font-size: 0.875rem;
    animation: slideIn 0.3s ease;
    max-width: 350px;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Print page specific */
.print-logo { width: 48px; height: 48px; border-radius: 50%; margin-bottom: 4px; }
