/* Pico v2 (vendored locally) imported here so axiom.css is self-contained — any
   page that loads axiom.css gets Pico, even the long-tail pages that have their
   own <head> and don't use includes/page_head.php. Local file, so no CDN/online
   dependency. Must be the first statement in the file. */
@import url("pico.min.css");

:root {
  --axiom-surface: #ffffff;
  --axiom-surface-raised: #ffffff;
  --axiom-surface-sunken: #f8fafb;
  --axiom-border: #a4c3d7;
  --axiom-border-muted: #e1ebf2;
  --axiom-text: #001c2b;
  --axiom-text-muted: #355f79;
  --axiom-brand: #780000;
  --axiom-brand-hover: #620000;
  --axiom-brand-contrast: #ffffff;
  --axiom-accent: #355f79;
  --axiom-accent-muted: #e1ebf2;
  --axiom-success: #0f6b3a;
  --axiom-warning: #8a4b00;
  --axiom-danger: #9a0c16;
  --axiom-info: #005b8c;
  --axiom-radius-sm: 4px;
  --axiom-radius-md: 8px;
  --axiom-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --axiom-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --axiom-shadow-lg: 0 12px 28px -8px rgba(0, 0, 0, 0.28);

  /* Shell geometry (compact financial density). */
  --axiom-topbar-h: 52px;
  --axiom-sidebar-expanded: 260px;
  --axiom-sidebar-rail: 64px;

  /* Compact density via Pico's own knobs. */
  --pico-font-size: 95%;
  --pico-line-height: 1.4;
  --pico-spacing: 0.85rem;
  --pico-typography-spacing-vertical: 0.85rem;
  --pico-form-element-spacing-vertical: 0.5rem;
  --pico-form-element-spacing-horizontal: 0.75rem;

  --pico-font-family-sans-serif: "Segoe UI", Inter, Arial, ui-sans-serif, system-ui, sans-serif;
  --pico-primary: var(--axiom-brand);
  --pico-primary-hover: var(--axiom-brand-hover);
  --pico-primary-focus: color-mix(in srgb, var(--axiom-brand) 30%, transparent);
  --pico-primary-inverse: var(--axiom-brand-contrast);
  /* Pico v2 control-fill tokens — without these, native <button>/[type=submit]/
     checked checkboxes/switches fall back to Pico's default blue. Map to brand. */
  --pico-primary-background: var(--axiom-brand);
  --pico-primary-hover-background: var(--axiom-brand-hover);
  --pico-primary-border: var(--axiom-brand);
  --pico-primary-hover-border: var(--axiom-brand-hover);
  --pico-primary-underline: color-mix(in srgb, var(--axiom-brand) 50%, transparent);
  --pico-switch-color: var(--axiom-brand-contrast);
  --pico-switch-checked-background-color: var(--axiom-brand);
  --pico-color: var(--axiom-text);
  --pico-muted-color: var(--axiom-text-muted);
  --pico-card-background-color: var(--axiom-surface-raised);
  --pico-card-border-color: var(--axiom-border-muted);
  --pico-form-element-border-color: var(--axiom-border);
  --pico-border-radius: var(--axiom-radius-md);
}

:root[data-theme="dark"] {
  --axiom-surface: #07141a;
  --axiom-surface-raised: #0b1f2a;
  --axiom-surface-sunken: #041016;
  --axiom-border: #2f5264;
  --axiom-border-muted: #18313d;
  --axiom-text: #f7fbfd;
  --axiom-text-muted: #c7d7e2;
  --axiom-brand: #c1121f;
  --axiom-brand-hover: #eb2330;
  --axiom-accent: #8bb8d0;
  --axiom-accent-muted: #102b38;
  /* Re-point Pico v2 primary fills at the dark-theme brand. */
  --pico-primary: var(--axiom-brand);
  --pico-primary-hover: var(--axiom-brand-hover);
  --pico-primary-background: var(--axiom-brand);
  --pico-primary-hover-background: var(--axiom-brand-hover);
  --pico-primary-border: var(--axiom-brand);
  --pico-primary-hover-border: var(--axiom-brand-hover);
  --pico-switch-checked-background-color: var(--axiom-brand);
}

/* Pico v2 scopes its colour tokens under :root:not([data-theme=dark]) (specificity
   0,2,0), which outranks a plain :root — so the primary-* overrides above don't
   take on native controls. Re-assert at matching specificity with :root:root.
   --axiom-brand already flips per theme, so this one block covers light + dark. */
:root:root {
  --pico-primary: var(--axiom-brand);
  --pico-primary-hover: var(--axiom-brand-hover);
  --pico-primary-focus: color-mix(in srgb, var(--axiom-brand) 30%, transparent);
  --pico-primary-inverse: var(--axiom-brand-contrast);
  --pico-primary-background: var(--axiom-brand);
  --pico-primary-hover-background: var(--axiom-brand-hover);
  --pico-primary-border: var(--axiom-brand);
  --pico-primary-hover-border: var(--axiom-brand-hover);
  --pico-primary-underline: color-mix(in srgb, var(--axiom-brand) 50%, transparent);
  --pico-switch-checked-background-color: var(--axiom-brand);
}

html,
body {
  min-height: 100%;
}

body {
  background: var(--axiom-surface-sunken);
  /* Effective sidebar width — overridden per responsive tier + by JS state. */
  --axiom-sidebar-w: var(--axiom-sidebar-expanded);
}

.axiom-shell {
  display: contents;
}

.axiom-topbar {
  align-items: center;
  background: linear-gradient(135deg, var(--axiom-brand), #a30f18);
  box-shadow: var(--axiom-shadow-md);
  color: var(--axiom-brand-contrast);
  display: flex;
  gap: 1rem;
  height: var(--axiom-topbar-h);
  left: 0;
  padding: 0 1rem;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 40;
}

.axiom-menu-button,
.axiom-theme-toggle {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--axiom-radius-sm);
  color: #fff;
  display: inline-flex;
  height: 2.25rem;
  justify-content: center;
  margin: 0;
  padding: 0;
  width: 2.25rem;
}

.axiom-brand {
  align-items: center;
  color: #fff;
  display: flex;
  font-weight: 700;
  gap: .6rem;
  min-width: 0;
  text-decoration: none;
}

.axiom-brand img {
  background: #fff;
  border-radius: 999px;
  height: 38px;
  padding: 3px;
  width: 38px;
}

.axiom-brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.axiom-user-menu {
  align-items: center;
  display: flex;
  gap: .75rem;
  margin-left: auto;
}

.axiom-user-menu a {
  color: #fff;
  text-decoration: none;
}

