/* ==== theme ==== */
/* The apps' shared theme: paste this block unchanged as the first section of static_extend/<app>/css/<app>.css (no separate file, so no extra request).
   One navy accent (#1a396f; dark mode a brighter #24508f fill and #9db9ea text) on neutral greys (shadcn-style: soft borders, 8px radius, clear focus ring). Dialog headers are filled --brand with white text; table and column headers use --brand-tint. Every colour in the app uses these tokens; status colours keep their meaning. */
:root {
  --brand: #1a396f;
  --brand-hover: #142c57;
  --brand-soft: #edf2fa;
  --brand-line: #b7c8e3;
  --brand-tint: #dce6f5;
  --brand-ink: #1a396f; /* the brand as text and icons; --brand is the fill under white text */
  --on-brand-soft: #dce6f5; /* a subtitle on a --brand header */
  --on-brand: #fff;
  --on-brand-line: rgba(255, 255, 255, .35);
  --on-brand-hover: rgba(255, 255, 255, .16);
  --bg: #f7f8fa;
  --surface: #fff;
  --surface-2: #f2f4f7;
  --ink: #1f2933;
  --muted: #5f6b7a;
  --faint: #8a94a3;
  --line: #e3e7ed;
  --line-strong: #cfd5de;
  --ring: 0 0 0 3px rgba(26, 57, 111, .22);
  --success: #2e7d4f;
  --success-soft: #e8f4ec;
  --warning: #9a6200;
  --warning-soft: #fdf3e1;
  --danger: #c62828;
  --danger-soft: #fdecec;
  --info: #2f6bad;
  --info-soft: #eaf1f9;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --backdrop: rgba(16, 24, 40, .45);
  --toast-bg: #1f2933;
  --font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* sizes: every app takes its sizes from here (heights, paddings, type), so all pages line up */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs: 13px;
  --fs-lg: 17px;
  --topbar-h: 64px;
  --topbar-pad: 24px;
  --mark: 32px;
  --avatar: 36px;
  --control-h: 36px;
  --control-pad: 0 10px;
  --btn-h: 36px;
  --btn-pad: 0 14px;
  --btn-sm-h: 30px;
  --cell-pad: 10px 12px;
  --dialog-head-pad: 14px 20px;
  --dialog-pad: 18px 20px;
  --dialog-actions-pad: 12px 20px;
  color-scheme: light;
}
/* dark: <html data-theme="dark"> (js/settings.js sets it from Settings > Theme; Light is the default, System follows the computer); the same names, darker surfaces, lighter text */
:root[data-theme="dark"] {
  --brand: #24508f;
  --brand-hover: #2c5aa0;
  --brand-ink: #9db9ea;
  --brand-soft: #1b293d;
  --brand-line: #2f4a73;
  --brand-tint: #1d2e47;
  --on-brand-soft: #d6e0f2;
  --bg: #0e1216;
  --surface: #161b21;
  --surface-2: #1d232a;
  --ink: #e4e9ee;
  --muted: #9aa6b2;
  --faint: #6e7a86;
  --line: #283039;
  --line-strong: #38424d;
  --ring: 0 0 0 3px rgba(157, 185, 234, .3);
  --success: #5ec48d;
  --success-soft: #14301f;
  --warning: #e3a640;
  --warning-soft: #33270f;
  --danger: #f07470;
  --danger-soft: #3a1a1b;
  --info: #6ea9ea;
  --info-soft: #152639;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
  --backdrop: rgba(0, 0, 0, .6);
  --toast-bg: #2b343e;
  color-scheme: dark;
}

/* compact: <html data-density="compact"> (js/settings.js, Settings > Density); smaller rows, fields, buttons and bars, the same layout */
:root[data-density="compact"] {
  --topbar-h: 52px;
  --mark: 28px;
  --avatar: 30px;
  --control-h: 30px;
  --btn-h: 30px;
  --btn-pad: 0 12px;
  --btn-sm-h: 26px;
  --cell-pad: 6px 10px;
  --dialog-head-pad: 10px 16px;
  --dialog-pad: 14px 16px;
  --dialog-actions-pad: 10px 16px;
}
/* ==== base ==== */
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--font);
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible {
  outline: 0;
  box-shadow: var(--ring);
}
.hidden {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.muted {
  color: var(--muted);
}
.error {
  color: var(--danger);
  font-size: var(--fs);
  margin: 12px 0 0;
}
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}
.field label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--muted);
}
/* inputs and selects: one height and border everywhere */
.input {
  width: 100%;
  height: var(--control-h);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background-color: var(--surface);
  color: var(--ink);
  padding: var(--control-pad);
  font-size: var(--fs);
  line-height: 20px;
  outline: none;
}
.input:focus {
  border-color: var(--brand);
  box-shadow: var(--ring);
}
/* buttons: .btn primary, .btn.secondary */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--btn-h);
  padding: var(--btn-pad);
  white-space: nowrap;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--on-brand);
  font-size: var(--fs);
  font-weight: 600;
}
.btn:not(:disabled):hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
}
.btn:disabled {
  opacity: .55;
  cursor: default;
}
.btn.secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn.secondary:not(:disabled):hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}
.link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--brand-ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link:hover {
  text-decoration: underline;
}

/* ==== login ==== */
.login {
  min-height: 100vh;
  padding: 32px 3.4vw 36px;
}
.mgh-wordmark {
  display: inline-flex;
  align-items: center;
  color: var(--brand-ink);
  font-family: Arial, sans-serif;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -2px;
}
.mgh-wordmark:before {
  content: "";
  width: 18px;
  height: 25px;
  margin-right: 3px;
  background: repeating-linear-gradient(to bottom, transparent 0 5px, var(--line-strong) 5px 7px);
}
.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 48px;
  align-items: center;
  margin: 64px auto 0;
  max-width: 1100px;
}
.login .intro h1 {
  font: 700 38px/1.12 Georgia, serif;
  letter-spacing: -1px;
  margin: 16px 0;
}
.login .intro>p {
  font-size: 15px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 560px;
}
.group-badge {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand-ink);
  border-radius: 999px;
  padding: 5px 12px;
  letter-spacing: 1px;
  font-weight: 700;
  font-size: 11px;
}
.login-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 28px;
}
.login-feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.login-feature strong {
  display: block;
  font-size: 14px;
}
.login-feature p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.feature-icon {
  display: grid;
  place-items: center;
  padding: 9px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  border-radius: var(--radius);
}
.login svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.login .card {
  background: var(--surface);
  padding: 26px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.login .card h2 {
  font-size: 23px;
  margin: 0 0 8px;
}
.login label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 16px 0 8px;
}
.login-input {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
}
.login-input:focus-within {
  border-color: var(--brand);
  box-shadow: var(--ring);
  color: var(--brand-ink);
}
.login-input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 11px 0;
  font-size: 14px;
  color: var(--ink);
}
.login .password-toggle {
  display: grid;
  place-items: center;
  padding: 6px;
  border: 0;
  background: transparent;
  color: var(--muted);
}
.login #loginBtn {
  width: 100%;
  margin-top: 22px;
  padding: 12px;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 14px;
  font-weight: 600;
}
.login #loginBtn:hover {
  background: var(--brand-hover);
}
.login #loginBtn:disabled {
  opacity: .6;
  cursor: wait;
}
.login .error {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}
@media(max-width:850px) {
  .login {
    padding: 24px;
  }
  .login-layout {
    grid-template-columns: 1fr;
    max-width: 540px;
    margin-top: 30px;
    gap: 28px;
  }
  .login .intro h1 {
    font-size: 32px;
  }
  .login .intro>p {
    font-size: 14px;
  }
  .login-features {
    display: none;
  }
  .mgh-wordmark {
    font-size: 34px;
  }
}

