/*
 * PUB-SYNC overrides — loaded LAST, after the purchased template (style.css)
 * and the notification styles. Plan 122.
 *
 * The template file itself is never edited: an upgrade of the template would
 * silently undo a fix made there. Every rule below corrects something measured
 * in the UI audit of 2026-11-14; keep the reason with the rule.
 *
 * Linked through static_asset_path, so a change here reaches browsers despite
 * the one-year cache on public/ (plan 122, phase 0).
 */

/* ── Keyboard focus (WCAG 2.4.7) ──────────────────────────────────────────
   style.css:12702 sets `.btn:focus { box-shadow: none }`, which also wipes
   Bootstrap's :focus-visible ring: tabbing through SIGN IN, Log Out, Add New
   Sales Order or Export to Excel showed nothing at all. Form fields kept only a
   pale border (#a8b7ec, 1.97:1 on white) and select2 boxes nothing.

   One ring for everything a keyboard can reach: a dark outline that reads on
   the light surfaces, with a halo in the page colour between it and the
   control, so it also reads against a dark or coloured button. Only on
   :focus-visible, so a mouse click draws nothing. In the dark skin the ring is
   amber, the one colour that stands out from both its surfaces and its
   buttons. */
:root {
  --pub-focus-ring: #212830;
  --pub-focus-halo: #fff;
  --pub-field-focus: #4560c8;
  --pub-field-focus-glow: rgba(69, 96, 200, 0.45);
}
[data-skin="dark"] {
  --pub-focus-ring: #ffc107;
  --pub-focus-halo: #192030;
  --pub-field-focus: #8fa4ee;
  --pub-field-focus-glow: rgba(143, 164, 238, 0.45);
}

a:focus-visible,
button:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[tabindex]:not([tabindex="-1"]):focus-visible,
.page-link:focus-visible,
.btn-close:focus-visible,
.accordion-button:focus-visible,
.navbar-toggler:focus-visible {
  outline: 2px solid var(--pub-focus-ring);
  outline-offset: 2px;
}

/* A button gets the halo too: the outline sits 2px out, the halo fills that gap. */
.btn:focus-visible,
.btn-check:focus-visible + .btn {
  outline: 2px solid var(--pub-focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--pub-focus-halo);
}

/* Row actions are a link wrapping a .btn-styled <span> (one tab stop, valid
   HTML). The link is an inline box around it, so its own outline would not
   follow the button's shape: draw the ring on the button instead. */
a:focus-visible:has(> .btn) {
  outline: none;
}
a:focus-visible > .btn {
  outline: 2px solid var(--pub-focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--pub-focus-halo);
}

/* The sidebar scrolls inside a clipped box: an outline drawn outside a full-
   width menu link would be cut off at both edges. Draw it inside. */
.sidebar .nav-link:focus-visible,
.sidebar .nav-label:focus-visible,
.sidebar .sidebar-logo:focus-visible {
  outline-offset: -2px;
}

/* Fields keep the template's border-and-glow style, made strong enough to see:
   the border at 5.6:1 on white instead of 1.97:1. */
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--pub-field-focus);
  box-shadow: 0 0 0 3px var(--pub-field-focus-glow);
}
.select2-container--focus .select2-selection,
.select2-container--open .select2-selection {
  border-color: var(--pub-field-focus) !important; /* the template sets it with a three-class selector per variant */
  box-shadow: 0 0 0 3px var(--pub-field-focus-glow);
}

/* The skip link target: focus lands here, but a ring around the whole page
   would only be noise. */
main:focus {
  outline: none;
}

/* ── Skip link (WCAG 2.4.1) ───────────────────────────────────────────────
   Without it a keyboard user tabbed through the logo and every sidebar group
   before reaching the page. Hidden until focused (Bootstrap's
   .visually-hidden-focusable), then pinned top-left above the fixed header
   and sidebar. */
.skip-link:focus {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1100;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  background-color: #fff;
  color: #212830;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(33, 40, 48, 0.18);
}
[data-skin="dark"] .skip-link:focus {
  background-color: #192030;
  color: #fff;
}

/* ── Header controls ──────────────────────────────────────────────────────
   The sidebar toggle and the display-settings control were links to "#" and
   ""; they are buttons now (they act, they do not navigate). Strip the
   browser's button chrome so they keep the template's look. */
.header-main button.menu-link,
.header-main button.dropdown-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  line-height: inherit;
}

/* The menu button. The template drew it as a 20×20 grey glyph
   (style.css:13829): users on phones did not see it (reported 2026-11-14),
   and the target was below WCAG 2.5.8's 24px. Now a 44px button, like a
   native app bar's navigation button, tinted so it reads as one. */
.header-main button.menu-link {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background-color: #eef1fc;
  color: #4560c8;
  font-size: 1.75rem;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.header-main button.menu-link:hover,
.header-main button.menu-link:focus-visible {
  background-color: #dfe5fa;
  color: #3a52b0;
}
.header-main button.menu-link:active {
  background-color: #cfd8f7;
}
[data-skin="dark"] .header-main button.menu-link {
  background-color: rgba(143, 164, 238, 0.14);
  color: #8fa4ee;
}
[data-skin="dark"] .header-main button.menu-link:hover,
[data-skin="dark"] .header-main button.menu-link:focus-visible,
[data-skin="dark"] .header-main button.menu-link:active {
  background-color: rgba(143, 164, 238, 0.24);
  color: #b3c2f4;
}
@media (prefers-reduced-motion: reduce) {
  .header-main button.menu-link { transition: none; }
}

/* Log Out stays in the header for shared warehouse PCs, but quiet: it was a
   solid red button, the loudest thing on every page (plan 123). Grey outline
   at rest; red only when the pointer or focus is on it. */
.header-main .btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  border: 1px solid #ccd2da;
  background-color: transparent;
  color: #5f6b77;
}
.header-main .btn-logout:hover,
.header-main .btn-logout:focus-visible {
  border-color: #c82333;
  background-color: #fdf1f2;
  color: #c82333;
}
[data-skin="dark"] .header-main .btn-logout {
  border-color: #2c3650;
  color: #9aa4b2;
}
[data-skin="dark"] .header-main .btn-logout:hover,
[data-skin="dark"] .header-main .btn-logout:focus-visible {
  border-color: #ff7a85;
  background-color: rgba(255, 122, 133, 0.1);
  color: #ff7a85;
}

/* The avatar is a button now; strip the browser's button chrome. */
.dropdown-profile > button.dropdown-link {
  padding: 0;
  border: 0;
  background: none;
}

/* Light/Dark and Sidebar/Top bar in the account menu. Both settings share one
   shape — label above, two equal halves across the full width — so they line
   up (owner, 2026-11-15: Appearance sat inline while Menu wrapped below). */
