/* Polish layer (Lustre, 2026-11-17). Marlene's Aesthetic Standard sections 35 and 36, app lane. Hand-authored; load AFTER theme-bridge.css.
   Uses theme tokens only (themes.css is generated and is not touched). Values come from the shared tokens below (35.1).
   Resting-state law: every state is fully visible with motion off. Animations are @keyframes with `backwards` fill, written only inside
   @media (prefers-reduced-motion: no-preference); no base rule sets opacity:0 or a transform offset. Calm and fast: nothing a daily user
   repeats exceeds 220ms, the header and the primary action never move, no list stagger on navigation (section 36 refinement). */

:root {
  --dur-instant: 90ms; --dur-fast: 140ms; --dur-base: 220ms; --dur-slow: 320ms;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-std: cubic-bezier(.4, 0, .2, 1);
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
  /* elevation, light mode: navy-tinted, light from the top (y offset only) */
  --elev-0: none;
  --elev-1: 0 1px 2px rgb(49 62 72 / .06), 0 1px 3px rgb(49 62 72 / .08);
  --elev-2: 0 4px 8px -2px rgb(49 62 72 / .10), 0 2px 4px -2px rgb(49 62 72 / .06);
  --elev-3: 0 12px 24px -6px rgb(49 62 72 / .16), 0 4px 8px -4px rgb(49 62 72 / .08);
  --elev-4: 0 24px 48px -12px rgb(49 62 72 / .24), 0 8px 16px -8px rgb(49 62 72 / .10);
  --scrim: rgb(15 20 25 / .45);
  --z-sticky: 10; --z-menu: 20; --z-modal: 40;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --shimmer: rgb(255 255 255 / .55);
  /* Tertiary text (footer notes, secondary labels). WCAG AA 4.5:1 on light backgrounds (tas v1-22). */
  --text-tertiary: #666;
  /* header band (navy on the WFG themes). Text on the band is always the band ink, never the page ink. */
  --band-bg: var(--surface-console, #313e48);
  --band-ink: #ffffff;
  --band-ink-2: rgb(255 255 255 / .80);
  --band-line: rgb(255 255 255 / .16);
  --band-hover: rgb(255 255 255 / .12);
  --band-active: rgb(255 255 255 / .16);
  --band-mark: rgb(255 255 255 / .14);
}
html[data-theme="signature-midnight"], html[data-theme="abyss"], html[data-theme="twilight"] {
  --elev-1: 0 1px 2px rgb(0 0 0 / .35), inset 0 1px 0 rgb(255 255 255 / .04);
  --elev-2: 0 4px 10px -2px rgb(0 0 0 / .45), inset 0 1px 0 rgb(255 255 255 / .05);
  --elev-3: 0 12px 28px -6px rgb(0 0 0 / .55), inset 0 1px 0 rgb(255 255 255 / .06);
  --elev-4: 0 24px 56px -12px rgb(0 0 0 / .65), inset 0 1px 0 rgb(255 255 255 / .07);
  --scrim: rgb(0 0 0 / .6);
  --shimmer: rgb(255 255 255 / .07);
  /* Dark themes: lighter tertiary text for contrast on dark backgrounds (tas v1-22). */
  --text-tertiary: #aaa;
}
/* Themes whose console colour is mid-blue need a brighter secondary ink to keep 4.5:1 */
html[data-theme="wfg-social-blue"] { --band-ink-2: rgb(255 255 255 / .96); --band-hover: rgb(0 0 0 / .14); --band-active: rgb(0 0 0 / .22); --band-mark: rgb(0 0 0 / .18); }
/* Themes whose console colour is light: the band uses the theme's own ink instead of white */
html[data-theme="daylight"], html[data-theme="harbor"], html[data-theme="midtone"], html[data-theme="verdant"],
html[data-theme="grove"], html[data-theme="ledger"], html[data-theme="highcontrast"] {
  --band-ink: var(--ink-primary); --band-ink-2: var(--ink-secondary);
  --band-line: var(--line); --band-hover: var(--accent-wash); --band-active: var(--accent-wash); --band-mark: var(--accent-wash);
}

html { scroll-padding-top: 112px; }

/* ---- 1. Motion foundation: 140ms on every control, 90ms press, visible focus ------------------------------------------------ */
:where(button, a, input, select, textarea, summary, [role="button"], [role="menuitemradio"], .nav-btn) {
  transition: background-color var(--dur-fast) var(--ease-std), color var(--dur-fast) var(--ease-std), border-color var(--dur-fast) var(--ease-std),
    box-shadow var(--dur-fast) var(--ease-std), transform var(--dur-fast) var(--ease-std), opacity var(--dur-fast) var(--ease-std);
}
:where(button, [role="button"]):not(:disabled):not(.nav-btn):not(.theme-picker-item):active {
  transform: scale(.98); transition-duration: var(--dur-instant);
}
:where(button, input, select, textarea):disabled { opacity: .55; cursor: not-allowed; }
html[data-theme] .btn-primary:hover:not(:disabled) { box-shadow: var(--elev-2); }
html[data-theme] .btn-primary:active:not(:disabled) { box-shadow: var(--elev-0); }
html[data-theme] .btn-secondary:hover:not(:disabled), html[data-theme] .btn-edit:hover:not(:disabled), html[data-theme] .btn-cancel:hover:not(:disabled) { background: var(--surface-sunken); border-color: var(--ink-tertiary); }
html[data-theme] .btn-primary, html[data-theme] .btn-secondary, html[data-theme] .btn-edit, html[data-theme] .btn-delete, html[data-theme] .btn-cancel { border-radius: 6px; font-weight: 500; }
html[data-theme] input:hover:not(:disabled):not([type="checkbox"]):not([type="radio"]), html[data-theme] select:hover:not(:disabled), html[data-theme] textarea:hover:not(:disabled) { border-color: var(--accent); }
html[data-theme] input:not([type="checkbox"]):not([type="radio"]), html[data-theme] select, html[data-theme] textarea { border-radius: 6px; }
html[data-theme] #client-search { padding: 8px 12px; font: inherit; width: min(100%, 360px); }

/* Focus: never removed. 2px ring at 2px offset plus a soft wash. On the navy band the ring is the band ink; inside the tab strip it is inset so the scroll box never clips it. */
html[data-theme] :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 4px var(--accent-wash); }
html[data-theme] .app-header :focus-visible { outline-color: var(--band-ink); box-shadow: none; }
html[data-theme] .main-nav .nav-btn:focus-visible { outline-offset: -3px; }
html[data-theme] .client-dropdown:focus, html[data-theme] input:focus, html[data-theme] select:focus, html[data-theme] textarea:focus { border-color: var(--accent); }