/* ==== header and account menu ==== */
.app {
  min-height: 100vh;
  background: var(--bg);
}
/* brand | tabs | buttons: equal side columns keep the tabs in the exact centre */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  min-height: var(--topbar-h);
  padding: 0 var(--topbar-pad);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 700;
}
/* the logo is a link to the app's home: it looks like the brand, not a link */
a.brand {
  color: inherit;
  text-decoration: none;
}
.logo {
  display: inline-grid;
  place-items: center;
  width: var(--mark);
  height: var(--mark);
  border-radius: var(--radius);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 16px;
  font-weight: 700;
}
/* view tabs (Home / Dashboard in the header, the Dashboard's own tabs): a segmented group */
.nexus-view-tabs,
.dashboard-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 10px;
}
.nexus-view-tabs button,
.dashboard-tabs button {
  height: 30px;
  padding: 0 14px;
  white-space: nowrap;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: var(--fs);
  font-weight: 600;
}
:root[data-density="compact"] .dashboard-tabs button {
  height: var(--btn-sm-h);
}
.nexus-view-tabs button:hover:not(.active),
.dashboard-tabs button:hover:not(.active) {
  color: var(--ink);
}
.nexus-view-tabs button.active,
.dashboard-tabs button.active {
  background: var(--brand);
  color: var(--on-brand);
}
.profile-area {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
/* Sync, Export: an icon and a short label (the label hides on phones) */
.header-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--btn-h);
  padding: 0 12px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--fs);
  font-weight: 600;
}
.header-action:not(:disabled):hover {
  background: var(--surface-2);
}
.header-action:disabled {
  opacity: .55;
  cursor: default;
}
.header-action svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.profile-avatar {
  display: grid;
  place-items: center;
  margin-left: 8px; /* 16px from the last header button (the row's 8px gap + 8px), the same in every app */
  width: var(--avatar);
  height: var(--avatar);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 14px;
  font-weight: 700;
}
.profile-avatar:hover {
  background: var(--brand-hover);
}
/* ==== toast ==== */
/* The same notification in every app (js/toast.js builds it): paste this block unchanged into css/<app>.css; it uses the app's --ink, --on-brand, --success, --danger, --fs and --shadow-lg.
   Bottom right (centred on a phone), a dark box: a green check or a red !, the message (a #number in light green), an optional green open icon after a thin line, then a muted ×.
   It is a popover (top layer), so the browser's popover defaults are reset here. */
.toast {
  --toast-accent: #9fd9b6; /* light green, readable on the dark box */
  position: fixed;
  inset: auto 24px 24px auto;
  margin: 0;
  max-width: min(440px, calc(100vw - 32px));
  padding: 8px 8px 8px 12px;
  border: 0;
  border-radius: 10px;
  background: var(--toast-bg);
  color: var(--on-brand);
  font-size: var(--fs);
  line-height: 1.4;
  box-shadow: var(--shadow-lg);
  overflow: visible;
}
.toast:popover-open {
  display: flex;
  align-items: center;
  gap: 10px;
}
@media (max-width: 600px) {
  .toast {
    inset: auto 16px 16px 16px;
    max-width: none;
  }
}
.toast-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--success);
}
.toast.error .toast-icon {
  background: var(--danger);
}
.toast-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.toast-icon-error,
.toast.error .toast-icon-ok {
  display: none;
}
.toast.error .toast-icon-error {
  display: block;
}
.toast-text {
  flex: 1;
  min-width: 0;
}
.toast-id {
  font-weight: 600;
  color: var(--toast-accent);
}
.toast-divider,
.toast-open {
  display: none;
}
.toast.has-open .toast-divider {
  display: block;
  flex: none;
  width: 1px;
  height: 18px;
  background: rgb(255 255 255 / 0.2);
}
.toast-btn {
  flex: none;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgb(255 255 255 / 0.55);
  cursor: pointer;
}
.toast-close,
.toast.has-open .toast-open {
  display: grid;
}
.toast-btn:hover,
.toast-btn:focus-visible {
  color: #fff;
  background: rgb(255 255 255 / 0.12);
}
.toast-open {
  color: var(--toast-accent);
  background: rgb(159 217 182 / 0.16);
}
.toast-open:hover,
.toast-open:focus-visible {
  color: var(--toast-accent);
  background: rgb(159 217 182 / 0.28);
}
.toast-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media(max-width:760px) {
  .topbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }
  .nexus-view-tabs {
    order: 3;
    flex-basis: 100%;
  }
  .nexus-view-tabs button {
    flex: 1;
  }
}
/* phones: icon-only square header buttons */
@media(max-width:600px) {
  .header-action {
    width: var(--btn-h);
    padding: 0;
  }
  .header-action-label {
    display: none;
  }
}