.axiom-sidebar {
  background: var(--axiom-surface-raised);
  border-right: 1px solid var(--axiom-border-muted);
  bottom: 0;
  box-shadow: var(--axiom-shadow-sm);
  left: 0;
  overflow: hidden;
  position: fixed;
  top: var(--axiom-topbar-h);
  width: var(--axiom-sidebar-w);
  z-index: 30;
  transition: width .2s ease, transform .2s ease;
}

/* The nav region scrolls silently (no visible scrollbar) when it overflows. */
.axiom-nav {
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .85rem .6rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.axiom-nav::-webkit-scrollbar {
  display: none;
}

.axiom-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.axiom-sidebar a,
.axiom-sidebar summary {
  align-items: center;
  border-radius: var(--axiom-radius-sm);
  color: var(--axiom-text);
  cursor: pointer;
  display: flex;
  gap: .75rem;
  min-height: 38px;
  padding: .4rem .6rem;
  text-decoration: none;
  white-space: nowrap;
}

/* Phosphor icons inherit font-size; give them a sensible default for this UI. */
.ph {
  font-size: 1.25rem;
  line-height: 1;
  vertical-align: middle;
}

.axiom-sidebar .ph {
  flex: 0 0 auto;
}

.axiom-nav-label {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.axiom-sidebar a:hover,
.axiom-sidebar summary:hover {
  background: color-mix(in srgb, var(--axiom-brand) 8%, transparent);
  color: var(--axiom-brand);
}

/* Active item — brand-tinted pill with a brand indicator bar (keeps the rail
   on-brand maroon, not the accent teal). */
.axiom-sidebar .active > a {
  background: color-mix(in srgb, var(--axiom-brand) 12%, transparent);
  color: var(--axiom-brand);
  font-weight: 600;
  box-shadow: inset 3px 0 0 0 var(--axiom-brand);
}

.axiom-sidebar details {
  margin: .2rem 0;
}

.axiom-sidebar details ul {
  border-left: 1px solid var(--axiom-border-muted);
  margin: .15rem 0 .35rem 1.1rem;
  padding-left: .55rem;
}

main,
.mn-inner {
  margin-left: var(--axiom-sidebar-w);
  padding: calc(var(--axiom-topbar-h) + 16px) 16px 24px;
  transition: margin-left .2s ease;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-left: 0;
  margin-right: 0;
}

.col {
  flex: 1 1 0;
  min-width: 0;
}

.s12 { flex-basis: 100%; }
.s8 { flex-basis: calc(66.666% - 1rem); }
.s6 { flex-basis: calc(50% - 1rem); }
.s4 { flex-basis: calc(33.333% - 1rem); }
.right-align { text-align: right; }
.center-align { text-align: center; }
.hide-on-med-and-up { display: none; }

.card {
  background: var(--axiom-surface-raised);
  border: 1px solid var(--axiom-border-muted);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 18px -10px rgba(16, 24, 40, 0.18);
  margin: 0 0 1.25rem;
}

.card-content {
  padding: 1.25rem 1.4rem;
}

.card-title {
  color: var(--axiom-text);
  display: inline-block;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: .35rem;
}

.btn,
button.btn,
a.btn {
  align-items: center;
  background: var(--axiom-brand);
  border: 1px solid var(--axiom-brand);
  border-radius: var(--axiom-radius-sm);
  color: #fff;
  display: inline-flex;
  font-weight: 600;
  gap: .4rem;
  min-height: 2.35rem;
  padding: .45rem .8rem;
  text-decoration: none;
}

.btn:hover,
button.btn:hover,
a.btn:hover {
  background: var(--axiom-brand-hover);
  border-color: var(--axiom-brand-hover);
  color: #fff;
}

/* Secondary = quiet neutral (outline), so the brand maroon stays the only
   filled/primary action. Avoids the accent-teal reading as a stray "blue". */
.btn.secondary,
button.btn.secondary,
a.btn.secondary {
  background: var(--axiom-surface-raised);
  border-color: var(--axiom-border);
  color: var(--axiom-text);
}

.btn.secondary:hover,
button.btn.secondary:hover,
a.btn.secondary:hover {
  background: var(--axiom-surface-sunken);
  border-color: var(--axiom-text-muted);
  color: var(--axiom-text);
}

.btn-floating,
.btn-small {
  min-height: 2rem;
  padding: .25rem .5rem;
}

.input-field {
  margin-bottom: .75rem;
}

.responsive-table,
.axiom-table {
  /* display:table so the cells distribute across the full card width (a
     display:block table shrinks to content and leaves dead space on the
     right). On narrow screens fall back to a block scroll container so
     many-column tables can scroll horizontally instead of squeezing. */
  display: table;
  width: 100%;
  min-width: 100%;
}

@media (max-width: 767.98px) {
  .axiom-table {
    display: block;
    overflow-x: auto;
  }
}

.dataTables_wrapper {
  max-width: 100%;
  overflow-x: auto;
}

.dataTables_wrapper table.dataTable {
  max-width: none;
}

table {
  background: var(--axiom-surface-raised);
}

thead th {
  background: var(--axiom-surface-sunken);
  border-bottom: 1px solid var(--axiom-border-muted);
  position: sticky;
  /* .axiom-table/.responsive-table set overflow:auto, so the TABLE is the sticky
     scroll container — pin the header at the table's top edge (0), not the
     viewport topbar offset, otherwise it renders pushed down over the first row. */
  top: 0;
  z-index: 1;
}

/* Denser financial tables. */
table {
  font-size: .875rem;
}

th, td {
  padding-top: .5rem;
  padding-bottom: .5rem;
}

tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--axiom-border-muted) 35%, transparent);
}

.axiom-click-row,
.audit-log-row {
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}

.axiom-click-row > td,
.audit-log-row > td {
  transition: background .15s ease, color .15s ease;
}

.axiom-click-row:hover > td,
.axiom-click-row:focus-visible > td,
.axiom-click-row.is-selected > td,
.audit-log-row:hover > td,
.audit-log-row:focus-visible > td,
.audit-log-row.is-selected > td {
  background: color-mix(in srgb, var(--axiom-brand) 12%, var(--axiom-surface-raised));
  color: var(--axiom-brand);
}

.axiom-click-row:hover .axiom-badge,
.axiom-click-row:focus-visible .axiom-badge,
.axiom-click-row.is-selected .axiom-badge,
.audit-log-row:hover .axiom-badge,
.audit-log-row:focus-visible .axiom-badge,
.audit-log-row.is-selected .axiom-badge {
  border-color: color-mix(in srgb, var(--axiom-brand) 35%, var(--axiom-border-muted));
  color: var(--axiom-brand);
}

.axiom-click-row:focus-visible,
.audit-log-row:focus-visible {
  outline: 2px solid var(--axiom-brand);
  outline-offset: -2px;
}

