/* ============================================================
   Calorie calculator — trial design (tools/calorie-calculator-v2)
   Loaded only on that page (CALC_V2=true). Everything is scoped under .cv2,
   logical properties throughout so the page mirrors for Arabic.
   ============================================================ */

.cv2 {
  --v-dark: #12302D;
  --v-teal: #1F5F5B;
  --v-amber: #C6873A;
  --v-amber-deep: #8F5E1E;
  --v-amber-soft: #E3B26C;
  --v-cream: #F3E6CF;
  --v-bg: #F7F9F8;
  --v-card: #FFFFFF;
  --v-tint: #F4F8F7;
  --v-ink: #1C2422;
  --v-soft: #52605D;
  --v-muted: #65736F;
  --v-line: #E5ECEA;
  --v-line-2: #DCE5E3;
  --v-highlight: #FBF4E8;
  --v-serif: 'DM Serif Display', Georgia, serif;
  --v-sans: 'DM Sans', system-ui, sans-serif;
  --v-nav: 76px; /* the site navbar is sticky and 76px tall */
  --m-p: #E3B26C;  /* protein */
  --m-c: #7CC7C0;  /* carbs */
  --m-f: #F3E6CF;  /* fat */
  background: var(--v-bg);
  color: var(--v-ink);
  font-family: var(--v-sans);
  padding-bottom: 4rem;
}
[dir="rtl"] .cv2 { --v-sans: 'IBM Plex Sans Arabic', 'DM Sans', system-ui, sans-serif; }
[data-theme="dark"] .cv2 {
  --v-dark: #0F2624;
  --v-teal: #5FB3AC;
  --v-amber-deep: #E0A868;
  --v-bg: #0E1514;
  --v-card: #161F1D;
  --v-tint: #1B2523;
  --v-ink: #E4EBE9;
  --v-soft: #AFBCB9;
  --v-muted: #A3B1AD;
  --v-line: #26332F;
  --v-line-2: #2C3A36;
  --v-highlight: #2A2015;
}
:where(.cv2) button { font: inherit; cursor: pointer; } /* no specificity, so each button class keeps its own size */
.cv2 [hidden] { display: none !important; }
.cv2 fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }

/* ── Hero ─────────────────────────────────────────────────── */
.cv2-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--v-dark);
  color: #fff;
  padding: 16px 0 calc(64px + 2rem); /* the tool overlaps the hero by 64px */
}
.cv2-hero__grain {
  position: absolute; inset: 0; z-index: -1; opacity: .09; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
.cv2-hero__rings {
  position: absolute; z-index: -1; inset-block-start: 0; inset-inline-end: 0;
  width: min(300px, 55vw); height: auto; pointer-events: none;
  fill: none; stroke: rgba(227,178,108,.32); stroke-width: 1;
}
[dir="rtl"] .cv2-hero__rings { transform: scaleX(-1); }
.cv2-hero__inner { position: relative; }

/* Breadcrumb: the shared pill, dark variant (same colours as the v2 article hero) */
.cv2-hero .page-hero__breadcrumb {
  margin-bottom: 32px;
  background: rgba(255,255,255,.10);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.22);
  color: #fff;
}
.cv2-hero .page-hero__breadcrumb a { color: rgba(255,255,255,.85); }
.cv2-hero .page-hero__breadcrumb .breadcrumb-separator { color: rgba(255,255,255,.5); }
.cv2-hero .page-hero__breadcrumb a:hover { color: #fff; }
.cv2-hero .page-hero__breadcrumb a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 2px; }

.cv2-kicker {
  display: flex; align-items: center; gap: .6rem; margin: 0 0 14px;
  font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--v-amber-soft);
}
.cv2-kicker__line { width: 28px; height: 1px; background: var(--v-amber-soft); }
[dir="rtl"] .cv2-kicker { letter-spacing: 0; font-size: .875rem; }
.cv2-title {
  margin: 0; max-width: 980px;
  font-family: var(--v-serif); font-weight: 400; font-size: 56px; line-height: 1.08;
  color: #fff; text-wrap: balance;
}
.cv2-title em { font-style: italic; color: var(--v-cream); }
[dir="rtl"] .cv2-title { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; font-weight: 600; font-size: 46px; line-height: 1.3; }
[dir="rtl"] .cv2-title em { font-style: normal; color: inherit; } /* the italic cream word is English only */
.cv2-dek { margin: 12px 0 0; max-width: 680px; font-size: 18px; line-height: 1.6; color: rgba(255,255,255,.8); }
.cv2-trust { list-style: none; margin: 22px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .75rem 1.75rem; }
.cv2-trust li { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: rgba(255,255,255,.78); }
.cv2-trust svg { color: var(--v-amber-soft); flex: none; }
.cv2-noscript { margin: 1rem 0 0; padding: .75rem 1rem; border-radius: 12px; background: rgba(255,255,255,.1); }

