/* EatWise components — buttons, cards, forms, modals (from style.css) */
/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #00C853;
    --primary-dark: #00A844;
    --primary-light: #E8F5E9;
    --secondary: #1A1A2E;
    --text: #1A1A2E;
    --text-light: #6B7280;
    --bg: #F8FAFC;
    --white: #FFFFFF;
    --border: #E5E7EB;
    --danger: #EF4444;
    --warning: #F59E0B;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
}

html, body {
    height: 100%;
    font-family: 'Cairo', sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ==================== SCREENS ==================== */
.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
    position: relative;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* ==================== SPLASH ==================== */
#splash {
    background: linear-gradient(160deg, #00C853 0%, #00A844 50%, #007A32 100%);
    justify-content: center;
    align-items: center;
    color: white;
}

.splash-content {
    text-align: center;
    animation: fadeInUp 0.8s ease;
}

.logo {
    margin-bottom: 16px;
}

.logo-icon {
    width: 80px;
    height: 80px;
    background: white;
    color: var(--primary);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    font-weight: 800;
    margin: 0 auto 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.logo h1 {
    font-size: 42px;
    font-weight: 800;
    letter-spacing: -1px;
}

.tagline {
    font-size: 16px;
    opacity: 0.9;
    margin-bottom: 40px;
    font-weight: 400;
}

.splash-loader {
    width: 160px;
    height: 4px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    margin: 0 auto;
    overflow: hidden;
}

.loader-bar {
    height: 100%;
    width: 0%;
    background: white;
    border-radius: 10px;
    animation: loadProgress 0.9s ease forwards;
}

@keyframes loadProgress {
    to { width: 100%; }
}

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

/* ==================== AUTH PAGES ==================== */
#login, #register {
    background: var(--bg);
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.auth-container {
    width: 100%;
    max-width: 420px;
    background: var(--white);
    border-radius: 24px;
    padding: 32px 28px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease;
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.logo-small {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
}

.logo-small .logo-icon {
    width: 42px;
    height: 42px;
    font-size: 22px;
    border-radius: 12px;
    margin: 0;
    box-shadow: none;
}

.logo-small span {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
}

.auth-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-header p {
    color: var(--text-light);
    font-size: 14px;
}

/* Form */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: 'Cairo', sans-serif;
    background: #FAFAFA;
    transition: all 0.2s;
    outline: none;
}

.input-group input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 200, 83, 0.1);
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-left: 48px;
}

.toggle-password {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.6;
    padding: 4px;
}

.toggle-password:hover {
    opacity: 1;
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-light);
}

.checkbox input {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.checkbox.terms {
    margin: 4px 0;
    line-height: 1.5;
}

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

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 200, 83, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

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

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

.btn-full {
    width: 100%;
}

.auth-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: var(--text-light);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    padding: 0 16px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--text-light);
}

.link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

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

.link-bold {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.link-bold:hover {
    text-decoration: underline;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
    .auth-container {
        padding: 28px 20px;
        border-radius: 20px;
        box-shadow: none;
        background: transparent;
    }

    #login, #register {
        background: var(--white);
        padding: 16px;
    }
}

/* ==================== TOAST / MESSAGES ==================== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--secondary);
    color: white;
    padding: 14px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

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

.toast.success {
    background: var(--primary);
}

/* ==================== ONBOARDING ==================== */
#onboarding {
    background: var(--white);
    padding: 20px;
    overflow-y: auto;
}

.onboarding-container {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.onb-progress {
    height: 6px;
    background: var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
    overflow: hidden;
}

.onb-progress-bar {
    height: 100%;
    width: 25%;
    background: var(--primary);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.onb-step-indicator {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 24px;
}

.onb-step {
    display: none;
    flex: 1;
    animation: fadeInUp 0.4s ease;
}

.onb-step.active {
    display: block;
}

.onb-step h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    text-align: center;
}

.onb-desc {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 28px;
    font-size: 14px;
}

.goal-cards, .activity-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.goal-card, .activity-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    background: var(--white);
}

.goal-card:hover, .activity-card:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.goal-card.selected, .activity-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(0, 200, 83, 0.15);
}

.goal-card .icon, .activity-card .icon {
    font-size: 28px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F3F4F6;
    border-radius: 12px;
}

.goal-card.selected .icon, .activity-card.selected .icon {
    background: white;
}

.goal-card .info h4, .activity-card .info h4 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
}

.goal-card .info p, .activity-card .info p {
    font-size: 12px;
    color: var(--text-light);
}

.gender-select {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.gender-btn {
    flex: 1;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: white;
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.gender-btn.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.input-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.input-row .input-group {
    flex: 1;
}

.onb-nav {
    display: flex;
    gap: 12px;
    margin-top: 32px;
    padding-bottom: 20px;
}

.onb-nav .btn {
    flex: 1;
}

.result-card {
    text-align: center;
    padding: 40px 20px;
}

.result-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.result-calories {
    font-size: 18px;
    margin: 16px 0;
}

.result-calories strong {
    font-size: 36px;
    color: var(--primary);
    display: block;
    margin-top: 8px;
}

.result-desc {
    color: var(--text-light);
    font-size: 14px;
}

/* ==================== APP HEADER & HOME ==================== */
.app-header {
    background: linear-gradient(160deg, #00C853 0%, #00A844 100%);
    color: white;
    padding: 20px 20px 28px;
    border-radius: 0 0 28px 28px;
}

.app-header.simple {
    background: var(--white);
    color: var(--text);
    border-radius: 0;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.app-header.simple h2 {
    font-size: 18px;
    font-weight: 700;
}

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

.greeting {
    font-size: 13px;
    opacity: 0.9;
}

.header-top h2 {
    font-size: 22px;
    font-weight: 700;
}

.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.2);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calories-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 16px 20px;
}

.cal-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: white;
    color: var(--primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cal-number {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.cal-label {
    font-size: 11px;
    font-weight: 600;
}

.cal-info p {
    font-size: 13px;
    opacity: 0.9;
}

.cal-goal {
    font-size: 16px !important;
    font-weight: 700;
    opacity: 1 !important;
    margin-top: 4px;
}

.home-content, .profile-content {
    padding: 20px;
    padding-bottom: 100px;
    flex: 1;
    overflow-y: auto;
}

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

.section-title h3 {
    font-size: 18px;
    font-weight: 700;
}

.meals-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.meal-card {
    display: flex;
    gap: 14px;
    background: white;
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}

.meal-img {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    flex-shrink: 0;
}

.meal-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.meal-info h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
}

.meal-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--text-light);
}

.meal-type {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    margin-bottom: 6px;
}

/* ==================== BOTTOM NAV ==================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    font-size: 11px;
    color: var(--text-light);
    padding: 6px 10px;
    transition: color 0.2s;
}

.nav-item.active {
    color: var(--primary);
    font-weight: 700;
}

.nav-icon {
    font-size: 20px;
}

/* ==================== PROFILE ==================== */
.profile-card {
    text-align: center;
    padding: 24px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    margin: 0 auto 12px;
}

.profile-card h3 {
    font-size: 20px;
    font-weight: 700;
}

.profile-card p {
    color: var(--text-light);
    font-size: 13px;
}

.profile-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.stat-item {
    flex: 1;
    background: white;
    border-radius: var(--radius-sm);
    padding: 16px 8px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 11px;
    color: var(--text-light);
}

.profile-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    background: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: var(--shadow);
    color: var(--text);
}

.menu-item.danger {
    color: var(--danger);
}

.placeholder-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-light);
}

.placeholder-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.placeholder-content h3 {
    font-size: 20px;
    color: var(--text);
    margin-bottom: 8px;
}

/* ==================== MEALS PAGE ==================== */
.meals-page-content, .plan-content, .progress-content {
    padding: 16px 20px 100px;
    flex: 1;
    overflow-y: auto;
}