.axiom-detail-backdrop,
.audit-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(10, 15, 22, .38);
}

.axiom-detail-backdrop[hidden],
.audit-detail-backdrop[hidden] {
  display: none;
}

.axiom-detail-drawer,
.audit-detail-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 56;
  display: flex;
  flex-direction: column;
  width: min(460px, 100vw);
  height: 100vh;
  background: var(--axiom-surface-raised);
  border-left: 1px solid var(--axiom-border-muted);
  box-shadow: -24px 0 48px -28px rgba(16, 24, 40, .65);
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.16, 1, .3, 1);
  visibility: hidden;
}

.axiom-detail-drawer.is-open,
.audit-detail-drawer.is-open {
  transform: translateX(0);
  visibility: visible;
}

.axiom-detail-head,
.audit-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--axiom-border-muted);
  background: var(--axiom-surface-sunken);
}

.axiom-detail-kicker,
.audit-detail-kicker {
  display: block;
  color: var(--axiom-text-muted);
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
}

.axiom-detail-head h2,
.audit-detail-head h2 {
  margin: .15rem 0 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.axiom-detail-close,
.audit-detail-close {
  width: 2rem;
  min-width: 2rem;
  height: 2rem;
  min-height: 2rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--axiom-text-muted);
  font-size: 1.5rem;
  line-height: 1;
}

.axiom-detail-close:hover,
.axiom-detail-close:focus-visible,
.audit-detail-close:hover,
.audit-detail-close:focus-visible {
  background: var(--axiom-border-muted);
  color: var(--axiom-text);
}

.axiom-detail-body,
.audit-detail-body {
  overflow-y: auto;
  padding: 1rem 1.25rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.axiom-detail-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 100%;
}

.axiom-detail-meta,
.audit-detail-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin: 0;
}

.axiom-detail-meta div,
.audit-detail-meta div {
  min-width: 0;
}

.axiom-detail-meta dt,
.audit-detail-meta dt {
  color: var(--axiom-text-muted);
  font-size: .76rem;
  font-weight: 700;
}

.axiom-detail-meta dd,
.audit-detail-meta dd {
  margin: .15rem 0 0;
  overflow-wrap: anywhere;
}

.axiom-detail-values,
.audit-detail-values {
  display: grid;
  gap: .8rem;
}

.axiom-detail-actions {
  order: 30;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
  margin: .25rem 0 0;
  padding: .75rem 0 0;
  border-top: 1px solid var(--axiom-border-muted);
}

.axiom-detail-actions .btn,
.axiom-detail-actions button,
.axiom-detail-actions a {
  width: 100%;
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: .38rem .65rem;
  text-align: center;
  white-space: normal;
  line-height: 1.2;
  font-size: .9rem;
}

.axiom-detail-actions .btn:not(.secondary),
.axiom-detail-actions button.btn:not(.secondary),
.axiom-detail-actions a.btn:not(.secondary) {
  background: color-mix(in srgb, var(--axiom-brand) 5%, var(--axiom-surface-raised));
  border-color: color-mix(in srgb, var(--axiom-brand) 38%, var(--axiom-border));
  color: var(--axiom-brand);
}

.axiom-detail-actions .btn:not(.secondary):hover,
.axiom-detail-actions button.btn:not(.secondary):hover,
.axiom-detail-actions a.btn:not(.secondary):hover {
  background: color-mix(in srgb, var(--axiom-brand) 10%, var(--axiom-surface-raised));
  border-color: color-mix(in srgb, var(--axiom-brand) 48%, var(--axiom-border));
  color: var(--axiom-brand);
}

.axiom-detail-actions .danger {
  border-color: color-mix(in srgb, var(--axiom-danger) 32%, var(--axiom-border-muted));
  color: var(--axiom-danger);
}

.axiom-detail-actions .danger:hover,
.axiom-detail-actions .danger:focus-visible {
  background: color-mix(in srgb, var(--axiom-danger) 10%, var(--axiom-surface-raised));
  border-color: color-mix(in srgb, var(--axiom-danger) 45%, var(--axiom-border-muted));
  color: var(--axiom-danger);
}

.axiom-detail-actions[hidden],
.axiom-detail-action[hidden] {
  display: none;
}

.axiom-detail-section {
  order: 20;
  border-top: 1px solid var(--axiom-border-muted);
  padding-top: 1rem;
}

.axiom-detail-section h3,
.audit-detail-values h3 {
  margin: 0 0 .35rem;
  font-size: .86rem;
}

.axiom-detail-history-list {
  display: grid;
  gap: .45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.axiom-detail-history-list li {
  border: 1px solid var(--axiom-border-muted);
  border-radius: 8px;
  background: var(--axiom-surface-sunken);
  padding: .6rem .7rem;
}

.axiom-detail-history-empty {
  margin: 0;
  color: var(--axiom-text-muted);
  font-size: .88rem;
}

.axiom-detail-values pre,
.audit-detail-values pre {
  min-height: 7rem;
  max-height: 16rem;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--axiom-border-muted);
  border-radius: 8px;
  background: var(--axiom-surface-sunken);
  color: var(--axiom-text);
  font: .82rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  padding: .75rem;
}

body.axiom-detail-open,
body.audit-detail-open {
  overflow: hidden;
}

@media (max-width: 767.98px) {
  .axiom-detail-drawer,
  .audit-detail-drawer {
    width: 100vw;
  }

  .axiom-detail-meta,
  .audit-detail-meta {
    grid-template-columns: 1fr;
  }

  .axiom-detail-actions {
    grid-template-columns: 1fr;
  }
}