/* ── Tool ─────────────────────────────────────────────────── */
.cv2-tool {
  position: relative; z-index: 2; margin-top: -64px;
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start;
}
@media (min-width: 1024px) {
  .cv2-tool { grid-template-columns: minmax(0, 1fr) 380px; }
}
.cv2-card {
  background: var(--v-card); border-radius: 18px;
  box-shadow: 0 24px 48px -32px rgba(18,48,45,.35), 0 2px 6px -2px rgba(18,48,45,.08);
  padding: 32px;
}
.cv2-inputs { display: grid; gap: 32px; margin: 0; }

/* Steps */
.cv2-step__h {
  display: flex; align-items: baseline; gap: .75rem; padding: 0; margin: 0 0 14px;
  font-size: 1.0625rem; font-weight: 600; color: var(--v-ink);
}
.cv2-step__n { font-family: 'DM Serif Display', Georgia, serif; font-size: 1.5rem; line-height: 1; color: var(--v-amber); }
.cv2-hint { margin: .65rem 0 0; font-size: .85rem; color: var(--v-muted); }

/* Visually hidden radio + styled label (segmented controls, rows, cards) */
.cv2-seg input, .cv2-act input, .cv2-style input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }

.cv2-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; border-radius: 999px; background: var(--v-tint); border: 1px solid var(--v-line); }
.cv2-seg--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cv2-seg--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cv2-seg label { display: block; cursor: pointer; }
.cv2-seg span { display: block; padding: .65rem .5rem; border: 1.5px solid transparent; border-radius: 999px; text-align: center; font-weight: 600; font-size: .9375rem; color: var(--v-soft); transition: background-color .15s, color .15s, border-color .15s; }
.cv2-seg label:hover span { color: var(--v-ink); }
/* Selected: white + teal border + teal text (the dark colour is kept for the result card only) */
.cv2-seg input:checked + span { background: var(--v-card); border-color: var(--v-teal); color: var(--v-teal); box-shadow: 0 0 0 .5px var(--v-teal), 0 2px 6px -3px rgba(18,48,45,.25); }
.cv2-seg input:focus-visible + span { outline: 2px solid var(--v-teal); outline-offset: 2px; }
/* Step 01: gender symbol + label, centred together (the icon follows the text in RTL) */
.cv2-seg--sex span { display: flex; align-items: center; justify-content: center; gap: 8px; }
.cv2-seg--sex svg { flex: none; }
.cv2-check { display: flex; align-items: center; gap: .5rem; margin-top: .75rem; font-size: .9rem; color: var(--v-soft); cursor: pointer; }
.cv2-check input { width: 18px; height: 18px; accent-color: var(--v-teal); }

/* Number boxes */
.cv2-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.cv2-num { padding: 14px 14px 10px; border-radius: 14px; background: var(--v-tint); border: 1px solid var(--v-line); }
.cv2-num__label { display: block; margin-bottom: .35rem; font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--v-muted); }
[dir="rtl"] .cv2-num__label { letter-spacing: 0; font-size: .85rem; }
.cv2-num__row { display: flex; align-items: center; justify-content: space-between; gap: .25rem; }
.cv2-num__val { display: flex; align-items: baseline; justify-content: center; gap: .2rem; min-width: 0; }
.cv2-num__input {
  width: 3.2ch; padding: 0; border: 0; background: transparent; text-align: center;
  font-family: 'DM Serif Display', Georgia, serif; font-size: 2.1rem; line-height: 1.1; color: var(--v-ink);
  -moz-appearance: textfield; appearance: textfield;
}
.cv2-num__input::-webkit-outer-spin-button, .cv2-num__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cv2-num__input:focus-visible { outline: 2px solid var(--v-teal); outline-offset: 2px; border-radius: 6px; }
.cv2-num__input[aria-invalid="true"] { color: #C0392B; }
.cv2-num__unit { font-size: .8rem; color: var(--v-muted); }
.cv2-pm {
  flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--v-line-2); background: var(--v-card); color: var(--v-ink); font-size: 1.1rem; line-height: 1;
}
.cv2-pm:hover { border-color: var(--v-teal); color: var(--v-teal); }
.cv2-pm:focus-visible { outline: 2px solid var(--v-teal); outline-offset: 2px; }

