/* UIArc content components: toggles, tabs, pagination, breadcrumbs, cards, metric tiles, badges,
   avatars, tables, alerts, progress, chips, inputs, timeline, toasts, page headers and the
   notification centre. Values follow https://uiarc.dev (see .docs/UIARC_COMPONENT_SYSTEM.md),
   restyling the existing Bootstrap markup so every page picks them up. Loaded after
   uiarc-overlays.css; floating-layer tokens (--ui-radius-*, --ui-shadow-*) live there. */
html:root {
  --ui-shadow-resting: 0 1px 2px rgb(0 0 0 / .035);
  --ui-control-track: #e2e2e5;
  --ui-control-track-hover: #d6d6da;
  --ui-control-thumb-shadow: 0 0 0 .5px rgb(0 0 0 / .07), 0 1px 2px rgb(0 0 0 / .14), 0 2px 6px rgb(0 0 0 / .06);
  /* UIArc's morph spring (bounce .16): gliding highlights (tab pill, pagination mark). */
  --ui-ease-morph: linear(0, .048, .157, .291, .428, .555, .663, .755, .828, .884, .926, .956, .977, .99, .999,
    1.004, 1.007, 1.007, 1.007, 1.007, 1.006, 1.005, 1.004, 1.003, 1);
  --ui-morph: 647ms;
  /* Critically damped (vd .3): the switch thumb never overshoots its end. */
  --ui-ease-smooth: linear(0, .051, .16, .291, .417, .531, .629, .71, .776, .828, .869, .901, .925, .944, .958,
    .969, .977, .983, .987, .991, .993, .995, .996, .997, 1);
}
html.app-skin-dark:root {
  --ui-shadow-resting: 0 1px 2px rgb(0 0 0 / .18);
  --ui-control-track: #3a3a40;
  --ui-control-track-hover: #45454c;
}

/* ── Toggles ─────────────────────────────────────────────────────────────────────────────── */
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .auth-page) .form-check-input[type='checkbox']:not([role='switch']) {
  width: 18px; height: 18px; margin-top: .1em;
  border: 1px solid var(--erp-border-strong); border-radius: 5px;
  background-color: var(--erp-surface); background-size: 0;
  transition: border-color var(--ui-fast) var(--ui-ease), background-color 120ms var(--ui-ease),
    background-size 377ms var(--ease-spring), scale var(--duration-spring) var(--ease-spring);
}
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .auth-page) .form-check-input[type='checkbox']:not([role='switch']):is(:checked, :indeterminate) {
  border-color: var(--ui-primary); background-color: var(--ui-primary); background-size: 100%;
}
html.app-skin-dark .form-check-input[type='checkbox']:not([role='switch']):checked {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%2318181b' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .auth-page) .form-check-input:active:not(:disabled) { scale: .95; transition-duration: 160ms, 120ms, 377ms, var(--ui-instant); filter: none; }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .auth-page) .form-check-input:focus { box-shadow: none; border-color: var(--erp-border-strong); }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .auth-page) .form-check-input:checked:focus { border-color: var(--ui-primary); }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .auth-page) .form-check-input:focus-visible { outline: 2px solid var(--erp-ink); outline-offset: 2px; }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .auth-page) .form-check-input:disabled ~ .form-check-label { opacity: .5; }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .auth-page) .form-check-label { color: var(--erp-ink); font-size: 13px; font-weight: 500; cursor: pointer; }
@media (hover: hover) and (pointer: fine) {
  :is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .auth-page) .form-check-input[type='checkbox']:not([role='switch']):not(:checked):not(:disabled):hover { border-color: var(--erp-subtle); }
}

/* Switch: 42×24 track, 18px thumb with 18px of travel (UIArc). */
:is(.erp-app, .t-modal, .side-drawer-panel) .form-switch { padding-left: 52px; min-height: 24px; }
:is(.erp-app, .t-modal, .side-drawer-panel) .form-switch .form-check-input {
  width: 42px; height: 24px; margin: 0 0 0 -52px; border: 0; border-radius: 999px;
  background-color: var(--ui-control-track);
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2.25' fill='%23fff'/%3e%3c/svg%3e");
  background-position: left center; background-size: 24px 24px;
  box-shadow: inset 0 0 0 .5px rgb(0 0 0 / .05);
  transition: background-position 489ms var(--ui-ease-smooth), background-color 240ms var(--ui-ease);
}
:is(.erp-app, .t-modal, .side-drawer-panel) .form-switch .form-check-input:checked {
  background-color: var(--ui-primary); background-position: right center;
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2.25' fill='%23fff'/%3e%3c/svg%3e");
}
html.app-skin-dark .form-switch .form-check-input:checked {
  --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2.25' fill='%2318181b'/%3e%3c/svg%3e") !important;
}
@media (hover: hover) and (pointer: fine) {
  :is(.erp-app, .t-modal, .side-drawer-panel) .form-switch .form-check-input:not(:checked):not(:disabled):hover { background-color: var(--ui-control-track-hover); }
}

