/* =====================================================================
   shadcn/ui look for the whole app — loaded LAST.

   shadcn's components are React + Tailwind; this app is server-rendered
   Bootstrap. So this file gives Bootstrap's own classes (.btn, .card,
   .form-control, .table, .modal, .dropdown-menu, .badge, .nav ...) the
   shadcn design: its neutral "zinc" palette, hairline borders, small
   radii, quiet shadows, 36px controls, focus rings and tab / dialog /
   sheet shapes. No template needs to change, and removing this file's
   <link> in base.html returns the previous look.

   The brand colour (Branding or the active theme) stays the one accent.
   Phone layout rules are at the end.
   ===================================================================== */

:root {
  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --accent: #f4f4f5;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --ring: var(--app-primary, #4f46e5);
  --destructive: #dc2626;
  --radius: .5rem;
  --radius-md: calc(var(--radius) - 2px);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-xl: .75rem;
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / .05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);
  --control-h: 2.25rem;

  /* the older layers read these, so they follow automatically */
  --ui-bg: #fafafa;
  --ui-surface: var(--card);
  --ui-border: var(--border);
  --ui-border-strong: #d4d4d8;
  --ui-text: var(--foreground);
  --ui-text-2: #52525b;
  --ui-text-3: var(--muted-foreground);
  --ui-radius: var(--radius-xl);
  --ui-radius-sm: var(--radius-md);
  --ui-shadow-xs: var(--shadow-xs);
  --ui-shadow-sm: var(--shadow-xs);
  --ui-shadow-md: var(--shadow-md);
  --app-sidebar-hover: var(--accent);
  --app-sidebar-active-bg: var(--accent);
  --bs-border-color: var(--border);
  --bs-body-color: var(--foreground);
  --bs-secondary-color: var(--muted-foreground);
  --bs-tertiary-bg: var(--muted);
  --bs-border-radius: var(--radius-md);
}
[data-bs-theme="dark"] {
  --background: #09090b;
  --foreground: #fafafa;
  --card: #0c0c0e;
  --muted: #27272a;
  --muted-foreground: #a1a1aa;
  --accent: #27272a;
  --border: #27272a;
  --input: #27272a;
  --ui-bg: #09090b;
  --ui-border-strong: #3f3f46;
  --ui-text-2: #d4d4d8;
  --bs-body-bg: #09090b;
}

/* ---- Base ------------------------------------------------------------ */
body, .app-main { background: var(--ui-bg); color: var(--foreground); }
body { font-size: .875rem; line-height: 1.5; font-feature-settings: "cv11", "ss01"; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { font-weight: 600; letter-spacing: -.02em; color: var(--foreground); }
.text-secondary, .text-muted, .form-text, small.text-secondary { color: var(--muted-foreground) !important; }
hr { border-color: var(--border); opacity: 1; }
::selection { background: color-mix(in srgb, var(--ring) 22%, transparent); }

/* ---- Button ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .375rem;
  min-height: var(--control-h); padding: 0 1rem; border-radius: var(--radius-md);
  font-size: .875rem; font-weight: 500; line-height: 1; white-space: nowrap;
  border: 1px solid transparent; box-shadow: none;
  transition: background-color .15s, color .15s, border-color .15s, box-shadow .15s;
}
.btn > .bi { margin: 0 !important; font-size: 1em; }
.btn-sm { min-height: 2rem; padding: 0 .75rem; font-size: .8125rem; border-radius: var(--radius-md); }
.btn-lg { min-height: 2.5rem; padding: 0 1.5rem; font-size: .9375rem; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring) !important; }
.btn:disabled, .btn.disabled { opacity: .5; pointer-events: none; }

.btn-primary, .view-switcher .btn.btn-primary, .view-switcher .btn.btn-primary.active {
  background: var(--app-primary) !important; border-color: var(--app-primary) !important;
  color: #fff !important; box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background: color-mix(in srgb, var(--app-primary) 90%, #000) !important; border-color: transparent !important; }
.btn-secondary { background: var(--muted) !important; border-color: transparent !important; color: var(--foreground) !important; }
.btn-secondary:hover { background: color-mix(in srgb, var(--muted) 80%, var(--foreground) 8%) !important; }
.btn-outline-secondary, .btn-outline-primary, .btn-outline-dark, .btn-light, .btn-outline-light {
  background: var(--background) !important; border-color: var(--input) !important;
  color: var(--foreground) !important; box-shadow: var(--shadow-xs);
}
.btn-outline-secondary:hover, .btn-outline-primary:hover, .btn-outline-dark:hover, .btn-light:hover,
.btn-outline-secondary.active, .btn-outline-primary.active, .btn-check:checked + .btn-outline-secondary,
.btn-check:checked + .btn-outline-primary, .btn-outline-secondary.show, .btn-outline-primary.show {
  background: var(--accent) !important; color: var(--foreground) !important; border-color: var(--input) !important;
}
.btn-outline-primary { color: var(--app-primary-dark, var(--app-primary)) !important; }
.btn-danger { background: var(--destructive) !important; border-color: var(--destructive) !important; color: #fff !important; box-shadow: var(--shadow-xs); }
.btn-danger:hover { background: color-mix(in srgb, var(--destructive) 90%, #000) !important; }
.btn-outline-danger { background: var(--background) !important; border-color: var(--input) !important; color: var(--destructive) !important; box-shadow: var(--shadow-xs); }
.btn-outline-danger:hover { background: color-mix(in srgb, var(--destructive) 8%, var(--background)) !important; }
.btn-success { background: #16a34a !important; border-color: #16a34a !important; color: #fff !important; box-shadow: var(--shadow-xs); }
.btn-success:hover { background: #15803d !important; }
.btn-warning { background: #f59e0b !important; border-color: #f59e0b !important; color: #1c1917 !important; }
.btn-outline-warning { background: var(--background) !important; border-color: #fcd34d !important; color: #b45309 !important; }
.btn-outline-warning:hover { background: #fffbeb !important; }
.btn-link { color: var(--foreground) !important; text-underline-offset: 4px; padding: 0 .5rem; }
.btn-link:hover { text-decoration: underline !important; }
.btn-close { opacity: .6; border-radius: var(--radius-sm); }
.btn-close:hover { opacity: 1; }
.btn-group > .btn { box-shadow: none; }

/* ---- Input, Select, Textarea, Label ---------------------------------- */
.form-label, label.form-label { font-size: .875rem; font-weight: 500; color: var(--foreground); margin-bottom: .375rem; line-height: 1.2; }
.form-control, .form-select {
  min-height: var(--control-h); padding: .375rem .75rem; font-size: .875rem;
  background-color: var(--background); color: var(--foreground);
  border: 1px solid var(--input); border-radius: var(--radius-md); box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}
.form-control-sm, .form-select-sm { min-height: 2rem; padding: .25rem .625rem; font-size: .8125rem; border-radius: var(--radius-md); }
.form-select { padding-right: 2rem; background-position: right .625rem center; background-size: 14px 10px; }
textarea.form-control { min-height: 4.5rem; padding-top: .5rem; }
.form-control::placeholder { color: var(--muted-foreground); opacity: 1; }
.form-control:focus, .form-select:focus {
  border-color: var(--ring); box-shadow: 0 0 0 1px var(--ring), var(--shadow-xs) !important; outline: none;
}
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background: var(--muted); opacity: .7; cursor: not-allowed; }
.form-text { font-size: .8125rem; margin-top: .375rem; }
.input-group > .btn { box-shadow: none; }
.input-group-text { background: var(--muted); border-color: var(--input); color: var(--muted-foreground); font-size: .875rem; border-radius: var(--radius-md); }
.form-check-input {
  width: 1rem; height: 1rem; margin-top: .2rem; border: 1px solid var(--ui-border-strong);
  border-radius: var(--radius-sm); background-color: var(--background); box-shadow: var(--shadow-xs);
}
.form-check-input[type="radio"] { border-radius: 50%; }
.form-check-input:checked { background-color: var(--app-primary); border-color: var(--app-primary); }
.form-check-input:focus { border-color: var(--ring); box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }
.form-switch .form-check-input { width: 2.25rem; height: 1.25rem; border-radius: 999px; border-color: transparent; background-color: var(--input); margin-top: .125rem; }
.form-switch .form-check-input:checked { background-color: var(--app-primary); }
.form-check-label { font-size: .875rem; }
fieldset.form-section, .form-section {
  border: 1px solid var(--border) !important; border-radius: var(--radius-xl) !important;
  background: var(--card) !important; box-shadow: none !important;
  padding: 1.25rem !important; margin: 0 0 1rem !important;
}
fieldset.form-section > legend, .form-section > legend {
  float: left; width: 100%; padding: 0 !important; margin: 0 0 1rem !important; border: 0 !important;
  font-size: .9375rem; font-weight: 600; letter-spacing: -.01em; text-transform: none; color: var(--foreground);
}
.form-section > legend + * { clear: both; }
.form-section .form-control, .form-section .form-select { background-color: var(--background); border-color: var(--input); }
.form-section .form-control.bg-body-secondary, .form-control.bg-body-secondary { background-color: var(--muted) !important; }
/* a picker with a button beside it fills the row */
.input-group > .searchable-select, .input-group > .form-select, .input-group > .form-control { flex: 1 1 auto; width: 1%; min-width: 0; }
.input-group > .searchable-select > .form-control, .input-group > .searchable-select > .form-select { width: 100%; }
.input-group > .btn { min-height: var(--control-h); border-color: var(--input) !important; }