.meal-filters {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.filter-btn {
    flex-shrink: 0;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    background: white;
    font-family: 'Cairo', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.2s;
}

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

.meals-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.meal-card-full {
    display: flex;
    gap: 14px;
    background: white;
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow);
}

.meal-img-lg {
    width: 90px;
    height: 90px;
    border-radius: 14px;
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    flex-shrink: 0;
}

.meal-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.meal-details h4 {
    font-size: 15px;
    font-weight: 700;
}

.meal-macros {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: var(--text-light);
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 20px;
    border: none;
    font-family: 'Cairo', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: var(--primary-light);
    color: var(--primary-dark);
    margin-top: 6px;
    width: fit-content;
}

.btn-swap:hover {
    background: var(--primary);
    color: white;
}

/* ==================== PLAN PAGE ==================== */
.current-plan-card {
    background: linear-gradient(160deg, #00C853 0%, #00A844 100%);
    color: white;
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
}

.plan-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    margin-bottom: 12px;
}

.current-plan-card h3 {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
}

.current-plan-card p {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 16px;
}

.plan-calories-box {
    background: rgba(255,255,255,0.15);
    border-radius: 14px;
    padding: 12px;
}

.big-cal {
    display: block;
    font-size: 36px;
    font-weight: 800;
    line-height: 1.1;
}

.macros-row {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.macro-item {
    flex: 1;
    background: white;
    border-radius: 14px;
    padding: 14px 8px;
    text-align: center;
    box-shadow: var(--shadow);
}

.macro-bar {
    height: 6px;
    border-radius: 10px;
    margin-bottom: 8px;
    background: #E5E7EB;
    position: relative;
    overflow: hidden;
}

.macro-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 70%;
    border-radius: 10px;
}

