/* ==========================================================================
   FitFlex — design system "Studio Light" (2026-10-18)
   Owner brief: humanized, light, attractive, professional; sharper corners.
   Research: dashboard references (Linear / Stripe / Vercel style) favour a cool
   light neutral base with brand colour used sparingly; Source Sans 3 (humanist,
   optical sizing, tabular figures) for dense retail data. Colour is kept where it
   carries meaning: status, payment type, category tiles, charts.
   Tokens only — never raw hex in pages.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;

  /* Neutrals (cool, light) */
  --ff-bg: #f5f6f8;
  --ff-surface: #ffffff;
  --ff-surface-2: #f9fafb;
  --ff-sunken: #eef0f3;
  --ff-line: #e4e7ec;
  --ff-line-strong: #cfd4dc;
  --ff-ink: #111827;            /* 17:1 on white */
  --ff-ink-2: #344054;
  --ff-muted: #5b6475;          /* 6.0:1 on white */
  --ff-subtle: #98a2b3;         /* decorative / disabled only */

  /* Brand: one confident indigo, used for structure and primary actions */
  --ff-brand: #4338ca;          /* 8:1 with white */
  --ff-brand-2: #3730a3;
  --ff-on-brand: #ffffff;
  --ff-brand-soft: #eef2ff;
  --ff-brand-grad: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);   /* near-solid, no rainbow */
  --ff-accent: #4338ca;         /* the one main action per screen = brand */
  --ff-on-accent: #ffffff;
  --ff-accent-grad: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  --ff-accent-ink: #3730a3;
  --ff-accent-soft: #eef2ff;

  /* Status (always paired with icon/text) */
  --ff-success: #067647;  --ff-success-soft: #ecfdf3;
  --ff-warning: #b54708;  --ff-warning-soft: #fffaeb;
  --ff-danger:  #c01048;  --ff-danger-soft:  #fff1f3;
  --ff-info:    #175cd3;  --ff-info-soft:    #eff8ff;

  /* Payment accounts */
  --ff-cash: #067647;     --ff-cash-soft: #ecfdf3;
  --ff-wish: #0e7490;     --ff-wish-soft: #ecfeff;

  /* Charts (ordered, colour-blind aware) */
  --ff-chart-1: #4338ca;
  --ff-chart-2: #0e9384;
  --ff-chart-3: #e04f16;
  --ff-chart-4: #dc6803;
  --ff-chart-5: #7a5af8;
  --ff-chart-grid: #eaecf0;

  /* Shell (sidebar retired; kept for any legacy reference) */
  --ff-rail-bg: #ffffff;
  --ff-rail-ink: #111827;
  --ff-rail-muted: #5b6475;
  --ff-rail-hover: #f2f4f7;
  --ff-rail-line: #e4e7ec;
  --ff-rail-active-ink: #4338ca;

  /* Type: humanist sans for everything; weight carries the hierarchy */
  --ff-font-display: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ff-font-ui: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ff-text-xs: 12px;
  --ff-text-sm: 13px;
  --ff-text-md: 14px;
  --ff-text-base: 15px;
  --ff-text-lg: 18px;
  --ff-text-xl: 21px;
  --ff-text-2xl: 26px;
  --ff-text-3xl: 34px;

  /* Space (4pt) */
  --ff-1: 4px; --ff-2: 8px; --ff-3: 12px; --ff-4: 16px;
  --ff-5: 20px; --ff-6: 24px; --ff-8: 32px; --ff-10: 40px;

  /* Shape & depth: sharper corners, soft neutral shadows */
  --ff-r-sm: 4px;
  --ff-r-md: 6px;
  --ff-r-lg: 8px;
  --ff-r-xl: 10px;
  --ff-r-pill: 6px;             /* "pill" elements are squared off on purpose */
  --ff-shadow-1: 0 1px 2px rgba(16, 24, 40, .05);
  --ff-shadow-2: 0 4px 8px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --ff-shadow-3: 0 16px 32px -8px rgba(16, 24, 40, .16), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --ff-ring: 0 0 0 3px rgba(67, 56, 202, .22), 0 0 0 1px var(--ff-brand);

  /* Motion */
  --ff-ease-out: cubic-bezier(.22, 1, .36, 1);
  --ff-ease-in: cubic-bezier(.55, 0, 1, .45);
  --ff-fast: 120ms;
  --ff-med: 180ms;

  /* Layers */
  --ff-z-sticky: 20; --ff-z-rail: 40; --ff-z-scrim: 60; --ff-z-modal: 80; --ff-z-toast: 100; --ff-z-loader: 120;

  /* Layout */
  --ff-rail-w: 232px;
  --ff-rail-w-collapsed: 76px;
  --ff-topbar-h: 60px;
  --ff-content-max: 1440px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--ff-bg);
  color: var(--ff-ink);
  font-family: var(--ff-font-ui);
  font-size: var(--ff-text-base);
  line-height: 1.5;
  font-feature-settings: "tnum" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 {
  font-family: var(--ff-font-display);
  font-stretch: 110%;
  letter-spacing: -.01em;
  line-height: 1.15;
  color: var(--ff-ink);
  margin: 0 0 var(--ff-3);
}
h1 { font-size: var(--ff-text-2xl); font-weight: 800; }
h2 { font-size: var(--ff-text-xl); font-weight: 750; }
h3 { font-size: var(--ff-text-lg); font-weight: 700; }
h4 { font-size: var(--ff-text-base); font-weight: 700; }
a { color: inherit; }
img, svg, video, canvas { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; }
input, select, textarea, button { touch-action: manipulation; }
::selection { background: var(--ff-accent); color: var(--ff-on-accent); }
:focus-visible { outline: none; box-shadow: var(--ff-ring); border-radius: var(--ff-r-sm); }
hr { border: 0; border-top: 1px solid var(--ff-line); margin: var(--ff-4) 0; }
.ff-num, .num { font-variant-numeric: tabular-nums; }
.ff-display { font-family: var(--ff-font-display); font-stretch: 112%; font-weight: 800; letter-spacing: -.015em; }
.ff-eyebrow {
  font-family: var(--ff-font-display); font-stretch: 118%; font-weight: 700;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ff-muted);
}
.ff-muted { color: var(--ff-muted); }
.ff-sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- App shell ---------- */
.ff-skip {
  position: fixed; left: var(--ff-3); top: -60px; z-index: var(--ff-z-toast);
  background: var(--ff-accent); color: var(--ff-on-accent); font-weight: 800;
  padding: 10px 14px; border-radius: var(--ff-r-md); text-decoration: none;
  transition: top var(--ff-fast) var(--ff-ease-out);
}
.ff-skip:focus { top: var(--ff-3); }

.ff-app { display: flex; min-height: 100dvh; }