/* ── Chips (components/ui/Chip.tsx) and filter chips ──────────────────────────────────────── */
.ui-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-height: 28px;
  padding: 0 4px 0 10px; border: 1px solid var(--erp-border); border-radius: 999px;
  background: var(--erp-surface-soft); color: var(--erp-ink); font-size: 12px; font-weight: 500; line-height: 1.2;
  animation: ui-chip-in 240ms var(--ui-ease-enter);
}
.ui-chip.is-static { padding-right: 10px; }
.ui-chip > .ui-chip-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-chip-remove {
  display: inline-grid; place-items: center; flex-shrink: 0; width: 22px; height: 22px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--erp-muted); font-size: 12px;
  transition: background-color var(--ui-fast) var(--ui-ease), color var(--ui-fast) var(--ui-ease), scale var(--duration-spring) var(--ease-spring);
}
.ui-chip-remove:hover { background: var(--erp-surface); color: var(--erp-ink); }
.ui-chip-remove:active { scale: .96; transition-duration: 100ms; }
.ui-chip-remove:focus-visible { outline: 0; box-shadow: inset 0 0 0 1.5px var(--erp-ink); }
.ui-chip-remove:disabled { opacity: .45; }
@keyframes ui-chip-in { from { opacity: 0; scale: .9; filter: blur(4px); } }

/* ── Tabs (components/Tabs.tsx) ────────────────────────────────────────────────────────────── */
.ui-tabs {
  position: relative; display: inline-flex; gap: 4px; max-width: 100%; padding: 4px; overflow-x: auto;
  border: 1px solid var(--erp-border); border-radius: var(--ui-radius-control);
  background: var(--erp-surface-soft); scrollbar-width: none; isolation: isolate;
}
.ui-tabs::-webkit-scrollbar { display: none; }
.ui-tab {
  position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  flex-shrink: 0; min-height: 36px; min-width: 88px; padding: 0 14px; border: 0; border-radius: 14px;
  background: transparent; color: var(--erp-muted); font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap;
  transition: color var(--ui-fast) var(--ui-ease);
}
.ui-tab > i { font-size: 14px; }
.ui-tab[aria-selected='true'] { color: var(--erp-ink); }
.ui-tab:focus-visible { outline: 2px solid var(--erp-ink); outline-offset: -2px; }
.ui-tabs > .ui-tabs-pill {
  top: 4px; left: 0; height: calc(100% - 8px); border: 1px solid var(--erp-border); border-radius: 14px;
  background: var(--erp-surface); box-shadow: var(--ui-shadow-resting); pointer-events: none;
  transition: transform var(--ui-morph) var(--ui-ease-morph), width var(--ui-morph) var(--ui-ease-morph);
}
.ui-tab-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--erp-surface-hover); color: var(--erp-muted); font-size: 11px; font-variant-numeric: tabular-nums;
}
.ui-tab[aria-selected='true'] .ui-tab-count { background: var(--ui-primary); color: var(--ui-on-primary); }
@media (hover: hover) and (pointer: fine) { .ui-tab:hover { color: var(--erp-ink); } }