.account-skin {
  display: grid;
  gap: 0.5rem;
}
.account-skin-label {
  font-size: 0.8125rem;
  color: #5f6b77;
}
/* The template stacks every .nav in the account menu into a column. */
.dropdown-profile .account-skin .nav-skin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0; /* the template pulls .nav in this menu 10px past the text edge */
}
.account-skin .nav-skin button.nav-link {
  justify-content: center;
  background: none;
  font: inherit;
  font-size: 0.8125rem;
  min-height: 32px;
  text-align: center;
}
.account-skin .nav-skin button.nav-link.active {
  background-color: #eef1fc;
  border-color: #4560c8;
  color: #3a52b0;
}
[data-skin="dark"] .account-skin-label {
  color: #9aa4b2;
}
[data-skin="dark"] .account-skin .nav-skin button.nav-link {
  border-color: #2c3650;
  color: #c7cdd6;
}
[data-skin="dark"] .account-skin .nav-skin button.nav-link.active {
  background-color: rgba(143, 164, 238, 0.18);
  border-color: #8fa4ee;
  color: #b3c2f4;
}

/* Brand (shared/_app_brand): the PUB mark and the app's name, in the sidebar
   and on every sign-in page (plan 123). It replaces the template's wordmark
   and the dot after it (style.css:13754), which was its logo, not PUB's. */
.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Archivo", sans-serif;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.3px;
  color: #212830;
  text-decoration: none;
}
.app-brand:hover,
.app-brand:focus {
  color: #212830;
}
.app-brand-mark {
  width: auto; /* the logo is 3:2; never squeeze it into a square */
  height: 40px;
  flex-shrink: 0;
}
[data-skin="dark"] .app-brand,
[data-skin="dark"] .app-brand:hover,
[data-skin="dark"] .app-brand:focus {
  color: #ffffff;
}
/* The mark's black gear disappears on a dark surface: give it a white tile. */
[data-skin="dark"] .app-brand-mark {
  padding: 3px;
  border-radius: 8px;
  background-color: #ffffff;
}

/* Icon buttons in page-title and card-header icon rows (e.g. the dashboard's
   Refresh) were links to "#"; they are buttons now. Same look, no chrome. */
.nav-icon > button.nav-link {
  border: 0;
  background: none;
}

/* ── Colour: text a reader can read (WCAG 1.4.3, plan 122 phase 3) ────────
   Measured in the browser on 2026-11-14: 23.7% of the visible text in the
   light skin and 28.8% in the dark one was below 4.5:1. Nearly all of it came
   from a handful of template colours, so each is corrected once here. The
   ratio each new value reaches is noted beside it. */

/* Grey: the secondary colour, muted text, form hints, the breadcrumb's current
   page and the sidebar group labels were #6e7985 — 4.2–4.4:1 on the page and
   card surfaces, and as the background of white text (Secondary buttons,
   grey badges such as Released). */
:root {
  --bs-secondary: #5f6b77; /* 5.45:1 against white */
  --bs-secondary-rgb: 95, 107, 119;
  --bs-secondary-color: #5f6b77;
  --bs-success: #0a7f5c; /* 5.0:1; was #0cb785, 2.58:1 */
  --bs-success-rgb: 10, 127, 92;
  --bs-success-2: #0b7a3e; /* 5.43:1; was #03a54c, 3.24:1 ("Approved") */
  --bs-success-2-rgb: 11, 122, 62;
  --bs-link-color: #4560c8; /* 5.44:1 on the page; #506fd9 was 4.43:1 */
  --bs-link-color-rgb: 69, 96, 200;
  --bs-link-hover-color: #3a51a8;
  --bs-link-hover-color-rgb: 58, 81, 168;
}
.text-muted,
.text-secondary {
  color: #5f6b77 !important; /* the template sets it with !important */
}
:root {
  --bs-gray-600: #5f6b77; /* the notification list's meta line reads it */
}
.form-text,
.notification-meta,
.card-footer,
.card-one small,
.card-one .small,
.main-footer,
.card-sign .card-text,
.card-sign .card-footer {
  color: #5f6b77;
}
.text-primary {
  color: #4560c8 !important; /* 5.2:1 on the grey card surfaces; #506fd9 was 4.3:1 */
}
.text-danger {
  color: #c82333 !important; /* 5.6:1; #dc3545 was 4.3:1 on the grey card surfaces */
}
.breadcrumb {
  --bs-breadcrumb-item-active-color: #5f6b77;
}
.sidebar-body .nav-label {
  color: #5f6b77;
}
.form-control::placeholder {
  color: #6b7684; /* 4.62:1; was #a8afb6, 2.22:1 */
  opacity: 1;
}

/* Buttons. The template lightened Secondary and Success on hover while keeping
   white text (white on #848d97 is 3.4:1): hover and press now darken. */
.btn-secondary {
  --bs-btn-color: #fff;
  --bs-btn-bg: #5f6b77;
  --bs-btn-border-color: #5f6b77;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #4f5a65; /* 7.0:1 */
  --bs-btn-hover-border-color: #4f5a65;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #46505a;
  --bs-btn-active-border-color: #46505a;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #5f6b77;
  --bs-btn-disabled-border-color: #5f6b77;
}
.btn-success {
  --bs-btn-color: #fff;
  --bs-btn-bg: #0a7f5c;
  --bs-btn-border-color: #0a7f5c;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #096e50; /* 6.25:1 */
  --bs-btn-hover-border-color: #096e50;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #085f45;
  --bs-btn-active-border-color: #085f45;
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: #0a7f5c;
  --bs-btn-disabled-border-color: #0a7f5c;
}
.btn-outline-success {
  --bs-btn-color: #0a7f5c;
  --bs-btn-border-color: #0a7f5c;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #0a7f5c;
  --bs-btn-hover-border-color: #0a7f5c;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #096e50;
  --bs-btn-active-border-color: #096e50;
  --bs-btn-disabled-color: #0a7f5c;
  --bs-btn-disabled-border-color: #0a7f5c;
}
.btn-outline-primary {
  --bs-btn-color: #4560c8;
  --bs-btn-border-color: #4560c8;
}
.btn-outline-secondary {
  --bs-btn-color: #5f6b77;
  --bs-btn-border-color: #5f6b77;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: #5f6b77;
  --bs-btn-hover-border-color: #5f6b77;
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: #4f5a65;
  --bs-btn-active-border-color: #4f5a65;
}

/* Yellow and cyan are surfaces, never text: amber #ffc107 as text on its own
   tint was 1.55:1, white on cyan #0dcaf0 1.96:1. */
.text-warning {
  color: #8a5a00 !important; /* 5.35:1 on the warning tint */
}
.text-info {
  color: #087990 !important; /* 5.06:1 */
}
.badge.bg-info,
.badge.bg-warning,
.bg-info.text-white,
.bg-warning.text-white {
  --bs-badge-color: #212830;
  color: #212830 !important; /* 7.6:1 on cyan, 9.1:1 on amber; also where a view asks for white */
}

/* ── Dark skin ────────────────────────────────────────────────────────────
   On the dark surfaces (#192030 cards, #141926 page) the light-skin colours
   were too dark — links 3.58:1, muted text 3.67:1, red 3.59:1, sidebar group
   labels 2.27:1 — and the light boxes (bg-light, table-light) stayed light
   while their text turned white: the address cards and the totals box of a
   sales order read 1.03:1, blank. */