.axiom-toolbar {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.axiom-toolbar form {
  align-items: end;
  display: flex;
  flex: 1 1 280px;
  gap: .75rem;
  margin: 0;
}

.axiom-alert {
  border-radius: var(--axiom-radius-sm);
  margin: .75rem 0;
  padding: .75rem;
}

.axiom-alert.success {
  background: color-mix(in srgb, var(--axiom-success) 12%, transparent);
  color: var(--axiom-success);
}

.axiom-alert.error {
  background: color-mix(in srgb, var(--axiom-danger) 12%, transparent);
  color: var(--axiom-danger);
}

.axiom-alert.info {
  background: color-mix(in srgb, var(--axiom-warning, #d98e00) 14%, transparent);
  color: var(--axiom-warning, #8a6d00);
}

.axiom-badge {
  background: var(--axiom-surface-sunken);
  border: 1px solid var(--axiom-border-muted);
  border-radius: 999px;
  color: var(--axiom-text-muted);
  display: inline-block;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1;
  padding: .3rem .6rem;
  white-space: nowrap;
}

.axiom-badge.success {
  background: color-mix(in srgb, var(--axiom-success) 14%, transparent);
  border-color: transparent;
  color: var(--axiom-success);
}

.axiom-badge.warning {
  background: color-mix(in srgb, var(--axiom-warning) 16%, transparent);
  border-color: transparent;
  color: var(--axiom-warning);
}

.axiom-badge.error,
.axiom-badge.danger {
  background: color-mix(in srgb, var(--axiom-danger) 14%, transparent);
  border-color: transparent;
  color: var(--axiom-danger);
}

.axiom-muted {
  color: var(--axiom-text-muted);
}

.axiom-filter-grid {
  display: grid;
  gap: .75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 1rem;
}

/* Shared list-table filter bar (house standard). */
.axiom-filter-inline,
.axiom-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .75rem;
  margin-bottom: 1rem;
}
.axiom-filter-field { display: flex; flex-direction: column; gap: .25rem; font-size: .8rem; color: var(--axiom-text-muted); margin: 0; }
.axiom-filter-field select { width: auto; min-width: 160px; margin: 0; }
.axiom-filter-popover .axiom-filter-field { padding: .4rem .5rem; }
.axiom-filter-popover .axiom-filter-field select { min-width: 200px; }

.axiom-filter-trigger { display: inline-flex; align-items: center; gap: .4rem; }
.axiom-filter-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem;
  background: var(--axiom-brand); color: #fff; border-radius: 999px;
  font-size: .72rem; font-weight: 700;
}

/* Quick-filter tabs (e.g. Manage Shifts scope). */
.axiom-tabs {
  display: inline-flex; flex-wrap: wrap; gap: 2px;
  background: var(--axiom-surface-sunken);
  border: 1px solid var(--axiom-border-muted);
  border-radius: var(--axiom-radius-md);
  padding: 3px; margin-bottom: 1rem;
}
.axiom-tab {
  border: 0; background: none; cursor: pointer;
  padding: .4rem .85rem; border-radius: calc(var(--axiom-radius-md) - 3px);
  font-size: .85rem; font-weight: 600; color: var(--axiom-text-muted);
  display: inline-flex; align-items: center; gap: .4rem;
}
.axiom-tab[aria-selected="true"] {
  background: var(--axiom-surface-raised); color: var(--axiom-brand);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.axiom-tab-count {
  background: color-mix(in srgb, var(--axiom-text-muted) 25%, transparent);
  color: var(--axiom-text); border-radius: 999px;
  padding: 0 .4rem; font-size: .72rem; min-width: 1.3rem; text-align: center;
}
.axiom-tab[aria-selected="true"] .axiom-tab-count { background: var(--axiom-brand); color: #fff; }
.axiom-tab-attention .axiom-tab-count {
  background: color-mix(in srgb, var(--axiom-warning) 22%, transparent);
  color: var(--axiom-warning);
}
/* Subtle tint for rows that need attention (stale/long-running shifts). */
.axiom-row-attention > td { background: color-mix(in srgb, var(--axiom-warning) 8%, transparent); }

/* Locked-scope context banner (e.g. "Receipts for shift 000002 · View all"). */
.axiom-scope-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem; margin-bottom: 1rem; padding: .6rem .9rem;
  border-radius: var(--axiom-radius-md);
  background: color-mix(in srgb, var(--axiom-brand) 10%, transparent);
  color: var(--axiom-brand); font-weight: 600;
}
.axiom-scope-bar > span { display: inline-flex; align-items: center; gap: .5rem; }
.axiom-scope-bar strong { color: var(--axiom-text); }

.axiom-chips { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: -.25rem 0 1rem; }
.axiom-chip {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-weight: 600;
  background: color-mix(in srgb, var(--axiom-brand) 12%, transparent);
  color: var(--axiom-brand);
  border-radius: 999px; padding: .3rem .3rem .3rem .7rem;
}
.axiom-chip button {
  border: 0; background: none; color: inherit; cursor: pointer;
  display: inline-flex; padding: 2px; border-radius: 999px;
}
.axiom-chip button:hover { background: color-mix(in srgb, var(--axiom-brand) 22%, transparent); }

.axiom-filter-grid label {
  display: block;
  font-size: .85rem;
  margin-bottom: .25rem;
}

.axiom-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

.axiom-actions .btn {
  width: auto;
}

.axiom-field-error {
  color: var(--axiom-danger);
  display: block;
  margin-top: .25rem;
}

.axiom-sort {
  color: inherit;
  display: inline-block;
  text-decoration: none;
  white-space: nowrap;
}

.axiom-sort:hover {
  text-decoration: underline;
}

.axiom-sort.active {
  font-weight: 600;
}

/* Table footer: page-size selector (left) + count & numbered pager (right). */
.axiom-table-foot {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  justify-content: space-between;
  margin-top: 1rem;
}

.axiom-pagesize { color: var(--axiom-text-muted); font-size: .85rem; }
.axiom-pagesize label { display: inline-flex; align-items: center; gap: .5rem; margin: 0; }
.axiom-pagesize select {
  width: auto;
  margin: 0;
  padding: .25rem 1.8rem .25rem .6rem;
}

.axiom-pager {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: flex-end;
  margin-top: 0;
}

.axiom-pager-info {
  color: var(--axiom-text-muted, inherit);
  font-size: .85rem;
}

.axiom-pager .btn[disabled] {
  cursor: not-allowed;
  opacity: .5;
}

/* Numbered pager buttons. */
.axiom-pages { display: inline-flex; gap: .25rem; align-items: center; }
.axiom-page {
  min-width: 34px;
  height: 34px;
  padding: 0 .5rem;
  border-radius: var(--axiom-radius-sm);
  border: 1px solid var(--axiom-border-muted);
  background: var(--axiom-surface-raised);
  color: var(--axiom-text);
  cursor: pointer;
  font-size: .85rem;
  line-height: 1;
}
.axiom-page:hover:not([disabled]):not([aria-current="true"]) { border-color: var(--axiom-text-muted); }
.axiom-page[aria-current="true"] {
  background: var(--axiom-brand);
  border-color: var(--axiom-brand);
  color: #fff;
  font-weight: 700;
}
.axiom-page[disabled] { opacity: .45; cursor: not-allowed; }
.axiom-page-gap { min-width: 18px; text-align: center; color: var(--axiom-text-muted); }

.day-header {
  color: var(--axiom-text-muted, inherit);
  margin-bottom: 1rem;
}

.text-danger {
  color: var(--axiom-danger);
}

.bucket-row {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1rem;
}

.bucket-row .chip {
  align-items: center;
  background: var(--axiom-surface-sunken);
  border-radius: 999px;
  color: var(--axiom-text);
  cursor: pointer;
  display: inline-flex;
  font-size: .85rem;
  padding: .3rem .75rem;
  text-decoration: none;
}

.bucket-row .chip.active {
  font-weight: 600;
  outline: 2px solid var(--axiom-brand);
}

.invoice-list td.money {
  text-align: right;
}

.invoice-list td.err {
  color: var(--axiom-danger);
}

/* Fiscalisation display pages (DevicesFiscalStatus / InvoiceFiscalDetail / DeviceFiscalDayLog) */
.stale {
  color: var(--axiom-danger);
  font-weight: 500;
}

.error-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: #ffebee;
  color: #b71c1c;
  font-size: .85em;
}

.kv {
  margin-bottom: 6px;
  color: var(--axiom-text-muted, #444);
}

.kv b {
  display: inline-block;
  min-width: 160px;
  color: var(--axiom-text, #222);
}

.signature {
  font-family: monospace;
  font-size: .85em;
  word-break: break-all;
  background: var(--axiom-surface-sunken, #f5f5f5);
  padding: 8px;
  border-radius: 4px;
  max-height: 120px;
  overflow-y: auto;
}

.error-block {
  background: #ffebee;
  color: #b71c1c;
  padding: 12px;
  border-radius: 4px;
  margin-top: 8px;
}

.day-chip {
  display: inline-block;
  padding: 8px 12px;
  margin-right: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--axiom-border-muted, #ddd);
  border-radius: 4px;
  background: var(--axiom-surface-sunken, #fafafa);
}

.day-chip .err {
  color: #b71c1c;
  font-weight: 500;
}

.override-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  background: #fff3e0;
  color: #e65100;
  font-weight: 600;
}

.override-detail {
  margin-top: 4px;
  color: #e65100;
}

/* Receipt review page */
.receipt-review {
  display: grid;
  gap: 1rem;
}

.receipt-review > *,
.receipt-review-grid > *,
.receipt-review-section,
.receipt-review-hero,
.receipt-review-actions {
  max-width: 100%;
  min-width: 0;
}

.receipt-review-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--axiom-surface-raised);
  border: 1px solid var(--axiom-border-muted);
  border-radius: var(--axiom-radius-md);
  box-shadow: var(--axiom-shadow-sm);
}

.receipt-review-kicker {
  display: block;
  color: var(--axiom-brand);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.receipt-review-hero h1 {
  margin: .2rem 0;
  font-size: 1.65rem;
}

.receipt-review-hero p,
.receipt-review-footnote,
.receipt-map-coordinates {
  color: var(--axiom-text-muted);
  margin: 0;
}

.receipt-review-total {
  display: grid;
  justify-items: end;
  gap: .35rem;
  min-width: 13rem;
}

.receipt-review-total span:first-child {
  color: var(--axiom-text-muted);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
}

.receipt-review-total strong {
  color: var(--axiom-text);
  font-size: 1.45rem;
}

.receipt-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: flex-end;
}

.receipt-review-actions .receipt-action-btn,
.receipt-review-actions a.receipt-action-btn,
.receipt-review-actions button.receipt-action-btn {
  box-sizing: border-box;
  min-height: 2.6rem;
  height: 2.6rem;
  min-width: 6.25rem;
  margin: 0;
  padding: 0 .85rem;
  appearance: none;
  border-radius: var(--axiom-radius-sm);
  font-size: .92rem;
  font-weight: 700;
  line-height: 1;
  gap: .42rem;
}

.receipt-review-actions .receipt-action-btn .ph {
  font-size: 1.05rem;
  line-height: 1;
}

.receipt-review-actions .receipt-print-btn {
  min-width: 6.75rem;
}

.receipt-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}

.receipt-summary-card {
  min-width: 0;
  min-height: 5rem;
  padding: .85rem;
  background: var(--axiom-surface-raised);
  border: 1px solid var(--axiom-border-muted);
  border-radius: var(--axiom-radius-md);
  box-shadow: var(--axiom-shadow-sm);
}

.receipt-summary-card span:first-child {
  display: block;
  color: var(--axiom-text-muted);
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: .35rem;
  text-transform: uppercase;
}

.receipt-summary-card strong {
  display: block;
  color: var(--axiom-text);
  font-size: 1.12rem;
  overflow-wrap: anywhere;
}

.receipt-console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 23rem);
  gap: 1rem;
  align-items: start;
}