/* ── Pagination (components/ui/Pagination.tsx) ───────────────────────────────────────────── */
.ui-pager { position: relative; display: inline-flex; align-items: center; gap: 4px; isolation: isolate; }
.ui-pager-btn {
  position: relative; z-index: 1; display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid transparent; border-radius: var(--ui-radius-control); background: transparent;
  color: var(--erp-muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums;
  transition: background-color var(--ui-fast) var(--ui-ease), color var(--ui-fast) var(--ui-ease), scale var(--duration-spring) var(--ease-spring);
}
.ui-pager-btn[aria-current='page'] { color: var(--erp-ink); }
.ui-pager-btn.is-arrow:active:not(:disabled) { scale: .96; transition-duration: 100ms; }
.ui-pager-btn:disabled { opacity: .4; cursor: default; }
.ui-pager-btn:focus-visible { outline: 2px solid var(--erp-ink); outline-offset: 1px; }
.ui-pager-mark {
  position: absolute; z-index: 0; top: 0; left: 0; width: 36px; height: 36px; pointer-events: none;
  border: 1px solid var(--erp-border); border-radius: var(--ui-radius-control); background: var(--erp-surface); box-shadow: var(--ui-shadow-resting);
  transition: transform var(--ui-morph) var(--ui-ease-morph);
}
.ui-pager-summary { color: var(--erp-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
@media (hover: hover) and (pointer: fine) {
  .ui-pager-btn:not([aria-current='page']):not(:disabled):hover { background: var(--erp-surface-soft); color: var(--erp-ink); }
}

/* ── Breadcrumbs (Bootstrap .breadcrumb markup) ────────────────────────────────────────────── */
:is(.erp-app, .ui-page-header) .breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: 0; padding: 0; background: none; font-size: 13px; }
:is(.erp-app, .ui-page-header) .breadcrumb-item { display: inline-flex; align-items: center; gap: 6px; padding: 0; color: var(--erp-muted); white-space: nowrap; }
:is(.erp-app, .ui-page-header) .breadcrumb-item + .breadcrumb-item { padding-left: 0; }
:is(.erp-app, .ui-page-header) .breadcrumb-item + .breadcrumb-item::before {
  content: ''; float: none; width: 14px; height: 14px; padding: 0; background: var(--erp-border-strong);
  -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='m9 18 6-6-6-6'/%3e%3c/svg%3e") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='m9 18 6-6-6-6'/%3e%3c/svg%3e") center / contain no-repeat;
}
:is(.erp-app, .ui-page-header) .breadcrumb-item a {
  padding: 2px; border-radius: 7px; color: var(--erp-muted); text-decoration: underline transparent; text-underline-offset: 4px;
  transition: color var(--ui-fast) var(--ui-ease), text-decoration-color var(--ui-fast) var(--ui-ease);
}
:is(.erp-app, .ui-page-header) .breadcrumb-item a:hover { color: var(--erp-ink); text-decoration-color: color-mix(in oklab, currentColor 45%, transparent); }
:is(.erp-app, .ui-page-header) .breadcrumb-item.active { color: var(--erp-ink); font-weight: 500; }

/* ── Page header (components/ui/PageHeader.tsx) ────────────────────────────────────────────── */
.ui-page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.ui-page-header-text { min-width: 0; display: grid; gap: 6px; }
.ui-page-header-title { margin: 0; color: var(--erp-ink); font-size: 24px; font-weight: 500; line-height: 1.15; letter-spacing: -.025em; text-wrap: balance; }
.ui-page-header-description { margin: 0; max-width: 60ch; color: var(--erp-muted); font-size: 13px; line-height: 1.5; }
.ui-page-header-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
@media (max-width: 575.98px) {
  .ui-page-header { align-items: stretch; }
  .ui-page-header-title { font-size: 21px; }
  .ui-page-header-actions { width: 100%; }
}

/* ── Cards ─────────────────────────────────────────────────────────────────────────────────── */
:is(.erp-app, .side-drawer-panel) .card {
  --bs-card-border-radius: var(--ui-radius-panel);
  --bs-card-inner-border-radius: calc(var(--ui-radius-panel) - 1px);
  overflow: clip; overflow-clip-margin: 1px;
  border-radius: var(--ui-radius-panel) !important;
  box-shadow: var(--ui-shadow-resting) !important;
  transition: border-color var(--ui-fast) var(--ui-ease), box-shadow var(--ui-standard) var(--ui-ease);
}
/* Cards that hold an absolutely positioned menu or popover must not clip it. */
:is(.erp-app, .side-drawer-panel) .card:has(.dropdown-menu, .position-absolute, .t-dropdown, .address-suggestions) { overflow: visible; }
:is(.erp-app, .side-drawer-panel) .card-header { min-height: 56px; padding: 14px 20px; font-size: 14px; font-weight: 500; letter-spacing: -.01em; }
:is(.erp-app, .side-drawer-panel) .card-header :is(h5, h6, .card-title) { font-size: 14px; font-weight: 500; letter-spacing: -.01em; }
:is(.erp-app, .side-drawer-panel) .card-footer { padding: 12px 20px; }
:is(.erp-app, .side-drawer-panel) .card-body:not([class*='p-']):not([class*='px-']) { padding: 20px; }
:is(.erp-app, .side-drawer-panel) .card-title { color: var(--erp-ink); font-weight: 500; }

/* ── Metric card (components/ui/MetricCard.tsx) ────────────────────────────────────────────── */
.ui-metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; margin-bottom: 16px; }
.ui-metric {
  display: flex; flex-direction: column; min-width: 0; padding: 20px;
  border: 1px solid var(--erp-border); border-radius: var(--ui-radius-panel);
  background: var(--erp-surface); box-shadow: var(--ui-shadow-resting); color: var(--erp-ink);
}
.ui-metric-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.ui-metric-label { color: var(--erp-muted); font-size: 13px; font-weight: 500; }
.ui-metric-icon {
  display: inline-grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 12px;
  border: 1px solid color-mix(in oklab, var(--ui-tone, var(--erp-muted)) 22%, var(--erp-border));
  background: color-mix(in oklab, var(--ui-tone, var(--erp-muted)) 9%, var(--erp-surface)); color: var(--ui-tone, var(--erp-muted)); font-size: 15px;
}
.ui-metric-value { font-size: 28px; font-weight: 500; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ui-metric-context { margin-top: 10px; color: var(--erp-subtle); font-size: 12px; line-height: 1.4; }
.ui-metric-delta { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ui-metric-delta.is-up { background: color-mix(in oklab, var(--erp-success) 11%, transparent); color: var(--erp-success); }
.ui-metric-delta.is-down { background: color-mix(in oklab, var(--erp-danger) 11%, transparent); color: var(--erp-danger); }

/* ── Badges (UIArc tone recipe: tinted fill, tinted border, tone text) ─────────────────────── */
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .ui-page-header) .badge {
  --ui-tone: var(--erp-muted);
  display: inline-flex; align-items: center; gap: 5px; min-height: 22px; padding: 0 9px;
  border: 1px solid color-mix(in oklab, var(--ui-tone) 26%, var(--erp-border));
  border-radius: 999px; background-color: color-mix(in oklab, var(--ui-tone) 10%, var(--erp-surface)) !important;
  color: var(--ui-tone) !important; font-size: 11px; font-weight: 500; line-height: 1; letter-spacing: -.005em; white-space: nowrap;
  transition: border-color var(--ui-standard) var(--ui-ease), background-color var(--ui-standard) var(--ui-ease), color var(--ui-standard) var(--ui-ease);
}
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .ui-page-header) .badge:is(.bg-secondary, .bg-light, .bg-light-secondary, .bg-secondary-subtle, .bg-dark) {
  --ui-tone: var(--erp-muted); background-color: var(--erp-surface-soft) !important; border-color: var(--erp-border);
}
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .ui-page-header) .badge:is(.bg-success, .bg-success-subtle, .bg-soft-success) { --ui-tone: var(--erp-success); }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .ui-page-header) .badge:is(.bg-warning, .bg-warning-subtle, .bg-soft-warning) { --ui-tone: var(--erp-warning); }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .ui-page-header) .badge:is(.bg-danger, .bg-danger-subtle, .bg-soft-danger) { --ui-tone: var(--erp-danger); }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .ui-page-header) .badge:is(.bg-info, .bg-info-subtle, .bg-soft-info, .bg-primary, .bg-primary-subtle, .bg-soft-primary) { --ui-tone: var(--erp-info); }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .ui-page-header) .badge:is(.bg-orange) { --ui-tone: var(--erp-orange); }
/* Inline backgrounds (job-type colours) keep their colour; the tone ring would clash. */
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel) .badge[style*='background'] { border-color: transparent; }
/* Count bubbles on icons stay solid so they read at a glance. */
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel, .nxl-header) .badge.position-absolute,
.ui-count-badge {
  min-width: 18px; height: 18px; min-height: 0; padding: 0 5px; justify-content: center;
  border: 2px solid var(--erp-surface); background-color: var(--ui-primary) !important; color: var(--ui-on-primary) !important;
  font-size: 10px; font-variant-numeric: tabular-nums;
}

