/* UI v2 sample (14 November 2026): a calmer, modern style for data-heavy screens.
   Scoped to .ui2 so nothing else on the site changes until James approves it.
   Ideas: filled inputs instead of outlined boxes, fewer boxes (spacing instead of borders),
   calm tables with tabular numbers, segmented controls, icon buttons, KPI strip, sticky save bar.
   Rounded corners by default; the page can switch to square (data-corners="square") to compare. */

html.m .ui2 {
	--u-fill: #F1F3F6; --u-fill-2: #E8EBF0; --u-line: #ECEEF2; --u-line-2: #DDE1E7;
	--u-ink: #14171A; --u-ink-2: #4E545B; --u-ink-3: #7A8088; --u-accent: var(--blue, #FFAA00); --u-link: var(--link, #8A5800);
	--u-ok: #1B7F3B; --u-ok-bg: #E8F5EC; --u-warn: #A8550F; --u-warn-bg: #FDF1E4;
	--u-r: 12px; --u-r-sm: 8px; --u-ring: 0 0 0 3px rgba(255, 170, 0, .35); --u-focus: var(--focus, #C77700);
	font-variant-numeric: tabular-nums;
}

/* ---------- Surfaces: one level of white on grey, no borders, no nested boxes ---------- */
html.m .ui2 .u-card { background: #fff; border: 0; border-radius: var(--u-r) !important; padding: 22px 24px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
html.m .ui2 .u-card + .u-card { margin-top: 14px; }
html.m .ui2 .u-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
html.m .ui2 .u-head h3 { margin: 0; font-size: 18px; }
html.m .ui2 .u-sub { font-size: 13px; color: var(--u-ink-3); }
html.m .ui2 .u-label { display: block; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--u-ink-3); margin-bottom: 6px; }
html.m .ui2 .u-divider { height: 1px; background: var(--u-line); margin: 18px 0; border: 0; }

/* ---------- Inputs: soft fill, no outline box; white with a ring on focus ---------- */
html.m .ui2 .u-input, html.m .ui2 .u-select, html.m .ui2 .u-text {
	width: 100%; min-height: 44px; padding: 10px 14px; font: inherit; font-size: 15px; color: var(--u-ink);
	background: var(--u-fill); border: 1px solid transparent; border-radius: var(--u-r-sm) !important; box-shadow: none; transition: background .12s, border-color .12s, box-shadow .12s;
}
html.m .ui2 .u-input:hover, html.m .ui2 .u-select:hover { background: var(--u-fill-2); }
html.m .ui2 .u-input:focus, html.m .ui2 .u-select:focus, html.m .ui2 .u-text:focus { background: #fff; border-color: var(--u-focus, #C77700); box-shadow: var(--u-ring); outline: none; }
html.m .ui2 .u-input::placeholder { color: #A1A7AE; opacity: 1; }
html.m .ui2 .u-select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237A8088' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 12px center; }
html.m .ui2 .u-field { margin-bottom: 16px; }
html.m .ui2 .u-field .u-hint { font-size: 13px; color: var(--u-ink-3); margin-top: 6px; }
html.m .ui2 .u-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
html.m .ui2 .u-grid.two { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
/* Number with its unit inside the field, e.g. [ 22.5   g ] */
html.m .ui2 .u-affix { position: relative; }
html.m .ui2 .u-affix .u-input { padding-right: 40px; text-align: right; }
html.m .ui2 .u-affix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 13px; color: var(--u-ink-3); pointer-events: none; }

/* Amount + measure as one joined control: [ 1 | cup, dry ▾ ] */
html.m .ui2 .u-qty { display: inline-flex; align-items: stretch; background: var(--u-fill); border-radius: var(--u-r-sm) !important; border: 1px solid transparent; transition: background .12s, border-color .12s, box-shadow .12s; }
html.m .ui2 .u-qty:hover { background: var(--u-fill-2); }
html.m .ui2 .u-qty:focus-within { background: #fff; border-color: var(--u-focus, #C77700); box-shadow: var(--u-ring); }
html.m .ui2 .u-qty input { width: 64px; min-height: 36px; padding: 6px 8px 6px 10px; border: 0; background: transparent; text-align: right; font: inherit; font-size: 15px; font-weight: 600; color: var(--u-ink); box-shadow: none; }
html.m .ui2 .u-qty input::placeholder { color: #A9AFB6; font-weight: 500; }
html.m .ui2 .u-qty input:focus { outline: none; box-shadow: none; }
/* No up/down arrows in amount boxes: people type the number, and the arrows ate the room for 3 digits on phones. */
html.m .ui2 .u-qty input[type=number] { -moz-appearance: textfield; appearance: textfield; }
html.m .ui2 .u-qty input[type=number]::-webkit-inner-spin-button, html.m .ui2 .u-qty input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
html.m .ui2 .u-qty select { min-height: 36px; max-width: 140px; padding: 6px 26px 6px 8px; border: 0; border-left: 1px solid var(--u-line-2); background: transparent; font: inherit; font-size: 13px; color: var(--u-ink-2); appearance: none; -webkit-appearance: none; cursor: pointer; box-shadow: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%237A8088' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 9px center; border-radius: 0 !important; }
html.m .ui2 .u-qty select:focus { outline: none; }

/* ---------- Buttons ---------- */
html.m .ui2 .u-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; font: inherit; font-size: 15px; font-weight: 600; border-radius: var(--u-r-sm) !important; border: 0; cursor: pointer; text-decoration: none; transition: background .12s, color .12s; }
html.m .ui2 .u-btn.primary { background: var(--u-ink); color: #fff; }
html.m .ui2 .u-btn.primary:hover { background: #2A2F35; }
html.m .ui2 .u-btn.accent { background: var(--u-accent); color: #06121A; }
html.m .ui2 .u-btn.soft { background: var(--u-fill); color: var(--u-ink); }
html.m .ui2 .u-btn.soft:hover { background: var(--u-fill-2); }
html.m .ui2 .u-btn.text { background: transparent; color: var(--u-link); padding: 0 6px; min-height: 36px; }
html.m .ui2 .u-btn.text:hover { background: var(--u-fill); }
html.m .ui2 .u-btn.sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
html.m .ui2 .u-btn svg { width: 16px; height: 16px; }
/* Icon buttons instead of underlined text links */
html.m .ui2 .u-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; background: transparent; color: var(--u-ink-3); border-radius: var(--u-r-sm) !important; cursor: pointer; transition: background .12s, color .12s; }
html.m .ui2 .u-icon:hover { background: var(--u-fill); color: var(--u-ink); }
html.m .ui2 .u-icon.danger:hover { background: #FDECEC; color: #B42318; }
html.m .ui2 .u-icon svg { width: 17px; height: 17px; }

/* ---------- Segmented control and chips ---------- */
html.m .ui2 .u-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--u-fill); border-radius: 10px !important; }
html.m .ui2 .u-seg label { position: relative; }
html.m .ui2 .u-seg input { position: absolute; opacity: 0; pointer-events: none; }
html.m .ui2 .u-seg span { display: block; padding: 6px 12px; font-size: 13.5px; font-weight: 600; color: var(--u-ink-2); border-radius: 8px !important; cursor: pointer; white-space: nowrap; transition: background .12s, color .12s, box-shadow .12s; }
html.m .ui2 .u-seg input:checked + span { background: #fff; color: var(--u-ink); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
html.m .ui2 .u-seg input:focus-visible + span { box-shadow: var(--u-ring); }
html.m .ui2 .u-seg.cant input:checked + span.c { background: var(--u-warn-bg); color: var(--u-warn); }
html.m .ui2 .u-chips { display: flex; flex-wrap: wrap; gap: 6px; }
html.m .ui2 .u-chips a { padding: 6px 12px; font-size: 13.5px; font-weight: 500; color: var(--u-ink-2); background: var(--u-fill); border-radius: 99px !important; text-decoration: none; }
html.m .ui2 .u-chips a:hover { background: var(--u-fill-2); }
html.m .ui2 .u-chips a.on { background: var(--u-ink); color: #fff; }
html.m .ui2 .u-badge { display: inline-block; padding: 2px 8px; font-size: 12px; font-weight: 600; border-radius: 99px !important; background: var(--u-fill); color: var(--u-ink-2); }
html.m .ui2 .u-badge.ok { background: var(--u-ok-bg); color: var(--u-ok); }
html.m .ui2 .u-badge.warn { background: var(--u-warn-bg); color: var(--u-warn); }
html.m .ui2 .u-badge.accent { background: #FFF4DB; color: #7A4E00; }

/* Toggle */
html.m .ui2 .u-toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 15px; }
html.m .ui2 .u-toggle input { position: absolute; opacity: 0; }
html.m .ui2 .u-toggle i { position: relative; width: 40px; height: 24px; background: var(--u-line-2); border-radius: 99px !important; transition: background .15s; flex: none; }
html.m .ui2 .u-toggle i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 99px !important; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
html.m .ui2 .u-toggle input:checked + i { background: var(--u-accent); }
html.m .ui2 .u-toggle input:checked + i::after { transform: translateX(16px); }
html.m .ui2 .u-toggle input:focus-visible + i { box-shadow: var(--u-ring); }

/* ---------- KPI strip and bars ---------- */
html.m .ui2 .u-kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); background: #fff; border-radius: var(--u-r) !important; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
html.m .ui2 .u-kpi { padding: 18px 22px; }
html.m .ui2 .u-kpi + .u-kpi { border-left: 1px solid var(--u-line); }
html.m .ui2 .u-kpi b { display: block; font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; color: var(--u-ink); }
html.m .ui2 .u-kpi b small { font-size: 14px; font-weight: 500; color: var(--u-ink-3); margin-left: 3px; }
html.m .ui2 .u-kpi .u-sub { margin-top: 4px; display: block; }
html.m .ui2 .u-kpi .neg { color: var(--u-warn); }
html.m .ui2 .u-bars { display: grid; gap: 12px; }
html.m .ui2 .u-bar { display: grid; grid-template-columns: 70px minmax(0,1fr) auto; gap: 14px; align-items: center; font-size: 14px; }
html.m .ui2 .u-bar .tr { height: 8px; background: var(--u-fill); border-radius: 99px !important; overflow: hidden; }
html.m .ui2 .u-bar .tr i { display: block; height: 100%; background: var(--u-accent); border-radius: 99px !important; }
html.m .ui2 .u-bar .v { color: var(--u-ink-3); font-size: 13.5px; }
html.m .ui2 .u-bar .v b { color: var(--u-ink); font-weight: 600; }

/* ---------- Tables: no grid lines, faint dividers, hover, right-aligned numbers ---------- */
html.m .ui2 .u-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
html.m .ui2 .u-table th { padding: 0 10px 10px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--u-ink-3); text-align: left; border-bottom: 1px solid var(--u-line); white-space: nowrap; }
html.m .ui2 .u-table td { padding: 12px 10px; border-bottom: 1px solid var(--u-line); vertical-align: middle; }
html.m .ui2 .u-table tbody tr:last-child td { border-bottom: 0; }
html.m .ui2 .u-table tbody tr { transition: background .1s; }
html.m .ui2 .u-table tbody tr:hover td { background: #FAFBFC; }
html.m .ui2 .u-table .r { text-align: right; white-space: nowrap; }
html.m .ui2 .u-table .unit { color: var(--u-ink-3); font-size: 12.5px; margin-left: 2px; }
html.m .ui2 .u-table .nm { font-weight: 600; color: var(--u-ink); }
html.m .ui2 .u-table .nm small { display: block; font-weight: 400; font-size: 12.5px; color: var(--u-ink-3); margin-top: 2px; }
html.m .ui2 .u-table .dim td { color: var(--u-ink-3); }
html.m .ui2 .u-table .acts { white-space: nowrap; text-align: right; width: 1%; opacity: .55; transition: opacity .12s; }
html.m .ui2 .u-table tr:hover .acts, html.m .ui2 .u-table tr:focus-within .acts { opacity: 1; }
html.m .ui2 .u-table .sug { color: #A1A7AE; }
html.m .ui2 .u-table tfoot td { padding-top: 12px; font-weight: 600; border: 0; }

/* Meal card header */
html.m .ui2 .u-meal-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
html.m .ui2 .u-meal-h h3 { margin: 0; font-size: 18px; }
html.m .ui2 .u-meal-h .k { font-size: 20px; font-weight: 700; }
html.m .ui2 .u-meal-h .k small { font-size: 13px; color: var(--u-ink-3); font-weight: 500; }
html.m .ui2 .u-macros { display: flex; gap: 14px; font-size: 13px; color: var(--u-ink-3); }
html.m .ui2 .u-macros b { color: var(--u-ink); font-weight: 600; }
html.m .ui2 .u-add { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 10px; font-size: 14px; font-weight: 600; color: var(--u-link); background: transparent; border: 0; border-radius: var(--u-r-sm) !important; cursor: pointer; }
html.m .ui2 .u-add:hover { background: var(--u-fill); }

/* Training sets as compact pills */
html.m .ui2 .u-sets { display: flex; flex-wrap: wrap; gap: 8px; }
html.m .ui2 .u-set { display: flex; align-items: center; gap: 2px; background: var(--u-fill); border-radius: 10px !important; padding: 4px 6px 4px 10px; border: 1px solid transparent; }
html.m .ui2 .u-set:focus-within { background: #fff; border-color: var(--u-focus, #C77700); box-shadow: var(--u-ring); }
html.m .ui2 .u-set .n { font-size: 11px; font-weight: 700; color: var(--u-ink-3); margin-right: 6px; }
html.m .ui2 .u-set input { width: 52px; min-height: 34px; border: 0; background: transparent; text-align: right; font: inherit; font-size: 15px; font-weight: 600; padding: 4px; box-shadow: none; }
html.m .ui2 .u-set input:focus { outline: none; box-shadow: none; }
html.m .ui2 .u-set input::placeholder { color: #A9AFB6; font-weight: 500; }
html.m .ui2 .u-set .x { color: var(--u-ink-3); font-size: 13px; }
html.m .ui2 .u-set .u { color: var(--u-ink-3); font-size: 12px; }
html.m .ui2 .u-set.add { background: transparent; border: 1px dashed var(--u-line-2); color: var(--u-ink-3); font-size: 14px; font-weight: 600; padding: 0 14px; cursor: pointer; }
html.m .ui2 .u-ex { display: grid; grid-template-columns: minmax(0,1fr); gap: 10px; padding: 16px 0; border-top: 1px solid var(--u-line); }
html.m .ui2 .u-ex:first-of-type { border-top: 0; padding-top: 4px; }
html.m .ui2 .u-ex-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
html.m .ui2 .u-ex-h b { font-size: 16px; }
html.m .ui2 .u-up { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--u-ok); background: var(--u-ok-bg); padding: 2px 8px; border-radius: 99px !important; }

/* Sticky save bar */
html.m .ui2 .u-savebar { position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding: 10px 12px 10px 18px; background: rgba(20, 23, 26, .94); color: #fff; border-radius: 14px !important; box-shadow: 0 8px 24px rgba(16, 24, 40, .18); backdrop-filter: blur(6px); }
html.m .ui2 .u-savebar .u-sub { color: #B5BBC2; }
html.m .ui2 .u-savebar .u-btn.ghost { background: transparent; color: #fff; }
html.m .ui2 .u-savebar .u-btn.ghost:hover { background: rgba(255, 255, 255, .1); }

/* Square comparison: everything back to 0 except toggles and pills that must read as round */
html.m .ui2[data-corners="square"] *:not(#u-none) { border-radius: 0 !important; }
html.m .ui2[data-corners="square"] .u-toggle i:not(#u-none), html.m .ui2[data-corners="square"] .u-toggle i:not(#u-none)::after { border-radius: 99px !important; }

@media (max-width: 760px) {
	html.m .ui2 .u-card { padding: 18px 16px; }
	html.m .ui2 .u-kpis { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
	html.m .ui2 .u-kpi:nth-child(3) { border-left: 0; }
	html.m .ui2 .u-kpi:nth-child(n+3) { border-top: 1px solid var(--u-line); }
	html.m .ui2 .u-kpi { padding: 14px 16px; }
	html.m .ui2 .u-kpi b { font-size: 24px; }
	html.m .ui2 .u-table .hide-s { display: none; }
	html.m .ui2 .u-table .acts { opacity: 1; }
	html.m .ui2 .u-qty select { max-width: 96px; }
}