/* ---- Card ------------------------------------------------------------ */
.card, .widget-card, .kpi-card {
  background: var(--card); color: var(--foreground);
  border: 1px solid var(--border) !important; border-radius: var(--radius-xl) !important;
  box-shadow: var(--shadow-xs) !important;
}
.card:hover, .widget-card:hover, .kpi-card:hover { transform: none; box-shadow: var(--shadow-xs) !important; }
.card-header {
  background: transparent !important; border-bottom: 1px solid var(--border);
  padding: .875rem 1.25rem; font-size: .9375rem; font-weight: 600; letter-spacing: -.01em; color: var(--foreground);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
}
.card-header .bi:first-child { color: var(--muted-foreground); }
.card-body { padding: 1.25rem; }
.card-footer { background: transparent; border-top: 1px solid var(--border); padding: .875rem 1.25rem; }
.kpi-card { padding: 1.125rem 1.25rem; gap: .875rem; }
.kpi-label { font-size: .8125rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted-foreground); }
.kpi-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.2; color: var(--foreground); }
.kpi-sub { font-size: .75rem; color: var(--muted-foreground); }
.kpi-icon { width: 2.25rem; height: 2.25rem; border-radius: var(--radius-md); font-size: 1rem; }
.kpi-card.kpi-link:hover { border-color: var(--ui-border-strong) !important; background: color-mix(in srgb, var(--muted) 40%, var(--card)); }

/* ---- Table ----------------------------------------------------------- */
.table { --bs-table-bg: transparent; --bs-table-hover-bg: color-mix(in srgb, var(--muted) 50%, transparent); color: var(--foreground); margin-bottom: 0; font-size: .875rem; }
.table > :not(caption) > * > * { padding: .625rem .75rem; border-bottom: 1px solid var(--border); background: transparent; }
.table > thead > tr > th, .table thead.table-light th, .table-light {
  --bs-table-bg: transparent; background: transparent !important;
  color: var(--muted-foreground); font-size: .8125rem; font-weight: 500; letter-spacing: 0; text-transform: none;
  height: 2.5rem; vertical-align: middle; white-space: nowrap; border-bottom: 1px solid var(--border);
}
.table > tbody > tr:last-child > * { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { background: color-mix(in srgb, var(--muted) 50%, transparent); }
.table tfoot.table-light td, .table > tfoot > tr > * { background: color-mix(in srgb, var(--muted) 50%, transparent) !important; font-weight: 500; border-top: 1px solid var(--border); }
.table-bordered > :not(caption) > * > * { border: 1px solid var(--border); }
.table a:not(.btn) { color: var(--foreground); font-weight: 500; }
.table a:not(.btn):hover { text-decoration: underline; text-underline-offset: 3px; }
.card > .table-responsive:last-child { border-radius: 0 0 var(--radius-xl) var(--radius-xl); }

/* ---- Badge ----------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: .25rem; border-radius: var(--radius-md);
  padding: .125rem .5rem; font-size: .75rem; font-weight: 600; line-height: 1.35; border: 1px solid transparent;
}
.badge.text-bg-primary, .badge.bg-primary { background: color-mix(in srgb, var(--app-primary) 12%, var(--background)) !important; color: var(--app-primary-dark, var(--app-primary)) !important; }
.badge.text-bg-secondary, .badge.bg-secondary, .badge.text-bg-dark { background: var(--muted) !important; color: var(--foreground) !important; }
.badge.text-bg-light, .badge.bg-light { background: var(--background) !important; color: var(--foreground) !important; border-color: var(--border) !important; }
.badge.text-bg-success, .badge.bg-success { background: #dcfce7 !important; color: #166534 !important; }
.badge.text-bg-warning, .badge.bg-warning { background: #fef3c7 !important; color: #92400e !important; }
.badge.text-bg-danger, .badge.bg-danger { background: #fee2e2 !important; color: #991b1b !important; }
.badge.text-bg-info, .badge.bg-info { background: #e0f2fe !important; color: #075985 !important; }
[data-bs-theme="dark"] .badge.text-bg-success { background: #14532d !important; color: #bbf7d0 !important; }
[data-bs-theme="dark"] .badge.text-bg-warning { background: #78350f !important; color: #fde68a !important; }
[data-bs-theme="dark"] .badge.text-bg-danger { background: #7f1d1d !important; color: #fecaca !important; }
[data-bs-theme="dark"] .badge.text-bg-info { background: #0c4a6e !important; color: #bae6fd !important; }

/* ---- Dropdown menu / Popover ----------------------------------------- */
.dropdown-menu {
  min-width: 10rem; padding: .25rem; font-size: .875rem; background: var(--background); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
}
.dropdown-item { border-radius: var(--radius-sm); padding: .375rem .5rem; color: var(--foreground); display: flex; align-items: center; gap: .5rem; width: 100%; }
.dropdown-item > .bi { margin: 0 !important; color: var(--muted-foreground); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--accent); color: var(--foreground); }
.dropdown-item.active, .dropdown-item:active { background: var(--accent); color: var(--foreground); font-weight: 500; }
.dropdown-item.text-danger, .dropdown-item.text-danger > .bi { color: var(--destructive) !important; }
.dropdown-header { padding: .375rem .5rem; font-size: .75rem; font-weight: 600; color: var(--muted-foreground); }
.dropdown-divider { margin: .25rem -.25rem; border-color: var(--border); opacity: 1; }
.dropdown-toggle::after { border-top-width: .3em; border-left-width: .25em; border-right-width: .25em; opacity: .5; margin-left: .25rem; }
.tooltip-inner { background: var(--foreground); color: var(--background); border-radius: var(--radius-md); font-size: .75rem; padding: .375rem .625rem; }