/* ── Avatars (components/ui/Avatar.tsx) ────────────────────────────────────────────────────── */
.ui-avatar {
  position: relative; display: inline-grid; place-items: center; flex-shrink: 0;
  width: var(--ui-avatar-size, 36px); height: var(--ui-avatar-size, 36px); overflow: hidden;
  border: 1px solid var(--erp-border); border-radius: 50%; background: var(--erp-surface-soft);
  color: var(--erp-ink); font-size: calc(var(--ui-avatar-size, 36px) * .34); font-weight: 500; line-height: 1;
}
.ui-avatar > img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }

/* ── Tables ───────────────────────────────────────────────────────────────────────────────── */
.erp-app .table { font-size: 13px; }
.erp-app .table > thead, .erp-app .table > thead.table-light { --bs-table-bg: var(--erp-surface); }
.erp-app .table thead th {
  height: 44px; padding: 0 16px; background: var(--erp-surface);
  color: var(--erp-subtle); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none;
}
.erp-app .table:not(.table-sm):not(.table-borderless) tbody td { height: 52px; padding: 8px 16px; }
.erp-app .table.table-sm thead th { height: 36px; padding: 0 12px; }
.erp-app .table.table-sm tbody td { padding: 8px 12px; }
.erp-app .table > tbody > tr > * { border-bottom-color: var(--erp-surface-hover); }
.erp-app .table > tbody > tr:last-child > * { border-bottom: 0; }
.erp-app .table tbody tr { transition: background-color var(--ui-standard) var(--ui-ease); }
.erp-app .table-hover > tbody > tr:hover > * { --bs-table-accent-bg: color-mix(in oklab, var(--erp-ink) 3%, var(--erp-surface)); background: color-mix(in oklab, var(--erp-ink) 3%, var(--erp-surface)); }
.erp-app .table td.text-end, .erp-app .table th.text-end { font-variant-numeric: tabular-nums; }

