/* ==========================================================================
   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-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 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; }
.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 and MBL pages: a tinted panel with an accent edge so the actions (Costing, Fee, Close, Cancel)
   stand apart from the white tabs and cards below. Buttons are coloured by what they do. */
.toolbar.toolbar-accent {
    padding: 10px 12px;
    border: 1px solid #cfe0f5;
    border-left: 4px solid var(--bs-primary);
    border-radius: var(--bs-border-radius-lg, 8px);
    background: linear-gradient(90deg, #eaf3fd 0%, #f5f9ff 100%);
    box-shadow: 0 1px 2px rgba(16, 42, 67, .06);
}
.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: #cfe0f5; 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; }