[data-skin="dark"] {
  --bs-link-color: #8fa4ee; /* 6.75:1 on a card */
  --bs-link-color-rgb: 143, 164, 238;
  --bs-link-hover-color: #b3c2f4;
  --bs-link-hover-color-rgb: 179, 194, 244;
}
[data-skin="dark"] .text-primary {
  color: #8fa4ee !important;
}
[data-skin="dark"] .text-muted,
[data-skin="dark"] .text-secondary,
[data-skin="dark"] .form-text,
[data-skin="dark"] .notification-meta {
  color: #9aa4b2 !important; /* 6.45:1 */
}
[data-skin="dark"] .breadcrumb {
  --bs-breadcrumb-item-active-color: #9aa4b2;
}
[data-skin="dark"] .sidebar:not(.sidebar-prime) .sidebar-body .nav-label {
  color: #8e97a8; /* 5.53:1; was 25% white, 2.27:1 */
}
[data-skin="dark"] .text-danger {
  color: #ff7a85 !important; /* 6.49:1 */
}
[data-skin="dark"] .text-success {
  color: #3dd6a5 !important; /* 8.8:1 */
}
[data-skin="dark"] .text-warning {
  color: #ffc107 !important; /* amber reads on dark: 10:1 */
}
[data-skin="dark"] .text-body {
  color: rgba(255, 255, 255, 0.8) !important; /* the light skin's #41505f was 1.7:1 */
}
[data-skin="dark"] .sidebar:not(.sidebar-prime) .nav-sidebar .nav-link.active {
  color: #8fa4ee; /* 6.75:1; was #506fd9, 3.58:1 */
}
[data-skin="dark"] .btn-outline-success {
  --bs-btn-color: #3dd6a5;
  --bs-btn-border-color: #3dd6a5;
}
[data-skin="dark"] .btn-outline-secondary {
  --bs-btn-color: #9aa4b2;
  --bs-btn-border-color: #9aa4b2;
}
[data-skin="dark"] .form-control::placeholder {
  color: #8e97a8;
}
[data-skin="dark"] .btn-outline-primary,
[data-skin="dark"] .btn-link {
  --bs-btn-color: #8fa4ee;
  --bs-btn-border-color: #8fa4ee;
  --bs-btn-hover-color: #fff;
}
[data-skin="dark"] .btn-link {
  --bs-btn-border-color: transparent;
}
[data-skin="dark"] .pagination {
  --bs-pagination-color: #8fa4ee;
}
[data-skin="dark"] .bg-light {
  background-color: #222b41 !important;
  color: #e6eaf2;
}
[data-skin="dark"] .table-light {
  --bs-table-bg: #222b41;
  --bs-table-color: #e6eaf2;
  --bs-table-border-color: #2c3650;
  color: #e6eaf2;
}
[data-skin="dark"] .badge.bg-light {
  color: #e6eaf2 !important;
}
[data-skin="dark"] .card-title {
  color: #e6eaf2;
}

/* ── Dark skin: three levels of text (2026-11-15) ─────────────────────────
   The template set ALL dark-skin text to 60% white (style.css:24272), which
   lands at #a3a6ac (6.66:1): every table cell, customer name and field value
   (87.6% of the text measured on 111 pages), next to labels at #9aa4b2
   (6.45:1). Data and its labels were the same grey, and on detail pages the
   bold label outweighed its value. Now data reads first, labels recede. */
[data-skin="dark"] {
  --dk-text: #e1e5ec;   /* data, field values, body text: 13.2:1 on a card */
  --dk-text-2: #c7cdd6; /* table headers, sidebar links: 10.2:1 */
  --dk-muted: #9aa4b2;  /* labels (.text-muted), hints, meta: 6.45:1 */
}
[data-skin="dark"] body {
  color: var(--dk-text);
}
[data-skin="dark"] .form-control,
[data-skin="dark"] .form-select,
[data-skin="dark"] .gridjs-input {
  color: var(--dk-text); /* was 65% white */
}
[data-skin="dark"] .table > thead > tr > th {
  color: var(--dk-text-2);
}
[data-skin="dark"] .sidebar:not(.sidebar-prime) .nav-sidebar .nav-link {
  color: var(--dk-text-2); /* was 60% white */
}
/* The current page must not look dimmer than the rest of the menu. */
[data-skin="dark"] .sidebar:not(.sidebar-prime) .nav-sidebar .nav-link.active {
  color: #b3c2f4; /* 9.2:1 */
  font-weight: 600;
}

/* Coloured table rows (an overdue AR, a stock line to recount) were painted
   solid #dc3545, #ffc107 and so on in the dark skin, under white text and red
   hints: "Please sent the outgoing invoice!" vanished. A dark tint of the same
   hue keeps the cue, and every text colour above reads on it (5:1 or more). */
[data-skin="dark"] .table-danger td,
[data-skin="dark"] .table-danger th {
  background-color: #48242e;
}
/* Bootstrap's contextual rows set black text and a light stripe/hover
   (--bs-table-striped-color: #000; striped-bg #eccccf), so on a striped
   table every other tinted row went dark-on-dark in the dark skin (AR and AP
   lists, found 2026-11-15). Light text and faint white overlays instead. */
[data-skin="dark"] .table-danger,
[data-skin="dark"] .table-warning {
  --bs-table-color: #c7cdd6;
  --bs-table-striped-color: #c7cdd6;
  --bs-table-active-color: #c7cdd6;
  --bs-table-hover-color: #e6e9ef;
  --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
  --bs-table-active-bg: rgba(255, 255, 255, 0.06);
  --bs-table-hover-bg: rgba(255, 255, 255, 0.06);
}
/* ...and the dark skin laid a 60% slate overlay on every odd row
   (style.css:24198), hiding the tint on half the tinted rows. */
[data-skin="dark"] .table-striped > tbody > tr.table-danger:nth-of-type(2n + 1) > *,
[data-skin="dark"] .table-striped > tbody > tr.table-warning:nth-of-type(2n + 1) > * {
  box-shadow: inset 0 0 0 9999px rgba(255, 255, 255, 0.03);
}
[data-skin="dark"] .table-warning td,
[data-skin="dark"] .table-warning th {
  background-color: #3a3218;
}
[data-skin="dark"] .table-success td,
[data-skin="dark"] .table-success th {
  background-color: #173a2f;
}
[data-skin="dark"] .table-info td,
[data-skin="dark"] .table-info th {
  background-color: #143843;
}
[data-skin="dark"] .table-primary td,
[data-skin="dark"] .table-primary th {
  background-color: #222f5e;
}
[data-skin="dark"] .table-secondary td,
[data-skin="dark"] .table-secondary th {
  background-color: #2a3242;
}
[data-skin="dark"] :is(.table-danger, .table-warning, .table-success, .table-info, .table-primary, .table-secondary) :is(td, th) {
  color: rgba(255, 255, 255, 0.85);
}
/* The info alert stayed bright cyan in the middle of a dark page. */
[data-skin="dark"] .alert-info {
  --bs-alert-color: #bfe9f5;
  --bs-alert-bg: #12303a;
  --bs-alert-border-color: #1c4a59;
  color: #bfe9f5;
  background-color: #12303a;
  border-color: #1c4a59;
}
/* ApexCharts draws its axis labels and legend in #373d3f (1.47:1 on a dark
   card). It writes them as SVG attributes and inline styles, which a
   stylesheet rule outranks or, for the legend, overrides with !important. */