.macro-bar.protein::after { background: #EF4444; width: 80%; }
.macro-bar.carbs::after { background: #F59E0B; width: 65%; }
.macro-bar.fat::after { background: #3B82F6; width: 50%; }

.macro-value {
    display: block;
    font-size: 16px;
    font-weight: 800;
    color: var(--text);
}

.macro-label {
    font-size: 11px;
    color: var(--text-light);
}

.section-label {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 12px;
}

.plan-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.plan-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: white;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.plan-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.plan-option-icon {
    font-size: 28px;
}

.plan-option h5 {
    font-size: 15px;
    font-weight: 700;
}

.plan-option p {
    font-size: 12px;
    color: var(--text-light);
}

.plan-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ==================== PROGRESS PAGE ==================== */
.weight-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

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

.weight-header h4 {
    font-size: 14px;
    color: var(--text-light);
}

.weight-display {
    text-align: center;
    margin-bottom: 8px;
}

.weight-value {
    font-size: 48px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
}

.weight-unit {
    font-size: 16px;
    color: var(--text-light);
    margin-right: 4px;
}

.weight-change {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
}

.change-down {
    color: var(--primary);
    font-weight: 700;
}

.weight-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 140px;
    background: white;
    border-radius: 16px;
    padding: 16px 12px 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    gap: 4px;
}

.chart-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 70%;
    max-width: 28px;
    background: linear-gradient(180deg, var(--primary), #00A844);
    border-radius: 6px 6px 2px 2px;
    transition: height 0.4s ease;
    min-height: 8px;
}

.chart-label {
    font-size: 10px;
    color: var(--text-light);
    margin-top: 6px;
}

.chart-val {
    font-size: 10px;
    font-weight: 600;
    color: var(--text);
}

.progress-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.p-stat {
    flex: 1;
    background: white;
    border-radius: 14px;
    padding: 14px 8px;
    text-align: center;
    box-shadow: var(--shadow);
}

.p-stat-icon {
    font-size: 22px;
    display: block;
    margin-bottom: 4px;
}

.p-stat-value {
    display: block;
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

.p-stat-label {
    font-size: 11px;
    color: var(--text-light);
}

.weekly-summary {
    background: white;
    border-radius: 16px;
    padding: 4px 0;
    box-shadow: var(--shadow);
}

.week-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

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

.week-item strong {
    font-weight: 700;
    color: var(--primary);
}

/* ==================== MODALS ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 2000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.modal-box {
    background: white;
    width: 100%;
    max-width: 480px;
    border-radius: 24px 24px 0 0;
    padding: 20px 20px 32px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: #F3F4F6;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
}

.auth-form select {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: 'Cairo', sans-serif;
    background: #FAFAFA;
    outline: none;
}

.auth-form select:focus {
    border-color: var(--primary);
    background: white;
}

.chart-empty {
    text-align: center;
    color: var(--text-light);
    width: 100%;
    padding: 28px 12px;
    font-size: 14px;
    line-height: 1.6;
}

.modal-overlay.open {
    display: flex !important;
}

#progress.screen.active {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg);
}

/* ==================== MEALS REAL ==================== */
.fab-add-meal {
    position: fixed;
    bottom: 88px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 28px;
    font-weight: 700;
    box-shadow: 0 8px 24px rgba(0, 200, 83, 0.35);
    cursor: pointer;
    z-index: 90;
}

.fab-add-meal:active {
    transform: scale(0.96);
}

.meal-img-wrap {
    width: 90px;
    height: 90px;
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #E8F5E9, #C8E6C9);
    display: flex;
    align-items: center;
    justify-content: center;
}

.meal-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.meal-actions {
    margin-top: 6px;
}

.btn-delete-meal {
    background: #FEE2E2;
    color: #B91C1C;
}

.meal-image-upload {
    text-align: center;
    margin-bottom: 8px;
}

.meal-preview {
    width: 100%;
    height: 160px;
    border-radius: 16px;
    background: #F3F4F6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    overflow: hidden;
}

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

.ai-status {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.5;
    text-align: center;
}

.ai-loading {
    color: var(--primary);
    font-weight: 600;
    animation: pulse 1.2s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.image-pick-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.image-pick-btn {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    font-size: 13px;
}

.modal-close {
    z-index: 5;
    position: relative;
}


.cal-plan, .cal-consumed {
    font-size: 12px;
    color: rgba(255,255,255,0.85);
    margin-top: 2px;
}

.macro-bars {
    padding: 12px 20px 4px;
    background: var(--primary);
}

.macro-bar-item { margin-bottom: 10px; }
.macro-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: rgba(255,255,255,0.9);
    margin-bottom: 4px;
}
.macro-bar-track {
    height: 8px;
    background: rgba(255,255,255,0.25);
    border-radius: 99px;
    overflow: hidden;
}
.macro-bar-fill {
    height: 100%;
    border-radius: 99px;
    transition: width 0.35s ease;
}
.macro-bar-fill.protein { background: #fff; }
.macro-bar-fill.carbs { background: #C8E6C9; }
.macro-bar-fill.fat { background: #FFE082; }

.fit-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 700;
    margin-top: 4px;
}
.fit-good { background: #E8F5E9; color: #2E7D32; }
.fit-warn { background: #FFF8E1; color: #F57F17; }
.fit-bad { background: #FFEBEE; color: #C62828; }

.meal-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.btn-log-today {
    background: var(--primary);
    color: #fff;
}

.fit-reason {
    font-size: 11px;
    color: var(--text-light);
    margin: 4px 0 0;
    line-height: 1.4;
}
.meals-fit-summary {
    grid-column: 1 / -1;
    background: #E8F5E9;
    color: #1B5E20;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 12px;
    margin-bottom: 8px;
}
.meal-thumb-sm {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    object-fit: cover;
}


.meals-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.rest-sub {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 2px;
    font-weight: 400;
}
.cart-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    position: relative;
}
.cart-count {
    background: #fff;
    color: var(--primary);
    border-radius: 99px;
    padding: 1px 7px;
    font-size: 12px;
    margin-right: 4px;
}
.menu-price {
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
}
.btn-add-cart {
    background: var(--primary);
    color: #fff;
}
.cart-items { max-height: 40vh; overflow-y: auto; }
.cart-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    gap: 10px;
}
.cart-line-info { flex: 1; }
.cart-line-info h4 { font-size: 14px; margin-bottom: 4px; }
.cart-line-info p { font-size: 12px; color: var(--text-light); }
.cart-qty {
    display: flex;
    align-items: center;
    gap: 8px;
}
.cart-qty button {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-weight: 700;
}
.cart-summary {
    margin: 14px 0;
    padding: 12px;
    background: #F3F4F6;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.8;
}
.checkout-totals {
    background: #E8F5E9;
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.8;
}
.menu-desc {
    font-size: 12px;
    color: var(--text-light);
    margin: 4px 0;
}


/* ===== EatWise UI polish ===== */
:root {
    --primary: #00A878;
    --primary-dark: #008F66;
    --primary-soft: #E6F7F1;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
    --radius: 16px;
}
.logo-icon {
    width: 64px; height: 64px; border-radius: 18px;
    background: linear-gradient(145deg, #00C896, #008F66);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 28px;
    box-shadow: 0 10px 30px rgba(0,168,120,0.35);
}
.logo-small .logo-icon { width: 36px; height: 36px; font-size: 16px; border-radius: 10px; }
.btn-primary, .btn.btn-primary {
    background: linear-gradient(135deg, #00C896, #00A878);
    border: none; box-shadow: 0 6px 16px rgba(0,168,120,0.28);
    border-radius: 14px; font-weight: 700;
}
.input-group input, .input-group select {
    border-radius: 12px; border: 1.5px solid #E5E7EB;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group input:focus, .input-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,168,120,0.15);
    outline: none;
}
.field-hint { display:block; margin-top:6px; font-size:11px; color:#6B7280; }
.meal-card, .meal-card-full {
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.04); overflow: hidden;
}
.bottom-nav {
    backdrop-filter: blur(12px); background: rgba(255,255,255,0.95);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}
.cart-btn { box-shadow: 0 4px 12px rgba(0,168,120,0.3); }
.fab-add-meal { box-shadow: 0 8px 24px rgba(0,168,120,0.4); }
.modal-box { border-radius: 20px; box-shadow: var(--shadow-md); }

.change-up { color: #EF4444; font-weight: 700; }
.cal-chart .chart-bar.bar-cal { background: linear-gradient(180deg, #34D399, #00A878); }
.cal-chart .chart-bar.bar-over { background: linear-gradient(180deg, #FCA5A5, #EF4444); }
.chart-bar-col .chart-val { font-size: 10px; color: var(--text-light); margin-bottom: 4px; }
.daily-meals-log { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.day-meals-card {
    background: #fff;
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.04);
}
.day-meals-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.day-meals-date { font-size: 12px; color: #9CA3AF; }
.day-meals-cal {
    margin-right: auto;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
}
.day-meals-names { display: flex; flex-wrap: wrap; gap: 6px; }
.meal-chip {
    background: var(--primary-soft, #E6F7F1);
    color: #065F46;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 99px;
    font-weight: 600;
}


.meals-search-wrap {
    padding: 0 16px 10px;
}
.meals-search {
    width: 100%;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1.5px solid #E5E7EB;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
}
.meals-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,168,120,0.12);
    outline: none;
}
.meal-categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 0 16px 12px;
    -webkit-overflow-scrolling: touch;
}
.meal-categories::-webkit-scrollbar { display: none; }
.cat-chip {
    flex-shrink: 0;
    border: 1.5px solid #E5E7EB;
    background: #fff;
    border-radius: 99px;
    padding: 8px 14px;
    font-size: 13px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    color: #374151;
}
.cat-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.meal-cat-tag {
    display: inline-block;
    font-size: 11px;
    background: #F3F4F6;
    color: #4B5563;
    padding: 2px 8px;
    border-radius: 99px;
    margin-top: 4px;
}


.packages-hint {
    font-size: 12px;
    color: #6B7280;
    padding: 0 4px 10px;
    margin: 0;
}
.packages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}
.package-card {
    background: #fff;
    border: 1.5px solid #E5E7EB;
    border-radius: 16px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
}
.package-card.featured {
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(0,168,120,0.15);
}
.package-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}
.package-card h4 {
    margin: 0 0 4px;
    font-size: 17px;
}
.package-card p {
    margin: 0;
    font-size: 13px;
    color: #6B7280;
    line-height: 1.5;
}
.package-price {
    text-align: left;
    white-space: nowrap;
}
.package-price .price {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}
.package-price .old {
    font-size: 12px;
    color: #9CA3AF;
    text-decoration: line-through;
}
.package-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0;
}
.package-slot-badge {
    background: var(--primary-soft, #E6F7F1);
    color: #065F46;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 99px;
}
.package-discount {
    display: inline-block;
    background: #FEF3C7;
    color: #92400E;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
}
.modal-box-lg {
    max-height: 90vh;
    overflow-y: auto;
}
.slot-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.slot-toggle {
    border: 1.5px solid #E5E7EB;
    background: #fff;
    border-radius: 99px;
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
}
.slot-toggle.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 700;
}
.pkg-mode-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.package-slots-custom .slot-pick {
    margin-bottom: 12px;
}
.package-slots-custom select {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1.5px solid #E5E7EB;
    font-family: inherit;
}
.package-auto-preview {
    background: #F9FAFB;
    border-radius: 12px;
    padding: 12px;
    font-size: 13px;
    line-height: 1.7;
    margin-bottom: 12px;
}

/* =========================================================
   EatWise — UI/UX Design System v2
   ========================================================= */
:root {
    --primary: #00A878;
    --primary-dark: #008F66;
    --primary-light: #E6F7F1;
    --primary-soft: #E6F7F1;
    --secondary: #0F172A;
    --text: #0F172A;
    --text-light: #64748B;
    --text-muted: #94A3B8;
    --bg: #F1F5F9;
    --white: #FFFFFF;
    --border: #E2E8F0;
    --danger: #EF4444;
    --warning: #F59E0B;
    --success: #10B981;
    --radius: 18px;
    --radius-sm: 12px;
    --radius-xs: 8px;
    --shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 8px 28px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.12);
    --nav-h: 72px;
    --header-pad: 20px;
    --tap: 44px;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ----- Screens: smooth content area ----- */
.screen.active {
    animation: screenIn 0.28s var(--ease);
}
@keyframes screenIn {
    from { opacity: 0.6; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.home-content,
.meals-page-content,
.plan-content,
.progress-content,
.profile-content {
    padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)) !important;
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
}

/* ----- Header ----- */
.app-header {
    background: linear-gradient(160deg, #00C896 0%, #00A878 55%, #008F66 100%) !important;
    padding: 20px 20px 24px !important;
    border-radius: 0 0 28px 28px;
    box-shadow: 0 12px 32px rgba(0, 168, 120, 0.25);
}
.app-header.simple {
    background: var(--white) !important;
    color: var(--text) !important;
    box-shadow: 0 1px 0 var(--border) !important;
    border-radius: 0 !important;
    padding: 16px 20px !important;
    position: sticky;
    top: 0;
    z-index: 20;
}
.app-header.simple h2 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.greeting { opacity: 0.9; font-size: 14px; }
#home-username { font-size: 24px; font-weight: 800; letter-spacing: -0.03em; }

.calories-summary {
    margin-top: 16px;
    gap: 16px;
}
.cal-circle {
    width: 96px !important;
    height: 96px !important;
    background: rgba(255,255,255,0.18) !important;
    border: 3px solid rgba(255,255,255,0.35) !important;
    backdrop-filter: blur(8px);
}
.cal-number { font-size: 28px !important; font-weight: 800 !important; }
.macro-bars { padding: 14px 20px 16px !important; }

/* ----- Buttons ----- */
.btn, .btn-primary, .btn.btn-primary {
    min-height: var(--tap);
    border-radius: 14px !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em;
    transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), background 0.15s var(--ease);
}
.btn-primary, .btn.btn-primary {
    background: linear-gradient(135deg, #00C896, #00A878) !important;
    box-shadow: 0 8px 20px rgba(0, 168, 120, 0.28) !important;
}
.btn-primary:hover, .btn.btn-primary:hover {
    box-shadow: 0 10px 24px rgba(0, 168, 120, 0.35) !important;
}
.btn-primary:active, .btn:active {
    transform: scale(0.97);
}
.btn-outline {
    border: 1.5px solid var(--border) !important;
    background: var(--white) !important;
    color: var(--text) !important;
}
.btn-outline:hover {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
    background: var(--primary-light) !important;
}
.btn-sm {
    min-height: 36px;
    padding: 8px 14px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 700;
}

/* ----- Inputs ----- */
.input-group { margin-bottom: 14px; }
.input-group label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
    display: block;
}
.input-group input,
.input-group select,
.input-group textarea,
.meals-search {
    min-height: var(--tap);
    border-radius: 14px !important;
    border: 1.5px solid var(--border) !important;
    background: var(--white) !important;
    padding: 12px 16px !important;
    font-size: 15px !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.input-group input:focus,
.input-group select:focus,
.meals-search:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 4px rgba(0, 168, 120, 0.12) !important;
    outline: none;
}

/* ----- Auth ----- */
.auth-container {
    max-width: 420px;
    margin: 0 auto;
    padding: 32px 24px 40px;
}
.auth-header {
    text-align: center;
    margin-bottom: 28px;
}
.auth-header h2 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-top: 12px;
}
.auth-header p { color: var(--text-light); }

/* ----- Cards ----- */
.meal-card,
.meal-card-full,
.weight-card,
.current-plan-card,
.package-card,
.day-meals-card,
.p-stat,
.weekly-summary,
.plan-option {
    background: var(--white) !important;
    border: 1px solid rgba(15, 23, 42, 0.05) !important;
    border-radius: var(--radius) !important;
    box-shadow: var(--shadow) !important;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.meal-card-full:active,
.package-card:active {
    transform: scale(0.99);
}
.meal-card-full {
    overflow: hidden;
}
.meal-img-wrap img,
.meal-thumb {
    transition: transform 0.35s var(--ease);
}
.meal-card-full:hover .meal-thumb {
    transform: scale(1.03);
}

/* ----- Filters & chips ----- */
.meal-filters, .meal-categories {
    gap: 8px !important;
    padding-bottom: 12px !important;
}
.filter-btn, .cat-chip {
    min-height: 40px;
    padding: 8px 16px !important;
    border-radius: 999px !important;
    font-weight: 600 !important;
    border: 1.5px solid var(--border) !important;
    background: var(--white) !important;
    color: var(--text) !important;
    transition: all 0.2s var(--ease);
}
.filter-btn.active, .cat-chip.active {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 12px rgba(0, 168, 120, 0.25);
}

.meals-search-wrap { padding: 4px 16px 12px !important; }

.meals-fit-summary {
    border-radius: 14px !important;
    padding: 12px 14px !important;
    font-size: 12.5px !important;
    line-height: 1.5;
}

/* ----- Bottom nav (thumb-friendly) ----- */
.bottom-nav {
    height: calc(var(--nav-h) + env(safe-area-inset-bottom)) !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(16px) saturate(1.4) !important;
    -webkit-backdrop-filter: blur(16px) saturate(1.4) !important;
    border-top: 1px solid rgba(15, 23, 42, 0.06) !important;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.06) !important;
    z-index: 50;
}
.nav-item {
    min-height: 56px;
    border-radius: 14px;
    gap: 4px !important;
    color: var(--text-muted) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    transition: color 0.2s, background 0.2s;
}
.nav-item.active {
    color: var(--primary) !important;
    background: var(--primary-light) !important;
}
.nav-icon { font-size: 20px !important; }

/* ----- FAB ----- */
.fab-add-meal {
    width: 56px !important;
    height: 56px !important;
    bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)) !important;
    box-shadow: 0 12px 28px rgba(0, 168, 120, 0.4) !important;
    border: 3px solid #fff !important;
}
.cart-btn {
    min-height: 44px;
    border-radius: 14px !important;
    padding: 10px 14px !important;
    box-shadow: 0 6px 16px rgba(0, 168, 120, 0.3) !important;
}

/* ----- Modals ----- */
.modal-overlay {
    background: rgba(15, 23, 42, 0.45) !important;
    backdrop-filter: blur(6px);
    padding: 16px;
    align-items: flex-end;
}
@media (min-width: 520px) {
    .modal-overlay { align-items: center; }
}
.modal-box {
    border-radius: 24px 24px 20px 20px !important;
    box-shadow: var(--shadow-lg) !important;
    max-height: 92vh;
    width: 100%;
    max-width: 440px;
    animation: modalUp 0.28s var(--ease);
}
@keyframes modalUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
}
.modal-header {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}
.modal-header h3 { font-weight: 800; font-size: 18px; }
.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--bg);
    border: none;
    font-size: 16px;
    cursor: pointer;
}

/* ----- Progress charts ----- */
.weight-chart {
    background: var(--white);
    border-radius: var(--radius);
    padding: 16px 12px 12px;
    box-shadow: var(--shadow);
    gap: 6px !important;
}
.chart-bar {
    border-radius: 8px 8px 4px 4px !important;
    background: linear-gradient(180deg, #34D399, #00A878) !important;
}
.section-label {
    font-size: 15px !important;
    font-weight: 800 !important;
    margin: 20px 4px 12px !important;
    letter-spacing: -0.02em;
}

/* ----- Splash / Logo ----- */
#splash {
    background: linear-gradient(165deg, #00D68F 0%, #00A878 48%, #007A5A 100%) !important;
}
.logo-icon {
    width: 72px !important;
    height: 72px !important;
    border-radius: 20px !important;
    background: linear-gradient(145deg, #00C896, #008F66) !important;
    color: #fff !important;
    font-size: 32px !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2) !important;
}
.logo-small .logo-icon {
    width: 40px !important;
    height: 40px !important;
    font-size: 18px !important;
    border-radius: 12px !important;
}

/* ----- Empty states ----- */
.chart-empty {
    text-align: center;
    padding: 28px 16px !important;
    color: var(--text-light) !important;
    font-size: 14px !important;
    line-height: 1.6;
    background: var(--white);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

/* ----- Fit badges ----- */
.fit-badge {
    font-size: 11px !important;
    font-weight: 800 !important;
    padding: 4px 10px !important;
}
.fit-good { background: #D1FAE5 !important; color: #065F46 !important; }
.fit-warn { background: #FEF3C7 !important; color: #92400E !important; }
.fit-bad { background: #FEE2E2 !important; color: #991B1B !important; }

/* ----- Package cards ----- */
.package-card.featured {
    border: 2px solid var(--primary) !important;
    position: relative;
}
.package-card.featured::before {
    content: 'الأكثر طلباً';
    position: absolute;
    top: -10px;
    left: 16px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 99px;
}

/* ----- Toast-friendly spacing ----- */
.meals-grid {
    padding: 0 16px 8px !important;
    gap: 12px !important;
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}


/* =========================================================
   Contrast + Nav icons fix
   ========================================================= */

/* Home green header: ALWAYS white text */
#home .app-header,
#home .app-header * {
    color: #ffffff !important;
}
#home .app-header .icon-btn {
    background: rgba(255,255,255,0.2) !important;
    color: #fff !important;
    border: none;
}
#home .macro-bar-track {
    background: rgba(255,255,255,0.25) !important;
}
#home .macro-bar-fill.protein { background: #ffffff !important; }
#home .macro-bar-fill.carbs { background: #BBF7D0 !important; }
#home .macro-bar-fill.fat { background: #FDE68A !important; }
#home .cal-circle {
    color: #fff !important;
}
#home .cal-info p,
#home .cal-goal,
#home .cal-plan,
#home .cal-consumed {
    color: rgba(255,255,255,0.92) !important;
}
#home .cal-info strong {
    color: #fff !important;
}

/* Content areas: dark text on light bg */
.home-content,
.meals-page-content,
.plan-content,
.progress-content,
.profile-content,
.home-content h3,
.section-title h3,
.section-label {
    color: #0F172A !important;
}
.home-content .link {
    color: #00A878 !important;
}

/* Fit summary: dark text on soft green, not green-on-green */
.meals-fit-summary {
    background: #F0FDF4 !important;
    color: #14532D !important;
    border: 1px solid #BBF7D0 !important;
}

/* Simple headers: dark on white */
.app-header.simple,
.app-header.simple h2,
.app-header.simple p,
.app-header.simple .rest-sub {
    color: #0F172A !important;
    background-color: transparent;
}
.app-header.simple {
    background: #FFFFFF !important;
}

/* Cards text */
.meal-card, .meal-card-full, .package-card, .weight-card,
.meal-details h4, .meal-info h4 {
    color: #0F172A !important;
}
.meal-type, .meal-meta, .meal-macros, .fit-reason, .menu-desc, .rest-sub {
    color: #64748B !important;
}
.menu-price {
    color: #00A878 !important;
}

/* Bottom nav icons SVG */
.nav-icon {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    margin: 0 auto 2px;
}
.nav-svg {
    width: 22px;
    height: 22px;
    display: block;
}
.nav-item {
    color: #94A3B8 !important;
    background: transparent !important;
}
.nav-item .nav-icon,
.nav-item span:not(.nav-icon) {
    color: inherit !important;
}
.nav-item.active {
    color: #00A878 !important;
    background: #ECFDF5 !important;
}
.nav-item.active .nav-svg {
    stroke: #00A878;
}
.bottom-nav {
    background: #FFFFFF !important;
    border-top: 1px solid #E2E8F0 !important;
}

/* Avoid green bg with green body text globally on main */
body {
    background: #F8FAFC !important;
    color: #0F172A !important;
}

/* Primary buttons: white text on green */
.btn-primary, .btn.btn-primary, .cart-btn, .fab-add-meal, .btn-add-cart, .btn-log-today {
    color: #FFFFFF !important;
}

/* Auth / splash stay intentional */
#splash, #splash * {
    color: #fff !important;
}
#splash .logo-icon {
    background: #fff !important;
    color: #00A878 !important;
}