/* ==== filters ==== */
.shell {
  padding: 16px var(--topbar-pad) 40px;
}
.filter-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 16px 16px;
  margin-bottom: 16px;
}
.list-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.list-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 10px 12px;
}
.list-filters .field {
  margin: 0;
  min-width: 0;
  gap: 4px;
}
.list-filters .list-search {
  grid-column: span 2;
}
/* the filter card has a light grey fill and its inputs are white; a filter in use is tinted (below) */
.filter-card .field > .input {
  background-color: var(--surface);
}
/* a filter in use is tinted; the search box is not (its × and → show it has text) */
.filter-card .input.filter-applied {
  background-color: var(--brand-soft);
  border-color: var(--brand-line);
}
.filter-card .field:has(.filter-applied)>label {
  color: var(--brand-ink);
  font-weight: 600;
}
.status-context {
  color: var(--brand-ink);
  font-size: var(--fs-sm);
  margin: 8px 0 0;
}
@media(max-width:1250px) {
  .list-filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media(max-width:900px) {
  .list-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media(max-width:600px) {
  .shell {
    padding: 12px 12px 32px;
  }
  .filter-card {
    padding: 12px;
  }
  .filter-actions {
    flex-wrap: wrap;
  }
  .list-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .list-filters .list-search {
    grid-column: 1/-1;
  }
}

/* ==== projection list ==== */
.report-error {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
}
.panel {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);    /* one coloured band per card: the head stays white, only the column headings carry the brand tint */
  border-bottom: 1px solid var(--line);
}
.panel-head:has(.pager) {
  flex-wrap: wrap;
}
.panel-head h2,
.list-filter-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
}
.panel-head .muted {
  font-size: var(--fs-sm);
}
.report-count {
  margin-left: auto;
}
.panel-head .sort-select {
  width: auto;
}
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.table-wrap {
  overflow: auto;
  max-height: 480px;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: var(--fs);
}
/* tables: tinted headings, one cell padding */
.report-table th,
.report-table td,
.modal-data-table th,
.modal-data-table td {
  padding: var(--cell-pad);
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.report-table th,
.modal-data-table th {
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.4;
  text-transform: none;
  background: var(--brand-tint);
  color: var(--ink);
}
.report-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.report-table td {
  vertical-align: top;
}
.report-table td.num,
.report-table th.num {
  text-align: right;
}
.report-table tbody tr:hover,
.modal-data-table tbody tr:hover>td {
  background: var(--surface-2);
}
.report-table td small {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
}
/* long headings wrap, so the columns are as wide as their values (every report table: the list and the Dashboard cards) */
.report-table thead th {
  white-space: normal;
  vertical-align: bottom;
}
.report-table thead th small {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 500;
}
/* the list fits its width: fixed columns, each cell a value and one small line under it, cut with "…" (the full text on hover) */
.main-report {
  table-layout: fixed;
  min-width: 920px;    /* below that (phones) the list scrolls sideways */
}
.main-report .col-check { width: 34px; }
.main-report .col-month { width: 80px; }
.main-report .col-customer { width: 14%; }
.main-report .col-person { width: 10%; }
.main-report .col-lane { width: 13%; }
.main-report .col-product { width: 10%; }
.main-report .col-volume { width: 66px; }
.main-report .col-money { width: 88px; }
.main-report .col-pct { width: 64px; }
.main-report .col-status { width: 118px; }
/* the status stands apart from the numbers: centred in its column, with a wider gap after GP % */
.main-report .status-cell { text-align: center; padding-left: 18px; }
#listPanel.no-select .main-report .col-check { width: 0; }
#listPanel.no-select .main-report .check-cell { padding: 0; border: 0; overflow: hidden; }
#listPanel.no-select .main-report .check-cell input { display: none; }
/* one even gap between columns: the same padding on both sides of every cell; headings on one line in the small font */
.main-report th,
.main-report td {
  padding-left: 10px;
  padding-right: 10px;
}
.main-report thead th {
  white-space: nowrap;
  font-size: var(--fs-xs);
  overflow: hidden;
  text-overflow: ellipsis;
}
.main-report td {
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
.main-report .cell-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}
.main-report .cell-line {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.main-report td.num strong {
  font-variant-numeric: tabular-nums;
}
.main-report td strong {
  font-weight: 600;
}
.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
}
.badge.pending {
  background: var(--warning-soft);
  color: var(--warning);
}
.badge.approved {
  background: var(--success-soft);
  color: var(--success);
}
.empty-row {
  padding: 30px !important;
  text-align: center !important;
  color: var(--muted);
}
.table-loading-cell {
  height: 150px;
  text-align: center !important;
  vertical-align: middle !important;
  color: var(--muted);
  font-size: var(--fs);
}
.table-loader {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 9px;
  vertical-align: middle;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: nexus-spin .8s linear infinite;
}
@keyframes nexus-spin {
  to {
    transform: rotate(360deg);
  }
}
@media(prefers-reduced-motion:reduce) {
  .table-loader {
    animation: none;
  }
}
@media(max-width:600px) {
  .panel-head {
    flex-wrap: wrap;
  }
}

/* Refresh: an icon like the header buttons */
.refresh-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ==== dashboard ==== */
/* the totals in a row of small tiles, then one card with a tab per grouping (one table at a time) */
.dash-totals {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}
.dash-tile {
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.dash-tile small {
  display: block;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.dash-tile strong {
  display: block;
  margin-top: 2px;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.dash-card {
  min-width: 0;
}
.dash-table th,
.dash-table td {
  padding-top: 7px;
  padding-bottom: 7px;
}
.dash-card .panel-head {
  flex-wrap: wrap;
  gap: 8px;
}
.dash-tabs {
  margin-left: 0;
  flex-wrap: wrap;
}
#dashboardPanel .table-wrap {
  max-height: 520px;
}
/* the name column takes the rest; every number column the same narrow width */
.dash-table {
  table-layout: fixed;
  min-width: 720px;
}
.dash-table th.num,
.dash-table td.num {
  width: 96px;
}
#dashboardPanel.loading .dash-card,
#dashboardPanel.loading .dash-totals {
  opacity: .5;
}
.dash-table tbody tr[data-drill] {
  cursor: pointer;
}
.dash-table tbody tr[data-drill]:hover td,
.dash-table tbody tr[data-drill]:focus td {
  background: var(--brand-soft);
}
.dash-table tbody tr[data-drill]:focus {
  outline: 0;
}
.dash-table .total-row td {
  font-weight: 700;
  border-bottom: 2px solid var(--line);
}
@media(max-width:900px) {
  .dash-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ==== dropdowns ==== */
/* one arrow drawn with the theme's colour on every single dropdown */
.app select:not([multiple]),
dialog select:not([multiple]) {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px !important;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-repeat: no-repeat;
  background-position: right 18px center, right 13px center;
  background-size: 5px 5px;
}
/* counted dropdowns: the select's own text is hidden under a label the page writes */
.counted-select {
  position: relative;
  min-width: 0;
}
.counted-select select {
  color: transparent !important;
}
.counted-select select option {
  color: var(--ink);
  background: var(--surface);
}
.selected-filter-label {
  position: absolute;
  left: 10px;
  right: 36px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: var(--fs);
  line-height: 20px;
  color: var(--ink);
}
@media(forced-colors:active) {
  .app select:not([multiple]),
  dialog select:not([multiple]) {
    appearance: auto;
    -webkit-appearance: auto;
    background-image: none;
  }
  .counted-select select {
    color: CanvasText !important;
  }
  .selected-filter-label {
    display: none;
  }
}
/* ==== dropdown search ==== */
/* picker.js: the search list of a long dropdown (select[data-searchable] with more than 10 choices); the same block in Finance, MDM and Pulse */
.select-picker {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(360px, 60vh);
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.select-picker .input {
  flex-shrink: 0;
}
.select-picker ul {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
}
.select-picker li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 8px;
  border-radius: calc(var(--radius) - 2px);
  font-size: var(--fs);
  line-height: 1.35;
  color: var(--ink);
  cursor: pointer;
}
.select-picker li small {
  flex-shrink: 0;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.select-picker li.active {
  background: var(--brand-soft);
}
.select-picker li[aria-selected="true"] {
  font-weight: 600;
  color: var(--brand-ink);
}
.select-picker li.picker-note {
  color: var(--muted);
  font-size: var(--fs-sm);
  cursor: default;
}

/* ==== dialogs ==== */
/* every dialog: dialog.modal > .modal-header (title, subtitle, ×) > .modal-body > .modal-actions (secondary first, the primary last); the Sync dialog builds the same header */
dialog.modal {
  width: min(440px, calc(100vw - 24px));
  max-height: 90dvh;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
dialog.modal[open] {
  display: flex;
  flex-direction: column;
}
dialog.modal::backdrop {
  background: var(--backdrop);
}
/* dialogs fade in softly (off when the system asks for less motion) */
@media (prefers-reduced-motion: no-preference) {
  dialog.modal[open] {
    animation: modal-in .16s ease-out;
  }
  dialog.modal[open]::backdrop {
    animation: backdrop-in .16s ease-out;
  }
}
@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(.99);
  }
}
@keyframes backdrop-in {
  from {
    opacity: 0;
  }
}
/* while a list reloads, its rows stay in place, dimmed, until the new ones arrive: no jump in size */
.is-loading {
  opacity: .5;
  pointer-events: none;
  transition: opacity .15s ease;
}
dialog.modal>.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
  margin: 0;
  padding: var(--dialog-head-pad);
  background: var(--brand);
  border-bottom: 1px solid var(--brand-hover);
}
dialog.modal>.modal-header>div {
  min-width: 0;
}
dialog.modal>.modal-header h2 {
  margin: 0;
  color: var(--on-brand);
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
dialog.modal>.modal-header p {
  margin: 3px 0 0;
  color: var(--on-brand-soft);
  font-size: var(--fs-sm);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
dialog.modal>.modal-header>.modal-close {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--on-brand-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--on-brand);
}
dialog.modal>.modal-header>.modal-close:hover {
  background: var(--on-brand-hover);
}
.modal-close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.modal-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: var(--dialog-pad);
  background: var(--surface);
  font-size: var(--fs);
}
/* buttons are .btn (the account dialog's are styled in its own block and inherit this font size) */
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
  padding: var(--dialog-actions-pad);
  background: var(--bg);
  border-top: 1px solid var(--line);
  font-size: var(--fs);
}
/* each dialog's size and body */
#projectionDialog {
  width: min(960px, calc(100vw - 28px));
}