[data-skin="dark"] .apexcharts-text,
[data-skin="dark"] .apexcharts-xaxis-label,
[data-skin="dark"] .apexcharts-yaxis-label,
[data-skin="dark"] .apexcharts-title-text {
  fill: #9aa4b2;
}
[data-skin="dark"] .apexcharts-legend-text {
  color: #9aa4b2 !important;
}
/* ── Long lists: the first column (and narrow actions) stay in view ──────
   The Sales Order list has 16 columns and Accounts Receivable 12; at 1366 px
   the statuses and the actions were past the right edge (plan 122, phase 4).
   A sticky cell needs an opaque background, so the table's own background
   variable is made opaque here; a row that sets its own (table-danger on an
   overdue AR) still wins, and the striped and hover tints still lie on top.
   .table-sticky-actions pins the last column too — only for a list whose
   actions are narrow (AR: one View button): a wide one covers the columns
   it was meant to make room for. */
:is(.table-sticky-first, .table-sticky-actions) {
  --bs-table-bg: #fff;
}
[data-skin="dark"] :is(.table-sticky-first, .table-sticky-actions) {
  --bs-table-bg: #192030;
}
.table-sticky-first > :is(thead, tbody) > tr > :first-child {
  position: sticky;
  left: 0;
  z-index: 2;
}
.table-sticky-first > :is(thead, tbody) > tr > :first-child::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background-color: var(--bs-border-color);
}
/* From tablet width up: on a phone even one pinned button column takes too
   much of the table. */
@media (min-width: 768px) {
  .table-sticky-actions > :is(thead, tbody) > tr > :last-child {
    position: sticky;
    right: 0;
    z-index: 2;
  }
  .table-sticky-actions > :is(thead, tbody) > tr > :last-child::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 1px;
    background-color: var(--bs-border-color);
  }
}

[data-skin="dark"] .apexcharts-gridline,
[data-skin="dark"] .apexcharts-grid line {
  stroke: #2c3650;
}

/* Chart legend dots take the series' own colour (home/index sets
   --legend-dot), not a colour chosen by the item's position in the list.
   [style] lifts this above the template's .card-one .legend li:last-child. */
.card-one .legend li.legend-swatch[style]::before,
.legend li.legend-swatch[style]::before {
  background-color: var(--legend-dot);
}

/* ── Status badges: the colours users know, a modern shape (2026-11-16) ────
   Before 2026-11-14 every status was a solid template badge at 16px bold.
   Plan 123 made most of them quiet pastel tints; users liked the look but
   knew each status by its old colour, and the owner chose solid again with
   a modern touch (option A): the same colours, a pill, 12.5px semibold and a
   faint inner edge; then, the same day, an icon in front (option B). Three old colours could not carry white text (success
   #0cb785 2.6:1, success-2 #03a54c 3.2:1, secondary #6e7985 4.4:1); on status
   badges only they are deepened just to 4.5:1 — the hue does not move.
   Yellow and cyan keep dark text (.badge.bg-warning / bg-info above). */
.badge.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: auto;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.78125rem; /* 12.5px */
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
}
/* Option B (owner, 2026-11-16): an icon by meaning before the word
   (StatusIconHelper). Decorative — the word says it — so aria-hidden. */