/* ============================================================
   EatWise Design System — Premium Clean (restrained)
   ============================================================ */
:root {
  --ew-green: #0D9F6E;
  --ew-green-hover: #0B8A5F;
  --ew-green-muted: #E8F5F0;
  --ew-ink: #111827;
  --ew-body: #374151;
  --ew-muted: #6B7280;
  --ew-line: #E5E7EB;
  --ew-bg: #F3F4F6;
  --ew-surface: #FFFFFF;
  --ew-danger: #DC2626;
  --ew-danger-bg: #FEF2F2;
  --ew-warn: #D97706;
  --ew-warn-bg: #FFFBEB;
  --ew-ok: #059669;
  --ew-ok-bg: #ECFDF5;
  --ew-r: 12px;
  --ew-r-sm: 8px;
  --ew-r-lg: 16px;
  --ew-space-1: 4px;
  --ew-space-2: 8px;
  --ew-space-3: 12px;
  --ew-space-4: 16px;
  --ew-space-5: 24px;
  --ew-space-6: 32px;
  --ew-shadow: 0 1px 2px rgba(17, 24, 39, 0.06), 0 1px 3px rgba(17, 24, 39, 0.08);
  --ew-shadow-md: 0 2px 8px rgba(17, 24, 39, 0.08);
  --ew-nav: 64px;
  --ew-font: 'Cairo', system-ui, -apple-system, sans-serif;
  --ew-text-xs: 12px;
  --ew-text-sm: 13px;
  --ew-text: 15px;
  --ew-text-md: 16px;
  --ew-text-lg: 18px;
  --ew-text-xl: 22px;
  --primary: var(--ew-green);
  --primary-dark: var(--ew-green-hover);
  --primary-light: var(--ew-green-muted);
  --primary-soft: var(--ew-green-muted);
  --text: var(--ew-ink);
  --text-light: var(--ew-muted);
  --bg: var(--ew-bg);
  --white: var(--ew-surface);
  --border: var(--ew-line);
  --radius: var(--ew-r);
  --radius-sm: var(--ew-r-sm);
  --shadow: var(--ew-shadow);
  --shadow-md: var(--ew-shadow-md);
}