.ff-rail {
  position: sticky; top: 0; height: 100dvh; flex: 0 0 var(--ff-rail-w); width: var(--ff-rail-w);
  background: var(--ff-rail-bg); color: var(--ff-rail-ink);
  display: flex; flex-direction: column; z-index: var(--ff-z-rail);
  border-right: 1px solid var(--ff-rail-line);
  transition: width var(--ff-med) var(--ff-ease-out), flex-basis var(--ff-med) var(--ff-ease-out);
}
.ff-rail__brand {
  display: flex; align-items: center; gap: 10px; min-height: var(--ff-topbar-h);
  padding: 0 16px; text-decoration: none; color: var(--ff-rail-ink);
  border-bottom: 1px solid var(--ff-rail-line);
}
.ff-rail__mark {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; overflow: hidden;
  background: #ffffff; color: var(--ff-brand); box-shadow: 0 6px 16px -6px rgba(30, 27, 75, .5);
  font-family: var(--ff-font-display); font-stretch: 125%; font-weight: 900; font-size: 15px; letter-spacing: -.04em;
}
.ff-rail__mark img { width: 100%; height: 100%; object-fit: cover; background: #fff; }
.ff-rail__name {
  font-family: var(--ff-font-display); font-stretch: 115%; font-weight: 800; font-size: 16px;
  letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ff-rail__nav { flex: 1 1 auto; overflow-y: auto; padding: 10px 10px 16px; scrollbar-width: none; }
.ff-rail__group { margin-top: 14px; }
.ff-rail__group:first-child { margin-top: 4px; }
.ff-rail__label {
  padding: 0 10px 6px; color: var(--ff-rail-muted);
  font-family: var(--ff-font-display); font-stretch: 118%; font-weight: 700;
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
}
.ff-nav-link {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px;
  padding: 0 12px; border-radius: var(--ff-r-md); text-decoration: none;
  color: var(--ff-rail-ink); font-weight: 600; font-size: var(--ff-text-md); white-space: nowrap;
  transition: background var(--ff-fast) ease, color var(--ff-fast) ease;
}
.ff-nav-link i { width: 20px; text-align: center; font-size: 16px; color: var(--ff-rail-muted); transition: color var(--ff-fast) ease; }
.ff-nav-link:hover { background: var(--ff-rail-hover); }
.ff-nav-link:hover i { color: var(--ff-rail-ink); }
.ff-nav-link[aria-current="page"] { background: #ffffff; color: var(--ff-rail-active-ink); font-weight: 800; box-shadow: 0 8px 18px -8px rgba(30, 27, 75, .55); }
.ff-nav-link[aria-current="page"] i { color: #db2777; }
.ff-nav-link__text { overflow: hidden; text-overflow: ellipsis; }

.ff-rail__foot { border-top: 1px solid var(--ff-rail-line); padding: 10px; display: grid; gap: 6px; }
.ff-user {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--ff-r-md); min-width: 0;
}
.ff-user__avatar {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ff-rail-hover); color: var(--ff-rail-ink);
  font-weight: 800; font-size: 13px; border: 1px solid var(--ff-rail-line);
}
.ff-user__meta { min-width: 0; line-height: 1.25; }
.ff-user__name { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ff-user__role { font-size: 11.5px; color: var(--ff-rail-muted); text-transform: capitalize; }
.ff-rail__actions { display: flex; gap: 6px; }
.ff-rail-btn {
  flex: 1 1 0; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: transparent; border: 1px solid var(--ff-rail-line); border-radius: var(--ff-r-md);
  color: var(--ff-rail-ink); font-size: 13px; font-weight: 700; text-decoration: none;
  transition: background var(--ff-fast) ease, border-color var(--ff-fast) ease;
}
.ff-rail-btn:hover { background: var(--ff-rail-hover); border-color: var(--ff-rail-muted); }
.ff-rail-btn i { font-size: 14px; }

/* collapsed rail (desktop toggle, and default on tablets) */
.ff-app[data-rail="collapsed"] .ff-rail { width: var(--ff-rail-w-collapsed); flex-basis: var(--ff-rail-w-collapsed); }
.ff-app[data-rail="collapsed"] .ff-rail__name,
.ff-app[data-rail="collapsed"] .ff-rail__label,
.ff-app[data-rail="collapsed"] .ff-nav-link__text,
.ff-app[data-rail="collapsed"] .ff-user__meta,
.ff-app[data-rail="collapsed"] .ff-rail-btn span { display: none; }
.ff-app[data-rail="collapsed"] .ff-rail__brand { justify-content: center; padding: 0; }
.ff-app[data-rail="collapsed"] .ff-nav-link { justify-content: center; padding: 0; }
.ff-app[data-rail="collapsed"] .ff-rail__label { height: 1px; padding: 0; margin: 6px 12px; background: var(--ff-rail-line); }
.ff-app[data-rail="collapsed"] .ff-rail__label { display: block; font-size: 0; }
.ff-app[data-rail="collapsed"] .ff-user { justify-content: center; padding: 6px 0; }
.ff-app[data-rail="collapsed"] .ff-rail__actions { flex-direction: column; }

.ff-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.ff-topbar {
  position: sticky; top: 0; z-index: var(--ff-z-sticky);
  height: var(--ff-topbar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 var(--ff-6); background: color-mix(in srgb, var(--ff-bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--ff-line);
}
.ff-topbar__title {
  font-family: var(--ff-font-display); font-stretch: 112%; font-weight: 800; font-size: 18px;
  letter-spacing: -.01em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ff-topbar__spacer { flex: 1 1 auto; }
.ff-topbar__meta { display: flex; align-items: center; gap: 10px; color: var(--ff-muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.ff-icon-btn {
  width: 44px; height: 44px; flex: 0 0 auto; display: inline-grid; place-items: center;
  border-radius: var(--ff-r-md); border: 1px solid var(--ff-line); background: var(--ff-surface);
  color: var(--ff-ink); font-size: 16px; text-decoration: none;
  transition: background var(--ff-fast) ease, border-color var(--ff-fast) ease, transform var(--ff-fast) ease;
}
.ff-icon-btn:hover { border-color: var(--ff-line-strong); background: var(--ff-surface-2); }
.ff-icon-btn:active { transform: scale(.96); }
.ff-menu-btn { display: none; }
.ff-collapse-btn { display: inline-grid; }

.ff-content { flex: 1 1 auto; min-width: 0; }
.content-inner { width: 100%; max-width: var(--ff-content-max); margin: 0 auto; padding: var(--ff-6); }
.ff-content--bleed .content-inner { max-width: none; padding: 0; }

.ff-scrim {
  position: fixed; inset: 0; z-index: var(--ff-z-scrim); background: rgba(30, 27, 75, .45);
  opacity: 0; pointer-events: none; transition: opacity var(--ff-med) var(--ff-ease-out);
}

@media (max-width: 1199px) {
  .ff-app:not([data-rail="expanded"]) .ff-rail { width: var(--ff-rail-w-collapsed); flex-basis: var(--ff-rail-w-collapsed); }
  .ff-app:not([data-rail="expanded"]) .ff-rail__name,
  .ff-app:not([data-rail="expanded"]) .ff-nav-link__text,
  .ff-app:not([data-rail="expanded"]) .ff-user__meta,
  .ff-app:not([data-rail="expanded"]) .ff-rail-btn span { display: none; }
  .ff-app:not([data-rail="expanded"]) .ff-rail__label { display: block; height: 1px; padding: 0; margin: 6px 12px; background: var(--ff-rail-line); font-size: 0; }
  .ff-app:not([data-rail="expanded"]) .ff-rail__brand { justify-content: center; padding: 0; }
  .ff-app:not([data-rail="expanded"]) .ff-nav-link { justify-content: center; padding: 0; }
  .ff-app:not([data-rail="expanded"]) .ff-user { justify-content: center; padding: 6px 0; }
  .ff-app:not([data-rail="expanded"]) .ff-rail__actions { flex-direction: column; }
}

@media (max-width: 767px) {
  .ff-rail {
    position: fixed; left: 0; top: 0; bottom: 0; height: 100dvh;
    width: min(84vw, 300px) !important; flex-basis: auto !important;
    transform: translateX(-102%); transition: transform var(--ff-med) var(--ff-ease-out);
    z-index: var(--ff-z-modal);
  }
  .ff-app .ff-rail .ff-rail__name, .ff-app .ff-rail .ff-nav-link__text,
  .ff-app .ff-rail .ff-user__meta, .ff-app .ff-rail .ff-rail-btn span { display: initial !important; }
  .ff-app .ff-rail .ff-rail__label { display: block !important; height: auto !important; margin: 0 !important; background: none !important; font-size: 10.5px !important; padding: 0 10px 6px !important; }
  .ff-app .ff-rail .ff-rail__brand { justify-content: flex-start !important; padding: 0 16px !important; }
  .ff-app .ff-rail .ff-nav-link { justify-content: flex-start !important; padding: 0 12px !important; }
  .ff-app .ff-rail .ff-user { justify-content: flex-start !important; padding: 8px 10px !important; }
  .ff-app .ff-rail .ff-rail__actions { flex-direction: row !important; }
  .ff-app[data-drawer="open"] .ff-rail { transform: translateX(0); box-shadow: var(--ff-shadow-3); }
  .ff-app[data-drawer="open"] .ff-scrim { opacity: 1; pointer-events: auto; }
  .ff-menu-btn { display: inline-grid; }
  .ff-collapse-btn { display: none; }
  .ff-topbar { padding: 0 var(--ff-4); }
  .ff-topbar__meta .ff-hide-sm { display: none; }
  .content-inner { padding: var(--ff-4); }
}

/* ---------- Loader (thin top bar + overlay only for long operations) ---------- */
.ff-progress {
  position: fixed; left: 0; top: 0; height: 3px; width: 100%; z-index: var(--ff-z-loader);
  transform-origin: left; transform: scaleX(0); background: var(--ff-accent-grad);
  box-shadow: 0 0 10px rgba(219, 39, 119, .6); opacity: 0;
  transition: transform 1.6s var(--ff-ease-out), opacity var(--ff-med) ease;
  pointer-events: none;
}
.ff-progress.is-active { opacity: 1; transform: scaleX(.85); }
.ff-progress.is-done { opacity: 0; transform: scaleX(1); transition: transform var(--ff-med) ease, opacity 400ms ease 150ms; }
.global-loader {
  position: fixed; inset: 0; z-index: var(--ff-z-loader); display: none; place-items: center;
  background: rgba(30, 27, 75, .18); backdrop-filter: blur(1.5px);
}
.global-loader.show { display: grid; }
.global-loader .box {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: var(--ff-surface); color: var(--ff-ink); border: 1px solid var(--ff-line);
  border-radius: var(--ff-r-lg); box-shadow: var(--ff-shadow-3); font-weight: 800;
}
.global-loader .spinner, .ff-spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--ff-line); border-top-color: var(--ff-ink);
  animation: ff-spin .7s linear infinite;
}
@keyframes ff-spin { to { transform: rotate(360deg); } }

/* ---------- Components ---------- */
/* Page heading */
.ff-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--ff-4); flex-wrap: wrap; margin-bottom: var(--ff-5); }
.ff-page-head h1 { margin: 2px 0 0; }
.ff-page-head p { margin: 4px 0 0; color: var(--ff-muted); }
.ff-actions { display: flex; align-items: center; gap: var(--ff-2); flex-wrap: wrap; }

/* Card */
.ff-card {
  background: var(--ff-surface); border: 1px solid var(--ff-line); border-radius: var(--ff-r-lg);
  box-shadow: var(--ff-shadow-1);
}
.ff-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--ff-3); padding: var(--ff-4) var(--ff-5); border-bottom: 1px solid var(--ff-line); }
.ff-card__head h2, .ff-card__head h3 { margin: 0; font-size: var(--ff-text-base); font-stretch: 108%; }
.ff-card__body { padding: var(--ff-5); }

/* Buttons */
.ff-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: var(--ff-r-md);
  border: 1px solid var(--ff-line-strong); background: var(--ff-surface); color: var(--ff-ink);
  font-weight: 700; font-size: var(--ff-text-md); line-height: 1; text-decoration: none; white-space: nowrap;
  transition: background var(--ff-fast) ease, border-color var(--ff-fast) ease, transform var(--ff-fast) ease, box-shadow var(--ff-fast) ease;
}
.ff-btn:hover { background: var(--ff-surface-2); border-color: var(--ff-ink-2); }
.ff-btn:active { transform: translateY(1px); }
.ff-btn:disabled { opacity: .45; transform: none; }
.ff-btn--primary { background: var(--ff-brand); color: var(--ff-on-brand); border-color: var(--ff-brand); }
.ff-btn--primary:hover { background: #5b21b6; border-color: #5b21b6; }
.ff-btn--accent { background: var(--ff-accent-grad); color: var(--ff-on-accent); border-color: transparent; box-shadow: 0 8px 18px -8px rgba(225, 29, 72, .55), inset 0 -2px 0 rgba(0,0,0,.12); }
.ff-btn--accent:hover { background: var(--ff-accent-grad); filter: brightness(1.07) saturate(1.05); border-color: transparent; }
.ff-btn--danger { background: var(--ff-danger); color: #fff; border-color: var(--ff-danger); }
.ff-btn--danger:hover { filter: brightness(.92); background: var(--ff-danger); }
.ff-btn--ghost { background: transparent; border-color: transparent; }
.ff-btn--ghost:hover { background: var(--ff-sunken); border-color: transparent; }
.ff-btn--sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: var(--ff-r-sm); }
.ff-btn--lg { min-height: 56px; padding: 0 22px; font-size: 16px; border-radius: var(--ff-r-lg); }
.ff-btn--block { width: 100%; }

/* Form fields */
.ff-field { display: grid; gap: 6px; }
.ff-label { font-size: 12.5px; font-weight: 700; color: var(--ff-ink-2); }
.ff-help { font-size: 12px; color: var(--ff-muted); }
.ff-input, .ff-select, .ff-textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--ff-surface); color: var(--ff-ink);
  border: 1px solid var(--ff-line-strong); border-radius: var(--ff-r-md);
  font-size: var(--ff-text-base); outline: none;
  transition: border-color var(--ff-fast) ease, box-shadow var(--ff-fast) ease;
}
.ff-input::placeholder, .ff-textarea::placeholder { color: var(--ff-subtle); }
.ff-input:hover, .ff-select:hover, .ff-textarea:hover { border-color: var(--ff-muted); }
.ff-input:focus, .ff-select:focus, .ff-textarea:focus { border-color: var(--ff-ink); box-shadow: 0 0 0 3px rgba(124, 58, 237, .22); }
.ff-input[aria-invalid="true"] { border-color: var(--ff-danger); }
.ff-textarea { min-height: 90px; resize: vertical; }
.ff-input-group { position: relative; display: flex; align-items: center; }
.ff-input-group > i { position: absolute; left: 13px; color: var(--ff-muted); pointer-events: none; }
.ff-input-group > .ff-input { padding-left: 38px; }

