/*
 * The look: a bright, plain business tool. Loaded last; layout lives in the other
 * stylesheets, and the colour and type values are at the top of styles.css.
 */
body { font-variant-numeric: tabular-nums; }
h1, h2 { font-weight: 750; letter-spacing: -0.028em; }
h2 { line-height: 1.12; }
h3, .detail h3, .lib__title h3, .rows b, .clients tbody th, .plan h3, .client-box h2, .side h2, .intake h2, .assistant__head h2 { font-weight: 650; letter-spacing: -0.012em; }

/* ---------- controls ---------- */
.button { gap: 8px; border-color: var(--rule-2); border-radius: var(--radius); background: var(--white); color: var(--ink); font-weight: 600; }
.button:hover { border-color: var(--ink-3); }
.button--solid { background: var(--accent); border-color: var(--accent); color: var(--white); }
.button--solid:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: var(--white); }
.button--solid:disabled:hover { background: var(--accent); border-color: var(--accent); }
.button--large { min-height: 50px; padding: 0 26px; }
.link { font-weight: 600; text-decoration-color: transparent; color: var(--accent); }
.link:hover { color: var(--accent-deep); text-decoration-color: currentColor; }
.link.danger { color: var(--warn); }

.field input:not([type="checkbox"]), .field select, .field textarea, .toolbar input, .assistant input, .intake textarea, .client__copy select,
.target input, .wb__select, .wb__template input, .detail__actions select, .lib > input, .foodsearch__row input, .foodsearch__row select,
.ingredients input, .ingredients select, .ownfood input, .sharelink input, .share__other input { border-radius: 8px; border-color: var(--rule-2); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgb(71 118 97 / 0.28); outline-offset: 0; border-color: var(--accent); }
.chip span { border-radius: 999px; }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); }
.status, .pill, .dish__fit { border-radius: 999px; }

/* ---------- header ---------- */
.mark { align-items: center; gap: 7px; font: 800 24px/1 var(--display); letter-spacing: -0.03em; }
/* The mark's tag becomes a small square. */
.mark__zero { width: 10px; height: 10px; margin-top: 6px; padding: 0; overflow: hidden; border-radius: 3px; font-size: 0; }
.nav a, .portal-nav a { font-weight: 600; }
.nav a:hover, .portal-nav a:hover { color: var(--ink); text-decoration: none; }

/* ---------- the signed-in app ---------- */
.portal { background: var(--stone); }
.portal-header { background: var(--white); border-bottom: 1px solid var(--rule); }
.page-head h1 { font-size: clamp(28px, 3.2vw, 40px); }
.panel, .client-box, .side, .intake, .assistant, .history[open], .share-panel { border: 1px solid var(--rule); border-radius: var(--radius-large); background: var(--white); }
.panel { overflow: hidden; box-shadow: var(--shadow); }
.narrow .form { padding: 24px; border: 1px solid var(--rule); border-radius: var(--radius-large); background: var(--white); }
.tool, .tool--app { background: transparent; }
.table-scroll { padding: 4px 18px; border: 1px solid var(--rule); border-radius: var(--radius-large); background: var(--white); }
.table-scroll h2 { margin-top: 14px; }
.split .table-scroll { margin-top: 20px; }
.clients tbody tr:last-child > * { border-bottom: 0; }
.clients tbody th { font-size: 16px; }
.toolbar { border-bottom: 0; }
.filtertab { background: var(--white); border-color: var(--rule); }
.filtertab[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); }
.filtertab__n { font-weight: 700; }
.status { background: var(--stone-2); border-color: transparent; color: var(--ink-2); font-weight: 600; }
.status--approved { background: var(--accent-wash); color: var(--accent-deep); }
.status--draft { background: var(--stone-2); color: var(--ink); }
.status--review { background: var(--amber-wash); color: var(--amber); }
.rows, .today .rows { border-top-color: var(--rule); }
.today__panel { padding: 18px 20px; border: 1px solid var(--rule); border-radius: var(--radius-large); background: var(--white); }
.today__panel h2 { font-size: 18px; }
.today__panel .rows li:last-child { border-bottom: 0; }
.today__panel .rows small { display: block; color: var(--ink-3); }
.today__panel .today__note { font-style: italic; overflow-wrap: anywhere; }
/* On a phone the client list comes first; visits and check-ins follow it. */
@media (max-width: 760px) {
  .dashboard { display: flex; flex-direction: column; }
  .dashboard > .today { order: 9; margin: 32px 0 0; }
}
.plain thead th, .lines, .details { border-color: var(--rule); }