body {
  font-family: var(--ew-font) !important;
  font-size: var(--ew-text) !important;
  background: var(--ew-bg) !important;
  color: var(--ew-ink) !important;
  line-height: 1.5 !important;
  -webkit-font-smoothing: antialiased;
}

/* Kill flashy motion from earlier layers */
.screen.active { animation: none !important; }
.modal-box { animation: none !important; }
.meal-card-full:hover .meal-thumb { transform: none !important; }

/* Typography scale */
h1, h2, h3, h4 {
  color: var(--ew-ink);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
h2 { font-size: var(--ew-text-xl) !important; }
h3 { font-size: var(--ew-text-lg) !important; }
h4, .section-label {
  font-size: var(--ew-text-md) !important;
  font-weight: 700 !important;
  margin: var(--ew-space-5) 0 var(--ew-space-3) !important;
  color: var(--ew-ink) !important;
}
p, span, label { line-height: 1.5; }

/* Page shells */
.home-content,
.meals-page-content,
.plan-content,
.progress-content,
.profile-content {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
  padding-left: var(--ew-space-4) !important;
  padding-right: var(--ew-space-4) !important;
  padding-bottom: calc(var(--ew-nav) + var(--ew-space-5) + env(safe-area-inset-bottom)) !important;
}

/* Headers — solid, no heavy gradient */
.app-header {
  background: var(--ew-green) !important;
  color: #fff !important;
  padding: var(--ew-space-5) var(--ew-space-4) !important;
  border-radius: 0 0 var(--ew-r-lg) var(--ew-r-lg);
  box-shadow: none !important;
}
.app-header.simple {
  background: var(--ew-surface) !important;
  color: var(--ew-ink) !important;
  border-bottom: 1px solid var(--ew-line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: var(--ew-space-4) !important;
  position: sticky;
  top: 0;
  z-index: 30;
}
.app-header.simple h2 {
  font-size: var(--ew-text-xl) !important;
  font-weight: 700 !important;
  color: var(--ew-ink) !important;
}
#home .app-header,
#home .app-header * { color: #fff !important; }
#home .greeting { font-size: var(--ew-text-sm); opacity: 0.9; font-weight: 500; }
#home #home-username { font-size: var(--ew-text-xl); font-weight: 700; }
#home .cal-info p,
#home .cal-goal,
#home .cal-plan,
#home .cal-consumed { color: rgba(255,255,255,0.9) !important; font-size: var(--ew-text-sm); }
#home .cal-circle {
  background: rgba(255,255,255,0.15) !important;
  border: 2px solid rgba(255,255,255,0.3) !important;
}
#home .macro-bars { background: var(--ew-green) !important; padding: var(--ew-space-3) var(--ew-space-4) var(--ew-space-4) !important; }
#home .macro-bar-label { font-size: var(--ew-text-xs); color: rgba(255,255,255,0.9) !important; }
#home .macro-bar-track { background: rgba(255,255,255,0.22) !important; height: 6px; border-radius: 99px; }
#home .macro-bar-fill.protein { background: #fff !important; }
#home .macro-bar-fill.carbs { background: #A7F3D0 !important; }
#home .macro-bar-fill.fat { background: #FDE68A !important; }

/* Splash — solid brand, minimal */
#splash {
  background: var(--ew-green) !important;
}
#splash .logo-icon {
  background: #fff !important;
  color: var(--ew-green) !important;
  box-shadow: var(--ew-shadow-md) !important;
  border-radius: var(--ew-r-lg) !important;
}
#splash h1 { font-size: 28px !important; font-weight: 700 !important; }
#splash .tagline { font-size: var(--ew-text-sm); opacity: 0.92; }