/* ── Alerts: a quiet surface; the tone sits in a soft wash and the text ─────────────────────── */
:is(.erp-app, .t-modal, .side-drawer-panel, .auth-page) .alert {
  --ui-tone: var(--erp-info);
  display: block; padding: 12px 16px; font-size: 13px; line-height: 1.45;
  border: 1px solid color-mix(in oklab, var(--ui-tone) 24%, var(--erp-border));
  border-radius: var(--ui-radius-control);
  background: color-mix(in oklab, var(--ui-tone) 6%, var(--erp-surface));
  color: color-mix(in oklab, var(--ui-tone) 70%, var(--erp-ink)) !important;
  box-shadow: var(--ui-shadow-resting);
}
:is(.erp-app, .t-modal, .side-drawer-panel, .auth-page) .alert.d-flex { display: flex; }
:is(.erp-app, .t-modal, .side-drawer-panel, .auth-page) .alert-danger { --ui-tone: var(--erp-danger); }
:is(.erp-app, .t-modal, .side-drawer-panel, .auth-page) .alert-warning { --ui-tone: var(--erp-warning); }
:is(.erp-app, .t-modal, .side-drawer-panel, .auth-page) .alert-success { --ui-tone: var(--erp-success); }
:is(.erp-app, .t-modal, .side-drawer-panel, .auth-page) :is(.alert-light, .alert-secondary) { --ui-tone: var(--erp-muted); }
:is(.erp-app, .t-modal, .side-drawer-panel, .auth-page) .alert .alert-link { color: inherit; font-weight: 500; }
:is(.erp-app, .t-modal, .side-drawer-panel, .auth-page) .alert-dismissible { padding-right: 44px; }
:is(.erp-app, .t-modal, .side-drawer-panel, .auth-page) .alert-dismissible .btn-close { top: 50%; right: 8px; width: 28px; height: 28px; padding: 0; margin-top: -14px; border-radius: 50%; background-size: 9px; opacity: .6; }

/* ── Progress (UIArc: 7px track, rounded fill) ────────────────────────────────────────────── */
.erp-app .progress { height: 7px; border: 1px solid var(--erp-border); border-radius: 99px; background: var(--erp-surface-soft); overflow: hidden; }
.erp-app .progress-bar { background-color: var(--ui-primary); border-radius: 99px; transition: width 650ms var(--ui-ease-smooth); }

/* ── List groups (notifications page, pickers) ────────────────────────────────────────────── */
.erp-app .list-group-flush > .list-group-item { padding: 14px 20px; border-color: var(--erp-surface-hover); }
.erp-app .list-group-item { transition: background-color var(--ui-fast) var(--ui-ease); }

/* ── Inputs with an affix (components/ui/MoneyInput.tsx) ──────────────────────────────────── */
.ui-affix { position: relative; display: flex; align-items: center; }
.ui-affix > .ui-affix-text { position: absolute; left: 12px; z-index: 1; color: var(--erp-muted); font-size: inherit; pointer-events: none; font-variant-numeric: tabular-nums; }
.ui-affix > .form-control { padding-left: 26px; font-variant-numeric: tabular-nums; }
.ui-affix > .form-control-sm + .ui-affix-text, .ui-affix > .ui-affix-text.is-sm { left: 10px; }
.erp-app input[type='number'].form-control { font-variant-numeric: tabular-nums; }