/* ---- Dialog (modal) and Sheet (offcanvas) ---------------------------- */
.modal-backdrop.show, .offcanvas-backdrop.show { opacity: .6; background: #000; }
.modal-content { background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.modal-header { border-bottom: 0; padding: 1.5rem 1.5rem .25rem; align-items: flex-start; }
.modal-title { font-size: 1.125rem; font-weight: 600; letter-spacing: -.02em; }
.modal-body { padding: 1rem 1.5rem; }
.modal-footer { border-top: 0; padding: .5rem 1.5rem 1.5rem; gap: .5rem; }
.modal-footer > * { margin: 0; }
.offcanvas { background: var(--background); border-color: var(--border) !important; box-shadow: var(--shadow-lg); }
.offcanvas-header { padding: 1.25rem 1.5rem .75rem; }
.offcanvas-title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.02em; }
.offcanvas-body { padding: .5rem 1.5rem 1.5rem; }

/* ---- Alert ----------------------------------------------------------- */
.alert { border: 1px solid var(--border); border-radius: var(--radius); background: var(--background); color: var(--foreground); padding: .75rem 1rem; font-size: .875rem; box-shadow: none; }
.alert-success { border-color: #bbf7d0; background: #f0fdf4; color: #14532d; }
.alert-danger { border-color: #fecaca; background: #fef2f2; color: #7f1d1d; }
.alert-warning { border-color: #fde68a; background: #fffbeb; color: #78350f; }
.alert-info { border-color: #bae6fd; background: #f0f9ff; color: #0c4a6e; }
.alert-light { background: var(--background); border-color: var(--border) !important; color: var(--foreground); }
[data-bs-theme="dark"] .alert-success, [data-bs-theme="dark"] .alert-danger,
[data-bs-theme="dark"] .alert-warning, [data-bs-theme="dark"] .alert-info { background: var(--card); color: var(--foreground); }

/* ---- Tabs (nav-tabs, nav-pills, the view switcher) -------------------- */
.nav-tabs, .nav-pills, .view-switcher {
  display: inline-flex; flex-wrap: nowrap; gap: 0; padding: .25rem; border: 0;
  background: var(--muted); border-radius: var(--radius); max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.nav-tabs::-webkit-scrollbar, .nav-pills::-webkit-scrollbar, .view-switcher::-webkit-scrollbar { display: none; }
.nav-tabs .nav-link, .nav-pills .nav-link, .view-switcher .btn {
  border: 0 !important; border-radius: var(--radius-md) !important; background: transparent !important;
  color: var(--muted-foreground) !important; font-size: .875rem; font-weight: 500;
  padding: 0 .75rem; min-height: 1.875rem; display: inline-flex; align-items: center; gap: .375rem;
  white-space: nowrap; box-shadow: none !important;
}
.nav-tabs .nav-link:hover, .nav-pills .nav-link:hover, .view-switcher .btn:hover { color: var(--foreground) !important; }
.nav-tabs .nav-link.active, .nav-pills .nav-link.active,
.view-switcher .btn.active, .view-switcher .btn.btn-primary {
  background: var(--background) !important; color: var(--foreground) !important; box-shadow: var(--shadow-xs) !important;
}

/* ---- Pagination, list group, accordion, progress ---------------------- */
.pagination { gap: .25rem; }
.page-link { border: 1px solid transparent; border-radius: var(--radius-md) !important; min-width: 2rem; min-height: 2rem; display: inline-flex; align-items: center; justify-content: center; padding: 0 .625rem; font-size: .875rem; font-weight: 500; color: var(--foreground); background: transparent; }
.page-link:hover { background: var(--accent); color: var(--foreground); border-color: transparent; }
.page-item.active .page-link { background: var(--background); border-color: var(--input); color: var(--foreground); box-shadow: var(--shadow-xs); }
.page-item.disabled .page-link { background: transparent; color: var(--muted-foreground); opacity: .5; }
.list-group-item { background: transparent; border-color: var(--border); color: var(--foreground); padding: .75rem 1.25rem; }
.accordion { --bs-accordion-border-color: var(--border); --bs-accordion-border-radius: var(--radius); --bs-accordion-inner-border-radius: var(--radius); --bs-accordion-btn-focus-box-shadow: none; --bs-accordion-active-bg: transparent; --bs-accordion-active-color: var(--foreground); --bs-accordion-bg: var(--card); }
.accordion-button { font-size: .875rem; font-weight: 500; padding: .875rem 1rem; }
.accordion-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.progress { height: .5rem; border-radius: 999px; background: var(--muted); }
.progress-bar { background: var(--app-primary); border-radius: 999px; }
kbd, .kbd-hint { background: var(--muted); color: var(--muted-foreground); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: .6875rem; font-weight: 500; padding: .0625rem .375rem; box-shadow: none; }

/* ---- Shell: sidebar and top bar -------------------------------------- */
.app-sidebar { background: var(--background); border-right: 1px solid var(--border); box-shadow: none; }
.sidebar-brand { border-bottom: 1px solid var(--border); }
.sidebar-nav .nav-link, .app-sidebar .nav-link {
  min-height: 2.125rem; padding: 0 .625rem; margin: 1px .5rem; border-radius: var(--radius-md);
  font-size: .875rem; font-weight: 500; color: var(--ui-text-2); gap: .625rem; display: flex; align-items: center;
}
.app-sidebar .nav-link .bi:first-child { font-size: 1rem; color: var(--muted-foreground); }
.app-sidebar .nav-link:hover { background: var(--accent); color: var(--foreground); }
.app-sidebar .nav-link.active { background: var(--accent); color: var(--foreground); font-weight: 600; }
.app-sidebar .nav-link.active .bi:first-child { color: var(--app-primary); }
.app-sidebar .nav-section { font-size: .75rem; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted-foreground); padding: 1rem 1.125rem .375rem; }
.app-sidebar .nav-sub .nav-link { min-height: 1.875rem; font-weight: 400; margin-left: 1.25rem; border-left: 1px solid var(--border); border-radius: 0 var(--radius-md) var(--radius-md) 0; padding-left: .875rem; }
.app-topbar {
  background: color-mix(in srgb, var(--background) 85%, transparent); backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border); box-shadow: none; min-height: 3.5rem; padding: 0 1rem;
}
.topbar-title h1 { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; }
.topbar-search {
  min-height: 2rem; border: 1px solid var(--input); border-radius: var(--radius-md); background: var(--background);
  color: var(--muted-foreground); box-shadow: var(--shadow-xs); font-size: .8125rem;
}
.topbar-search:hover { background: var(--accent); color: var(--foreground); }
.app-content { padding: 1.25rem; }
.app-footer { border-top: 0; color: var(--muted-foreground); font-size: .75rem; background: transparent; }
.report-tile { border-radius: var(--radius-xl); border-color: var(--border); box-shadow: var(--shadow-xs); }
.report-tile:hover { border-color: var(--ui-border-strong); box-shadow: var(--shadow-xs); transform: none; background: color-mix(in srgb, var(--muted) 40%, var(--card)); }
.report-tile-icon { border-radius: var(--radius-md); background: var(--tile-soft, var(--muted)); color: var(--tile, var(--foreground)); }
.report-tile { border-left: 3px solid var(--tile, var(--border)); }
.report-tile:hover .report-tile-go { color: var(--tile, var(--app-primary)); }
/* one colour per report, so each is recognised at a glance */
.tone-blue   { --tile: #2563eb; --tile-soft: #eff6ff; }
.tone-green  { --tile: #16a34a; --tile-soft: #f0fdf4; }
.tone-violet { --tile: #7c3aed; --tile-soft: #f5f3ff; }
.tone-amber  { --tile: #d97706; --tile-soft: #fffbeb; }
.tone-rose   { --tile: #e11d48; --tile-soft: #fff1f2; }
.tone-teal   { --tile: #0d9488; --tile-soft: #f0fdfa; }
[data-bs-theme="dark"] .report-tile-icon { background: color-mix(in srgb, var(--tile, #fff) 18%, transparent); }

/* KPI cards in the style of the report tiles: a coloured edge on the left, the
   icon on a tinted square of the same colour, and an arrow when the card opens
   the list behind its figure. */
.kpi-1 { --tile: #2563eb; --tile-soft: #eff6ff; }
.kpi-2 { --tile: #7c3aed; --tile-soft: #f5f3ff; }
.kpi-3 { --tile: #16a34a; --tile-soft: #f0fdf4; }
.kpi-4 { --tile: #d97706; --tile-soft: #fffbeb; }
.kpi-5 { --tile: #0d9488; --tile-soft: #f0fdfa; }
.kpi-6 { --tile: #e11d48; --tile-soft: #fff1f2; }
.kpi-card { display: flex; align-items: center; border-radius: var(--radius-xl, 12px); position: relative;
            border-left: 3px solid var(--tile, var(--border)) !important; }
.kpi-card .kpi-icon { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 10px;
                      background: var(--tile-soft, var(--muted)) !important; color: var(--tile, var(--foreground)) !important; }
.kpi-card .kpi-body { flex: 1 1 auto; min-width: 0; }
a > .kpi-card::after, .kpi-card.kpi-link::after {
  content: ""; width: .45rem; height: .45rem; margin: 0;
  /* in the top right corner, so that a long figure never runs into it */
  position: absolute; inset: auto; top: 1.05rem; right: 1rem; background: none; border-radius: 0; opacity: 1;
  border-top: 2px solid var(--ui-text-3, #98a2b3); border-right: 2px solid var(--ui-text-3, #98a2b3);
  transform: rotate(45deg); transition: transform .15s ease, border-color .15s ease;
}
a:hover > .kpi-card, .kpi-card.kpi-link:hover { background: color-mix(in srgb, var(--muted) 40%, var(--card)) !important;
                                               border-color: var(--ui-border-strong); }
a:hover > .kpi-card::after, .kpi-card.kpi-link:hover::after { border-color: var(--tile); transform: translateX(2px) rotate(45deg); }
[data-bs-theme="dark"] .kpi-card .kpi-icon { background: color-mix(in srgb, var(--tile, #fff) 18%, transparent) !important; }
/* dashboard section headings */
.dash-heading { font-size: .8125rem; font-weight: 600; color: var(--muted-foreground); margin: 1rem 0 .5rem; }
/* one heading for every dashboard section (macro dash_section) */
.dash-section { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin: 1.25rem 0 .6rem; }
.dash-section-title { display: flex; align-items: center; gap: .45rem; margin: 0; font-size: .95rem; font-weight: 600;
  color: var(--ui-text, inherit); letter-spacing: -.005em; }
.dash-section-title .bi { color: var(--app-primary); font-size: 1rem; }
.dash-section-link { font-size: .8rem; text-decoration: none; white-space: nowrap; }
.dash-section-link:hover { text-decoration: underline; }
/* a dashboard filter in use; the cross removes it */
.filter-chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; padding: .2rem .55rem;
  border-radius: 999px; text-decoration: none; color: var(--app-primary);
  background: color-mix(in srgb, var(--app-primary) 10%, transparent); border: 1px solid color-mix(in srgb, var(--app-primary) 30%, transparent); }
.filter-chip:hover { background: color-mix(in srgb, var(--app-primary) 18%, transparent); color: var(--app-primary); }
.filter-chip .bi { font-size: .65rem; }
.auth-form .btn { min-height: 2.5rem; }

.help-trigger { padding: 0 !important; min-height: 0 !important; }
.btn.rounded-circle { padding: 0; }

/* ---- Getting started: checklist, dashboard card, coach panel, practice banner */
.learn-tick {
  flex: 0 0 auto; width: 1.75rem; height: 1.75rem; border-radius: 999px; display: grid; place-items: center;
  font-size: .75rem; font-weight: 600; background: var(--muted); color: var(--muted-foreground); border: 1px solid var(--border);
}
.learn-tick.done { background: #16a34a; border-color: #16a34a; color: #fff; }
.learn-card {
  display: flex; align-items: center; gap: .875rem; padding: .625rem .875rem; margin-bottom: 1rem;
  background: var(--card); border: 1px solid var(--border); border-left: 3px solid var(--app-primary);
  border-radius: var(--radius-xl); color: inherit; box-shadow: var(--shadow-xs);
}
.learn-card:hover { border-color: var(--ui-border-strong); border-left-color: var(--app-primary); color: inherit; }
.learn-card-ring {
  flex: 0 0 auto; min-width: 2.5rem; height: 2.5rem; padding: 0 .375rem; border-radius: 999px; display: grid; place-items: center;
  font-size: .75rem; font-weight: 700; color: var(--app-primary-dark, var(--app-primary));
  background: color-mix(in srgb, var(--app-primary) 10%, transparent);
}
.learn-coach {
  position: fixed; right: 1rem; bottom: 4.25rem; z-index: 1040; width: min(22rem, calc(100vw - 2rem));
  background: var(--card); border: 1px solid var(--border); border-top: 3px solid var(--app-primary);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); padding: .75rem .875rem .875rem;
}
.learn-coach.is-done { border-top-color: #16a34a; }
.learn-coach-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .25rem; }
.learn-coach-head .btn-close { font-size: .625rem; }
.learn-coach-title { font-weight: 600; font-size: .9375rem; line-height: 1.3; margin-bottom: .25rem; }
.learn-coach ol li { margin-bottom: .125rem; }
.practice-banner {
  background: #fef3c7; color: #78350f; border: 1px solid #fde68a; border-radius: var(--radius);
  padding: .5rem .875rem; margin-bottom: 1rem; font-size: .875rem;
}
@media (max-width: 767.98px) { .learn-coach { bottom: 4.75rem; right: .5rem; left: .5rem; width: auto; } }

/* ---- Billing: numbered steps in the menu, and the "Next step" line on each screen -- */
.nav-step {
  flex: 0 0 auto; width: 1.25rem; height: 1.25rem; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: .6875rem; font-weight: 600; background: var(--muted); color: var(--muted-foreground); border: 1px solid var(--border);
}
.app-sidebar .nav-link.active .nav-step { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.next-step {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  background: color-mix(in srgb, var(--app-primary) 6%, var(--card));
  border: 1px solid color-mix(in srgb, var(--app-primary) 28%, var(--border)); border-left-width: 4px;
  border-radius: var(--radius-xl); padding: .625rem .875rem; margin-bottom: 1rem; box-shadow: var(--shadow-xs);
}
.next-step-late { background: color-mix(in srgb, var(--destructive) 6%, var(--card)); border-color: color-mix(in srgb, var(--destructive) 35%, var(--border)); }
.next-step-clear { background: var(--card); border-color: var(--border); }
.next-step-icon { font-size: 1.125rem; color: var(--app-primary); flex: 0 0 auto; }
.next-step-late .next-step-icon { color: var(--destructive); }
.next-step-clear .next-step-icon { color: var(--muted-foreground); }
.next-step-text { flex: 1 1 20rem; min-width: 0; margin: 0; font-size: .875rem; color: var(--foreground); }
.next-step-clear .next-step-text { color: var(--muted-foreground); }
.next-step-go { flex: 0 0 auto; }
/* the row a "Go to ..." button jumps to: clear of the top bar, and marked */
tr[id] { scroll-margin-top: 5rem; }
tr:target > td { background: color-mix(in srgb, var(--app-primary) 10%, var(--card)) !important; }
@media (max-width: 575.98px) { .next-step-go { width: 100%; } }

/* "Filters" button for list filter panels: phones only (app.js adds it) */
.filter-toggle { display: none; }

/* ---- Bottom navigation (phones only; markup in base.html) ------------ */
.mobile-nav { display: none; }

/* The line that says which date range is applied */
.date-range-note { color: var(--ui-text-2, #475467); background: var(--bs-primary-bg-subtle, #eef2ff);
                   border-radius: 8px; padding: .35rem .65rem; display: inline-block; }

/* Pipeline board: the line under a column heading (period and total value) */
.kanban-subhead { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: .78rem;
                  color: var(--ui-text-2, #667085); padding: 0 .5rem .6rem; margin-top: -.5rem; }
.kanban-subhead strong { color: var(--ui-text, #101828); font-weight: 600; }
.kanban-column.drop-refused { outline: 2px dashed var(--bs-danger); outline-offset: -2px; }

/* The board on a phone or tablet: columns one below another. Nothing inside it
   scrolls by itself (a scroll area inside the page's own traps the finger on
   some phones); a row of names jumps to a column; a heading folds its column. */
.kanban-jump { display: none; }
@media (max-width: 991.98px) {
  /* The top bar is meant to stay in view while the page scrolls. It did not on
     phones: hiding sideways overflow made these two boxes scroll areas of their
     own, and a bar sticks to the nearest one. "clip" hides the overflow without that. */
  .app-main, .app-content { overflow-x: clip; overflow-y: visible; }
  .app-topbar { top: 0; z-index: 1020; background: var(--ui-surface, #fff); }
  .kanban-board { overflow: visible; min-height: 0; padding: .25rem 0 0; }
  .kanban-column { min-width: 0; max-width: 100%; scroll-margin-top: 7.5rem; }
  .kanban-cards { overflow: visible; min-height: 0; flex: none; }
  .kanban-cards .empty-state { padding-top: .5rem !important; padding-bottom: .5rem !important; }
  .kanban-cards .empty-state-icon { display: none; }      /* an empty column takes one line, not half a screen */
  .kanban-jump { display: flex; gap: .4rem; overflow-x: auto; position: sticky; top: 3.1rem; z-index: 6;
                 background: var(--ui-bg, #f9fafb); padding: .45rem 0; margin: 0 0 .35rem;
                 -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .kanban-jump::-webkit-scrollbar { display: none; }
  .kanban-jump a { flex: 0 0 auto; white-space: nowrap; text-decoration: none; font-size: .8rem; font-weight: 600;
                   color: var(--ui-text, #101828); background: #fff; border: 1px solid var(--ui-border, #e4e7ec);
                   border-radius: 999px; padding: .3rem .7rem; }
  .kanban-jump a span { color: var(--ui-text-2, #667085); font-weight: 500; margin-left: .2rem; }
  .kanban-header { cursor: pointer; user-select: none; }
  .kanban-header::after { content: "\25BE"; margin-left: .5rem; color: var(--ui-text-2, #667085); }
  .kanban-column.is-folded .kanban-header::after { content: "\25B8"; }
  .kanban-column.is-folded .kanban-cards, .kanban-column.is-folded .kanban-subhead { display: none; }
  .kanban-column.is-folded .kanban-header { margin-bottom: 0; }
}
/* phones have "+" in the bar at the bottom: the second floating "+" only covers the board */
@media (max-width: 767.98px) {
  .fab { display: none !important; }
}

/* The organisation's logo where the menu or the sign-in panel is off screen */
.brand-logo { display: block; width: auto; object-fit: contain; }
.brand-logo-icon { font-size: 1.5rem; line-height: 1; color: var(--bs-primary); }
.topbar-brand { display: none; align-items: center; flex: 0 0 auto; text-decoration: none; }
.topbar-brand .brand-logo { height: 28px; max-width: 104px; }
.auth-brand-mobile { display: none; }
@media (max-width: 991.98px) {
  .topbar-brand { display: inline-flex; }
  /* the page title gives way before the logo does */
  .app-topbar .topbar-title { min-width: 0; }
  .app-topbar .topbar-title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 420px) {
  .topbar-brand .brand-logo { height: 24px; max-width: 80px; }
}

/* =====================================================================
   Phones and small tablets
   ===================================================================== */
@media (max-width: 767.98px) {
  html, body { overflow-x: hidden; }
  body { font-size: .9375rem; }
  .app-main { min-width: 0; width: 100%; }
  .app-content { padding: .75rem .75rem 5.25rem; }
  .app-footer { display: none; }

  /* top bar: title + the essentials */
  .app-topbar { padding: 0 .625rem; gap: .375rem !important; min-height: 3.25rem; position: sticky; top: 0; z-index: 1020; }
  .app-topbar .sidebar-collapse-btn, .app-topbar .kbd-hint, .app-topbar .topbar-search-text { display: none !important; }
  .app-topbar .topbar-title { min-width: 0; flex: 1 1 auto; }
  .app-topbar .topbar-title h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-topbar .ms-auto { gap: .375rem !important; flex: 0 0 auto; }
  .app-topbar .topbar-search { width: 2.25rem; min-width: 0; padding: 0; justify-content: center; }
  .app-topbar .bu-switcher .btn { max-width: 6.5rem; overflow: hidden; text-overflow: ellipsis; }
  .app-topbar .btn, .app-topbar .topbar-search { min-height: 2.25rem; }
  .app-topbar .dropdown .badge { display: none; }
  .app-topbar a.btn-primary { display: none; }      /* the + lives in the bottom bar */

  /* comfortable touch targets; 16px inputs stop iOS zooming on focus */
  .btn, .btn-sm { min-height: 2.5rem; }
  .table .btn-sm, .input-group .btn, .view-switcher .btn { min-height: 2.25rem; }
  .form-control, .form-select, .form-control-sm, .form-select-sm { min-height: 2.75rem; font-size: 1rem; }
  .form-check-input { width: 1.25rem; height: 1.25rem; }
  .form-switch .form-check-input { width: 2.75rem; height: 1.5rem; }
  .dropdown-item { padding: .625rem .625rem; }

  /* page headers and button rows wrap instead of overflowing */
  .app-content > .d-flex, .card-header.d-flex { flex-wrap: wrap; gap: .5rem; }
  .app-content .d-flex.gap-2 { flex-wrap: wrap; }
  .card-body { padding: 1rem; }
  fieldset.form-section, .form-section { padding: 1rem !important; }
  .card-header { padding: .75rem 1rem; }
  .kpi-card { padding: .875rem; }
  .kpi-value { font-size: 1.25rem; }
  .nav-tabs, .nav-pills, .view-switcher { display: flex; width: 100%; }

  /* filter rows: one field per line, full-width action */
  form.row > [class*="col-"] { flex: 0 0 100%; max-width: 100%; }
  form.row > .col-6 { flex: 0 0 50%; max-width: 50%; }
  form .d-flex.justify-content-end { position: sticky; bottom: 4.25rem; z-index: 5; background: color-mix(in srgb, var(--ui-bg) 92%, transparent); backdrop-filter: blur(6px); padding: .625rem 0; margin-bottom: 0 !important; }
  form .d-flex.justify-content-end > .btn { flex: 1 1 0; }

  /* filter panels start closed behind the "Filters" button */
  .filter-toggle { display: inline-flex; }
  form.filter-collapsible { display: none; margin-top: .75rem; }
  form.filter-collapsible.is-open { display: flex; }

  /* tables: cards where marked (.table-reflow, below), sideways scroll elsewhere */
  .table-responsive { -webkit-overflow-scrolling: touch; }
  .inline-edit-note { display: none; }       /* a phone has no double-click */

  /* dialogs become bottom sheets */
  .modal-dialog { margin: 0; position: fixed; left: 0; right: 0; bottom: 0; max-width: none; }
  .modal.fade .modal-dialog { transform: translateY(100%); }
  .modal.show .modal-dialog { transform: none; }
  .modal-content { border-radius: var(--radius-xl) var(--radius-xl) 0 0; border-bottom: 0; max-height: 92vh; overflow-y: auto; }
  .modal-header { padding: 1.25rem 1rem .25rem; }
  .modal-body { padding: .75rem 1rem; }
  .modal-footer { padding: .5rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
  .modal-footer > .btn { flex: 1 1 0; }
  .dropdown-menu { max-width: calc(100vw - 1.5rem); }

  /* sign-in: the form, under the logo */
  .auth-split { display: block; }
  .auth-aside { display: none; }
  .auth-main { padding: 2rem 1.25rem; }
  .auth-brand-mobile { display: flex; flex-direction: column; align-items: center; gap: .5rem; margin-bottom: 1.75rem;
                       font-weight: 600; color: var(--ui-text-2, #475467); text-align: center; }
  .auth-brand-mobile .brand-logo { height: 52px; max-width: 220px; }
  .auth-brand-mobile .brand-logo-icon { font-size: 2.2rem; }
  .app-topbar .topbar-title h1 { font-size: .95rem; }

  /* bottom navigation */
  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    background: color-mix(in srgb, var(--background) 92%, transparent); backdrop-filter: saturate(180%) blur(10px);
    border-top: 1px solid var(--border); padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom));
  }
  /* five items alike: an icon in a box of one height, the name under it, so the
     icons sit on one line and the names on another; "+" is a filled circle in that box */
  .mobile-nav a, .mobile-nav button {
    flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .125rem;
    min-height: 3.5rem; border: 0; background: transparent; border-radius: var(--radius-md);
    color: var(--muted-foreground); font-size: .6875rem; font-weight: 500; text-decoration: none; line-height: 1.2;
  }
  .mobile-nav a > .bi, .mobile-nav button > .bi, .mobile-nav .plus { height: 2.25rem; display: grid; place-items: center; }
  .mobile-nav .bi { font-size: 1.3rem; line-height: 1; }
  .mobile-nav .bi::before { vertical-align: 0; display: block; }
  .mobile-nav a.active { color: var(--foreground); font-weight: 600; }
  .mobile-nav a.active .bi { color: var(--app-primary); }
  .mobile-nav .mobile-nav-add { color: var(--foreground); }
  .mobile-nav .mobile-nav-add span.plus {
    position: relative; width: 2.25rem; border-radius: 999px;
    background: var(--app-primary); color: #fff; box-shadow: 0 2px 6px color-mix(in srgb, var(--app-primary) 40%, transparent);
  }
  /* the "+" is two bars, not the icon font: the font's "+" sits off its own centre */
  .mobile-nav .mobile-nav-add span.plus .bi { display: none; }
  .mobile-nav .mobile-nav-add span.plus::before, .mobile-nav .mobile-nav-add span.plus::after {
    content: ""; position: absolute; left: 50%; top: 50%; width: 1rem; height: 2px; border-radius: 2px;
    background: #fff; transform: translate(-50%, -50%); }
  .mobile-nav .mobile-nav-add span.plus::after { transform: translate(-50%, -50%) rotate(90deg); }
  .help-trigger { bottom: 5rem !important; }
}

/* ---- Phones: a top bar like an app's (1.22.6) ----------------------------
   The Menu is in the bottom bar, so the bar here keeps only: the logo on the
   dashboard or the page's name elsewhere, the unit, Search, the bell and the
   account. "Getting started" stays in the menu. Every button is the same square. */
@media (max-width: 767.98px) {
  .app-topbar .sidebar-toggle { display: none !important; }   /* Menu (bottom bar) opens the same */
  .app-topbar .dropdown:has(> .learn-top) { display: none; }
  .app-topbar:not(.is-home) .topbar-brand { display: none; }
  .app-topbar.is-home .topbar-title { display: none; }
  .app-topbar .topbar-title { flex: 1 1 0; min-width: 0; }      /* a long page name shortens; the buttons never move */
  .app-topbar .topbar-title h1 { font-size: 1.0625rem; font-weight: 700; }
  .app-topbar .ms-auto { flex: 0 0 auto; margin-left: auto; }
  .app-topbar .bu-switcher .btn { max-width: 7.25rem; padding: 0 .55rem; display: inline-flex; align-items: center; }
  .app-topbar .bu-switcher .bi-buildings { display: none; }
  .app-topbar .ms-auto > a.btn:not(.btn-primary), .app-topbar .ms-auto > .dropdown:not(.bu-switcher) > .btn, .app-topbar .topbar-search {
    min-width: 2.25rem; height: 2.25rem; padding: 0 .5rem; display: inline-flex; align-items: center; justify-content: center; }
  .app-topbar .ms-auto > .dropdown:not(.bu-switcher) > .dropdown-toggle::after { display: none; }
  .app-topbar .bi { font-size: 1.05rem; }
}

/* ---- A list's less-used tools behind "More" on a phone (1.22.6) ----------
   On a laptop the wrapper is invisible to the layout (display: contents), so
   the buttons sit in their row as before. */
.tools-more { display: contents; }
.tools-more-toggle { display: none; }
@media (max-width: 767.98px) {
  .tools-more-toggle { display: inline-flex; align-items: center; }
  .tools-more { display: none; }
  .tools-more.is-open { display: flex; flex-wrap: wrap; gap: .5rem; flex: 1 1 100%; order: 5;
    padding: .625rem; border: 1px solid var(--ui-border, #e4e4e7); border-radius: 12px; background: var(--card, #fff); }
  .tools-more-toggle[aria-expanded="true"] { background: var(--app-primary) !important; border-color: var(--app-primary) !important; color: #fff !important; }
  .list-tools .list-new { display: none; }       /* "New" in the bottom bar does the same */
}

/* ---- Lists as cards on a phone (1.22.6) ----------------------------------
   Every table marked .table-reflow. A card: its name across the top (the cell
   marked .rc-title, else the first), the other fields in two columns with a
   small name above each value, and the buttons in one row along the bottom.
   A tap on the card opens the record (app.js). */
@media (max-width: 767.98px) {
  .table-reflow, .table-reflow tbody { display: block; width: 100%; }
  .table-reflow thead { display: none; }
  .table-responsive:has(> .table-reflow) { background: var(--ui-bg, #f4f4f5); }
  .table-reflow tbody { padding: .75rem .625rem .125rem; }
  .table-reflow tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 1rem; row-gap: .6rem;
    margin: 0 0 .625rem; padding: .875rem 1rem .75rem;
    background: var(--card, #fff); border: 1px solid var(--ui-border, #e4e4e7); border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .05); cursor: pointer;
  }
  .table-reflow tbody tr:active { border-color: var(--app-primary); }
  .table-reflow.table > tbody > tr > td {
    display: flex; flex-direction: column; align-items: flex-start; gap: .125rem; min-width: 0;
    padding: 0 !important; border: 0 !important; background: transparent !important; box-shadow: none !important;
    position: static !important; text-align: left !important; white-space: normal !important;
    font-size: .9375rem; line-height: 1.35; overflow-wrap: anywhere;
  }
  .table-reflow.table > tbody > tr > td::before {
    content: attr(data-label); font-size: .6875rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
    color: var(--muted-foreground, #71717a); line-height: 1.3;
  }
  .table-reflow.table > tbody > tr > td:not([data-label])::before,
  .table-reflow.table > tbody > tr > td[data-label=""]::before { content: none; }
  /* the name: across the card, larger, no label; what follows it (an ID, the summary button) flows after it */
  .table-reflow.table > tbody > tr > td.rc-title,
  .table-reflow.table > tbody > tr:not(:has(> td.rc-title)) > td:first-child {
    display: block; grid-column: 1 / -1; order: -1; font-size: 1.0625rem; font-weight: 600; line-height: 1.3; }
  .table-reflow.table > tbody > tr > td.rc-title::before,
  .table-reflow.table > tbody > tr:not(:has(> td.rc-title)) > td:first-child::before { content: none; }
  .table-reflow tbody td .cell-truncate { max-width: none; white-space: normal; }
  .table-reflow tbody td .cell-sub { margin-top: .25rem; font-size: .8125rem; font-weight: 500; }
  /* the buttons: one row along the bottom, right-aligned, no label */
  .table-reflow.table > tbody > tr > td[data-label="Actions"],
  .table-reflow.table > tbody > tr > td:not([data-label]):last-child:not(:first-child) {
    grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .5rem;
    margin-top: .125rem; padding-top: .625rem !important; border-top: 1px solid var(--ui-border, #e4e4e7) !important; }
  .table-reflow.table > tbody > tr > td[data-label="Actions"]::before { content: none; }
  .table-reflow tbody td[data-label="Actions"] .btn { min-width: 2.75rem; min-height: 2.5rem; margin: 0 !important;
    display: inline-flex; align-items: center; justify-content: center; }
  .table-reflow tbody td[data-label="Actions"] .dropdown { display: inline-block; }
  /* a message instead of rows */
  .table-reflow.table > tbody > tr > td[colspan] { grid-column: 1 / -1; align-items: center; text-align: center !important; }
  .table-reflow tbody tr:has(> td[colspan]) { cursor: default; }
}

/* Filters that allow several values (Stage, Service) */
.multi-select { width: 100%; }
.multi-select-toggle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-select-menu { min-width: 100%; max-height: 300px; overflow-y: auto; }
.multi-select-menu .dropdown-item { white-space: normal; cursor: pointer; font-size: .875rem; }

/* A pop-up whose fields sit inside a <form>: the form passes the pop-up's
   height on, so the fields scroll and the title and buttons stay in view. */
.modal-dialog-scrollable .modal-content > form {
  display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden;
}
.modal-dialog-scrollable .modal-content > form > .modal-body { overflow-y: auto; }
/* New Account pop-up: optional fields wait under "More details" */
.in-modal .more-detail { display: none; }
.in-modal.show-more .more-detail { display: block; }
.in-modal.show-more fieldset.more-detail { display: block; }
.account-matches { margin-top: .5rem; padding: .5rem .75rem; border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: .5rem; background: var(--bs-tertiary-bg, #f8f9fa); }
/* floating buttons step aside while a pop-up or a drop-down menu is open, so they never cover its fields or items */
body.modal-open .asst-launch, body.modal-open .help-trigger, body.modal-open .fab,
body:has(.dropdown-menu.show) .asst-launch, body:has(.dropdown-menu.show) .help-trigger, body:has(.dropdown-menu.show) .fab { display: none !important; }

/* ---- Dashboard figure cards with their trend (trend_card macro) ------- */
.tcard { --tile: var(--app-primary, #0f766e); --tile-soft: color-mix(in srgb, var(--tile) 10%, transparent);
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: .15rem;
  /* "wash": a stripe of the card's colour on top, fading to the card's own background,
     so the figures and bars still sit on plain ground */
  background: linear-gradient(180deg, color-mix(in srgb, var(--tile) 13%, var(--card, var(--ui-surface, #fff))) 0%,
                              var(--card, var(--ui-surface, #fff)) 62%);
  border: 1px solid var(--ui-border, #e4e7ec); border-top: 3px solid var(--tile);
  border-radius: var(--radius-xl, 12px); box-shadow: 0 2px 8px rgba(16,24,40,.06);
  padding: .9rem .9rem .7rem; min-width: 0; transition: border-color .15s ease; }
.tcard:hover { border-color: color-mix(in srgb, var(--tile) 55%, var(--ui-border, #e4e7ec)); border-top-color: var(--tile); }
.t-kpi-1 { --tile: #2563eb; } .t-kpi-2 { --tile: #7c3aed; } .t-kpi-3 { --tile: #16a34a; }
.t-kpi-4 { --tile: #d97706; } .t-kpi-5 { --tile: #0d9488; } .t-kpi-6 { --tile: #e11d48; }
.tcard-main { display: flex; flex-direction: column; align-items: center; gap: .15rem; width: 100%;
  color: inherit; text-decoration: none; border-radius: 8px; }
a.tcard-main:hover { text-decoration: none; color: inherit; }
a.tcard-main:focus-visible { outline: 2px solid var(--tile); outline-offset: 3px; }
.tcard-icon { width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center;
  background: var(--tile-soft); color: var(--tile); font-size: 1.05rem; margin-bottom: .2rem; }
.tcard-label { font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--tile); line-height: 1.3; }
.tcard-value { font-size: 1.4rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; color: var(--ui-text, inherit);
  font-variant-numeric: tabular-nums; max-width: 100%; overflow-wrap: anywhere; }
.tcard-sub { font-size: .76rem; color: var(--ui-text-2, #475467); min-height: 1.15em; line-height: 1.35; }
.tcard-sub a { position: relative; z-index: 1; }
.tcard-trend { display: flex; align-items: center; justify-content: center; gap: .35rem; flex-wrap: wrap; margin-top: .2rem; min-height: 1.3em; }
.tchip { font-size: .7rem; font-weight: 700; border-radius: 999px; padding: .05rem .5rem; white-space: nowrap; }
.tchip-good { background: color-mix(in srgb, #16a34a 14%, transparent); color: #15803d; }
.tchip-bad { background: color-mix(in srgb, #dc2626 13%, transparent); color: #b42318; }
.tchip-flat { background: color-mix(in srgb, #64748b 14%, transparent); color: var(--ui-text-2, #475467); }
.tcard-vs { font-size: .68rem; color: var(--ui-text-3, #667085); }
.tbars { display: flex; align-items: flex-end; gap: 4px; width: 100%; height: 34px; margin-top: auto; padding-top: .4rem; }
.tbar { flex: 1 1 0; height: var(--h); min-height: 2px; border-radius: 2px 2px 0 0; background: var(--tile); opacity: .32; display: block; }
.tbar-now { opacity: 1; }
a.tbar:hover, a.tbar:focus-visible { opacity: .75; outline: none; }
a.tbar-now:hover { opacity: .85; }
.tbar-empty { height: 100%; background: none; opacity: 1; border: 1px dashed color-mix(in srgb, var(--tile) 35%, transparent); border-bottom: none; }
.tcard-note { font-size: .66rem; color: var(--ui-text-3, #667085); margin-top: .2rem; line-height: 1.3; }
[data-bs-theme="dark"] .tcard { --tile-soft: color-mix(in srgb, var(--tile) 20%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tile) 20%, var(--card, #111827)) 0%, var(--card, #111827) 62%);
  box-shadow: none; }
/* the other two card styles (Settings > General > Card style); wash is the default above */
.cards-tint .tcard { background: color-mix(in srgb, var(--tile) 7%, var(--card, var(--ui-surface, #fff)));
  border: 1px solid color-mix(in srgb, var(--tile) 22%, var(--ui-border, #e4e7ec)); box-shadow: var(--shadow-xs, 0 1px 2px rgba(16,24,40,.05)); }
.cards-tint .tcard:hover { border-top-color: color-mix(in srgb, var(--tile) 55%, var(--ui-border, #e4e7ec)); }
[data-bs-theme="dark"] .cards-tint .tcard { background: color-mix(in srgb, var(--tile) 12%, var(--card, #111827)); }
.cards-lifted .tcard { background: var(--card, var(--ui-surface, #fff)); border: 0; border-top: 3px solid var(--tile);
  box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 6px 18px rgba(16,24,40,.07); transition: transform .15s ease, box-shadow .15s ease; }
.cards-lifted .tcard:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16,24,40,.08), 0 10px 24px rgba(16,24,40,.10); }
[data-bs-theme="dark"] .cards-lifted .tcard { background: var(--card, #111827); box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
@media (prefers-reduced-motion: reduce) { .cards-lifted .tcard:hover { transform: none; } }

.tcard-ring { display: none; }   /* only the Ring style shows the change as a ring */

/* Ring (1.22.7, Branding > Card style): white card, a colour tab on the right edge, an outlined icon,
   the change as a ring at the top right, and bold headings in a deeper shade of the card's colour.
   The figures, bars and captions are the same; only the look changes. */
.cards-ring .tcard { position: relative; background: var(--card, var(--ui-surface, #fff)); border: 0;
  border-radius: 18px; box-shadow: 0 1px 2px rgba(16,24,40,.05), 0 8px 22px rgba(16,24,40,.07);
  padding: 16px 22px 14px 18px; align-items: flex-start; text-align: left; overflow: hidden; }
.cards-ring .tcard::after { content: ""; position: absolute; right: 0; top: 38%; width: 10px; height: 46%;
  background: var(--tile); border-radius: 10px 0 0 10px; opacity: .9; }
.cards-ring .tcard:hover { border: 0; }
.cards-ring .tcard-main { align-items: flex-start; width: 100%; }
.cards-ring .tcard-icon { background: none; border: 1.5px solid var(--tile); color: var(--tile);
  width: 40px; height: 40px; border-radius: 12px; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; line-height: 1; }
.cards-ring .tcard-icon > i { display: block; line-height: 1; }
/* each glyph is drawn off-centre in its own em box; these shift the drawn shape to the middle
   of the square (measured on the real page at 1440 wide, 1.4rem icons) */
.cards-ring .tcard-icon > .bi-cash-stack { transform: translate(1.75px, 0); }
.cards-ring .tcard-icon > .bi-trophy { transform: translate(2.5px, -0.5px); }
.cards-ring .tcard-icon > .bi-percent { transform: translate(5px, 0); }
.cards-ring .tcard-icon > .bi-lightning { transform: translate(-0.25px, 0); }
.cards-ring .tcard-icon > .bi-arrow-repeat { transform: translate(2.5px, -0.25px); }
.cards-ring .tcard-icon > .bi-check2-circle { transform: translate(1.75px, 0); }
.cards-ring .tcard-icon > .bi-exclamation-triangle { transform: translate(1.5px, 0.5px); }
.cards-ring .tcard-icon > .bi-receipt { transform: translate(4px, 0); }
.cards-ring .tcard-icon > .bi-pause-circle { transform: translate(5px, 0); }
.cards-ring .tcard-icon > .bi-cash-coin { transform: translate(1.5px, 0); }
.cards-ring .tcard-icon > .bi-person-lines-fill { transform: translate(2.75px, 0); }
.cards-ring .tcard-icon > .bi-alarm { transform: translate(3.75px, -0.25px); }
.cards-ring .tcard-icon > .bi-calendar-plus { transform: translate(0, 1px); }
.cards-ring .tcard-icon > .bi-arrow-right-circle { transform: translate(1.5px, 0); }
.cards-ring .tcard-label { text-transform: none; letter-spacing: 0; font-weight: 700; font-size: .82rem;
  color: color-mix(in srgb, var(--tile) 62%, #000); }
.cards-ring .tcard-value { text-align: left; font-size: 1.5rem; margin: 1px 0 3px; }
.cards-ring .tcard-sub { text-align: left; width: 100%; }
.cards-ring .tcard-trend { display: none; }
.cards-ring .tcard-ring { display: flex; flex-direction: column; align-items: center; gap: 2px;
  position: absolute; top: 14px; right: 22px; width: 56px; }
.cards-ring .tring { position: relative; width: 48px; height: 48px; }
.cards-ring .tring svg { width: 48px; height: 48px; transform: rotate(-90deg); }
.cards-ring .ttrack { fill: none; stroke: var(--ui-border, #e4e7ec); stroke-width: 4; }
.cards-ring .tarc { fill: none; stroke: var(--tile); stroke-width: 4; stroke-linecap: round; }
.cards-ring .ttxt { position: absolute; inset: 0; display: grid; place-items: center; font-size: 10.5px; font-weight: 700;
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.cards-ring .ttxt.tone-good { color: #15803d; }
.cards-ring .ttxt.tone-bad { color: #b42318; }
.cards-ring .ttxt.tone-flat { color: var(--ui-text-2, #667085); }
.cards-ring .tcard-ringvs { font-size: .62rem; color: var(--ui-text-3, #667085); white-space: nowrap; }
.cards-ring .tbars { padding-right: 8px; }
.cards-ring .tcard-note { text-align: left; width: 100%; }
.cards-ring .tcard-sub, .cards-ring .tcard-value { overflow-wrap: anywhere; }
[data-bs-theme="dark"] .cards-ring .tcard { background: var(--card, #111827); box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
[data-bs-theme="dark"] .cards-ring .tcard-label { color: color-mix(in srgb, var(--tile) 80%, #fff); }
[data-bs-theme="dark"] .cards-ring .ttrack { stroke: rgba(255,255,255,.12); }
[data-bs-theme="dark"] .cards-ring .ttxt.tone-good { color: #4ade80; }
[data-bs-theme="dark"] .cards-ring .ttxt.tone-bad { color: #f97066; }
@media (max-width: 575.98px) {
  .cards-ring .tcard { padding: 12px 16px 10px 14px; }
  .cards-ring .tcard-icon { width: 32px; height: 32px; margin-bottom: 8px; font-size: 1.2rem; }
  .cards-ring .tcard-value { font-size: 1.2rem; }
  .cards-ring .tcard-ring { top: 10px; right: 16px; width: 46px; }
  .cards-ring .tring, .cards-ring .tring svg { width: 40px; height: 40px; }
  .cards-ring .tcard-ringvs { font-size: .56rem; }
}
[data-bs-theme="dark"] .tchip-good { color: #4ade80; } [data-bs-theme="dark"] .tchip-bad { color: #f97066; }
@media (max-width: 575.98px) {
  .tcard { padding: .7rem .55rem .55rem; }
  .tcard-icon { width: 28px; height: 28px; font-size: .9rem; }
  .tcard-label { font-size: .64rem; } .tcard-value { font-size: 1.15rem; } .tcard-sub { font-size: .7rem; }
  .tbars { height: 26px; gap: 3px; }
}
@media (prefers-reduced-motion: reduce) { .tcard { transition: none; } }

/* Getting started in the top bar: a ring filled to the share of tasks done */
.learn-top { display: inline-flex; align-items: center; }
.learn-top-ring { width: 1.25rem; height: 1.25rem; border-radius: 999px; display: inline-grid; place-items: center;
  background: conic-gradient(var(--app-primary) calc(var(--p, 0) * 1%), color-mix(in srgb, var(--app-primary) 15%, transparent) 0);
  position: relative; }
.learn-top-ring::before { content: ""; position: absolute; inset: 3px; border-radius: 999px; background: var(--card, #fff); }
.learn-top-ring .bi { position: relative; font-size: .7rem; color: var(--app-primary); }
.learn-top-menu { width: 17rem; }

/* Branding: the ready-made colours */
.brand-swatch { width: 2rem; height: 2rem; border-radius: 999px; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--ui-border, #e4e7ec); cursor: pointer; }
.brand-swatch:hover, .brand-swatch:focus-visible { box-shadow: 0 0 0 2px var(--ui-text, #101828); outline: none; }
.brand-swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ui-text, #101828); }

/* ---- 1.16: chips, the Settings bar and home, numbered form sections ---- */
/* One chip for everything: Settings groups, a group's screens, Picklists'
   lists, and the sections of a long form or page. When the chips fit on one
   line they stretch across it (.fill, set by app.js after measuring); when
   they do not, each is as wide as its name and they wrap. */
.chipbar { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; white-space: nowrap;
  padding: .4rem .85rem; border-radius: 999px; border: 1px solid var(--ui-border-strong); background: var(--card);
  color: var(--foreground); font-size: .875rem; font-weight: 500; line-height: 1.25; text-decoration: none; cursor: pointer;
}
.chip:hover { border-color: var(--app-primary); color: var(--app-primary); }
.chip:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; }
.chip.active, .chip[aria-current] { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.chip .count { font-size: .72rem; padding: 0 .4rem; border-radius: 999px; background: var(--muted); color: var(--muted-foreground); }
.chip.active .count { background: rgb(255 255 255 / .22); color: #fff; }
.chip .chip-bad { background: var(--destructive); color: #fff; font-size: .68rem; font-weight: 700; border-radius: 999px; padding: 0 .38rem; }
.chip .chip-ok { color: #16a34a; }
.chip.active .chip-ok { color: #bbf7d0; }
.chip .chip-num { display: inline-flex; width: 1.25rem; height: 1.25rem; border-radius: 50%; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--app-primary) 12%, transparent); color: var(--app-primary); font-size: .7rem; font-weight: 700; }
.chip.active .chip-num { background: #fff; }
.chipbar.fill > .chip { flex: 1 1 0; }
.chip-group-label { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); margin: .4rem 0 .35rem; }
/* the section chips of a form or a long page stay at the top while it scrolls */
.chipbar.section-chips { position: sticky; top: var(--sticky-top, 0px); z-index: 20; padding: .6rem 0; margin-bottom: .75rem;
  background: color-mix(in srgb, var(--ui-bg, #fafafa) 94%, transparent); backdrop-filter: blur(4px);
  border-bottom: 1px solid var(--border); }

/* Settings: the bar on every screen, and the home */
.settings-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.settings-bar .chipbar { flex: 1 1 100%; }
.settings-home { font-weight: 600; text-decoration: none; }
.set-search { position: relative; max-width: 720px; margin: .25rem auto 1.5rem; }
.set-search > .bi { position: absolute; left: 1rem; top: .85rem; color: var(--muted-foreground); font-size: 1.05rem; }
.set-search input { height: 3rem; padding-left: 2.75rem; font-size: 1rem; border-radius: .75rem; }
.set-results { position: absolute; left: 0; right: 0; top: calc(100% + .35rem); z-index: 30; background: var(--card);
  border: 1px solid var(--border); border-radius: .75rem; box-shadow: var(--shadow-lg); overflow: hidden; }
.set-results a { display: flex; gap: .75rem; align-items: baseline; padding: .6rem 1rem; color: inherit; text-decoration: none;
  border-bottom: 1px solid var(--border); }
.set-results a:last-child { border-bottom: 0; }
.set-results a.hl, .set-results a:hover { background: color-mix(in srgb, var(--app-primary) 8%, transparent); }
.set-results small { color: var(--muted-foreground); }
.set-group { margin-bottom: 1.5rem; }
.set-group h2 { font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-foreground); margin-bottom: .6rem; }
.tile { display: flex; gap: .8rem; padding: 1rem; background: var(--card); border: 1px solid var(--border); border-radius: .75rem;
  height: 100%; color: inherit; text-decoration: none; }
.tile:hover, .tile:focus-visible { border-color: var(--app-primary); box-shadow: var(--shadow-md); }
.tile .ic { width: 2.4rem; height: 2.4rem; border-radius: .6rem; flex: none; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--app-primary) 10%, transparent); color: var(--app-primary); font-size: 1.15rem; }
.tile b { display: block; font-weight: 600; }
.tile span { font-size: .82rem; color: var(--muted-foreground); }

/* Picklists: the chosen list */
.pl-panel { background: var(--card); border: 1px solid var(--border); border-radius: .75rem; overflow: hidden; }
.pl-head { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; padding: .85rem 1.1rem;
  border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--app-primary) 6%, transparent); }
.pl-head h3 { font-size: 1.05rem; margin: 0; font-weight: 650; }
.pl-head small { color: var(--muted-foreground); }

/* Every form section: a numbered, tinted heading band, so each part of a
   form is easy to tell apart and to find (the chips above jump to them). */
form { counter-reset: formsec; }
fieldset.form-section, .form-section { counter-increment: formsec; border-left: 4px solid var(--app-primary) !important;
  padding-top: 0 !important; scroll-margin-top: 5rem; }
/* no overflow: hidden on the section: it cut off the drop-down lists inside it
   (1.17); the heading band takes the section's rounded corners itself */
fieldset.form-section > legend, .form-section > legend {
  border-radius: calc(var(--radius-xl) - 1px) calc(var(--radius-xl) - 1px) 0 0;
  display: flex; align-items: center; gap: .6rem; margin: 0 -1.25rem 1.1rem !important; width: calc(100% + 2.5rem);
  padding: .75rem 1.25rem !important; background: color-mix(in srgb, var(--app-primary) 7%, transparent);
  border-bottom: 1px solid var(--border) !important; font-size: 1rem; font-weight: 650;
}
fieldset.form-section > legend::before, .form-section > legend::before {
  content: counter(formsec); flex: none; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; background: var(--app-primary); color: #fff; font-size: .82rem; font-weight: 700;
}
.form-section > legend .sec-state { margin-left: auto; font-size: .8rem; font-weight: 500; color: var(--muted-foreground); }
.form-section > legend .sec-state.ok { color: #16a34a; }
.form-section > legend .sec-state.bad { color: var(--destructive); font-weight: 600; }
.form-section + .form-section { margin-top: 1.25rem !important; }
/* a section that holds only a page part (not a numbered form step) */
.page-section { scroll-margin-top: 5rem; }

@media (max-width: 575.98px) {
  /* the section chips stay one line and slide sideways on a phone */
  .chipbar.section-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chipbar.section-chips::-webkit-scrollbar { display: none; }
  .chipbar.section-chips.fill > .chip { flex: 0 0 auto; }
  fieldset.form-section > legend, .form-section > legend { margin: 0 -1rem .9rem !important; width: calc(100% + 2rem); padding: .65rem 1rem !important; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* one Save for a long page, always in reach */
.save-bar { position: sticky; bottom: 0; z-index: 20; display: flex; justify-content: flex-end; align-items: center; gap: 1rem;
  padding: .75rem 1rem; margin: 0 -.25rem; background: color-mix(in srgb, var(--card, #fff) 94%, transparent);
  backdrop-filter: blur(4px); border-top: 1px solid var(--border); }
/* Roles: a group of field switches that folds */
.fp-section { border: 1px solid var(--border); border-radius: var(--radius-md); padding: .5rem .75rem; }
.fp-section > summary { cursor: pointer; list-style: none; }
.fp-section > summary::-webkit-details-marker { display: none; }
.fp-section > summary::before { content: "\203A"; display: inline-block; width: 1rem; transition: transform .15s; color: var(--muted-foreground); }
.fp-section[open] > summary::before { transform: rotate(90deg); }
.form-switch .form-check-input + .form-check-label { margin-left: .5rem; }

/* ---- Visibility (1.22.4) --------------------------------------------------
   Controls must stand out from the page: their outline reaches 3:1 against
   what is behind them (WCAG 1.4.11). Cards and table lines stay light; only
   things people click or type into get the stronger outline.               */
:root { --input: #8a8a94; }                     /* fields, selects, checkboxes, outline buttons: 3.4:1 on white */

/* tabs and view switchers: a visible track, a clearly marked choice */
.nav-tabs, .nav-pills, .view-switcher, .btn-group.filter-status {
  background: var(--background); border: 1px solid var(--input) !important;
}
.nav-tabs .nav-link, .nav-pills .nav-link, .view-switcher .btn, .btn-group.filter-status .btn {
  color: #3f3f46 !important;                    /* 10:1 */
}
.nav-tabs .nav-link:hover, .nav-pills .nav-link:hover, .view-switcher .btn:hover, .btn-group.filter-status .btn:hover {
  background: var(--muted) !important; color: var(--foreground) !important;
}
.nav-tabs .nav-link.active, .nav-pills .nav-link.active,
.view-switcher .btn.active, .view-switcher .btn.btn-primary,
.btn-group > .btn.active, .btn-group > .btn-check:checked + .btn,
.view-switcher .btn-check:checked + .btn {
  background: var(--app-primary) !important; color: #fff !important; font-weight: 600;
}

/* the floating help button */
.help-trigger, .btn.position-fixed.rounded-circle {
  background: var(--app-primary) !important; color: #fff !important; border-color: transparent !important;
  box-shadow: 0 4px 12px rgb(0 0 0 / .18) !important; opacity: 1 !important;
}

/* checkboxes and radios, the coloured outline buttons and the Settings chips */
.form-check-input:not([role="switch"]) { border-color: var(--input); }
.btn-outline-success { border-color: #15803d !important; }        /* 5.0:1 on white */
.btn-outline-warning { border-color: #d97706 !important; }        /* 3.2:1 */
.btn-outline-danger  { border-color: #dc2626 !important; }        /* 4.8:1 */
.btn-outline-info    { border-color: #0e7490 !important; }        /* 5.4:1 */
.chip { border-color: var(--input); }

/* the menu: the page you are on is filled with the unit's colour, in white (owner, 24 Nov 2026):
   exactly the colour of the buttons and the chosen tab, so the whole screen uses one colour.
   Branding accepts only colours that carry white text. */
.app-sidebar .nav-link.active {
  background: var(--app-primary) !important;
  color: #fff !important;
  box-shadow: none;
}
.app-sidebar .nav-link.active .bi:first-child,
.app-sidebar .nav-link.active .nav-caret { color: #fff !important; }
.app-sidebar .nav-link.active .nav-step { background: #fff; border-color: #fff; color: var(--app-primary); }

/* one look for every "pick one" control (1.22.4): the switcher. Steppers
   (earlier / later week or month) stay joined buttons: they move, not choose. */
.view-switcher .btn + .btn, .view-switcher .btn-check + .btn { margin-left: 0 !important; }

/* a table row under the pointer: a light tint of the unit's colour (owner, 24 Nov 2026),
   the actions column on the right included */
.table-hover > tbody > tr:hover > * {
  background: color-mix(in srgb, var(--app-primary) 10%, var(--card)) !important;
  box-shadow: none !important;
}

/* the searchable box of a list people may add to (1.22.4, Designation) */
.searchable-select-section { padding: .375rem .75rem .125rem; font-size: .6875rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted-foreground); }
.searchable-select-add { border-top: 1px solid var(--border); color: var(--app-primary-dark, var(--app-primary)); font-weight: 600; }
.searchable-select-add small { display: block; font-weight: 400; color: var(--muted-foreground); }
.searchable-select-note { border-top: 1px solid var(--border); padding: .5rem .75rem; font-size: .8125rem; color: var(--muted-foreground); }

/* ---- Settings home (1.22.4): a title, a compact search, soft chips, larger tiles ---- */
.settings-home .set-crumbs { font-size: .875rem; color: var(--muted-foreground); margin-bottom: .25rem; }
.settings-home .set-crumbs a { color: var(--app-primary); text-decoration: none; }
.settings-home .set-title { font-size: 1.75rem; font-weight: 700; margin: 0; }
.settings-home .set-lead { color: var(--muted-foreground); margin: .125rem 0 .875rem; }
.settings-home .set-search { max-width: 360px; margin: 0 0 .75rem; }
.settings-home .set-search > .bi { top: .6rem; left: .75rem; font-size: .95rem; }
.settings-home .set-search input { height: 2.375rem; padding-left: 2.25rem; font-size: .9375rem; border-radius: var(--radius-md); }
.chipbar-soft .chip { background: var(--muted); border-color: transparent; color: var(--foreground); }
.chipbar-soft .chip:hover { background: color-mix(in srgb, var(--app-primary) 10%, var(--muted)); color: var(--foreground); border-color: transparent; }
.chipbar-soft .chip.active { background: var(--app-primary); color: #fff; }
.tile-lg { height: 100%; padding: 1.25rem; gap: 1rem; }
.tile-lg .ic { width: 2.75rem; height: 2.75rem; font-size: 1.15rem;
  background: color-mix(in srgb, var(--app-primary) 12%, var(--card)); color: var(--app-primary); }
.tile-lg b { font-size: 1.125rem; margin-bottom: .25rem; }
.tile-lg span { font-size: .9375rem; line-height: 1.45; }
.tile-lg span { font-weight: 400; }