/* ---- 3. Elevation scale ------------------------------------------------------------------------------------------------------ */
html[data-theme] .card, html[data-theme] .client-card, html[data-theme] .client-selector-section, html[data-theme] .auth-card {
  background: var(--surface-panel); border: 1px solid var(--line); border-radius: var(--radius-card, 8px); box-shadow: var(--elev-1);
}
html[data-theme] .client-card { padding: 20px; margin: 0 0 16px; transition: box-shadow var(--dur-base) var(--ease-std), border-color var(--dur-base) var(--ease-std); }
html[data-theme] .client-card:hover, html[data-theme] .client-card:focus-within { box-shadow: var(--elev-2); }
html[data-theme] .client-card .client-header h3 { font-size: 1.125rem; margin-bottom: 4px; }
html[data-theme] .client-card .detail-row { font-size: .9375rem; line-height: 1.5; color: var(--ink-secondary); }
html[data-theme] .client-card .detail-value { color: var(--ink-primary); }
html[data-theme] .client-card .client-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
html[data-theme] .client-card .client-actions > button { width: auto; margin: 0; min-height: 36px; padding: 6px 16px; }
html[data-theme] .client-card .client-actions > :not(button) { flex: 1 1 100%; margin: 0; font-size: .8125rem; color: var(--ink-secondary); }
html[data-theme] .auth-screen { padding: 16px; }
html[data-theme] .auth-card { box-shadow: var(--elev-3); padding: 32px; }
html[data-theme] .theme-picker { box-shadow: var(--elev-3); border-radius: 10px; z-index: var(--z-menu); }
html[data-theme] .modal { box-shadow: var(--elev-4); border-radius: 12px; background: var(--surface-panel); color: var(--ink-primary); }
html[data-theme] .modal::backdrop { background: var(--scrim); }
/* The dialog opened pinned to the top-left corner (a reset zeroed the UA auto margin): centre it and keep it inside the viewport */
html[data-theme] dialog.modal { margin: auto; max-width: min(600px, calc(100vw - 16px)); max-height: calc(100vh - 16px); }
html[data-theme] .app-header.is-scrolled { box-shadow: var(--elev-2); }