.plans { gap: 20px; border: 0; }
.plan { border: 1px solid var(--rule); border-radius: var(--radius-large); background: var(--white); }
.plan + .plan { border: 1px solid var(--rule); }
.plan.is-wanted { border-color: var(--accent); background: var(--accent-wash); }
.plan__price { font-weight: 750; letter-spacing: -0.03em; }
.plan .button { width: 100%; }
.plan { position: relative; }
.plan.is-recommended { border: 2px solid var(--accent); }
.plan__tag { position: absolute; top: -13px; left: 24px; padding: 2px 12px; border-radius: 999px; background: var(--accent); color: var(--white); font-size: 12px; font-weight: 700; line-height: 20px; }
.plan__each { font-size: 14px; font-weight: 600; color: var(--accent-deep); }

/* ---------- warnings stay red, whatever the accent ---------- */
.notice { border-left: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--white); }
.notice.is-error { border-color: #f3c2bd; background: var(--warn-wash); color: #7a1a12; }
.notice.is-demo { border-color: #f0d9a8; background: var(--amber-wash); color: var(--amber); }
.banner { background: var(--warn); }
.warn, .clients small.warn, .field__error, .detail__verdict.is-off, .savestate.is-error, .rows li.is-flag b, .meter.is-off .meter__head b { color: var(--warn); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--warn); }
.pill.is-on { background: var(--accent); border-color: var(--accent); }
.pill.is-off { background: var(--warn); border-color: var(--warn); }
.is-on > i { background: var(--accent); border-color: var(--accent) !important; }
.is-partial > i { background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); border-color: var(--accent) !important; }
.is-off > i { background: var(--warn); border-color: var(--warn) !important; }

/* ---------- week builder ---------- */
.grid, .grid__corner, .grid__day, .wb__daytabs button { border-bottom-color: var(--rule); }
.lib { border-right-color: var(--rule); }
.lib__tabs { border-radius: 8px; overflow: hidden; }
.lib__tabs button[aria-pressed="true"] { background: var(--ink); }
.dish__fit { border-color: transparent; background: var(--accent-wash); color: var(--accent-deep); font-weight: 600; }
.grid__day[aria-pressed="true"], .wb__daytabs button[aria-pressed="true"] { background: var(--accent-wash); }
.cell { padding: 3px; }
.cell__main { border-radius: 8px; }
.cell.is-filled .cell__main { background: var(--stone); }
.cell.is-filled .cell__main:hover { background: var(--stone-2); }
.cell.is-selected { box-shadow: none; }
.cell.is-selected .cell__main { background: var(--accent-wash); box-shadow: inset 0 0 0 2px var(--accent); }
.cell__remove { top: 6px; right: 6px; border-radius: 6px; }
.cell__name { font-weight: 600; }
.detail__day { border-left-color: var(--rule); }
.meter__bar { border-radius: 999px; }
.meter__bar i { border-radius: 999px; background: var(--accent); }
.meter__bar u { background: var(--ink-3); }
.meter.is-off .meter__bar i { background: var(--warn); }
.meter.is-off .meter__bar u { background: var(--ink); }
.meter__head b { font-weight: 700; }
.savestate { font: 600 16px var(--sans); color: var(--ink-2); }

/* ---------- the toolbar's "More" menu and the targets line ---------- */
.wb__bar { justify-content: flex-start; }
.menu { position: relative; margin-left: auto; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu__body { position: absolute; right: 0; top: calc(100% + 6px); z-index: 15; display: grid; gap: 8px; width: 260px; padding: 12px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); }
.menu__body .button, .menu__body .wb__select { width: 100%; }
.menu__body .wb__template { display: grid; }
.panel.wb { overflow: visible; }
.targets { border-bottom: 1px solid var(--rule); }
.targets > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 11px 16px; font-size: 14px; cursor: pointer; list-style: none; }
.targets > summary::-webkit-details-marker { display: none; }
.targets > summary b { font-weight: 650; }
.targets > summary span { color: var(--ink-2); }
.targets > summary em { margin-left: auto; font-style: normal; font-weight: 600; color: var(--accent); }
.targets[open] > summary em { font-size: 0; }
.targets[open] > summary em::after { content: "Done"; font-size: 14px; }
.targets .wb__targets { border-bottom: 0; padding-top: 4px; }
.starter { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 24px; padding: 16px; border-bottom: 1px solid var(--rule); background: var(--accent-wash); }
.starter p { font-weight: 600; }
.starter p span { display: block; font-weight: 400; color: var(--ink-2); font-size: 14px; }