/* Buttons */
.btn,
.btn-primary,
.btn.btn-primary,
.btn-outline {
  min-height: 44px;
  padding: 10px 16px !important;
  border-radius: var(--ew-r-sm) !important;
  font-size: var(--ew-text-sm) !important;
  font-weight: 600 !important;
  font-family: var(--ew-font) !important;
  box-shadow: none !important;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-primary,
.btn.btn-primary,
.btn-add-cart,
.btn-log-today,
.cart-btn {
  background: var(--ew-green) !important;
  color: #fff !important;
  border: none !important;
}
.btn-primary:hover,
.btn.btn-primary:hover {
  background: var(--ew-green-hover) !important;
}
.btn-primary:active { opacity: 0.92; transform: none !important; }
.btn-outline {
  background: var(--ew-surface) !important;
  color: var(--ew-ink) !important;
  border: 1px solid var(--ew-line) !important;
}
.btn-outline:hover {
  background: var(--ew-bg) !important;
  border-color: #D1D5DB !important;
  color: var(--ew-ink) !important;
}
.btn-sm {
  min-height: 36px;
  padding: 6px 12px !important;
  font-size: var(--ew-text-xs) !important;
  border-radius: var(--ew-r-sm) !important;
  font-weight: 600;
}

/* Inputs */
.input-group { margin-bottom: var(--ew-space-3); }
.input-group label {
  font-size: var(--ew-text-xs);
  font-weight: 600;
  color: var(--ew-muted);
  margin-bottom: var(--ew-space-1);
}
.input-group input,
.input-group select,
.input-group textarea,
.meals-search {
  min-height: 44px;
  border-radius: var(--ew-r-sm) !important;
  border: 1px solid var(--ew-line) !important;
  background: var(--ew-surface) !important;
  padding: 10px 12px !important;
  font-size: var(--ew-text-sm) !important;
  color: var(--ew-ink) !important;
  box-shadow: none !important;
}
.input-group input:focus,
.input-group select:focus,
.meals-search:focus {
  border-color: var(--ew-green) !important;
  box-shadow: 0 0 0 3px rgba(13, 159, 110, 0.12) !important;
  outline: none;
}
.field-hint { font-size: var(--ew-text-xs); color: var(--ew-muted); margin-top: var(--ew-space-1); }

/* Cards */
.meal-card,
.meal-card-full,
.weight-card,
.current-plan-card,
.package-card,
.day-meals-card,
.p-stat,
.weekly-summary,
.plan-option,
.auth-container {
  background: var(--ew-surface) !important;
  border: 1px solid var(--ew-line) !important;
  border-radius: var(--ew-r) !important;
  box-shadow: var(--ew-shadow) !important;
}
.meal-card-full,
.package-card {
  padding: 0;
  overflow: hidden;
}
.meal-details,
.package-card { padding: var(--ew-space-3); }
.meal-details h4,
.meal-info h4 {
  font-size: var(--ew-text-md) !important;
  font-weight: 700 !important;
  color: var(--ew-ink) !important;
  margin: 4px 0 !important;
}
.meal-type, .meal-meta, .meal-macros, .fit-reason, .menu-desc, .rest-sub {
  color: var(--ew-muted) !important;
  font-size: var(--ew-text-xs) !important;
}
.menu-price {
  color: var(--ew-green) !important;
  font-weight: 700;
  font-size: var(--ew-text-sm) !important;
}

/* Chips / filters */
.filter-btn, .cat-chip, .slot-toggle {
  min-height: 36px;
  padding: 6px 12px !important;
  border-radius: 999px !important;
  font-size: var(--ew-text-xs) !important;
  font-weight: 600 !important;
  border: 1px solid var(--ew-line) !important;
  background: var(--ew-surface) !important;
  color: var(--ew-body) !important;
  box-shadow: none !important;
}
.filter-btn.active, .cat-chip.active, .slot-toggle.active {
  background: var(--ew-green) !important;
  border-color: var(--ew-green) !important;
  color: #fff !important;
}
.meal-cat-tag {
  background: var(--ew-bg) !important;
  color: var(--ew-body) !important;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
}
.fit-badge {
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 3px 8px !important;
  border-radius: 999px !important;
}
.fit-good { background: var(--ew-ok-bg) !important; color: var(--ew-ok) !important; }
.fit-warn { background: var(--ew-warn-bg) !important; color: var(--ew-warn) !important; }
.fit-bad { background: var(--ew-danger-bg) !important; color: var(--ew-danger) !important; }

.meals-fit-summary {
  background: var(--ew-green-muted) !important;
  color: #065F46 !important;
  border: 1px solid #A7F3D0 !important;
  border-radius: var(--ew-r-sm) !important;
  padding: var(--ew-space-3) !important;
  font-size: var(--ew-text-xs) !important;
  box-shadow: none !important;
}

/* Bottom nav — clean, opaque */
.bottom-nav {
  height: calc(var(--ew-nav) + env(safe-area-inset-bottom)) !important;
  padding-bottom: env(safe-area-inset-bottom) !important;
  background: var(--ew-surface) !important;
  border-top: 1px solid var(--ew-line) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
.nav-item {
  color: var(--ew-muted) !important;
  background: transparent !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  border-radius: var(--ew-r-sm);
  gap: 2px !important;
}
.nav-item.active {
  color: var(--ew-green) !important;
  background: var(--ew-green-muted) !important;
}
.nav-icon { width: 22px; height: 22px; margin: 0 auto; }
.nav-svg { width: 20px; height: 20px; }

/* FAB / cart */
.fab-add-meal {
  width: 52px !important;
  height: 52px !important;
  background: var(--ew-green) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: var(--ew-shadow-md) !important;
  bottom: calc(var(--ew-nav) + 12px + env(safe-area-inset-bottom)) !important;
}
.cart-btn {
  background: var(--ew-green) !important;
  color: #fff !important;
  border-radius: var(--ew-r-sm) !important;
  box-shadow: none !important;
  font-size: var(--ew-text-sm);
}

/* Modals */
.modal-overlay {
  background: rgba(17, 24, 39, 0.4) !important;
  backdrop-filter: none !important;
}
.modal-box {
  background: var(--ew-surface) !important;
  border-radius: var(--ew-r-lg) var(--ew-r-lg) 0 0 !important;
  box-shadow: var(--ew-shadow-md) !important;
  max-width: 480px;
}
@media (min-width: 520px) {
  .modal-box { border-radius: var(--ew-r-lg) !important; }
}
.modal-header {
  border-bottom: 1px solid var(--ew-line);
  padding-bottom: var(--ew-space-3);
  margin-bottom: var(--ew-space-4);
}
.modal-header h3 {
  font-size: var(--ew-text-lg) !important;
  font-weight: 700 !important;
  color: var(--ew-ink) !important;
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--ew-r-sm);
  background: var(--ew-bg);
  border: 1px solid var(--ew-line);
  color: var(--ew-body);
}

/* Charts / progress */
.weight-chart {
  background: var(--ew-surface);
  border: 1px solid var(--ew-line);
  border-radius: var(--ew-r);
  padding: var(--ew-space-4) var(--ew-space-3);
  box-shadow: var(--ew-shadow);
}
.chart-bar {
  background: var(--ew-green) !important;
  border-radius: 4px 4px 2px 2px !important;
}
.cal-chart .chart-bar.bar-over { background: var(--ew-danger) !important; }
.chart-val, .chart-label { font-size: 10px; color: var(--ew-muted); }

/* Empty / loading / error states */
.chart-empty,
.empty-state {
  text-align: center;
  padding: var(--ew-space-6) var(--ew-space-4) !important;
  background: var(--ew-surface) !important;
  border: 1px solid var(--ew-line) !important;
  border-radius: var(--ew-r) !important;
  color: var(--ew-muted) !important;
  font-size: var(--ew-text-sm) !important;
  line-height: 1.6 !important;
  box-shadow: none !important;
}
.chart-empty small,
.empty-state small {
  display: block;
  margin-top: var(--ew-space-2);
  color: #9CA3AF;
  font-size: var(--ew-text-xs);
}
.ai-loading,
.loading-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ew-muted);
  font-size: var(--ew-text-sm);
  font-weight: 500;
}
.ai-loading::before,
.loading-state::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid var(--ew-line);
  border-top-color: var(--ew-green);
  border-radius: 50%;
  animation: ew-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes ew-spin { to { transform: rotate(360deg); } }