.badge.status-badge > i {
  font-size: 0.8125rem; /* 13px */
  line-height: 1;
  opacity: 0.95;
}
.badge.status-badge.bg-success   { background-color: #098460 !important; } /* 4.70:1 */
.badge.status-badge.bg-success-2 { background-color: #02873e !important; } /* 4.61:1 */
.badge.status-badge.bg-secondary { background-color: #6c7782 !important; } /* 4.59:1 */
/* Unmapped statuses fall back to bg-light: dark text on a light grey. */
.badge.status-badge.bg-light {
  background-color: #e9ecf1 !important;
  color: #212830 !important;
}
/* Dark skin: the near-black and the light badges would sink into the
   surface or glare; both become a slate the eye can find. */
[data-skin="dark"] .badge.status-badge.bg-dark {
  background-color: #3a4556 !important;
  color: #e1e5ec !important;
}
[data-skin="dark"] .badge.status-badge.bg-light {
  background-color: #2c3650 !important;
  color: #c7cdd6 !important;
}

/* AR list: the legend above the table and the quiet "not sent" note. */
.ar-tint-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.ar-tint-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid #f1aeb5;
  border-radius: 3px;
  background-color: var(--bs-table-danger-bg, #f8d7da);
}
.ar-not-sent {
  color: #5f6b77;
}
[data-skin="dark"] .ar-not-sent {
  color: #9aa4b2;
}
[data-skin="dark"] .ar-tint-swatch {
  border-color: #6b2a33;
  background-color: #48242e; /* the dark skin's .table-danger cell tint */
}

/* ── Phone (below 576px): cards, bottom bar (plan 123, phase 3) ───────────
   Lists that were a sideways-scrolling table show each record as a card;
   the whole card opens it. */
.record-card-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.record-card + .record-card {
  margin-top: 10px;
}
.record-card-body {
  display: block;
  padding: 12px 14px;
  border: 1px solid #e2e5ec;
  border-radius: 10px;
  background-color: #ffffff;
  color: inherit;
  text-decoration: none;
}
a.record-card-body:hover,
a.record-card-body:focus-visible {
  border-color: #b8c3ef;
  color: inherit;
}
a.record-card-body:active {
  background-color: #f6f8fd;
}
/* More than 30 days past due: the same tint as the table row and the legend
   swatch above the list, so one mark means one thing on every screen. */
.record-card-alert .record-card-body {
  border-color: #f1aeb5;
  background-color: var(--bs-table-danger-bg, #f8d7da);
}
/* On the tint: code 5.2:1 and meta 5.7:1, as on the tinted table row. */
.record-card-alert .record-card-code { color: #3a52b0; }
.record-card-alert .record-card-meta { color: #4b5563; }
.record-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.record-card-code {
  font-weight: 600;
  color: #4560c8;
}
.record-card-amount {
  font-weight: 600;
  white-space: nowrap;
  color: #212830;
}
.record-card-title {
  margin-top: 2px;
  font-weight: 500;
  color: #212830;
}
.record-card-meta {
  margin-top: 2px;
  font-size: 0.8125rem;
  color: #5f6b77;
}
.record-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
[data-skin="dark"] .record-card-body {
  border-color: #2c3650;
  background-color: #192030;
}
[data-skin="dark"] a.record-card-body:active {
  background-color: #1e2639;
}
[data-skin="dark"] .record-card-code { color: #8fa4ee; }
[data-skin="dark"] .record-card-amount,
[data-skin="dark"] .record-card-title { color: #e6e9ef; }
[data-skin="dark"] .record-card-meta { color: #9aa4b2; }
[data-skin="dark"] .record-card-alert .record-card-body {
  border-color: #6b2a33;
  background-color: #48242e; /* the dark skin's .table-danger cell tint */
}

/* Sales Order page on a phone: More menu holds the secondary actions. */
.so-more-menu {
  min-width: 220px;
}
.so-more-menu a,
.so-more-menu .btn {
  display: block;
  width: 100%;
  text-align: left;
}
.so-more-menu > * + * {
  margin-top: 6px;
}

/* The bottom bar: the places a phone user goes most, within thumb reach. */
.bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 990; /* above the page and header (800), below the sidebar drawer (1000) and modals */
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
  border-top: 1px solid #e2e5ec;
  background-color: #ffffff;
  box-shadow: 0 -2px 10px rgba(33, 40, 48, 0.06);
}
.bottom-bar-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 58px;
  padding: 6px 2px;
  border: 0;
  background: none;
  color: #5f6b77;
  font: inherit;
  font-size: 0.6875rem;
  line-height: 1.2;
  text-decoration: none;
}
.bottom-bar-item i {
  font-size: 1.375rem;
  line-height: 1;
}
.bottom-bar-item.active {
  color: #3a52b0;
  font-weight: 600;
}
.bottom-bar-item:active {
  background-color: #f3f5f9;
}
[data-skin="dark"] .bottom-bar {
  border-top-color: #2c3650;
  background-color: #192030;
}
[data-skin="dark"] .bottom-bar-item { color: #9aa4b2; }
[data-skin="dark"] .bottom-bar-item.active { color: #8fa4ee; }
[data-skin="dark"] .bottom-bar-item:active { background-color: #1e2639; }

@media (max-width: 575.98px) {
  /* Room under the last line of the page for the bar. */
  .main.main-app {
    padding-bottom: calc(76px + env(safe-area-inset-bottom)) !important;
  }
  /* The stock audit outbox floats above the bar, not under it. */
  .stock-audit-outbox {
    bottom: calc(70px + env(safe-area-inset-bottom)) !important;
  }
  /* With the sidebar drawer open the bar would poke out beside it, above
     the backdrop; the drawer closes from the backdrop. */
  body.sidebar-show .bottom-bar {
    visibility: hidden;
  }
}

/* ── Contrast left after plan 122 (plan 123, phase 4) ──────────────────────
   Found by the detector run of 2026-11-14 with the app's CSS loaded. */

/* Sign-in placeholders were 2.2:1: the template's .card-sign rule
   (style.css:20620) is more specific than plan 122's .form-control one, so
   that fix never reached the sign-in card. Now 4.62:1. */
.card-sign .form-control::placeholder {
  color: #6b7684;
  opacity: 1;
}
[data-skin="dark"] .card-sign .form-control::placeholder {
  color: #8e97a8;
}

/* On a tinted AR row (#f8d7da) links were 4.18:1 and grey notes 4.08:1.
   Light skin only: unscoped, these dark colours reached the dark skin's tint
   (#48242e) at 1.92:1 and 1.77:1 (found 2026-11-15). */
:root:not([data-skin="dark"]) .table-danger a:not(.btn) {
  color: #3a52b0; /* 5.3:1 on the tint */
}
:root:not([data-skin="dark"]) .table-danger .ar-not-sent,
:root:not([data-skin="dark"]) .table-danger .text-secondary {
  color: #4b5563 !important; /* 5.7:1 on the tint */
}

/* The notification count was 9px in a 14px circle, white on #dc3545
   (4.53:1). Now 11px, a pill that fits "99", white on #c82333 (5.61:1). */
.header-main .dropdown-link small,
.header-main .dropdown-link .small {
  top: -5px;
  right: -8px;
  width: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background-color: #c82333;
  font-size: 11px;
  font-weight: 600;
}

/* Template greys plan 122 did not reach: 4.43:1 on white. The header's icon
   links (bell, and the screen-reader text inside them) were the same grey. */
:root {
  --bs-gray: #5f6b77; /* 5.45:1 on white */
}
.header-main .dropdown-link {
  color: #5f6b77;
}
caption,
.blockquote-footer,
.figure-caption {
  color: #5f6b77;
}

/* Green totals on the price summary card's blue gradient were 4.44:1. */
.price-summary-card .text-success {
  color: #086b4d !important; /* 5.8:1 on #e9f3fb */
}

/* ── Dark skin: light islands and stray colours (2026-11-15) ──────────────
   Measured on 111 pages in the dark skin. Light surfaces written into views
   (inline styles and page <style> blocks) stayed light while the text on
   them turned light: amounts on the price summary 1.14:1, a card title white
   on white, notification titles 1.05:1. Page <style> blocks load after this
   file, so these rules outrank them by specificity (and !important where the
   page or an inline style uses it). */

/* Surfaces: the dark card colours. */
[data-skin="dark"] .price-summary-card {
  background: #1e2639 !important;
  border-color: #2c3650 !important;
}
[data-skin="dark"] .price-summary-card .text-success {
  color: #3dd6a5 !important;
}
[data-skin="dark"] .price-summary-card .text-warning {
  color: #ffc94d !important;
}
[data-skin="dark"] [style*="background-color: #f8f9fa"] {
  background-color: #1e2639 !important; /* product / assembled-product action panels, service item rows */
}
[data-skin="dark"] [style*="background-color: #f8d7da"] {
  background-color: #48242e !important; /* a returned item's row on the SO detail */
}
[data-skin="dark"] [style*="background-color: #d4edda"] {
  background-color: #1f3d36 !important; /* "available" cells on holds and stock summaries */
  color: #4fd1a5 !important;
}
[data-skin="dark"] .bg-white {
  background-color: #192030 !important;
}
/* Page styles paint these card bodies #f8f9fa; let the card's own dark
   colour show, so a bg-warning-subtle summary card matches its siblings. */
[data-skin="dark"] body .card.bg-light .card-body,
[data-skin="dark"] body .card.bg-warning-subtle .card-body {
  background-color: transparent !important;
}
/* Customer / product / supplier detail: the card header was a light
   gradient under the white card title, invisible; its tab strip and the
   active tab stayed light; empty states were a light panel. */
[data-skin="dark"] body .card-header {
  background: transparent;
}
[data-skin="dark"] body .nav-tabs .nav-link.active {
  background-color: #192030;
  border-color: #2c3650 #2c3650 #192030;
  color: var(--dk-text);
}
[data-skin="dark"] body .text-center.py-5 {
  background: transparent;
}
/* Hover and selection fills in page styles. */
[data-skin="dark"] body .dropdown-item:hover,
[data-skin="dark"] body .permission-header:hover,
[data-skin="dark"] body .payment-item:hover,
[data-skin="dark"] body .bg-light.p-3.rounded:hover {
  background-color: #222b41 !important;
}
[data-skin="dark"] body .payment-item input:checked + .payment-details,
[data-skin="dark"] body .form-check-container:has(input:checked) {
  background-color: rgba(143, 164, 238, 0.14);
}
[data-skin="dark"] body .form-check-container {
  background-color: #1e2639;
}
[data-skin="dark"] body .form-check-container:hover {
  background-color: #222b41 !important;
}
[data-skin="dark"] body .action-item.action-highlight .form-check-container {
  background-color: rgba(255, 193, 7, 0.14) !important;
}
/* Order planning report: light column fills under inherited light text. */
[data-skin="dark"] body .opr-report .opr-table thead .opr-cols th {
  background: #1f3d36;
  color: #b8eedb;
}
[data-skin="dark"] body .opr-report .opr-table tbody tr:hover td,
[data-skin="dark"] body .opr-report .opr-table td.col-total,
[data-skin="dark"] body .opr-report .opr-table td.col-orderinv {
  background: #1e2639;
}
[data-skin="dark"] body .opr-report .opr-table td.col-rencana {
  background: #48242e;
  color: #ff9aa3;
}

/* Alerts: a dark tint of each hue, as plan 122 did for .alert-info. */
[data-skin="dark"] .alert-success {
  --bs-alert-color: #b8eedb; --bs-alert-bg: #143a31; --bs-alert-border-color: #1d5646;
  color: #b8eedb; background-color: #143a31; border-color: #1d5646;
}
[data-skin="dark"] .alert-warning {
  --bs-alert-color: #ffe3a3; --bs-alert-bg: #3a3218; --bs-alert-border-color: #5a4b1f;
  color: #ffe3a3; background-color: #3a3218; border-color: #5a4b1f;
}
[data-skin="dark"] .alert-danger {
  --bs-alert-color: #ffc2c7; --bs-alert-bg: #48242e; --bs-alert-border-color: #6b2a33;
  color: #ffc2c7; background-color: #48242e; border-color: #6b2a33;
}
[data-skin="dark"] .alert-primary {
  --bs-alert-color: #c9d3f7; --bs-alert-bg: #222f5e; --bs-alert-border-color: #34447e;
  color: #c9d3f7; background-color: #222f5e; border-color: #34447e;
}
[data-skin="dark"] .alert-secondary,
[data-skin="dark"] .alert-light {
  --bs-alert-color: var(--dk-text-2); --bs-alert-bg: #222b41; --bs-alert-border-color: #2c3650;
  color: var(--dk-text-2); background-color: #222b41; border-color: #2c3650 !important;
}
[data-skin="dark"] :is(.alert-success, .alert-warning, .alert-danger, .alert-primary) :is(.text-muted, .text-secondary) {
  color: inherit !important;
}

/* Notifications page: titles were #212830 on #1b2337 (1.05:1), bodies #555
   (2.10:1), category chips #313c47 (1.29:1). */
[data-skin="dark"] body .notification-group-summary {
  background: transparent;
}
[data-skin="dark"] body .notification-group-chip {
  border-color: #2c3650;
  background: #1e2639;
  color: var(--dk-text-2);
}
[data-skin="dark"] body .notification-group-chip.has-unread {
  border-color: rgba(255, 193, 7, 0.45);
  background: rgba(255, 193, 7, 0.1);
  color: var(--dk-text);
}
[data-skin="dark"] body .notification-group-chip:hover {
  border-color: #8fa4ee;
  color: #b3c2f4;
}
[data-skin="dark"] body .notification-group-chip.is-active {
  border-color: #4560c8;
  background: #4560c8;
  color: #ffffff;
}
[data-skin="dark"] body .notification-item-modern .notification-title,
[data-skin="dark"] body .notification-item-modern.is-unread .notification-title,
[data-skin="dark"] body .notification-header-link,
[data-skin="dark"] body .section-list li strong {
  color: var(--dk-text);
}
[data-skin="dark"] body .notification-item-modern .notification-body-text,
[data-skin="dark"] body .notification-body,
[data-skin="dark"] body .notification-text,
[data-skin="dark"] body .section-list li {
  color: var(--dk-text-2);
}
[data-skin="dark"] body .notification-item-modern .notification-avatar {
  background-color: #222b41;
}
[data-skin="dark"] body .notification-section.details-section {
  background-color: #12303a;
}
[data-skin="dark"] body .notification-section.credit-section {
  background-color: #143a31;
}

/* Bootstrap colours left at their light-skin values. */
[data-skin="dark"] .text-info {
  color: #6fd3ec !important; /* was #087990, 3.21:1 */
}
[data-skin="dark"] body .table-agent th a.sort-link,
[data-skin="dark"] body .sort-icon.sort-active {
  color: #8fa4ee; /* Purchase Orders' own sort links were #0d6efd, 3.62:1 */
}
[data-skin="dark"] .btn-outline-danger {
  --bs-btn-color: #ff7a85;
  --bs-btn-border-color: #ff7a85;
  --bs-btn-hover-color: #141926;
  --bs-btn-hover-bg: #ff7a85;
  --bs-btn-hover-border-color: #ff7a85;
}
/* Pill tabs (e.g. Commission Bank Payments' Posted / Void) were #6e7985,
   3.67:1; code (rack codes) inside an info alert was #ea4c89 on #12303a,
   3.90:1. */
[data-skin="dark"] .nav-pills .nav-link:not(.active) {
  color: var(--dk-text-2);
}
[data-skin="dark"] code {
  color: #f7a1c4; /* 8.4:1 on a card, 7.0:1 on the info alert */
}
/* A button whose label is a file name (any link to an attachment): it ran
   off the card on a phone ("223 PRIMA UNTUNG BERSAMA - MJC.pdf (391 KB)" on
   the Sales Order page, 2026-11-15). It now wraps inside its container, at
   spaces first and anywhere in a name without spaces. */
a.btn[href*="/rails/active_storage/"] {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
/* ── Menu as a top bar + menu search (plan 124) ───────────────────────────
   "Top bar" in the account menu sets html[data-nav="top"] (in <head>, before
   paint). Only screens >= 992px react: the sidebar and burger go, the page
   takes the full width, and the menu becomes a second row under the header.
   Phones keep the off-canvas sidebar and the bottom bar whatever is chosen.
   The header and top bar sit above page content (1031/1030) and below
   modals (1055). */
.top-menu,
.header-brand {
  display: none;
}

@media (min-width: 992px) {
  html[data-nav="top"] .sidebar,
  html[data-nav="top"] #menuSidebar {
    display: none;
  }
  html[data-nav="top"] .header-main {
    left: 0;
    border-left-width: 0;
    z-index: 1031;
  }
  html[data-nav="top"] .main {
    margin-left: 0;
    margin-top: 120px; /* 72px header + 48px top bar */
  }
  html[data-nav="top"] .header-brand {
    display: flex;
    align-items: center;
    margin-right: 1.5rem;
  }
  html[data-nav="top"] .top-menu {
    display: block;
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    z-index: 1030;
    height: 48px;
    padding: 0 1rem;
    background-color: #fff;
    border-bottom: 1px solid #e2e5ec;
    box-shadow: 0 2px 4px rgba(33, 40, 48, 0.04);
  }
}

.top-menu-list {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}
.top-menu-link {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 0.75rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #41505f;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
}
.top-menu-link:hover,
.top-menu-link[aria-expanded="true"] {
  background-color: #f0f3fa;
  color: #1f2b38;
}
/* The group holding the current page: a filled pill, not a line under it
   (owner, 2026-11-15: a bottom-only border on a rounded button looked odd). */
.top-menu-link.active,
.top-menu-link.active:hover {
  background-color: #e8edfc;
  color: #2f4fc4; /* 6.0:1 on the tint */
  font-weight: 600;
}
.top-menu-link:focus-visible {
  outline: 2px solid #506fd9;
  outline-offset: 2px;
}
.top-menu-search {
  margin-left: auto;
  width: 15rem;
}
@media (max-width: 1199.98px) {
  .top-menu-link { padding: 0 0.55rem; }
  .top-menu-search { width: 11rem; }
}
/* Touch screens (a tablet held landscape): 44px targets, as plan 122 set for
   tablets. A mouse keeps the compact 36px row. */
@media (pointer: coarse) {
  .top-menu-link { height: 44px; }
  .top-menu-panel .dropdown-item { min-height: 44px; }
  .menu-search-option { min-height: 44px; }
}

.top-menu-panel {
  min-width: 15rem;
  max-height: calc(100vh - 140px);
  margin-top: 6px !important;
  padding: 0.5rem;
  overflow-y: auto;
}
.top-menu-panel-title {
  padding: 0.25rem 0.75rem 0.5rem;
  color: #5c6b7a; /* 5.4:1 */
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.top-menu-cols-2 { min-width: 30rem; }
.top-menu-cols-3 { min-width: 44rem; }
.top-menu-cols-2 .top-menu-panel-items { column-count: 2; column-gap: 0.5rem; }
.top-menu-cols-3 .top-menu-panel-items { column-count: 3; column-gap: 0.5rem; }
.top-menu-panel .dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  break-inside: avoid;
  font-size: 0.875rem;
  white-space: normal;
}
.top-menu-panel .dropdown-item i {
  color: #6b7a89;
  font-size: 1rem;
}
.top-menu-panel .dropdown-item.active,
.top-menu-panel .dropdown-item:active {
  background-color: #eef2fd;
  color: #2f4fc4;
  font-weight: 500;
}
.top-menu-panel .dropdown-item.active i { color: inherit; }

/* Menu search — in the sidebar and in the top bar. */
.menu-search { position: relative; }
.sidebar .menu-search { margin: 0.75rem 1.25rem 0.75rem; }
/* The sidebar is 250px and clips its overflow: the group goes under the page
   name there, instead of beside it. */
.sidebar .menu-search-option { flex-wrap: wrap; row-gap: 0; }
.sidebar .menu-search-label { flex: 1 1 0; min-width: 0; }
.sidebar .menu-search-group {
  flex-basis: 100%;
  margin-left: 1.5rem;
  padding-left: 0;
}
.menu-search-field { position: relative; }
.menu-search-field > i {
  position: absolute;
  top: 50%;
  left: 0.6rem;
  transform: translateY(-50%);
  color: #6b7a89;
  pointer-events: none;
}
.menu-search-field .form-control {
  padding-left: 2rem;
  padding-right: 2rem;
}
.menu-search-hint {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  padding: 0 0.35rem;
  border: 1px solid #cfd5df;
  border-radius: 4px;
  background: transparent;
  color: #5c6b7a;
  font-size: 0.7rem;
}
.menu-search-field .form-control:focus ~ .menu-search-hint,
.menu-search-field .form-control:not(:placeholder-shown) ~ .menu-search-hint {
  display: none;
}
.menu-search-results {
  position: absolute;
  z-index: 1040;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  min-width: 16rem;
  max-height: 22rem;
  margin: 0;
  padding: 0.25rem;
  overflow-y: auto;
  list-style: none;
  background-color: #fff;
  border: 1px solid #e2e5ec;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(33, 40, 48, 0.12);
}
.top-menu-search .menu-search-results {
  left: auto;
  width: 22rem;
}
.menu-search-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  color: #1f2b38;
  font-size: 0.875rem;
  text-decoration: none;
}
.menu-search-option i { color: #6b7a89; }
.menu-search-group {
  margin-left: auto;
  padding-left: 0.5rem;
  color: #5c6b7a;
  font-size: 0.75rem;
  white-space: nowrap;
}
.menu-search-results .is-highlighted .menu-search-option,
.menu-search-option:hover {
  background-color: #eef2fd;
  color: #2f4fc4;
}
.menu-search-empty {
  padding: 0.5rem 0.6rem;
  color: #5c6b7a;
  font-size: 0.8125rem;
}

/* html[data-nav] in the selector: the light rule above lives under
   html[data-nav="top"] and would otherwise win. */
html[data-skin="dark"][data-nav="top"] .top-menu {
  background-color: #192030;
  border-bottom-color: rgba(255, 255, 255, 0.06);
}
[data-skin="dark"] .top-menu-link { color: var(--dk-text-2); }
[data-skin="dark"] .top-menu-link:hover,
[data-skin="dark"] .top-menu-link[aria-expanded="true"] {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--dk-text);
}
[data-skin="dark"] .top-menu-link.active,
[data-skin="dark"] .top-menu-link.active:hover {
  background-color: rgba(125, 149, 240, 0.18);
  color: #c9d3ff;
}
[data-skin="dark"] .top-menu-panel-title,
[data-skin="dark"] .top-menu-panel .dropdown-item i,
[data-skin="dark"] .menu-search-field > i,
[data-skin="dark"] .menu-search-option i,
[data-skin="dark"] .menu-search-group,
[data-skin="dark"] .menu-search-empty {
  color: var(--dk-muted);
}
[data-skin="dark"] .top-menu-panel .dropdown-item { color: var(--dk-text-2); }
[data-skin="dark"] .top-menu-panel .dropdown-item:hover,
[data-skin="dark"] .top-menu-panel .dropdown-item:focus {
  background-color: rgba(255, 255, 255, 0.06);
  color: var(--dk-text);
}
[data-skin="dark"] .top-menu-panel .dropdown-item.active,
[data-skin="dark"] .menu-search-results .is-highlighted .menu-search-option,
[data-skin="dark"] .menu-search-option:hover {
  background-color: rgba(125, 149, 240, 0.16);
  color: #c9d3ff;
}
[data-skin="dark"] .menu-search-results {
  background-color: #1e273a;
  border-color: rgba(255, 255, 255, 0.08);
}
[data-skin="dark"] .menu-search-option { color: var(--dk-text); }
[data-skin="dark"] .menu-search-hint {
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--dk-muted);
}

/* ── Sign-in pages (sign in, 2FA) — proportions (owner, 2026-11-16) ───────
   Measured on a 412x915 phone before: the form sat in the middle of the
   screen (logo at 28%, Password 551-591px, button 615-655px), right where a
   keyboard covers it; two near-equal headings competed (PUB-SYNC 22px bold,
   "Sign In" 24px light); fields and button 40px, the eye toggle 18x18px; the
   main button the smallest text on the page (12px caps); inputs 14px, which
   makes iPhones zoom on focus. On desktop the card was invisible (no border,
   no padding, a shadow too faint to see). */
.card-sign .card-title {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.card-sign .form-control {
  height: 44px;
  font-size: 1rem; /* 16px: iOS zooms into any field below it */
}
.card-sign .btn {
  height: 44px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.card-sign .password-toggle {
  width: 44px;
  height: 44px;
}

/* Phones: no card (full-bleed, like an app), the form in the top third so
   the keyboard never covers the button, 48px targets. */
@media (max-width: 575.98px) {
  .page-sign {
    align-items: flex-start;
    /* 56px on a 360x800 phone keeps the button (ends ~476px) above a
       typical keyboard there (from ~500px); was 255px down the screen. */
    padding: clamp(32px, 7vh, 80px) 0 24px;
  }
  .card-sign .card-header { padding: 0 24px; }
  .card-sign .card-body { padding: 28px 24px 24px; }
  .card-sign .form-control,
  .card-sign .btn,
  .card-sign .password-toggle {
    height: 48px;
  }
  .card-sign .password-toggle { width: 48px; }
}

/* Wider screens: a card you can actually see, centred on the grey page. */
@media (min-width: 576px) {
  .card-sign {
    width: 400px;
    border: 1px solid #e3e7ee;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 12px 32px rgba(16, 24, 40, 0.08);
  }
  .card-sign .card-header { padding: 36px 36px 0; }
  .card-sign .card-body { padding: 28px 36px 36px; }
  [data-skin="dark"] .card-sign {
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  }
}

/* ── Every list is cards on a phone (plan 126, owner 2026-11-16) ──────────
   phone_cards_controller.js marks list tables `table-stack` and labels each
   cell with its column (data-label). Below 576px a row becomes a card like
   the hand-made ones of plan 123: first column as the title, then "Column …
   value" lines, the buttons at the bottom. A tinted row (urgent, overdue)
   keeps its tint. The cell's own markup is untouched — the label is a
   pseudo-element — so page scripts inside the table still work. */
@media (max-width: 575.98px) {
  .table-responsive:has(> table.table-stack) {
    overflow: visible;
  }
  table.table-stack {
    --bs-table-bg: #fff;
    display: block;
    min-width: 0 !important;
    width: 100%;
    margin-bottom: 0;
  }
  [data-skin="dark"] table.table-stack {
    --bs-table-bg: #192030;
  }
  table.table-stack > thead,
  table.table-stack > tfoot {
    display: none;
  }
  table.table-stack > tbody {
    display: block;
  }
  table.table-stack > tbody > tr {
    display: block;
    margin: 0 0 10px;
    padding: 8px 14px 10px;
    border: 1px solid #e2e5ec;
    border-radius: 10px;
    background-color: var(--bs-table-bg);
  }
  [data-skin="dark"] table.table-stack > tbody > tr {
    border-color: rgba(255, 255, 255, 0.1);
  }
  table.table-stack > tbody > tr > td {
    display: block;
    position: relative !important;
    left: auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 1.6em;
    padding: 4px 0 4px 42% !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    text-align: right !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }
  table.table-stack > tbody > tr > td > div {
    max-width: none !important;
    margin-left: auto;
  }
  table.table-stack > tbody > tr > td::before {
    content: attr(data-label);
    position: absolute;
    top: 5px;
    left: 0;
    width: 40%;
    padding-right: 8px;
    color: #5c6b7a; /* 5.4:1 on white */
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.35;
    text-align: left;
    white-space: normal;
  }
  [data-skin="dark"] table.table-stack > tbody > tr > td::before {
    color: var(--dk-muted);
  }
  /* The pinned-first-column divider of .table-sticky-first means nothing here. */
  table.table-stack > tbody > tr > td::after {
    content: none !important;
  }
  table.table-stack > tbody > tr > td[data-label=""] {
    padding-left: 0 !important;
    text-align: left !important;
  }
  table.table-stack > tbody > tr > td[data-label=""]::before,
  table.table-stack > tbody > tr > td.stack-title::before,
  table.table-stack > tbody > tr > td.stack-actions::before,
  table.table-stack > tbody > tr > td.stack-check::before,
  table.table-stack > tbody > tr > td.stack-wide::before {
    content: none;
  }
  table.table-stack > tbody > tr > td.stack-title {
    margin-bottom: 4px;
    padding: 2px 0 8px !important;
    border-bottom: 1px solid #eef0f4 !important;
    font-size: 0.9375rem;
    font-weight: 600;
    text-align: left !important;
  }
  table.table-stack > tbody > tr > td.stack-actions {
    margin-top: 6px;
    padding: 10px 0 0 !important;
    border-top: 1px solid #eef0f4 !important;
    text-align: left !important;
  }
  [data-skin="dark"] table.table-stack > tbody > tr > td.stack-title,
  [data-skin="dark"] table.table-stack > tbody > tr > td.stack-actions {
    border-color: rgba(255, 255, 255, 0.08) !important;
  }
  table.table-stack > tbody > tr > td.stack-actions :is(.btn-group, .d-flex) {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start !important;
    gap: 6px;
  }
  /* A card that opens its record (phone_cards_controller#markOpenLink) has
     no buttons, like the Sales Order cards: they are on the record's page.
     Approvals keeps Approve / Reject (owner, 2026-11-16) and drops only View,
     which the tap replaces. */
  table.table-stack > tbody > tr.stack-link {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  table.table-stack > tbody > tr.stack-link:active {
    border-color: var(--bs-primary, #506fd9);
  }
  table.table-stack:not([data-phone-cards-keep-actions]) > tbody > tr.stack-link > td.stack-actions,
  table.table-stack > tbody > tr.stack-link > td.stack-actions a[data-phone-card-open] {
    display: none !important;
  }
  /* A long value (description, address): label above, full width. */
  table.table-stack > tbody > tr > td.stack-block {
    padding: 22px 0 6px !important;
    text-align: left !important;
  }
  table.table-stack > tbody > tr > td.stack-block > div {
    margin-left: 0;
  }
  table.table-stack > tbody > tr > td.stack-block::before {
    top: 4px;
    width: 100%;
  }
  table.table-stack > tbody > tr > td.stack-check {
    float: right;
    padding: 2px 0 0 8px !important;
  }
  table.table-stack > tbody > tr > td.stack-wide {
    padding: 4px 0 !important;
    text-align: center !important;
  }
  /* Nothing in a card value may be wider than the card: a long badge (a
     role name, "Debt: IDR 1,524,583 (all periods)") wraps, and a value
     truncated at a fixed max-width (product names on Order Planning) is
     truncated at the card's width instead. Summary cards sit two to a row,
     so the same goes for them. */
  table.table-stack > tbody > tr > td .badge,
  .col-6 > .card.border-0 .badge {
    max-width: 100%;
    white-space: normal;
  }
  table.table-stack > tbody > tr > td .text-truncate {
    max-width: 100% !important;
  }
  /* A pager with many pages wraps rather than widening the page. */
  .pagination {
    flex-wrap: wrap;
  }
  /* A show page's header (breadcrumb + title + status) would not shrink
     below its content, so on PO show the whole page grew to 430px and the
     top bar slid off the screen. Let it shrink and wrap instead. */
  main > .d-flex.justify-content-between > div:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  main > .d-flex.justify-content-between > div:first-child > .d-flex:has(> .main-title) {
    flex-wrap: wrap;
    row-gap: 4px;
  }
}