/* ── Search field (components/records/SearchInput.tsx and friends) ─────────────────────────── */
.ui-search { position: relative; display: flex; align-items: center; }
.ui-search > i { position: absolute; left: 12px; color: var(--erp-subtle); font-size: 14px; pointer-events: none; transition: color var(--ui-fast) var(--ui-ease); }
.ui-search > .form-control { padding-left: 34px; }
.ui-search:focus-within > i, .ui-search.has-value > i { color: var(--erp-ink); }
.erp-app input[type='search']::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ── Activity timeline (components/JobActivityTimeline.tsx) ────────────────────────────────── */
.ui-timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.ui-timeline-item { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; padding-bottom: 18px; animation: ui-timeline-in 240ms var(--ui-ease-enter) both; animation-delay: calc(min(var(--i, 0), 8) * 35ms); }
.ui-timeline-item:not(:last-child)::before {
  content: ''; position: absolute; left: 13.5px; top: 32px; bottom: 4px; width: 1px; background: var(--erp-border-strong);
}
.ui-timeline-marker {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--erp-surface); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--erp-ink) 10%, transparent);
  color: var(--erp-muted); font-size: 13px;
}
.ui-timeline-body { min-width: 0; padding-top: 4px; }
.ui-timeline-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ui-timeline-title { color: var(--erp-ink); font-size: 13px; font-weight: 500; line-height: 1.4; }
.ui-timeline-time { flex-shrink: 0; color: var(--erp-subtle); font-size: 12px; font-variant-numeric: tabular-nums; }
.ui-timeline-meta { margin-top: 2px; color: var(--erp-subtle); font-size: 12px; }
.ui-timeline-changes { margin: 6px 0 0; padding: 8px 10px; list-style: none; border-radius: 12px; background: var(--erp-surface-soft); color: var(--erp-muted); font-size: 12px; line-height: 1.5; }
.ui-timeline-changes del { color: var(--erp-subtle); }
.ui-timeline-changes ins { color: var(--erp-ink); font-weight: 500; text-decoration: none; }
@keyframes ui-timeline-in { from { opacity: 0; transform: translateY(4px); } }

/* ── Page toast (components/PageToast.tsx) — UIArc toast ───────────────────────────────────── */
.ui-toast {
  position: fixed; top: 84px; right: 16px; z-index: var(--ui-z-toast); display: flex; align-items: flex-start; gap: 12px;
  width: min(26rem, calc(100vw - 32px)); padding: 12px 12px 12px 14px;
  border: 1px solid var(--erp-border); border-radius: var(--ui-radius-panel);
  background: color-mix(in oklab, var(--erp-surface) 94%, var(--erp-bg)); color: var(--erp-ink);
  box-shadow: var(--ui-shadow-floating); font-size: 13px; line-height: 1.45;
  animation: ui-toast-in 300ms var(--ui-ease-enter);
}
.ui-toast-icon {
  --ui-tone: var(--erp-info);
  display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid color-mix(in oklab, var(--ui-tone) 24%, var(--erp-border));
  background: color-mix(in oklab, var(--ui-tone) 10%, var(--erp-surface)); color: var(--ui-tone); font-size: 14px;
}
.ui-toast.is-success .ui-toast-icon { --ui-tone: var(--erp-success); }
.ui-toast.is-danger .ui-toast-icon { --ui-tone: var(--erp-danger); }
.ui-toast.is-warning .ui-toast-icon { --ui-tone: var(--erp-warning); }
.ui-toast-message { flex: 1; min-width: 0; padding-top: 5px; overflow-wrap: anywhere; }
.ui-toast .ui-toast-close { width: 32px; height: 32px; margin: -1px -2px 0 0; border-radius: 50%; }
@keyframes ui-toast-in { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
@media (max-width: 575.98px) { .ui-toast { top: auto; bottom: 16px; left: 16px; right: 16px; width: auto; } @keyframes ui-toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } } }

/* ── Notification centre (components/NotificationBell.tsx) ────────────────────────────────── */
.ui-notify-panel { width: min(400px, calc(100vw - 24px)); padding: 0 !important; overflow: hidden; display: flex; flex-direction: column; }
.ui-notify-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.ui-notify-title { margin: 0; color: var(--erp-ink); font-size: 18px; font-weight: 500; letter-spacing: -.015em; display: flex; align-items: center; gap: 8px; }
.ui-notify-count { display: inline-grid; place-items: center; min-width: 22px; height: 21px; padding: 0 6px; border-radius: 7px; background: var(--erp-surface-soft); color: var(--erp-muted); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ui-notify-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 16px 10px; border-bottom: 1px solid var(--erp-surface-hover); }
.ui-notify-toolbar .ui-segmented { padding: 3px; border-radius: 11px; }
.ui-notify-toolbar .ui-segment { min-height: 30px; padding: 4px 12px; font-size: 12px; border-radius: 9px; }
.ui-notify-toolbar .ui-segmented-indicator { top: 3px; height: calc(100% - 6px); border-radius: 9px; }
.ui-notify-link { padding: 4px 8px; border: 0; border-radius: 10px; background: transparent; color: var(--erp-muted); font-size: 12px; font-weight: 500; }
.ui-notify-link:hover { background: var(--erp-surface-soft); color: var(--erp-ink); }
.ui-notify-list { flex: 1; min-height: 0; max-height: min(460px, calc(100vh - 220px)); overflow-y: auto; padding: 8px; scrollbar-width: none; }
.ui-notify-item {
  position: relative; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 11px; width: 100%;
  padding: 10px; border: 0; border-radius: 14px; background: transparent; color: var(--erp-ink); text-align: left;
  transition: background-color var(--ui-fast) var(--ui-ease);
  animation: ui-timeline-in 240ms var(--ui-ease-enter) both; animation-delay: calc(min(var(--i, 0), 8) * 35ms);
}
.ui-notify-item:hover, .ui-notify-item:focus-visible { background: var(--erp-surface-soft); outline: 0; }
.ui-notify-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 12px; background: var(--erp-surface-soft); color: var(--erp-muted); font-size: 15px; }
.ui-notify-item.is-unread .ui-notify-icon { background: color-mix(in oklab, var(--erp-info) 10%, var(--erp-surface)); color: var(--erp-info); }
.ui-notify-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ui-notify-item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.ui-notify-item:not(.is-unread) .ui-notify-item-title { color: var(--erp-muted); }
.ui-notify-dot { width: 6px; height: 6px; flex-shrink: 0; border-radius: 50%; background: var(--erp-ink); }
.ui-notify-preview { margin-top: 2px; overflow: hidden; color: var(--erp-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ui-notify-time { margin-top: 2px; color: var(--erp-subtle); font-size: 11px; font-variant-numeric: tabular-nums; }
.ui-notify-empty { min-height: 180px; }
.ui-notify-footer { display: flex; justify-content: center; padding: 8px; border-top: 1px solid var(--erp-surface-hover); }
.ui-bell-trigger { position: relative; }
.ui-bell-trigger > i { display: inline-block; transition: rotate 377ms var(--ease-spring); }
.ui-bell-trigger[aria-expanded='true'] > i { rotate: -12deg; }

/* ── Empty state (components/ui/EmptyState.tsx) — UIArc icon tile ──────────────────────────── */
.ui-empty-state { padding: clamp(32px, 8vw, 48px) 20px; gap: 0; }
.ui-empty-state > i {
  display: grid; place-items: center; width: 48px; height: 48px; font-size: 20px;
  border: 1px solid var(--erp-border); border-radius: var(--ui-radius-panel);
  background: var(--erp-surface-soft); color: var(--erp-muted);
  animation: ui-empty-in 480ms var(--ui-ease-enter);
}
.ui-empty-state h3 { margin-top: 16px; font-size: 15px; font-weight: 500; }
.ui-empty-state p { margin-top: 6px; max-width: 34ch; color: var(--erp-muted); text-wrap: balance; }
.ui-empty-state > :is(.btn, .ui-empty-actions) { margin-top: 16px; }
.ui-empty-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
@keyframes ui-empty-in { from { opacity: 0; scale: .92; } }

/* ── Scrollbars (UIArc scroll area: a slim, quiet thumb) ───────────────────────────────────── */
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel) * { scrollbar-width: thin; scrollbar-color: color-mix(in oklab, var(--erp-ink) 22%, transparent) transparent; }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel) ::-webkit-scrollbar { width: 10px; height: 10px; }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel) ::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 99px; background: color-mix(in oklab, var(--erp-ink) 22%, transparent) padding-box; }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel) ::-webkit-scrollbar-thumb:hover { background-color: color-mix(in oklab, var(--erp-ink) 40%, transparent); }
:is(.erp-app, .t-modal, .t-dropdown, .side-drawer-panel) ::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  .ui-chip, .ui-timeline-item, .ui-notify-item, .ui-toast, .ui-empty-state > i { animation: none; }
  .ui-tabs > .ui-tabs-pill, .ui-pager-mark, .ui-pager-btn, .ui-chip-remove, .ui-bell-trigger > i,
  :is(.erp-app, .t-modal, .side-drawer-panel) :is(.form-check-input, .card, .badge, .progress-bar) { transition: none !important; }
  .form-check-input:active, .ui-pager-btn:active, .ui-chip-remove:active { scale: 1 !important; }
}