.error-state {
  background: var(--ew-danger-bg) !important;
  border: 1px solid #FECACA !important;
  color: var(--ew-danger) !important;
  border-radius: var(--ew-r-sm);
  padding: var(--ew-space-3);
  font-size: var(--ew-text-sm);
  font-weight: 500;
}

/* Toast polish */
.toast {
  border-radius: var(--ew-r-sm) !important;
  box-shadow: var(--ew-shadow-md) !important;
  font-size: var(--ew-text-sm) !important;
  font-weight: 600 !important;
  padding: 12px 16px !important;
}

/* Package featured — quiet badge, no flashy glow */
.package-card.featured {
  border-color: var(--ew-green) !important;
  box-shadow: var(--ew-shadow) !important;
}
.package-card.featured::before {
  background: var(--ew-green);
  font-size: 10px;
  font-weight: 700;
  top: -9px;
}

/* Auth */
.auth-container {
  padding: var(--ew-space-6) var(--ew-space-5) !important;
  margin: var(--ew-space-5) auto;
  max-width: 400px;
  box-shadow: var(--ew-shadow) !important;
}
.auth-header h2 {
  font-size: var(--ew-text-xl) !important;
  font-weight: 700 !important;
  color: var(--ew-ink) !important;
}
.auth-header p { color: var(--ew-muted); font-size: var(--ew-text-sm); }
.logo-small .logo-icon {
  background: var(--ew-green) !important;
  color: #fff !important;
  box-shadow: none !important;
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .ai-loading::before, .loading-state::before { animation: none; }
}

.meal-preview-multi {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.meal-preview-multi .thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #E5E7EB;
  background: #F3F4F6;
}
.meal-preview-multi .thumb-wrap {
  position: relative;
}
.meal-preview-multi .thumb-count {
  font-size: 11px;
  color: #6B7280;
  width: 100%;
  margin-top: 4px;
}

.orders-admin-content {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px calc(80px + env(safe-area-inset-bottom));
}
.order-status-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
.orders-stats {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.orders-stats .stat-pill {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}
.orders-stats .stat-pill strong {
  color: #0D9F6E;
  display: block;
  font-size: 16px;
}
.orders-admin-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.order-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 1px 2px rgba(17,24,39,0.06);
}
.order-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}
.order-card-head strong { font-size: 14px; color: #111827; }
.order-card-meta {
  font-size: 12px;
  color: #6B7280;
  line-height: 1.5;
  margin-bottom: 8px;
}
.order-items-preview {
  font-size: 13px;
  color: #374151;
  background: #F9FAFB;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  line-height: 1.5;
}
.order-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.st-pending { background: #FEF3C7; color: #92400E; }
.st-confirmed { background: #DBEAFE; color: #1E40AF; }
.st-preparing { background: #E0E7FF; color: #3730A3; }
.st-on_the_way { background: #CFFAFE; color: #155E75; }
.st-delivered { background: #D1FAE5; color: #065F46; }
.st-cancelled { background: #FEE2E2; color: #991B1B; }
.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.order-actions .btn-sm {
  font-size: 11px;
}

.today-date-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}
.today-date-iso {
  font-size: 12px;
  font-weight: 500;
  color: #6B7280;
}
.log-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.package-price .price-calc {
  font-size: 14px !important;
  color: #0D9F6E;
}

.cart-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
}
.cart-row .menu-price,
.cart-price {
  font-weight: 700;
  color: #0D9F6E;
  font-size: 14px;
  white-space: nowrap;
}
.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid #F3F4F6;
}
.data-table th {
  background: #F9FAFB;
  font-weight: 700;
  color: #374151;
  font-size: 12px;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.cell-over td { background: #FEF2F2; }
.data-table tr.cell-under td { background: #FFFBEB; }
.consumed-list { display: flex; flex-direction: column; gap: 8px; }
.consumed-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #F3F4F6;
}
.consumed-row:last-child { border-bottom: none; }
.consumed-name { flex: 1; font-size: 13px; font-weight: 600; color: #111827; }
.consumed-cal { font-size: 12px; color: #6B7280; }
#weight-chart, #calories-chart {
  display: block !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
}


/* ===== Progress page layout fix ===== */
#progress .progress-content {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  overflow-x: hidden !important;
}

#progress .progress-stats {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 8px !important;
  margin: 8px 0 16px !important;
  width: 100% !important;
  flex: none !important;
}

#progress .p-stat {
  flex: none !important;
  width: auto !important;
  min-width: 0 !important;
  padding: 10px 6px !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
  border: 1px solid #E5E7EB !important;
}

#progress .p-stat-icon {
  font-size: 16px !important;
  margin-bottom: 2px !important;
}

#progress .p-stat-value {
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
}

#progress .p-stat-label {
  font-size: 10px !important;
  color: #6B7280 !important;
  line-height: 1.3 !important;
}

#progress .section-label {
  margin: 18px 0 8px !important;
  clear: both !important;
  position: relative !important;
  z-index: 1 !important;
}

#progress .weekly-summary {
  margin-bottom: 8px !important;
  position: relative !important;
  z-index: 1 !important;
}

#progress .progress-table-host,
#progress #weight-chart,
#progress #calories-chart {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 0 8px !important;
  padding: 0 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  overflow: visible !important;
  flex-wrap: nowrap !important;
  gap: 0 !important;
  position: relative !important;
  z-index: 1 !important;
}

#progress .data-table-wrap {
  display: block !important;
  width: 100% !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  background: #fff !important;
  border: 1px solid #E5E7EB !important;
  border-radius: 12px !important;
  margin: 0 !important;
}

#progress .data-table {
  width: 100% !important;
  min-width: 320px;
  border-collapse: collapse !important;
  table-layout: fixed !important;
}

#progress .data-table th,
#progress .data-table td {
  padding: 10px 8px !important;
  font-size: 12px !important;
  word-break: break-word;
}

#progress .daily-meals-log {
  position: relative !important;
  z-index: 1 !important;
  margin-bottom: 24px !important;
}

/* =========================================================
   Card design refresh — clean & consistent
   ========================================================= */
