/* Compact calendar: keep every add target usable while letting meals grow. */
.week-calendar-heading{align-items:center;gap:12px;margin-bottom:8px}
.week-calendar-heading h2{font-size:calc(var(--app-text-scale, 1) * 27px);font-weight:800;margin:0 0 3px}
.week-calendar-heading .head-actions{flex-wrap:wrap;gap:6px}
.week-calendar-heading .head-actions button{min-height:44px;font-size:calc(var(--app-text-scale, 1) * 13px)}
.week-board-scroll{width:100%;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;padding:0 0 6px;border-radius:14px;scrollbar-color:#94bddb #edf5fb;scrollbar-width:thin}
.week-board-scroll:focus-visible{outline:3px solid #318dc4;outline-offset:3px}
.week-board{width:100%;min-width:1120px;border-collapse:separate;border-spacing:6px;table-layout:fixed;margin:0;color:#233f55}
.week-board th,.week-board td{border:0;padding:0;vertical-align:top;text-align:left}
.week-board .week-corner{width:84px;position:sticky;left:0;top:0;z-index:4;background:#f0f6fd;font-size:calc(var(--app-text-scale, 1) * 12px);color:#607b91;vertical-align:bottom;padding:8px 4px;border-radius:10px}
.week-board .week-column-head{position:sticky;top:0;z-index:3;padding:5px;border-radius:12px;background:#f5faff;text-align:center;font-weight:400;border:1px solid #e0ebf4;box-shadow:0 3px 6px #d7e7f530}
.week-board .week-column-head.is-today{border-color:#6fa9dc;background:#e9f4ff}
.week-board .week-open-button{display:flex;align-items:center;justify-content:space-between;gap:3px;width:100%;min-height:44px;padding:4px 6px;border:1px solid #d4e4f1;border-radius:9px;background:#ffffffb3;color:#296d9d;margin:0;font-family:inherit}
.week-date{display:flex;align-items:center;justify-content:center;gap:4px}
.week-date>span{font-size:calc(var(--app-text-scale, 1) * 12px);text-transform:capitalize;font-weight:650}
.week-date>strong{font-size:calc(var(--app-text-scale, 1) * 19px);line-height:1.1;font-weight:800;min-width:28px;min-height:28px;display:grid;place-items:center;border-radius:8px}
.is-today .week-date>strong{background:#287dcd;color:white}
.week-open-button>small{font-size:calc(var(--app-text-scale, 1) * 11px);font-weight:650;white-space:nowrap}
.week-meal-count{display:block;font-size:calc(var(--app-text-scale, 1) * 11px);line-height:1.2;color:#5b7488;margin:4px 0}
.week-board .day-macros{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px;margin:0}
.week-board .day-macros .macro-chip{display:flex;align-items:center;justify-content:center;min-width:0;min-height:22px;padding:2px 1px;font-size:calc(var(--app-text-scale, 1) * 11px);gap:2px;border-radius:6px}
.week-board .day-macros .macro-chip-icon{width:15px;height:15px;flex:0 0 15px}
.week-board .week-row-label{width:84px;position:sticky;left:0;z-index:2;background:#f0f6fd;border-radius:11px;padding:6px 3px;text-align:center;vertical-align:middle;font-size:calc(var(--app-text-scale, 1) * 12px);font-weight:800;box-shadow:5px 0 9px #dbe9f74d}
.week-row-label>span{display:block;width:28px;height:28px;margin:0 auto 3px}
.week-row-label svg{width:100%;height:100%}
.week-slot-row{--cell-bg:#fff1d9;--cell-border:#e9d8b8;--cell-text:#775d32}
.week-slot-1{--cell-bg:#e6f3ee;--cell-border:#c3e0d4;--cell-text:#3d7161}
.week-slot-2{--cell-bg:#e7f0fc;--cell-border:#c9dcf2;--cell-text:#426d9a}
.week-slot-3{--cell-bg:#f9eaf0;--cell-border:#e8cedb;--cell-text:#87556d}
.week-board .week-slot-cell{background:var(--cell-bg);border:1px solid var(--cell-border);border-radius:12px;padding:5px;vertical-align:middle}
.week-cell-stack{display:grid;gap:4px;min-width:0}
.week-cell-stack.has-meals{grid-template-columns:minmax(0,1fr) 44px;align-items:start}
.week-cell-meals{display:grid;gap:4px;min-width:0}
.week-planned-meal{background:#ffffffd9;border:1px solid #ffffff;border-radius:8px;padding:0 4px;min-width:0;box-shadow:0 2px 4px #344f600a}
.week-recipe-open{display:flex;align-items:center;width:100%;min-height:44px;padding:2px 0;margin:0;border:0;background:transparent;border-radius:6px;box-shadow:none;text-align:left;color:#274559}
.week-recipe-open:hover{background:#ffffff}
.week-board .week-meal-title{font-size:calc(var(--app-text-scale, 1) * 14px);font-weight:800;line-height:1.3;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;white-space:normal;overflow-wrap:anywhere;hyphens:auto}
.week-board .week-eaten{font-size:calc(var(--app-text-scale, 1) * 11px);line-height:1.2;color:#36715a;padding-bottom:3px;display:block}
.week-add-meal{display:flex;align-items:center;justify-content:center;gap:5px;width:100%;min-width:44px;min-height:44px;padding:4px;margin:0;border:1px dashed var(--cell-border);border-radius:8px;background:#ffffff70;color:var(--cell-text);box-shadow:none}
.week-add-meal>span{font-size:calc(var(--app-text-scale, 1) * 25px);font-weight:400;line-height:1}
.week-add-meal>small{font-size:calc(var(--app-text-scale, 1) * 11px);font-weight:650}
.week-add-meal,.week-add-meal small{font-family:inherit}
.has-meals>.week-add-meal>small{display:none}
.week-add-meal:hover{background:#fff;border-style:solid}
.day-dashboard .energy-side>span{font-size:calc(var(--app-text-scale, 1) * 16px);font-weight:650}
.day-dashboard .energy-side strong{font-size:calc(var(--app-text-scale, 1) * 27px)}
.day-dashboard .ring-value,.day-dashboard .macro-track i{transition:none}
@media(max-width:680px){
 .week-calendar-heading{display:block;margin-bottom:6px}
 .week-calendar-heading h2{font-size:calc(var(--app-text-scale, 1) * 25px)}
 .week-calendar-heading .muted{font-size:calc(var(--app-text-scale, 1) * 13px);line-height:1.4;margin:0}
 .week-calendar-heading .head-actions{display:grid;grid-template-columns:1fr auto 1fr;margin-top:6px}
 .week-calendar-heading .head-actions button{font-size:calc(var(--app-text-scale, 1) * 12px);padding:6px 5px}
 .week-board{min-width:1080px;border-spacing:4px}
 .week-board .week-corner,.week-board .week-row-label{width:80px}
 .day-dashboard .energy-side>span{font-size:calc(var(--app-text-scale, 1) * 15px)}
 .day-dashboard .energy-side strong{font-size:calc(var(--app-text-scale, 1) * 24px)}
}
@media(max-width:350px){.day-dashboard .energy-side>span{font-size:calc(var(--app-text-scale, 1) * 14px)}.day-dashboard .energy-side strong{font-size:calc(var(--app-text-scale, 1) * 21px)}}
.week-calendar-heading{display:grid;justify-items:center;gap:8px;margin:0 0 8px;padding:22px 0 4px;text-align:center}
.week-heading-navigation{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:12px;width:min(100%,460px)}
.week-heading-navigation>button{width:44px;height:44px;min-width:44px;min-height:44px;padding:0;border:1px solid #d5e4ef;border-radius:13px;background:#ffffffb8;color:#3175a6;font-size:calc(var(--app-text-scale, 1) * 28px);line-height:1;box-shadow:none}
.week-heading-range{display:grid;justify-items:center;gap:2px;min-width:0;color:#274b66}
.week-heading-range>span{display:flex;align-items:center;justify-content:center;gap:8px}
.week-heading-range svg{width:20px;height:20px;color:#5b819b}
.week-heading-range strong{font-size:calc(var(--app-text-scale, 1) * 19px);font-variant-numeric:tabular-nums;white-space:nowrap}
.week-heading-range small{font-size:calc(var(--app-text-scale, 1) * 13px);color:#61798a}
.week-current-button{min-height:44px;padding:5px 12px;border:0;background:transparent;color:#286d9f;font-size:calc(var(--app-text-scale, 1) * 13px);font-weight:650;box-shadow:none}
.week-plan-actions{margin:12px 0 22px!important}
.week-calendar-heading>h2.sr{position:absolute}

/* Intrinsic table rows avoid browser-specific distribution of viewport height. */
.week-board,.week-board thead,.week-board tbody,.week-board tr{height:auto}
.week-board .week-slot-cell{height:64px}
.week-cell-stack.has-meals{grid-template-columns:minmax(0,1fr);align-items:stretch}
.week-planned-meal{position:relative;display:grid;grid-template-columns:minmax(0,1fr);padding:0;overflow:visible}
.week-recipe-open{display:grid;grid-template-columns:minmax(0,1fr);justify-items:stretch;padding:0;min-height:44px;overflow:visible}
.week-recipe-open>.food-photo{position:relative;width:100%;height:clamp(50px,8dvh,76px);min-height:0;margin:0;border-radius:7px;overflow:hidden;aspect-ratio:auto}
.week-recipe-open>.food-photo img{display:block;width:100%;height:100%;object-fit:cover}
.week-recipe-open>.food-photo figcaption{position:absolute;inset:auto 0 0;font-size:10px;line-height:1.2;padding:3px;background:#ffffffdf;color:#274559}
.week-recipe-open>.week-meal-title,.week-planned-meal>.week-meal-title{display:block;min-width:0;padding:5px 4px;font-size:calc(var(--app-text-scale, 1) * 12px);line-height:1.35;white-space:normal;overflow-wrap:anywhere;hyphens:auto}
.week-board .week-eaten{position:static;background:#fffffff0;border-radius:5px;padding:2px 3px;text-align:center;pointer-events:none}
.week-meal-actions{display:flex;align-items:center;justify-content:flex-end;gap:4px;min-height:44px;padding:0 3px;border-top:1px solid #edf1f4}
.week-meal-actions .meal-check,.week-meal-actions .week-remove-meal{position:static;z-index:auto;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;margin:0;padding:0;border-radius:11px;background:#fff;color:#536b7b}
.week-meal-actions .meal-check[aria-pressed="true"]{background:#e6f4ed;color:#28744d}
.week-plan-actions{display:flex;justify-content:center;margin:8px 0}
.week-plan-actions button{min-height:44px}

/* A filled day keeps the meal card full width; the add target follows it. */
#weekBoard .week-cell-stack.has-meals{grid-template-columns:minmax(0,1fr);align-items:stretch}
#weekBoard .week-cell-meals{width:100%}
#weekBoard .week-add-meal{grid-column:1;min-height:44px}
#weekBoard .week-slot-cell:has(.week-cell-meals){vertical-align:top}

/* Keep 44px separate hit areas while reducing the visible control tiles. */
html #weekBoard .week-planned-meal .week-meal-actions .meal-check,
html #weekBoard .week-planned-meal .week-meal-actions .week-remove-meal{
 position:relative;display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;
 min-width:44px;min-height:44px;margin:0;padding:0;border:0;border-radius:11px;
 background:transparent;box-shadow:none;overflow:visible
}
html #weekBoard .week-planned-meal .week-meal-actions .meal-check::before,
html #weekBoard .week-planned-meal .week-meal-actions .week-remove-meal::before{
 content:"";position:absolute;left:50%;top:50%;width:22px;height:22px;transform:translate(-50%,-50%);
 border:1px solid #d5e1e9;border-radius:7px;background:#fff;pointer-events:none
}
html #weekBoard .week-planned-meal .week-meal-actions .meal-check[aria-pressed="true"]::before{background:#e6f4ed;border-color:#9dcdb3}
html #weekBoard .week-planned-meal .week-meal-actions .meal-check svg{position:relative;z-index:1;width:11px;height:11px}
html #weekBoard .week-planned-meal .week-meal-actions .week-remove-meal{font-size:calc(var(--app-text-scale, 1) * 13px);line-height:1;color:#536b7b}
html #weekBoard .week-meal-actions .week-remove-meal>span{position:relative;z-index:1}
html #weekBoard .week-planned-meal .week-meal-actions .meal-check:hover::before{background:#f2f7fa}
html #weekBoard .week-planned-meal .week-meal-actions .week-remove-meal:hover::before{background:#f6e9ea;border-color:#e8c7ca}
html #weekBoard .week-planned-meal .week-meal-actions .meal-check:focus-visible,
html #weekBoard .week-planned-meal .week-meal-actions .week-remove-meal:focus-visible{outline:3px solid #1687bd;outline-offset:-2px}

/* Identical visual tiles inside identical 44px touch targets. */
html #weekBoard .week-planned-meal .week-meal-actions .meal-check,
html #weekBoard .week-planned-meal .week-meal-actions .week-remove-meal{inset:auto;box-sizing:border-box;}
html #weekBoard .week-planned-meal .week-meal-actions .meal-check::before,
html #weekBoard .week-planned-meal .week-meal-actions .week-remove-meal::before{box-sizing:border-box;width:24px;height:24px;}
html #weekBoard .week-planned-meal .week-meal-actions .meal-check svg,
html #weekBoard .week-planned-meal .week-meal-actions .week-remove-meal svg{position:relative;z-index:1;display:block;width:12px;height:12px;}

.week-heading-range{position:relative;min-height:44px;cursor:pointer}
.week-heading-range input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer;font-size:calc(var(--app-text-scale, 1) * 16px)}
.week-heading-range input::-webkit-calendar-picker-indicator{position:absolute;inset:0;width:100%;height:100%;cursor:pointer}
.week-heading-range:focus-within{outline:3px solid #1687bd;outline-offset:2px;border-radius:12px}

/* Keep the day headings inside the board while its rows scroll vertically. */
#weekBoard{width:max-content;min-width:100%;max-height:none;min-height:0;overflow:visible;overscroll-behavior:contain}
#weekBoard .week-corner{left:0;top:var(--week-sticky-offset,0px);z-index:5}
#weekBoard .week-column-head{top:var(--week-sticky-offset,0px);z-index:4}
#weekBoard .week-row-label{left:0;z-index:3}
#weekBoard .week-recipe-open{display:grid;grid-template-columns:minmax(0,1fr);justify-items:stretch;padding:0;min-height:0;overflow:hidden}
#weekBoard .week-recipe-open>.food-photo{position:relative;width:100%;height:clamp(38px,6.7dvh,64px);min-height:38px;margin:0;border-radius:7px;overflow:hidden;aspect-ratio:auto}
#weekBoard .week-recipe-open>.food-photo img{display:block;width:100%;height:100%;object-fit:cover}
#weekBoard .week-recipe-open>.food-photo figcaption{display:none}
#weekBoard .week-recipe-open>.food-placeholder{display:grid;place-items:center;width:100%;min-height:38px;padding:5px;border-radius:7px;background:#edf4fa;color:#607b91;text-align:center;font-size:11px}
#weekBoard .week-meal-actions{justify-content:center;gap:4px}
#weekBoard .week-meal-actions .week-copy-meal,#weekBoard .week-meal-actions .week-remove-meal{position:relative;display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;min-width:44px;min-height:44px;margin:0;padding:0;border:0;border-radius:9px;background:transparent;color:#536b7b;box-shadow:none}
#weekBoard .week-meal-actions .week-copy-meal svg,#weekBoard .week-meal-actions .week-remove-meal svg{display:block;width:16px;height:16px}
#weekBoard .week-meal-actions .week-copy-meal:hover,#weekBoard .week-meal-actions .week-remove-meal:hover{background:#ffffff}
#weekBoard .week-meal-actions .week-copy-meal:focus-visible,#weekBoard .week-meal-actions .week-remove-meal:focus-visible{outline:3px solid #1687bd;outline-offset:-2px}
#weekBoard .week-cell-kcal{display:block;padding:2px 3px 1px;color:#a33d45;text-align:center;font-size:calc(var(--app-text-scale, 1) * 12px);font-weight:750;font-variant-numeric:tabular-nums}
#weekBoard .week-paste-meal{width:100%;min-height:44px;padding:6px;border:1px solid #8cbce0;border-radius:9px;background:#ffffffd9;color:#276b98;font-family:inherit;font-size:calc(var(--app-text-scale, 1) * 12px);font-weight:650;box-shadow:none}
#weekBoard .week-paste-meal:hover{background:#fff;border-color:#4d95c6}
#weekBoard .week-paste-meal:focus-visible{outline:3px solid #1687bd;outline-offset:2px}

/* The full calendar scrolls as one viewport; week navigation stays above dates. */
.week-workspace{position:relative;width:100%;max-width:100%;overflow:auto;overscroll-behavior:contain;scrollbar-color:#94bddb #edf5fb;scrollbar-width:thin;-webkit-overflow-scrolling:touch}
.week-workspace:focus-within{scrollbar-color:#7baed0 #edf5fb}
.week-workspace #weekBoard .week-board{width:max-content;min-width:1120px}
.week-calendar-heading{position:sticky;top:0;left:0;z-index:12;width:min(100%,var(--week-viewport-width,100vw));background:#f5faffed;backdrop-filter:blur(10px);-webkit-backdrop-filter:blur(10px)}
@supports not ((backdrop-filter:blur(1px)) or (-webkit-backdrop-filter:blur(1px))){.week-calendar-heading{background:#f5faff}}
/* Daily totals yield space while scrolling; individual meal kcal stay visible. */
.week-workspace.week-totals-collapsed #weekBoard .day-macros{display:none}
.week-workspace.week-totals-collapsed #weekBoard .week-meal-count{display:none}
