/* ===========================================================
   CHEF ANTYO — SHARED COMPONENTS (design system v1, Nov 2026)
   Loaded on every page after site.css. Defines only NEW tokens and ca-* classes, so adding it changes nothing
   that already exists; pages move onto these parts one at a time. Rules: DESIGN.md at the repo root.

   Brand tokens (--ink, --panel, --gold, --red, --cream, --muted …) live in site.css. Every rule here reads them with
   the site.css value as a fallback, so the 12 pages that don't load site.css still get the right colors.
   =========================================================== */

:root {
  /* surfaces */
  --panel-2: #2c2622;            /* raised inside a card: inputs, chips, tiles */
  --overlay: rgba(14, 12, 11, .72);

  /* status (separate from brand red: red means "act", --bad means "problem") */
  --ok: #6fbf8a;   --ok-bg: rgba(111, 191, 138, .14);   --ok-line: rgba(111, 191, 138, .4);
  --warn: #d9a441; --warn-bg: rgba(217, 164, 65, .14);  --warn-line: rgba(217, 164, 65, .4);
  --bad: #ff8b80;  --bad-bg: rgba(255, 139, 128, .13);  --bad-line: rgba(255, 139, 128, .4);
  --info: #7fb3ff; --info-bg: rgba(127, 179, 255, .13); --info-line: rgba(127, 179, 255, .4);

  /* type scale (Archivo body, Fraunces display) */
  --fs-xs: .75rem; --fs-sm: .8125rem; --fs-md: .9375rem; --fs-lg: 1.0625rem;
  --fs-xl: 1.25rem; --fs-2xl: 1.6rem; --fs-3xl: 2.1rem; --fs-4xl: 2.8rem;

  /* spacing: 4px grid */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;

  /* shape and depth */
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-pill: 999px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .25);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, .38);
  --shadow-lg: 0 22px 54px rgba(0, 0, 0, .5);
  --focus: 0 0 0 3px rgba(201, 168, 76, .35);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