/* ---- 2. Navy header band: brand lockup, tab strip, actions ------------------------------------------------------------------- */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

html[data-theme] .app-header {
  position: sticky; top: 0; z-index: var(--z-sticky); padding: 0;
  background: var(--band-bg); color: var(--band-ink); border-bottom: 1px solid var(--band-line);
  transition: box-shadow 200ms var(--ease-std);
}
.app-header .header-content {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "brand actions" "nav nav";
  align-items: center; gap: 4px 16px; max-width: 1400px; margin: 0 auto; padding: 12px 32px 0;
}
.app-header .brand { grid-area: brand; display: flex; align-items: center; gap: 12px; margin: 0; min-width: 0; font-size: 1rem; font-weight: 400; color: var(--band-ink); }
.app-header .brand-mark { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--band-mark); color: var(--band-ink); }
.app-header .brand-mark .icon { width: 22px; height: 22px; }
.app-header .brand-text { display: flex; flex-direction: column; min-width: 0; }
.app-header .brand-name { font-size: 1.125rem; font-weight: 600; letter-spacing: -.005em; line-height: 1.2; color: var(--band-ink); white-space: nowrap; }
.app-header .brand-desc { font-size: .75rem; font-weight: 400; line-height: 1.3; color: var(--band-ink-2); }
html:not([lang="fr"]) .brand-desc [lang="fr"], html[lang="fr"] .brand-desc [lang="en"] { display: none; }

.app-header .header-actions { grid-area: actions; display: flex; gap: 8px; align-items: center; }
html[data-theme] .app-header .btn-icon, html[data-theme] .app-header #btn-signout {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; min-width: 40px; padding: 0 10px;
  border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--band-ink); font: inherit; font-size: .875rem; font-weight: 500; white-space: nowrap; cursor: pointer;
}
html[data-theme] .app-header #btn-signout { border-color: var(--band-line); padding: 0 14px; }
html[data-theme] .app-header .btn-icon:hover, html[data-theme] .app-header #btn-signout:hover, html[data-theme] .app-header .btn-icon[aria-expanded="true"] { background: var(--band-hover); }

.app-header .main-nav {
  grid-area: nav; position: relative; display: flex; flex-wrap: nowrap; justify-content: flex-start; gap: 4px; margin: 0 -8px; padding: 0 8px;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
}
.app-header .main-nav::-webkit-scrollbar { display: none; }
html[data-theme] .main-nav .nav-btn {
  display: inline-flex; align-items: center; gap: 8px; flex: none; min-height: 44px; padding: 0 14px; border: 0; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0;
  background: transparent; color: var(--band-ink-2); font: inherit; font-size: .9375rem; font-weight: 500; white-space: nowrap; cursor: pointer;
}
html[data-theme] .main-nav .nav-btn:hover { background: var(--band-hover); color: var(--band-ink); }
html[data-theme] .main-nav .nav-btn.active { color: var(--band-ink); background: var(--band-active); font-weight: 600; border-bottom-color: var(--band-ink); }
.nav-btn[hidden] { display: none; }
/* Sliding indicator (core/polish.js). Without JS the active tab keeps its own bottom border, so the current page is always marked. */
.main-nav .nav-indicator { display: none; }
html.has-nav-indicator .main-nav .nav-indicator {
  display: block; position: absolute; left: 0; bottom: 0; height: 3px; width: var(--ind-w, 0); transform: translateX(var(--ind-x, 0)); border-radius: 3px 3px 0 0;
  background: var(--band-ink); pointer-events: none;
}
html.has-nav-indicator.nav-indicator-ready .main-nav .nav-indicator { transition: transform var(--dur-base) var(--ease-std), width var(--dur-base) var(--ease-std); }
html.has-nav-indicator[data-theme] .main-nav .nav-btn.active { border-bottom-color: transparent; }

/* Page body: the band is the 30% navy, the canvas the 60%, cards the layer between */
.main-content { padding-top: var(--s6); }