/* ==== export dialog ==== */
/* The same Export dialog in every app. Paste this block unchanged into css/<app>.css (after the app's dialog section).
   Markup: <dialog id="exportDialog" class="modal export-dialog"> > .modal-header (title "Export <things>", subtitle "CSV · one row per <thing>", ×)
   > .modal-body.export-body: [the app's own fields, each a .field] > label.export-scope (input#exportUseFilters, span > strong "Use the filters applied on the main page", small hint, ul.export-filter-list > li per picked filter)
   The header subtitle ends with the maximum: "CSV · one row per <thing> · up to 1,000,000 rows" (/info export_limit).
   > div.export-options: .field Rows (label, div.export-rows > input#exportRows type=number min 1 max = export_limit, 5,000 by default and editable, button.export-rows-toggle (chevron) opening ul#exportRowsMenu.export-rows-menu > li > button[data-rows]: 500 / 1,000 / 2,500 / 5,000 / 10,000 / 25,000 / 50,000 / 100,000 / 250,000 / 500,000 (each only when below the maximum) / "Max (1,000,000)") and .field Order (label, select)
   > p.export-note (empty; only a failed download's message)
   > .modal-actions: Cancel, then the primary "Download CSV". A number above the maximum becomes the maximum when the box is left; while typed out of range the box is red and Download is off; no message. No count before the download. */
/* short enough never to scroll, so nothing clips the Rows menu; the header and the action row round their own corners */
dialog.export-dialog {
  width: min(520px, calc(100vw - 32px));
  overflow: visible;
}
dialog.export-dialog .modal-body.export-body {
  display: grid;
  gap: 14px;
  overflow: visible;
}
dialog.export-dialog .modal-header {
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
dialog.export-dialog .modal-actions {
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.export-body .field {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
}
.export-scope {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.export-scope.disabled {
  opacity: .6;
  cursor: default;
}
.export-scope input {
  flex: none;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--brand);
}
.export-scope span {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: var(--fs);
}
.export-scope small {
  color: var(--muted);
  font-size: var(--fs-sm);
}
.export-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}
.export-filter-list:empty,
.export-filter-list.hidden {
  display: none;
}
.export-filter-list li {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.export-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 12px;
}
.export-rows {
  position: relative;
}
.export-rows input {
  width: 100%;
  padding-right: 34px;
  appearance: textfield;
  -moz-appearance: textfield;
}
.export-rows input::-webkit-inner-spin-button,
.export-rows input::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}
.export-rows input:invalid {
  border-color: var(--danger);
}
.export-rows-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  display: grid;
  place-items: center;
  width: 32px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.export-rows-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.export-rows-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 5;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  list-style: none;
  max-height: 248px;
  overflow-y: auto;
}
.export-rows-menu.hidden {
  display: none;
}
.export-rows-menu button {
  display: block;
  width: 100%;
  height: 30px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}
.export-rows-menu button:hover,
.export-rows-menu button.active {
  background: var(--surface-2);
}
.export-note:empty {
  display: none;
}
.export-note {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}
@media (max-width: 520px) {
  .export-options {
    grid-template-columns: 1fr;
  }
}

