/* The portals' design layer, on top of the Tailwind utilities every view uses.
 *
 * Shared: ClientPortal and AdminPortal carry identical copies (each nginx image only ships its own
 * wwwroot), and tests/js/portal-ui.test.js fails if they drift. Edit one, copy it over. What differs
 * per portal (its built-in accent, its dark-mode remap of Tailwind classes) is in css/site.css.
 *
 * White-label: nothing here names a colour of the product's own. The brand comes from --brand and
 * --brand-accent (set from /api/branding by applyBranding(), and before first paint by theme.js
 * from the last branding seen), the menu style from [data-sidebar] and the corners from
 * [data-corners]. Everything derived from them is declared on :root and again on [data-brand-scope],
 * so the Branding page's live preview can carry its own values without repainting the console.
 * Shapes and spacing follow Pagadera's WebKit (tokens.css, components.css). */

/* ---- Inter, self-hosted (font-src 'self'; OFL, see fonts/OFL.txt) ---------------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- Surfaces and text: light, then dark ---------------------------------------------------- */
:root {
  color-scheme: light;
  --wf-surface-page: #f6f8fb;
  --wf-surface-card: #ffffff;
  --wf-surface-sunken: #f0f3f8;
  --wf-surface-hover: #e9eef5;
  --wf-border-hairline: #e3e8ef;
  --wf-border-strong: #d3dbe6;
  --wf-text-strong: #0b1b30;
  --wf-text-body: #334155;
  --wf-text-muted: #5b6678;
  --wf-tone-success: #047857; --wf-tone-success-bg: #e5f5ee;
  --wf-tone-danger: #be123c;  --wf-tone-danger-bg: #fdecef;
  --wf-tone-warning: #a16207; --wf-tone-warning-bg: #fdf4dc;
  --wf-tone-info: #1d4ed8;    --wf-tone-info-bg: #e8effd;
  --wf-shadow-hairline: 0 1px 2px rgb(15 27 45 / .04), 0 1px 1px rgb(15 27 45 / .02);
  --wf-shadow-raised: 0 1px 2px rgb(15 27 45 / .05), 0 4px 12px -2px rgb(15 27 45 / .06);
  --wf-shadow-float: 0 2px 6px rgb(15 27 45 / .06), 0 16px 40px -8px rgb(15 27 45 / .22);
  --wf-scrim: rgb(8 17 33 / .5);
  --wf-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
.dark {
  color-scheme: dark;
  /* Matches the Tailwind remap in site.css (bg-white -> #1e293b, borders #334155). */
  --wf-surface-page: #0f172a;
  --wf-surface-card: #1e293b;
  --wf-surface-sunken: #172033;
  --wf-surface-hover: #334155;
  --wf-border-hairline: #2b3a52;
  --wf-border-strong: #3b4c66;
  --wf-text-strong: #f1f5f9;
  --wf-text-body: #cbd5e1;
  --wf-text-muted: #94a3b8;
  --wf-tone-success: #6ee7b7; --wf-tone-success-bg: rgb(16 185 129 / .16);
  --wf-tone-danger: #fda4af;  --wf-tone-danger-bg: rgb(244 63 94 / .16);
  --wf-tone-warning: #fcd34d; --wf-tone-warning-bg: rgb(245 158 11 / .16);
  --wf-tone-info: #93c5fd;    --wf-tone-info-bg: rgb(59 130 246 / .16);
  --wf-shadow-hairline: 0 1px 2px rgb(0 0 0 / .3);
  --wf-shadow-raised: 0 1px 2px rgb(0 0 0 / .35), 0 4px 12px -2px rgb(0 0 0 / .35);
  --wf-shadow-float: 0 2px 6px rgb(0 0 0 / .4), 0 16px 40px -8px rgb(0 0 0 / .6), 0 0 0 1px rgb(148 163 184 / .12);
  --wf-scrim: rgb(2 6 15 / .65);
}

/* ---- The brand, the menu style and the corners (white-label) -------------------------------- */
:root, [data-brand-scope] {
  --wf-brand: var(--brand, var(--wf-brand-default, #4f46e5));
  --wf-accent: var(--brand-accent, var(--wf-brand));
  --wf-on-brand: var(--brand-on, #ffffff);
  --wf-brand-strong: color-mix(in srgb, var(--wf-brand) 82%, black);
  --wf-brand-deep: color-mix(in srgb, var(--wf-brand) 55%, #020617);
  --wf-brand-tint: color-mix(in srgb, var(--wf-brand) 10%, var(--wf-surface-card));
  --wf-brand-text: color-mix(in srgb, var(--wf-brand) 72%, var(--wf-text-strong));
  --wf-focus: color-mix(in srgb, var(--wf-brand) 70%, var(--wf-text-strong));

  /* The menu, light by default: the card surface with a brand-tinted active item. */
  --wf-sb-bg: var(--wf-surface-card);
  --wf-sb-border: var(--wf-border-hairline);
  --wf-sb-fg: var(--wf-text-body);
  --wf-sb-strong: var(--wf-text-strong);
  --wf-sb-muted: var(--wf-text-muted);
  --wf-sb-hover: var(--wf-surface-sunken);
  --wf-sb-active-bg: var(--wf-brand-tint);
  --wf-sb-active-fg: var(--wf-brand-text);
  --wf-sb-bar: var(--wf-accent);
  --wf-logo-chip: transparent;

  --wf-radius-sm: 6px;
  --wf-radius-control: 10px;
  --wf-radius-card: 16px;
}
/* :where() keeps these at the specificity of [data-sidebar=…] below, so a menu style always wins. */
.dark, :where(.dark) [data-brand-scope] {
  --wf-sb-bg: #111b2e;
  --wf-logo-chip: #ffffff;
  /* On a dark page the brand is lifted towards white, so a dark brand (navy) still reads. */
  --wf-brand-tint: color-mix(in srgb, var(--wf-brand) 30%, #1e293b);
  --wf-brand-text: color-mix(in srgb, var(--wf-brand) 35%, #ffffff);
  --wf-focus: color-mix(in srgb, var(--wf-brand) 40%, #ffffff);
  --wf-sb-bar: var(--brand-accent, var(--wf-brand-text));
}
[data-sidebar="dark"] {
  --wf-sb-bg: #0f172a;
  --wf-sb-border: #1e293b;
  --wf-sb-fg: #cbd5e1;
  --wf-sb-strong: #f8fafc;
  --wf-sb-muted: #7c8aa0;
  --wf-sb-hover: rgb(255 255 255 / .06);
  --wf-sb-active-bg: rgb(255 255 255 / .1);
  --wf-sb-active-fg: #ffffff;
  --wf-sb-bar: var(--brand-accent, color-mix(in srgb, var(--wf-brand) 45%, #ffffff));
  --wf-logo-chip: #ffffff;
}
[data-sidebar="brand"] {
  --wf-sb-bg: var(--wf-brand-deep);
  --wf-sb-border: rgb(255 255 255 / .08);
  --wf-sb-fg: rgb(255 255 255 / .82);
  --wf-sb-strong: #ffffff;
  --wf-sb-muted: rgb(255 255 255 / .55);
  --wf-sb-hover: rgb(255 255 255 / .08);
  --wf-sb-active-bg: rgb(255 255 255 / .14);
  --wf-sb-active-fg: #ffffff;
  --wf-sb-bar: var(--brand-accent, #ffffff);
  --wf-logo-chip: #ffffff;
}
[data-corners="soft"] { --wf-radius-sm: 4px; --wf-radius-control: 6px; --wf-radius-card: 10px; }
[data-corners="square"] { --wf-radius-sm: 2px; --wf-radius-control: 3px; --wf-radius-card: 4px; }

/* ---- Base ------------------------------------------------------------------------------------ */
html { font-feature-settings: "cv11", "ss01"; -webkit-tap-highlight-color: transparent; }
body { background: var(--wf-surface-page); }
.wf-icon { flex: none; display: inline-block; vertical-align: middle; }
[dir="rtl"] .wf-icon[data-directional] { transform: scaleX(-1); }
:focus-visible { outline: 2px solid var(--wf-focus); outline-offset: 2px; }
.tabular-nums, :where(#view) td { font-variant-numeric: tabular-nums; }
@keyframes wf-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes wf-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes wf-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes wf-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---- The app shell -------------------------------------------------------------------------- */
.wf-app { min-height: 100dvh; }
.wf-main { display: flex; flex-direction: column; min-width: 0; min-height: 100dvh; }
@media (min-width: 1024px) {
  .wf-app { display: grid; grid-template-columns: 16.5rem minmax(0, 1fr); }
  .wf-app[data-collapsed="true"] { grid-template-columns: 4.75rem minmax(0, 1fr); }
}

.wf-sidebar {
  position: fixed; inset-block: 0; inset-inline: 0 auto; z-index: 50;
  display: flex; flex-direction: column;
  width: min(18rem, 86vw);
  border-inline-end: 1px solid var(--wf-sb-border);
  background: var(--wf-sb-bg);
  color: var(--wf-sb-fg);
  transform: translateX(-100%);
  transition: transform 220ms var(--wf-ease), visibility 0s linear 220ms;
  visibility: hidden;
}
.wf-sidebar[data-open="true"] { transform: none; visibility: visible; box-shadow: var(--wf-shadow-float); transition: transform 220ms var(--wf-ease); }
@media (min-width: 1024px) {
  .wf-sidebar { position: sticky; top: 0; height: 100dvh; width: auto; transform: none; transition: none; visibility: visible; }
  .wf-sidebar[data-open="true"] { box-shadow: none; }
}
.wf-drawer-scrim { position: fixed; inset: 0; z-index: 45; background: var(--wf-scrim); animation: wf-fade 160ms ease-out; }
@media (min-width: 1024px) { .wf-drawer-scrim { display: none !important; } }

.wf-sidebar__brand { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 4.25rem; padding: .75rem 1rem .75rem 1.25rem; }
.wf-sidebar__brandtext { display: flex; flex-direction: column; gap: .25rem; min-width: 0; }
.wf-logo-chip { display: inline-flex; align-items: center; align-self: flex-start; max-width: 100%; border-radius: var(--wf-radius-control); background: var(--wf-logo-chip); }
.wf-logo-chip:not(.wf-logo-chip--text) { padding: .3125rem .5rem; }
.wf-sidebar__logo { display: block; max-height: 2.5rem; max-width: 10.5rem; object-fit: contain; }
.wf-sidebar__name { color: var(--wf-sb-strong); font-size: 1.0625rem; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; overflow-wrap: anywhere; }
.wf-logo-chip--text { background: transparent; }
.wf-sidebar__product { color: var(--wf-sb-muted); font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.wf-sidebar__mark { display: none; width: 2.25rem; height: 2.25rem; border-radius: var(--wf-radius-control); object-fit: contain; background: var(--wf-logo-chip); }
.wf-sidebar__initials { display: none; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: var(--wf-radius-control); background: var(--wf-brand); color: var(--wf-on-brand); font-size: .8125rem; font-weight: 700; }
.wf-sidebar__nav { flex: 1; overflow-y: auto; padding: .25rem .75rem 1rem; scrollbar-width: thin; }
.wf-sidebar__footer { padding: .5rem .75rem .75rem; border-top: 1px solid var(--wf-sb-border); }
.wf-sidebar__footer .wf-nav-item { width: 100%; color: var(--wf-sb-muted); }
.wf-app[data-collapsed="true"] .wf-sidebar__collapse .wf-icon { transform: scaleX(-1); }

.wf-nav-group + .wf-nav-group { margin-top: 1rem; }
.wf-nav-group__label {
  display: flex; align-items: center; gap: .625rem; width: 100%; height: 1.875rem; padding: 0 .75rem;
  border-radius: var(--wf-radius-control);
  color: var(--wf-sb-muted); font-size: .6875rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; text-align: start;
}
button.wf-nav-group__label { cursor: pointer; }
button.wf-nav-group__label:hover { background: var(--wf-sb-hover); color: var(--wf-sb-strong); }
.wf-nav-group__label .wf-nav-group__text { flex: 1; }
.wf-nav-group__chev { transition: transform 180ms var(--wf-ease); }
.wf-nav-group[data-open="false"] .wf-nav-group__chev { transform: rotate(-90deg); }
.wf-nav-group[data-open="false"] .wf-nav-items { display: none; }
.wf-nav-items { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }

.wf-nav-item {
  position: relative; display: flex; align-items: center; gap: .75rem;
  min-height: 2.375rem; padding: 0 .75rem;
  border-radius: var(--wf-radius-control);
  color: var(--wf-sb-fg); font-size: .875rem; font-weight: 500; text-align: start; text-decoration: none; white-space: nowrap;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.wf-nav-item .wf-icon { color: var(--wf-sb-muted); transition: color 150ms ease-out; }
.wf-nav-item:hover { background: var(--wf-sb-hover); color: var(--wf-sb-strong); }
.wf-nav-item:hover .wf-icon { color: var(--wf-sb-strong); }
.wf-nav-item[aria-current="page"] { background: var(--wf-sb-active-bg); color: var(--wf-sb-active-fg); font-weight: 600; }
.wf-nav-item[aria-current="page"] .wf-icon { color: var(--wf-sb-active-fg); }
.wf-nav-item[aria-current="page"]::before {
  content: ""; position: absolute; inset-inline-start: -.75rem; top: .5rem; bottom: .5rem; width: 3px;
  border-start-end-radius: 3px; border-end-end-radius: 3px; background: var(--wf-sb-bar);
}
.wf-nav-item__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

@media (min-width: 1024px) {
  .wf-app[data-collapsed="true"] .wf-nav-item__label,
  .wf-app[data-collapsed="true"] .wf-nav-group__label,
  .wf-app[data-collapsed="true"] .wf-sidebar__brandtext { display: none; }
  .wf-app[data-collapsed="true"] .wf-sidebar__mark { display: block; }
  .wf-app[data-collapsed="true"] .wf-sidebar__initials { display: grid; }
  .wf-app[data-collapsed="true"] .wf-sidebar__brand { justify-content: center; padding: .75rem 0; }
  .wf-app[data-collapsed="true"] .wf-nav-item { justify-content: center; padding: 0; }
  .wf-app[data-collapsed="true"] .wf-nav-group[data-open="false"] .wf-nav-items { display: flex; }
  .wf-app[data-collapsed="true"] .wf-nav-group + .wf-nav-group { margin-top: .5rem; padding-top: .5rem; border-top: 1px solid var(--wf-sb-border); }
}
@media (max-width: 1023px) { .wf-sidebar__footer { display: none; } }

.wf-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: .5rem;
  height: 4rem; padding: 0 1rem;
  border-bottom: 1px solid var(--wf-border-hairline);
  background: color-mix(in srgb, var(--wf-surface-page) 84%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
}
@media (min-width: 640px) { .wf-topbar { padding: 0 1.5rem; gap: .75rem; } }
@media (min-width: 1024px) { .wf-topbar__menu { display: none !important; } }
.wf-topbar__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--wf-text-strong); font-size: 1.0625rem; font-weight: 650; letter-spacing: -.01em; }
.wf-topbar__actions { display: flex; align-items: center; gap: .25rem; }
@media (min-width: 640px) { .wf-topbar__actions { gap: .5rem; } }

.wf-content { width: 100%; max-width: 100rem; margin: 0 auto; padding: 1.25rem 1rem 4rem; animation: wf-rise 220ms var(--wf-ease); }
@media (min-width: 640px) { .wf-content { padding: 1.75rem 1.5rem 4rem; } }
@media (min-width: 1280px) { .wf-content { padding: 2rem 2.5rem 4rem; } }

.wf-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .625rem 1rem; border-bottom: 1px solid; font-size: .875rem; }
@media (min-width: 640px) { .wf-banner { padding: .625rem 1.5rem; } }
.wf-banner--warning { background: var(--wf-tone-warning-bg); border-color: color-mix(in srgb, var(--wf-tone-warning) 25%, transparent); color: var(--wf-tone-warning); }
.wf-banner__text { display: flex; align-items: center; gap: .5rem; }

/* ---- Buttons in the chrome ------------------------------------------------------------------ */
.wf-icon-btn {
  position: relative; display: inline-grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem; border-radius: var(--wf-radius-control);
  color: var(--wf-text-muted); cursor: pointer;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.wf-icon-btn:hover, .wf-icon-btn[aria-expanded="true"] { background: var(--wf-surface-hover); color: var(--wf-text-strong); }
.wf-icon-btn--sm { width: 2rem; height: 2rem; }
.wf-sidebar .wf-icon-btn { color: var(--wf-sb-muted); }
.wf-sidebar .wf-icon-btn:hover { background: var(--wf-sb-hover); color: var(--wf-sb-strong); }
.wf-count {
  position: absolute; top: .3125rem; inset-inline-end: .3125rem;
  display: grid; place-items: center; min-width: 1rem; height: 1rem; padding: 0 .25rem;
  border-radius: 999px; background: var(--wf-accent); color: var(--wf-on-brand);
  font-size: .625rem; font-weight: 700; line-height: 1; box-shadow: 0 0 0 2px var(--wf-surface-page);
}
.wf-count.hidden { display: none; }

.wf-balance {
  display: inline-flex; align-items: center; gap: .5rem; height: 2.25rem; padding: 0 .3125rem 0 .75rem;
  border: 1px solid var(--wf-border-hairline); border-radius: 999px; background: var(--wf-surface-card);
  color: var(--wf-text-strong); font-size: .875rem; font-weight: 600; box-shadow: var(--wf-shadow-hairline); cursor: pointer;
  transition: border-color 150ms ease-out;
}
.wf-balance:hover { border-color: color-mix(in srgb, var(--wf-brand) 45%, var(--wf-border-hairline)); }
.wf-balance > .wf-icon { color: var(--wf-text-muted); }
.wf-balance__plus { display: grid; place-items: center; width: 1.625rem; height: 1.625rem; border-radius: 999px; background: var(--wf-brand); color: var(--wf-on-brand); }
@media (max-width: 479px) { .wf-balance > .wf-icon { display: none; } }

.wf-account {
  display: flex; align-items: center; gap: .625rem; height: 2.5rem; padding: 0 .375rem 0 .25rem;
  border-radius: 999px; color: var(--wf-text-strong); cursor: pointer; text-align: start;
}
.wf-account:hover, .wf-account[aria-expanded="true"] { background: var(--wf-surface-hover); }
.wf-account__text { display: none; line-height: 1.15; white-space: nowrap; max-width: 11rem; }
@media (min-width: 768px) { .wf-account__text { display: block; } }
.wf-account__name { display: block; overflow: hidden; text-overflow: ellipsis; font-size: .8125rem; font-weight: 600; }
.wf-account__meta { display: block; overflow: hidden; text-overflow: ellipsis; font-size: .6875rem; color: var(--wf-text-muted); }
.wf-account > .wf-icon { color: var(--wf-text-muted); }
/* A phone keeps the title readable: the theme moves into the account menu, the chevron goes. */
@media (max-width: 639px) {
  .wf-topbar #themeButton, .wf-account > .wf-icon { display: none; }
  .wf-account { padding: 0; }
}
.wf-avatar { display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 999px; overflow: hidden; background: var(--wf-brand); color: var(--wf-on-brand); font-size: .75rem; font-weight: 700; }
.wf-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Menus and popovers --------------------------------------------------------------------- */
.wf-popover {
  position: absolute; inset-inline-end: 0; top: calc(100% + .5rem); z-index: 60;
  min-width: 14rem; max-width: min(22rem, calc(100vw - 1.5rem));
  padding: .375rem; border: 1px solid var(--wf-border-hairline); border-radius: calc(var(--wf-radius-control) + 4px);
  background: var(--wf-surface-card); box-shadow: var(--wf-shadow-float);
  transform-origin: top right; animation: wf-pop 140ms var(--wf-ease);
}
.wf-popover.hidden { display: none; }
.wf-popover--panel { width: 22rem; padding: 0; overflow: hidden; }
.wf-popover__header { padding: .625rem .75rem .75rem; margin-bottom: .25rem; border-bottom: 1px solid var(--wf-border-hairline); }
.wf-popover__title { color: var(--wf-text-strong); font-size: .875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-popover__sub { color: var(--wf-text-muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-menu__item {
  display: flex; align-items: center; gap: .625rem; width: 100%; min-height: 2.25rem; padding: 0 .625rem;
  border-radius: var(--wf-radius-control); color: var(--wf-text-body); font-size: .875rem; text-align: start; text-decoration: none; cursor: pointer;
}
.wf-menu__item .wf-icon { color: var(--wf-text-muted); }
.wf-menu__item:hover, .wf-menu__item:focus-visible { background: var(--wf-surface-sunken); color: var(--wf-text-strong); outline: none; }
.wf-menu__item--danger, .wf-menu__item--danger .wf-icon { color: var(--wf-tone-danger); }
.wf-menu__item--danger:hover { background: var(--wf-tone-danger-bg); color: var(--wf-tone-danger); }
.wf-menu__sep { height: 1px; margin: .25rem .375rem; background: var(--wf-border-hairline); }
.wf-notice { padding: .75rem 1rem; border-bottom: 1px solid var(--wf-border-hairline); }
.wf-notice:last-child { border-bottom: 0; }
.wf-notice--unread { background: var(--wf-brand-tint); }
.wf-empty { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 2rem 1rem; color: var(--wf-text-muted); font-size: .875rem; text-align: center; }
.wf-empty .wf-icon { color: var(--wf-text-muted); opacity: .7; }

/* ---- Cards, pills, banners ------------------------------------------------------------------ */
.wf-card { border: 1px solid var(--wf-border-hairline); border-radius: var(--wf-radius-card); background: var(--wf-surface-card); box-shadow: var(--wf-shadow-hairline); }
.wf-pill {
  display: inline-flex; align-items: center; gap: .375rem; min-height: 1.375rem; padding: .0625rem .5rem;
  border-radius: 999px; font-size: .75rem; font-weight: 500; line-height: 1.2; white-space: nowrap;
}
.wf-pill__dot { flex: none; width: .375rem; height: .375rem; border-radius: 999px; background: currentColor; opacity: .85; }
.wf-pill--live .wf-pill__dot { animation: wf-pulse 1.6s ease-in-out infinite; }
.wf-alert { display: flex; align-items: flex-start; gap: .625rem; padding: .75rem 1rem; border: 1px solid; border-radius: var(--wf-radius-control); font-size: .875rem; }
.wf-alert > .wf-icon { margin-top: .0625rem; }
.wf-alert--danger { background: var(--wf-tone-danger-bg); border-color: color-mix(in srgb, var(--wf-tone-danger) 25%, transparent); color: var(--wf-tone-danger); }
.wf-alert--warning { background: var(--wf-tone-warning-bg); border-color: color-mix(in srgb, var(--wf-tone-warning) 25%, transparent); color: var(--wf-tone-warning); }
.wf-spinner { width: 2rem; height: 2rem; border: 2px solid color-mix(in srgb, var(--wf-brand) 25%, transparent); border-top-color: var(--wf-brand); border-radius: 999px; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* An icon on a tinted tile: categories, credentials, payment methods. */
.wf-tile { display: inline-grid; place-items: center; flex: none; width: 2.5rem; height: 2.5rem; border-radius: var(--wf-radius-control); background: var(--wf-brand-tint); color: var(--wf-brand-text); }
.wf-tile--sm { width: 2rem; height: 2rem; }
.wf-tile--lg { width: 3rem; height: 3rem; }

/* ---- Toasts ---------------------------------------------------------------------------------- */
.wf-toast-host { position: fixed; inset-inline: .75rem; bottom: .75rem; z-index: 70; display: flex; flex-direction: column; align-items: stretch; gap: .5rem; pointer-events: none; }
@media (min-width: 640px) { .wf-toast-host { inset-inline: auto 1.25rem; bottom: 1.25rem; width: 24rem; } }
.wf-toast {
  display: flex; align-items: flex-start; gap: .75rem; padding: .75rem .75rem .75rem .875rem;
  border: 1px solid var(--wf-border-hairline); border-radius: calc(var(--wf-radius-control) + 4px);
  background: var(--wf-surface-card); color: var(--wf-text-strong); box-shadow: var(--wf-shadow-float);
  font-size: .875rem; pointer-events: auto; animation: wf-rise 200ms var(--wf-ease);
}
.wf-toast__icon { display: grid; place-items: center; flex: none; width: 1.75rem; height: 1.75rem; border-radius: 999px; }
.wf-toast--success .wf-toast__icon { background: var(--wf-tone-success-bg); color: var(--wf-tone-success); }
.wf-toast--error .wf-toast__icon { background: var(--wf-tone-danger-bg); color: var(--wf-tone-danger); }
.wf-toast--info .wf-toast__icon { background: var(--wf-brand-tint); color: var(--wf-brand-text); }
.wf-toast__text { flex: 1; min-width: 0; padding-top: .25rem; overflow-wrap: anywhere; }
.wf-toast .wf-icon-btn { margin: -.125rem -.125rem 0 0; }

/* ---- Modals: a dialog, or a sheet from the bottom on phones ---------------------------------- */
.wf-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; padding: 0; background: var(--wf-scrim); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: wf-fade 160ms ease-out; }
.wf-dialog {
  display: flex; flex-direction: column; width: 100%; max-height: 92dvh;
  border-radius: calc(var(--wf-radius-card) + 2px) calc(var(--wf-radius-card) + 2px) 0 0;
  background: var(--wf-surface-card); box-shadow: var(--wf-shadow-float); overflow: hidden;
  animation: wf-rise 220ms var(--wf-ease);
}
@media (min-width: 640px) {
  .wf-modal { align-items: center; padding: 1.5rem; }
  .wf-dialog { max-height: 90dvh; border-radius: calc(var(--wf-radius-card) + 2px); }
}
.wf-dialog__header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .875rem .875rem .875rem 1.25rem; border-bottom: 1px solid var(--wf-border-hairline); }
.wf-dialog__title { color: var(--wf-text-strong); font-size: 1rem; font-weight: 600; }
.wf-dialog > .p-5 { overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 639px) { .wf-dialog > .p-5 { padding-bottom: calc(1.25rem + env(safe-area-inset-bottom)); } }

/* ---- Segmented control (Branding page) ------------------------------------------------------- */
.wf-segmented { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .25rem; border-radius: calc(var(--wf-radius-control) + 2px); background: var(--wf-surface-sunken); }
.wf-segmented button { display: inline-flex; align-items: center; gap: .375rem; height: 2rem; padding: 0 .75rem; border-radius: var(--wf-radius-control); color: var(--wf-text-muted); font-size: .8125rem; font-weight: 500; }
.wf-segmented button:hover { color: var(--wf-text-strong); }
.wf-segmented button[aria-pressed="true"] { background: var(--wf-surface-card); color: var(--wf-text-strong); box-shadow: var(--wf-shadow-raised); }

/* ---- Sign-in screens ------------------------------------------------------------------------- */
.wf-auth { min-height: 100dvh; display: grid; background: var(--wf-surface-page); }
@media (min-width: 1024px) { .wf-auth { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); } }
.wf-auth__brand {
  position: relative; display: none; flex-direction: column; justify-content: space-between; gap: 2rem; padding: 3rem; overflow: hidden;
  background: radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--wf-brand) 85%, white) 0%, transparent 55%),
              linear-gradient(150deg, var(--wf-brand) 0%, var(--wf-brand-deep) 100%);
  color: #fff;
}
@media (min-width: 1024px) { .wf-auth__brand { display: flex; } }
.wf-auth__brand::after { content: ""; position: absolute; inset: auto -20% -35% auto; width: 32rem; height: 32rem; border-radius: 999px; border: 1px solid rgb(255 255 255 / .12); box-shadow: 0 0 0 4rem rgb(255 255 255 / .03), 0 0 0 8rem rgb(255 255 255 / .02); }
.wf-auth__logo { display: inline-flex; align-self: flex-start; padding: .625rem .875rem; border-radius: var(--wf-radius-card); background: #fff; box-shadow: 0 10px 30px -10px rgb(0 0 0 / .35); }
.wf-auth__logo img { display: block; max-height: 3.5rem; max-width: 14rem; object-fit: contain; }
.wf-auth__headline { position: relative; z-index: 1; max-width: 28rem; font-size: 2.25rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.wf-auth__tagline { margin-top: .75rem; max-width: 26rem; color: rgb(255 255 255 / .78); font-size: 1rem; line-height: 1.5; }
.wf-auth__foot { position: relative; z-index: 1; color: rgb(255 255 255 / .6); font-size: .8125rem; }
.wf-auth__panel { display: flex; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
@media (min-width: 640px) { .wf-auth__panel { padding: 3rem 2rem; } }
.wf-auth__card { width: 100%; max-width: 26rem; }
.wf-auth__mobilebrand { display: flex; flex-direction: column; align-items: center; gap: .75rem; margin-bottom: 1.5rem; text-align: center; }
@media (min-width: 1024px) { .wf-auth__mobilebrand { display: none; } }
.wf-auth__mark { width: 3.5rem; height: 3.5rem; border-radius: var(--wf-radius-card); object-fit: contain; background: #fff; padding: .375rem; box-shadow: var(--wf-shadow-raised); }
.wf-auth__initials { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; border-radius: var(--wf-radius-card); background: var(--wf-brand); color: var(--wf-on-brand); font-size: 1.25rem; font-weight: 700; }
.wf-auth__title { color: var(--wf-text-strong); font-size: 1.5rem; font-weight: 700; letter-spacing: -.015em; }
.wf-auth__sub { color: var(--wf-text-muted); font-size: .875rem; }
.wf-field { position: relative; }
.wf-field > .wf-icon { position: absolute; inset-inline-start: .75rem; top: 50%; transform: translateY(-50%); color: var(--wf-text-muted); pointer-events: none; }
.wf-field > input { padding-inline-start: 2.375rem !important; }
.wf-field__toggle { position: absolute; inset-inline-end: .25rem; top: 50%; transform: translateY(-50%); }
.wf-field__toggle + input, .wf-field > input.has-toggle { padding-inline-end: 2.75rem !important; }

/* ---- The Branding page: swatches, image slots and the live preview ------------------------- */
.wf-swatch { height: 2rem; border-radius: var(--wf-radius-control); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08); cursor: pointer; }
.wf-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--wf-surface-card), 0 0 0 4px var(--wf-text-strong); }
.wf-image-slot {
  display: flex; align-items: center; justify-content: center; flex: none; width: 11rem; height: 3.75rem; overflow: hidden;
  border: 1px dashed var(--wf-border-strong); border-radius: var(--wf-radius-control);
  background: repeating-conic-gradient(var(--wf-surface-sunken) 0 25%, var(--wf-surface-card) 0 50%) 0 0 / 14px 14px;
  color: var(--wf-text-muted); font-size: .75rem;
}
.wf-image-slot--square { width: 3.75rem; }
.wf-image-slot img { max-width: calc(100% - .75rem); max-height: calc(100% - .75rem); object-fit: contain; }
.wf-preview { display: grid; gap: 1rem; }
.wf-pv-app { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); min-height: 15rem; overflow: hidden; border: 1px solid var(--wf-border-hairline); border-radius: var(--wf-radius-card); background: var(--wf-surface-page); }
.wf-pv-sidebar { display: flex; flex-direction: column; gap: .125rem; padding: .625rem .5rem; border-inline-end: 1px solid var(--wf-sb-border); background: var(--wf-sb-bg); color: var(--wf-sb-fg); }
.wf-pv-sidebar .wf-sidebar__brand { min-height: 0; padding: .25rem .25rem .625rem; }
.wf-pv-sidebar .wf-sidebar__logo { max-height: 1.75rem; max-width: 7.5rem; }
.wf-pv-sidebar .wf-sidebar__name { font-size: .875rem; }
.wf-pv-sidebar .wf-nav-group__label { height: 1.5rem; padding: 0 .5rem; font-size: .625rem; }
.wf-pv-sidebar .wf-nav-item { min-height: 2rem; gap: .5rem; padding: 0 .5rem; font-size: .75rem; }
.wf-pv-sidebar .wf-nav-item[aria-current="page"]::before { inset-inline-start: -.5rem; }
.wf-pv-main { display: flex; flex-direction: column; min-width: 0; }
.wf-pv-topbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; height: 2.75rem; padding: 0 .75rem; border-bottom: 1px solid var(--wf-border-hairline); color: var(--wf-text-strong); font-size: .8125rem; font-weight: 600; }
.wf-pv-body { display: grid; gap: .75rem; padding: .75rem; }
.wf-pv-line { height: .5rem; border-radius: 999px; background: var(--wf-surface-hover); }
.wf-pv-field { height: 2rem; border: 1px solid var(--wf-border-strong); border-radius: var(--wf-radius-control); background: var(--wf-surface-card); }
.wf-btn-brand { display: inline-flex; align-items: center; justify-content: center; gap: .375rem; height: 2.25rem; padding: 0 .875rem; border-radius: var(--wf-radius-control); background: var(--wf-brand); color: var(--wf-on-brand); font-size: .8125rem; font-weight: 600; }
.wf-pv-login { display: grid; grid-template-columns: 1fr 1fr; min-height: 10rem; overflow: hidden; border: 1px solid var(--wf-border-hairline); border-radius: var(--wf-radius-card); }
.wf-pv-login__brand { display: flex; flex-direction: column; justify-content: space-between; gap: .5rem; padding: .875rem; background: linear-gradient(150deg, var(--wf-brand) 0%, var(--wf-brand-deep) 100%); color: #fff; }
.wf-pv-login__brand img { max-height: 1.5rem; max-width: 6rem; object-fit: contain; padding: .25rem .375rem; border-radius: var(--wf-radius-sm); background: #fff; }
.wf-pv-login__form { display: grid; align-content: center; gap: .5rem; padding: .875rem; background: var(--wf-surface-page); }

/* ---- Views: light-touch defaults, below any utility class a view sets ------------------------ */
:where(#view) :where(thead th) { position: sticky; top: 0; z-index: 1; background: var(--wf-surface-card); }
:where(#view) :where(tbody tr) { transition: background-color 120ms ease-out; }
:where(#view) :where(tbody tr:hover) { background: color-mix(in srgb, var(--wf-surface-sunken) 70%, transparent); }
:where(#view, .wf-modal) :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), select, textarea) { border-radius: var(--wf-radius-control); }
:where(#view, .wf-modal, .wf-auth) :where(input, select, textarea):focus-visible { outline: 2px solid color-mix(in srgb, var(--wf-brand) 45%, transparent); outline-offset: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
