/*
 * FieldOps UI polish — shared, page-agnostic component styles.
 *
 * Linked from resources/views/partials/theme-head.blade.php right after fo-theme.css, so every panel
 * (company, super admin, customer portal) picks it up. Pages keep their own inline <style>; the rules
 * here either style things pages never touch (::file-selector-button, injected .fo-* nodes) or use a
 * slightly higher specificity (html …) so the shared look wins over the per-page copies of the same
 * vocabulary (.modal, .dialog, .field, .row2/.row3, .check, .dlg-actions, fieldset/legend).
 * public/js/fo-ui.js adds the modal header/body/footer structure (.fo-dlg-*) these rules target.
 * Colours come from the --fo-* tokens (fo-theme.css redefines them for dark mode).
 */

/* ---------------------------------------------------------------- file inputs */
input[type="file"] {
    box-sizing: border-box;
    max-width: 100%;
    padding: 5px;
    border: 1px solid var(--fo-border-strong, #d5dde8);
    border-radius: 10px;
    background-color: var(--fo-input-bg, #fff);
    color: var(--fo-muted, #64748b);
    font: inherit;
    font-size: 13px;
    line-height: 1.4;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
}
input[type="file"]:hover { border-color: #94a3b8; }
input[type="file"]:focus-visible { outline: none; border-color: var(--fo-accent, #2563eb); box-shadow: var(--fo-ring, 0 0 0 3px #2563eb2e); }
input[type="file"]:disabled { opacity: .55; cursor: not-allowed; }
input[type="file"]::file-selector-button {
    margin-block: 0;
    margin-inline: 0 10px;
    padding: 7px 12px 7px 32px;
    border: 1px solid var(--fo-border-strong, #d5dde8);
    border-radius: 8px;
    background: var(--fo-muted-bg, #f1f5f9) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='m17 8-5-5-5 5'/%3E%3Cpath d='M12 3v12'/%3E%3C/svg%3E") no-repeat left 11px center / 15px 15px;
    color: var(--fo-text-2, #334155);
    font: 600 12.5px var(--fo-font, var(--fo-font-ui, system-ui, sans-serif));
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}
input[type="file"]:hover::file-selector-button { background-color: var(--fo-border-strong, #e2e8f0); }
input[type="file"]:disabled::file-selector-button { cursor: not-allowed; }
html[dir="rtl"] input[type="file"]::file-selector-button { padding: 7px 32px 7px 12px; background-position: right 11px center; }
html[data-theme="dark"] input[type="file"]:hover { border-color: #475569; }
html[data-theme="dark"] input[type="file"]::file-selector-button {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='m17 8-5-5-5 5'/%3E%3Cpath d='M12 3v12'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- form fields */
/* Help text on one field must not stretch the controls in neighbouring fields. */
html .field { min-width: 0; align-content: start; gap: 6px; font-size: 13px; font-weight: 500; color: var(--fo-text-2, #334155); }
html .field :is(input:not([type="checkbox"], [type="radio"], [type="file"], [type="range"], [type="color"], [type="hidden"]), select, textarea) {
    box-sizing: border-box;
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px solid var(--fo-border-strong, #d5dde8);
    border-radius: 8px;
    background-color: var(--fo-input-bg, var(--fo-surface, #fff));
    color: var(--fo-text, #0f172a);
    font: 400 14px/1.4 var(--fo-font, var(--fo-font-ui, system-ui, sans-serif));
    box-shadow: 0 1px 2px #0f172a0a;
    transition: border-color .15s, box-shadow .15s, background-color .15s;
}
html .field textarea:not([data-fo-no-min]) { min-height: 120px; resize: vertical; line-height: 1.5; }
html .field :is(input, select, textarea):hover:not(:disabled, [readonly], :focus) { border-color: #a3b1c4; }
html .field :is(input, select, textarea):focus { outline: none; border-color: var(--fo-accent, #2563eb); box-shadow: var(--fo-ring, 0 0 0 3px #2563eb2e); }
html .field :is(input, textarea)::placeholder { color: #94a3b8; opacity: 1; }
html .field :is(input, select, textarea):disabled { background-color: var(--fo-muted-bg, #f1f5f9); color: var(--fo-muted, #64748b); cursor: not-allowed; box-shadow: none; }
html .field :is(input, textarea)[readonly] { background-color: var(--fo-muted-bg, #f8fafc); color: var(--fo-text-3, #475569); }
html .field :is(input, select, textarea):user-invalid { border-color: #ef4444; }
html .field :is(input, select, textarea):user-invalid:focus { box-shadow: 0 0 0 3px #ef444433; }
html .field select:not([multiple], [size]) {
    appearance: none;
    -webkit-appearance: none;
    padding-inline-end: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
    cursor: pointer;
}
html[dir="rtl"] .field select:not([multiple], [size]) { background-position: left 12px center; }
html .field select:is([multiple], [size]) { padding: 6px; }
html .field input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
html .field input[type="number"]::-webkit-inner-spin-button,
html .field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
html .field .fo-err { font-weight: 500; }
html[data-theme="dark"] .field :is(input, select, textarea):hover:not(:disabled, [readonly], :focus) { border-color: #475569; }
html[data-theme="dark"] .field :is(input, textarea)::placeholder { color: #64748b; }
html[data-theme="dark"] .field select:not([multiple], [size]) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
html :is(.row2, .row3) { column-gap: 14px; align-items: start; }
@media (max-width: 640px) { html :is(.row2, .row3) { grid-template-columns: minmax(0, 1fr); } }

/* Control wrapper injected by fo-ui.js (character counter, number stepper). */
.fo-ctl { position: relative; display: block; min-width: 0; }
.fo-count { position: absolute; inset-inline-end: 12px; bottom: 9px; font: 500 11px/1 var(--fo-font, var(--fo-font-ui, system-ui, sans-serif)); color: var(--fo-muted, #94a3b8); pointer-events: none; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.fo-count.near { color: var(--fo-warn-fg, #b45309); }
.fo-count.full { color: var(--fo-bad-fg, #b91c1c); }
html .field .fo-ctl.has-count > textarea { padding-bottom: 26px; }
html .field .fo-ctl.has-count > input { padding-inline-end: 64px; }
.fo-ctl.has-count > input ~ .fo-count { top: 50%; bottom: auto; transform: translateY(-50%); opacity: 0; transition: opacity .15s; }
.fo-ctl.has-count:focus-within > input ~ .fo-count, .fo-ctl.has-count > input ~ .fo-count.near, .fo-ctl.has-count > input ~ .fo-count.full { opacity: 1; }
html .field .fo-ctl.has-step > input { padding-inline-end: 72px; }
.fo-step { position: absolute; inset-inline-end: 5px; top: 50%; transform: translateY(-50%); display: flex; gap: 2px; }
html .fo-step button {
    display: grid; place-items: center; width: 30px; height: 30px; padding: 0; margin: 0; border: 0; border-radius: 8px;
    background: transparent; color: var(--fo-text-3, #475569); font: 600 16px/1 var(--fo-font, var(--fo-font-ui, system-ui, sans-serif)); cursor: pointer; box-shadow: none;
}
html .fo-step button:hover { background: var(--fo-muted-bg, #f1f5f9); color: var(--fo-text, #0f172a); }
html .fo-step button:disabled { opacity: .35; cursor: not-allowed; background: transparent; }
html .fo-step button svg { width: 15px; height: 15px; }

/* ---------------------------------------------------------------- modals */
html .modal { -webkit-backdrop-filter: blur(6px) saturate(120%); backdrop-filter: blur(6px) saturate(120%); background-color: #0f172a5c; }
html .modal.open { animation: fo-fade .18s ease-out; }
html .modal.open > .dialog { animation: fo-pop .22s cubic-bezier(.2, .9, .3, 1.15); }
@keyframes fo-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fo-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fo-sheet { from { transform: translateY(100%); } to { transform: none; } }

html .modal > .dialog.fo-dlg {
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    padding: 0;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--fo-border, transparent);
    box-shadow: var(--fo-shadow-lg, 0 25px 50px -12px #0f172a59), 0 0 0 1px #0f172a0d;
}
html .modal > .dialog.fo-dlg.fo-w-md { width: min(560px, calc(100% - 32px)); }
html .modal > .dialog.fo-dlg.fo-w-lg { width: min(760px, calc(100% - 32px)); }

.fo-dlg-header {
    position: relative;
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--fo-border, #e8edf4);
    background: var(--fo-surface, #fff);
}
.fo-dlg-chip { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--fo-info-bg, #eff6ff); color: var(--fo-link, var(--fo-accent, #2563eb)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fo-accent, #2563eb) 14%, transparent); }
.fo-dlg-chip svg { width: 19px; height: 19px; }
.fo-dlg-titles { flex: 1; min-width: 0; display: grid; gap: 2px; }
html .fo-dlg-header h2, html .fo-dlg-header h3 { margin: 0; font-size: 18px; font-weight: 600; line-height: 1.35; letter-spacing: -.01em; color: var(--fo-text, #0f172a); overflow-wrap: anywhere; }
html .fo-dlg-header .fo-dlg-sub { margin: 0; font-size: 13px; font-weight: 400; line-height: 1.45; color: var(--fo-muted, #64748b); }
html .fo-dlg-header .fo-dlg-sub:empty { display: none; }
html .fo-dlg .fo-x {
    flex: none; align-self: flex-start; display: grid; place-items: center; width: 36px; height: 36px; margin: -2px; padding: 0;
    border: 0; border-radius: 10px; background: transparent; color: var(--fo-muted, #64748b); box-shadow: none; cursor: pointer;
    transition: background-color .15s, color .15s;
}
html .fo-dlg .fo-x:hover { background: var(--fo-muted-bg, #f1f5f9); color: var(--fo-text, #0f172a); }
html .fo-dlg .fo-x:focus-visible { outline: 2px solid var(--fo-accent, #2563eb); outline-offset: 1px; }
.fo-dlg .fo-x svg { width: 18px; height: 18px; }

.fo-dlg-pre { flex: none; max-height: 30vh; overflow: auto; padding: 16px 24px 0; }
.fo-dlg-pre > :first-child { margin-top: 0; }
.fo-dlg-pre > :last-child { margin-bottom: 0; }
html .fo-dlg-split { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin: 0; }
.fo-dlg-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 20px 24px; }
.fo-dlg-body > :first-child, .fo-dlg-body > :first-child > :first-child { margin-top: 0; }
html .fo-dlg-body > :last-child, html .fo-dlg-body > :last-child > :last-child { margin-bottom: 0 !important; }
html .fo-dlg-body .field { margin: 0 0 16px; }
html .fo-dlg-body :is(.row2, .row3) { margin: 0; row-gap: 0; align-items: start; }
html .fo-dlg-body > p.muted { margin: 0 0 16px; }

html .dialog .fo-dlg-foot {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 14px 24px;
    border-top: 1px solid var(--fo-border, #e8edf4);
    background: var(--fo-bg, #f8fafc);
}
.fo-kbd-hint { margin-inline-end: auto; display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--fo-muted, #64748b); white-space: nowrap; }
.fo-kbd-hint .fo-keys { display: inline-flex; gap: 3px; direction: ltr; unicode-bidi: isolate; }
.fo-kbd-hint kbd { display: inline-block; min-width: 20px; padding: 2px 6px; border: 1px solid var(--fo-border-strong, #d5dde8); border-bottom-width: 2px; border-radius: 6px; background: var(--fo-surface, #fff); color: var(--fo-text-2, #334155); font: 600 11px/1.3 var(--fo-font, var(--fo-font-ui, system-ui, sans-serif)); text-align: center; }
html .fo-dlg-foot :is(button, .btn) { min-height: 36px; padding: 8px 16px; border-radius: 8px; }
html .fo-dlg-foot :is(button, .btn).secondary { background: var(--fo-surface, #fff); border: 0; box-shadow: inset 0 0 0 1px var(--fo-border-strong, #d5dde8), var(--fo-shadow-xs, none); color: var(--fo-text-2, #334155); }
html .fo-dlg-foot :is(button, .btn).secondary:hover { background: var(--fo-muted-bg, #f1f5f9); }
html .fo-dlg-foot button:not(.secondary, .danger, .ok-btn):hover:not(:disabled) { filter: brightness(1.08); }
html .fo-dlg-foot button:focus-visible { outline: 2px solid var(--fo-accent, #2563eb); outline-offset: 2px; }
html .fo-dlg button.fo-busy { position: relative; color: transparent !important; pointer-events: none; }
html .fo-dlg button.fo-busy::after {
    content: ""; position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%;
    border: 2px solid #ffffff66; border-top-color: #fff; animation: fo-spin .7s linear infinite;
}
html .fo-dlg button.fo-busy.secondary::after { border-color: #94a3b866; border-top-color: #475569; }
@keyframes fo-spin { to { transform: rotate(360deg); } }

/* fieldset → titled card section */
html :is(.dialog, .card) fieldset { margin: 4px 0 16px; padding: 14px 16px 0; border: 1px solid var(--fo-border, #e8edf4); border-radius: 12px; background: var(--fo-bg, #f8fafc); min-width: 0; }
html :is(.dialog, .card) fieldset > legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font-size: 13px; font-weight: 650; text-transform: none; letter-spacing: 0; color: var(--fo-text, #0f172a); }
html :is(.dialog, .card) fieldset > legend + * { clear: both; }
html :is(.dialog, .card) fieldset > :last-child { margin-bottom: 14px; }
html :is(.dialog, .card) fieldset .field { margin: 0 0 14px; }

/* checkboxes inside dialogs → switches; radios → custom dots */
html .dialog .check { gap: 10px; font-size: 14px; color: var(--fo-text, #0f172a); cursor: pointer; }
html .dialog input[type="checkbox"] {
    appearance: none; -webkit-appearance: none; position: relative; flex: none; box-sizing: border-box;
    width: 36px; height: 20px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 999px;
    background: var(--fo-border-strong, #cbd5e1); cursor: pointer; vertical-align: middle; transition: background-color .2s;
}
html .dialog input[type="checkbox"]::before {
    content: ""; position: absolute; top: 2px; inset-inline-start: 2px; width: 16px; height: 16px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px #0f172a40; transition: transform .2s;
}
html .dialog input[type="checkbox"]:checked { background: var(--fo-accent, #2563eb); }
html .dialog input[type="checkbox"]:checked::before { transform: translateX(16px); }
html[dir="rtl"] .dialog input[type="checkbox"]:checked::before { transform: translateX(-16px); }
html .dialog input[type="checkbox"]:focus-visible { outline: 2px solid var(--fo-accent, #2563eb); outline-offset: 2px; }
html .dialog input[type="checkbox"]:disabled { opacity: .5; cursor: not-allowed; }
html[data-theme="dark"] .dialog input[type="checkbox"]:not(:checked) { background: #3b4b66; }
html .dialog input[type="radio"] {
    appearance: none; -webkit-appearance: none; flex: none; display: inline-grid; place-content: center; box-sizing: border-box;
    width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; border: 1.5px solid var(--fo-border-strong, #b6c2d2); border-radius: 50%;
    background: var(--fo-input-bg, #fff); cursor: pointer; vertical-align: middle; transition: border-color .15s;
}
html .dialog input[type="radio"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--fo-accent, #2563eb); transform: scale(0); transition: transform .15s; }
html .dialog input[type="radio"]:checked { border-color: var(--fo-accent, #2563eb); }
html .dialog input[type="radio"]:checked::before { transform: scale(1); }
html .dialog input[type="radio"]:focus-visible { outline: 2px solid var(--fo-accent, #2563eb); outline-offset: 2px; }
/* A stand-alone toggle (e.g. "Active", "Visible") reads as a control row the height of an input. */
html .fo-dlg-body :is(.fo-dlg-body, form, fieldset, .row2, .row3) > label.check:has(> input[type="checkbox"]),
html .fo-dlg-body > label.check:has(> input[type="checkbox"]) {
    box-sizing: border-box; min-height: 42px; margin: 0 0 16px; padding: 8px 12px;
    border: 1px solid var(--fo-border, #e8edf4); border-radius: 10px; background: var(--fo-surface, #fff);
    transition: border-color .15s;
}
html .fo-dlg-body label.check:has(> input[type="checkbox"]):hover { border-color: var(--fo-border-strong, #cbd5e1); }
/* In a field row, line the toggle up with the neighbouring inputs (not their labels). */
html .fo-dlg-body :is(.row2, .row3) > label.check { align-self: end; margin-bottom: 16px !important; }

/* ---------------------------------------------------------------- mobile: bottom sheet */
@media (max-width: 640px) {
    html .modal.open:has(> .dialog.fo-dlg) { align-items: flex-end; padding: 0; }
    html .modal > .dialog.fo-dlg, html .modal > .dialog.fo-dlg.fo-w-md, html .modal > .dialog.fo-dlg.fo-w-lg {
        width: 100% !important; max-width: 100% !important; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px);
        border-radius: 18px 18px 0 0; border-bottom: 0;
    }
    html .modal.open > .dialog.fo-dlg { animation: fo-sheet .26s cubic-bezier(.2, .9, .3, 1); }
    .fo-dlg-header { padding: 20px 16px 14px; }
    .fo-dlg-header::before { content: ""; position: absolute; top: 7px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 4px; background: var(--fo-border-strong, #cbd5e1); }
    .fo-dlg-chip { width: 34px; height: 34px; }
    .fo-dlg-pre { padding: 14px 16px 0; }
    .fo-dlg-body { padding: 16px; }
    html .dialog .fo-dlg-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); }
    html .fo-dlg-foot > :is(button, .btn) { flex: 1 1 auto; }
    .fo-kbd-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    html .modal.open, html .modal.open > .dialog, html .modal.open > .dialog.fo-dlg { animation: none; }
}

/*
 * ---------------------------------------------------------------------------------------------
 * Opt-in design layer for stand-alone pages (customer portal, tracking, receipts…): add class
 * "fo-ds" to <body>. Same language as the panel layer in fo-shell.css — Inter, 8px grid, hairline
 * borders, soft shadows, quiet table headers, status pills with a dot, crisp focus rings — but scoped
 * by body.fo-ds so it wins over the page's own <style> regardless of source order. Only "skin"
 * properties are set; layout stays with the page.
 * ---------------------------------------------------------------------------------------------
 */
body.fo-ds {
    font-family: var(--fo-font, var(--fo-font-ui));
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: "cv11", "ss01", "ss03";
}
body.fo-ds :is(button, input, select, textarea, .btn) { font-family: inherit; }
body.fo-ds :is(h1, h2, h3) { letter-spacing: -.015em; }
body.fo-ds h1 { font-weight: 650; letter-spacing: -.022em; }
body.fo-ds :is(h2, h3) { font-weight: 600; }
body.fo-ds .card { border-radius: var(--fo-radius-lg, 12px); box-shadow: var(--fo-shadow-sm); }
body.fo-ds .card .card { box-shadow: none; }
body.fo-ds .stat { border-radius: var(--fo-radius-lg, 12px); box-shadow: var(--fo-shadow-sm); }
body.fo-ds .stat :is(b, .value) { font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
body.fo-ds :is(button, .btn) { border-radius: var(--fo-radius, 8px); transition: background-color .15s, color .15s, box-shadow .15s, filter .15s; }
body.fo-ds :is(button, .btn):not(.secondary, .danger, .ghost, .linkbtn, .fo-icon-btn, .fo-tt-b, .stars button):not(:disabled):hover { filter: brightness(1.07); }
body.fo-ds :is(button, .btn, a, summary):focus-visible { outline: 2px solid var(--fo-accent, #2563eb); outline-offset: 2px; }
body.fo-ds :is(button, .btn).secondary { background: var(--fo-surface, #fff); color: var(--fo-text-2, #334155); box-shadow: inset 0 0 0 1px var(--fo-border-strong, #d5dbe3), var(--fo-shadow-xs); }
body.fo-ds :is(button, .btn).secondary:not(:disabled):hover { background: var(--fo-muted-bg, #f1f3f6); color: var(--fo-text, #0f172a); }
body.fo-ds :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), select, textarea) { transition: border-color .15s, box-shadow .15s; }
body.fo-ds :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"]), select, textarea):focus { outline: none; border-color: var(--fo-accent, #2563eb); box-shadow: var(--fo-ring); }
body.fo-ds :is(input, textarea)::placeholder { color: var(--fo-subtle, #94a3b8); opacity: 1; }
body.fo-ds :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--fo-accent, #2563eb); }
body.fo-ds th { font-size: 11.5px; font-weight: 600; letter-spacing: .045em; text-transform: uppercase; color: var(--fo-muted, #64748b); white-space: nowrap; }
body.fo-ds td { vertical-align: middle; }
body.fo-ds tbody tr:last-child > td { border-bottom-color: transparent; }
body.fo-ds .card tbody > tr > td { transition: background-color .12s; }
body.fo-ds .card tbody > tr:hover > td { background-color: var(--fo-row-hover); }
body.fo-ds .pill {
    display: inline-flex; align-items: center; vertical-align: middle; gap: 6px; min-height: 22px; padding: 2px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; line-height: 1.2; white-space: nowrap;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 16%, transparent);
}
body.fo-ds .pill::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
body.fo-ds .pill:empty::before { display: none; }
/* Keep a record name and its badges aligned, including when the name wraps. */
.fo-label-row {
    display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 8px;
    max-width: 100%; min-width: 0; vertical-align: middle; line-height: 1.5;
}
.fo-label-row > :is(strong, b, a) { min-width: 0; overflow-wrap: anywhere; }
.fo-label-row > :is(.pill, .badge, .fd-pill, .fa-pill) { flex: none; margin-inline: 0; }
/* Preserve readable name columns inside the existing horizontal table scrollers. */
main td:has(> .fo-label-row) { min-width: 14rem; }
body.fo-ds :is(.badge, .fd-pill, .fa-pill) { vertical-align: middle; }
body.fo-ds .muted a:not([class]) { font-weight: 500; text-decoration: none; }
body.fo-ds .muted a:not([class]):hover { text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { body.fo-ds :is(button, .btn) { transition: none; } }

/* Keep financial/count columns consistent in panels and customer pages. */
html :is(th, td).num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