@media (max-width: 820px) {
  .app-header .header-content { padding: 10px 16px 0; }
  .app-header .main-nav { margin: 0 -8px; }
  html[data-theme] .app-header .btn-icon, html[data-theme] .app-header #btn-signout { min-height: 44px; min-width: 44px; }
  html { scroll-padding-top: 128px; }
}
@media (max-width: 480px) {
  /* Sign Out keeps its text for screen readers; only the icon shows so the brand and three actions fit at 390 */
  html[data-theme] .app-header #btn-signout { padding: 0; }
  html[data-theme] .app-header #btn-signout .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .app-header .header-actions { gap: 0; }
  .app-header .brand { gap: 10px; }
  .app-header .brand-name { font-size: 1.0625rem; }
}

/* ---- 8. Skeleton, empty and success states ---------------------------------------------------------------------------------- */
/* Loading: a skeleton of three rows replaces the bare word. The text stays in the DOM for screen readers. Shows after 200ms (animation delay, see below). */
html[data-theme] .loading { position: relative; overflow: hidden; height: 176px; padding: 0; font-size: 0; line-height: 0; color: transparent; text-align: left; }
html[data-theme] .loading::before {
  content: ""; position: absolute; left: 0; top: 0; width: 100%; max-width: 720px; height: 48px; border-radius: 8px; background: var(--surface-sunken);
  box-shadow: 0 64px 0 0 var(--surface-sunken), 0 128px 0 0 var(--surface-sunken);
}
html[data-theme] .loading::after { content: ""; position: absolute; left: 0; top: 0; width: 100%; max-width: 720px; height: 176px; border-radius: 8px; background: linear-gradient(90deg, transparent 0, var(--shimmer) 50%, transparent 100%); transform: translateX(-100%); }

/* Empty: 96px accent-wash disc with a 56px line icon, then the message. Used by every list that can be empty. */
html[data-theme] .empty-state { position: relative; text-align: center; padding: 144px 16px 32px; color: var(--ink-primary); }
html[data-theme] .empty-state::before { content: ""; position: absolute; top: 24px; left: 50%; width: 96px; height: 96px; margin-left: -48px; border-radius: 50%; background: var(--accent-wash); }
html[data-theme] .empty-state::after {
  content: ""; position: absolute; top: 44px; left: 50%; width: 56px; height: 56px; margin-left: -28px; background: var(--accent-text);
  -webkit-mask: var(--icon-empty) center / contain no-repeat; mask: var(--icon-empty) center / contain no-repeat;
  --icon-empty: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 13h5l1.5 3h5L16 13h5'/%3E%3Cpath d='M5.5 5h13L21 13v6a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-6z'/%3E%3C/svg%3E");
}
html[data-theme] .empty-state p { max-width: 44ch; margin: 0 auto; font-size: 1rem; font-weight: 500; line-height: 1.5; color: var(--ink-primary); }
html[data-theme] p.empty { padding: 24px 16px; text-align: center; color: var(--ink-secondary); border: 1px dashed var(--line); border-radius: var(--radius-card, 8px); background: var(--surface-panel); }

