:root {
    --eat-green: #22c55e;
    --eat-orange: #ef9144;
    --eat-red: #ef4444;
    --eat-carb: #f59e0b;
    --eat-fat: #a855f7;
    --eat-protein: #3b82f6;
    --bs-secondary-rgb: 166,172,177;
}

html, body {
    min-height: 100%;
    background-color: #0f1115;
}

body {
    padding-bottom: 5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.eat-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1030;
    background-color: #171a21;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.eat-bottom-nav a {
    flex: 1;
    text-align: center;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.75rem;
    padding: 0.5rem 0;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
}

.eat-bottom-nav a.active { color: var(--eat-green); }
.eat-bottom-nav a i { font-size: 1.25rem; line-height: 1; }

.btn, .form-control, .form-select { min-height: 44px; }
.btn-xsm {min-height: 30px}

.macro-carb    { color: var(--eat-carb); }
.macro-fat     { color: var(--eat-fat); }
.macro-protein { color: var(--eat-protein); }

.progress-eat .progress-bar { background-color: var(--eat-green); }
.progress-eat.equal .progress-bar { background-color: var(--eat-orange); }
.progress-eat.over .progress-bar { background-color: var(--eat-red); }

.ring-kcal { display: block; margin: 0 auto; }
.ring-kcal .ring-track { stroke: rgba(255,255,255,0.08); }
.ring-kcal .ring-progress { stroke: var(--eat-green); transition: stroke-dasharray 0.4s ease, stroke 0.2s ease; }
.ring-kcal.over .ring-progress { stroke: var(--eat-red); }
.ring-kcal.equal .ring-progress { stroke: var(--eat-orange); }

.week-swiper {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.35rem;
    padding: 0.25rem 0;
}
.week-swiper .day-pill {
    padding: 0.4rem 0;
    border-radius: 0.75rem;
    text-align: center;
    background: #171a21;
    color: #cbd5e1;
    border: 1px solid rgba(255,255,255,0.06);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    font-size: 0.7rem;
    min-height: 52px;
}
.week-swiper .day-pill.today { border-color: var(--eat-green); color: var(--eat-green); }
.week-swiper .day-pill.selected { background: var(--eat-green); color: #0f1115; border-color: var(--eat-green); }
.week-swiper .day-pill .day-num { font-weight: 700; font-size: 1.05rem; line-height: 1; }

.meal-card { border-radius: 1rem; }
.meal-card.finished { opacity: 0.65; }

.day-summary {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
}
@media (max-width: 380px) {
    .day-summary { grid-template-columns: 1fr; text-align: center; }
}
.macro-tri {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}
.macro-tile {
    background: #171a21;
    border-radius: 0.75rem;
    padding: 0.5rem 0.4rem;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.06);
}
.macro-tile.over { border-color: rgba(239,68,68,0.4); }
.macro-tile .macro-label { font-size: 0.7rem; font-weight: 600; }
.macro-tile .macro-value { font-size: 0.95rem; font-weight: 700; }
.macro-tile .macro-sub   { font-size: 0.65rem; color: #94a3b8; }

.meal-summary { display: flex; align-items: center; gap: 0.75rem; }
.meal-summary .meal-ring { flex: 0 0 auto; }
.meal-summary .meal-macros { flex: 1 1 auto; }
.meal-item-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.4rem 0; border-top: 1px solid rgba(255,255,255,0.06);
    background: transparent; border-left: 0; border-right: 0; border-bottom: 0;
    width: 100%; text-align: left; color: inherit;
}
.meal-item-row-flex {
    width: 100%;
}
.meal-item-row:first-child { border-top: 0; }
.meal-item-row:hover:not(:disabled) { background: rgba(255,255,255,0.02); }

.eat-toast-stack {
    position: fixed;
    top: calc(1rem + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: min(90vw, 24rem);
}
.eat-toast {
    margin: 0;
    pointer-events: auto;
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.eat-toast--out { opacity: 0; transform: translateY(-0.5rem); }

.export-table thead th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: #94a3b8; }
.export-day { break-inside: avoid; }
.export-meal { break-inside: avoid; }
.export-report { scroll-margin-top: 0.75rem; outline: none; }

.day-picker {
    background: #171a21;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 0.75rem;
    padding: 0.75rem;
}
.day-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.day-picker-month {
    flex: 1;
    text-align: center;
    font-weight: 600;
    text-transform: capitalize;
    color: #e2e8f0;
}
.day-picker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
    margin-bottom: 0.25rem;
    color: #94a3b8;
    font-size: 0.7rem;
    text-align: center;
}
.day-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
}
.day-picker-cell {
    all: unset;
    box-sizing: border-box;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    color: #cbd5e1;
    background: transparent;
    border: 1px solid transparent;
    cursor: default;
    -webkit-tap-highlight-color: transparent;
}
.day-picker-cell.empty { visibility: hidden; }
.day-picker-cell.has-meals {
    background: #0f1115;
    border-color: rgba(255,255,255,0.08);
    cursor: pointer;
}
.day-picker-cell.is-disabled {
    color: #4b5563;
    background: transparent;
}
.day-picker-cell.is-today {
    border-color: var(--eat-green);
    color: var(--eat-green);
}
.day-picker-cell.is-selected {
    background: var(--eat-green);
    color: #0f1115;
    border-color: var(--eat-green);
    font-weight: 700;
}
.day-picker-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}
.day-picker-count {
    flex: 1;
    color: #cbd5e1;
    font-size: 0.85rem;
}

@media print {
    html, body { background: #fff !important; color: #000 !important; }
    body { padding-bottom: 0; }
    .eat-bottom-nav, .eat-toast-stack, .export-no-print { display: none !important; }
    main.container { padding: 0 !important; max-width: none !important; }
    .export-report, .export-table, .export-table th, .export-table td { color: #000 !important; }
    .export-table { border-color: #000 !important; }
    .export-table thead th { color: #333 !important; }
    .text-secondary { color: #555 !important; }
    a { color: #000 !important; text-decoration: none !important; }
    h1, h2, h3 { color: #000 !important; }
}
