/* Marketiism WP-15 layer (loaded by every shell right after components.css). Tokens only.
   Stacked phone tables (T1), sticky table empty state (T2), touch + zoom-safe controls (FM1), upright placeholders
   (FM5), two-line action list (F1), standalone filter bar (T4), slim cookie bar (PU4), command palette (N1),
   nav group badge (N4), table meta size (A1). */

/* ---------------------------------------------------------------- A1: small text at 13px */
.table .who__sub, .table td.muted, .alist__meta { font-size: var(--fs-13); }

/* ---------------------------------------------------------------- FM5: placeholders upright */
.input::placeholder, .textarea::placeholder, input::placeholder, textarea::placeholder { font-style: normal; }

/* ---------------------------------------------------------------- F1: action list second line */
.alist__link--multi { align-items: flex-start; }
.alist__link--multi .alist__icon, .alist__link--multi .alist__go { margin-top: var(--s-1); }
.alist__text { min-width: 0; flex: 1 1 auto; }
.alist__sub {
  display: block; margin-top: var(--s-1); color: var(--muted); font-size: var(--fs-13);
  font-weight: var(--fw-regular); line-height: var(--lh-snug); white-space: normal;
}

/* ---------------------------------------------------------------- T4: filter bar outside a card */
.filterbar--card, .stack > .filterbar, .c-content > .filterbar {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-card, none); padding: var(--s-3) var(--s-4); margin-inline: 0;
}

/* ---------------------------------------------------------------- T2: empty state stays in view */
.table-wrap:has(.table__state) { container-type: inline-size; }
.table__empty { position: sticky; left: 0; width: 100%; max-width: 100%; }
@supports (width: 1cqi) {
  .table__empty { width: calc(100cqi - 2 * var(--s-4)); }
}
.table__empty > * { max-width: var(--empty-max); margin-inline: auto; }

/* ---------------------------------------------------------------- FM1: touch targets, no iOS zoom */
@media (max-width: 640px), (pointer: coarse) {
  .input, .select, .textarea,
  .field__control > input, .field__control > select, .field__control > textarea {
    font-size: var(--fs-16); min-height: var(--touch-min);
  }
  .btn:not(.btn--sm):not(.btn--link) { min-height: var(--touch-min); }
  .btn--icon:not(.btn--sm) { min-width: var(--touch-min); }
  .btn.btn--sm { min-height: var(--control-h-lg); }
  .btn--icon.btn--sm { min-width: var(--control-h-lg); }
}

/* ---------------------------------------------------------------- T1: stacked tables under 640px */
@media (max-width: 640px) {
  .table.table--stack, .table.table--stack tbody { display: block; width: 100%; }
  .table.table--stack thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .table.table--stack tbody tr:not(.table__state) {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s-3); row-gap: var(--s-1);
    padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line);
  }
  .table.table--stack tbody tr:not(.table__state):has(> td.table__sel) { grid-template-columns: auto minmax(0, 1fr) auto; }
  .table.table--stack tbody tr:not(.table__state) > td {
    display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3);
    grid-column: 1 / -1; min-width: 0; height: auto; padding: 0; border: 0; text-align: right; white-space: normal;
  }
  .table.table--stack tbody tr:not(.table__state) > td::before {
    content: attr(data-label); flex: 0 0 auto; max-width: var(--stack-label-max);
    color: var(--muted); font-size: var(--fs-13); font-weight: var(--fw-regular); text-align: left;
  }
  .table.table--stack tbody tr > td[data-label=""]::before,
  .table.table--stack tbody tr > td.t-key::before,
  .table.table--stack tbody tr > td.t-amt::before,
  .table.table--stack tbody tr > td.table__actions::before { content: none; }
  .table.table--stack tbody tr:not(.table__state) > td.t-key {
    display: block; grid-column: 1; grid-row: 1; text-align: left; font-weight: var(--fw-medium);
  }
  .table.table--stack tbody tr:not(.table__state) > td.t-amt {
    display: block; grid-column: 2; grid-row: 1; font-weight: var(--fw-semibold); white-space: nowrap;
  }
  .table.table--stack tbody tr:not(.table__state) > td.table__sel { display: block; grid-column: 1; grid-row: 1; }
  .table.table--stack tbody tr:has(> td.table__sel) > td.t-key { grid-column: 2; }
  .table.table--stack tbody tr:has(> td.table__sel) > td.t-amt { grid-column: 3; }
  .table.table--stack tbody tr:not(.table__state) > td.table__actions {
    order: 2; justify-content: flex-end; flex-wrap: wrap; padding-top: var(--s-2);
  }
  .table.table--stack tbody tr > td.hide-sm,
  .table.table--stack tbody tr > td.hide-md,
  .table.table--stack tbody tr > td.t-nostack { display: none; }
  .table.table--stack tbody tr.table__state, .table.table--stack tbody tr.table__state > td { display: block; }
}