/* Tag chips (components/tags/TagChip.tsx). The fill is the tag's own color; text color is picked
   for contrast in JS. Deliberately a small pill so it never competes with the schedule's primary
   color mode (service type / area / technician), which owns the card's background and edge. */
.tag-chip {
  display: inline-flex; align-items: center; gap: 3px; max-width: 100%;
  border-radius: 999px; font-weight: 600; line-height: 1.2; white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .08);
}
.tag-chip-md { padding: 3px 9px; font-size: 12px; }
.tag-chip-sm { padding: 1px 7px; font-size: 10.5px; }
.tag-chip-label { overflow: hidden; text-overflow: ellipsis; }
.tag-chip-remove {
  display: inline-grid; place-items: center; width: 16px; height: 16px; margin-right: -4px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; opacity: .75; font-size: 11px;
  transition: opacity var(--ui-fast, 160ms) ease, background-color var(--ui-fast, 160ms) ease;
}
.tag-chip-remove:hover, .tag-chip-remove:focus-visible { opacity: 1; background: rgb(0 0 0 / .12); }
.tag-chip-remove:disabled { opacity: .4; }
.tag-chip-list { display: inline-flex; flex-wrap: wrap; gap: 4px; }
@media (prefers-reduced-motion: reduce) { .tag-chip-remove { transition: none; } }

/* Tag management (components/tags/*) */
.tag-manager-search { max-width: 280px; }
.tag-color-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.tag-color-swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-color-swatch {
  width: 26px; height: 26px; padding: 0; border: 2px solid transparent; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .12); cursor: pointer;
  transition: transform var(--ui-fast, 160ms) ease, border-color var(--ui-fast, 160ms) ease;
}
.tag-color-swatch:hover { transform: scale(1.08); }
.tag-color-swatch.is-selected { border-color: var(--erp-ink, #111); box-shadow: inset 0 0 0 2px #fff; }
.tag-color-swatch:focus-visible { outline: 2px solid var(--erp-ink, #111); outline-offset: 2px; }
.tag-color-custom { display: flex; align-items: center; gap: 6px; }
.tag-color-custom .form-control-color { width: 38px; height: 31px; padding: 2px; }
.tag-color-custom input[type="text"] { width: 96px; font-family: var(--bs-font-monospace, monospace); }
@media (prefers-reduced-motion: reduce) {
  .tag-color-swatch { transition: none; }
  .tag-color-swatch:hover { transform: none; }
}

/* Job detail floating save bar (components/jobs/detail/JobSaveBar). Sticky rather than fixed so it
   follows the sidebar's width and, at the end of the page, sits below the last card instead of
   over it. It must live outside .main-content (overflow-x: hidden breaks sticky), so it repeats
   that container's side padding. Kept under dropdowns (1000) so a picker near the bottom stays on top. */
.job-save-dock {
  position: sticky; bottom: 0; z-index: 990; display: flex; justify-content: center;
  /* Tucks into .main-content's 50px bottom padding, leaving the usual 16px gap under the last card. */
  margin-top: -34px; padding: 0 30px 16px; pointer-events: none;
}
.job-save-bar {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; width: min(680px, 100%);
  padding: 10px 10px 10px 16px; border: 1px solid var(--erp-border); border-radius: var(--erp-radius-lg);
  background: var(--erp-surface); color: var(--erp-ink); box-shadow: var(--erp-shadow-float);
  transition: opacity var(--ui-standard) var(--ui-ease), transform var(--ui-standard) var(--ui-ease);
}
@starting-style { .job-save-bar { opacity: 0; transform: translateY(12px); } }
.job-save-bar.has-error { border-color: var(--erp-danger); }
.job-save-bar-icon { flex-shrink: 0; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--erp-surface-soft); font-size: 16px; }
.job-save-bar.has-error .job-save-bar-icon { color: var(--erp-danger); }
.job-save-bar-text { flex: 1; min-width: 0; line-height: 1.3; }
.job-save-bar-actions { display: flex; gap: 8px; flex-shrink: 0; }
/* Narrow screens: wrap the actions under the summary, and clear the chat launcher (56px + 24px inset + 8px gap). */
@media (max-width: 767.98px) {
  .job-save-dock { padding-right: 88px; }
  .job-save-bar { flex-wrap: wrap; }
  .job-save-bar-actions { width: 100%; }
  .job-save-bar-actions > * { flex: 1; }
}
/* Matches .main-content's phone padding (20px sides, 5px bottom). */
@media (max-width: 575.98px) {
  .job-save-dock { margin-top: 11px; padding-left: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .job-save-bar { transition: opacity 120ms ease; }
  @starting-style { .job-save-bar { transform: none; } }
}
