/* ==========================================================================
   site.css: loaded after bootstrap.min.css.
   Part 1  Theme: Bootstrap variables set to the Nextama (Fluent) look.
   Part 2  Small additions Bootstrap does not have.
   Views use Bootstrap classes first. Guide: docs/UI.md
   ========================================================================== */

/* ---------- Part 1: theme ---------- */
:root {
  /* Brand. Change these to rebrand; keep the -rgb values in sync. */
  --bs-primary: #0078d4;
  --bs-primary-rgb: 0, 120, 212;
  --bs-primary-text-emphasis: #005a9e;
  --bs-primary-bg-subtle: #eff6fc;
  --bs-primary-border-subtle: #c7e0f4;
  --bs-link-color: #0078d4;
  --bs-link-color-rgb: 0, 120, 212;
  --bs-link-hover-color: #106ebe;
  --bs-link-hover-color-rgb: 16, 110, 190;
  --bs-focus-ring-color: rgba(0, 120, 212, 0.25);

  /* Text and surfaces */
  --bs-font-sans-serif: "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  --bs-font-monospace: ui-monospace, "Cascadia Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --bs-body-font-size: 0.875rem;
  --bs-body-color: #242424;
  --bs-body-color-rgb: 36, 36, 36;
  --bs-body-bg: #fff; /* surfaces: cards, lists, inputs, modals */
  --bs-emphasis-color: #111827;
  --bs-secondary-color: #616161;
  --bs-secondary-rgb: 97, 97, 97;
  --bs-tertiary-color: #8a8886;
  --bs-secondary-bg: #f3f2f1;
  --bs-tertiary-bg: #f8f9fa;
  --bs-border-color: #edebe9;
  --bs-border-radius: 2px;
  --bs-border-radius-sm: 2px;
  --bs-border-radius-lg: 6px;
  --bs-code-color: #242424;
  --bs-heading-color: #242424;

  /* Status (Fluent palette): solid, text, subtle background, subtle border */
  --bs-success: #107c10; --bs-success-rgb: 16, 124, 16;
  --bs-success-text-emphasis: #0e700e; --bs-success-bg-subtle: #dff6dd; --bs-success-border-subtle: #a7e3a5;
  --bs-warning: #ffb900; --bs-warning-rgb: 255, 185, 0;
  --bs-warning-text-emphasis: #795600; --bs-warning-bg-subtle: #fff4ce; --bs-warning-border-subtle: #f2d57e;
  --bs-danger: #a4262c; --bs-danger-rgb: 164, 38, 44;
  --bs-danger-text-emphasis: #a4262c; --bs-danger-bg-subtle: #fde7e9; --bs-danger-border-subtle: #f8b6bb;
  --bs-info: #0078d4; --bs-info-rgb: 0, 120, 212;
  --bs-info-text-emphasis: #005a9e; --bs-info-bg-subtle: #eff6fc; --bs-info-border-subtle: #c7e0f4;
  --bs-secondary-text-emphasis: #605e5c; --bs-secondary-bg-subtle: #f3f2f1; --bs-secondary-border-subtle: #e1dfdd;

  /* App tokens used by layout.css, site.css and dashboard.css */
  --color-brand: var(--bs-primary);
  --color-brand-hover: #106ebe;
  --color-brand-pressed: #005a9e;
  --color-brand-subtle: var(--bs-primary-bg-subtle);
  --color-brand-border: var(--bs-primary-border-subtle);
  --color-text: var(--bs-body-color);
  --color-text-strong: var(--bs-emphasis-color);
  --color-text-secondary: var(--bs-secondary-color);
  --color-text-muted: var(--bs-tertiary-color);
  --color-canvas: #fafafa; /* page background */
  --color-surface: #fff;
  --color-hover: #f3f2f1;
  --color-pressed: #e1dfdd;
  --color-navigation: #f0f0f0;
  --color-border: var(--bs-border-color);
  --color-border-strong: #d1d1d1;
  --color-input-border: #8a8886;
  --color-suite: #0b1f3a;
  --color-suite-gradient: linear-gradient(90deg, #0a192f 0%, #0f294a 100%);
  --shadow-sm: 0 1.2px 3.6px rgba(0, 0, 0, 0.04), 0 0.3px 0.9px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 6.4px 14.4px rgba(0, 0, 0, 0.13), 0 1.2px 3.6px rgba(0, 0, 0, 0.11);
  --suite-height: 44px;
  --nav-width: 248px;
  --nav-padding-inline: 16px;
  --nav-icon-size: 20px;
  --nav-compact-width: calc(var(--nav-padding-inline) * 2 + var(--nav-icon-size) + 1px);
}

body { background-color: var(--color-canvas); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; }
h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 16px; } h4, h5, h6 { font-size: 14px; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
[x-cloak] { display: none !important; }
/* Fluent icons are filled outline paths: never add strokes. Size them with width/height. */
svg { width: 20px; height: 20px; fill: currentColor; stroke: none; flex-shrink: 0; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.small, small { font-size: 12px; }

/* Buttons: Bootstrap .btn + variants, tuned to Fluent sizes */
.btn { --bs-btn-padding-x: 12px; --bs-btn-padding-y: 5px; --bs-btn-font-size: 13px; --bs-btn-font-weight: 600; --bs-btn-line-height: 20px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { text-decoration: none; }
.btn svg { width: 16px; height: 16px; }
.btn-sm { --bs-btn-padding-x: 8px; --bs-btn-padding-y: 2px; --bs-btn-font-size: 12px; }
.btn-primary { --bs-btn-bg: #0078d4; --bs-btn-border-color: #0078d4; --bs-btn-hover-bg: #106ebe; --bs-btn-hover-border-color: #106ebe; --bs-btn-active-bg: #005a9e; --bs-btn-active-border-color: #005a9e; --bs-btn-disabled-bg: #0078d4; --bs-btn-disabled-border-color: #0078d4; }
.btn-secondary { --bs-btn-color: #323130; --bs-btn-bg: #fff; --bs-btn-border-color: #8a8886; --bs-btn-hover-color: #323130; --bs-btn-hover-bg: #f3f2f1; --bs-btn-hover-border-color: #323130; --bs-btn-active-color: #323130; --bs-btn-active-bg: #e1dfdd; --bs-btn-active-border-color: #323130; --bs-btn-disabled-color: #a19f9d; --bs-btn-disabled-bg: #fff; --bs-btn-disabled-border-color: #d1d1d1; }
.btn-danger { --bs-btn-bg: #a4262c; --bs-btn-border-color: #a4262c; --bs-btn-hover-bg: #8e1f24; --bs-btn-hover-border-color: #8e1f24; --bs-btn-active-bg: #751a1e; --bs-btn-active-border-color: #751a1e; }
.btn-outline-danger { --bs-btn-color: #a4262c; --bs-btn-bg: #fff; --bs-btn-border-color: #f8b6bb; --bs-btn-hover-color: #a4262c; --bs-btn-hover-bg: #fde7e9; --bs-btn-hover-border-color: #a4262c; --bs-btn-active-color: #fff; --bs-btn-active-bg: #a4262c; --bs-btn-active-border-color: #a4262c; }
.btn-link { --bs-btn-padding-x: 0; --bs-btn-padding-y: 0; --bs-btn-color: var(--bs-link-color); --bs-btn-hover-color: var(--color-brand-pressed); text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
.btn-close { --bs-btn-close-focus-shadow: 0 0 0 0.2rem var(--bs-focus-ring-color); width: 12px; height: 12px; }

/* Forms */
.form-label { margin-bottom: 4px; font-size: 13px; font-weight: 600; color: #323130; }
.form-control, .form-select { min-height: 32px; padding-top: 4px; padding-bottom: 4px; border-color: var(--color-input-border); font-size: 13px; }
.form-select::picker-icon { display: none; }
.form-control:hover, .form-select:hover { border-color: #323130; }
.form-control:focus, .form-select:focus { border-color: var(--bs-primary); box-shadow: inset 0 0 0 1px var(--bs-primary); }
.form-control.input-validation-error, .form-select.input-validation-error { border-color: var(--bs-danger); }
.form-control::placeholder { color: var(--color-text-muted); }
.form-control:disabled, .form-control[readonly] { background-color: var(--bs-secondary-bg); border-color: var(--color-border-strong); color: var(--bs-secondary-color); }
.form-text { margin-top: 4px; font-size: 12px; }
.field-validation-error { display: block; margin-top: 4px; font-size: 12px; color: var(--bs-danger); }
/* Checkbox, radio, switch: one consistent Fluent size everywhere (forms and tables). */
.form-check { min-height: 20px; padding-left: 28px; }
.form-check .form-check-input { margin-left: -28px; }
.form-check-input { border: 1px solid #616161; cursor: pointer; }
.form-check-input[type="checkbox"] { width: 18px; height: 18px; margin-top: 1px; border-radius: 3px; }
.form-check-input[type="radio"] { width: 18px; height: 18px; margin-top: 1px; }
.form-switch { padding-left: 48px; }
.form-switch .form-check-input { width: 38px; height: 20px; margin-left: -48px; margin-top: 0; border-radius: 999px; }
.form-check-input:hover { border-color: #242424; }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.form-check-input:focus { border-color: var(--bs-primary); box-shadow: 0 0 0 0.2rem var(--bs-focus-ring-color); }
.form-check-label { font-size: 13px; }
.input-group > .btn { border-color: var(--color-input-border); }

/* Cards */
.card { --bs-card-spacer-y: 16px; --bs-card-spacer-x: 20px; --bs-card-cap-padding-y: 14px; --bs-card-cap-padding-x: 20px; --bs-card-cap-bg: #fff; --bs-card-border-color: var(--bs-border-color); --bs-card-border-radius: var(--bs-border-radius-lg); --bs-card-inner-border-radius: calc(var(--bs-border-radius-lg) - 1px); box-shadow: var(--shadow-sm); }
.card-title { margin-bottom: 0; font-size: 16px; font-weight: 600; color: var(--bs-emphasis-color); }
.card-subtitle { margin-top: 2px; font-size: 12px; color: var(--bs-secondary-color); }
.card-footer { background: #fff; font-size: 12px; }

/* Tables: wrap in .card > .table-responsive, table gets .table.table-hover.mb-0 */
.table { --bs-table-hover-bg: var(--color-hover); --bs-table-border-color: var(--bs-border-color); font-size: 13px; }
.table > :not(caption) > * > * { padding: 9px 12px; vertical-align: middle; white-space: nowrap; }
.table > thead > tr > * { background: var(--bs-tertiary-bg); border-bottom-color: var(--color-border-strong); font-size: 12px; font-weight: 600; color: #323130; }
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table td.text-truncate { max-width: 320px; }
.table tr.is-selected > * { --bs-table-bg-state: var(--bs-primary-bg-subtle); }
.table-sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; font-weight: 600; color: inherit; }
.table-sort svg { width: 12px; height: 12px; color: var(--color-text-muted); }

/* Badges: .badge + .tone-* (subtle Fluent look). Plain .badge is neutral. */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border: 1px solid var(--tone-border, var(--bs-secondary-border-subtle)); border-radius: var(--bs-border-radius-sm); background: var(--tone-bg, var(--bs-secondary-bg-subtle)); color: var(--tone, var(--bs-secondary-text-emphasis)); font-size: 11px; font-weight: 600; line-height: 1.4; }
.badge svg { width: 12px; height: 12px; }

/* Alerts: Bootstrap .alert-* already use the subtle colours above. Icon first, text after. */
.alert { --bs-alert-padding-x: 12px; --bs-alert-padding-y: 10px; --bs-alert-margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 20px; color: var(--bs-body-color); }
.alert > svg { width: 18px; height: 18px; margin-top: 1px; color: var(--bs-alert-color); }
.alert > :not(svg):first-of-type { flex: 1; min-width: 0; }

/* Tabs: .nav.nav-underline */
.nav-underline { --bs-nav-underline-gap: 4px; --bs-nav-underline-border-width: 3px; --bs-nav-link-padding-y: 9px; --bs-nav-link-color: var(--bs-secondary-color); --bs-nav-link-hover-color: var(--bs-body-color); --bs-nav-underline-link-active-color: var(--bs-body-color); flex-wrap: nowrap; margin-bottom: 16px; overflow-x: auto; border-bottom: 1px solid var(--bs-border-color); scrollbar-width: none; }
.nav-underline .nav-link { display: inline-flex; align-items: center; gap: 6px; padding-left: 12px; padding-right: 12px; font-size: 14px; white-space: nowrap; }
.nav-underline .nav-link { border-radius: var(--bs-border-radius) var(--bs-border-radius) 0 0; transition: background-color .1s ease; }
.nav-underline .nav-link:hover { text-decoration: none; background: var(--color-hover); }
.nav-underline .nav-link.active, .nav-underline .nav-link[aria-current="page"] { background: var(--bs-primary-bg-subtle); }
.nav-underline .nav-link svg { width: 16px; height: 16px; }
.nav-underline .nav-link.active, .nav-underline .nav-link[aria-current="page"] { border-bottom-color: var(--bs-primary); font-weight: 400; color: var(--bs-body-color); }

/* Menus, list groups, progress, modal, offcanvas, toast */
.dropdown-menu { --bs-dropdown-font-size: 13px; --bs-dropdown-border-color: var(--bs-border-color); --bs-dropdown-link-active-bg: var(--color-pressed); --bs-dropdown-link-active-color: var(--bs-body-color); --bs-dropdown-item-padding-y: 7px; box-shadow: var(--shadow-md); }
.dropdown-item { display: flex; align-items: center; gap: 8px; }
.dropdown-item svg { width: 16px; height: 16px; color: var(--bs-primary); }
.list-group { --bs-list-group-border-color: var(--color-hover); --bs-list-group-item-padding-y: 10px; font-size: 13px; }
.progress, .progress-stacked { --bs-progress-height: 8px; --bs-progress-bg: var(--bs-border-color); --bs-progress-bar-bg: var(--bs-primary); --bs-progress-border-radius: 4px; }
.modal { --bs-modal-border-radius: var(--bs-border-radius-lg); --bs-modal-header-padding: 16px 20px; --bs-modal-padding: 20px; --bs-modal-title-line-height: 1.4; }
.modal-title, .offcanvas-title { font-size: 17px; font-weight: 600; color: var(--bs-emphasis-color); }
.offcanvas { --bs-offcanvas-width: min(520px, 92vw); --bs-offcanvas-padding-x: 20px; --bs-offcanvas-padding-y: 16px; }
.offcanvas-wide { --bs-offcanvas-width: min(720px, 96vw); }
.offcanvas-wide.offcanvas-xwide { --bs-offcanvas-width: min(1000px, 96vw); }
.offcanvas fieldset { padding-top: 12px; border-top: 1px solid var(--color-hover); }
.offcanvas-header { border-bottom: 1px solid var(--bs-border-color); }
/* Bootstrap has no offcanvas footer. */
.offcanvas-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--bs-border-color); background: #fdfdfd; }
.toast { --bs-toast-font-size: 13px; --bs-toast-max-width: 380px; }

/* ---------- Part 2: additions ---------- */

/* Tone: one modifier colours .badge, .dot, .icon-tile, .stat-value, .progress-bar */
.tone-success { --tone: var(--bs-success-text-emphasis); --tone-bg: var(--bs-success-bg-subtle); --tone-border: var(--bs-success-border-subtle); --tone-solid: var(--bs-success); }
.tone-warning { --tone: var(--bs-warning-text-emphasis); --tone-bg: var(--bs-warning-bg-subtle); --tone-border: var(--bs-warning-border-subtle); --tone-solid: var(--bs-warning); }
.tone-danger  { --tone: var(--bs-danger-text-emphasis);  --tone-bg: var(--bs-danger-bg-subtle);  --tone-border: var(--bs-danger-border-subtle);  --tone-solid: var(--bs-danger); }
.tone-info    { --tone: var(--bs-info-text-emphasis);    --tone-bg: var(--bs-info-bg-subtle);    --tone-border: var(--bs-info-border-subtle);    --tone-solid: var(--bs-info); }
.tone-neutral { --tone: var(--bs-secondary-text-emphasis); --tone-bg: var(--bs-secondary-bg-subtle); --tone-border: var(--bs-secondary-border-subtle); --tone-solid: #a19f9d; }
.tone-purple  { --tone: #5c2d91; --tone-bg: #f3f0f9; --tone-border: #dcd3ed; --tone-solid: #8764b8; }
.tone-teal    { --tone: #03787c; --tone-bg: #e6f5f5; --tone-border: #a6dedf; --tone-solid: #038387; }
.tone-orange  { --tone: #b4400c; --tone-bg: #ffe7d6; --tone-border: #ffc29b; --tone-solid: #f7630c; }
.progress-bar[class*="tone-"] { background-color: var(--tone-solid); }
.stat-value[class*="tone-"] { color: var(--tone); }

/* Toolbar (command bar) with flat buttons */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; padding: 8px; border-top: 1px solid var(--bs-border-color); border-bottom: 1px solid var(--bs-border-color); background: #fff; }
.toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar-group > .btn-subtle + .btn-subtle { margin-left: -4px; }
/* Inline field labels in a toolbar: quiet, no colon needed. */
.toolbar .form-label { margin: 0; font-weight: 400; color: var(--bs-secondary-color); }
.toolbar .form-select, .toolbar .form-control { min-height: 30px; }
.toolbar-divider { width: 1px; height: 20px; margin: 0 4px; background: var(--color-pressed); }
.btn-subtle { --bs-btn-color: var(--bs-body-color); --bs-btn-hover-bg: var(--color-hover); --bs-btn-hover-color: var(--bs-body-color); --bs-btn-active-bg: var(--color-pressed); --bs-btn-font-weight: 400; --bs-btn-padding-x: 10px; --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; }
.btn-subtle svg { color: var(--bs-primary); }
.btn-subtle:disabled svg { color: #a19f9d; }
.btn-icon { --bs-btn-padding-x: 0; --bs-btn-padding-y: 0; --bs-btn-color: var(--bs-secondary-color); --bs-btn-hover-color: var(--bs-body-color); --bs-btn-hover-bg: var(--color-hover); --bs-btn-border-color: transparent; --bs-btn-hover-border-color: transparent; width: 32px; height: 32px; }
.btn-icon.btn-sm { width: 26px; height: 26px; }

/* KPI tile (use the _Stat partial inside a .row) */
.stat { display: flex; flex-direction: column; height: 100%; padding: 12px 14px; background: #fff; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); box-shadow: var(--shadow-sm); }
.stat-label { margin-bottom: 4px; font-size: 12px; font-weight: 600; color: var(--bs-secondary-text-emphasis); }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; color: var(--bs-emphasis-color); }
.stat-value-lg { font-size: 32px; }
.stat-note { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: 11px; color: var(--color-text-muted); }

/* Icon tile, status dot, avatar */
.icon-tile { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--tone-border, var(--bs-info-border-subtle)); border-radius: var(--bs-border-radius-lg); background: var(--tone-bg, var(--bs-info-bg-subtle)); color: var(--tone, var(--bs-info-text-emphasis)); flex-shrink: 0; }
.icon-tile svg { width: 18px; height: 18px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--tone-solid, #a19f9d); flex-shrink: 0; }
.dot-ring { box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone-solid, #a19f9d) 16%, transparent); }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; overflow: hidden; border: 1px solid var(--color-pressed); border-radius: 50%; background: var(--color-hover); color: #323130; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.avatar svg { width: 18px; height: 18px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 72px; height: 72px; font-size: 24px; }
.avatar-lg svg { width: 36px; height: 36px; }

/* Filter pills and search box */
.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pills-label { margin-right: 4px; font-size: 12px; font-weight: 600; color: #323130; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 11px; border: 1px solid var(--color-border-strong); border-radius: 13px; background: #fff; color: #323130; font-size: 12px; white-space: nowrap; }
.pill:hover { background: var(--color-hover); border-color: var(--color-input-border); color: #323130; text-decoration: none; }
.pill.active, .pill[aria-pressed="true"], .pill[aria-current] { background: var(--bs-primary-bg-subtle); border-color: var(--bs-primary); color: var(--color-brand-pressed); font-weight: 600; }
.pill-count { min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--color-hover); color: #605e5c; font-size: 11px; font-weight: 600; line-height: 16px; text-align: center; }
.pill.active .pill-count { background: #fff; color: var(--color-brand-pressed); }
.search { position: relative; display: flex; align-items: center; width: 260px; max-width: 100%; }
.search > svg { position: absolute; left: 9px; width: 15px; height: 15px; color: var(--bs-secondary-text-emphasis); pointer-events: none; }
.search .form-control { min-height: 30px; padding-left: 30px; padding-right: 30px; }
.search .form-control::-webkit-search-cancel-button { display: none; }
.search .btn-icon { position: absolute; right: 3px; width: 24px; height: 24px; }
.search .btn-icon svg { width: 13px; height: 13px; }
/* Live search loader: the spinner replaces the search icon while a request runs (see site.js). */
.search-spinner { position: absolute; left: 9px; width: 14px; height: 14px; border: 2px solid var(--color-input-border); border-top-color: var(--bs-primary); border-radius: 50%; opacity: 0; pointer-events: none; animation: search-spin .7s linear infinite; }
.search.is-loading > svg { opacity: 0; }
.search.is-loading .search-spinner { opacity: 1; }
#main-content.is-searching .table-responsive, #main-content.is-searching .pager, #main-content.is-searching .empty { opacity: .55; transition: opacity .15s; }
@keyframes search-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .search-spinner { animation-duration: 2s; } }

/* Key/value list: dl.kv > div > dt + dd */
.kv { margin: 0; font-size: 13px; }
.kv > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--color-hover); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { font-weight: 400; color: var(--bs-secondary-color); }
.kv dd { margin: 0; font-weight: 600; text-align: right; }

/* Empty state (use the _EmptyState partial) */
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 32px 16px; text-align: center; }
.empty > svg { width: 32px; height: 32px; margin-bottom: 4px; color: var(--color-text-muted); }
.empty h3 { margin: 0; font-size: 14px; }
.empty p { max-width: 360px; margin: 0; font-size: 12px; color: var(--bs-secondary-color); }

/* Chevron that turns when its toggle collapses: <button aria-expanded> ... <svg class="chevron"> */
.chevron { width: 16px; height: 16px; transition: transform .15s ease; }
[aria-expanded="false"] > .chevron { transform: rotate(-90deg); }

/* Narrow centered page (account, settings forms): .page-narrow wraps the whole view */
.page-narrow { max-width: 760px; margin-inline: auto; }

/* Inline code chip */
.code { padding: 1px 5px; border-radius: 3px; background: var(--color-hover); font-family: var(--bs-font-monospace); font-size: 12px; }

@media (max-width: 767px) {
  .search { width: 100%; }
}

/* Select2 (wwwroot/lib/select2), themed like .form-select. Every select.form-select is upgraded by site.js;
   add data-native to keep a plain select. AJAX lookups: data-lookup="/lookups/partners?role=customers". */
.select2-container { font-size: 13px; }
.select2-container--default .select2-selection--single { min-height: 32px; border: 1px solid var(--color-input-border); border-radius: var(--bs-border-radius); background: var(--bs-body-bg); }
.select2-container--default .select2-selection--single:hover { border-color: #323130; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 30px; padding-left: 10px; padding-right: 28px; color: var(--bs-body-color); }
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--color-text-muted); }
.select2-container--default .select2-selection--single .select2-selection__arrow { height: 30px; }
.select2-container--default .select2-selection--single .select2-selection__clear { height: 30px; margin-right: 22px; }
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single { border-color: var(--bs-primary); box-shadow: inset 0 0 0 1px var(--bs-primary); }
.select2-container--default.select2-container--disabled .select2-selection--single { background: var(--bs-secondary-bg); }
.select2-dropdown { border-color: var(--color-input-border); border-radius: var(--bs-border-radius); box-shadow: var(--shadow-sm); }
.select2-container--open { z-index: 2000; }
.select2-search--dropdown .select2-search__field { min-height: 30px; border-color: var(--color-input-border); border-radius: var(--bs-border-radius); font-size: 13px; }
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable { background: var(--bs-primary); }
.select2-container--default .select2-results__group { color: var(--bs-secondary-color); font-weight: 600; }
.select2-results__option { padding: 6px 10px; }
.form-select-sm + .select2-container .select2-selection--single { min-height: 30px; }

/* Multi-line text kept as typed (remarks). */
.text-preline { white-space: pre-line; }

/* Pager: card-footer > .pager (summary left, page links right) */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.pager .pagination { margin: 0; --bs-pagination-padding-x: 10px; --bs-pagination-padding-y: 3px; --bs-pagination-font-size: 13px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* MBL consolidation summary (legacy MBL sidebar) */
.mbl-summary-block { padding: 10px 16px; border-top: 1px solid var(--color-hover); }
.mbl-summary-block .kv > div { padding: 5px 0; }
.mbl-summary-head { color: var(--tone, inherit); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.mbl-summary-block[class*="tone-"] { background: transparent; border-left: 3px solid var(--tone-solid, transparent); }


/* Job / partner picker chips in the journal lines (open the right-hand picker drawer) */
.pick-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 220px; min-height: 30px; padding: 4px 10px; border: 1px dashed var(--color-input-border); border-radius: var(--bs-border-radius); background: var(--bs-body-bg); color: var(--bs-secondary-color); font-size: 13px; text-align: left; cursor: pointer; }
.pick-chip svg { flex: none; width: 15px; height: 15px; }
.pick-chip span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pick-chip:hover { border-color: var(--bs-primary); color: var(--bs-primary); }
.pick-chip.is-set { border-style: solid; color: var(--bs-body-color); background: var(--bs-tertiary-bg); }
.pick-item.active { font-weight: 600; }
.pick-wrap { display: inline-flex; align-items: center; gap: 2px; max-width: 250px; }
.pick-clear { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--bs-secondary-color); cursor: pointer; }
.pick-clear svg { width: 12px; height: 12px; }
.pick-clear:hover { background: var(--bs-danger-bg-subtle); color: var(--bs-danger); }

/* Busy submit button (site.js): spinner while the form is being saved */
.btn.is-busy { display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: progress; opacity: 1; }
.btn-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: btn-spin .7s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .btn-spinner { animation-duration: 2s; } }

/* Roles & Permissions: one role per tab, each module a collapsible panel of switches. */
.permission-module { overflow: hidden; }
.permission-module-head {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .7rem 1rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.permission-module-head::-webkit-details-marker { display: none; }
.permission-module-head:hover { background: #f6f8fa; }
.permission-chevron { width: 1rem; height: 1rem; transition: transform .15s ease; color: #6b7785; }
.permission-module[open] .permission-chevron { transform: rotate(90deg); }
.permission-module[open] .permission-module-head { border-bottom: 1px solid #e5e9ee; }
.permission-module-body { padding: .75rem 1rem .5rem; }
.permission-row { padding: .35rem 0 .35rem 2.5rem; border-bottom: 1px dashed #edf0f3; }
.permission-row:last-child { border-bottom: 0; }

/* "Entered by" stamp in the page action bar: light, readable, same height as the buttons beside it. */
.entered-by {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    align-self: center;
    padding: .35rem .8rem;
    border-radius: 999px;
    background: #eef5fd;
    border: 1px solid #cfe0f5;
    color: #1f2d3d;
    font-size: .85rem;
    line-height: 1.2;
    white-space: nowrap;
}

.entered-by svg { width: 1rem; height: 1rem; flex-shrink: 0; color: #2f6fb5; }
.entered-by-label { color: #55657a; }
.entered-by-name { color: #102a43; font-weight: 600; }
.entered-by-at { color: #55657a; padding-left: .4rem; border-left: 1px solid #cfe0f5; }


/* Action bar on job, MBL and purchasing pages: plain, no border or background. Buttons are coloured by what they do. */
.toolbar.toolbar-accent {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}
.toolbar-accent .btn { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
/* Icons always take the button's text colour, so text and icon never disappear on hover. */
.toolbar-accent .btn svg { width: 16px; height: 16px; color: currentColor; }
/* Outline buttons: white, coloured text and border; on hover a light tint of the same colour (never white text). */
.toolbar-accent .btn-outline-primary,
.toolbar-accent .btn-outline-success,
.toolbar-accent .btn-outline-danger {
    --bs-btn-bg: #fff;
    --bs-btn-active-color: var(--bs-btn-color);
    --bs-btn-hover-color: var(--bs-btn-color);
}
.toolbar-accent .btn-outline-primary { --bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary); --bs-btn-hover-bg: #e3eefb; --bs-btn-active-bg: #d0e2f7; --bs-btn-hover-border-color: var(--bs-primary); }
.toolbar-accent .btn-outline-success { --bs-btn-hover-bg: #e6f4ea; --bs-btn-active-bg: #d2ecda; --bs-btn-hover-border-color: var(--bs-success); }
.toolbar-accent .btn-outline-danger { --bs-btn-hover-bg: #fdecec; --bs-btn-active-bg: #f9d9d9; --bs-btn-hover-border-color: var(--bs-danger); }
.toolbar-accent .toolbar-divider { background: #e1dfdd; height: 24px; }

/* List filters (_ListFilters): date range and dropdowns in one row that wraps on small screens. */
.list-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.list-filter { display: flex; flex-direction: column; min-width: 140px; }
.list-filter .form-label { margin-bottom: 2px; font-size: .78rem; color: var(--bs-secondary-color); }
.list-filter-reset { display: inline-flex; align-items: center; gap: 4px; padding-bottom: 6px; }
.list-filter-reset svg { width: 14px; height: 14px; }

/* Document pages in the Dynamics 365 style (purchasing module): an action bar, collapsible FastTabs with fields in
   label/value rows and a lines grid.
   <div class="doc-layout"><div class="doc-main">…FastTabs…</div></div> */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.doc-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.toolbar.toolbar-accent.doc-actions { margin-bottom: 12px; }
/* List pages: search on the left, actions (New ...) on the right. */
.list-bar > .toolbar-group:first-child { order: 2; margin-left: auto; }
.doc-actions form { display: inline-flex; margin: 0; }

.fasttab { background: #fff; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius-lg); box-shadow: var(--shadow-sm); }
.fasttab-head { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px; }
.fasttab-title { font-size: 15px; font-weight: 600; color: var(--bs-emphasis-color); }
.fasttab-peek { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-left: auto; font-size: 12px; color: var(--bs-secondary-color); }
.fasttab-peek strong { font-weight: 600; color: var(--bs-body-color); }
.fasttab-body { padding: 4px 16px 16px; }
.fasttab-body.p-0 { padding: 0 0 4px; }

.field-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px 32px; }
@media (min-width: 992px) { .field-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.field { display: grid; grid-template-columns: minmax(120px, 38%) minmax(0, 1fr); align-items: center; gap: 12px; min-height: 36px; padding: 2px 0; border-bottom: 1px dashed #edebe9; }
.field-wide { grid-column: 1 / -1; grid-template-columns: minmax(120px, calc(19% - 6px)) minmax(0, 1fr); }
@media (max-width: 991.98px) { .field-wide { grid-template-columns: minmax(120px, 38%) minmax(0, 1fr); } }
.field > label, .field > .field-label { margin: 0; font-size: 13px; font-weight: 400; color: var(--bs-secondary-color); }
.field-value { font-size: 13px; color: var(--bs-body-color); min-width: 0; overflow-wrap: anywhere; }
.field .form-control, .field .form-select, .field .select2-container { font-size: 13px; }
.field-required > label::after { content: " *"; color: var(--bs-danger); }

.seg { display: inline-flex; flex-wrap: wrap; justify-self: start; width: fit-content; gap: 0; border: 1px solid var(--color-input-border, #8a8886); border-radius: var(--bs-border-radius); overflow: hidden; }
.seg button { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border: 0; border-right: 1px solid var(--bs-border-color); background: #fff; font-size: 13px; color: var(--bs-body-color); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--color-hover); }
.seg button.is-selected { background: var(--color-brand); color: #fff; }
.seg button svg { width: 14px; height: 14px; }

.lines-grid { margin: 0; font-size: 13px; }
.lines-grid > :not(caption) > * > * { padding: 4px 8px; vertical-align: middle; }
.lines-grid thead th { position: sticky; top: 0; background: #faf9f8; font-size: 12px; font-weight: 600; color: var(--bs-secondary-color); white-space: nowrap; border-bottom: 1px solid var(--bs-border-color); }
.lines-grid tbody tr:hover { background: var(--color-hover); }
.lines-grid tbody tr.is-current { background: var(--color-brand-subtle); }
.lines-grid .form-control, .lines-grid .form-select { border-color: var(--color-border-strong, #d1d1d1); background-color: #fff; box-shadow: none; }
.lines-grid tr:hover .form-control, .lines-grid tr:hover .form-select, .lines-grid tr.is-current .form-control, .lines-grid tr.is-current .form-select, .lines-grid .form-control:focus, .lines-grid .form-select:focus { border-color: var(--color-input-border, #8a8886); background-color: #fff; }
.lines-grid .select2-container--default .select2-selection--single { border-color: var(--color-border-strong, #d1d1d1); background: #fff; }
.lines-grid tr:hover .select2-selection--single, .lines-grid tr.is-current .select2-selection--single, .lines-grid .select2-container--open .select2-selection--single { border-color: var(--color-input-border, #8a8886); background: #fff; }
.lines-grid tfoot td { font-weight: 600; border-top: 1px solid var(--bs-border-color); }
.lines-grid .line-no { width: 2.5rem; color: var(--bs-secondary-color); font-size: 12px; }
/* Per-line delete button: small red icon button at the end of each editable line. */
.lines-grid .line-del { width: 2.25rem; padding-left: 0 !important; text-align: center; }
.btn-line-del { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid #f1bbbc; border-radius: var(--bs-border-radius); background: #fde7e9; color: #a4262c; }
.btn-line-del:hover { background: #a4262c; border-color: #a4262c; color: #fff; }
.btn-line-del:focus-visible { outline: 2px solid #a4262c; outline-offset: 1px; }
.btn-line-del svg { width: 14px; height: 14px; }
.lines-actions { display: flex; align-items: center; gap: 4px; padding: 6px 12px; border-bottom: 1px solid var(--bs-border-color); }


/* List pages: the action bar carries the actions and the search; views (status tabs) and filters sit in one quiet row below. */
.list-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; margin: -4px 0 12px; border-bottom: 1px solid var(--bs-border-color); }
.view-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.view-tab { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; color: var(--bs-secondary-color); font-size: 13px; text-decoration: none; white-space: nowrap; }
.view-tab:hover { color: var(--bs-body-color); background: var(--color-hover); border-radius: var(--bs-border-radius) var(--bs-border-radius) 0 0; }
.view-tab.active { color: var(--bs-emphasis-color); font-weight: 600; }
.view-tab.active::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; border-radius: 2px; background: var(--color-brand); }
.view-tab-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bs-secondary-bg); color: var(--bs-secondary-color); font-size: 11px; font-weight: 600; line-height: 1; }
.view-tab.active .view-tab-count { background: var(--color-brand-subtle); color: var(--bs-primary-text-emphasis); }
.filter-select { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 6px; }
.filter-select label { margin: 0; font-size: 12px; font-weight: 600; color: var(--bs-secondary-color); white-space: nowrap; }
.filter-select .form-select { width: auto; min-width: 120px; min-height: 28px; padding-top: 2px; padding-bottom: 2px; }
.doc-actions .search { width: 240px; }
.item-thumb { width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); }

/* P&L comparison: latest period shaded, change columns set apart, account column stays visible when scrolling. */
.trend-table .trend-latest { background: var(--bs-primary-bg-subtle); font-weight: 600; }
.trend-table .trend-change { border-left: 1px solid var(--bs-border-color); }
.trend-table .trend-change + .trend-change { border-left: 0; }
.trend-table .trend-account { position: sticky; left: 0; background: var(--bs-body-bg); min-width: 240px; z-index: 1; }
.trend-table tr.table-light > th { position: sticky; left: 0; }
.trend-table tr.trend-total > * { background: var(--bs-tertiary-bg); }
.trend-table tr.trend-total > .trend-latest { background: var(--bs-primary-bg-subtle); }

/* Sales performance: gross profit column shaded, sales person stays visible when scrolling sideways. */
.sales-table .sales-gp { background: var(--bs-primary-bg-subtle); }
.sales-table td:first-child, .sales-table th:first-child { position: sticky; left: 0; background: var(--bs-body-bg); z-index: 1; }

/* Costing drawer: each buying / selling row in its own light box. */
.costing-row { border: 1px solid var(--bs-border-color); border-radius: var(--bs-border-radius); padding: .75rem; margin-bottom: .5rem; background: var(--bs-tertiary-bg); }
.costing-row .costing-no { display: inline-block; min-width: 1.5rem; font-weight: 700; }
/* The number is a solid header tab cut into the card's top-left corner, in the colour of the card's left edge. */
.costing-row[class*="costing-tone-"] { position: relative; padding-top: 2.1rem; }
.costing-row .costing-sep { display: flex; align-items: center; margin: .75rem 0 .5rem -.75rem; }
.costing-row .costing-sep span { padding: .2rem .8rem .2rem .75rem; background: var(--tone-edge, var(--bs-secondary-color)); color: #fff; font-weight: 700; line-height: 1.4; border-radius: 0 var(--bs-border-radius) var(--bs-border-radius) 0; }
.costing-row .costing-sep span::before { content: attr(data-no) " Selling"; } /* "Selling" stays in English in both languages, like "Costing" */
.costing-row .costing-sep::after { content: ""; flex: 1; margin-left: .6rem; border-top: 2px solid var(--tone-edge, var(--bs-border-color)); opacity: .45; }
/* Delete: solid red tab in the card's top-right corner. */
.costing-row .costing-del { position: absolute; top: -1px; right: -1px; display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .75rem; border: 0; background: #c4262e; color: #fff; font-weight: 600; line-height: 1.4; border-radius: 0 var(--bs-border-radius) 0 var(--bs-border-radius); }
.costing-row .costing-del:hover { background: #a21d24; }
.costing-row .costing-del svg { width: 1rem; height: 1rem; fill: currentColor; }
.costing-row[class*="costing-tone-"] .costing-no { position: absolute; top: -1px; left: -4px; min-width: 0; padding: .2rem .8rem .2rem .75rem; background: var(--tone-edge); color: #fff; line-height: 1.4; border-radius: var(--bs-border-radius) 0 var(--bs-border-radius) 0; }
/* Job details: coloured frame tells the Sell card (blue) from the Buy card (orange). */
.card-sell { border: 2px solid #0f6cbd; border-top-width: 5px; }
.card-buy { border: 2px solid #f7630c; border-top-width: 5px; }
/* Each "+ Costing" package gets its own tint and accent edge (8 colours in turn: blue, red, green, purple, orange, teal, pink, olive). */
.costing-row[class*="costing-tone-"] { background: var(--tone-bg); border-left: 4px solid var(--tone-edge); }
.costing-tone-0 { --tone-bg: #eef5fc; --tone-edge: #0f6cbd; }
/* No red or pink here: the Delete tab is red. */
.costing-tone-1 { --tone-bg: #edf8ee; --tone-edge: #107c10; }
.costing-tone-2 { --tone-bg: #f4effa; --tone-edge: #7a3fb5; }
.costing-tone-3 { --tone-bg: #fdf3e8; --tone-edge: #b34700; }
.costing-tone-4 { --tone-bg: #e9f7f7; --tone-edge: #047d82; }
.costing-tone-5 { --tone-bg: #f5f6e6; --tone-edge: #6b7a0a; }
.costing-row .costing-tax { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; padding: .35rem .6rem; border-radius: var(--bs-border-radius); background: var(--bs-body-bg); }
/* Small (i) next to a label: the explanation shows as a tooltip while the icon is hovered or focused. */
.hint-icon { display: inline-flex; vertical-align: -2px; margin-left: 2px; color: var(--bs-secondary-color); cursor: help; }
.hint-icon svg { width: 14px; height: 14px; }
.hint-icon:hover, .hint-icon:focus-visible { color: #0f6cbd; }