.receipt-console-main,
.receipt-console-side {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.receipt-console-side {
  position: sticky;
  top: 5.5rem;
}

.receipt-party-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.receipt-review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(18rem, .8fr);
  gap: 1rem;
}

.receipt-review-section {
  background: var(--axiom-surface-raised);
  border: 1px solid var(--axiom-border-muted);
  border-radius: var(--axiom-radius-md);
  padding: 1.1rem;
}

.receipt-review-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .85rem;
}

.receipt-review-section h2 {
  margin: 0;
  font-size: 1.05rem;
}

.receipt-review-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .85rem 1rem;
  margin: 0;
}

.receipt-review-meta div {
  min-width: 0;
}

.receipt-review-meta dt {
  color: var(--axiom-brand-strong);
  font-size: .78rem;
  font-weight: 700;
  margin-bottom: .18rem;
}

.receipt-review-meta dd {
  margin: 0;
  overflow-wrap: break-word;
  word-break: normal;
}

.receipt-review-meta .span-2 {
  grid-column: 1 / -1;
}

.receipt-review-meta-single {
  grid-template-columns: 1fr;
}

.receipt-party-meta {
  grid-template-columns: repeat(2, minmax(8.5rem, 1fr));
}

.receipt-party-meta dd {
  font-size: 1rem;
}

.receipt-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .45rem 0;
  border-bottom: 1px solid var(--axiom-border-muted);
}

.receipt-total-row:last-child {
  border-bottom: 0;
}

.receipt-total-row.grand {
  color: var(--axiom-text);
  font-size: 1.1rem;
  font-weight: 800;
}

.receipt-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: var(--axiom-radius-sm);
}

.receipt-table-scroll .axiom-table {
  margin-bottom: 0;
}

.receipt-items-table {
  min-width: 52rem;
}

.receipt-items-table td:nth-child(2) {
  min-width: 11rem;
}

.receipt-items-table td:nth-child(3),
.receipt-items-table td:nth-child(4) {
  min-width: 9rem;
}

.receipt-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}

.receipt-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.6rem;
  max-width: 100%;
  padding: .22rem .5rem;
  border: 1px solid var(--axiom-border-muted);
  border-radius: 999px;
  background: var(--axiom-surface-sunken);
  color: var(--axiom-text);
  font-size: .78rem;
  font-weight: 700;
  overflow-wrap: break-word;
}