/* ---------- creating a plan, step by step ---------- */
.stepper { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 0 0 20px; padding: 0; list-style: none; }
.stepper li { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; color: var(--ink-3); }
.stepper b { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--rule-2); background: var(--white); font-size: 13px; }
.stepper li[aria-current="step"] { color: var(--ink); }
.stepper li[aria-current="step"] b { background: var(--accent); border-color: var(--accent); color: var(--white); }
.stepper li.is-done b { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-deep); }
.client-form--single { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
.client-box .form__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.client-box .form__grid > * { grid-column: span 2; }
.client-box .form__grid > :first-child { grid-column: 1 / -1; }
.optional { border-top: 1px solid var(--rule); }
.optional > summary { padding: 14px 0 0; font-weight: 600; color: var(--accent); cursor: pointer; }
.optional > div { display: grid; gap: 18px; padding-top: 16px; }
.share-panel { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-bottom: 14px; padding: 18px 20px; border-color: var(--accent); background: var(--accent-wash); }
.share-panel p { font-weight: 650; }
.share-panel p span { display: block; font-weight: 400; color: var(--ink-2); font-size: 14px; }
.share-panel > div { display: flex; flex-wrap: wrap; gap: 8px; }
.share-panel input { flex-basis: 100%; min-height: 40px; padding: 0 10px; border: 1px solid var(--rule-2); border-radius: 8px; background: var(--white); font: 400 13px var(--sans); }
.handout { margin-top: 18px; }
.handout > summary { padding: 8px 0; font-weight: 600; cursor: pointer; }
.handout .client { margin-top: 10px; padding-block: 28px; border-radius: var(--radius-large); background: var(--stone-2); color: var(--ink); }
.handout .client__copy p { color: var(--ink-2); }
.sheet { border-radius: var(--radius); }
.sheet__head h3 { font-weight: 750; }

@media (max-width: 960px) {
  .detail__day { border-top-color: var(--rule); }
  .lib { border-top-color: var(--rule); }
}
@media (max-width: 760px) {
  .client-box .form__grid > * { grid-column: 1 / -1; }
  .menu__body { width: min(260px, 80vw); }
}
@media print {
  .stepper, .share-panel, .handout > summary { display: none !important; }
  .portal { background: var(--white); }
  .handout .client { background: none; padding: 0; margin: 0; }
}

/* ---------- the client's portal and its link ---------- */
.share__card { margin-top: 16px; padding: 16px 18px; border: 1px solid var(--rule); border-radius: var(--radius-large); background: var(--accent-wash); }
.share__card h2 { font-size: 14px; font-weight: 650; color: var(--accent-deep); }
.share__card p { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.portal-link { display: grid; gap: 12px; padding: 20px; border: 1px solid var(--rule); border-radius: var(--radius-large); background: var(--white); }
.portal-link input { width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: 8px; font: 400 13px var(--sans); background: var(--stone); }
.portal-link textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--rule-2); border-radius: 8px; font: 400 15px/1.5 var(--sans); resize: vertical; }
.clients td .button { white-space: nowrap; }
.portal-link + .form { margin-top: 20px; }
@media (max-width: 760px) { .clients tbody td:nth-of-type(6) { margin-top: 8px; } }

/* ---------- safety warnings ---------- */
.safety .notice { margin-bottom: 10px; }
.reasonbox { display: grid; gap: 10px; margin-bottom: 16px; padding: 18px 20px; border: 1px solid var(--warn); border-radius: var(--radius-large); background: var(--white); }
.reasonbox p { font-weight: 650; }
.reasonbox textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--rule-2); border-radius: 8px; font: 400 15px/1.5 var(--sans); }
.lowweight { display: grid; gap: 4px; }
.lowweight .notice { margin-bottom: 8px; }

.allergens { border-top: 1px solid var(--rule); }
.allergens__row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--rule); font-size: 14px; font-weight: 500; }
.allergens__row small { display: block; font-weight: 600; font-size: 12px; color: var(--amber); }
.field .allergens__row input { min-height: 0; width: auto; }