/* Slider */
.cv2-range { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 24px; margin: .4rem 0 0; background: transparent; cursor: pointer; --p: 50%; }
.cv2-range::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(to right, var(--v-teal), var(--v-teal)) 0 0 / var(--p) 100% no-repeat, var(--v-line-2); }
[dir="rtl"] .cv2-range::-webkit-slider-runnable-track { background: linear-gradient(to left, var(--v-teal), var(--v-teal)) 100% 0 / var(--p) 100% no-repeat, var(--v-line-2); }
.cv2-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: var(--v-card); border: 2px solid var(--v-teal); box-shadow: 0 2px 6px -2px rgba(18,48,45,.5); }
.cv2-range::-moz-range-track { height: 4px; border-radius: 99px; background: var(--v-line-2); }
.cv2-range::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--v-teal); }
.cv2-range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--v-card); border: 2px solid var(--v-teal); }

/* Activity rows */
.cv2-acts { display: grid; gap: 8px; }
.cv2-act {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) 18px; gap: .85rem; align-items: center;
  padding: .7rem .9rem; border-radius: 12px; border: 1.5px solid var(--v-line); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.cv2-act:hover { border-color: var(--v-line-2); background: var(--v-tint); }
.cv2-act__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--v-tint); color: var(--v-teal); }
.cv2-act__text strong { display: block; font-size: .9375rem; font-weight: 600; color: var(--v-ink); }
.cv2-act__text small { display: block; font-size: .8125rem; color: var(--v-muted); }
.cv2-act__dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--v-line-2); }
.cv2-act:has(input:checked) { border-color: var(--v-teal); background: var(--v-card); box-shadow: 0 0 0 .5px var(--v-teal); }
.cv2-act:has(input:checked) .cv2-act__text strong { color: var(--v-teal); }
.cv2-act input:checked ~ .cv2-act__dot { border: 5px solid var(--v-teal); }
.cv2-act input:checked ~ .cv2-act__icon { background: var(--v-tint); color: var(--v-teal); }
.cv2-act:has(input:focus-visible) { outline: 2px solid var(--v-teal); outline-offset: 2px; }