.receipt-tax-stack {
  display: grid;
  gap: .5rem;
}

.receipt-tax-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .75rem;
  padding: .65rem;
  background: var(--axiom-surface-sunken);
  border: 1px solid var(--axiom-border-muted);
  border-radius: var(--axiom-radius-sm);
}

.receipt-tax-row span {
  color: var(--axiom-text-muted);
  overflow-wrap: break-word;
}

.receipt-tax-row strong {
  color: var(--axiom-text);
  white-space: nowrap;
}

.receipt-qr-block {
  display: grid;
  align-content: start;
  gap: .5rem;
  min-height: 9rem;
  padding: 1rem;
  background: var(--axiom-surface-sunken);
  border: 1px dashed var(--axiom-border);
  border-radius: var(--axiom-radius-sm);
}

.receipt-qr-block > span {
  color: var(--axiom-brand-strong);
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.receipt-qr-block a {
  overflow-wrap: anywhere;
}

.receipt-signature-block {
  margin-top: .85rem;
}

.receipt-history-list {
  display: grid;
  gap: .65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.receipt-history-list li {
  padding-left: .65rem;
  border-left: 3px solid var(--axiom-border);
}

.receipt-history-list strong,
.receipt-history-list span,
.receipt-history-list em {
  display: block;
  overflow-wrap: anywhere;
}

.receipt-history-list span {
  color: var(--axiom-text-muted);
  font-size: .85rem;
}

.receipt-history-list em {
  color: var(--axiom-danger, #b42318);
  font-style: normal;
  font-size: .85rem;
  margin-top: .25rem;
}

.receipt-side-actions {
  display: grid;
  gap: .5rem;
}

.receipt-side-actions .btn {
  width: 100%;
}

.receipt-print-document {
  display: none;
}

#receipt-map {
  height: 280px;
  width: 100%;
  border-radius: var(--axiom-radius-sm);
  overflow: hidden;
}

.receipt-map-coordinates {
  margin-top: .65rem;
  font-size: .9rem;
}

.receipt-review-footnote {
  font-size: .85rem;
  text-align: center;
}

@media (max-width: 1440px) {
  .receipt-console {
    grid-template-columns: minmax(0, 1fr);
  }

  .receipt-console-side {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .receipt-side-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  }
}

@media (max-width: 1180px) {
  .receipt-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .receipt-party-grid,
  .receipt-console-side {
    grid-template-columns: minmax(0, 1fr);
  }

  .receipt-party-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .receipt-console,
  .receipt-party-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .receipt-console-side {
    position: static;
  }

  .receipt-review-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .receipt-review-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .receipt-review-total {
    justify-items: start;
    min-width: 0;
  }

  .receipt-review-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .receipt-summary-strip {
    grid-template-columns: minmax(0, 1fr);
  }

  .receipt-review-meta {
    grid-template-columns: 1fr;
  }

  .receipt-review-actions .receipt-action-btn,
  .receipt-review-actions a.receipt-action-btn,
  .receipt-review-actions button.receipt-action-btn {
    flex: 1 1 8.5rem;
    min-width: 0;
  }
}

@media print {
  @page {
    size: A4;
    margin: 1.2cm;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 10pt;
    margin: 0 !important;
    padding: 0 !important;
  }

  body * {
    visibility: hidden !important;
  }

  .receipt-print-document,
  .receipt-print-document * {
    visibility: visible !important;
  }

  .axiom-topbar,
  .axiom-sidebar,
  .no-print {
    display: none !important;
  }

  .receipt-print-document {
    display: block !important;
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    max-width: none;
    color: #000 !important;
    font-size: 10pt;
    background: #fff !important;
  }

  .receipt-print-document h2 {
    margin: 0 0 .2rem;
    text-align: center;
    font-size: 15pt;
  }

  .receipt-print-document p {
    margin: 0 0 .5rem;
    text-align: center;
  }

  .receipt-print-document dl {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .3rem .8rem;
    margin: .6rem 0;
    padding: .6rem 0;
    border-top: 1px solid #999;
    border-bottom: 1px solid #999;
  }

  .receipt-print-document dl div {
    min-width: 0;
  }

  .receipt-print-document dt {
    font-weight: 700;
  }

  .receipt-print-document dd {
    margin: 0;
    overflow-wrap: anywhere;
  }

  .receipt-print-document table {
    width: 100%;
    border-collapse: collapse;
    margin-top: .6rem;
  }

  .receipt-print-document th,
  .receipt-print-document td {
    padding: .25rem;
    border-bottom: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
  }

  .receipt-print-document th:last-child,
  .receipt-print-document td:last-child {
    text-align: right;
  }

  .receipt-print-totals {
    margin-top: .65rem;
    margin-left: auto;
    max-width: 16rem;
  }

  .receipt-print-totals div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .2rem 0;
  }

  .receipt-print-totals div:last-child {
    border-top: 1px solid #999;
    font-size: 12pt;
  }

  .receipt-print-qr {
    margin-top: .8rem !important;
    text-align: left !important;
    overflow-wrap: anywhere;
  }

  .receipt-review-hero,
  .receipt-review-section {
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    break-inside: avoid;
  }

  .receipt-review-grid {
    grid-template-columns: 1fr;
  }

  #receipt-map {
    display: none !important;
  }
}

/* Large centered icon for bare/notice pages (mobile-only, unauthorized). */
.axiom-bare-icon {
  display: block;
  font-size: 3rem;
  color: var(--axiom-text-muted);
  margin-bottom: .5rem;
}

/* ===== Modal (native <dialog>, htmx-driven) =====
   The <dialog> itself is the full-viewport dim layer (a real element background,
   which renders reliably — unlike ::backdrop, which Chrome sometimes paints as a
   white wash). The swapped-in [data-modal-body] div is the centred card. */
.axiom-modal {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 1.5rem;
  border: 0;
  background: rgba(10, 15, 22, 0.55);
  overflow: hidden;
}

.axiom-modal:not([open]) {
  display: none;
}

.axiom-modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

.axiom-modal::backdrop {
  background: transparent;
}

/* The card. */
.axiom-modal [data-modal-body] {
  width: min(580px, 100%);
  max-height: calc(100vh - 3rem);
  background: var(--axiom-surface-raised);
  color: var(--axiom-text);
  border: 1px solid var(--axiom-border-muted);
  border-radius: 14px;
  box-shadow: 0 28px 64px -16px rgba(16, 24, 40, 0.45), 0 8px 20px -8px rgba(16, 24, 40, 0.28);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: axiom-modal-in .18s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Header stays pinned; body scrolls when a form is taller than the viewport. */
.axiom-modal-body {
  overflow-y: auto;
}

/* Mobile: card fills the screen (a centred card is cramped on small phones). */
@media (max-width: 767.98px) {
  .axiom-modal {
    padding: 0;
  }
  .axiom-modal [data-modal-body] {
    width: 100%;
    max-height: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
  }
}

.axiom-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.4rem;
  background: var(--axiom-surface-sunken);
  border-bottom: 1px solid var(--axiom-border-muted);
}