/* Segmented control / chips (category filters, presets) */
.ff-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ff-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px;
  border-radius: var(--ff-r-pill); border: 1px solid var(--ff-line-strong); background: var(--ff-surface);
  color: var(--ff-ink-2); font-weight: 700; font-size: 13px; white-space: nowrap; text-decoration: none;
  transition: background var(--ff-fast) ease, border-color var(--ff-fast) ease, color var(--ff-fast) ease;
}
.ff-chip:hover { border-color: var(--ff-ink-2); color: var(--ff-ink); }
.ff-chip[aria-pressed="true"], .ff-chip.is-active { background: var(--ff-brand); border-color: var(--ff-brand); color: var(--ff-on-brand); }

/* Badges */
.ff-badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: var(--ff-r-pill); font-size: 12px; font-weight: 750; white-space: nowrap;
  background: var(--ff-sunken); color: var(--ff-ink-2);
}
.ff-badge--success { background: var(--ff-success-soft); color: var(--ff-success); }
.ff-badge--warning { background: var(--ff-warning-soft); color: var(--ff-warning); }
.ff-badge--danger  { background: var(--ff-danger-soft);  color: var(--ff-danger); }
.ff-badge--info    { background: var(--ff-info-soft);    color: var(--ff-info); }
.ff-badge--accent  { background: var(--ff-accent);       color: var(--ff-on-accent); }
.ff-badge--cash    { background: var(--ff-cash-soft);    color: var(--ff-cash); }
.ff-badge--wish    { background: var(--ff-wish-soft);    color: var(--ff-wish); }