/* T1b (17 Nov, every-screen report): tablets keep the table, but text cells wrap and padding is tighter so the
   last columns (amounts, buttons) are not pushed off to the right inside the box. Numbers, dates and amounts stay on one line. */
@media (min-width: 641px) and (max-width: 1100px) {
  .table.table--stack th, .table.table--stack td { padding-left: var(--s-3); padding-right: var(--s-3); }
  .table.table--stack td:not(.num):not(.nowrap):not(.t-amt) { white-space: normal; }
  .table.table--stack td:has(> .who) { max-width: 260px; }
  .table.table--stack td .who__text { min-width: 0; }
  .table.table--stack td code { overflow-wrap: anywhere; }
}

/* ---------------------------------------------------------------- N4: nav group badge (shown while collapsed) */
.c-nav__gbadge { margin-inline-start: auto; }
.c-nav__toggle[aria-expanded="true"] .c-nav__gbadge { display: none; }
.is-rail .c-nav__gbadge { display: none; }

/* ---------------------------------------------------------------- PU4: slim cookie bar */
.cookiebar .cookiebar__in { align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-4); }
.cookiebar .cookiebar__title { display: inline; margin: 0 var(--s-2) 0 0; font-size: var(--fs-14); }
.cookiebar .cookiebar__body { display: block; min-width: 0; flex: 1 1 auto; }
.cookiebar .cookiebar__text { display: inline; margin: 0; font-size: var(--fs-13); line-height: var(--lh-snug); }
.cookiebar .cookiebar__actions { flex: none; flex-direction: row; gap: var(--s-2); margin: 0; }
@media (max-width: 640px) {
  .cookiebar .cookiebar__icon { display: none; }
  /* 25 Oct: keep the safe-area inset (iPhone home bar) and put the button row across the bar, button on the right;
     the bare `width: auto` left a small OK hanging at the bottom-left edge. */
  .cookiebar .cookiebar__in { padding: var(--s-2) var(--s-3) calc(var(--s-2) + env(safe-area-inset-bottom, 0px)); }
  .cookiebar .cookiebar__actions { width: 100%; justify-content: flex-end; }
  .cookiebar .cookiebar__actions .btn { width: auto; flex: none; min-width: 96px; justify-content: center; }
  .cookiebar .cookiebar__title { display: none; }
}