/* ==== pager ==== */
/* every Previous / Next in the app, the same block in Finance, MDM and Pulse: <div class="pager ..." role="group" aria-label="Pages"> > button.btn.secondary.pager-btn (aria-label "Previous page", left chevron) + span.pager-label ("Page N", or "Page N of M" when the total is known) + button.btn.secondary.pager-btn (aria-label "Next page", right chevron); the app only places the group */
.pager .pager-btn {
  flex: 0 0 auto;
  width: var(--btn-h);
  padding: 0;
}
.pager .pager-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pager .pager-btn:disabled {
  background: var(--bg);
  color: var(--faint);
  border-color: var(--line);
  opacity: 1;
  cursor: not-allowed;
}
.pager .pager-label {
  min-width: 54px;
  text-align: center;
  white-space: nowrap;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
}

/* ==== account dialog ==== */
/* My profile, Login details, the password form and the row list Sync shares: the same #accountDialog and .kv-list in every app. Paste this block unchanged into css/<app>.css after the app's dialog section.
   Markup: <dialog id="accountDialog" class="modal account-dialog"> > .modal-header (#accountDialogTitle, #accountDialogSub, #closeAccountDialog) > #accountDialogBody.modal-body > #accountDialogActions.modal-actions (hidden when empty).
   Account menu: My profile, Login details, User management, Sync (opens js/sync.js's dialog), Settings, Logout (asks "Logout?" with the body <p class="confirm-text">Are you sure you want to logout?</p>, actions Cancel then the primary Logout).
   Row list (My profile, Login details, Sync): <div class="kv-list"> > <div class="kv-row"> > <span class="kv-label"><svg> icon + label</span> + <span class="kv-value">value, or "-", or the value and its button</span>; label left, value right, one line between rows.
   Menu: <div class="account-menu hidden" role="menu"> > button.account-menu-item (person icon "My profile"), button.account-menu-item (lock icon "Login details"), button#sync.account-menu-item (sync arrows "Sync"), button.account-menu-item (exit icon "Logout", class account-menu-logout: red text and icon); no divider.
   My profile: a row list: Created (how long ago), Name, Job title, Email, Mobile, City, Country, About; action Edit turns the rows into inputs in place (<form id="profileForm" class="profile-form"> around the same row list, each value an input.kv-input, About a textarea), Save sends only what changed. Each field is in one dialog only: what the login sends is in Login details.
   Login details (icons at, lock, shield, key): the Username value is <span>username</span> + button#copyUsernameBtn.profile-edit with a copy icon, aria-label "Copy username".
   Login details (subtitle "What you sign in with. Only the password can be changed."): a row list: Username, Password (lock icon; the value <span class="profile-secret">•••••••• (always 8)</span> + button#changePasswordBtn.profile-edit with a pencil, aria-label "Change password"), Role, Permissions (✓ when the user holds any, a click lists ID and Name; ✗ when none); only the password is editable.
   Password form (title "Update password", subtitle "Set a new password for your account."): <form id="passwordForm" class="account-form"> two .field (label + input), p.field-help, p.error#passwordError; actions: Cancel (back to Login details), then the primary "Update password" (form="passwordForm"); success closes it with the toast "Password updated." */
dialog.account-dialog {
  width: min(440px, calc(100vw - 32px));
}
dialog.account-dialog > .modal-body:empty {
  display: none;
}
.account-dialog .confirm-text {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs);
}
dialog.account-dialog > .modal-body {
  padding: var(--dialog-pad);
  background: var(--surface);
  font-size: var(--fs);
}
.kv-list {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: var(--fs);
}
/* a small caption over a group of rows (Login details: Sign in, Account) */
.kv-group {
  margin: 14px 2px 6px;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.kv-group:first-child {
  margin-top: 0;
}
.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
}
.kv-row:first-child {
  border-top: 0;
}
.kv-label {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.kv-label svg {
  flex: none;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.kv-value {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  text-align: right;
  overflow-wrap: anywhere;
}
/* My profile, editing in place: each row's value becomes an input, the label stays on the left */
.kv-value:has(.kv-input) {
  flex: 1 1 auto;
}
.kv-input {
  width: 100%;
  max-width: 260px;
  height: var(--control-h);
  margin: 0;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  text-align: left;
}
textarea.kv-input {
  height: auto;
  min-height: 64px;
  padding: 6px 10px;
  resize: vertical;
}
.kv-input:focus {
  border-color: var(--brand);
  outline: 0;
  box-shadow: var(--ring);
}
.account-dialog .profile-secret {
  letter-spacing: 2px;
}
.account-dialog .profile-edit {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--brand-ink);
  cursor: pointer;
}
.account-dialog .profile-edit:hover {
  background: var(--brand-soft);
}
.account-dialog .profile-edit svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.account-dialog .account-form {
  display: grid;
  gap: 14px;
}
.account-dialog .account-form .field {
  display: grid;
  gap: 6px;
  margin: 0;
}
.account-dialog .account-form label {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs);
  font-weight: 600;
}
.account-dialog .account-form textarea {
  width: 100%;
  min-height: 72px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  resize: vertical;
}
.account-dialog .account-form input {
  width: 100%;
  height: var(--control-h);
  margin: 0;
  padding: var(--control-pad);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  font-weight: 400;
}
.account-dialog .account-form input:focus,
.account-dialog .account-form textarea:focus {
  border-color: var(--brand);
  outline: 0;
  box-shadow: var(--ring);
}
.account-dialog .account-form select {
  width: 100%;
  max-width: none;
}
.account-dialog .account-form select:disabled {
  background-color: var(--surface-2);
  color: var(--muted);
  opacity: 1;
  cursor: not-allowed;
}
.account-dialog .password-field {
  position: relative;
  display: block;
}
.account-dialog .password-field input {
  padding-right: 40px;
}
.account-dialog .password-eye {
  position: absolute;
  top: 50%;
  right: 3px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  transform: translateY(-50%);
  cursor: pointer;
}
.account-dialog .password-eye:hover {
  background: none;
  color: var(--ink);
}
.account-dialog .password-eye svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.account-dialog .account-form .field-help {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}
.account-dialog .account-form .error,
.account-dialog .profile-form .error {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--fs-sm);
}
.account-dialog .account-form .error.hidden,
.account-dialog .profile-form .error.hidden {
  display: none;
}
.account-dialog .profile-form .error {
  margin-top: 10px;
}
dialog.account-dialog > .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: var(--dialog-actions-pad);
  border-top: 1px solid var(--line);
  background: var(--bg);
}
dialog.account-dialog > .modal-actions.hidden {
  display: none;
}
dialog.account-dialog > .modal-actions button {
  height: var(--btn-h);
  margin: 0;
  padding: var(--btn-pad);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  font-weight: 600;
  cursor: pointer;
}
dialog.account-dialog > .modal-actions button:hover {
  background: var(--surface-2);
}
dialog.account-dialog > .modal-actions button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}
dialog.account-dialog > .modal-actions button.primary:hover {
  background: var(--brand-hover);
}
dialog.account-dialog > .modal-actions button:disabled {
  opacity: .6;
  cursor: wait;
}
/* account menu (under the avatar): My profile, Login details, Sync, Logout (in red), no divider; the app positions it (its avatar wrapper is position: relative) */
.account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: max-content;
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.account-menu.hidden {
  display: none;
}
.account-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 36px;
  margin: 0;
  padding: 0 18px 0 11px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.account-menu-item:hover {
  background: var(--surface-2);
}
.account-menu-logout {
  color: var(--danger);
}
.account-menu-logout:hover {
  background: var(--danger-soft);
}
.account-menu-item svg {
  flex: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* dropdowns in this dialog (User management's status, My profile's Country): one arrow, clear of the right edge */
.account-dialog select.kv-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M3 5l4 4 4-4' fill='none' stroke='%235f6b7a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
  cursor: pointer;
}
/* User management (account menu, people icon "User management"): the users of the app's role, a page at a time; #accountDialogBody > .users-manage >
   form.users-tools (the shared .search-box: Username; select#usersStatus.kv-input All / Active / Inactive, button#usersClear.btn.users-clear "Clear filters") > .users-table-wrap > table.users-table (Created, ID, Username, Name, Role, Permissions (✓ or ✗), Last active, Status: span.users-status.is-active or .is-inactive) > div.pager.users-pager (the shared pager) */