/* ---------- buttons: one style, three looks, three sizes ---------- */
.ca-btn {
  --b-bg: transparent; --b-fg: var(--cream, #f4efe4); --b-line: var(--line, #352f2c);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 40px; padding: 0 var(--s-5); border-radius: var(--r-pill); border: 1px solid var(--b-line);
  background: var(--b-bg); color: var(--b-fg); font: 600 var(--fs-md)/1 var(--body, system-ui, sans-serif);
  text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .08s;
}
.ca-btn:hover { border-color: var(--gold, #c9a84c); }
.ca-btn:active { transform: scale(.98); }
.ca-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.ca-btn:disabled, .ca-btn[aria-disabled="true"] { opacity: .45; cursor: default; transform: none; }
.ca-btn--primary { --b-bg: var(--red, #e5231b); --b-fg: #fff; --b-line: var(--red, #e5231b); }
.ca-btn--primary:hover { --b-bg: var(--red-soft, #ff5a4d); border-color: var(--red-soft, #ff5a4d); }
.ca-btn--gold { --b-bg: var(--gold, #c9a84c); --b-fg: #1b1817; --b-line: var(--gold, #c9a84c); }
.ca-btn--gold:hover { --b-bg: var(--gold-soft, #e0c882); }
.ca-btn--danger { --b-fg: var(--bad); --b-line: var(--bad-line); }
.ca-btn--quiet { --b-line: transparent; --b-bg: var(--panel-2); }
.ca-btn--sm { min-height: 32px; padding: 0 var(--s-3); font-size: var(--fs-sm); }
.ca-btn--lg { min-height: 48px; padding: 0 var(--s-6); font-size: var(--fs-lg); }
.ca-btn--icon { width: 40px; padding: 0; }
.ca-btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- status pills ---------- */
.ca-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--r-pill);
  font: 700 var(--fs-xs)/1.4 var(--body, system-ui, sans-serif); white-space: nowrap;
  color: var(--muted, #a8a099); background: rgba(255, 255, 255, .06);
}
.ca-pill--ok { color: var(--ok); background: var(--ok-bg); }
.ca-pill--warn { color: var(--warn); background: var(--warn-bg); }
.ca-pill--bad { color: var(--bad); background: var(--bad-bg); }
.ca-pill--info { color: var(--info); background: var(--info-bg); }
.ca-pill--gold { color: var(--gold-soft, #e0c882); background: rgba(201, 168, 76, .16); }
.ca-pill--dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ---------- page and section headings ---------- */
.ca-eyebrow { font: 700 var(--fs-xs)/1.3 var(--body, system-ui, sans-serif); letter-spacing: .16em; text-transform: uppercase; color: var(--gold, #c9a84c); }
.ca-page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin: 0 0 var(--s-6); }
.ca-page-h h1 { margin: 0; font: 400 var(--fs-3xl)/1.1 var(--display, Georgia, serif); color: var(--cream, #f4efe4); text-wrap: balance; }
.ca-page-h h1 em { color: var(--gold-soft, #e0c882); }
.ca-page-h p { margin: var(--s-1) 0 0; color: var(--muted, #a8a099); font-size: var(--fs-md); }
.ca-section-h { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin: 0 0 var(--s-3); }
.ca-section-h h2 { margin: 0; font: 400 var(--fs-xl)/1.2 var(--display, Georgia, serif); color: var(--cream, #f4efe4); }

/* ---------- cards and stat tiles ---------- */
.ca-card { background: var(--panel, #231f1d); border: 1px solid var(--line, #352f2c); border-radius: var(--r-lg); padding: var(--s-5); min-width: 0; }
.ca-card--flush { padding: 0; overflow: hidden; }
.ca-card--attention { border-color: var(--warn-line); box-shadow: inset 3px 0 0 var(--warn); }
.ca-card--problem { border-color: var(--bad-line); box-shadow: inset 3px 0 0 var(--bad); }
.ca-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.ca-stat { display: grid; gap: 2px; padding: var(--s-4); border-radius: var(--r-md); background: var(--panel-2); border: 1px solid var(--line, #352f2c); text-decoration: none; color: inherit; }
.ca-stat b { font: 600 var(--fs-2xl)/1.1 var(--display, Georgia, serif); font-variant-numeric: tabular-nums; color: var(--cream, #f4efe4); }
.ca-stat span { font-size: var(--fs-sm); color: var(--muted, #a8a099); }
a.ca-stat:hover { border-color: var(--gold, #c9a84c); }

/* ---------- tables ---------- */
.ca-table-wrap { overflow-x: auto; border: 1px solid var(--line, #352f2c); border-radius: var(--r-md); background: var(--panel, #231f1d); }
.ca-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); font-variant-numeric: tabular-nums; }
.ca-table th { text-align: left; font: 700 var(--fs-xs)/1.3 var(--body, system-ui, sans-serif); letter-spacing: .08em; text-transform: uppercase; color: var(--muted, #a8a099);
  padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line, #352f2c); background: rgba(255, 255, 255, .02); position: sticky; top: 0; }
.ca-table td { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line, #352f2c); vertical-align: middle; }
.ca-table tr:last-child td { border-bottom: 0; }
.ca-table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.ca-table .num { text-align: right; }

/* ---------- forms ---------- */
.ca-field { display: grid; gap: 6px; min-width: 0; }
.ca-field > span, .ca-label { font: 600 var(--fs-sm)/1.3 var(--body, system-ui, sans-serif); color: var(--muted, #a8a099); }
.ca-input, .ca-field input:not([type=checkbox]):not([type=radio]), .ca-field select, .ca-field textarea {
  width: 100%; min-height: 42px; padding: 10px 12px; border-radius: var(--r-sm); border: 1px solid var(--line, #352f2c);
  background: var(--panel-2); color: var(--cream, #f4efe4); font: var(--fs-md)/1.4 var(--body, system-ui, sans-serif);
}
.ca-input:focus, .ca-field input:focus, .ca-field select:focus, .ca-field textarea:focus { outline: none; border-color: var(--gold, #c9a84c); box-shadow: var(--focus); }
.ca-field small { color: var(--muted, #a8a099); font-size: var(--fs-xs); }
.ca-form-row { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }

/* ---------- tabs (segmented) ---------- */
.ca-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-md); background: var(--panel, #231f1d); border: 1px solid var(--line, #352f2c); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.ca-tabs::-webkit-scrollbar { display: none; }
.ca-tabs > * { flex: none; padding: 8px 14px; border-radius: var(--r-sm); border: 0; background: transparent; color: var(--muted, #a8a099);
  font: 600 var(--fs-sm)/1 var(--body, system-ui, sans-serif); cursor: pointer; text-decoration: none; }
.ca-tabs > [aria-current="page"], .ca-tabs > [aria-selected="true"], .ca-tabs > .on { background: var(--cream, #f4efe4); color: #1b1817; }

/* ---------- toolbars, empty states, avatars ---------- */
.ca-toolbar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin: 0 0 var(--s-4); }
.ca-toolbar .ca-grow { flex: 1 1 220px; }
.ca-empty { text-align: center; padding: var(--s-10) var(--s-5); border: 1px dashed var(--line, #352f2c); border-radius: var(--r-lg); color: var(--muted, #a8a099); display: grid; gap: var(--s-2); justify-items: center; }
.ca-empty b { color: var(--cream, #f4efe4); font-size: var(--fs-lg); }
.ca-avatar { --c: var(--gold, #c9a84c); width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--c) 28%, var(--panel, #231f1d)); color: var(--cream, #f4efe4); font: 700 var(--fs-sm)/1 var(--body, system-ui, sans-serif); }

@media (prefers-reduced-motion: reduce) { .ca-btn { transition: none; } .ca-btn:active { transform: none; } }

/* ---------- Cursor and scrollbars (site-wide) ----------
   A cream arrow with a dark edge (gold on anything clickable), only on mouse/trackpad devices.
   Text fields keep the normal text cursor. Scrollbars are slim, warm and match the dark grounds. */
@media (pointer: fine) {
  html { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M4 2.5v16.2l4.3-4.1 2.9 6.6 2.7-1.2-2.9-6.5h6.1z' fill='%23f4efe4' stroke='%230e0c0b' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E") 4 2, auto; }
  a, button, summary, label[for], select, [role="button"], [role="tab"], .ca-btn, .btn, input[type="checkbox"], input[type="radio"] {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M4 2.5v16.2l4.3-4.1 2.9 6.6 2.7-1.2-2.9-6.5h6.1z' fill='%23C9A84C' stroke='%230e0c0b' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E") 4 2, pointer; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, [contenteditable="true"] { cursor: text; }
  button:disabled, .ca-btn:disabled, .btn:disabled { cursor: not-allowed; }
}
html { scrollbar-color: rgba(201, 168, 76, .45) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201, 168, 76, .35); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(201, 168, 76, .6); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- No white boxes: native controls follow the dark brand ---------- */
html { color-scheme: dark; }   /* date pickers, dropdown lists and number spinners draw dark */
input[type="checkbox"], input[type="radio"] {
  appearance: none; -webkit-appearance: none; flex: none; width: 18px; height: 18px; margin: 0; display: inline-grid; place-content: center;
  border: 1.5px solid rgba(244, 239, 228, .35); background: var(--panel-2, #2b2623); cursor: pointer; vertical-align: middle;
  transition: background-color .12s, border-color .12s;
}
input[type="checkbox"] { border-radius: 5px; }
input[type="radio"] { border-radius: 50%; }
input[type="checkbox"]::before { content: ""; width: 10px; height: 10px; transform: scale(0); transition: transform .12s;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%); background: var(--char, #1b1817); }
input[type="radio"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; transform: scale(0); transition: transform .12s; background: var(--char, #1b1817); }
input[type="checkbox"]:checked, input[type="radio"]:checked { background: var(--gold, #C9A84C); border-color: var(--gold, #C9A84C); }
input[type="checkbox"]:checked::before, input[type="radio"]:checked::before { transform: scale(1); }
input[type="checkbox"]:indeterminate { background: var(--gold, #C9A84C); border-color: var(--gold, #C9A84C); }
input[type="checkbox"]:indeterminate::before { transform: scale(1); clip-path: inset(40% 10%); }
input[type="checkbox"]:hover, input[type="radio"]:hover { border-color: var(--gold, #C9A84C); }
input[type="checkbox"]:focus-visible, input[type="radio"]:focus-visible { outline: 2px solid var(--gold, #C9A84C); outline-offset: 2px; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { opacity: .45; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { input[type="checkbox"], input[type="radio"], input[type="checkbox"]::before, input[type="radio"]::before { transition: none; } }

/* ---------- One cursor everywhere: the gold Chef AntyO arrow (page styles that set their own pointer can't swap it) ---------- */
@media (pointer: fine) {
  html, html *, html *::before, html *::after {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M4 2.5v16.2l4.3-4.1 2.9 6.6 2.7-1.2-2.9-6.5h6.1z' fill='%23C9A84C' stroke='%230e0c0b' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E") 4 2, auto !important;
  }
  html input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]), html textarea, html [contenteditable="true"] { cursor: text !important; }
  html :disabled { cursor: not-allowed !important; }
}

/* ---------- Page changes: no white flash, a quick cross-fade, the staff header holds still ---------- */
html { background: #0e0c0b; }
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .16s; }
.staffnav.sn2 { view-transition-name: staff-header; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }

/* ---------- No hidden sideways scrolling on computers: rows of tabs and chips wrap onto a second line instead of
   cutting words off. Phones keep the swipe, with a visible thin scrollbar so it's clear there's more. ---------- */
@media (min-width: 761px) {
  .ca-tabs, .fk-chips, .kb-tabs, .pt-tabs, .studio-nav, .ev-tabs, .dl-cats, .kira-embed .chips.scroll-row,
  .chips, .st-strip, .tl-row, .mp-chips, .pg-seg, .pg-chips, .ad-for, .sn2 .sn-sub, .sn2 .sn-sections, .md-chips, .td-feedchips {
    flex-wrap: wrap !important; overflow-x: visible !important; -webkit-mask-image: none !important; mask-image: none !important;
  }
  .ca-tabs { display: inline-flex; }
}
@media (max-width: 760px) {
  .ca-tabs, .fk-chips, .kb-tabs, .pt-tabs, .studio-nav, .ev-tabs, .dl-cats, .chips, .st-strip, .tl-row, .mp-chips, .pg-seg, .pg-chips, .ad-for, .sn2 .sn-sub, .sn2 .sn-sections {
    scrollbar-width: thin !important;
  }
}


/* "Close this section" at the bottom of long open sections (Dish Library categories, Meal Prep weeks) */
.dl-close { display: flex; align-items: center; justify-content: center; gap: 6px; width: calc(100% - 28px); margin: 0 14px 14px; padding: 9px; border-radius: 10px;
  border: 1px dashed var(--line, #352f2c); background: transparent; color: var(--muted, #a8a099); font: 600 .8rem var(--body, sans-serif); }
.dl-close:hover { color: var(--cream, #f4efe4); border-color: var(--gold, #C9A84C); }
.mp-close { margin-top: 12px; }

/* Panels and tabs appear at once: whole-page changes already cross-fade, and a second fade on top read as a glitch */
.pt-panel.on, .kb-panel.on { animation: none !important; }

/* ---------- dropdowns: closed look (low specificity, page styles still win) and the styled open menu (select-ui.js) ---------- */
select[aria-expanded="true"] { border-color: #d9b866 !important; }
.sx-menu {
  position: fixed; z-index: 2147483000; display: flex; flex-direction: column; max-width: min(420px, calc(100vw - 16px));
  background: #1b1816; border: 1px solid rgba(217, 184, 102, .35); border-radius: 14px; padding: 6px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  font: 500 .88rem/1.35 var(--body, 'Archivo', system-ui, sans-serif); color: #f3ead8;
  animation: sxIn .12s ease-out;
}
@keyframes sxIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.sx-menu .sx-list { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(217,184,102,.4) transparent; }
.sx-menu .sx-search { padding: 2px 2px 6px; }
.sx-menu .sx-search input { width: 100%; height: 34px; border-radius: 9px; border: 1px solid rgba(255,255,255,.12); background: #121010; color: #f3ead8; padding: 0 10px; font: inherit; }
.sx-menu .sx-group { padding: 8px 10px 4px; font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #a8987a; }
.sx-menu .sx-opt { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; white-space: nowrap; }
.sx-menu .sx-opt .sx-label { overflow: hidden; text-overflow: ellipsis; }
.sx-menu .sx-opt.hi { background: rgba(217, 184, 102, .14); }
.sx-menu .sx-opt.on { color: #e9cf8a; font-weight: 650; }
.sx-menu .sx-opt.off { opacity: .4; }
.sx-menu .sx-check { width: 14px; flex: none; height: 14px; }
.sx-menu .sx-opt.on .sx-check { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.5 7.5l3 3 6-7' fill='none' stroke='%23e9cf8a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