.axiom-modal-head h2,
.axiom-modal-head h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.axiom-modal-body {
  padding: 1.4rem;
}

/* Treat the form's action row as a pinned footer with a divider. */
.axiom-modal-body .axiom-actions {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  margin: 1.4rem -1.4rem -1.4rem;
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--axiom-border-muted);
  background: var(--axiom-surface-sunken);
}

.axiom-modal-close {
  background: none;
  border: 0;
  border-radius: 6px;
  transition: background .15s ease, color .15s ease;
  color: var(--axiom-text-muted);
  cursor: pointer;
  padding: .2rem;
  margin: 0;
  width: auto;
  line-height: 1;
}

.axiom-modal-close:hover {
  background: var(--axiom-border-muted);
  color: var(--axiom-text);
}

@keyframes axiom-modal-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Legacy print-modal stub retained for the receipt print path. */
.modal {
  background: var(--axiom-surface-raised);
  border: 1px solid var(--axiom-border-muted);
  border-radius: var(--axiom-radius-md);
  box-shadow: var(--axiom-shadow-md);
  margin: 1rem auto;
  max-width: 720px;
  padding: 0;
}

.modal-content,
.modal-footer {
  padding: 1rem;
}

/* ===== Topbar user menu + popovers (native Popover API) ===== */
.axiom-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  height: 2.25rem;
  padding: 0 .6rem;
  margin: 0;
  width: auto;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--axiom-radius-sm);
  color: #fff;
  cursor: pointer;
}

.axiom-user-caret {
  font-size: 1.1rem;
}

.axiom-popover {
  position: fixed;
  inset: auto;
  margin: 0;
  min-width: 200px;
  padding: .35rem;
  border: 1px solid var(--axiom-border-muted);
  border-radius: var(--axiom-radius-md);
  background: var(--axiom-surface-raised);
  color: var(--axiom-text);
  box-shadow: var(--axiom-shadow-lg);
}

/* Anchor the topbar user popover to the top-right under the bar. */
#axiom-user-popover {
  top: calc(var(--axiom-topbar-h) + 6px);
  right: .75rem;
  left: auto;
}

/* Row-action popovers are positioned by axiom.js relative to their trigger. */
.axiom-row-popover {
  top: 0;
  left: 0;
}

.axiom-row-actions {
  white-space: nowrap;
}

.axiom-action-trigger {
  padding: .15rem .4rem;
  min-height: 1.9rem;
}

.axiom-action-trigger .ph {
  font-size: 1.2rem;
}

.axiom-popover-head {
  padding: .4rem .6rem;
  font-weight: 600;
  font-size: .85rem;
  color: var(--axiom-text-muted);
  border-bottom: 1px solid var(--axiom-border-muted);
  margin-bottom: .25rem;
}

.axiom-popover a,
.axiom-popover button {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .5rem .6rem;
  margin: 0;
  border: 0;
  border-radius: var(--axiom-radius-sm);
  background: none;
  color: var(--axiom-text);
  text-decoration: none;
  text-align: left;
  font-size: .9rem;
  cursor: pointer;
}

.axiom-popover a:hover,
.axiom-popover button:hover {
  background: color-mix(in srgb, var(--axiom-brand) 8%, transparent);
  color: var(--axiom-brand);
}

.axiom-popover .ph {
  font-size: 1.15rem;
}

/* Inline form (e.g. cancel-with-reason) inside an actions popover: padded and
   set off from the action items above it, with normally-styled inputs. */
.axiom-popover-form {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin: .25rem 0 0;
  padding: .5rem .6rem 0;
  border-top: 1px solid var(--axiom-border-muted);
}

.axiom-popover-form .summary-label {
  margin: 0;
}

/* Scrollable checkbox list for multi-select fields (tax codes, UOMs) — friendlier
   than a native multi-select that needs Ctrl/Cmd-click. */
.axiom-checkbox-list {
  max-height: 11rem;
  overflow-y: auto;
  border: 1px solid var(--axiom-border-muted);
  border-radius: var(--axiom-radius-md);
  padding: .35rem;
  background: var(--axiom-surface);
}

.axiom-checkbox-list.axiom-invalid {
  border-color: var(--axiom-danger, #c0392b);
}

.axiom-check {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .3rem .4rem;
  margin: 0;
  border-radius: var(--axiom-radius-sm);
  cursor: pointer;
}

.axiom-check:hover {
  background: color-mix(in srgb, var(--axiom-brand) 7%, transparent);
}

.axiom-check input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.axiom-check input[type="checkbox"]:disabled + span {
  opacity: .5;
}

/* Bold standalone field label (where the control isn't a single native input). */
.axiom-field-label {
  display: block;
  font-weight: 600;
  margin-bottom: .35rem;
}

/* Live "(n selected)" / "(n / max)" counter shown next to a checkbox-list label. */
.axiom-list-count {
  font-weight: 400;
  font-size: .85em;
  color: var(--axiom-text-muted);
}

/* Type-to-filter input sitting above a checkbox list. */
.axiom-list-filter {
  margin-bottom: .35rem;
}

/* Read-only chip row used in view mode for multi-value fields. */
.axiom-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}

/* Toolbar action cluster: primary button + overflow/export menu, no wrap. */
.axiom-toolbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Divider between leading actions and the export formats in a combined menu. */
.axiom-popover-sep {
  height: 1px;
  margin: .3rem .2rem;
  background: var(--axiom-border-muted);
}

.axiom-popover-form input[type="text"] {
  margin: 0;
}

/* Compact button used in row-action menus / modal footers. */
.btn-sm {
  min-height: 1.9rem;
  padding: .25rem .6rem;
  font-size: .85rem;
}

.hidden-print {
  print-color-adjust: exact;
}

.htmx-indicator {
  display: none;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-block;
}

/* ===== Responsive tiers =====
   xl (>=1280px): sidebar always expanded, rail toggle hidden.
   md/lg (768-1279px): icon rail by default; body.axiom-rail-expanded shows labels.
   mobile (<768px): off-canvas drawer toggled by body.axiom-sidebar-open. */