.passcode { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; font-weight: 600; }
.passcode b { font-size: 22px; letter-spacing: 0.12em; }
.passcode span { flex-basis: 100%; font-weight: 400; font-size: 13px; color: var(--ink-3); }
.share__unlock { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.share__code { width: 9ch; min-height: 50px; padding: 0 12px; border: 1px solid var(--rule-2); border-radius: 8px; font: 600 24px var(--sans); letter-spacing: 0.15em; }
.share__unlock .share__message { flex-basis: 100%; }

.account__h { margin: 36px 0 6px; font-size: 22px; }
.account__h + .field__hint { margin-bottom: 12px; }

/* The board needs the whole width, so the handout's controls sit above it. */
.handout .client__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.handout .client__copy { position: static; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; max-width: none; }
.handout .client__copy p { flex-basis: 100%; margin: 0; font-size: 14px; }
.handout .client__copy select, .handout .client__copy .button { margin: 0; width: auto; }
.handout__out > .sheet { margin-inline: auto; }
.share__print { margin-top: 16px; }

/* ---------- the language button ---------- */
.lang { display: inline-flex; align-items: center; gap: 6px; }
.lang__icon svg { display: block; width: 18px; height: 18px; fill: none; stroke: var(--accent); stroke-width: 1.6; }
.lang__code { display: none; color: var(--ink); }
.lang select { min-height: 36px; padding: 0 10px; border: 1px solid var(--rule-2); border-radius: 999px; background: var(--white); color: var(--ink); font: 600 13px var(--sans); cursor: pointer; }
.lang select:focus-visible { outline: 3px solid rgb(71 118 97 / 0.28); outline-offset: 1px; border-color: var(--accent); }
.share__lang { display: flex; justify-content: flex-end; padding: 14px var(--gutter) 0; }
@media print { .lang, .share__lang { display: none !important; } }
/* Other languages have longer words. */
html:not([lang="en"]) .grid__meal { padding: 0 3px 0 6px; font-size: 11px; overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto; }
html:not([lang="en"]) :is(h1, h2, h3, .grid b, .tiles p, .board__meal) { overflow-wrap: break-word; -webkit-hyphens: auto; hyphens: auto; }
html:not([lang="en"]) .lib__tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html:not([lang="en"]) .lib__tabs button:nth-child(3) { border-left: 0; }
html:not([lang="en"]) .lib__tabs button:nth-child(n+3) { border-top: 1px solid var(--rule-2); }
/* On a phone the header makes room for the language button. */
@media (max-width: 760px) {
  .lang { position: relative; gap: 0; }
  .lang .lang__icon { display: block; position: absolute; left: 10px; top: 50%; translate: 0 -50%; pointer-events: none; }
  .lang .lang__code { display: block; position: absolute; left: 32px; top: 50%; translate: 0 -50%; font-size: 12px; pointer-events: none; }
  .lang select { width: 62px; max-width: 62px; padding: 0; color: transparent; -webkit-appearance: none; appearance: none; }
  .lang select option { color: var(--ink); }
  .home .site-header { grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; }
  .home .site-header .account-links { flex-wrap: nowrap; justify-content: flex-end; gap: 8px; min-width: 0; }
  .home .site-header .account-links .button { height: auto; min-height: 36px; padding: 4px 12px; font-size: 13px; line-height: 1.2; text-align: center; }
  .home .site-header .account-links .link { font-size: 13px; }
}

/* ---------- opening a client and following their progress ---------- */
.clients__row { cursor: pointer; }
.clients tbody th a.clients__name { color: var(--accent-deep); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 4px; }
.clients tbody th a.clients__name:hover { text-decoration-color: currentColor; }
.clients__open { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font: 600 13px var(--sans); }
.clients__open a { color: var(--accent); text-decoration: none; }
.clients__open a:hover { text-decoration: underline; }
.clients__progress a { font-weight: 650; text-decoration: none; }
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.glance__card { display: grid; align-content: start; gap: 4px; padding: 16px 18px; border: 1px solid var(--rule); border-radius: var(--radius-large); background: var(--white); }
.glance__card p { font-size: 13px; color: var(--ink-3); }
.glance__card b { font-size: 24px; letter-spacing: -0.02em; }
.glance__card small { font-size: 13px; color: var(--ink-2); }
.glance__card a { font-size: 13px; font-weight: 600; color: var(--accent); }
/* Header words stay on one line; mid-size windows tighten the spacing first. */
@media (min-width: 761px) {
  .home .site-header { grid-template-columns: 1fr auto 1fr; column-gap: 16px; }
  .home .site-header .account-links, .home .site-header .nav { white-space: nowrap; }
  .home .site-header .account-links { justify-self: end; }
}
@media (min-width: 761px) and (max-width: 1180px) {
  .home .site-header { grid-template-columns: auto 1fr auto; padding-inline: 24px; }
  .home .site-header .nav { justify-self: center; gap: 18px; }
  .home .site-header .account-links { gap: 12px; }
  .home .site-header .lang > span { display: none; }
  .home .site-header .account-links .button { padding-inline: 14px; }
}
@media (min-width: 761px) and (max-width: 880px) {
  .home .site-header { grid-template-columns: 1fr auto; grid-template-areas: "brand account" "tabs tabs"; height: auto; padding-block: 12px 8px; row-gap: 6px; }
  .home .site-header .mark { grid-area: brand; }
  .home .site-header .account-links { grid-area: account; }
  .home .site-header .nav { grid-area: tabs; justify-self: start; }
}

/* ---------- changing the foods in a meal ---------- */
.lines__tools { display: inline-flex; }
.lines__tool { width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--ink-3); font-size: 15px; line-height: 1; cursor: pointer; }
.lines__tool:hover:not(:disabled) { background: var(--stone-2); color: var(--ink); }
.lines__tool:disabled { opacity: 0.3; cursor: default; }
.detail__changed { margin-top: 6px; font-size: 13px; color: var(--accent-deep); }
.detail__method small { color: var(--ink-3); }
.foodpick { display: grid; gap: 8px; margin-top: 12px; padding: 12px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--stone); }
.foodpick__row { display: flex; gap: 8px; }
.foodpick__row input { flex: 1; min-width: 0; min-height: 38px; padding: 0 10px; border: 1px solid var(--rule-2); border-radius: 8px; font-size: 14px; }
.foodpick__row select { min-height: 38px; border: 1px solid var(--rule-2); border-radius: 8px; background: var(--white); }
.foodpick__results { display: flex; flex-wrap: wrap; gap: 6px; }
.foodpick__hit { padding: 6px 10px; border: 1px solid var(--rule-2); border-radius: 999px; background: var(--white); font-size: 13px; cursor: pointer; }
.foodpick__hit:hover { border-color: var(--accent); background: var(--accent-wash); }
.detail__rename { display: grid; gap: 4px; margin-top: 8px; font-size: 13px; color: var(--ink-3); }
.detail__rename input { min-height: 36px; padding: 0 10px; border: 1px solid var(--rule-2); border-radius: 8px; font-size: 14px; color: var(--ink); }