/* Eating style cards */
.cv2-styles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cv2-style { display: flex; flex-direction: column; gap: .35rem; padding: .9rem; border-radius: 12px; border: 1.5px solid var(--v-line); cursor: pointer; transition: border-color .15s, background-color .15s; }
.cv2-style:hover { border-color: var(--v-line-2); background: var(--v-tint); }
.cv2-style:has(input:checked) { border-color: var(--v-teal); background: var(--v-card); box-shadow: 0 0 0 .5px var(--v-teal); }
.cv2-style:has(input:checked) .cv2-style__name { color: var(--v-teal); }
.cv2-style:has(input:focus-visible) { outline: 2px solid var(--v-teal); outline-offset: 2px; }
.cv2-style__name { font-weight: 600; font-size: .9375rem; color: var(--v-ink); }
.cv2-style__ratio { font-size: .78rem; color: var(--v-muted); }
.cv2-style__bar { display: flex; gap: 2px; height: 6px; margin-top: .2rem; border-radius: 99px; overflow: hidden; }
.cv2-style__bar i, .cv2-stack i { display: block; }
.cv2-style__bar .is-p { background: #C6873A; }
.cv2-style__bar .is-c { background: #1F5F5B; }
.cv2-style__bar .is-f { background: #E3B26C; }

/* ── Result card ──────────────────────────────────────────── */
.cv2-res {
  position: relative; overflow: hidden;
  padding: 28px; border-radius: 18px; background: var(--v-dark); color: #fff;
  box-shadow: 0 30px 60px -35px rgba(18,48,45,.7);
  scroll-margin-top: calc(var(--v-nav) + 12px); /* the mobile bar scrolls it into view below the sticky navbar */
}
@media (min-width: 1024px) {
  .cv2-res { position: sticky; top: calc(var(--v-nav) + 20px); } /* 20px below the sticky navbar */
}
.cv2-res__label { margin: 0 0 .35rem; font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--v-amber-soft); }
[dir="rtl"] .cv2-res__label { letter-spacing: 0; font-size: .85rem; }
.cv2-res__h { margin: 0; font-family: var(--v-sans); font-size: 1.05rem; font-weight: 500; line-height: 1.4; color: rgba(255,255,255,.85); }
.cv2-res__kcal { display: flex; align-items: baseline; flex-wrap: wrap; gap: .5rem; margin: .75rem 0 1.1rem; }
.cv2-res__kcal strong { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; font-size: 4rem; line-height: 1; color: #fff; }
.cv2-res__kcal span { font-size: .95rem; color: rgba(255,255,255,.72); }
.cv2-res__empty { margin: 1.25rem 0; padding: 1.25rem; border-radius: 12px; border: 1px dashed rgba(255,255,255,.3); color: rgba(255,255,255,.85); line-height: 1.6; }
.cv2-res__notice { margin: 1rem 0; padding: .85rem 1rem; border-radius: 12px; background: rgba(227,178,108,.14); color: #F7E3C2; font-size: .9rem; line-height: 1.55; }
.cv2-res__notice--soft { margin-top: -.25rem; }

.cv2-stack { display: flex; gap: 3px; height: 10px; border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.cv2-stack .is-p, .cv2-macro--p i { background: var(--m-p); }
.cv2-stack .is-c, .cv2-macro--c i { background: var(--m-c); }
.cv2-stack .is-f, .cv2-macro--f i { background: var(--m-f); }
.cv2-macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cv2-macro { display: flex; flex-direction: column; padding: .7rem; border-radius: 12px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); min-width: 0; } /* grid rows stretch, so all three boxes have the same height */
.cv2-macro__name { display: flex; align-items: center; gap: .35rem; font-size: 12px; color: rgba(255,255,255,.72); }
.cv2-macro__name i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.cv2-macro strong { display: block; margin: .25rem 0 .1rem; font-size: 1.25rem; font-weight: 600; color: #fff; }
/* % on one line, kcal on the next */
.cv2-macro__meta { display: block; font-size: 12px; line-height: 1.45; color: rgba(255,255,255,.72); white-space: nowrap; }

.cv2-energy { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0 0; }
.cv2-energy div { padding: .65rem .75rem; border-radius: 12px; border: 1px solid rgba(255,255,255,.12); }
.cv2-energy dt { font-size: .8rem; font-weight: 600; color: var(--v-amber-soft); }
.cv2-energy dt small { display: block; font-size: 12px; font-weight: 400; color: rgba(255,255,255,.72); }
.cv2-energy dd { margin: .2rem 0 0; font-size: 1.05rem; font-weight: 600; color: #fff; }

.cv2-res__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.cv2-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1rem; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; font-size: .9rem; text-align: center; white-space: nowrap; transition: background-color .15s, color .15s, border-color .15s;
}
.cv2-btn--white { background: #fff; color: #12302D; }
.cv2-btn--white:hover { background: var(--v-amber-soft); color: #12302D; }
.cv2-btn--outline { background: transparent; color: #fff; border-color: rgba(255,255,255,.5); }
.cv2-btn--outline:hover { border-color: #fff; }
.cv2-btn--ghost { background: var(--v-card); color: var(--v-ink); border-color: var(--v-line-2); padding: .55rem 1rem; font-size: .85rem; }
.cv2-btn--ghost:hover { border-color: var(--v-teal); color: var(--v-teal); }
.cv2-btn:focus-visible { outline: 2px solid var(--v-amber-soft); outline-offset: 2px; }
.cv2-res__opt { grid-column: 1 / -1; display: flex; align-items: center; gap: .5rem; margin-top: 4px; font-size: 13px; color: rgba(255,255,255,.72); cursor: pointer; }
.cv2-res__opt input { width: 16px; height: 16px; accent-color: var(--v-amber-soft); }
.cv2-res__hint { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--v-amber-soft); }
.cv2-res__note { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12px; line-height: 1.5; color: rgba(255,255,255,.72); }

/* ── Goals + meal split ───────────────────────────────────── */
.cv2-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 24px; }
@media (min-width: 1024px) { .cv2-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cv2 .cv2-h { margin: 0 0 1rem; font-family: var(--v-serif); font-weight: 400; font-size: 1.5rem; line-height: 1.25; color: var(--v-ink); }
[dir="rtl"] .cv2 .cv2-h { font-weight: 700; font-size: 1.25rem; }
.cv2-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cv2-scroll:focus-visible { outline: 2px solid var(--v-teal); outline-offset: 2px; border-radius: 6px; }
.cv2-table { width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.45; }
.cv2-table thead th { padding: .55rem .6rem; text-align: start; font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--v-muted); border-bottom: 1.5px solid var(--v-ink); white-space: nowrap; }
[dir="rtl"] .cv2-table thead th { letter-spacing: 0; font-size: .8rem; }
.cv2-table tbody th, .cv2-table td { padding: .7rem .6rem; text-align: start; vertical-align: top; border-bottom: 1px solid var(--v-line); font-weight: 400; color: var(--v-soft); }
.cv2-table tbody th { color: var(--v-ink); font-weight: 600; }
.cv2-table tbody th small { font-weight: 400; color: var(--v-muted); }
.cv2-table .is-num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cv2-table td strong { color: var(--v-ink); font-weight: 600; }
/* The line above the total is drawn on the row, so it spans the full table width */
.cv2-table tfoot tr { border-top: 1.5px solid var(--v-ink); }
.cv2-table tfoot th, .cv2-table tfoot td { padding: .75rem .6rem; border-bottom: 0; font-weight: 700; color: var(--v-ink); text-align: start; }
.cv2-table tfoot .is-num { text-align: end; }
/* Goal table rows select the goal in step 04 */
#cv2-goals tbody tr { cursor: pointer; }
#cv2-goals tbody tr:not(.is-selected):hover th, #cv2-goals tbody tr:not(.is-selected):hover td { background: var(--v-tint); }
.cv2-goal-pick { padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: start; cursor: pointer; }
.cv2-goal-pick:focus-visible { outline: 2px solid var(--v-teal); outline-offset: 2px; border-radius: 3px; }
.cv2-table tr.is-selected th, .cv2-table tr.is-selected td { background: var(--v-highlight); }
.cv2-badge { display: inline-block; margin-inline-start: .35rem; padding: .1rem .45rem; border-radius: 99px; background: var(--v-amber); color: #fff; font-size: .68rem; font-weight: 600; vertical-align: 1px; }
.cv2-floor { display: block; font-size: .72rem; color: var(--v-amber-deep); white-space: normal; }
.cv2-foot { margin: .85rem 0 0; font-size: .8rem; line-height: 1.55; color: var(--v-muted); }
.cv2-split__head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.cv2-split__head .cv2-h { margin: 0; }
.cv2-select { width: auto; min-width: 9.5rem; }
.cv2-split .cv2-table { min-width: 420px; }
.cv2-link { display: inline-block; margin-top: .9rem; font-weight: 600; font-size: .9rem; color: var(--v-teal); text-decoration: underline; text-underline-offset: 3px; }

/* ── Food log ─────────────────────────────────────────────── */
.cv2-day { margin-top: 24px; scroll-margin-top: calc(var(--v-nav) + 16px); }
.cv2-day__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.cv2-day__head p { margin: 0; font-size: .9rem; color: var(--v-muted); }
.cv2-saved { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .75rem; border-radius: 99px; background: var(--v-tint); border: 1px solid var(--v-line); font-size: .78rem; font-weight: 600; color: var(--v-teal); }
.cv2-search { position: relative; }
.cv2-search__box { display: flex; align-items: center; gap: .65rem; padding: .25rem 1rem; border-radius: 14px; border: 1.5px solid var(--v-line-2); background: var(--v-card); color: var(--v-muted); }
.cv2-search__box:focus-within { border-color: var(--v-teal); }
.cv2-search__box input { flex: 1; min-width: 0; padding: .75rem 0; border: 0; background: transparent; font: inherit; font-size: 1rem; color: var(--v-ink); outline: none; }
.cv2-drop { position: absolute; inset-inline: 0; top: 100%; z-index: 20; list-style: none; margin: .5rem 0 0; padding: .4rem; border-radius: 16px; background: var(--v-card); border: 1px solid var(--v-line-2); box-shadow: 0 20px 40px -25px rgba(0,0,0,.35); max-height: min(60vh, 440px); overflow-y: auto; }
.cv2-drop .opt { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .5rem .55rem; border-radius: 12px; cursor: pointer; }
.cv2-drop .opt.hl, .cv2-drop .opt:hover { background: var(--v-tint); }
.cv2-drop .opt--none { display: block; padding: .6rem .8rem; color: var(--v-soft); font-size: .88rem; cursor: default; }
.cv2-drop .opt--none:hover { background: none; }
.cv2-drop .ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--v-tint); color: var(--v-teal); overflow: hidden; }
.cv2-drop .ico img { width: 100%; height: 100%; object-fit: cover; }
.cv2-drop .opt strong { display: block; font-size: .92rem; color: var(--v-ink); }
.cv2-drop .opt small { font-size: .75rem; color: var(--v-muted); }
.cv2-drop .tag { margin-inline-start: .35rem; padding: .1rem .4rem; border-radius: 6px; background: var(--v-tint); color: var(--v-teal); font-size: .68rem; font-weight: 600; white-space: nowrap; }
.cv2-drop .add { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--v-teal); color: var(--v-teal); font-weight: 600; }
.cv2-drop .opt--manual { margin-top: .3rem; border-top: 1px dashed var(--v-line-2); border-radius: 0 0 12px 12px; }
.cv2 .flag { display: inline-block; vertical-align: -1px; border-radius: 2px; }
.cv2-quick { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: 1rem 0 1.25rem; }
.cv2-quick__label { font-size: .82rem; color: var(--v-muted); }
.cv2-quick button { padding: .4rem .8rem; border-radius: 99px; border: 1px solid var(--v-line-2); background: var(--v-card); color: var(--v-ink); font-size: .85rem; }
.cv2-quick button:hover { border-color: var(--v-teal); }
.cv2-quick button:focus-visible { outline: 2px solid var(--v-teal); outline-offset: 2px; }
.cv2-quick em { font-style: normal; font-size: .75rem; color: var(--v-muted); }
.cv2-meals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cv2-meal { display: flex; flex-direction: column; padding: 14px; border-radius: 14px; border: 1px solid var(--v-line); background: var(--v-card); min-width: 0; }
.cv2-meal__h { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.cv2-meal__h h3 { margin: 0; font-family: var(--v-sans); font-size: .95rem; font-weight: 600; color: var(--v-ink); }
.cv2-meal__h span { font-size: .85rem; font-weight: 600; color: var(--v-teal); }
.cv2-meal__empty { display: none; margin: .6rem 0; font-size: .82rem; color: var(--v-muted); }
.cv2-meal.meal--empty .cv2-meal__empty { display: block; }
.cv2-meal__items { list-style: none; margin: .4rem 0; padding: 0; }
.cv2-meal .it { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem 0; border-top: 1px solid var(--v-line); font-size: .85rem; }
.cv2-meal .it small { display: block; font-size: .72rem; color: var(--v-muted); }
.cv2-meal .it b { white-space: nowrap; font-weight: 600; }
.cv2-meal .it__r { display: flex; align-items: center; gap: .3rem; }
.cv2-meal .it__rm { width: 24px; height: 24px; border-radius: 6px; border: 0; background: transparent; color: var(--v-muted); font-size: 1.05rem; line-height: 1; }
.cv2-meal .it__rm:hover { background: #FDEDEB; color: #C0392B; }
.cv2-meal__add { margin-top: auto; padding: .5rem; border-radius: 10px; border: 1px dashed var(--v-line-2); background: transparent; color: var(--v-teal); font-weight: 600; font-size: .85rem; }
.cv2-meal__add:hover { border-color: var(--v-teal); background: var(--v-tint); }
.cv2-meal__add:focus-visible { outline: 2px solid var(--v-teal); outline-offset: 2px; }
.cv2-sum { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 1.25rem; align-items: center; margin-top: 16px; padding: 16px 18px; border-radius: 14px; background: var(--v-tint); border: 1px solid var(--v-line); }
.cv2-sum__cell small { display: block; font-size: .75rem; color: var(--v-muted); }
.cv2-sum__cell strong { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; font-size: 1.6rem; line-height: 1.1; color: var(--v-ink); }
.cv2-sum__bar { height: 6px; border-radius: 99px; background: var(--v-line-2); overflow: hidden; }
.cv2-sum__bar b { display: block; height: 100%; border-radius: 99px; background: var(--v-teal); transition: width .3s, background-color .3s; }
/* Under the target: teal. Over: amber. More than 115%: red. */
.cv2-sum #c2-left { color: var(--v-teal); }
.cv2-sum.is-over .cv2-sum__bar b { background: #C6873A; }
.cv2-sum.is-over #c2-left { color: #C6873A; }
.cv2-sum.is-way-over .cv2-sum__bar b { background: #B5462F; }
.cv2-sum.is-way-over #c2-left { color: #B5462F; }
.cv2-sum__line { display: flex; justify-content: space-between; gap: .5rem; margin-top: .4rem; font-size: .78rem; color: var(--v-muted); }
.cv2-sum__actions { display: flex; gap: .4rem; }

/* ── Guide + sidebar ──────────────────────────────────────── */
.cv2-guide-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; margin-top: 56px; }
@media (min-width: 1024px) { .cv2-guide-wrap { grid-template-columns: minmax(0, 760px) 300px; justify-content: space-between; } }
.cv2-guide { min-width: 0; font-size: 1.0625rem; line-height: 1.75; color: #3A4744; }
[data-theme="dark"] .cv2-guide { color: #C9D3D0; }
.cv2-guide section { margin-bottom: 2.5rem; }
.cv2 .cv2-h2 { margin: 0 0 .9rem; font-family: var(--v-serif); font-weight: 400; font-size: 1.85rem; line-height: 1.2; color: var(--v-ink); }
[dir="rtl"] .cv2 .cv2-h2 { font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; font-weight: 700; font-size: 1.45rem; line-height: 1.45; }
.cv2-guide p { margin: 0 0 1rem; }
.cv2-steps-list { margin: 0; padding-inline-start: 1.4rem; }
.cv2-steps-list li { margin-bottom: .5rem; padding-inline-start: .25rem; }
.cv2-steps-list li::marker { color: var(--v-amber-deep); font-weight: 600; }
.cv2-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cv2-info { padding: 18px; border-radius: 14px; background: var(--v-card); border: 1px solid var(--v-line); }
.cv2 .cv2-info h3 { margin: 0 0 .4rem; font-family: var(--v-sans); font-size: 1rem; font-weight: 600; color: var(--v-ink); }
.cv2-info p { margin: 0; font-size: .92rem; line-height: 1.65; }
.cv2-table--plain { font-size: .92rem; }
.cv2-faq details { border-top: 1px solid var(--v-line-2); }
.cv2-faq details:last-child { border-bottom: 1px solid var(--v-line-2); }
.cv2-faq summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0; cursor: pointer; list-style: none; font-weight: 600; font-size: 1rem; color: var(--v-ink); }
.cv2-faq summary::-webkit-details-marker { display: none; }
.cv2-faq summary svg { flex: none; color: var(--v-muted); transition: transform .2s; }
.cv2-faq details[open] summary svg { transform: rotate(180deg); }
.cv2-faq summary:focus-visible { outline: 2px solid var(--v-teal); outline-offset: 2px; border-radius: 4px; }
.cv2-faq details p { margin: 0 0 1.1rem; font-size: 1rem; }
.cv2-sources { margin: 0 0 1rem; padding-inline-start: 1.4rem; font-size: .92rem; }
.cv2-sources li { padding: .25rem 0; }
.cv2-sources a, .cv2-related a { color: var(--v-teal); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.cv2-related { margin: 0; padding-inline-start: 1.2rem; }
.cv2-related li { padding: .2rem 0; }
.cv2-disclaimer { margin: 0; padding-top: .9rem; border-top: 1px solid var(--v-line-2); font-size: 14px; line-height: 1.6; color: var(--v-muted); }
.cv2-disclaimer span { display: block; margin-top: .25rem; font-size: 13px; }
.cv2-aside { display: none; }
@media (min-width: 1024px) { .cv2-aside { display: block; } }
.cv2-ad { position: sticky; top: calc(var(--v-nav) + 24px); text-align: center; }
.cv2-ad__label { margin: 0 0 .35rem; font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--v-muted); }

/* ── Mobile target bar ────────────────────────────────────── */
.cv2-mbar {
  position: fixed; z-index: 50; inset-inline: 16px; bottom: 16px;
  display: flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .7rem 1.1rem; border-radius: 999px; border: 0;
  background: #12302D; color: #fff; box-shadow: 0 12px 30px -10px rgba(18,48,45,.6);
}
.cv2-mbar strong { font-family: 'DM Serif Display', Georgia, serif; font-weight: 400; font-size: 1.4rem; line-height: 1; }
.cv2-mbar span { font-size: .85rem; color: rgba(255,255,255,.75); }
.cv2-mbar svg { color: var(--v-amber-soft); }
.cv2-mbar:focus-visible { outline: 2px solid var(--v-amber-soft); outline-offset: 3px; }
@media (min-width: 1024px) { .cv2-mbar { display: none !important; } }

/* ── Add dialog + toast ───────────────────────────────────── */
.cv2-dialog { margin: auto; width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 1px solid var(--v-line-2); border-radius: 20px; background: var(--v-card); color: var(--v-ink); box-shadow: 0 30px 60px -20px rgba(0,0,0,.35); }
.cv2-dialog::backdrop { background: rgba(20,33,31,.55); }
.cv2-dialog form { display: grid; gap: .9rem; padding: 1.4rem; }
.cv2 .cv2-dialog h2 { margin: 0; font-family: var(--v-serif); font-weight: 400; font-size: 1.35rem; color: var(--v-ink); }
.cv2-dialog__food { margin: -.5rem 0 0; font-weight: 600; color: var(--v-teal); }
.cv2-dialog__food:empty { display: none; }
.cv2-dialog label { display: grid; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--v-soft); }
.cv2-dialog legend { margin-bottom: .4rem; padding: 0; font-size: .85rem; font-weight: 600; color: var(--v-soft); }
.cv2-manual { display: grid; gap: .8rem; }
.cv2-dialog__macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.cv2-dialog__macros legend { grid-column: 1 / -1; }
.cv2-dialog__macros label span { font-weight: 500; font-size: .78rem; }
.cv2-dialog__meals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .4rem; }
.cv2-dialog__meals legend { grid-column: 1 / -1; }
.cv2-dialog__meals label { display: block; cursor: pointer; }
.cv2-dialog__meals input { position: absolute; opacity: 0; pointer-events: none; }
.cv2-dialog__meals span { display: block; padding: .55rem .2rem; border-radius: 10px; border: 1.5px solid var(--v-line-2); text-align: center; font-size: .78rem; color: var(--v-soft); }
.cv2-dialog__meals input:checked + span { border-color: var(--v-teal); background: var(--v-tint); color: var(--v-teal); font-weight: 700; }
.cv2-dialog__meals input:focus-visible + span { outline: 2px solid var(--v-teal); outline-offset: 2px; }
.cv2-portion { display: grid; gap: .45rem; font-size: .85rem; font-weight: 600; color: var(--v-soft); }
.cv2-qty { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; gap: .5rem; align-items: center; }
.cv2-qty .cv2-pm { width: 40px; height: 40px; }
.cv2-qty input { text-align: center; }
.cv2-preview { margin: 0; text-align: center; font-family: 'DM Serif Display', Georgia, serif; font-size: 1.6rem; color: var(--v-teal); }
.cv2-preview:empty { display: none; }
.cv2-dialog__actions { display: flex; justify-content: flex-end; gap: .6rem; }
.cv2-toast { position: fixed; z-index: 60; inset-inline-start: 50%; bottom: 88px; transform: translate(-50%, 20px); padding: .6rem 1rem; border-radius: 99px; background: #12302D; color: #fff; font-size: .85rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
[dir="rtl"] .cv2-toast { transform: translate(50%, 20px); }
.cv2-toast.is-on { opacity: 1; transform: translate(-50%, 0); }
[dir="rtl"] .cv2-toast.is-on { transform: translate(50%, 0); }

/* ── Tablet / mobile ──────────────────────────────────────── */
@media (max-width: 1023.98px) {
  .cv2-meals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cv2-sum { grid-template-columns: auto minmax(0, 1fr) auto; }
  .cv2-sum__actions { grid-column: 1 / -1; justify-content: flex-end; }
}
@media (max-width: 767.98px) {
  .cv2-hero { padding: 16px 0 calc(64px + 2rem); }
  .cv2-hero .page-hero__breadcrumb { margin-bottom: 32px; }
  .cv2-title { font-size: clamp(30px, 8.6vw, 38px); }
  [dir="rtl"] .cv2-title { font-size: clamp(27px, 7.8vw, 34px); }
  .cv2-dek { font-size: 16px; }
  .cv2-trust { gap: .55rem 1.1rem; margin-top: 20px; }
  .cv2-trust li { font-size: .82rem; }
  .cv2-card { padding: 20px 16px; border-radius: 16px; }
  .cv2-res { padding: 22px 18px; }
  .cv2-inputs { gap: 26px; }
  .cv2-nums { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .cv2-num { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: .5rem; padding: 10px 12px; }
  .cv2-num__label { margin: 0; }
  .cv2-num .cv2-range { grid-column: 1 / -1; }
  .cv2-styles { grid-template-columns: minmax(0, 1fr); }
  /* 4 goals do not fit in one row: 2 × 2 */
  .cv2-seg--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); border-radius: 16px; }
  .cv2-seg--4 span { border-radius: 12px; }
  .cv2-res__kcal strong { font-size: 3.25rem; }
  .cv2-macro { padding: .55rem; }
  .cv2-macro strong { font-size: 1.05rem; }
  .cv2-meals { grid-template-columns: minmax(0, 1fr); }
  .cv2-sum { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
  .cv2-sum__mid { grid-column: 1 / -1; grid-row: 2; }
  .cv2-cards { grid-template-columns: minmax(0, 1fr); }
  .cv2-split__head { flex-wrap: wrap; }
  .cv2 .cv2-h2 { font-size: 1.5rem; }
  .cv2 { padding-bottom: 6rem; } /* room for the mobile target bar */
}