.meal-card,
.meal-card-full,
.weight-card,
.current-plan-card,
.package-card,
.day-meals-card,
.order-card,
.p-stat,
.weekly-summary,
.plan-option {
  background: #FFFFFF !important;
  border: 1px solid #E8ECF0 !important;
  border-radius: 14px !important;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.04) !important;
}

/* Progress stat cards — compact equal tiles */
#progress .progress-stats {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
  margin: 4px 0 16px !important;
}
#progress .p-stat {
  padding: 14px 8px !important;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 92px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#progress .p-stat:active {
  border-color: #0D9F6E !important;
  box-shadow: 0 2px 8px rgba(13, 159, 110, 0.12) !important;
}
#progress .p-stat-icon {
  width: 32px;
  height: 32px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: #EDF8F3;
  border-radius: 10px;
  font-size: 15px !important;
  margin-bottom: 8px !important;
}
#progress .p-stat-value {
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #111827 !important;
  letter-spacing: -0.02em;
}
#progress .p-stat-label {
  font-size: 11px !important;
  color: #6B7280 !important;
  margin-top: 2px;
}

/* Meal cards */
.meal-card-full {
  overflow: hidden !important;
  margin-bottom: 0;
}
.meal-card-full .meal-img-wrap {
  background: #F3F4F6;
}
.meal-card-full .meal-details {
  padding: 12px 14px 14px !important;
}
.meal-card-full h4 {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: #111827 !important;
  margin: 4px 0 6px !important;
  line-height: 1.35;
}
.meal-card {
  display: flex;
  gap: 12px;
  padding: 12px !important;
  align-items: stretch;
}
.meal-card .meal-info {
  flex: 1;
  min-width: 0;
}
.meal-card h4 {
  font-size: 14px !important;
  font-weight: 700 !important;
  margin: 2px 0 6px !important;
}

/* Weight / plan cards */
.weight-card,
.current-plan-card {
  padding: 16px !important;
}
.weight-card .weight-value {
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* Package cards */
.package-card {
  padding: 16px !important;
}
.package-card h4 {
  font-size: 16px !important;
  font-weight: 700 !important;
  margin: 0 0 6px !important;
}
.package-card p {
  font-size: 13px !important;
  color: #6B7280 !important;
  line-height: 1.5 !important;
}
.package-card.featured {
  border-color: #0D9F6E !important;
  box-shadow: 0 2px 10px rgba(13, 159, 110, 0.1) !important;
}
.package-card.featured::before {
  font-size: 10px !important;
  padding: 3px 8px !important;
}

/* Day meals / order cards */
.day-meals-card,
.order-card {
  padding: 14px !important;
}
.day-meals-head,
.order-card-head {
  margin-bottom: 10px !important;
}

/* Weekly summary as card list */
.weekly-summary {
  padding: 0 !important;
  overflow: hidden !important;
}
.weekly-summary .week-item {
  padding: 13px 16px !important;
}
.weekly-summary .week-item:last-child {
  border-bottom: none !important;
}
.weekly-summary .week-item strong {
  color: #0D9F6E;
  font-weight: 700;
}

/* Data tables as cards */
#progress .data-table-wrap {
  border-radius: 14px !important;
  border-color: #E8ECF0 !important;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.04) !important;
}


/* ===== UX polish pass ===== */
.toast {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  max-width: min(92vw, 360px);
  background: #111827;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { background: #065F46; }
.toast.error { background: #991B1B; }
.toast.info { background: #1E3A5F; }
.toast-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.toast-msg { flex: 1; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 16px !important;
}
.empty-state .empty-icon {
  font-size: 28px;
  margin-bottom: 4px;
  opacity: 0.9;
}
.empty-state p {
  margin: 0;
  font-weight: 700;
  color: #111827;
  font-size: 14px;
}
.empty-state small {
  color: #6B7280;
  margin-bottom: 8px;
}
.empty-cta {
  margin-top: 4px !important;
}

.screen-loading {
  opacity: 0.72;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.btn.is-loading {
  opacity: 0.75;
  cursor: wait;
}

.cart-pulse {
  animation: cartPulse 0.4s ease;
}
@keyframes cartPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* أوضح تفاعل للتنقل */
.nav-item:active {
  transform: scale(0.96);
}
.filter-btn:active, .cat-chip:active {
  transform: scale(0.97);
}

/* حقول أوضح عند الخطأ */
.input-group input:invalid:not(:placeholder-shown) {
  border-color: #FCA5A5 !important;
}

/* Help page */
.help-content {
  max-width: 480px;
  margin: 0 auto;
  padding: 12px 16px calc(88px + env(safe-area-inset-bottom));
}
.help-intro {
  background: #EDF8F3;
  border: 1px solid #C6EBD9;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.65;
  color: #065F46;
  margin-bottom: 8px;
}
.help-card {
  background: #fff;
  border: 1px solid #E8ECF0;
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(17,24,39,0.04);
}
.help-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid #F3F4F6;
  font-size: 13px;
  line-height: 1.55;
  color: #374151;
}
.help-step:last-child { border-bottom: none; }
.help-step span {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: #0D9F6E;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.help-faq { display: flex; flex-direction: column; gap: 8px; }
.help-item {
  background: #fff;
  border: 1px solid #E8ECF0;
  border-radius: 12px;
  padding: 0 14px;
  box-shadow: 0 1px 3px rgba(17,24,39,0.04);
}
.help-item summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 0;
  font-weight: 700;
  font-size: 13px;
  color: #111827;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.help-item summary::-webkit-details-marker { display: none; }
.help-item summary::after {
  content: '+';
  color: #0D9F6E;
  font-weight: 700;
  font-size: 16px;
}
.help-item[open] summary::after { content: '−'; }
.help-item p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.65;
  color: #4B5563;
  border-top: 1px solid #F3F4F6;
  padding-top: 12px;
}
.help-nav-guide .help-nav-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #F3F4F6;
  font-size: 13px;
}
.help-nav-guide .help-nav-row:last-child { border-bottom: none; }
.help-nav-guide strong { color: #111827; white-space: nowrap; }
.help-nav-guide span { color: #6B7280; text-align: left; }
.help-footer {
  margin-top: 20px;
  font-size: 12px;
  color: #9CA3AF;
  line-height: 1.6;
  text-align: center;
}


/* ===== Progress stats — compact cards (not tall pills) ===== */
#progress .progress-stats,
.progress-stats {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
  margin: 8px 0 16px !important;
  width: 100% !important;
  align-items: stretch !important;
}

#progress .p-stat,
.progress-stats .p-stat {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  min-height: 0 !important;
  height: auto !important;
  max-height: none !important;
  width: 100% !important;
  padding: 12px 8px !important;
  margin: 0 !important;
  background: #fff !important;
  border: 1px solid #E8ECF0 !important;
  border-radius: 14px !important;
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.05) !important;
  text-align: center !important;
  flex: none !important;
}

#progress .p-stat-icon,
.progress-stats .p-stat-icon {
  width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #EDF8F3 !important;
  border-radius: 10px !important;
  font-size: 16px !important;
  margin: 0 0 2px !important;
  line-height: 1 !important;
}

#progress .p-stat-value,
.progress-stats .p-stat-value {
  display: block !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  color: #111827 !important;
  line-height: 1.2 !important;
  margin: 0 !important;
}

#progress .p-stat-label,
.progress-stats .p-stat-label {
  display: block !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #6B7280 !important;
  line-height: 1.3 !important;
  margin: 0 !important;
  white-space: normal !important;
}

/* إخفاء لوحة الطلبات عن غير المدير */
#btn-open-orders-admin.d-none,
#btn-open-orders-admin.admin-only-btn.d-none {
  display: none !important;
}
#btn-open-orders-admin.d-flex {
  display: flex !important;
}