dialog.account-dialog:has(.users-manage) {
  width: min(920px, calc(100vw - 32px)); /* every column fits: Permissions, Username and Name wrap instead of scrolling sideways */
}
.users-tools {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.users-tools .search-box {
  flex: 1;
}
.users-tools > select.kv-input {
  flex: 0 0 120px;
  max-width: none;
}
/* Clear filters at the right end, as on the app's own filter row: red tint while a filter is in use, grey and disabled otherwise */
.users-tools .users-clear,
.users-tools .users-clear:hover:not(:disabled) {
  flex: none;
  padding: 0 12px;
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}
.users-tools .users-clear:disabled {
  border-color: var(--line);
  background: var(--bg);
  color: var(--faint);
  opacity: 1;
  cursor: not-allowed;
}
/* the list's refresh (button.btn.secondary.users-refresh, icon only) and New user (users granted permission 61), after Clear filters */
.users-tools .users-refresh {
  flex: none;
  width: var(--btn-h);
  padding: 0;
}
.users-tools .users-refresh svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.users-tools .users-new {
  flex: none;
  padding: 0 12px;
  border-color: var(--brand);
  background: var(--brand);
  color: var(--on-brand);
}
.users-tools .users-new:hover {
  background: var(--brand-hover);
}
.users-table-wrap {
  height: min(440px, 55vh); /* a fixed height: the dialog keeps its size while users load, so it never jumps */
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.users-table {
  width: 100%;
  table-layout: fixed; /* the columns keep their widths below; Username takes the rest */
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.users-table th,
.users-table td {
  padding: var(--cell-pad);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
/* one line per user: a value longer than its column ends in "…" (the full text on hover); a click on it opens dialog#usersCellDialog with the value in full */
.users-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.users-table td.is-cut {
  cursor: pointer;
}
.users-table td.is-cut:hover {
  color: var(--brand);
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}
/* Permissions (Login details, User management): a ✓ (button.permissions-open, a click opens table.permissions-table in the small dialog: ID, Name from /info) or a ✗ (span.permissions-none) */
.permissions-open {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--success);
  font: inherit;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.permissions-open:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.permissions-open:focus-visible {
  outline: 0;
  box-shadow: var(--ring);
}
.permissions-none {
  display: inline-grid;
  place-items: center;
  width: 26px;
  color: var(--muted);
}
.permissions-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.permissions-table th,
.permissions-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.permissions-table th {
  color: var(--muted);
  font-weight: 600;
}
.permissions-table th:first-child,
.permissions-table td:first-child {
  width: 72px;
}
.permissions-table tr:last-child td {
  border-bottom: 0;
}
/* the cut cell's dialog (.modal.account-dialog.users-cell-dialog, over User management): the column as the title, the ID as the subtitle, p.users-cell-value the full value, wrapped; a user's permissions use it too */
dialog.users-cell-dialog {
  width: min(480px, calc(100vw - 32px));
}
.users-cell-value {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
}
.users-table th:nth-child(1) { width: 6%; } /* ID */
.users-table th:nth-child(2) { width: 10%; } /* Created */
.users-table th:nth-child(3) { width: 23%; } /* Username */
.users-table th:nth-child(4) { width: 16%; } /* Manager (Nexus) */
.users-table th:nth-child(5) { width: 5%; } /* Role */
.users-table th:nth-child(6) { width: 10%; } /* Permissions */
.users-table th:nth-child(7) { width: 13%; } /* Last active */
.users-table th:nth-child(8) { width: 9%; } /* Status */
.users-table th:nth-child(9) { width: 8%; } /* Action */
.users-table .users-muted { color: var(--muted); }
.users-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  font-size: var(--fs-sm);
  font-weight: 600;
  background: var(--brand-tint);
  color: var(--ink);
}
.users-table tbody tr:last-child td {
  border-bottom: 0;
}
.users-table-wrap[aria-busy="true"] tbody {
  opacity: 0.55; /* the next page or a new search: the rows on screen stay, dimmed, until the new ones arrive */
}
.users-table .users-note {
  text-align: center;
  color: var(--muted);
}
.users-table .users-note.error {
  color: var(--danger);
}
.users-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  font-weight: 600;
}
.users-status.is-active {
  background: var(--success-soft);
  color: var(--success);
}
.users-status.is-inactive {
  background: var(--surface-2);
  color: var(--muted);
}
/* Update user (permission 62): the Action column (th/td.users-row-action), whose ⋯ (button.users-action) opens #usersMenu, the account menu's look (.account-menu, .account-menu-item;
   Deactivate in red as .account-menu-logout) placed by the app under the ⋯ inside .users-manage, so the table's scroll never clips it; each item opens its form, whose Deactivate is .modal-actions button.danger */
.users-manage {
  position: relative;
}
.users-menu {
  position: absolute;
  z-index: 5;
}
.users-table th.users-row-action,
.users-table td.users-row-action {
  text-align: center;
}
.users-table td.users-row-action {
  padding-top: 0;
  padding-bottom: 0;
}
.users-table .users-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.users-table .users-action:hover,
.users-table .users-action[aria-expanded="true"] {
  background: var(--surface-2);
  color: var(--ink);
}
.users-table .users-action svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}
dialog.account-dialog > .modal-actions button.danger,
dialog.account-dialog > .modal-actions button.danger:hover {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}
.users-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

/* ==== login head ==== */
/* the login card opens with a header like a dialog's: --brand fill, "Login" in white, then which accounts the page is for (from the hidden #role field) */
.login .card .login-head {
  display: grid;
  gap: 2px;
  margin: -26px -26px 8px;
  padding: var(--dialog-head-pad);
  border-bottom: 1px solid var(--brand-hover);
  border-radius: inherit;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  background: var(--brand);
}
.login .card .login-head h2 {
  margin: 0;
  color: var(--on-brand);
  font-size: var(--fs-lg);
  font-weight: 600;
}
.login .card .login-head p {
  margin: 0;
  color: var(--on-brand-soft);
  font-size: 12px;
}

/* ==== search ==== */
/* every search box, the same in every app: one box that looks like an input. Markup: <div class="search-box"> > select.search-field (the one column searched, at the left) + input.search-input (with a placeholder)
   + button.search-clear (×) + button.search-submit (→, brand colour, so it reads as submit). It runs on Enter or →, never while typing; × empties the box and searches again (the shared click handler in js/app.js);
   × and → show only while the box has text (every search input has a placeholder, so :placeholder-shown means empty). The app only sets the box's width. */
.search-box {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  height: var(--control-h);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.search-box:focus-within {
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.search-box select.search-field {
  flex: none;
  width: auto;
  max-width: 45%;
  height: 100%;
  margin: 0;
  padding: 0 22px 0 10px !important;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: var(--radius) 0 0 var(--radius);
  appearance: none;
  -webkit-appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 14 14'%3E%3Cpath d='M3 5l4 4 4-4' fill='none' stroke='%235f6b7a' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 7px center;
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: none;
  outline: none;
  cursor: pointer;
}
.search-box input.search-input {
  flex: 1;
  width: 0;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font: inherit;
  font-size: var(--fs);
  outline: none;
}
.search-box .search-submit {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 28px;
  margin: 0 3px 0 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--brand-ink);
  cursor: pointer;
}
.search-box .search-submit:hover {
  background: var(--brand-soft);
  color: var(--brand-ink);
}
.search-box .search-submit svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
/* the × and → in every search box (the same in every app): × between the text and the → search button, both shown only while the box has text
   (every search input has a placeholder, so :placeholder-shown means empty); it empties the box and searches again, like the search button */
.search-clear {
  display: grid;
  flex: none;
  place-items: center;
  align-self: center;
  width: 26px;
  height: 26px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.search-clear:hover {
  background: var(--surface-2);
  color: var(--ink);
}
input:placeholder-shown + .search-clear,
input:placeholder-shown ~ .search-submit {
  display: none !important; /* × and → show only while the box has text (Enter still searches an empty box) */
}
.search-clear svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
/* Clear filters: red while a filter is set, grey and disabled otherwise (as in Pulse) */
.clear-filters-text,
.clear-filters-text:hover:not(:disabled) {
  flex: none;
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
  padding: 0 12px;
}
.clear-filters-text:disabled {
  border-color: var(--line);
  background: var(--bg);
  color: var(--faint);
  opacity: 1;
  cursor: not-allowed;
}
.clear-label-short {
  display: none;
}
@media (max-width: 380px) {
  .clear-label-full {
    display: none;
  }
  .clear-label-short {
    display: inline;
  }
}

/* ==== projection ==== */
/* the list: a tick box for pending rows the user may approve, then one line per projection; a row opens it */
.check-cell {
  width: 34px;
  text-align: center !important;
}
.main-report tbody tr.list-row {
  cursor: pointer;
}
.main-report tbody tr.list-row:focus {
  outline: 0;
}
.main-report tbody tr.list-row:focus td {
  background: var(--brand-soft);
}
#listPanel.loading tbody {
  opacity: .5;
}
#listPanel .panel-head .refresh-button,
#listPanel .panel-head #approveSelectedBtn:not(.hidden) {
  margin-left: auto;
}
#listPanel .panel-head #approveSelectedBtn:not(.hidden) + .refresh-button {
  margin-left: 0;
}
#approveSelectedBtn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* the projection dialog: wide, its sections one under the other, the fields in a grid */
#projectionDialog .modal-body {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}
.form-section + .form-section {
  margin-top: 18px;
}
.form-section h3 {
  margin: 0 0 10px;
  font-size: var(--fs);
  font-weight: 700;
  color: var(--brand-ink);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
}
.form-grid .field {
  margin: 0;
  min-width: 0;
}
.form-grid .field.wide {
  grid-column: 1 / -1;
}
.form-grid .field > .input,
.form-grid .field > textarea.input {
  width: 100%;
}
.form-grid textarea.input {
  height: auto;
  padding-top: 8px;
}
.codes-box {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 8px;
}
.codes-box .codes-search {
  width: 100%;
  margin-bottom: 8px;
}
.codes-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px 12px;
  max-height: 180px;
  overflow-y: auto;
}
.codes-list label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  color: var(--ink);
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 0;
}
.detail-grid dt {
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.detail-grid dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}
.detail-totals {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 16px;
}
.projection-form .detail-totals {
  margin: 18px 0 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.detail-totals > div {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.detail-totals small {
  display: block;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
}
.detail-totals strong {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}
.detail-note {
  margin: -6px 0 16px;
  font-size: var(--fs-sm);
}
@media(max-width:700px) {
  .form-grid,
  .detail-grid,
  .codes-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* All / Pending / Approved above the list (the Status filter): a segmented group like the view tabs */
.status-switch {
  display: inline-flex;
  padding: 3px;
  margin-left: 6px;
  background: var(--surface-2);
  border-radius: 10px;
}
.status-switch button {
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.status-switch button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgb(0 0 0 / .12);
}
.status-switch button[data-status="1"].active {
  background: var(--warning-soft);
  color: var(--warning);
}
.status-switch button[data-status="2"].active {
  background: var(--success-soft);
  color: var(--success);
}
.main-report .check-cell {
  cursor: default;
}
.main-report .check-cell input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
@media(max-width:700px) {
  .main-report {
    table-layout: auto;
    min-width: 760px;
  }
  .status-switch {
    order: 5;
    margin-left: 0;
  }
}
/* status badges carry a dot in their colour, so Pending and Approved read at a glance */
.badge.pending::before,
.badge.approved::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* compact filters: every filter in view, small labels and fields, as many a row as fit */
#filterForm {
  padding: 10px 14px 12px;
}
#filterForm .list-filter-head {
  margin-bottom: 8px;
}
#filterForm .list-filter-head h2 {
  font-size: var(--fs);
}
#filterForm .list-filters {
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 6px 10px;
}
#filterForm .list-filters .list-search {
  grid-column: span 2;
}
#filterForm .field > label {
  font-size: var(--fs-xs);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#filterForm .input,