/* Stock level pill: in stock / low / out */
.ff-stock { display: inline-flex; align-items: center; gap: 6px; font-weight: 750; font-size: 12.5px; }
.ff-stock::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.ff-stock--ok { color: var(--ff-success); }
.ff-stock--low { color: var(--ff-warning); }
.ff-stock--out { color: var(--ff-danger); }

/* KPI tiles */
.ff-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--ff-3); }
.ff-kpi { background: var(--ff-surface); border: 1px solid var(--ff-line); border-radius: var(--ff-r-lg); padding: var(--ff-4) var(--ff-5); box-shadow: var(--ff-shadow-1); }
.ff-kpi__label { font-size: 12.5px; font-weight: 700; color: var(--ff-muted); display: flex; align-items: center; gap: 8px; }
.ff-kpi__value { font-family: var(--ff-font-display); font-stretch: 106%; font-weight: 800; font-size: clamp(19px, 1vw + 9px, 28px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.ff-kpi__sub { font-size: 12.5px; color: var(--ff-muted); margin-top: 2px; }
.ff-kpi--ink { background: var(--ff-brand-grad); color: var(--ff-on-brand); border-color: transparent; box-shadow: var(--ff-shadow-2); }
.ff-kpi--ink .ff-kpi__label, .ff-kpi--ink .ff-kpi__sub { color: color-mix(in srgb, var(--ff-on-brand) 70%, transparent); }

/* Tables */
.ff-table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--ff-line); border-radius: var(--ff-r-lg); background: var(--ff-surface); }
.ff-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--ff-text-md); }
.ff-table th {
  position: sticky; top: 0; z-index: 1; text-align: left; white-space: nowrap;
  padding: 11px 14px; background: var(--ff-surface-2); color: var(--ff-muted);
  font-family: var(--ff-font-display); font-stretch: 112%; font-size: 11.5px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; border-bottom: 1px solid var(--ff-line);
}
.ff-table td { padding: 12px 14px; border-bottom: 1px solid var(--ff-line); vertical-align: middle; }
.ff-table tbody tr:last-child td { border-bottom: 0; }
.ff-table tbody tr:hover td { background: var(--ff-surface-2); }
.ff-table .num, .ff-table .ff-num { text-align: right; font-variant-numeric: tabular-nums; }

/* Modal */
.ff-modal-backdrop {
  position: fixed; inset: 0; z-index: var(--ff-z-modal); display: none; align-items: center; justify-content: center;
  padding: var(--ff-4); background: rgba(30, 27, 75, .5);
}
.ff-modal-backdrop.is-open, .ff-modal-backdrop[aria-hidden="false"] { display: flex; }
.ff-modal {
  width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  background: var(--ff-surface); color: var(--ff-ink); border: 1px solid var(--ff-line);
  border-radius: var(--ff-r-xl); box-shadow: var(--ff-shadow-3);
  animation: ff-pop var(--ff-med) var(--ff-ease-out);
}
.ff-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: var(--ff-5) var(--ff-6) var(--ff-3); }
.ff-modal__head h2 { margin: 0; font-size: var(--ff-text-lg); }
.ff-modal__body { padding: var(--ff-2) var(--ff-6) var(--ff-5); }
.ff-modal__foot { display: flex; justify-content: flex-end; gap: var(--ff-2); padding: var(--ff-4) var(--ff-6); border-top: 1px solid var(--ff-line); background: var(--ff-surface-2); border-radius: 0 0 var(--ff-r-xl) var(--ff-r-xl); }
@keyframes ff-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* Alerts */
.ff-alert {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--ff-r-lg);
  border: 1px solid var(--ff-line); background: var(--ff-surface); font-weight: 600;
}
.ff-alert > i { margin-top: 2px; }
.ff-alert__title { font-weight: 800; }
.ff-alert--warn { background: var(--ff-warning-soft); border-color: color-mix(in srgb, var(--ff-warning) 35%, transparent); color: var(--ff-warning); }
.ff-alert--danger { background: var(--ff-danger-soft); border-color: color-mix(in srgb, var(--ff-danger) 35%, transparent); color: var(--ff-danger); }
.ff-alert--info { background: var(--ff-info-soft); border-color: color-mix(in srgb, var(--ff-info) 35%, transparent); color: var(--ff-info); }
.ff-alert--success { background: var(--ff-success-soft); border-color: color-mix(in srgb, var(--ff-success) 35%, transparent); color: var(--ff-success); }
.ff-notice-wrap { padding: var(--ff-4) var(--ff-6) 0; max-width: var(--ff-content-max); margin: 0 auto; }

