/*
* app.css
* Application-wide custom styles (formerly the theme's demo.css)
******************************************************************************/

/* App design tokens — single source of truth for the brand palette.
   Retheme the app by changing these values (used across app.css + calendar.css).

   ProDexter lime (#CBD16C) is BRIGHT (~1.6:1 on white) and therefore FILL-ONLY:
   - --app-primary       fills/tints (buttons, active menu, badges, events)
   - --app-on-primary    dark olive for text/icons ON a lime fill — never #fff
   - --app-primary-text  text-grade olive for links/.text-primary on light
                         surfaces (brightened lime on dark, see html.dark-style) */
:root {
  --app-primary: #CBD16C;        /* brand lime — fills/tints only */
  --app-primary-hover: #9CA24B;  /* darkest lime (strong hover accents) */
  --app-primary-active: #B9BF5A; /* btn-primary :hover/:active fill */
  --app-primary-light: #E9ECBF;
  --app-primary-rgb: 203, 209, 108;
  --app-on-primary: #2B2C10;     /* text on lime (≈9:1) */
  --app-primary-text: #74772F;   /* text-grade lime-olive (≈4.6:1 on white) */
  --app-primary-text-hover: #5D6023;
  --app-success: #8DB988;
  --app-success-hover: #7DA978;
  --app-info: #87CEEB;
  --app-info-hover: #77BEDB;
  --app-warning: #ECC08A;
  --app-warning-hover: #DCB07A;
  --app-warning-text: #5e4d37;
  --app-danger: #E09A9A;
  --app-danger-hover: #D08A8A;
  --app-secondary: #B8C1CA;
  --app-secondary-hover: #A8B1BA;

  /* Bridge Bootstrap/theme tokens so components using var(--bs-primary)
     inherit the same blue as app buttons and calendar controls. */
  --bs-primary: var(--app-primary);
  --bs-primary-rgb: var(--app-primary-rgb);
  --bs-primary-text-emphasis: #4C4E1C;
  --bs-primary-bg-subtle: #F3F4D8;
  --bs-primary-border-subtle: var(--app-primary-light);
  --bs-link-color: var(--app-primary-text);
  --bs-link-color-rgb: 116, 119, 47;
  --bs-link-hover-color: var(--app-primary-text-hover);
  --bs-link-hover-color-rgb: 93, 96, 35;

  /* Menu contract tokens (see "Menu contract" below).
     NOT --bs-body-bg: in this theme that is the grey page canvas (#f7f9fa),
     while a menu is paper. --bs-card-bg holds the right colour but the theme
     scopes it to .card, so the surface gets its own token here. */
  --app-menu-bg: #fff;
  --app-menu-border: var(--bs-border-color, #e7e7e8);
  --app-menu-color: var(--bs-body-color, #6f6b7d);
  --app-menu-muted: var(--bs-secondary-color, #a1a1b5);

  /* ONE chevron for every "this opens something" control: the native
     .form-select, the select2 single arrow and .dropdown-toggle::after.
     The muted stroke carries its opacity inside the SVG so all three render
     identically (an element `opacity` cannot reach a background-image). */
  --app-chevron: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%236f6b7d' stroke-opacity='0.55' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Dark surfaces flip the text-grade lime from darkened to brightened. */
html.dark-style {
  --app-primary-text: #D9DE8F;
  --app-primary-text-hover: #E4E8AC;
  --bs-link-color-rgb: 217, 222, 143;
  --bs-link-hover-color-rgb: 228, 232, 172;
  /* the theme's dark paper (its .dropdown-menu/.card/select2 surface) */
  --app-menu-bg: #2f3349;
  --app-menu-border: #464d6a;
  --app-menu-color: #d9def7;
  --app-menu-muted: #aeb6dc;
  --app-chevron: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%23b6bee3' stroke-opacity='0.55' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Global shadow removal */
.card,
.card:hover,
.modal-content,
.dropdown-menu,
.popover,
.btn-primary:hover,
.btn-secondary:hover,
.btn:hover,
.form-control:focus,
.form-select:focus,
.alert,
.accordion-item,
.accordion-button:not(.collapsed),
.nav-tabs,
.nav-pills,
.breadcrumb,
.pagination .page-link,
.list-group-item,
.toast {
  box-shadow: none !important;
}

/* Cards keep an edge.
   The theme gives .card a shadow and NO border (--bs-card-border-width: 0);
   removing the shadow above therefore left every plain card edgeless, while
   the list surfaces (.lp-table-card) drew their own 1px line. One border
   token here puts the dashboard, the calendar and every other card on the
   same footing as the lists. A card that wants to stay flat says border-0,
   as the nested ones already do. */
.card {
  --bs-card-border-width: 1px;
  --bs-card-border-color: var(--bs-border-color, #e7e7e8);
}

/* Breathing room under bordered card headers.
   The theme collapses `.card-header + .card-body` to padding-top: 0 — right
   for its borderless headers, wrong since the border token above gave every
   header a divider line: body content sat flush against it. 1rem matches the
   `pt-3` a few older views already added by hand (the utility's !important
   keeps those exactly as they were). */
.card > .card-header + .card-body,
.card > .card-header + .card-content > .card-body:first-of-type {
  padding-top: 1rem;
}

/* Pastel color overrides */
.btn-primary {
  background-color: var(--app-primary) !important;
  border-color: var(--app-primary) !important;
  color: var(--app-on-primary) !important;
}

.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
  background-color: var(--app-primary-active) !important;
  border-color: var(--app-primary-active) !important;
  color: var(--app-on-primary) !important;
}

.btn-outline-primary {
  color: var(--app-primary-text) !important;
  border-color: var(--app-primary) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
  color: var(--app-on-primary) !important;
  background-color: var(--app-primary-active) !important;
  border-color: var(--app-primary-active) !important;
}

.table {
  --bs-table-active-bg: rgba(var(--app-primary-rgb), 0.08);
}

/* .dropdown-menu / .dropdown-item live in the "Menu contract" block below —
   they share their paint with select2, jQuery UI and the daterangepicker. */

.nav-tabs {
  --bs-nav-tabs-link-active-color: var(--app-primary-text);
}

.nav-pills {
  --bs-nav-pills-link-active-bg: var(--app-primary);
  --bs-nav-pills-link-active-color: var(--app-on-primary);
}

.accordion {
  --bs-accordion-btn-focus-border-color: var(--app-primary);
}

.pagination {
  --bs-pagination-active-bg: var(--app-primary);
  --bs-pagination-active-border-color: var(--app-primary);
  --bs-pagination-active-color: var(--app-on-primary);
}

.progress {
  --bs-progress-bar-bg: var(--app-primary);
}

.progress-bar {
  color: var(--app-on-primary);
}

.list-group {
  --bs-list-group-action-hover-color: var(--app-primary-text);
  --bs-list-group-action-active-color: var(--app-primary-text);
  --bs-list-group-active-bg: var(--app-primary);
  --bs-list-group-active-border-color: var(--app-primary);
  --bs-list-group-active-color: var(--app-on-primary);
}

.nav-tabs.widget-nav-tabs .nav-link.active,
.nav-tabs.widget-nav-tabs .nav-link.active .badge {
  border-color: var(--app-primary) !important;
}

.nav-tabs.widget-nav-tabs .nav-link.active .badge {
  background-color: rgba(var(--app-primary-rgb), 0.08) !important;
  color: var(--app-primary-text) !important;
}

.btn-success {
  background-color: var(--app-success) !important;
  border-color: var(--app-success) !important;
}

.btn-success:hover,
.btn-success:focus,
.btn-success:active {
  background-color: var(--app-success-hover) !important;
  border-color: var(--app-success-hover) !important;
}

.btn-info {
  background-color: var(--app-info) !important;
  border-color: var(--app-info) !important;
}

.btn-info:hover,
.btn-info:focus,
.btn-info:active {
  background-color: var(--app-info-hover) !important;
  border-color: var(--app-info-hover) !important;
}

.btn-warning {
  background-color: var(--app-warning) !important;
  border-color: var(--app-warning) !important;
  color: var(--app-warning-text) !important;
}

.btn-warning:hover,
.btn-warning:focus,
.btn-warning:active {
  background-color: var(--app-warning-hover) !important;
  border-color: var(--app-warning-hover) !important;
  color: var(--app-warning-text) !important;
}

.btn-danger {
  background-color: var(--app-danger) !important;
  border-color: var(--app-danger) !important;
}

.btn-danger:hover,
.btn-danger:focus,
.btn-danger:active {
  background-color: var(--app-danger-hover) !important;
  border-color: var(--app-danger-hover) !important;
}

.btn-secondary {
  background-color: var(--app-secondary) !important;
  border-color: var(--app-secondary) !important;
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
  background-color: var(--app-secondary-hover) !important;
  border-color: var(--app-secondary-hover) !important;
}

/* Badge colors */
.badge.bg-primary,
.badge.badge-primary {
  background-color: var(--app-primary) !important;
  color: var(--app-on-primary) !important;
}

.badge.bg-success,
.badge.badge-success {
  background-color: var(--app-success) !important;
}

.badge.bg-info,
.badge.badge-info {
  background-color: var(--app-info) !important;
}

.badge.bg-warning,
.badge.badge-warning {
  background-color: var(--app-warning) !important;
  color: var(--app-warning-text) !important;
}

.badge.bg-danger,
.badge.badge-danger {
  background-color: var(--app-danger) !important;
}

/* Text colors — text-grade olive, never raw lime on light surfaces */
.text-primary {
  color: var(--app-primary-text) !important;
}

.text-success {
  color: var(--app-success) !important;
}

.text-info {
  color: var(--app-info) !important;
}

.text-warning {
  color: var(--app-warning) !important;
}

.text-danger {
  color: var(--app-danger) !important;
}

/* Background colors */
.bg-primary {
  background-color: var(--app-primary) !important;
  color: var(--app-on-primary);
}

.bg-success {
  background-color: var(--app-success) !important;
}

.bg-info {
  background-color: var(--app-info) !important;
}

.bg-warning {
  background-color: var(--app-warning) !important;
}

.bg-danger {
  background-color: var(--app-danger) !important;
}

/* Menu pastel colors */
.menu .menu-link.active {
  background-color: rgba(var(--app-primary-rgb), 0.14) !important;
  color: var(--app-primary-text) !important;
}

.menu .menu-link:hover:not(.active) {
  background-color: rgba(var(--app-primary-rgb), 0.07) !important;
}

.menu .menu-link.active .menu-icon {
  color: var(--app-primary-text) !important;
}

/* Active menu indicator */
.layout-wrapper:not(.layout-horizontal) .bg-menu-theme .menu-inner > .menu-item.active:before {
  background-color: var(--app-primary) !important;
}

/* Menu vertical active link — solid lime fill carries dark olive text */
.bg-menu-theme.menu-vertical .menu-item.active > .menu-link:not(.menu-toggle) {
  background: var(--app-primary) !important;
  box-shadow: 0px 2px 6px 0px rgba(var(--app-primary-rgb), 0.48) !important;
  color: var(--app-on-primary) !important;
}

.bg-menu-theme.menu-vertical .menu-item.active > .menu-link:not(.menu-toggle) .menu-icon {
  color: var(--app-on-primary) !important;
}

/* Menu horizontal active link */
.bg-menu-theme.menu-horizontal .menu-inner > .menu-item.active > .menu-link.menu-toggle {
  background: var(--app-primary) !important;
  box-shadow: 0px 2px 6px 0px rgba(var(--app-primary-rgb), 0.48) !important;
  color: var(--app-on-primary) !important;
}

.bg-menu-theme.menu-horizontal .menu-inner > .menu-item.active > .menu-link.menu-toggle .menu-icon {
  color: var(--app-on-primary) !important;
}

/* Links */
a:not(.btn) {
  color: var(--app-primary-text);
}

a:not(.btn):hover {
  color: var(--app-primary-text-hover);
}

/* Alert colors */
.alert-primary {
  background-color: #F3F4D8 !important;
  border-color: #E9ECBF !important;
  color: #4C4E1C !important;
}

.alert-success {
  background-color: #e8f2e7 !important;
  border-color: #c5ddc3 !important;
  color: #384a36 !important;
}

.alert-info {
  background-color: #e7f5fc !important;
  border-color: #b8e4f6 !important;
  color: #36525e !important;
}

.alert-warning {
  background-color: #faf3e9 !important;
  border-color: #f4e0c4 !important;
  color: var(--app-warning-text) !important;
}

.alert-danger {
  background-color: #f8eded !important;
  border-color: #efc7c7 !important;
  color: #5a3e3e !important;
}

/* ── Lime contrast layer ────────────────────────────────────────────────────
   Vendor CSS pairs white text/glyphs with the primary fill — fine on the old
   blue, invisible on lime. Every lime fill below re-pairs with dark olive. */

/* Bootstrap checks / radios / switches: dark glyphs instead of white */
.form-check-input:checked[type=checkbox] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='13' viewBox='0 0 15 14' fill='none'%3E%3Cpath d='M3.41667 7L6.33333 9.91667L12.1667 4.08333' stroke='%232B2C10' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.form-check-input:checked[type=radio] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='5' y='5' width='8' height='8' rx='4' fill='%232B2C10'/%3E%3C/svg%3E%0A");
}

.form-check-input[type=checkbox]:indeterminate {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 8H12' stroke='%232B2C10' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

.form-switch .form-check-input:checked {
  background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='9' cy='9' r='6' fill='%232B2C10'/%3E%3C/svg%3E%0A");
}

/* bootstrap-daterangepicker: selected day/range in the calendar grid.
   Its RANGE LIST is a menu and lives in the menu contract below. */
.daterangepicker td.active:not(.off),
.daterangepicker td.active:not(.off):hover,
.daterangepicker td.in-range.active {
  color: var(--app-on-primary) !important;
}

/* jquery-ui datepicker active states (the autocomplete MENU is contracted
   below — this covers the calendar/day cells the same widget ships) */
.ui-state-active,
.ui-widget-content .ui-state-active,
.ui-widget-header .ui-state-active {
  color: var(--app-on-primary);
}

/* ══════════════════════════════════════════════════════════════════════════
   Menu contract: every dropdown looks the same
   ─────────────────────────────────────────────────────────────────────────
   Four libraries paint "a list you pick from" and each shipped its own idea
   of it: select2 (solid lime selected rows, tall padded pills, a drop
   shadow), Bootstrap dropdowns, jQuery UI autocomplete (its own widget
   chrome), the daterangepicker range list. One surface, one hairline, one
   radius, one row height, one hover, one selected state with a check —
   everywhere. Change a menu here and it changes on every page.

   Surface   var(--app-menu-bg)      #fff / #2f3349 dark
   Edge      1px var(--app-menu-border), radius .5rem, NO shadow
   Menu pad  .25rem vertical
   Row       .4375rem .75rem · .875rem/1.45
   Hover     rgba(--app-primary-rgb, .08) + var(--app-primary-text)
   Selected  rgba(--app-primary-rgb, .16) + var(--app-primary-text) + 600
             + a small check at the right
   Group     .6875rem uppercase, letter-spacing .08em, muted

   The vendor select2 CSS is hand-rebranded and stays untouched; every rule
   it contradicts is neutralised here by specificity (its two !important
   highlight declarations are matched with !important at equal specificity —
   app.css loads after select2.css, so the later rule wins).
   ══════════════════════════════════════════════════════════════════════ */

/* ── the surface ─────────────────────────────────────────────────────── */
.dropdown-menu,
.select2-dropdown,
html.light-style .select2-dropdown,
html.dark-style .select2-dropdown,
.ui-autocomplete,
.ui-autocomplete.ui-widget-content {
  background: var(--app-menu-bg);
  background-clip: padding-box;
  border: 1px solid var(--app-menu-border);
  border-radius: 0.5rem;
  box-shadow: none;
  color: var(--app-menu-color);
  font-size: 0.875rem;
}

.dropdown-menu {
  --bs-dropdown-bg: var(--app-menu-bg);
  --bs-dropdown-border-width: 1px;
  --bs-dropdown-border-color: var(--app-menu-border);
  --bs-dropdown-border-radius: 0.5rem;
  --bs-dropdown-font-size: 0.875rem;
  --bs-dropdown-padding-y: 0.25rem;
  --bs-dropdown-item-padding-y: 0.4375rem;
  --bs-dropdown-item-padding-x: 0.75rem;
  --bs-dropdown-link-hover-color: var(--app-primary-text);
  --bs-dropdown-link-hover-bg: rgba(var(--app-primary-rgb), 0.08);
  --bs-dropdown-link-active-color: var(--app-primary-text);
  --bs-dropdown-link-active-bg: rgba(var(--app-primary-rgb), 0.16);
  padding: 0.25rem 0;
}

.select2-dropdown,
html.light-style .select2-dropdown,
html.dark-style .select2-dropdown,
.ui-autocomplete,
.daterangepicker .ranges ul {
  padding: 0.25rem 0;
}

/* select2 flattens the edge it shares with the control and shadows the
   "above" variant — the contract keeps one closed hairline box instead */
.select2-container--open .select2-dropdown--above,
.select2-container--open .select2-dropdown--below,
html.light-style .select2-dropdown.select2-dropdown--above,
html.dark-style .select2-dropdown.select2-dropdown--above {
  border: 1px solid var(--app-menu-border);
  border-radius: 0.5rem;
  box-shadow: none !important;
}

.select2-container--default.select2-container--open.select2-container--below .select2-selection,
.select2-container--default.select2-container--open.select2-container--above .select2-selection {
  border-radius: 0.375rem;
}

.ui-autocomplete,
.ui-autocomplete.ui-widget {
  font-family: inherit;
  font-size: 0.875rem;
}

/* ── the rows ────────────────────────────────────────────────────────── */
.dropdown-item,
a.dropdown-item, /* beats the global a:not(.btn) link colour */
.select2-results__option,
.select2-results__option[role=option],
.ui-menu .ui-menu-item-wrapper,
.daterangepicker .ranges li,
html.light-style .daterangepicker .ranges li,
html.dark-style .daterangepicker .ranges li {
  position: relative;
  margin: 0;
  width: auto;
  border: 0;
  border-radius: 0;
  padding: 0.4375rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.45;
  background: none;
  /* a .dropdown-item is an <a> and would otherwise read as a link (olive)
     while the other three menus read as body text */
  color: var(--app-menu-color);
}

/* A grouped select2 result indents under its group label. The vendor's own
   nested-option rules are 4 classes deep and set width + padding-left, so
   this stays a SEPARATE, more specific rule — putting it in the row rule
   above would drag that rule's `padding` shorthand up with it and squeeze
   the gutter the selected check needs. */
.select2-container--default .select2-results__group + .select2-results__options .select2-results__option[role=option],
html.light-style .select2-container--default .select2-results__option .select2-results__option[role=option],
html.dark-style .select2-container--default .select2-results__option .select2-results__option[role=option] {
  width: auto;
  padding-left: 1.25rem;
}

/* ── hover / keyboard highlight ──────────────────────────────────────── */
.dropdown-item:hover,
.dropdown-item:focus,
.select2-container--default .select2-results__option--highlighted:not([aria-selected=true]):not(.select2-results__option--selected),
.ui-menu .ui-menu-item-wrapper.ui-state-active,
.ui-menu .ui-menu-item-wrapper.ui-state-focus,
.ui-widget-content .ui-menu-item-wrapper.ui-state-active,
.daterangepicker .ranges li:hover,
html.light-style .daterangepicker .ranges li:hover,
html.dark-style .daterangepicker .ranges li:hover {
  background-color: rgba(var(--app-primary-rgb), 0.08) !important;
  color: var(--app-primary-text) !important;
  border: 0;
  margin: 0;
  font-weight: inherit;
}

/* ── selected / active ───────────────────────────────────────────────── */
.dropdown-item.active,
.dropdown-item:active,
/* the theme paints these two with a SOLID lime + `color: #fff !important`;
   matched here at equal specificity so the later rule (this one) wins */
.dropdown-item:not(.disabled).active,
.dropdown-item:not(.disabled):active,
.dropdown-menu > li:not(.disabled) > a:not(.dropdown-item):active,
.dropdown-menu > li.active:not(.disabled) > a:not(.dropdown-item),
.select2-container--default .select2-results__option[aria-selected=true],
.select2-container--default .select2-results__option--selected,
.select2-container--default .select2-results__option--highlighted[aria-selected=true],
.select2-container--default .select2-results__option--highlighted.select2-results__option--selected,
.daterangepicker .ranges li.active,
html.light-style .daterangepicker .ranges li.active,
html.dark-style .daterangepicker .ranges li.active {
  background-color: rgba(var(--app-primary-rgb), 0.16) !important;
  color: var(--app-primary-text) !important;
  font-weight: 600;
  padding-right: 2rem;
}

.dropdown-item.active::after,
.select2-container--default .select2-results__option[aria-selected=true]::after,
.select2-container--default .select2-results__option--selected::after,
.daterangepicker .ranges li.active::after {
  content: "\ea5e"; /* ti-check — the tabler font is loaded on every page */
  font-family: tabler-icons;
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1;
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  opacity: 0.9;
}

[dir=rtl] .dropdown-item.active::after,
[dir=rtl] .select2-container--default .select2-results__option[aria-selected=true]::after,
[dir=rtl] .daterangepicker .ranges li.active::after {
  right: auto;
  left: 0.75rem;
}

/* the <li> that WRAPS a group is not itself a row — it would double-indent */
.select2-container--default .select2-results__option--group,
.select2-container--default .select2-results__option[role=group] {
  padding: 0;
}

/* a select2 group header is a label, not a row */
.select2-container--default .select2-results__group,
html.light-style .select2-container--default .select2-results__group,
html.dark-style .select2-container--default .select2-results__group {
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--app-menu-muted);
}

/* the dropdown's own search box sits inside the same .25rem gutter */
.select2-container--default .select2-search--dropdown .select2-search__field {
  margin: 0.125rem 0.5rem 0.25rem;
  width: calc(100% - 1rem);
  border-radius: 0.375rem;
}

/* ── a RICH autocomplete row (jQuery UI) ─────────────────────────────────
   Three shared parts, so every picker in the app builds its rows out of the
   same pieces instead of inventing them: `.ac-lead` is the identifying
   column the eye scans down (an article code, a plate), `.ac-sub` the quiet
   second line under it, `.ac-create` the "make a new one" entry that always
   closes such a list. Used by the work-order line picker (materials_handler)
   and the G1.7 plate/VIN lookup (autocomplete_helper). */
.ui-autocomplete .ac-lead {
  display: inline-block;
  min-width: 7.5rem;
  padding-right: 0.75rem;
  white-space: nowrap;
}

/* … bold where the lead IS the identity of the row (a plate) */
.ui-autocomplete .ac-lead.is-key {
  font-weight: 600;
}

.ui-autocomplete .ac-sub {
  font-size: 0.75rem;
  color: var(--app-menu-muted);
}

.ui-autocomplete .ac-create {
  color: var(--app-primary-text);
  font-weight: 500;
}

/* ══════════════════════════════════════════════════════════════════════════
   select2 chips = sheet pills
   The multi-select chip is the same object as `.lp-sheet-pill` in
   components/styles/list_page (999px, hairline, .6875rem/1.6,
   .0625rem .5625rem) — the two must stay in step. The 4.1 markup renders
   the remove <button> BEFORE the label, so the chip is a row-reverse flex
   box: the × reads on the right and stays the element that removes.
   ══════════════════════════════════════════════════════════════════════ */
.select2-container--default .select2-selection--multiple .select2-selection__choice,
html:not([dir=rtl]) .select2-container--default .select2-selection--multiple .select2-selection__choice,
html.light-style .select2-container--default .select2-selection--multiple .select2-selection__choice,
html.dark-style .select2-container--default .select2-selection--multiple .select2-selection__choice,
html.light-style .select2-selection--multiple .select2-selection__choice,
html.dark-style .select2-selection--multiple .select2-selection__choice {
  display: inline-flex;
  flex-direction: row-reverse;
  align-items: center;
  column-gap: 0.25rem;
  border: 1px solid var(--app-menu-border);
  border-radius: 999px;
  background-color: var(--app-menu-bg);
  color: var(--app-menu-color);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.6;
  padding: 0.0625rem 0.5625rem;
  margin: 0.25rem 0.25rem 0 0;
  float: none;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  /* row-reverse already carries the DOM-first × to the right edge */
  position: static;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--app-menu-muted);
  opacity: 1;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover,
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:focus-visible {
  color: var(--app-primary-text);
  opacity: 1;
  outline: 0;
}

/* ══════════════════════════════════════════════════════════════════════════
   One chevron: native select, select2 single, dropdown toggle
   ══════════════════════════════════════════════════════════════════════ */
.form-select {
  --bs-form-select-bg-img: var(--app-chevron);
  --bs-form-select-bg-size: 20px 20px; /* the SVG's own box — no stretch */
}

.select2-container--default .select2-selection--single .select2-selection__arrow b,
html.light-style .select2-container--default .select2-selection--single .select2-selection__arrow b,
html.dark-style .select2-container--default .select2-selection--single .select2-selection__arrow b {
  border: 0;
  margin: 0;
  height: 20px;
  width: 20px;
  top: 50%;
  transform: translateY(-50%);
  left: auto;
  right: 0.5rem;
  background-image: var(--app-chevron);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 20px 20px;
}

.dropdown-toggle::after {
  width: 0.75rem;
  height: 0.75rem;
  margin-top: 0;
  border: 0;
  transform: none;
  background-image: var(--app-chevron);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.75rem 0.75rem;
}

.dropup .dropdown-toggle::after {
  transform: rotate(180deg);
}

.dropend .dropdown-toggle::after {
  transform: rotate(-90deg);
}

.dropstart .dropdown-toggle::before {
  width: 0.75rem;
  height: 0.75rem;
  border: 0;
  transform: rotate(90deg);
  background-image: var(--app-chevron);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 0.75rem 0.75rem;
}

/* fullcalendar: primary-tinted events carry readable text */
.fc .fc-event-primary:not(.fc-list-event),
.fc .fc-event-primary .fc-event-title,
.fc .fc-event-primary .fc-event-time {
  color: var(--app-on-primary) !important;
}

/* Every remaining "selected item = primary fill + white text" state the
   vendor theme ships (pickers, trees, steppers, Vuexy switches, …) */
.datepicker table tr td.active,
.datepicker table tr td.active.highlighted,
.datepicker table tr td.selected,
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
li.ui-timepicker-selected,
.ui-timepicker-list .ui-timepicker-selected:hover,
.tt-suggestion:active,
.tt-cursor,
.jstree-default .jstree-wholerow-clicked,
.jstree-default .jstree-clicked,
.bootstrap-select .dropdown-menu.inner a[aria-selected=true],
.bs-stepper .step.active .bs-stepper-circle,
.switch-input:checked ~ .switch-toggle-slider {
  color: var(--app-on-primary) !important;
}

.tooltip-primary .tooltip-inner,
.popover-primary .popover-header,
.bg-label-hover-primary:hover,
.btn-outline-primary .badge {
  color: var(--app-on-primary) !important;
}

/* label chips: pale lime tint needs text-grade olive, not raw lime */
.bg-label-primary,
.badge.bg-label-primary {
  color: var(--app-primary-text) !important;
}

.light-style .menu .app-brand.demo {
  height: 64px;
}

.dark-style .menu .app-brand.demo {
  height: 64px;
}

.app-brand-logo.demo {
  -ms-flex-align: center;
  align-items: center;
  -ms-flex-pack: center;
  justify-content: center;
  display: -ms-flexbox;
  display: flex;
  width: 34px;
  height: 24px;
}

.app-brand-logo.demo svg {
  width: 35px;
  height: 24px;
}

.app-brand-text.demo {
  font-size: 1.375rem;
}

/* ! For .layout-navbar-fixed added fix padding top tpo .layout-page */
.layout-navbar-fixed .layout-wrapper:not(.layout-without-menu) .layout-page {
  padding-top: 64px !important;
}
.layout-navbar-fixed .layout-wrapper:not(.layout-horizontal):not(.layout-without-menu) .layout-page {
  padding-top: 78px !important;
}
/* Navbar page z-index issue solution */
.content-wrapper .navbar {
  z-index: auto;
}

/*
* Content
******************************************************************************/

.demo-blocks > * {
  display: block !important;
}

.demo-inline-spacing > * {
  margin: 1rem 0.375rem 0 0 !important;
}

/* ? .demo-vertical-spacing class is used to have vertical margins between elements. To remove margin-top from the first-child, use .demo-only-element class with .demo-vertical-spacing class. For example, we have used this class in forms-input-groups.html file. */
.demo-vertical-spacing > * {
  margin-top: 1rem !important;
  margin-bottom: 0 !important;
}
.demo-vertical-spacing.demo-only-element > :first-child {
  margin-top: 0 !important;
}

.demo-vertical-spacing-lg > * {
  margin-top: 1.875rem !important;
  margin-bottom: 0 !important;
}
.demo-vertical-spacing-lg.demo-only-element > :first-child {
  margin-top: 0 !important;
}

.demo-vertical-spacing-xl > * {
  margin-top: 5rem !important;
  margin-bottom: 0 !important;
}
.demo-vertical-spacing-xl.demo-only-element > :first-child {
  margin-top: 0 !important;
}

.rtl-only {
  display: none !important;
  text-align: left !important;
  direction: ltr !important;
}

[dir='rtl'] .rtl-only {
  display: block !important;
}

/* Dropdown buttons going out of small screens */
@media (max-width: 576px) {
  #dropdown-variation-demo .btn-group .text-truncate {
    width: 254px;
    position: relative;
  }
  #dropdown-variation-demo .btn-group .text-truncate::after {
    position: absolute;
    top: 45%;
    right: 0.65rem;
  }
}

/*
* Layout demo
******************************************************************************/

.layout-demo-wrapper {
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  align-items: center;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -ms-flex-direction: column;
  flex-direction: column;
  margin-top: 1rem;
}
.layout-demo-placeholder img {
  width: 900px;
}
.layout-demo-info {
  text-align: center;
  margin-top: 1rem;
}

/* ── Clearable autocomplete inputs: shared clear (×) button ──────────────────
   Single source of truth (loaded globally via templates/header). The button is
   built by addClearButton() in components/scripts/autocomplete_helper.php and
   definitionen/customers.php. */
.input-wrapper {
  position: relative;
}
.input-wrapper > .clear-input-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8592a3;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  z-index: 4;
}
.input-wrapper > .clear-input-btn:hover,
.input-wrapper > .clear-input-btn:focus-visible {
  background: rgba(67, 89, 113, 0.08);
  color: #566a7f;
  outline: none;
}
.input-wrapper > .clear-input-btn .ti {
  font-size: 16px;
}
/* keep field text clear of the × */
.input-wrapper > .form-control {
  padding-right: 2rem;
}

/* Uniform offcanvas width across the app — matches the work-order offcanvas
   (700px on desktop, full-width on mobile). Per-view inline `style="width:..."`
   was removed so this single rule is the source of truth. */
.offcanvas.offcanvas-end,
.offcanvas.offcanvas-start {
  width: 700px !important;
  max-width: 100% !important;
}
@media (max-width: 768px) {
  .offcanvas.offcanvas-end,
  .offcanvas.offcanvas-start {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* A drawer is a RAISED SHEET over the page: one hairline on its inner edge
   and a soft shadow cast onto the page, both shared by every offcanvas.
   The global shadow removal above skips .offcanvas on purpose — this is the
   one place a shadow does a job (which surface is on top), and the work-order
   drawer runs without a backdrop so the lightbox stays visible behind it. */
.offcanvas.offcanvas-end {
  border-left: 1px solid var(--app-menu-border);
  box-shadow: -8px 0 24px rgba(43, 44, 64, 0.08), -1px 0 0 rgba(43, 44, 64, 0.04);
}
.offcanvas.offcanvas-start {
  border-right: 1px solid var(--app-menu-border);
  box-shadow: 8px 0 24px rgba(43, 44, 64, 0.08), 1px 0 0 rgba(43, 44, 64, 0.04);
}
html.dark-style .offcanvas.offcanvas-end {
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.42), -1px 0 0 rgba(0, 0, 0, 0.3);
}
html.dark-style .offcanvas.offcanvas-start {
  box-shadow: 8px 0 28px rgba(0, 0, 0, 0.42), 1px 0 0 rgba(0, 0, 0, 0.3);
}
