/* ==========================================================================
   Omni Forms — app theme for the pages that use layouts/app (lists, account, admin, new form).
   The builder doesn't load this file. The layout sets on <html>:
     data-ui          always (marks these pages)
     data-mode        light | dark (resolved from the viewer's choice; "auto" follows the system)
     data-accent      indigo | ocean | teal | emerald | violet | rose | sunset | graphite
   Choices are made in the top bar (Appearance) and kept in this browser.
   ========================================================================== */

/* ---------- Accents: a main colour and a partner for gradients. White text on --fb-accent stays readable. ---------- */
:root[data-ui] { --fb-accent: #5b5bf0; --fb-accent-2: #a855f7; }
:root[data-ui][data-accent="ocean"] { --fb-accent: #2563eb; --fb-accent-2: #06b6d4; }
:root[data-ui][data-accent="teal"] { --fb-accent: #0f8a80; --fb-accent-2: #22c3a6; }
:root[data-ui][data-accent="emerald"] { --fb-accent: #058a5f; --fb-accent-2: #84cc16; }
:root[data-ui][data-accent="violet"] { --fb-accent: #7c3aed; --fb-accent-2: #ec4899; }
:root[data-ui][data-accent="rose"] { --fb-accent: #e11d48; --fb-accent-2: #f97316; }
:root[data-ui][data-accent="sunset"] { --fb-accent: #c2410c; --fb-accent-2: #f59e0b; }
:root[data-ui][data-accent="graphite"] { --fb-accent: #334155; --fb-accent-2: #64748b; }

/* ---------- Light ---------- */
:root[data-ui] {
    --fb-canvas: #f3f5fb;  --fb-dot: #d9dfea;
    --fb-panel: #ffffff;   --fb-line: #e3e8f1;
    --fb-text: #0f172a;    --fb-muted: #5b6b82;
    --fb-field: #f8fafd;   --fb-hover: #f3f6fb;
    --fb-accent-soft: color-mix(in srgb, var(--fb-accent) 12%, #ffffff);
    --fb-accent-ink: color-mix(in srgb, var(--fb-accent) 82%, #000000);
    --fb-glow: color-mix(in srgb, var(--fb-accent) 22%, transparent);
    --fb-shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 10px 28px -18px rgb(15 23 42 / 0.22);
    --fb-shadow-lift: 0 2px 4px rgb(15 23 42 / 0.05), 0 18px 40px -20px color-mix(in srgb, var(--fb-accent) 45%, rgb(15 23 42 / 0.4));
    color-scheme: light;
}
/* ---------- Dark (explicit, or "auto" on a dark system) ---------- */
:root[data-ui][data-mode="dark"] {
    --fb-canvas: #0a0f1c;  --fb-dot: #1c2740;
    --fb-panel: #111a2c;   --fb-line: #223150;
    --fb-text: #e7edf7;    --fb-muted: #95a5c0;
    --fb-field: #0d1526;   --fb-hover: #17223a;
    --fb-accent-soft: color-mix(in srgb, var(--fb-accent) 24%, #111a2c);
    --fb-accent-ink: color-mix(in srgb, var(--fb-accent) 45%, #ffffff);
    --fb-glow: color-mix(in srgb, var(--fb-accent) 35%, transparent);
    --fb-shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 30px -18px rgb(0 0 0 / 0.7);
    --fb-shadow-lift: 0 2px 4px rgb(0 0 0 / 0.3), 0 20px 44px -18px color-mix(in srgb, var(--fb-accent) 55%, rgb(0 0 0 / 0.8));
    color-scheme: dark;
}

/* The shared design-system classes (.btn, .form-control, toasts) read these: point them at the app colours… */
:root[data-ui] body.fb-page {
    --primary: var(--fb-accent); --primary-hover: color-mix(in srgb, var(--fb-accent) 80%, #000);
    --primary-light: var(--fb-accent-soft); --border-focus: color-mix(in srgb, var(--fb-accent) 55%, transparent);
    --shadow-glow: 0 0 0 4px var(--fb-glow);
    --surface: var(--fb-panel); --bg-color: var(--fb-field); --text-main: var(--fb-text); --text-muted: var(--fb-muted); --border: var(--fb-line);
}
/* …except inside the form previews on New form, which must look exactly like the exported form.
   (:where() keeps this weaker than each template's own [data-fb-theme] colours.) */
:where(.tpl-stage) {
    --surface: #ffffff; --bg-color: #f8fafc; --text-main: #0f172a; --text-muted: #64748b; --border: #cbd5e1;
    --border-focus: #a5b4fc; --primary-light: #e0e7ff; --shadow-glow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    color-scheme: light;
}

/* Switching theme: a short cross-fade instead of a hard flash (only while switching). */
:root.is-theming *, :root.is-theming *::before, :root.is-theming *::after { transition: background-color 0.3s, border-color 0.3s, color 0.3s, fill 0.3s !important; }

/* ---------- Page backdrop: soft colour glows from the accent at the top ---------- */
:root[data-ui] body.fb-page {
    background:
        radial-gradient(900px 460px at 6% -12%, color-mix(in srgb, var(--fb-accent) 15%, transparent), transparent 70%),
        radial-gradient(760px 420px at 96% -10%, color-mix(in srgb, var(--fb-accent-2) 13%, transparent), transparent 70%),
        var(--fb-canvas);
    background-repeat: no-repeat;
}

/* ---------- Top bar ---------- */
.fb-brand-mark { background: linear-gradient(135deg, var(--fb-accent), var(--fb-accent-2)); box-shadow: 0 6px 14px -6px var(--fb-accent), inset 0 1px 0 rgb(255 255 255 / 0.3); transition: transform 0.25s; }
.fb-brand:hover .fb-brand-mark { transform: rotate(-8deg) scale(1.06); }
.fb-nav-tab { margin: 12px 0; padding: 0 14px; border-radius: 10px; transition: color 0.15s, background 0.15s; }
.fb-nav-tab:hover { background: var(--fb-hover); }
.fb-nav-tab.is-active { background: var(--fb-accent-soft); color: var(--fb-accent-ink); }
.fb-nav-tab::after { bottom: -13px; height: 3px; background: linear-gradient(90deg, var(--fb-accent), var(--fb-accent-2)); }
.fb-avatar { background: linear-gradient(135deg, var(--fb-accent), var(--fb-accent-2)); color: #fff; box-shadow: 0 0 0 2px var(--fb-panel), 0 0 0 3px color-mix(in srgb, var(--fb-accent) 40%, transparent); }

/* Appearance menu (next to the account menu) */
.fb-theme { position: relative; }
.fb-theme-btn { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--fb-line); background: var(--fb-panel); color: var(--fb-muted); cursor: pointer; transition: color 0.15s, border-color 0.15s, transform 0.2s; }
.fb-theme-btn:hover, .fb-theme.is-open .fb-theme-btn { color: var(--fb-accent-ink); border-color: var(--fb-accent); }
.fb-theme-btn:hover svg { transform: rotate(20deg); }
.fb-theme-btn svg { transition: transform 0.3s; }
.fb-theme-btn:focus-visible { outline: 2px solid var(--fb-accent); outline-offset: 2px; }
.fb-theme-menu { position: absolute; right: 0; top: calc(100% + 10px); width: 296px; padding: 14px; border-radius: 14px; background: var(--fb-panel); border: 1px solid var(--fb-line); box-shadow: 0 24px 50px -16px rgb(15 23 42 / 0.35), 0 2px 6px rgb(15 23 42 / 0.06); z-index: 50; animation: fbMenuIn 0.16s ease-out; }
.fb-theme-menu[hidden] { display: none; }
@keyframes fbMenuIn { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
.fb-appearance h2 { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fb-muted); margin: 0 0 8px; }
.fb-appearance h2:not(:first-child) { margin-top: 14px; }
.fb-mode-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 11px; background: var(--fb-hover); }
.fb-mode-seg button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 4px; border: 0; border-radius: 8px; background: transparent; color: var(--fb-muted); font: inherit; font-size: 0.76rem; font-weight: 600; cursor: pointer; }
.fb-mode-seg button:hover { color: var(--fb-text); }
.fb-mode-seg button[aria-pressed="true"] { background: var(--fb-panel); color: var(--fb-accent-ink); box-shadow: 0 1px 3px rgb(15 23 42 / 0.15); }
.fb-mode-seg button:focus-visible, .fb-swatch:focus-visible, .fb-theme-reset:focus-visible { outline: 2px solid var(--fb-accent); outline-offset: 2px; }
.fb-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.fb-swatch { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 2px; border: 0; border-radius: 10px; background: none; color: var(--fb-muted); font: inherit; font-size: 0.7rem; font-weight: 600; cursor: pointer; }
.fb-swatch i { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--a), var(--b)); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.25); transition: transform 0.15s, box-shadow 0.15s; position: relative; }
.fb-swatch:hover i { transform: scale(1.1); }
.fb-swatch[aria-pressed="true"] { color: var(--fb-text); }
.fb-swatch[aria-pressed="true"] i { box-shadow: 0 0 0 2px var(--fb-panel), 0 0 0 4px var(--a); }
.fb-swatch[aria-pressed="true"] i::after { content: ''; position: absolute; left: 11px; top: 8px; width: 7px; height: 12px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.fb-theme-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--fb-line); font-size: 0.75rem; color: var(--fb-muted); }
.fb-theme-reset { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--fb-accent-ink); cursor: pointer; }
.fb-theme-reset:hover { text-decoration: underline; }

/* Compact: inside the account menu (mode buttons with icon + word in a row, eight small colour dots). */
.fb-menu-appearance { padding: 10px 10px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--fb-line); }
.fb-appearance.is-compact h2 { margin-bottom: 8px; }
.fb-appearance.is-compact .fb-mode-seg button { flex-direction: row; justify-content: center; gap: 5px; padding: 6px 4px; font-size: 0.74rem; }
.fb-appearance.is-compact .fb-swatches { grid-template-columns: repeat(8, 1fr); gap: 2px; margin-top: 10px; }
.fb-appearance.is-compact .fb-swatch { padding: 3px 0; }
.fb-appearance.is-compact .fb-swatch i { width: 22px; height: 22px; }
.fb-appearance.is-compact .fb-swatch[aria-pressed="true"] i::after { left: 8px; top: 5px; width: 5px; height: 9px; border-width: 0 2px 2px 0; }
.fb-appearance.is-compact .fb-theme-foot { margin-top: 8px; padding-top: 0; border-top: 0; font-size: 0.72rem; }

/* Footer (signed out): a labelled pill next to "Back to top", opening upwards. */
.fb-footer-bar .fb-theme { margin-left: auto; }
.fb-footer-bar .fb-theme + .fb-footer-top { margin-left: 0; }
:root[data-ui] .fb-theme.is-up .fb-theme-btn { width: auto; height: auto; display: inline-flex; gap: 6px; padding: 6px 12px; border-radius: 999px; font: inherit; font-size: 0.8rem; font-weight: 600; background: rgb(255 255 255 / 0.07); border-color: rgb(255 255 255 / 0.12); color: #e2e8f0; }
:root[data-ui] .fb-theme.is-up .fb-theme-btn:hover, :root[data-ui] .fb-theme.is-up.is-open .fb-theme-btn { background: rgb(255 255 255 / 0.12); color: #fff; border-color: rgb(255 255 255 / 0.25); }
.fb-theme.is-up .fb-theme-menu { top: auto; bottom: calc(100% + 10px); }
/* the footer uses light-on-dark colours; the pop-up is an ordinary light / dark panel */
:root[data-ui] .fb-footer .fb-theme-menu { --fb-text: #0f172a; --fb-muted: #5b6b82; --fb-line: #e3e8f1; --fb-canvas: #f3f5fb; color: var(--fb-text); }
:root[data-ui][data-mode="dark"] .fb-footer .fb-theme-menu { --fb-text: #e7edf7; --fb-muted: #95a5c0; --fb-line: #223150; --fb-canvas: #0a0f1c; }

/* ---------- Headings, buttons, cards ---------- */
.fb-list-head h1, .fb-auth h1, .tpl-top h1 { background: linear-gradient(100deg, var(--fb-text) 35%, color-mix(in srgb, var(--fb-accent) 85%, var(--fb-text))); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.fb-page .btn-primary { background: linear-gradient(135deg, var(--fb-accent), color-mix(in srgb, var(--fb-accent) 55%, var(--fb-accent-2))); color: #fff; box-shadow: 0 6px 16px -6px var(--fb-accent); background-size: 160% 160%; background-position: 0 0; transition: background-position 0.4s, box-shadow 0.2s, transform 0.15s; }
.fb-page .btn-primary:hover { background-position: 100% 100%; box-shadow: 0 10px 22px -8px var(--fb-accent); transform: translateY(-1px); }
.fb-page .btn-primary:active { transform: translateY(0) scale(0.98); }
.fb-page .btn-outline { background: var(--fb-panel); border-color: var(--fb-line); color: var(--fb-text); }
.fb-page .btn-outline:hover { border-color: var(--fb-accent); color: var(--fb-accent-ink); background: var(--fb-panel); }
.fb-form-list, .fb-table-card, .fb-panel-block, .fb-card, .fb-stat, .tpl-side, .tpl-preview, .fb-empty-list { box-shadow: var(--fb-shadow); }
.fb-form-row { transition: background 0.15s, box-shadow 0.15s; position: relative; }
.fb-form-row::before { content: ''; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: linear-gradient(var(--fb-accent), var(--fb-accent-2)); opacity: 0; transform: scaleY(0.4); transition: opacity 0.15s, transform 0.2s; }
.fb-form-row:hover::before, .fb-form-row:focus-within::before { opacity: 1; transform: none; }
.fb-edit-btn:hover { background: linear-gradient(135deg, var(--fb-accent), color-mix(in srgb, var(--fb-accent) 55%, var(--fb-accent-2))); }
.fb-page-btn.is-current { background: linear-gradient(135deg, var(--fb-accent), color-mix(in srgb, var(--fb-accent) 55%, var(--fb-accent-2))); border-color: transparent; }

/* Overview cards: a spotlight follows the pointer (--mx / --my set by the layout script) and the number counts up. */
.fb-stat { position: relative; overflow: hidden; isolation: isolate; }
.fb-stat::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--fb-accent) 13%, transparent), transparent 65%); opacity: 0; transition: opacity 0.2s; }
.fb-stat:hover::before { opacity: 1; }
.fb-stat::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--fb-accent), var(--fb-accent-2)); transform: scaleX(0); transform-origin: left; transition: transform 0.3s; }
.fb-stat:hover::after { transform: scaleX(1); }
.fb-stat:hover { box-shadow: var(--fb-shadow-lift); }
.fb-stat-icon { transition: transform 0.25s; }
.fb-stat:hover .fb-stat-icon { transform: scale(1.08) rotate(-4deg); }
.fb-starter-card { position: relative; overflow: hidden; isolation: isolate; }
.fb-starter-card::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(200px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--fb-accent) 12%, transparent), transparent 65%); opacity: 0; transition: opacity 0.2s; }
.fb-starter-card:hover::before { opacity: 1; }
.fb-starter-card:hover { box-shadow: var(--fb-shadow-lift); }

/* Entrance: cards and rows rise in, one after another. */
@keyframes fbRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.fb-stat, .fb-form-row, .fb-panel-block, .fb-user-table tbody tr { animation: fbRise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; } /* backwards: once done it lets go, so the hover lift still works */
.fb-stat:nth-child(2), .fb-form-row:nth-child(2), .fb-user-table tbody tr:nth-child(2) { animation-delay: 0.03s; }
.fb-stat:nth-child(3), .fb-form-row:nth-child(3), .fb-user-table tbody tr:nth-child(3) { animation-delay: 0.06s; }
.fb-stat:nth-child(4), .fb-form-row:nth-child(4), .fb-user-table tbody tr:nth-child(4) { animation-delay: 0.09s; }
.fb-stat:nth-child(5), .fb-form-row:nth-child(5), .fb-user-table tbody tr:nth-child(5) { animation-delay: 0.12s; }
.fb-form-row:nth-child(6), .fb-user-table tbody tr:nth-child(6) { animation-delay: 0.15s; }
.fb-form-row:nth-child(7), .fb-user-table tbody tr:nth-child(7) { animation-delay: 0.18s; }
.fb-form-row:nth-child(n+8), .fb-user-table tbody tr:nth-child(n+8) { animation-delay: 0.21s; }
.fb-panel-block + .fb-panel-block { animation-delay: 0.08s; }

/* ---------- Header: frosted glass tinted with the accent (main colour → partner), gradient hairline below ---------- */
:root[data-ui] .fb-nav {
    background:
        linear-gradient(100deg,
            color-mix(in srgb, color-mix(in srgb, var(--fb-accent) 16%, var(--fb-panel)) 88%, transparent),
            color-mix(in srgb, color-mix(in srgb, var(--fb-accent-2) 13%, var(--fb-panel)) 88%, transparent));
    border-bottom-color: transparent;
    box-shadow: 0 8px 24px -18px color-mix(in srgb, var(--fb-accent) 55%, rgb(15 23 42 / 0.3));
}
:root[data-ui] .fb-nav::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--fb-accent) 55%, transparent) 20%, color-mix(in srgb, var(--fb-accent-2) 55%, transparent) 80%, transparent); pointer-events: none; }
:root[data-ui][data-mode="dark"] .fb-nav {
    background:
        linear-gradient(100deg,
            color-mix(in srgb, color-mix(in srgb, var(--fb-accent) 16%, #0d1424) 88%, transparent),
            color-mix(in srgb, color-mix(in srgb, var(--fb-accent-2) 12%, #0d1424) 88%, transparent));
}
/* the theme / account buttons sit on the tint: give them a glassy fill */
:root[data-ui] .fb-theme-btn { background: color-mix(in srgb, var(--fb-panel) 70%, transparent); border-color: color-mix(in srgb, var(--fb-accent) 22%, var(--fb-line)); }
:root[data-ui] .fb-nav-tab:not(.is-active):hover { background: color-mix(in srgb, var(--fb-panel) 65%, transparent); }

/* ---------- Builder (data-ui="builder"): its chrome follows the same mode and accent.
   The form on the canvas keeps its own template (#canvas sets the form's colours), as it exports. ---------- */
:root[data-ui] .fb-topbar {
    background:
        linear-gradient(100deg,
            color-mix(in srgb, var(--fb-accent) 13%, var(--fb-panel)),
            color-mix(in srgb, var(--fb-accent-2) 10%, var(--fb-panel)));
    border-bottom-color: transparent;
    box-shadow: 0 8px 24px -18px color-mix(in srgb, var(--fb-accent) 55%, rgb(15 23 42 / 0.3));
}
:root[data-ui] .fb-topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--fb-accent) 55%, transparent) 20%, color-mix(in srgb, var(--fb-accent-2) 55%, transparent) 80%, transparent); pointer-events: none; }
:root[data-ui][data-mode="dark"] .fb-topbar {
    background:
        linear-gradient(100deg,
            color-mix(in srgb, var(--fb-accent) 18%, #0d1424),
            color-mix(in srgb, var(--fb-accent-2) 13%, #0d1424));
}
:root[data-ui] .fb-topbar .fb-btn:not(.primary):not(.ghost) { background: color-mix(in srgb, var(--fb-panel) 75%, transparent); border-color: color-mix(in srgb, var(--fb-accent) 20%, var(--fb-line)); }
:root[data-ui] .fb-topbar .fb-btn:not(.primary):hover:not(:disabled) { background: var(--fb-panel); border-color: var(--fb-accent); color: var(--fb-accent-ink); }
:root[data-ui] .fb-btn.primary { background: linear-gradient(135deg, var(--fb-accent), color-mix(in srgb, var(--fb-accent) 55%, var(--fb-accent-2))); box-shadow: 0 6px 16px -6px var(--fb-accent); }
:root[data-ui] .fb-btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, var(--fb-accent), color-mix(in srgb, var(--fb-accent) 40%, var(--fb-accent-2))); box-shadow: 0 10px 22px -8px var(--fb-accent); }
.fb-actions .fb-theme { margin-left: 0; }
.fb-topbar .fb-theme-btn { width: 36px; height: 36px; border-radius: 8px; }
.fb-topbar .fb-theme-menu { top: calc(100% + 8px); }
:root[data-ui] .fb-left-tabs button[aria-selected="true"], :root[data-ui] .fb-tabs [aria-selected="true"] { color: var(--fb-accent-ink); }
:root[data-ui] .fb-toolbox, :root[data-ui] .fb-inspector { background: var(--fb-panel); }

/* ---------- Find fields (forms/fields) ---------- */
.fb-field-results { display: grid; gap: 14px; }
.fb-field-form { background: var(--fb-panel); border: 1px solid var(--fb-line); border-radius: 12px; box-shadow: var(--fb-shadow); overflow: hidden; animation: fbRise 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) backwards; }
.fb-field-form-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--fb-line); background: color-mix(in srgb, var(--fb-accent) 5%, var(--fb-panel)); }
.fb-field-form-title { font-weight: 700; color: var(--fb-text); text-decoration: none; }
.fb-field-form-title:hover { color: var(--fb-accent-ink); }
.fb-field-form-meta { font-size: 0.78rem; color: var(--fb-muted); }
.fb-field-hits { list-style: none; margin: 0; padding: 4px; }
.fb-field-hit { display: grid; grid-template-columns: 128px minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 9px; color: inherit; text-decoration: none; transition: background 0.15s; }
.fb-field-hit:hover, .fb-field-hit:focus-visible { background: var(--fb-hover); outline: none; }
.fb-field-hit:focus-visible { box-shadow: inset 0 0 0 2px var(--fb-accent); }
.fb-type-chip { justify-self: start; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: var(--fb-accent-soft); color: var(--fb-accent-ink); }
.fb-hit-main { display: flex; flex-direction: column; min-width: 0; }
.fb-hit-label { font-weight: 600; font-size: 0.9rem; color: var(--fb-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-hit-where { font-size: 0.76rem; color: var(--fb-muted); }
.fb-hit-name { font: 500 0.8rem ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--fb-muted); padding: 2px 7px; border-radius: 6px; background: var(--fb-hover); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-hit-open { font-size: 0.8rem; font-weight: 700; color: var(--fb-accent-ink); opacity: 0; transform: translateX(-4px); transition: opacity 0.15s, transform 0.15s; }
.fb-field-hit:hover .fb-hit-open, .fb-field-hit:focus-visible .fb-hit-open { opacity: 1; transform: none; }
.fb-field-hits mark { background: color-mix(in srgb, #facc15 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.fb-field-more { padding: 4px 16px 12px; font-size: 0.8rem; color: var(--fb-muted); }
.fb-names-lead { font-size: 0.85rem; color: var(--fb-muted); margin-bottom: 12px; }
.fb-names-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.fb-names-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fb-name-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border: 1px solid var(--fb-line); border-radius: 8px; text-decoration: none; color: var(--fb-text); transition: border-color 0.15s, background 0.15s; }
.fb-name-chip:hover { border-color: var(--fb-accent); background: var(--fb-accent-soft); }
.fb-name-chip code { font: 600 0.82rem ui-monospace, SFMono-Regular, Consolas, monospace; }
.fb-name-chip span { font-size: 0.74rem; color: var(--fb-muted); }
.fb-names-label { font-size: 0.8rem; color: var(--fb-muted); }
.fb-names-flag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; background: #fef3c7; color: #92400e; }
[data-mode="dark"] .fb-names-flag { background: rgb(245 158 11 / 0.18); color: #fcd34d; }
@media (max-width: 640px) { .fb-field-hit { grid-template-columns: minmax(0, 1fr) auto; } .fb-type-chip { grid-column: 1 / -1; } .fb-hit-open { display: none; } }
/* builder: the field opened from Find fields flashes once */
.fb-item.is-found { animation: fbFound 1.2s ease-out 2; }
@keyframes fbFound { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 40% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--fb-accent) 45%, transparent); } }

/* ---------- Footer: a deep navy band mixed with the accent colours, light text ---------- */
:root[data-ui] .fb-footer {
    --fb-text: #f1f5f9; --fb-muted: #a7b4c8; --fb-line: rgb(255 255 255 / 0.1); --fb-canvas: rgb(255 255 255 / 0.07);
    position: relative; isolation: isolate; border-top: 0; color: var(--fb-muted); /* no overflow: hidden, so the Appearance pop-up can open above it */
    background:
        radial-gradient(520px 260px at 12% 0%, color-mix(in srgb, var(--fb-accent) 38%, transparent), transparent 70%),
        radial-gradient(460px 240px at 92% 100%, color-mix(in srgb, var(--fb-accent-2) 30%, transparent), transparent 70%),
        linear-gradient(160deg, #111a33, #0b1222 60%, #0a0f1d);
}
:root[data-ui][data-mode="dark"] .fb-footer { background:
        radial-gradient(520px 260px at 12% 0%, color-mix(in srgb, var(--fb-accent) 28%, transparent), transparent 70%),
        radial-gradient(460px 240px at 92% 100%, color-mix(in srgb, var(--fb-accent-2) 22%, transparent), transparent 70%),
        linear-gradient(160deg, #0b1224, #060a15 60%, #05080f); }
/* a bright gradient edge where the page ends */
:root[data-ui] .fb-footer::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--fb-accent), var(--fb-accent-2), var(--fb-accent)); opacity: 0.9; }
:root[data-ui] .fb-footer .fb-brand-name { color: #fff; }
:root[data-ui] .fb-footer-col h2 { color: #fff; }
:root[data-ui] .fb-footer-col a, :root[data-ui] .fb-footer-col button { transition: color 0.15s, transform 0.15s; }
:root[data-ui] .fb-footer-col a:hover, :root[data-ui] .fb-footer-col button:hover, :root[data-ui] .fb-footer-top:hover { color: color-mix(in srgb, var(--fb-accent-2) 45%, #ffffff); transform: translateX(2px); }
:root[data-ui] .fb-footer kbd { background: rgb(255 255 255 / 0.08); border-color: rgb(255 255 255 / 0.18); color: #e2e8f0; }
:root[data-ui] .fb-footer-bar b { color: #fff; }
:root[data-ui] .fb-footer-top { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: rgb(255 255 255 / 0.07); border: 1px solid rgb(255 255 255 / 0.12); color: #e2e8f0; }
:root[data-ui] .fb-footer-top:hover { background: rgb(255 255 255 / 0.12); transform: none; }
:root[data-ui] .fb-footer a:focus-visible, :root[data-ui] .fb-footer button:focus-visible { outline-color: color-mix(in srgb, var(--fb-accent-2) 50%, #fff); }

/* ---------- Dark mode: the fixed light tints used for status colours ---------- */
[data-mode="dark"] .fb-stat-icon.is-blue { background: rgb(59 130 246 / 0.18); color: #93c5fd; }
[data-mode="dark"] .fb-stat-icon.is-violet { background: rgb(139 92 246 / 0.2); color: #c4b5fd; }
[data-mode="dark"] .fb-stat-icon.is-green { background: rgb(34 197 94 / 0.18); color: #86efac; }
[data-mode="dark"] .fb-stat-icon.is-amber { background: rgb(245 158 11 / 0.18); color: #fcd34d; }
[data-mode="dark"] .fb-stat-icon.is-rose { background: rgb(244 63 94 / 0.18); color: #fda4af; }
[data-mode="dark"] .fb-badge.is-active { background: rgb(34 197 94 / 0.18); color: #86efac; }
[data-mode="dark"] .fb-badge.is-locked, [data-mode="dark"] .fb-badge.is-pinned { background: rgb(245 158 11 / 0.18); color: #fcd34d; }
[data-mode="dark"] .fb-badge.is-blocked { background: rgb(239 68 68 / 0.2); color: #fca5a5; }
[data-mode="dark"] .fb-alert.is-error { background: rgb(239 68 68 / 0.12); color: #fca5a5; border-color: rgb(239 68 68 / 0.35); }
[data-mode="dark"] .fb-alert.is-warning { background: rgb(245 158 11 / 0.12); color: #fcd34d; border-color: rgb(245 158 11 / 0.35); }
[data-mode="dark"] .fb-icon-act.is-danger:hover, [data-mode="dark"] .fb-icon-act.is-danger:focus-visible, [data-mode="dark"] .fb-btn-danger:hover,
[data-mode="dark"] .fb-menu-item.is-danger:hover, [data-mode="dark"] .fb-menu-item.is-danger:focus-visible { color: #fca5a5; border-color: rgb(239 68 68 / 0.45); background: rgb(239 68 68 / 0.14); }
[data-mode="dark"] .fb-menu-item.is-danger:hover svg, [data-mode="dark"] .fb-menu-item.is-danger:focus-visible svg { color: #fca5a5; }
[data-mode="dark"] .fb-icon-act.is-good:hover, [data-mode="dark"] .fb-icon-act.is-good:focus-visible { color: #86efac; border-color: rgb(34 197 94 / 0.45); background: rgb(34 197 94 / 0.14); }
[data-mode="dark"] .fb-pin:not(.is-on) { color: #475569; }
[data-mode="dark"] .fb-pin:hover { background: rgb(245 158 11 / 0.14); }
[data-mode="dark"] .fb-form-row.is-pinned { background: color-mix(in srgb, #f59e0b 7%, var(--fb-panel)); }
[data-mode="dark"] .fb-filter select option { color: var(--fb-text); background: var(--fb-panel); }
[data-mode="dark"] .tpl-checks .is-ok b { color: #34d399; }
[data-mode="dark"] .tpl-checks .is-low b { color: #fbbf24; }
[data-mode="dark"] .toast { border-top: 1px solid var(--fb-line); border-right: 1px solid var(--fb-line); border-bottom: 1px solid var(--fb-line); }
/* app.css colours these by the system setting; follow the chosen mode instead */
[data-mode="light"] .tpl-checks .is-ok b { color: #047857; }
[data-mode="light"] .tpl-checks .is-low b { color: #b45309; }

@media (max-width: 720px) { .fb-theme-menu { width: min(296px, calc(100vw - 24px)); } }
@media (prefers-reduced-motion: reduce) {
    .fb-stat, .fb-form-row, .fb-panel-block, .fb-user-table tbody tr, .fb-theme-menu { animation: none; }
    .fb-brand:hover .fb-brand-mark, .fb-stat:hover .fb-stat-icon, .fb-page .btn-primary:hover { transform: none; }
}