/* Empty state */
.ff-empty { text-align: center; padding: var(--ff-10) var(--ff-4); color: var(--ff-muted); }
.ff-empty i { font-size: 28px; margin-bottom: var(--ff-3); color: var(--ff-subtle); }
.ff-empty strong { display: block; color: var(--ff-ink); font-size: var(--ff-text-base); margin-bottom: 4px; }

/* Toasts (window.ffToast) */
.ff-toasts { position: fixed; right: var(--ff-4); bottom: var(--ff-4); z-index: var(--ff-z-toast); display: grid; gap: 8px; width: min(380px, calc(100vw - 32px)); }
.ff-toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--ff-r-lg);
  background: var(--ff-brand); color: var(--ff-on-brand); box-shadow: var(--ff-shadow-3); font-weight: 650; font-size: 14px;
  animation: ff-toast-in var(--ff-med) var(--ff-ease-out);
}
.ff-toast--success i { color: #fde047; }
.ff-toast--error { background: var(--ff-danger); color: #fff; }
.ff-toast.is-leaving { opacity: 0; transform: translateY(6px); transition: all 150ms var(--ff-ease-in); }
@keyframes ff-toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Utility layout */
.ff-grid { display: grid; gap: var(--ff-4); }
.ff-row { display: flex; align-items: center; gap: var(--ff-3); flex-wrap: wrap; }
.ff-stack { display: grid; gap: var(--ff-3); }
.ff-split { display: flex; align-items: center; justify-content: space-between; gap: var(--ff-3); }

/* Scrollbars (subtle) */
* { scrollbar-color: var(--ff-line-strong) transparent; }

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

@media print {
  .ff-rail, .ff-topbar, .ff-scrim, .ff-progress, .global-loader, .ff-toasts, .ff-notice-wrap, .ff-skip { display: none !important; }
  .ff-app { display: block; }
  .content-inner { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
}
.ff-rail__nav::-webkit-scrollbar { display: none; }

/* ---------- Colour Pop accents ---------- */
body {
  background:
    radial-gradient(900px 520px at 105% -8%, rgba(236, 72, 153, .10), transparent 62%),
    radial-gradient(820px 520px at -6% 108%, rgba(14, 165, 233, .10), transparent 60%),
    radial-gradient(700px 420px at 55% 120%, rgba(124, 58, 237, .07), transparent 65%),
    var(--ff-bg);
  background-attachment: fixed;
}
.ff-topbar { position: sticky; }
.ff-topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  background: linear-gradient(90deg, #4f46e5, #7c3aed 30%, #db2777 62%, #f97316 85%, #f59e0b);
  opacity: .9; pointer-events: none;
}
.ff-rail { box-shadow: 4px 0 24px -12px rgba(76, 29, 149, .45); border-right: 0; }
.ff-rail__label { color: rgba(255, 255, 255, .62); }
.ff-user__avatar { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .28); }
.ff-rail-btn:hover { border-color: rgba(255, 255, 255, .45); }

/* KPI tiles: a different colour stripe per tile, so dashboards read as colourful */
.ff-kpi:not(.ff-kpi--ink) { position: relative; overflow: hidden; }
.ff-kpi:not(.ff-kpi--ink)::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ff-chart-1);
}
.ff-kpis > .ff-kpi:not(.ff-kpi--ink):nth-child(5n+2)::before { background: var(--ff-chart-2); }
.ff-kpis > .ff-kpi:not(.ff-kpi--ink):nth-child(5n+3)::before { background: var(--ff-chart-3); }
.ff-kpis > .ff-kpi:not(.ff-kpi--ink):nth-child(5n+4)::before { background: var(--ff-chart-4); }
.ff-kpis > .ff-kpi:not(.ff-kpi--ink):nth-child(5n+5)::before { background: var(--ff-chart-5); }