/* ---------- the client page: game features switch and meal ratings ---------- */
.play-toggle { margin-top: 18px; }
.play-toggle .check { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; cursor: pointer; }
.play-toggle .check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--accent); flex: none; }
.rows .rated { color: var(--ink-2); font-weight: 600; }

/* The week builder is read all day: its small labels stay at 12px or more. */
.target small, .dish__meta, .grid__day small, .wb__daytabs small, .cell__kcal, .lines__name small, .lines__source,
.pill, .meter__head em, .detail__method small, .plain small { font-size: 12px; }
.dish__fit { font-size: 11px; }
/* An empty dashboard panel is one line, not a card. */
.today__panel.is-empty { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding-block: 12px; align-self: start; }
.today__panel.is-empty h2 { font-size: 15px; }
.today__panel.is-empty p { margin: 0; }
/* Destructive actions: red words on white, never the green of a safe step. */
.button--danger { border-color: rgb(180 35 24 / 0.35); background: var(--white); color: var(--warn); }
.button--danger:hover:not(:disabled) { border-color: var(--warn); background: #fdf3f2; color: var(--warn); }
.found__ideas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; color: var(--ink-3); font-size: 14px; }
/* The client's verdict on a meal: a small coloured mark before the words, no emoji. */
.rated span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--ink-3); vertical-align: 1px; }
.rated--love span::before { background: var(--accent); }
.rated--never span::before { background: var(--warn); }
/* An empty list says what goes there and offers the next step. */
.empty-box { display: grid; gap: 16px; justify-items: start; margin-top: 12px; padding: 28px; border-radius: var(--radius-large); background: var(--white); box-shadow: var(--shadow); color: var(--ink-2); }
.empty-box__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.builtin { margin-top: 28px; }
