/*
 * Products workspace (/account/products/): stats, search, filter chips, sort chips, card grid + table, floating bulk bar,
 * onboarding and the small dialogs. Markup: fm-products.php and includes/functions/products_ux.php; behaviour: includes/scripts/ux/20-products.js.
 * Uses the design tokens of fm-ui.css (--fm-*) so it follows the brand colour.
 */

.fmpl { --fmpl-ok: #15803d; --fmpl-low: #b45309; --fmpl-out: #b91c1c; --fmpl-na: #94a3b8; padding-bottom: 96px; }

/* ---------- stats strip ---------- */
.fmpl-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 4px 0 16px; }
.fmpl-stat { background: #fff; border: 1px solid var(--fm-line, #e4e8f0); border-radius: 14px; padding: 12px 16px; text-align: left; display: flex; flex-direction: column; gap: 1px; box-shadow: var(--fm-shadow-sm); font: inherit; color: inherit; }
.fmpl-stat small { color: var(--fm-muted, #6b7689); font-weight: 600; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; }
.fmpl-stat b { font: 700 22px/1.2 'Plus Jakarta Sans', Inter, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.fmpl-stat > span { color: var(--fm-muted, #6b7689); font-size: 12.5px; }
.fmpl-stat.is-link { cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.fmpl-stat.is-link:hover { border-color: var(--fm-primary-100, #c9e8f7); box-shadow: 0 6px 18px rgba(3, 105, 161, .1); transform: translateY(-1px); }
.fmpl-stat.is-warn b { color: var(--fmpl-low); }
.fmpl-stat.is-bad b { color: var(--fmpl-out); }
.fmpl-attn { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.fmpl-attn button { border: 1px solid var(--fm-line, #e4e8f0); background: var(--fm-bg, #f2f7fb); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; color: var(--fm-ink-2, #3a4560); }
.fmpl-attn button b { font: 700 12.5px Inter, sans-serif; color: var(--fm-ink, #1b2437); }
.fmpl-attn button:not(:disabled):hover { background: var(--fm-primary-50, #e9f6fd); border-color: var(--fm-primary-100, #c9e8f7); }
.fmpl-attn button:disabled { opacity: .45; cursor: default; }

/* ---------- toolbar ---------- */
.fmpl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.fmpl-search { position: relative; flex: 1 1 280px; max-width: 420px; }
.fmpl-search > i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--fm-muted, #6b7689); font-size: 13px; pointer-events: none; }
.fmpl-search input { width: 100%; height: 42px; border: 1px solid var(--fm-line, #e4e8f0); border-radius: 12px; background: #fff; padding: 0 40px 0 36px; font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.fmpl-search input:focus { outline: none; border-color: var(--fm-accent, #0ea5e9); box-shadow: 0 0 0 3px rgba(14, 165, 233, .18); }
.fmpl-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.fmpl-search input:focus + kbd, .fmpl-search input:not(:placeholder-shown) + kbd { display: none; }
.fmpl-search.is-busy > i { color: var(--fm-accent, #0ea5e9); animation: fmpl-pulse 1s ease-in-out infinite; }
@keyframes fmpl-pulse { 50% { opacity: .35; } }

.fmpl-chips { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 auto; }
.fmpl-chipwrap { position: relative; }
.fmpl-chip { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; background: #fff; border: 1px solid var(--fm-line, #e4e8f0); border-radius: 999px; font-size: 13.5px; font-weight: 500; color: var(--fm-ink-2, #3a4560); transition: background .15s, border-color .15s; white-space: nowrap; }
.fmpl-chip > i:first-child { color: var(--fm-muted, #6b7689); font-size: 12px; }
.fmpl-chip:hover { border-color: var(--fm-primary-100, #c9e8f7); background: var(--fm-primary-50, #e9f6fd); }
.fmpl-chip.is-on { background: var(--fm-primary-50, #e9f6fd); border-color: var(--fm-primary-100, #c9e8f7); color: var(--fm-primary-600, #075985); font-weight: 600; }
.fmpl-chip.is-on > i:first-child { color: var(--fm-primary, #0369a1); }
.fmpl-caret { font-size: 9px; opacity: .6; }

.fmpl-pop { position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; min-width: 250px; max-width: min(340px, 92vw); max-height: min(60vh, 420px); overflow: auto; background: #fff; border: 1px solid var(--fm-line, #e4e8f0); border-radius: 14px; box-shadow: var(--fm-shadow-lg); padding: 6px; }
.fmpl-pop[hidden] { display: none; }
.fmpl-pop h4 { margin: 8px 10px 4px; font: 600 11.5px Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--fm-muted, #6b7689); }
.fmpl-opt { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 9px; font-size: 14px; color: var(--fm-ink, #1b2437); }
.fmpl-opt:hover { background: var(--fm-primary-50, #e9f6fd); }
.fmpl-opt.is-on { background: var(--fm-primary-50, #e9f6fd); color: var(--fm-primary-600, #075985); font-weight: 600; }
.fmpl-opt .n { margin-left: auto; color: var(--fm-muted, #6b7689); font-size: 12px; font-variant-numeric: tabular-nums; }
.fmpl-opt .fmpl-dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.fmpl-pop .fmpl-form { padding: 8px 10px 10px; display: grid; gap: 8px; }
.fmpl-pop .fmpl-form label { font-size: 12.5px; font-weight: 600; color: var(--fm-ink-2, #3a4560); }
.fmpl-viewrow { display: flex; align-items: center; }
.fmpl-viewrow .fmpl-opt { flex: 1; }
.fmpl-viewrow .fmpl-x { border: 0; background: none; color: var(--fm-muted, #6b7689); padding: 6px 9px; border-radius: 8px; }
.fmpl-viewrow .fmpl-x:hover { background: #fee2e2; color: #b91c1c; }

.fmpl-viewtoggle { display: inline-flex; border: 1px solid var(--fm-line, #e4e8f0); border-radius: 12px; background: #fff; padding: 3px; margin-left: auto; }
.fmpl-viewtoggle button { border: 0; background: none; width: 38px; height: 32px; border-radius: 9px; color: var(--fm-muted, #6b7689); }
.fmpl-viewtoggle button.is-on { background: var(--fm-primary-50, #e9f6fd); color: var(--fm-primary, #0369a1); }

.fmpl-sortrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; }
.fmpl-sortlabel { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--fm-muted, #6b7689); margin-right: 4px; }
.fmpl-sort { border: 1px solid transparent; background: none; border-radius: 999px; padding: 4px 11px; font-size: 13px; color: var(--fm-ink-2, #3a4560); }
.fmpl-sort i { font-size: 10px; margin-left: 5px; opacity: 0; }
.fmpl-sort:hover { background: #fff; border-color: var(--fm-line, #e4e8f0); }
.fmpl-sort.is-on { background: #fff; border-color: var(--fm-primary-100, #c9e8f7); color: var(--fm-primary-600, #075985); font-weight: 600; }
.fmpl-sort.is-on i { opacity: 1; }
.fmpl-sortspacer { flex: 1; }
.fmpl-total { color: var(--fm-muted, #6b7689); font-size: 13px; }

.fmpl-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; align-items: center; }
.fmpl-pills[hidden] { display: none; }
.fmpl-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--fm-primary-50, #e9f6fd); color: var(--fm-primary-600, #075985); border-radius: 999px; padding: 3px 5px 3px 11px; font-size: 13px; font-weight: 500; }
.fmpl-pill button { border: 0; background: rgba(3, 105, 161, .12); color: inherit; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; line-height: 1; }
.fmpl-pill button:hover { background: rgba(3, 105, 161, .25); }
.fmpl-link { border: 0; background: none; color: var(--fm-primary, #0369a1); font-weight: 600; padding: 0 4px; font-size: 13px; }
.fmpl-link:hover { text-decoration: underline; }

/* ---------- card grid ---------- */
.fmpl-results { min-height: 160px; transition: opacity .15s; }
.fmpl-results[aria-busy="true"] { opacity: .55; }
.fmpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: 14px; }
.fmpl-card { position: relative; background: #fff; border: 1px solid var(--fm-line, #e4e8f0); border-radius: 16px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; box-shadow: var(--fm-shadow-sm); transition: transform .15s, box-shadow .15s, border-color .15s; }
.fmpl-card:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(3, 105, 161, .13); border-color: var(--fm-primary-100, #c9e8f7); }
.fmpl-card:focus-visible, .fmpl-row:focus-visible { outline: 3px solid rgba(14, 165, 233, .55); outline-offset: 1px; }
.fmpl-card.is-selected { border-color: var(--fm-primary, #0369a1); box-shadow: 0 0 0 2px var(--fm-primary, #0369a1); }
.fmpl-card.is-archived { opacity: .7; }
.fmpl-pic { position: relative; aspect-ratio: 4 / 3; background: #eef2f7; overflow: hidden; }
.fmpl-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fmpl-initials { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 800 34px 'Plus Jakarta Sans', Inter, sans-serif; letter-spacing: .02em; color: hsl(var(--h, 205) 55% 32%); background: linear-gradient(135deg, hsl(var(--h, 205) 80% 94%), hsl(var(--h, 205) 70% 86%)); }
.fmpl-badges { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.fmpl-badge { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 700; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.fmpl-badge.is-out { background: #fee2e2; color: #991b1b; }
.fmpl-badge.is-low { background: #fef3c7; color: #92400e; }
.fmpl-badge.is-info { background: #e0f2fe; color: #075985; }
.fmpl-badge.is-archived { background: #e2e8f0; color: #475569; }
.fmpl-body { padding: 11px 14px 13px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.fmpl-name { margin: 0; font: 650 14.5px/1.3 'Plus Jakarta Sans', Inter, sans-serif; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.fmpl-sub { color: var(--fm-muted, #6b7689); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fmpl-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.fmpl-price { display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap; min-width: 0; }
.fmpl-price b { font: 750 17px 'Plus Jakarta Sans', Inter, sans-serif; font-variant-numeric: tabular-nums; }
.fmpl-price small { color: var(--fm-muted, #6b7689); font-size: 12px; }
.fmpl-margin { display: inline-block; border-radius: 6px; padding: 0 6px; font-size: 11.5px; font-weight: 700; background: var(--fm-neutral-bg, #eef1f6); color: var(--fm-ink-2, #3a4560); }
.fmpl-margin.is-good { background: #dcfce7; color: #166534; }
.fmpl-margin.is-ok { background: #e0f2fe; color: #075985; }
.fmpl-margin.is-thin { background: #fef3c7; color: #92400e; }
.fmpl-margin.is-neg { background: #fee2e2; color: #991b1b; }

/* stock-health ring */
.fmpl-ring { position: relative; flex: 0 0 40px; width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; }
.fmpl-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.fmpl-ring circle { fill: none; stroke-width: 3.6; }
.fmpl-ring .bg { stroke: #e5e9f0; }
.fmpl-ring .fg { stroke: var(--fmpl-ok); stroke-linecap: round; transition: stroke-dasharray .4s; }
.fmpl-ring.is-low .fg { stroke: #f59e0b; }
.fmpl-ring.is-out .fg { stroke: var(--fmpl-out); stroke-opacity: 0; }
.fmpl-ring b { position: relative; font: 700 11px Inter, sans-serif; font-variant-numeric: tabular-nums; max-width: 30px; overflow: hidden; text-overflow: ellipsis; }
.fmpl-ring.is-out b { color: var(--fmpl-out); }
.fmpl-ring.is-na b { color: var(--fmpl-na); font-size: 15px; }

/* selection check */
.fmpl-check { position: absolute; z-index: 3; top: 8px; left: 8px; margin: 0; cursor: pointer; opacity: 0; transition: opacity .12s; }
.fmpl-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.fmpl-check span { display: inline-block; width: 24px; height: 24px; border-radius: 8px; background: rgba(255, 255, 255, .96); border: 2px solid #b6c1d1; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); position: relative; }
.fmpl-check input:checked + span { background: var(--fm-primary, #0369a1); border-color: var(--fm-primary, #0369a1); }
.fmpl-check input:checked + span::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.fmpl-check input:focus-visible + span { outline: 3px solid rgba(14, 165, 233, .55); }
.fmpl-card:hover .fmpl-check, .fmpl-card:focus-within .fmpl-check, .fmpl-card.is-selected .fmpl-check, .fmpl.has-sel .fmpl-check, .fmpl-check:has(input:checked) { opacity: 1; }
@media (hover: none) { .fmpl-check { opacity: 1; } }

/* ---------- table ---------- */
.fmpl-tablewrap { background: #fff; border: 1px solid var(--fm-line, #e4e8f0); border-radius: 16px; overflow-x: auto; box-shadow: var(--fm-shadow-sm); }
.fmpl-table { width: 100%; border-collapse: collapse; min-width: 880px; }
.fmpl-table th { text-align: left; font: 600 11.5px Inter, sans-serif; letter-spacing: .05em; text-transform: uppercase; color: var(--fm-muted, #6b7689); padding: 12px 12px; border-bottom: 1px solid var(--fm-line, #e4e8f0); background: #fbfcfe; position: sticky; top: 0; white-space: nowrap; }
.fmpl-table th[data-sort] { cursor: pointer; user-select: none; }
.fmpl-table th[data-sort]:hover { color: var(--fm-primary, #0369a1); }
.fmpl-table th.is-sorted { color: var(--fm-primary, #0369a1); }
.fmpl-table th.is-sorted::after { content: " \2193"; }
.fmpl-table th.is-sorted.is-asc::after { content: " \2191"; }
.fmpl-table td { padding: 10px 12px; border-bottom: 1px solid var(--fm-line-2, #eef1f6); vertical-align: middle; }
.fmpl-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fmpl-table th.num { text-align: right; }
.fmpl-row { cursor: pointer; }
.fmpl-row:hover { background: var(--fm-primary-50, #e9f6fd); }
.fmpl-row.is-selected { background: #dff1fb; }
.fmpl-row.is-archived .fm-cell-main { color: var(--fm-muted, #6b7689); }
.fmpl-table .fmpl-c-sel { width: 44px; padding-right: 0; }
.fmpl-table .fmpl-check { position: static; opacity: 1; display: inline-block; }
.fmpl-table .fmpl-check span { box-shadow: none; }
.fmpl-table .fm-thumb-fallback { background: hsl(var(--h, 205) 70% 90%); color: hsl(var(--h, 205) 55% 30%); }
.fmpl-edit { cursor: text; }
.fmpl-edit:hover { background: rgba(14, 165, 233, .09); box-shadow: inset 0 -2px 0 var(--fm-accent, #0ea5e9); }
.fmpl-edit input { width: 96px; text-align: right; border: 1px solid var(--fm-accent, #0ea5e9); border-radius: 8px; padding: 4px 8px; font: inherit; box-shadow: 0 0 0 3px rgba(14, 165, 233, .18); }
.fmpl-edit.is-saving { opacity: .5; }
.fmpl-edit.is-flash { animation: fmpl-flash 1.2s; }
@keyframes fmpl-flash { 0% { background: #bbf7d0; } 100% { background: transparent; } }
.fmpl-bar { display: inline-block; width: 46px; height: 7px; background: #e5e9f0; border-radius: 99px; overflow: hidden; vertical-align: middle; margin-right: 6px; }
.fmpl-bar i { display: block; height: 100%; background: var(--fmpl-ok); border-radius: 99px; }
.fmpl-bar.is-low i { background: #f59e0b; }
.fmpl-bar.is-out i { background: var(--fmpl-out); }
.fmpl-qty.is-out { color: var(--fmpl-out); }
.fmpl-qty.is-low { color: var(--fmpl-low); }
.fmpl-more { border: 0; background: none; width: 30px; height: 30px; border-radius: 8px; color: var(--fm-muted, #6b7689); }
.fmpl-more:hover { background: #fff; color: var(--fm-primary, #0369a1); box-shadow: 0 0 0 1px var(--fm-line, #e4e8f0); }
.fmpl-c-act { width: 40px; text-align: right; }

.fmpl-loadmore { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 18px 0; }
.fmpl-loadmore[hidden] { display: none; }
.fmpl-sentinel { height: 1px; width: 1px; }
.fmpl-empty[hidden] { display: none; }
.fmpl-hint { text-align: center; color: var(--fm-muted, #6b7689); font-size: 12.5px; margin-top: 18px; }
@media (max-width: 760px) { .fmpl-hint { display: none; } }

/* skeleton cards while the first answer is on its way */
.fmpl-sk { height: 270px; border-radius: 16px; }

/* ---------- floating bulk bar ---------- */
.fmpl-bulk { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 1050; display: flex; align-items: center; gap: 14px; background: #0c2d44; color: #fff; border-radius: 18px; padding: 10px 12px 10px 18px; box-shadow: 0 18px 48px rgba(8, 47, 73, .45); max-width: calc(100vw - 24px); animation: fmpl-up .18s ease-out; }
.fmpl-bulk[hidden] { display: none; }
@keyframes fmpl-up { from { opacity: 0; transform: translate(-50%, 14px); } }
.fmpl-bulk-count { white-space: nowrap; font-size: 14px; }
.fmpl-bulk-count .fmpl-link { color: #7dd3fc; }
.fmpl-bulk-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.fmpl-bulk-actions button { border: 0; background: rgba(255, 255, 255, .08); color: #fff; border-radius: 11px; padding: 8px 12px; font-size: 13.5px; display: inline-flex; gap: 7px; align-items: center; }
.fmpl-bulk-actions button:hover { background: rgba(255, 255, 255, .18); }
.fmpl-bulk-actions button[hidden] { display: none; }
.fmpl-bulk-actions button.is-danger:hover { background: #b91c1c; }
.fmpl-bulk-x { border: 0; background: none; color: #bfd6e6; width: 34px; height: 34px; border-radius: 50%; }
.fmpl-bulk-x:hover { background: rgba(255, 255, 255, .15); color: #fff; }

/* ---------- onboarding ---------- */
.fmpl-onboard { background: #fff; border: 1px solid var(--fm-line, #e4e8f0); border-radius: 20px; padding: 34px 28px; box-shadow: var(--fm-shadow-sm); }
.fmpl-onboard-hero { text-align: center; max-width: 560px; margin: 0 auto 26px; }
.fmpl-onboard-icon { display: inline-flex; width: 64px; height: 64px; border-radius: 20px; align-items: center; justify-content: center; font-size: 28px; background: var(--fm-primary-50, #e9f6fd); color: var(--fm-primary, #0369a1); margin-bottom: 12px; }
.fmpl-onboard-hero h2 { font: 750 24px 'Plus Jakarta Sans', Inter, sans-serif; margin: 0 0 6px; }
.fmpl-onboard-hero p { color: var(--fm-muted, #6b7689); margin: 0; }
.fmpl-onboard-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.fmpl-step { display: flex; flex-direction: column; gap: 4px; text-align: left; background: var(--fm-bg, #f2f7fb); border: 1px solid var(--fm-line-2, #eef1f6); border-radius: 16px; padding: 18px; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s, border-color .15s; font: inherit; }
.fmpl-step:hover { transform: translateY(-2px); border-color: var(--fm-primary-100, #c9e8f7); box-shadow: 0 10px 24px rgba(3, 105, 161, .12); color: inherit; }
.fmpl-step > i { font-size: 22px; color: var(--fm-primary, #0369a1); margin-bottom: 6px; }
.fmpl-step b { font: 700 15px 'Plus Jakarta Sans', Inter, sans-serif; }
.fmpl-step span { color: var(--fm-muted, #6b7689); font-size: 13px; }

/* ---------- small dialogs of the list (category, price change, labels) ---------- */
.fmx-modal__box.fmpl-dlg { width: min(520px, 100%); }
.fmpl-dlg .fmpl-field { margin: 0 0 12px; }
.fmpl-dlg label.lbl { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.fmpl-dlg .fmpl-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fmpl-preview { background: var(--fm-bg, #f2f7fb); border-radius: 12px; padding: 10px 12px; font-size: 13px; min-height: 44px; }
.fmpl-preview table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.fmpl-preview td { padding: 3px 0; }
.fmpl-preview td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.fmpl-preview .arrow { color: var(--fm-muted, #6b7689); padding: 0 6px; }
.fmpl-dlg .fmx-modal__actions { margin-top: 6px; }
.fmpl-dlg-help { color: var(--fm-muted, #6b7689); font-size: 12.5px; margin: 4px 0 0; }

/* actions menu of a table row */
.fmpl-menu { position: fixed; z-index: 1060; background: #fff; border: 1px solid var(--fm-line, #e4e8f0); border-radius: 12px; box-shadow: var(--fm-shadow-lg); padding: 5px; min-width: 190px; }
.fmpl-menu button, .fmpl-menu a { display: flex; gap: 9px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 8px 11px; border-radius: 8px; font-size: 14px; color: var(--fm-ink, #1b2437); text-decoration: none; }
.fmpl-menu button:hover, .fmpl-menu a:hover { background: var(--fm-primary-50, #e9f6fd); }
.fmpl-menu i { width: 16px; text-align: center; color: var(--fm-muted, #6b7689); }

/* drawer additions: prev / next product */
.fmx-drawer__panel > header .fmpl-nav { display: inline-flex; gap: 6px; margin-right: auto; margin-left: 12px; }
.fmx-drawer__panel > header .fmpl-nav button { background: #f1f5f9; border: 0; width: 32px; height: 32px; border-radius: 9px; color: #334155; }
.fmx-drawer__panel > header .fmpl-nav button:disabled { opacity: .35; }

/* ---------- small screens ---------- */
@media (max-width: 900px) { .fmpl-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
	.fmpl { padding-bottom: 120px; }
	.fmpl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.fmpl-body { padding: 9px 10px 11px; }
	.fmpl-name { font-size: 13.5px; }
	.fmpl-initials { font-size: 26px; }
	.fmpl-price b { font-size: 15px; }
	.fmpl-search { max-width: none; flex-basis: 100%; }
	.fmpl-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin: 0 -2px; flex-basis: 100%; scrollbar-width: none; }
	.fmpl-chips::-webkit-scrollbar { display: none; }
	.fmpl-pop { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; max-width: none; max-height: 70vh; }
	.fmpl-viewtoggle { margin-left: 0; }
	.fmpl-bulk { left: 8px; right: 8px; bottom: 8px; transform: none; border-radius: 16px; flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
	@keyframes fmpl-up { from { opacity: 0; transform: translateY(14px); } }
	.fmpl-bulk-actions { flex: 1 1 100%; }
	.fmpl-bulk-actions button span { display: none; }
	.fmpl-bulk-actions button { padding: 10px 14px; }
	.fmpl-bulk-x { position: absolute; top: 6px; right: 6px; }
	.fmpl-onboard { padding: 24px 16px; }
	.fmpl-stat b { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) { .fmpl-card, .fmpl-stat, .fmpl-step, .fmpl-results, .fmpl-ring .fg { transition: none !important; } .fmpl-bulk { animation: none; } .fmpl-search.is-busy > i { animation: none; } }

/* the "..." button on a card */
.fmpl-card-more { position: absolute; z-index: 3; top: 8px; right: 8px; background: rgba(255, 255, 255, .96); box-shadow: 0 1px 4px rgba(0, 0, 0, .18); opacity: 0; transition: opacity .12s; }
.fmpl-card:hover .fmpl-card-more, .fmpl-card:focus-within .fmpl-card-more { opacity: 1; }
@media (hover: none) { .fmpl-card-more { opacity: 1; } }

/* a card / row that was just refreshed after an edit */
.fmpl-flash { animation: fmpl-flashbg 1.4s ease-out; }
@keyframes fmpl-flashbg { 0% { box-shadow: 0 0 0 3px rgba(34, 197, 94, .6); } 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0); } }
@media (prefers-reduced-motion: reduce) { .fmpl-flash { animation: none; } }

/* ---------- import wizard (drawer) ---------- */
.fmimp { padding: 20px 24px 28px; }
.fmimp-steps { display: flex; gap: 6px; list-style: none; margin: 0 0 22px; padding: 0; }
.fmimp-steps li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fm-muted, #6b7689); font-weight: 600; }
.fmimp-steps li span { width: 24px; height: 24px; border-radius: 50%; background: #e5e9f0; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; color: #475569; }
.fmimp-steps li.is-on { color: var(--fm-primary, #0369a1); }
.fmimp-steps li.is-on span { background: var(--fm-primary, #0369a1); color: #fff; }
.fmimp-steps li.is-done span { background: #22c55e; color: #fff; }
.fmimp-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 38px 20px; border: 2px dashed var(--fm-primary-100, #c9e8f7); background: var(--fm-primary-50, #e9f6fd); border-radius: 18px; cursor: pointer; margin: 0 0 16px; transition: border-color .15s, background .15s; }
.fmimp-drop i { font-size: 34px; color: var(--fm-primary, #0369a1); }
.fmimp-drop b { font: 700 16px 'Plus Jakarta Sans', Inter, sans-serif; }
.fmimp-drop span, .fmimp-drop em { color: var(--fm-muted, #6b7689); font-size: 13px; font-style: normal; }
.fmimp-drop:hover, .fmimp-drop.is-over { border-color: var(--fm-accent, #0ea5e9); background: #dff1fb; }
.fmimp-tips { color: var(--fm-ink-2, #3a4560); font-size: 13.5px; padding-left: 18px; margin: 0 0 14px; }
.fmimp-tips li { margin: 3px 0; }
.fmimp-file { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--fm-line, #e4e8f0); border-radius: 14px; margin-bottom: 14px; }
.fmimp-file > i { font-size: 26px; color: var(--fm-primary, #0369a1); }
.fmimp-file div { flex: 1; min-width: 0; }
.fmimp-file b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmimp-file span { color: var(--fm-muted, #6b7689); font-size: 13px; }
.fmimp-note { background: var(--fm-primary-50, #e9f6fd); color: var(--fm-primary-600, #075985); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; margin: 0 0 14px; }
.fmimp-note.is-warn { background: #fef3c7; color: #92400e; }
.fmimp-mode { display: grid; gap: 8px; margin-bottom: 16px; }
.fmimp-mode label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--fm-line, #e4e8f0); border-radius: 12px; padding: 10px 12px; cursor: pointer; margin: 0; }
.fmimp-mode label:has(input:checked) { border-color: var(--fm-primary, #0369a1); background: var(--fm-primary-50, #e9f6fd); }
.fmimp-mode small { display: block; color: var(--fm-muted, #6b7689); }
.fmimp-map { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fmimp-map th { text-align: left; font: 600 11.5px Inter, sans-serif; letter-spacing: .05em; text-transform: uppercase; color: var(--fm-muted, #6b7689); padding: 8px 6px; border-bottom: 1px solid var(--fm-line, #e4e8f0); }
.fmimp-map td { padding: 6px; border-bottom: 1px solid var(--fm-line-2, #eef1f6); vertical-align: middle; }
.fmimp-map td:nth-child(2) { width: 44%; }
.fmimp-ex { color: var(--fm-muted, #6b7689); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fmimp-sep td { font-weight: 700; padding-top: 14px; color: var(--fm-ink-2, #3a4560); border-bottom: 0; }
.fmimp-map abbr { color: var(--fm-danger, #b91c1c); text-decoration: none; }
.fmimp-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; position: sticky; bottom: 0; background: linear-gradient(transparent, #fff 30%); padding-top: 14px; }
.fmimp-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.fmimp-tile { background: var(--fm-bg, #f2f7fb); border-radius: 14px; padding: 14px; text-align: center; }
.fmimp-tile b { display: block; font: 800 26px 'Plus Jakarta Sans', Inter, sans-serif; }
.fmimp-tile span { color: var(--fm-muted, #6b7689); font-size: 13px; }
.fmimp-tile.is-ok b { color: #15803d; }
.fmimp-tile.is-warn b { color: #b45309; }
.fmimp-h { font: 700 14px 'Plus Jakarta Sans', Inter, sans-serif; margin: 16px 0 6px; }
.fmimp-errs { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; border: 1px solid var(--fm-line, #e4e8f0); border-radius: 12px; }
.fmimp-errs li { padding: 8px 12px; border-bottom: 1px solid var(--fm-line-2, #eef1f6); font-size: 13px; }
.fmimp-errs li:last-child { border-bottom: 0; }
.fmimp-done { text-align: center; padding: 18px 0 6px; }
.fmimp-doneicon { display: inline-flex; width: 60px; height: 60px; border-radius: 50%; background: #dcfce7; color: #15803d; align-items: center; justify-content: center; font-size: 26px; margin-bottom: 8px; }
.fmimp-done h3 { font: 750 22px 'Plus Jakarta Sans', Inter, sans-serif; margin: 0 0 4px; }
@media (max-width: 640px) { .fmimp { padding: 14px 14px 24px; } .fmimp-steps li { font-size: 0; gap: 0; justify-content: center; } .fmimp-steps li span { font-size: 12px; } .fmimp-map td:nth-child(3), .fmimp-map th:nth-child(3) { display: none; } .fmimp-map td:nth-child(2) { width: 55%; } }

/* phones: the numbers become one swipeable row so the products come first; search and layout toggle share a line */
@media (max-width: 720px) {
	.fmpl-stats { display: flex; overflow-x: auto; gap: 10px; margin: 0 -2px 12px; padding: 2px; scroll-snap-type: x proximity; scrollbar-width: none; }
	.fmpl-stats::-webkit-scrollbar { display: none; }
	.fmpl-stat { flex: 0 0 auto; min-width: 150px; max-width: 220px; scroll-snap-align: start; padding: 10px 14px; }
	.fmpl-stat > span { font-size: 12px; }
	.fmpl-search { flex: 1 1 0; min-width: 0; order: 1; }
	.fmpl-viewtoggle { order: 2; margin-left: 0; }
	.fmpl-chips { order: 3; }
	.fmpl-toolbar { gap: 8px; }
}
@media (max-width: 720px) {
	.fmpl-sortrow { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
	.fmpl-sortrow::-webkit-scrollbar { display: none; }
	.fmpl-sort, .fmpl-sortlabel { white-space: nowrap; flex: 0 0 auto; }
	.fmpl-sortspacer { display: none; }
	.fmpl-total { flex: 0 0 auto; white-space: nowrap; padding-left: 10px; }
}