#filterForm .search-box {
  height: 32px;
  min-height: 32px;
  font-size: var(--fs-sm);
}
#filterForm .filter-actions .btn {
  height: 30px;
}

/* ==== projection window (like Pulse's task window) ==== */
/* header: Approve, Edit, Delete as white-outlined icon buttons on the blue, then × */
.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
/* the × beside the header buttons: the same white-outlined square as everywhere (as in Pulse) */
.modal-header-actions .modal-close {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--on-brand-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--on-brand);
  cursor: pointer;
}
.modal-header-actions .modal-close:hover {
  background: var(--on-brand-hover);
}
.head-actions {
  display: inline-flex;
  gap: 6px;
}
dialog.modal .modal-header .icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--on-brand-line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--on-brand);
  cursor: pointer;
}
dialog.modal .modal-header .icon-btn:hover:not(:disabled) {
  background: var(--on-brand-hover);
}
dialog.modal .modal-header .icon-btn:disabled {
  opacity: .5;
  cursor: default;
}
dialog.modal .modal-header .icon-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* the view: a grey body with white cards, two a row, each a title and its fields as label and value */
#projectionDialog.is-view .modal-body {
  background: var(--bg);
}
/* two columns that fill top to bottom, so a short card leaves no gap under it */
.detail-cards {
  columns: 2;
  column-gap: 10px;
}
.detail-card {
  min-width: 0;
  break-inside: avoid;
  margin: 0 0 10px;
  padding: 8px 12px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.detail-card.wide {
  column-span: all;
}
.detail-card h3 {
  margin: 0 0 4px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--brand-ink);
}
.kv-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: var(--fs-sm);
}
.kv-table th,
.kv-table td {
  padding: 5px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.kv-table tr:last-child th,
.kv-table tr:last-child td {
  border-bottom: 0;
}
.kv-table th {
  width: 44%;
  padding-right: 10px;
  color: var(--muted);
  font-weight: 600;
}
.kv-table td {
  overflow-wrap: anywhere;
}
.detail-card .market-table {
  font-size: var(--fs-sm);
}
#projectionDialog .detail-totals {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 8px;
}
#projectionDialog .detail-totals > div {
  background: var(--surface);
  padding: 8px 12px;
}
#projectionDialog .detail-totals strong {
  font-size: 15px;
}
#projectionDialog .detail-note {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: var(--fs-xs);
}
/* compact text: the list, the form and the window in the small font */
.main-report tbody,
.projection-form,
.dash-table {
  font-size: var(--fs-sm);
}
.projection-form .input,
.projection-form textarea.input {
  height: 32px;
  font-size: var(--fs-sm);
}
.projection-form textarea.input {
  height: auto;
}
.projection-form .field > label {
  font-size: var(--fs-xs);
}
.form-section h3 {
  font-size: var(--fs-sm);
}
@media(max-width:700px) {
  .detail-cards {
    columns: 1;
  }
  #projectionDialog .detail-totals {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* the dashboard's top row: what the numbers cover on the left; freshness and Refresh (for both cards and the totals) on the right */
.dash-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
}
.dash-scope {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 600;
}
.dash-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.dash-updated {
  color: var(--muted);
  font-size: var(--fs-xs);
}