/* Success: a check beside the message. Colour tokens already come from theme-bridge (state-green). */
html[data-theme] .auth-message.success::before, html[data-theme] .na-success::before, html[data-theme] .awk-alert-ok::before, html[data-theme] .dict-ok::before, html[data-theme] .alert.success::before {
  content: ""; display: inline-block; width: 18px; height: 18px; margin-right: 8px; vertical-align: -3px; background: currentColor;
  -webkit-mask: var(--icon-check) center / contain no-repeat; mask: var(--icon-check) center / contain no-repeat;
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

/* ---- 9. Shared form controls (Lustre pass 2, 2026-11-18) ---------------------------------------------------------------------
   One definition for inputs, selects, textareas, checkboxes, radios, buttons, button groups and tabs on every screen (Funds, CRM, Forms, Advice,
   Trackers, CE, Social, Profile, Bookings, Awakening, modals, sign-in). Built from theme tokens only. The scope is wrapped in :where() so the
   lane's own class rules (.awk-*, .client-actions, inline layout) still win where they say something specific; nothing here uses a gradient
   behind text, so the rendered contrast test keeps measuring every control. State order: rest, hover, focus-visible, active, disabled, invalid. */
html[data-theme] :where(#router-view, .modal, .auth-card) :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="hidden"]), select, textarea) {
  min-height: 40px; padding: 8px 12px; font: inherit; font-size: .9375rem; font-weight: 400; line-height: 1.4; border-radius: 8px; border-style: solid; border-width: 1px;
  background-color: var(--surface-panel); color: var(--ink-primary); box-shadow: var(--elev-0);
  transition: border-color var(--dur-fast) var(--ease-std), box-shadow var(--dur-fast) var(--ease-std), background-color var(--dur-fast) var(--ease-std);
}
html[data-theme] :where(#router-view, .modal, .auth-card) :where(select) { padding-right: 8px; cursor: pointer; }
html[data-theme] :where(#router-view, .modal) :where(textarea) { min-height: 88px; resize: vertical; width: 100%; max-width: 100%; box-sizing: border-box; }
html[data-theme] :where(#router-view, .modal) :where(input[type="search"]) { -webkit-appearance: none; appearance: none; }
html[data-theme] :where(input, select, textarea):focus-visible { box-shadow: 0 0 0 4px var(--accent-wash); border-color: var(--accent); }
html[data-theme] :where(input, select, textarea):disabled { background-color: var(--surface-sunken); cursor: not-allowed; }
html[data-theme] :where(input, select, textarea)[aria-invalid="true"] { border-color: var(--state-red-line); box-shadow: 0 0 0 1px var(--state-red-line); }
html[data-theme] :where(input, select, textarea)[aria-invalid="true"]:focus-visible { box-shadow: 0 0 0 1px var(--state-red-line), 0 0 0 4px var(--accent-wash); }

/* Checkbox and radio: themed with the accent, 18px, and the label row is the click target */
html[data-theme] :where(input[type="checkbox"], input[type="radio"]) { accent-color: var(--accent-fill); cursor: pointer; }
html[data-theme] :where(#router-view, .modal) :where(input[type="checkbox"], input[type="radio"]):not(.awk-root *) { width: 18px; height: 18px; margin: 0; flex: none; }
html[data-theme] :where(#router-view, .modal) label:has(> input[type="checkbox"], > input[type="radio"]):not(.awk-root *) {
  display: inline-flex !important; align-items: center; gap: 10px; min-height: 32px; cursor: pointer; margin: 4px 16px 4px 0;
}

html[data-theme] :where(#router-view, .modal) fieldset:not(.awk-fieldset) { border: 1px solid var(--line); border-radius: var(--radius-card, 8px); padding: 12px 14px; margin: 12px 0; min-width: 0; }
html[data-theme] :where(#router-view, .modal) fieldset:not(.awk-fieldset) > legend { padding: 0 6px; font-weight: 600; color: var(--ink-primary); }
/* Fields: a label that wraps a text control stacks the caption over the control, like every other labelled field. */
html[data-theme] :where(#router-view, .modal) label:has(> :is(select, textarea, input:not([type="checkbox"], [type="radio"], [type="hidden"]))):not(.awk-root *) {
  display: inline-flex !important; flex-direction: column; align-items: stretch; gap: 4px; vertical-align: top; margin: 6px 16px 10px 0 !important; max-width: 100%;
  font-size: .875rem; font-weight: 500; color: var(--ink-secondary);
}
html[data-theme] :where(#router-view, .modal) label:has(> textarea):not(.awk-root *) { display: flex !important; margin-right: 0 !important; width: 100%; }
html[data-theme] :where(#router-view, .modal) label > :is(select, input:not([type="checkbox"], [type="radio"])):not(.awk-root *) { min-width: min(100%, 220px); max-width: 100%; }

/* Buttons: one family. Primary = accent fill; secondary / edit / cancel / unclassed = panel with a line; delete keeps its status colours (theme-bridge). */
html[data-theme] :where(#router-view, .modal, .auth-card) :where(.btn-primary, .btn-secondary, .btn-edit, .btn-delete, .btn-cancel, button:not([class]), .awk-btn) {
  min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 18px; border-radius: 8px; font: inherit; font-size: .9375rem; font-weight: 500; line-height: 1.3; cursor: pointer;
}
html[data-theme] :where(#router-view) :where(.btn-primary, .btn-secondary, .btn-edit, .btn-delete, button:not([class])) { margin-right: 8px; }
html[data-theme] #router-view button:not([class]), html[data-theme] .modal button:not([class]) {
  background: var(--surface-panel); color: var(--ink-primary); border: 1px solid var(--line); box-shadow: var(--elev-1);
}
html[data-theme] #router-view button:not([class]):hover:not(:disabled), html[data-theme] .modal button:not([class]):hover:not(:disabled) { background: var(--surface-sunken); border-color: var(--ink-tertiary); box-shadow: var(--elev-0); }
html[data-theme] #router-view .btn-primary { width: auto; font-weight: 600; box-shadow: var(--elev-1); }
html[data-theme] #router-view .interactive-form-card .btn-primary { width: 100%; }
html[data-theme] .btn-secondary, html[data-theme] .btn-cancel { box-shadow: var(--elev-1); }
html[data-theme] .btn-secondary:hover:not(:disabled), html[data-theme] .btn-cancel:hover:not(:disabled), html[data-theme] .btn-edit:hover:not(:disabled) { box-shadow: var(--elev-0); }
/* Disabled primary: a clear flat state (sunken fill, secondary ink: both token pairs are contrast-proven) instead of a washed-out blue */
html[data-theme] .btn-primary:disabled, html[data-theme] .awk-btn-primary:disabled { background: var(--surface-sunken); border: 1px solid var(--line); color: var(--ink-secondary); opacity: 1; box-shadow: var(--elev-0); transform: none; }
/* Long values wrap at a word, not mid-word: replaces the 390px break-all guard (the overflow protection stays via overflow-wrap) */
html[data-theme] .detail-value { word-break: normal; overflow-wrap: anywhere; }
html[data-theme] .awk-root .awk-btn-primary, html[data-theme] .awk-tour .awk-btn-primary { box-shadow: var(--elev-1); }
html[data-theme] .awk-root .awk-btn-primary:hover:not(:disabled) { box-shadow: var(--elev-2); }
/* Accent coherence: the Awakening buttons, chips and progress use the same fill and on-accent tokens as every other primary action, in all 15 themes
   (they used --accent-text, which differs from --accent-fill in 10 themes). Pairs are the contrast-proven accent-fill / on-accent ones. */
html:root[data-theme] .awk-root, html:root[data-theme] .awk-tour { --awk-btn-bg: var(--accent-fill); --awk-on-btn: var(--on-accent); }
html[data-theme] .awk-btn-primary:hover:not(:disabled) { background: var(--accent-fill-hover); filter: none; }
/* In-flight: the button keeps its width and shows a spinner beside the label (the app already sets disabled + aria-busy while it saves) */
html[data-theme] button[aria-busy="true"]::after {
  content: ""; width: 14px; height: 14px; flex: none; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
}

/* Button group / tabs: a segmented track; the selected tab takes the accent fill (same pair as a primary button), the rest are quiet */
html[data-theme] #router-view [role="tablist"] {
  display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; padding: 4px; margin: 12px 0 16px; background: var(--surface-sunken); border-radius: 12px;
}
html[data-theme] #router-view [role="tablist"] > [role="tab"] {
  min-height: 40px; padding: 8px 16px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--ink-primary);
  font-size: .9375rem; font-weight: 500; box-shadow: none; text-decoration: none !important; white-space: normal; text-align: center;
}
html[data-theme] #router-view [role="tablist"] > [role="tab"]:hover:not([aria-selected="true"]) { background: var(--accent-wash); border-color: var(--line); }
html[data-theme] #router-view [role="tablist"] > [role="tab"][aria-selected="true"] { background: var(--accent-fill); color: var(--on-accent); font-weight: 600; box-shadow: var(--elev-1); }
html[data-theme] #router-view [role="tablist"] > [role="tab"]:focus-visible { outline-offset: 0; }

/* ---- 10. Screen anatomy: page title, lead line, section card, list rows, summary ------------------------------------------------ */
html[data-theme] #router-view :where(h2) { font-family: var(--font-display, inherit); font-size: 1.875rem; font-weight: 600; line-height: 1.15; letter-spacing: -.005em; margin: 0 0 8px; color: var(--ink-primary); }
html[data-theme] #router-view :where(h3) { font-size: 1.125rem; font-weight: 600; line-height: 1.3; margin: 0 0 8px; color: var(--ink-primary); }
html[data-theme] #router-view .awk-root :where(h2) { font-size: 1.5rem; }
html[data-theme] #router-view > h3:not(:first-child), html[data-theme] #funds-body > h3:not(:first-child) { margin-top: 24px; }
html[data-theme] #router-view :where(.view-header p, h2 + p) { margin: 0 0 20px; max-width: 72ch; color: var(--ink-secondary); font-size: 1rem; line-height: 1.5; }
html[data-theme] #router-view .view-header { margin-bottom: 20px; }
html[data-theme] #funds-body, html[data-theme] #router-view > form, html[data-theme] #router-view details, html[data-theme] #router-view .fl-list > li {
  background: var(--surface-panel); border: 1px solid var(--line); border-radius: var(--radius-card, 8px); box-shadow: var(--elev-1); box-sizing: border-box;
}
html[data-theme] #funds-body, html[data-theme] #router-view > form { padding: 20px; margin-top: 4px; }
html[data-theme] #router-view details { margin: 0 0 12px; padding: 0; overflow: clip; }
html[data-theme] #router-view details > summary {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 16px; list-style: none; cursor: pointer; font-weight: 600; color: var(--ink-primary);
}
html[data-theme] #router-view details > summary::-webkit-details-marker { display: none; }
html[data-theme] #router-view details > summary::before {
  content: ""; width: 7px; height: 7px; flex: none; border-right: 2px solid var(--ink-secondary); border-bottom: 2px solid var(--ink-secondary); transform: rotate(-45deg);
  transition: transform var(--dur-base) var(--ease-std);
}
html[data-theme] #router-view details[open] > summary::before { transform: rotate(45deg); }
html[data-theme] #router-view details > summary:hover { background: var(--accent-wash); }
html[data-theme] #router-view details[open] > summary { border-bottom: 1px solid var(--line); }
html[data-theme] #router-view details > :not(summary) { margin-left: 16px; margin-right: 16px; }
html[data-theme] #router-view details > :not(summary):last-child { margin-bottom: 16px; }
html[data-theme] #router-view .fl-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 12px; }
html[data-theme] #router-view .fl-list > li { padding: 14px 16px; line-height: 1.5; transition: box-shadow var(--dur-base) var(--ease-std), border-color var(--dur-base) var(--ease-std); }
html[data-theme] #router-view .fl-list > li:hover { box-shadow: var(--elev-2); border-color: var(--ink-tertiary); }
html[data-theme] #router-view .fl-list > li > * { margin-top: 2px; margin-bottom: 2px; }
html[data-theme] #router-view .fl-list > li button { margin-top: 8px; min-height: 36px; }
/* Interactive form cards: the emoji becomes a line icon in the accent disc (the emoji text stays in the DOM, set to zero size) */
html[data-theme] .interactive-form-card { border: 1px solid var(--line); border-radius: var(--radius-card, 8px); box-shadow: var(--elev-1); transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-std); }
html[data-theme] .interactive-form-card:hover { box-shadow: var(--elev-3); }
html[data-theme] .interactive-form-card .form-icon {
  position: relative; width: 56px; height: 56px; margin: 0 0 12px; border-radius: 50%; background: var(--accent-wash); font-size: 0; line-height: 0; color: transparent; overflow: hidden;
}
html[data-theme] .interactive-form-card .form-icon::before {
  content: ""; position: absolute; inset: 14px; background: var(--accent-text);
  -webkit-mask: var(--icon-doc) center / contain no-repeat; mask: var(--icon-doc) center / contain no-repeat;
  --icon-doc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5M9 13h6M9 17h6'/%3E%3C/svg%3E");
}
html[data-theme] .interactive-forms-section { background: var(--surface-sunken); border: 1px solid var(--line); }
html[data-theme] .client-selector-section label { font-weight: 500; color: var(--ink-secondary); font-size: .875rem; }
html[data-theme] .client-selector-section select { width: 100%; }
html[data-theme] .card, html[data-theme] .client-card { transition: box-shadow var(--dur-base) var(--ease-std), border-color var(--dur-base) var(--ease-std); }

@media (max-width: 820px) {
  html[data-theme] :where(#router-view, .modal, .auth-card) :where(input:not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"], [type="hidden"]), select) { min-height: 44px; }
  html[data-theme] :where(#router-view, .modal, .auth-card) :where(.btn-primary, .btn-secondary, .btn-edit, .btn-delete, .btn-cancel, button:not([class])) { min-height: 44px; }
  html[data-theme] #router-view [role="tablist"] > [role="tab"] { min-height: 44px; }
  html[data-theme] :where(#router-view, .modal) label:has(> input[type="checkbox"], > input[type="radio"]):not(.awk-root *) { min-height: 44px; }
  html[data-theme] #router-view .fl-list > li button { min-height: 44px; }
  html[data-theme] #router-view :where(h2) { font-size: 1.625rem; }
  html[data-theme] #funds-body, html[data-theme] #router-view > form { padding: 16px; }
}
@media (max-width: 600px) {
  html[data-theme] #router-view .btn-primary { width: 100%; }
  html[data-theme] #router-view [role="tablist"] { width: 100%; }
  html[data-theme] #router-view [role="tablist"] > [role="tab"] { flex: 1 1 calc(50% - 4px); }
  html[data-theme] :where(#router-view, .modal) label:has(> select, > input:not([type="checkbox"], [type="radio"], [type="hidden"])):not(.awk-root *) { display: flex !important; margin-right: 0 !important; width: 100%; }
}

/* ---- Animations: ONLY here, ONLY from a visible resting state (backwards fill), ONLY when motion is allowed ------------------ */
@media (prefers-reduced-motion: no-preference) {
  /* 5. Route/panel change: the incoming view fades in and rises 8px over 220ms. No stagger, no outgoing fade (the view is replaced in one step). */
  @keyframes route-in { from { opacity: 0; transform: translateY(8px); } }
  #router-view > * { animation: route-in var(--dur-base) var(--ease-out) backwards; }
  #router-view > .loading { animation: none; }
  /* Skeleton appears only if the wait passes 200ms, then shimmers (1400ms) */
  @keyframes skel-in { from { opacity: 0; } }
  @keyframes skel-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
  html[data-theme] .loading::before { animation: skel-in 140ms linear 200ms backwards; }
  html[data-theme] .loading::after { animation: skel-sweep 1400ms linear 200ms infinite; }
  @keyframes state-in { from { opacity: 0; transform: translateY(4px); } }
  html[data-theme] .empty-state, html[data-theme] p.empty { animation: state-in var(--dur-base) var(--ease-out) backwards; }
  @keyframes pop-in { from { opacity: 0; transform: scale(.96); } }
  html[data-theme] .auth-message.success, html[data-theme] .na-success, html[data-theme] .awk-alert-ok, html[data-theme] .dict-ok, html[data-theme] .alert.success { animation: pop-in var(--dur-base) var(--ease-pop) backwards; }
  @keyframes modal-in { from { opacity: 0; transform: scale(.98); } }
  html[data-theme] .modal[open] { animation: modal-in var(--dur-base) var(--ease-out) backwards; }
  @keyframes menu-in { from { opacity: 0; transform: translateY(6px); } }
  html[data-theme] .theme-picker:not([hidden]) { animation: menu-in var(--dur-fast) var(--ease-out) backwards; }
  /* Pass 2: a tab or panel switch eases in from a visible state (never below 35% opacity, so a redraw can never flash empty); sections open with a rise;
     buttons in flight spin; the card icon and tab track settle. Collapse is instant where the browser cannot animate it. */
  @keyframes panel-in { from { opacity: .35; transform: translateY(4px); } }
  html[data-theme] #funds-body > *, html[data-theme] #router-view [role="tabpanel"]:not([hidden]) { animation: panel-in var(--dur-base) var(--ease-out) backwards; }
  html[data-theme] #router-view details[open] > :not(summary) { animation: panel-in var(--dur-base) var(--ease-out) backwards; }
  @keyframes spin { to { transform: rotate(360deg); } }
  html[data-theme] button[aria-busy="true"]::after { animation: spin 700ms linear infinite; }
  @supports (interpolate-size: allow-keywords) {
    :root { interpolate-size: allow-keywords; }
    html[data-theme] #router-view details::details-content { block-size: 0; overflow: clip; transition: block-size var(--dur-base) var(--ease-std), content-visibility var(--dur-base) allow-discrete; }
    html[data-theme] #router-view details[open]::details-content { block-size: auto; }
  }
  html[data-theme] .interactive-form-card:hover { transform: translateY(-2px); }
}
/* Reduced motion: final frames, no shimmer, no transitions. The skeleton is a static fill. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  html[data-theme] .loading::after { display: none; }
}