/* Tier md/lg: default to the rail; expand on demand. */
@media (min-width: 768px) and (max-width: 1279.98px) {
  body {
    --axiom-sidebar-w: var(--axiom-sidebar-rail);
  }

  body.axiom-rail-expanded {
    --axiom-sidebar-w: var(--axiom-sidebar-expanded);
  }

  /* ---- Collapsed icon rail ---- */
  /* Hide labels + the native disclosure caret on group summaries. */
  body:not(.axiom-rail-expanded) .axiom-nav-label {
    display: none;
  }
  body:not(.axiom-rail-expanded) .axiom-sidebar summary {
    list-style: none;
  }
  body:not(.axiom-rail-expanded) .axiom-sidebar summary::-webkit-details-marker,
  body:not(.axiom-rail-expanded) .axiom-sidebar summary::marker,
  body:not(.axiom-rail-expanded) .axiom-sidebar summary::after {
    display: none;
  }

  /* Every item is a uniform, centered icon button. */
  body:not(.axiom-rail-expanded) .axiom-sidebar a,
  body:not(.axiom-rail-expanded) .axiom-sidebar summary {
    justify-content: center;
    gap: 0;
    padding: 0;
    width: 44px;
    height: 40px;
    min-height: 0;
    margin: 2px auto;
    border-radius: var(--axiom-radius-md);
  }

  /* Flatten group children (no indent rail) and separate groups with a divider. */
  body:not(.axiom-rail-expanded) .axiom-sidebar details {
    margin: 0;
    border-top: 1px solid var(--axiom-border-muted);
    padding-top: .35rem;
    margin-top: .35rem;
  }
  body:not(.axiom-rail-expanded) .axiom-sidebar details ul {
    border-left: 0;
    margin: 0;
    padding: 0;
  }

  /* Active item: centered tint, drop the full-width indicator bar. */
  body:not(.axiom-rail-expanded) .axiom-sidebar .active > a {
    box-shadow: none;
  }

  body:not(.axiom-rail-expanded) .axiom-nav {
    padding: .6rem .35rem;
  }
}

/* Tier xl: always expanded, hide the toggle. */
@media (min-width: 1280px) {
  body {
    --axiom-sidebar-w: var(--axiom-sidebar-expanded);
  }

  .axiom-menu-button {
    display: none;
  }
}

/* Tier mobile: off-canvas drawer (always full labels) + backdrop. */
@media (max-width: 767.98px) {
  .axiom-sidebar {
    --axiom-sidebar-w: var(--axiom-sidebar-expanded);
    width: var(--axiom-sidebar-expanded);
    transform: translateX(-105%);
  }

  body.axiom-sidebar-open .axiom-sidebar {
    transform: translateX(0);
  }

  main,
  .mn-inner {
    margin-left: 0;
    padding: calc(var(--axiom-topbar-h) + 14px) 14px 24px;
  }

  .axiom-backdrop {
    position: fixed;
    inset: 0;
    top: var(--axiom-topbar-h);
    background: rgba(0, 0, 0, 0.45);
    z-index: 25;
    border: 0;
    margin: 0;
    padding: 0;
    width: 100%;
    animation: axiom-fade-in .15s ease-out;
  }
}

@media (max-width: 600px) {
  .hide-on-small-only {
    display: none !important;
  }

  .hide-on-med-and-up {
    display: inline !important;
  }

  .s4,
  .s6,
  .s8 {
    flex-basis: 100%;
  }
}

@keyframes axiom-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== Dashboard (index.php) ===== */
.text-green { color: #2e7d32; }
.text-red { color: #c62828; }
.ph.tiny { font-size: 1rem; vertical-align: text-bottom; }
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-muted { color: var(--axiom-muted, #6b6b6b); }

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.dash-kpi .card-content { padding: 1.1rem 1.25rem; }

.dash-kpi-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; }
.dash-kpi-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex: 0 0 auto;
}
.dash-kpi-chip .ph { font-size: 1.3rem; }
.dash-chip-brand   { background: color-mix(in srgb, var(--axiom-brand) 12%, transparent);   color: var(--axiom-brand); }
.dash-chip-accent  { background: var(--axiom-accent-muted);                                 color: var(--axiom-accent); }
.dash-chip-success { background: color-mix(in srgb, var(--axiom-success) 14%, transparent); color: var(--axiom-success); }
.dash-chip-warning { background: color-mix(in srgb, var(--axiom-warning) 16%, transparent); color: var(--axiom-warning); }
.dash-chip-danger  { background: color-mix(in srgb, var(--axiom-danger) 12%, transparent);  color: var(--axiom-danger); }
.dash-chip-info    { background: color-mix(in srgb, var(--axiom-info) 14%, transparent);    color: var(--axiom-info); }

.dash-kpi-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; color: var(--axiom-text-muted); }
.dash-kpi-value { margin: .1rem 0 .35rem; font-weight: 700; font-size: 1.55rem; line-height: 1.15; color: var(--axiom-text); }
.dash-kpi-meta { margin: 0; font-size: .8rem; color: var(--axiom-text-muted); display: flex; align-items: center; gap: .3rem; }

/* Active filter/range context chips above the regions. */
.dash-context-bar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.dash-context-chip {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  background: var(--axiom-surface-raised);
  border: 1px solid var(--axiom-border-muted);
  border-radius: 999px;
  font-size: .8rem;
  color: var(--axiom-text-muted);
}

/* Region section heading. */
.dash-section-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 1.5rem 0 .75rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--axiom-text);
}
.dash-section-title .ph { color: var(--axiom-text-muted); }

/* Empty state for charts/tables with no data in the selected window. */
.dash-empty { padding: 2rem 1rem; text-align: center; color: var(--axiom-text-muted); }
.dash-empty .ph { font-size: 2rem; display: block; margin-bottom: .4rem; opacity: .6; }

/* Inline stat row (fiscal breakdown, etc.). */
.dash-stat-row { display: flex; flex-wrap: wrap; gap: 1.5rem; }
.dash-stat { display: flex; flex-direction: column; min-width: 88px; }
.dash-stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; color: var(--axiom-text); }
.dash-stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--axiom-text-muted); }

/* Configuration quick-links (admin). */
.dash-quicklinks { display: flex; flex-wrap: wrap; gap: .6rem; }
.dash-quicklinks a {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .5rem .8rem; border: 1px solid var(--axiom-border-muted);
  border-radius: var(--axiom-radius-md); color: var(--axiom-text);
  text-decoration: none; background: var(--axiom-surface-raised);
}
.dash-quicklinks a:hover { background: var(--axiom-surface-sunken); border-color: var(--axiom-text-muted); }

.dash-chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
.dash-chart-canvas { position: relative; width: 100%; }

.dash-area-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.dash-area-card,
.dash-area-total {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
}
.dash-area-card h5,
.dash-area-total h4 { margin: 0.2rem 0; }