/* each dashboard table ends with its bar column */
/* the bar: its length is the row's revenue on one $ scale for the table, the dark part inside it the GP share (GP %) */
.dash-table th.bar-cell,
.dash-table td.bar-cell {
  width: 32%;
  padding-left: 18px;
}
.dash-table th.bar-cell {
  font-weight: 600;
  white-space: nowrap;
}
.dash-table .bar {
  display: block;
  height: 10px;
  min-width: 2px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--brand-ink) 32%, transparent);
  overflow: hidden;
}
.dash-table .bar-gp {
  display: block;
  height: 100%;
  background: var(--success);
}
.dash-table .bar-key {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin: 0 4px 0 0;
  border-radius: 2px;
  vertical-align: -1px;
}
.dash-table .bar-key.revenue {
  background: color-mix(in srgb, var(--brand-ink) 32%, transparent);
}
.dash-table .bar-key.gp {
  margin-left: 10px;
  background: var(--success);
}

/* the four statuses: Pending amber, Approved green, Rejected red, Cancelled grey; the same colours in the status switch and the window's status line */
.badge.rejected {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge.cancelled {
  background: var(--surface-2);
  color: var(--muted);
  text-decoration: line-through;
}
.badge.rejected::before,
.badge.cancelled::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-switch button[data-status="3"].active {
  background: var(--danger-soft);
  color: var(--danger);
}
.detail-note.status-note.rejected {
  color: var(--danger);
}
/* the window's history: one line per change, newest first */
.history-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
}
.history-list > li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.history-list > li:last-child {
  border-bottom: 0;
}
.history-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.history-reason {
  margin-top: 2px;
  color: var(--muted);
}
.history-changes {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: var(--fs-xs);
}

/* the upload window: the steps, then the check's summary (a warning in amber) and each row's problem (in red) */
.upload-steps {
  margin: 0 0 12px;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  font-size: var(--fs-sm);
}
.upload-steps .btn {
  height: 28px;
  margin-right: 4px;
}
.upload-summary {
  margin: 10px 0 0;
  padding-left: 20px;
  font-size: var(--fs-sm);
}
.upload-summary .upload-warn {
  color: var(--warning);
}
.upload-errors {
  margin-top: 10px;
  padding: 8px 12px;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: var(--fs-sm);
}
.upload-errors ul {
  margin: 6px 0 0;
  padding-left: 18px;
  max-height: 220px;
  overflow: auto;
}