/* Chips & card heads pick up the brand colour */
.ff-chip[aria-pressed="true"], .ff-chip.is-active { background: var(--ff-brand-grad); border-color: transparent; color: #fff; box-shadow: 0 6px 14px -8px rgba(109, 40, 217, .7); }
.ff-chip:hover { border-color: var(--ff-brand); color: var(--ff-brand); }
.ff-card__head h2 i, .ff-card__head h3 i { color: var(--ff-brand); }
.ff-table th { color: #5b51a6; }

/* ---------- App launcher (replaces the sidebar, 2026-10-17) ---------- */
.ff-app { display: block; }
.ff-main { min-height: 100dvh; }
.ff-topbar { gap: 10px; padding-left: var(--ff-4); }
.ff-launcher-btn {
  flex: 0 0 auto; width: 46px; height: 46px; display: inline-grid; place-items: center;
  border: 0; border-radius: 14px; background: var(--ff-brand-grad); color: #fff;
  box-shadow: 0 8px 18px -8px rgba(109, 40, 217, .65);
  transition: transform var(--ff-fast) var(--ff-ease-out), box-shadow var(--ff-fast) ease, filter var(--ff-fast) ease;
}
.ff-launcher-btn svg { fill: currentColor; }
.ff-launcher-btn:hover { filter: brightness(1.08); box-shadow: 0 10px 22px -8px rgba(109, 40, 217, .75); }
.ff-launcher-btn:active { transform: scale(.94); }
.ff-launcher-btn[aria-expanded="true"] { transform: rotate(45deg); }
.ff-topbar__brand { display: inline-flex; text-decoration: none; }
.ff-topbar__mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; overflow: hidden; flex: 0 0 auto;
  background: var(--ff-surface); color: var(--ff-brand); border: 1px solid var(--ff-line);
  font-family: var(--ff-font-display); font-stretch: 125%; font-weight: 900; font-size: 14px; letter-spacing: -.04em;
}
.ff-topbar__mark img { width: 100%; height: 100%; object-fit: cover; }
.ff-topbar__user { display: inline-flex; align-items: center; gap: 8px; color: var(--ff-ink-2); font-weight: 700; font-size: 13px; }
.ff-topbar .ff-user__avatar, .ff-launcher .ff-user__avatar {
  width: 34px; height: 34px; background: var(--ff-sunken); color: var(--ff-brand); border: 1px solid var(--ff-line);
}

.ff-launcher { position: fixed; inset: 0; z-index: var(--ff-z-modal); }
.ff-launcher[hidden] { display: none; }
.ff-launcher__scrim { position: absolute; inset: 0; background: rgba(30, 27, 75, .42); backdrop-filter: blur(3px); animation: ff-fade var(--ff-med) ease; }
.ff-launcher__panel {
  position: absolute; top: 10px; left: 10px; width: min(760px, calc(100vw - 20px)); max-height: calc(100dvh - 20px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--ff-surface); border: 1px solid var(--ff-line); border-radius: var(--ff-r-xl); box-shadow: var(--ff-shadow-3);
  transform-origin: top left; animation: ff-launch var(--ff-med) var(--ff-ease-out);
}
@keyframes ff-launch { from { opacity: 0; transform: scale(.94) translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes ff-fade { from { opacity: 0; } to { opacity: 1; } }
.ff-launcher__head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 12px; border-bottom: 1px solid var(--ff-line); }
.ff-launcher__head .ff-topbar__mark { background: var(--ff-brand-grad); color: #fff; border: 0; }
.ff-launcher__titles { flex: 1 1 auto; min-width: 0; line-height: 1.2; }
.ff-launcher__titles h2 { margin: 0; font-size: 18px; }
.ff-launcher__titles span { font-size: 12.5px; color: var(--ff-muted); font-weight: 600; }
.ff-launcher__body { overflow-y: auto; padding: 6px 18px 18px; }
.ff-launcher__group { margin-top: 14px; }
.ff-launcher__label {
  margin: 0 0 8px; font-family: var(--ff-font-display); font-stretch: 118%; font-weight: 700; font-size: 11px;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ff-muted);
}
.ff-launcher__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
.ff-tile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 9px;
  min-height: 108px; padding: 14px 8px 12px; border-radius: var(--ff-r-lg); text-decoration: none; text-align: center;
  background: var(--ff-surface-2); border: 1px solid var(--ff-line); color: var(--ff-ink);
  transition: transform var(--ff-fast) var(--ff-ease-out), box-shadow var(--ff-fast) ease, border-color var(--ff-fast) ease, background var(--ff-fast) ease;
}
.ff-tile:hover { transform: translateY(-2px); background: var(--ff-surface); border-color: var(--ff-line-strong); box-shadow: var(--ff-shadow-2); }
.ff-tile:active { transform: scale(.97); }
.ff-tile:focus-visible { box-shadow: var(--ff-ring); border-radius: var(--ff-r-lg); }
.ff-tile[aria-current="page"] { background: color-mix(in srgb, var(--ff-brand) 8%, var(--ff-surface)); border-color: var(--ff-brand); }
.ff-tile[aria-current="page"]::after {
  content: "Here"; position: absolute; top: 6px; right: 6px; padding: 1px 7px; border-radius: var(--ff-r-pill);
  background: var(--ff-brand); color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .02em;
}
.ff-tile__icon {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; color: #fff; font-size: 21px;
  background: var(--tone, var(--ff-brand-grad)); box-shadow: 0 8px 16px -8px var(--tone-shadow, rgba(109, 40, 217, .6));
}
.ff-tile__label { font-size: 13px; font-weight: 750; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ff-launcher__group[data-tone="sell"]     { --tone: linear-gradient(150deg, #f472b6, #e11d48); --tone-shadow: rgba(225, 29, 72, .55); }
.ff-launcher__group[data-tone="stock"]    { --tone: linear-gradient(150deg, #34d399, #047857); --tone-shadow: rgba(4, 120, 87, .5); }
.ff-launcher__group[data-tone="insights"] { --tone: linear-gradient(150deg, #38bdf8, #0369a1); --tone-shadow: rgba(3, 105, 161, .5); }
.ff-launcher__group[data-tone="admin"]    { --tone: linear-gradient(150deg, #a78bfa, #6d28d9); --tone-shadow: rgba(109, 40, 217, .55); }
.ff-launcher__group[data-tone="device"]   { --tone: linear-gradient(150deg, #fbbf24, #c2410c); --tone-shadow: rgba(194, 65, 12, .5); }
.ff-launcher__foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; border-top: 1px solid var(--ff-line); background: var(--ff-surface-2);
}
.ff-launcher__foot .ff-user { padding: 0; }
.ff-launcher__foot .ff-user__name { color: var(--ff-ink); }
.ff-launcher__foot .ff-user__role { color: var(--ff-muted); }
body.ff-launcher-open { overflow: hidden; }

@media (max-width: 640px) {
  .ff-launcher__panel { top: 0; left: 0; width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; border: 0; }
  .ff-launcher__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .ff-tile { min-height: 100px; padding: 12px 4px 10px; }
  .ff-tile__icon { width: 48px; height: 48px; font-size: 19px; }
  .ff-topbar__brand { display: none; }
}
@media print { .ff-launcher, .ff-launcher-btn { display: none !important; } }

/* ==========================================================================
   Back-office list pattern (2026-10-17): toolbar → compact list → detail drawer
   ========================================================================== */

/* Page toolbar: search + filter chips on the left, one primary action on the right */
.ff-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: var(--ff-4); }
.ff-toolbar__search { position: relative; flex: 1 1 280px; max-width: 520px; }
.ff-toolbar__search > i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ff-muted); pointer-events: none; }
.ff-toolbar__search .ff-input { padding-left: 40px; min-height: 46px; border-radius: var(--ff-r-pill); background: var(--ff-surface); }
.ff-toolbar__spacer { flex: 1 1 auto; }
.ff-toolbar .ff-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.ff-toolbar .ff-chips::-webkit-scrollbar { display: none; }
.ff-count { color: var(--ff-muted); font-size: 13px; font-weight: 650; white-space: nowrap; }

/* Segmented control (date presets, status tabs) */
.ff-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--ff-r-pill); background: var(--ff-sunken); border: 1px solid var(--ff-line); }
.ff-seg button, .ff-seg a {
  min-height: 38px; padding: 0 14px; border: 0; border-radius: var(--ff-r-pill); background: transparent;
  color: var(--ff-ink-2); font-weight: 700; font-size: 13px; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.ff-seg button:hover, .ff-seg a:hover { color: var(--ff-ink); }
.ff-seg [aria-pressed="true"], .ff-seg [aria-selected="true"], .ff-seg .is-active { background: var(--ff-surface); color: var(--ff-brand); box-shadow: var(--ff-shadow-1); }
.ff-seg .ff-seg__n { font-size: 11.5px; padding: 0 6px; border-radius: var(--ff-r-pill); background: var(--ff-line); color: var(--ff-ink-2); }

/* Compact clickable list (table-like rows, whole row opens the drawer) */
.ff-list { background: var(--ff-surface); border: 1px solid var(--ff-line); border-radius: var(--ff-r-lg); overflow: hidden; box-shadow: var(--ff-shadow-1); }
.ff-list__head, .ff-list__row { display: grid; align-items: center; gap: 12px; padding: 0 16px; grid-template-columns: var(--cols, 1fr auto); }
.ff-list__head {
  min-height: 40px; background: var(--ff-surface-2); border-bottom: 1px solid var(--ff-line);
  font-family: var(--ff-font-display); font-stretch: 112%; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #5b51a6;
}
.ff-list__row {
  min-height: 60px; border-bottom: 1px solid var(--ff-line); cursor: pointer; text-decoration: none; color: inherit;
  transition: background var(--ff-fast) ease;
}
.ff-list__row:last-child { border-bottom: 0; }
.ff-list__row:hover { background: color-mix(in srgb, var(--ff-brand) 4%, var(--ff-surface)); }
.ff-list__row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ff-brand); }
.ff-list__row[aria-selected="true"], .ff-list__row.is-selected { background: color-mix(in srgb, var(--ff-brand) 8%, var(--ff-surface)); box-shadow: inset 3px 0 0 var(--ff-brand); }
.ff-list__main { min-width: 0; }
.ff-list__title { font-weight: 750; color: var(--ff-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ff-list__sub { font-size: 12.5px; color: var(--ff-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ff-list__num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 750; white-space: nowrap; }
.ff-list__chev { color: var(--ff-subtle); }
.ff-list__more { display: flex; justify-content: center; padding: 12px; border-top: 1px solid var(--ff-line); }
@media (max-width: 720px) {
  .ff-list__head { display: none; }
  .ff-list__row { grid-template-columns: var(--cols-sm, 1fr auto); padding: 10px 14px; }
  .ff-hide-mobile { display: none !important; }
}

/* Detail drawer (right side panel; full screen on phones) — window.ffDrawer */
.ff-drawer { position: fixed; inset: 0; z-index: var(--ff-z-modal); }
.ff-drawer[hidden] { display: none; }
.ff-drawer__scrim { position: absolute; inset: 0; background: rgba(30, 27, 75, .35); animation: ff-fade var(--ff-med) ease; }
.ff-drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); display: flex; flex-direction: column;
  background: var(--ff-surface); box-shadow: var(--ff-shadow-3); border-left: 1px solid var(--ff-line);
  animation: ff-drawer-in var(--ff-med) var(--ff-ease-out);
}
.ff-drawer--wide .ff-drawer__panel { width: min(760px, 100vw); }
@keyframes ff-drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.ff-drawer__head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--ff-line); }
.ff-drawer__titles { flex: 1 1 auto; min-width: 0; }
.ff-drawer__titles h2 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.ff-drawer__titles p { margin: 4px 0 0; color: var(--ff-muted); font-size: 13px; }
.ff-drawer__body { flex: 1 1 auto; overflow-y: auto; padding: 16px 20px 24px; display: grid; gap: 16px; align-content: start; }
.ff-drawer__foot { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--ff-line); background: var(--ff-surface-2); }
.ff-drawer__foot .ff-btn { flex: 1 1 auto; }
.ff-section { display: grid; gap: 8px; }
.ff-section > h3 { margin: 0; font-family: var(--ff-font-display); font-stretch: 116%; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ff-muted); }
.ff-dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.ff-dl dt { color: var(--ff-muted); font-weight: 650; }
.ff-dl dd { margin: 0; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.ff-lines { border: 1px solid var(--ff-line); border-radius: var(--ff-r-md); overflow: hidden; }
.ff-lines > div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--ff-line); font-size: 14px; }
.ff-lines > div:last-child { border-bottom: 0; }
.ff-total-row { display: flex; justify-content: space-between; align-items: baseline; padding-top: 8px; border-top: 2px solid var(--ff-ink); }
.ff-total-row strong { font-family: var(--ff-font-display); font-stretch: 112%; font-size: 24px; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .ff-drawer__panel { width: 100vw; border-left: 0; } }

/* "More" menu (⋯) — window.ffMenu */
.ff-menu { position: fixed; z-index: calc(var(--ff-z-modal) + 5); min-width: 220px; padding: 6px; background: var(--ff-surface); border: 1px solid var(--ff-line); border-radius: var(--ff-r-lg); box-shadow: var(--ff-shadow-3); animation: ff-pop var(--ff-fast) var(--ff-ease-out); }
.ff-menu[hidden] { display: none; }
.ff-menu button, .ff-menu a {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 12px; border: 0; border-radius: var(--ff-r-md);
  background: transparent; color: var(--ff-ink); font-weight: 650; font-size: 14px; text-align: left; text-decoration: none;
}
.ff-menu button:hover, .ff-menu a:hover, .ff-menu button:focus-visible, .ff-menu a:focus-visible { background: var(--ff-sunken); outline: none; }
.ff-menu i { width: 18px; text-align: center; color: var(--ff-muted); }
.ff-menu .is-danger, .ff-menu .is-danger i { color: var(--ff-danger); }
.ff-menu hr { margin: 6px 4px; }

/* ==========================================================================
   "Studio Light" refresh layer (2026-10-18) — overrides earlier component rules
   ========================================================================== */

/* Calm, plain light canvas (no colour washes, no rainbow line) */
body { background: var(--ff-bg); font-size: 15px; line-height: 1.5; font-feature-settings: "tnum" 1; letter-spacing: 0; }
.ff-topbar::after { display: none; }
.ff-topbar { background: rgba(255, 255, 255, .92); border-bottom: 1px solid var(--ff-line); }

/* Humanized type: sentence case, natural spacing, weight for hierarchy */
h1, h2, h3, h4, .ff-display { font-stretch: normal; letter-spacing: -.01em; }
h1 { font-weight: 700; } h2 { font-weight: 700; } h3, h4 { font-weight: 650; }
.ff-display { font-weight: 700; }
.ff-eyebrow, .ff-launcher__label, .ff-section > h3, .ff-rail__label {
  font-family: var(--ff-font-ui); font-stretch: normal; text-transform: none; letter-spacing: 0;
  font-size: 12.5px; font-weight: 650; color: var(--ff-muted);
}
.ff-table th, .ff-list__head {
  font-family: var(--ff-font-ui); font-stretch: normal; text-transform: none; letter-spacing: 0;
  font-size: 12.5px; font-weight: 650; color: var(--ff-muted);
}
.ff-topbar__title { font-stretch: normal; font-weight: 700; font-size: 17px; letter-spacing: -.005em; }
.ff-kpi__value { font-stretch: normal; font-weight: 700; letter-spacing: -.01em; }
.ff-kpi__label { font-weight: 600; }
.ff-card__head h2, .ff-card__head h3 { font-stretch: normal; font-weight: 650; }
.ff-list__title { font-weight: 650; }
.ff-btn { font-weight: 600; letter-spacing: 0; }

/* Sharper, quieter controls */
.ff-btn { border-radius: var(--ff-r-md); }
.ff-btn--lg { border-radius: var(--ff-r-lg); }
.ff-btn--primary, .ff-btn--accent {
  background: var(--ff-brand); color: #fff; border-color: var(--ff-brand);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08), inset 0 1px 0 rgba(255, 255, 255, .12);
}
.ff-btn--primary:hover, .ff-btn--accent:hover { background: var(--ff-brand-2); border-color: var(--ff-brand-2); filter: none; }
.ff-btn--danger { box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.ff-input, .ff-select, .ff-textarea { border-radius: var(--ff-r-md); border-color: var(--ff-line-strong); }
.ff-input:focus, .ff-select:focus, .ff-textarea:focus { border-color: var(--ff-brand); box-shadow: 0 0 0 3px rgba(67, 56, 202, .15); }
.ff-chip { border-radius: var(--ff-r-md); font-weight: 600; border-color: var(--ff-line-strong); }
.ff-chip:hover { border-color: var(--ff-brand); color: var(--ff-brand); }
.ff-chip[aria-pressed="true"], .ff-chip.is-active { background: var(--ff-brand-soft); border-color: var(--ff-brand); color: var(--ff-brand); box-shadow: none; }
.ff-badge { border-radius: var(--ff-r-sm); font-weight: 650; height: 22px; padding: 0 8px; }
.ff-seg { border-radius: var(--ff-r-lg); padding: 3px; }
.ff-seg button, .ff-seg a { border-radius: var(--ff-r-md); font-weight: 600; }
.ff-seg [aria-pressed="true"], .ff-seg [aria-selected="true"], .ff-seg .is-active { color: var(--ff-ink); box-shadow: var(--ff-shadow-1), 0 0 0 1px var(--ff-line); }
.ff-toolbar__search .ff-input { border-radius: var(--ff-r-md); }
.ff-icon-btn { border-radius: var(--ff-r-md); }

/* Cards, lists, panels */
.ff-card, .ff-kpi, .ff-list, .ff-table-wrap { border-radius: var(--ff-r-lg); box-shadow: var(--ff-shadow-1); }
.ff-kpi:not(.ff-kpi--ink)::before { width: 3px; }
.ff-kpi--ink { background: var(--ff-brand); border-color: var(--ff-brand); box-shadow: var(--ff-shadow-1); }
.ff-list__row:hover { background: var(--ff-surface-2); }
.ff-list__row[aria-selected="true"], .ff-list__row.is-selected { background: var(--ff-brand-soft); box-shadow: inset 3px 0 0 var(--ff-brand); }
.ff-modal { border-radius: var(--ff-r-xl); }
.ff-modal__foot { border-radius: 0 0 var(--ff-r-xl) var(--ff-r-xl); }
.ff-drawer__panel { border-radius: 0; }
.ff-menu { border-radius: var(--ff-r-lg); }
.ff-menu button, .ff-menu a { border-radius: var(--ff-r-sm); }
.ff-toast { border-radius: var(--ff-r-lg); background: var(--ff-ink); }
.ff-toast--success i { color: #75e0a7; }
.ff-alert { border-radius: var(--ff-r-lg); }
.ff-modal-backdrop, .ff-drawer__scrim, .ff-launcher__scrim { background: rgba(16, 24, 40, .45); }
.ff-launcher__scrim { backdrop-filter: none; }
.global-loader { background: rgba(16, 24, 40, .12); }
.ff-progress { background: var(--ff-brand); box-shadow: none; }
::selection { background: #c7d2fe; color: var(--ff-ink); }

/* Launcher: solid brand button, calmer tiles (colour lives in the icon only) */
.ff-launcher-btn { border-radius: var(--ff-r-lg); background: var(--ff-brand); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.ff-launcher-btn:hover { background: var(--ff-brand-2); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); filter: none; }
.ff-launcher-btn[aria-expanded="true"] { transform: none; background: var(--ff-brand-2); }
.ff-topbar__mark { border-radius: var(--ff-r-md); font-stretch: normal; font-weight: 800; letter-spacing: -.02em; }
.ff-launcher__head .ff-topbar__mark { background: var(--ff-brand); }
.ff-launcher__panel { border-radius: var(--ff-r-xl); }
.ff-tile { border-radius: var(--ff-r-lg); background: var(--ff-surface); }
.ff-tile:hover { transform: none; box-shadow: var(--ff-shadow-2); border-color: var(--ff-line-strong); }
.ff-tile[aria-current="page"] { background: var(--ff-brand-soft); }
.ff-tile[aria-current="page"]::after { border-radius: var(--ff-r-sm); }
.ff-tile__icon { border-radius: var(--ff-r-lg); box-shadow: none; width: 48px; height: 48px; font-size: 20px; }
.ff-tile__label { font-weight: 650; }
.ff-launcher__group[data-tone="sell"]     { --tone: #e04f16; }
.ff-launcher__group[data-tone="stock"]    { --tone: #0e9384; }
.ff-launcher__group[data-tone="insights"] { --tone: #175cd3; }
.ff-launcher__group[data-tone="admin"]    { --tone: #4338ca; }
.ff-launcher__group[data-tone="device"]   { --tone: #b54708; }

/* ---------- Offline mode: connection chip in the top bar (assets/js/ff-offline.js) ---------- */
.ff-net {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px;
  border: 1px solid var(--ff-line); border-radius: var(--ff-r-md); background: var(--ff-surface);
  color: var(--ff-ink-2); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; white-space: nowrap;
}
.ff-net[hidden] { display: none; }
.ff-net:focus-visible { outline: none; box-shadow: var(--ff-ring); }
.ff-net[data-tone="off"]  { background: var(--ff-warning-soft); border-color: #fedf89; color: var(--ff-warning); }
.ff-net[data-tone="warn"] { background: var(--ff-warning-soft); border-color: #fedf89; color: var(--ff-warning); }
.ff-net[data-tone="sync"] { background: var(--ff-info-soft); border-color: #b2ddff; color: var(--ff-info); }
.ff-net[data-tone="sync"] i { animation: ff-net-spin 1s linear infinite; }
.ff-net[data-tone="off"] i { position: relative; }
.ff-net[data-tone="off"] i::after {
  content: ""; position: absolute; left: -1px; right: -1px; top: 50%; height: 2px; background: currentColor; transform: rotate(-35deg);
}
@keyframes ff-net-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ff-net[data-tone="sync"] i { animation: none; } }