/* ---------------------------------------------------------------- N1: command palette (console shell) */
.pal {
  width: min(var(--pal-w), calc(100vw - 2 * var(--s-4))); max-width: none; max-height: min(var(--pal-h), calc(100vh - 2 * var(--pal-top)));
  margin: var(--pal-top) auto auto; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); overflow: hidden;
}
.pal[open] { display: flex; flex-direction: column; }
.pal::backdrop { background: var(--scrim); }
.pal__box { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--line); }
.pal__box:focus-within { box-shadow: inset 0 calc(-1 * var(--focus-width)) 0 var(--focus); }
.pal__glass { color: var(--muted); flex: none; }
.pal__input {
  flex: 1 1 auto; min-width: 0; min-height: var(--touch-min); border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: var(--fs-16); outline: none;
}
.pal__list { flex: 1 1 auto; overflow: auto; padding: var(--s-2); overscroll-behavior: contain; }
.pal__heading {
  padding: var(--s-2) var(--s-3) var(--s-1); color: var(--muted); font-size: var(--fs-12); font-weight: var(--fw-semibold);
  letter-spacing: var(--track-caps); text-transform: uppercase;
}
.pal__opt {
  display: flex; align-items: center; gap: var(--s-3); min-height: var(--pal-row-h); padding: var(--s-2) var(--s-3);
  border-radius: var(--r); color: var(--ink); cursor: pointer;
}
.pal__opt.is-active { background: var(--surface-sel); box-shadow: inset var(--focus-width) 0 0 var(--focus); }
.pal__icon { flex: none; color: var(--muted); }
.pal__opt.is-active .pal__icon { color: var(--link); }
.pal__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal__meta { flex: none; color: var(--muted); font-size: var(--fs-12); }
.pal__none { margin: 0; padding: var(--s-6) var(--s-4); color: var(--muted); text-align: center; }
.pal__foot {
  display: flex; gap: var(--s-4); margin: 0; padding: var(--s-2) var(--s-4); border-top: 1px solid var(--line);
  color: var(--muted); font-size: var(--fs-12);
}
.pal kbd {
  padding: 0 var(--s-1); border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface-2);
  color: var(--ink-2); font-family: var(--mono); font-size: var(--fs-12);
}
@media (max-width: 640px) {
  .pal { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .pal__foot, .pal__kbd { display: none; }
}

/* ---------------------------------------------------------------- WP-11D requests from public-ui */
/* Responsive 16:9 video: <div class="embed"><iframe class="embed__frame" ...></iframe></div> */
.embed { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--r); background: var(--surface-3); }
.embed--square { aspect-ratio: 1 / 1; }
.embed--map { aspect-ratio: 4 / 3; }
.embed--tall { aspect-ratio: 3 / 4; min-height: 560px; } /* WP-19E chat widget preview */
.embed__frame, .embed > iframe, .embed > video { display: block; width: 100%; height: 100%; border: 0; }

/* radio variant="chips": compact wrapping pills (time slots, sizes). The input stays focusable but invisible. */
.choices--chips { flex-direction: row; flex-wrap: wrap; gap: var(--s-2); }
.choices--chips > legend { flex-basis: 100%; }
.chip-opt { position: relative; display: inline-flex; }
.chip-opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip-opt__text {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-1);
  min-width: 96px; min-height: var(--control-h-lg); padding: 0 var(--s-3);
  border: 1px solid var(--line-input); border-radius: var(--r-pill); background: var(--surface);
  color: var(--ink); font-size: var(--fs-14); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease);
}
.chip-opt__text .check__desc { font-size: var(--fs-12); color: var(--muted); font-weight: var(--fw-regular); }
.chip-opt:hover .chip-opt__text { border-color: var(--ink-2); }
.chip-opt input:checked + .chip-opt__text { border-color: var(--brand-btn); background: var(--brand-btn); color: var(--brand-btn-ink); }
.chip-opt input:checked + .chip-opt__text .check__desc { color: inherit; }
.chip-opt input:focus-visible + .chip-opt__text { outline: var(--focus-width) solid var(--focus); outline-offset: 2px; }
.chip-opt input:disabled { cursor: not-allowed; }
.chip-opt input:disabled + .chip-opt__text { border-style: dashed; color: var(--muted); background: var(--surface-2); text-decoration: line-through; }
@media (max-width: 640px) { .chip-opt__text { min-width: 88px; min-height: var(--touch-min); } }

/* suite_grid variant="plain": columns only (no group labels) */
.suite--plain .suite__group { padding-top: var(--s-4); }
