/* ==========================================================================
   NEXORA TECHNOLOGIES — Admin panel theme
   ========================================================================== */

:root {
  --ax-primary:   #0F172A;   /* slate 900          */
  --ax-secondary: #EA580C;   /* orange 600 — action */
  --ax-indigo:    #F97316;   /* orange 500          */
  --ax-accent:    #06B6D4;
  --ax-success:   #16A34A;
  --ax-warning:   #F59E0B;
  --ax-danger:    #DC2626;

  --ax-bg:        #F1F5F9;
  --ax-surface:   #FFFFFF;
  --ax-surface-2: #F8FAFC;
  --ax-border:    #E2E8F0;
  --ax-text:      #0F172A;
  --ax-muted:     #64748B;

  --ax-sidebar-w: 264px;
  --ax-radius:    .85rem;
  --ax-shadow:    0 1px 3px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.05);
  --ax-font-head: 'Poppins', system-ui, sans-serif;
  --ax-font-body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body.ax-body {
  font-family: var(--ax-font-body);
  background: var(--ax-bg);
  color: var(--ax-text);
  font-size: .94rem;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5,h6 { font-family: var(--ax-font-head); font-weight: 600; letter-spacing: -.015em; color: var(--ax-text); }

a { color: var(--ax-secondary); text-decoration: none; }
a:hover { color: #C2410C; }

:focus-visible { outline: 3px solid rgba(234,88,12,.45); outline-offset: 2px; border-radius: 4px; }

/* ------------------------------------------------------------- Sidebar -- */
.ax-sidebar {
  position: fixed; inset: 0 auto 0 0;
  width: var(--ax-sidebar-w);
  background: var(--ax-primary);
  color: #CBD5E1;
  display: flex; flex-direction: column;
  z-index: 1045;
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

.ax-sidebar-head {
  padding: .85rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.09);
  display: flex; align-items: center; gap: .6rem;
  flex-shrink: 0;
  text-decoration: none;                 /* it is a link to the dashboard now */
  transition: background-color .2s;
}
.ax-sidebar-head:hover { background: rgba(255,255,255,.05); }

/* Site logo in place of the old letter tile. Height-constrained with width
   auto so any logo shape — square mark or wide wordmark — sits correctly. */
.ax-logo {
  height: 34px; width: auto; max-width: 46px;
  object-fit: contain; flex-shrink: 0;
}
.ax-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, #EA580C, #F97316 60%, #FB923C);
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-family: var(--ax-font-head);
  flex-shrink: 0;
}
.ax-brand-name { color: #fff; font-weight: 600; font-size: .95rem; line-height: 1.2; font-family: var(--ax-font-head); }
.ax-brand-sub  { font-size: .64rem; color: #94A3B8; letter-spacing: .09em; text-transform: uppercase; }

.ax-nav { flex: 1; overflow-y: auto; padding: .5rem .6rem 1rem; }
.ax-nav::-webkit-scrollbar { width: 6px; }
.ax-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.16); border-radius: 4px; }

/* ---- Collapsible groups ---------------------------------------------------
   Thirty-odd destinations will not fit on a laptop screen however tightly they
   are packed, and a menu you have to scroll to read is a menu you stop reading.
   Groups collapse instead; the one you are working in opens itself.          */
.ax-nav-group { margin-bottom: .12rem; }

.ax-nav-label {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  font-size: .67rem; letter-spacing: .1em; text-transform: uppercase;
  color: #94A3B8; font-weight: 600;
  padding: .45rem .6rem; border: 0; background: none; border-radius: .5rem;
  cursor: pointer; text-align: left;
  transition: background-color .2s, color .2s;
}
.ax-nav-label:hover { background: rgba(255,255,255,.06); color: #E2E8F0; }

/* The chevron sits at the left edge; the tally is what floats right. Giving
   the chevron margin-left:auto pushes the whole label across instead. */
.ax-nav-label .chev {
  font-size: .7rem; color: #64748B; flex-shrink: 0;
  transition: transform .22s ease;
}
.ax-nav-label .nm { flex: 1; min-width: 0; }

.ax-nav-group.open > .ax-nav-label { color: #E2E8F0; }
.ax-nav-group.open > .ax-nav-label .chev { transform: rotate(90deg); color: #FB923C; }

/* A count of what is inside, so a collapsed group still says something. */
.ax-nav-label .tally {
  margin-left: auto; flex-shrink: 0;
  font-size: .63rem; color: #64748B; letter-spacing: 0; line-height: 1.5;
  background: rgba(255,255,255,.07); border-radius: 20px; padding: 0 .42rem;
}
.ax-nav-group.open > .ax-nav-label .tally { opacity: 0; }

/* Pending-work badge, rolled up from an item so a collapsed group still shows
   it. Pushed to the right; the tally sits after it. */
.ax-nav-label .alert-dot {
  margin-left: auto; flex-shrink: 0; min-width: 17px; height: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .62rem; font-weight: 700; color: #fff; letter-spacing: 0;
  background: #DC2626; border-radius: 20px; padding: 0 .3rem;
}
.ax-nav-label .alert-dot + .tally { margin-left: .35rem; }
/* Once the group is open the item shows its own badge, so hide the rolled-up one. */
.ax-nav-group.open > .ax-nav-label .alert-dot { display: none; }

/* Collapse mechanism — deliberately simple and cache-proof.
 *
 * DEFAULT: every group is fully visible. So if the stylesheet and the script
 * ever fall out of sync (a cached file, a half-finished upload), the menu is
 * still completely usable — it just scrolls, the way it did before. A navigation
 * menu must never hide items unless we are certain the toggle works.
 *
 * The accordion only engages once the script adds `.js-nav` to the <nav>. Then
 * closed groups collapse via max-height, which — unlike the grid-rows trick —
 * needs no min-height incantation and cannot silently fail. 640px is safely
 * taller than the largest group; the exact value never shows because the
 * content is shorter. */
.ax-nav-items { overflow: hidden; }

.ax-nav.js-nav .ax-nav-group .ax-nav-items {
  max-height: 0;
  transition: max-height .26s ease;
}
.ax-nav.js-nav .ax-nav-group.open .ax-nav-items {
  max-height: 640px;
}
/* No animation on the very first paint, so nothing slides about on load. */
.ax-nav.booting .ax-nav-items { transition: none !important; }

.ax-nav-link {
  display: flex; align-items: center; gap: .65rem;
  padding: .42rem .7rem .42rem 1.1rem; border-radius: .55rem;
  color: #CBD5E1; font-size: .86rem;
  margin-bottom: .08rem;
  transition: background-color .2s, color .2s;
}
.ax-nav-link i { font-size: .98rem; width: 18px; text-align: center; flex-shrink: 0; }
.ax-nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.ax-nav-link.active { background: linear-gradient(135deg, #EA580C, #F97316 60%, #FB923C); color: #fff; box-shadow: 0 5px 14px rgba(234,88,12,.32); }
.ax-nav-link .badge { margin-left: auto; font-size: .66rem; }

/* A collapsed group holding the active page keeps a marker, so you can still
   see where you are without opening anything. */
.ax-nav-group.has-active:not(.open) > .ax-nav-label { color: #FB923C; }
.ax-nav-group.has-active:not(.open) > .ax-nav-label .tally {
  background: rgba(234,88,12,.22); color: #FDBA74;
}

/* Pinned to the bottom, outside the scroll area, so the two things you always
   want are never below the fold. */
.ax-sidebar-foot {
  flex-shrink: 0; padding: .5rem .6rem .7rem;
  border-top: 1px solid rgba(255,255,255,.09);
  display: flex; gap: .4rem;
}
.ax-sidebar-foot a {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .45rem .5rem; border-radius: .55rem; font-size: .78rem;
  color: #CBD5E1; background: rgba(255,255,255,.06);
  transition: background-color .2s, color .2s;
}
.ax-sidebar-foot a:hover { background: rgba(255,255,255,.13); color: #fff; }
.ax-sidebar-foot a.out:hover { background: rgba(239,68,68,.22); color: #FCA5A5; }

/* --------------------------------------------------------------- Shell -- */
.ax-main { margin-left: var(--ax-sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.ax-topbar {
  position: sticky; top: 0; z-index: 1030;
  background: color-mix(in srgb, var(--ax-surface) 82%, transparent);
  backdrop-filter: blur(16px) saturate(170%);
  border-bottom: 1px solid var(--ax-border);
  padding: .75rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  flex-wrap: wrap;
}
.ax-topbar h1 { font-size: 1.12rem; margin: 0; }

.ax-content { padding: 1.5rem; flex: 1; }

.ax-icon-btn {
  width: 38px; height: 38px; border-radius: .6rem;
  border: 1px solid var(--ax-border); background: var(--ax-surface);
  color: var(--ax-text); display: grid; place-items: center;
  transition: background-color .2s, color .2s;
}
.ax-icon-btn:hover { background: var(--ax-secondary); color: #fff; border-color: transparent; }

.ax-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  z-index: 1040; opacity: 0; visibility: hidden; transition: all .3s;
}
.ax-overlay.show { opacity: 1; visibility: visible; }

/* --------------------------------------------------------------- Cards -- */
.ax-card {
  background: var(--ax-surface);
  border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius);
  box-shadow: var(--ax-shadow);
  margin-bottom: 1.5rem;
}
.ax-card-head {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--ax-border);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.ax-card-head h2, .ax-card-head h3 { font-size: 1rem; margin: 0; }
.ax-card-body { padding: 1.25rem; }

.ax-stat-card {
  background: var(--ax-surface);
  border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--ax-shadow);
  display: flex; align-items: center; gap: 1rem;
  height: 100%;
  transition: transform .25s cubic-bezier(.16,1,.3,1), box-shadow .25s;
}
.ax-stat-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(15,23,42,.1); }
.ax-stat-icon {
  width: 46px; height: 46px; border-radius: .7rem;
  display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0;
  background: rgba(234,88,12,.11); color: var(--ax-secondary);
}
.ax-stat-value { font-family: var(--ax-font-head); font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.ax-stat-label { font-size: .8rem; color: var(--ax-muted); }

/* -------------------------------------------------------------- Tables -- */
.ax-table { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; }
.ax-table thead th {
  background: var(--ax-surface-2);
  font-size: .74rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ax-muted); font-weight: 600;
  padding: .8rem 1rem; border-bottom: 1px solid var(--ax-border);
  white-space: nowrap;
}
.ax-table tbody td {
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--ax-border);
  vertical-align: middle;
  color: var(--ax-text);
}
.ax-table tbody tr:last-child td { border-bottom: none; }
.ax-table tbody tr:hover { background: var(--ax-surface-2); }
.ax-table .ax-thumb { width: 46px; height: 46px; border-radius: .5rem; object-fit: cover; }

.table-responsive { border-radius: var(--ax-radius); position: relative; scrollbar-width: thin; }
.table-responsive::-webkit-scrollbar { height: 8px; }
.table-responsive::-webkit-scrollbar-thumb { background: var(--ax-border); border-radius: 8px; }
.table-responsive::-webkit-scrollbar-track { background: transparent; }

/* Long values — emails, SKUs, invoice numbers — wrap at sensible points.
   `anywhere` was breaking words mid-syllable ("W&R Ventu / res pvt.lt / d"),
   which is harder to read than a slightly wider column. `break-word` only
   splits a word when it genuinely cannot fit on a line of its own. */
.ax-table td { overflow-wrap: break-word; }
.ax-table td code, .ax-table td .text-nowrap { overflow-wrap: normal; }

/* A cluster of row actions. Left to themselves the buttons stack into a
   vertical tower as soon as the column narrows; this keeps them on one line
   and lets the column size itself to them. */
.ax-row-actions {
  display: inline-flex; align-items: center; gap: .3rem;
  flex-wrap: nowrap; justify-content: flex-end;
}
.ax-row-actions form { display: inline-flex; margin: 0; }

/* Action columns shrink to fit their buttons and never wrap them. Without
   this the column takes an equal share of the table, the buttons run out of
   room, and they stack into a vertical tower down the side of the row.
   .ax-cell-actions is applied by admin.js to any cell that holds nothing but
   icon buttons, so this works on every table without markup changes. */
.ax-table td.ax-cell-actions { width: 1%; white-space: nowrap; }

/* Even figures — five ageing buckets that reflow instead of stranding one
   value alone on a line. */
.ax-ageing {
  display: grid; gap: .75rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}

/* A run of chips (permissions, tags) that wraps as a block rather than as
   loose inline words. */
.ax-chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.ax-badge { white-space: nowrap; }

/* ---------------------------------------------------------------------------
   Stacked tables on small screens

   A five-column table cannot be made to fit a 360px phone. Squeezing it breaks
   words mid-syllable; letting it scroll hides the columns people came for. So
   below 640px each row becomes its own block of label/value pairs — nothing is
   hidden, nothing overflows, and the page never scrolls sideways.

   Labels come from the table head, applied as data-label by admin.js, so this
   works on every table in the panel without touching the markup. Opt a table
   out with .ax-table-grid where the grid itself carries the meaning.
--------------------------------------------------------------------------- */
@media (max-width: 640px) {
  /* min-width: a page may give its table a minimum width for the grid layout; as cards it must fit the screen. */
  .ax-table:not(.ax-table-grid) { display: block; min-width: 0 !important; }
  .ax-table:not(.ax-table-grid) thead { display: none; }
  .ax-table:not(.ax-table-grid) tbody,
  .ax-table:not(.ax-table-grid) tbody tr,
  .ax-table:not(.ax-table-grid) tbody td { display: block; width: auto; }

  /* Two label/value pairs per line where they fit, one where they do not.
     A seven-column row stacked one field per line is a very long block to
     scroll past; paired up it reads as a compact record card.
     minmax(0, …) stops one long value from widening its column and pushing
     the row — and the page — sideways. */
  .ax-table:not(.ax-table-grid) tbody tr {
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--ax-border);
    display: grid; gap: .1rem .9rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 8.5rem), 1fr));
    align-items: start;
  }
  .ax-table:not(.ax-table-grid) tbody tr:last-child { border-bottom: 0; }
  .ax-table:not(.ax-table-grid) tbody tr:hover { background: transparent; }

  /* The heading cell and the action row always take the full width. */
  .ax-table:not(.ax-table-grid) tbody td:first-child,
  .ax-table:not(.ax-table-grid) tbody td.ax-cell-actions,
  .ax-table:not(.ax-table-grid) tbody td[colspan] { grid-column: 1 / -1; }

  /* Label above value, not beside it.

     Beside would be tighter, but a cell is often several things — a name and
     a phone number, an amount and a date — and any side-by-side layout splits
     those into separate columns. Stacked, the cell's own markup is left to
     lay itself out exactly as it does on a wide screen. */
  .ax-table:not(.ax-table-grid) tbody td {
    padding: .38rem 0; border: 0; text-align: left;
  }
  .ax-table:not(.ax-table-grid) tbody td[data-label]::before {
    content: attr(data-label);
    display: block; margin-bottom: .1rem;
    font-size: .67rem; font-weight: 600; letter-spacing: .07em;
    text-transform: uppercase; color: var(--ax-muted);
  }
  .ax-table:not(.ax-table-grid) tbody td[data-label=""]::before { content: none; }

  /* Numeric columns are right-aligned in the grid; stacked, that leaves the
     figure marooned across the screen from its own label. */
  .ax-table:not(.ax-table-grid) tbody td.text-end,
  .ax-table:not(.ax-table-grid) tbody td.num { text-align: left !important; }

  /* The first cell is the row's identity — no label needed, and given the
     weight of a heading so each block reads as one record. */
  .ax-table:not(.ax-table-grid) tbody td:first-child {
    font-size: 1.02rem; padding-top: 0; padding-bottom: .45rem;
  }
  .ax-table:not(.ax-table-grid) tbody td:first-child::before { content: none; }
  /* The desktop density rules pad the first and last cell for the table's
     edge; stacked, that indented the SKU/name line on its own. */
  .ax-table:not(.ax-table-grid) tbody tr td:first-child,
  .ax-table:not(.ax-table-grid) tbody tr td:last-child { padding-left: 0; padding-right: 0; }
  .ax-table:not(.ax-table-grid) tbody td:first-child .small { font-size: .8rem; }

  /* Actions get their own line, full width, comfortably tappable. */
  .ax-table:not(.ax-table-grid) tbody td:last-child:has(.ax-row-actions),
  .ax-table:not(.ax-table-grid) tbody td.ax-cell-actions {
    display: block; text-align: left;
    margin-top: .6rem; padding-top: .6rem;
    border-top: 1px dashed var(--ax-border);
    width: auto; white-space: normal;
  }
  .ax-table:not(.ax-table-grid) tbody td:last-child:has(.ax-row-actions)::before,
  .ax-table:not(.ax-table-grid) tbody td.ax-cell-actions::before { content: none; }
  .ax-table:not(.ax-table-grid) .ax-row-actions {
    display: flex; flex-wrap: wrap; justify-content: flex-start; gap: .4rem;
  }

  /* An empty-state or "no results" row spanning every column. */
  .ax-table:not(.ax-table-grid) tbody td[colspan] {
    display: block; text-align: center;
  }
  .ax-table:not(.ax-table-grid) tbody td[colspan]::before { content: none; }

  /* Nothing left to scroll sideways for. */
  .table-responsive:has(.ax-table:not(.ax-table-grid)) { overflow-x: visible; }
}

/* Tables that stay a grid still need a hint that there is more to the right.
   The class is set by admin.js only when the content actually overflows, and
   removed once you reach the end.

   An inset shadow rather than an absolutely-positioned fade: a pseudo-element
   inside a scroll container scrolls away with the content, whereas an inset
   shadow is painted on the box and stays put. */
.is-scrollable {
  box-shadow: inset -16px 0 14px -14px rgba(15, 23, 42, .22);
  transition: box-shadow .2s;
}
.is-scrollable.is-scroll-end { box-shadow: none; }

/* Touch targets in table action columns — 32px was fiddly on a phone. */
@media (max-width: 767.98px) {
  .ax-table thead th,
  .ax-table tbody td { padding: .65rem .7rem; }
  .ax-table .ax-icon-btn { width: 40px; height: 40px; }
}

/* --------------------------------------------------------------- Forms -- */
.form-label { font-weight: 500; font-size: .86rem; margin-bottom: .35rem; color: var(--ax-text); }
.form-control, .form-select {
  border: 1.5px solid var(--ax-border);
  border-radius: .6rem;
  padding: .6rem .85rem;
  font-size: .92rem;
  background: var(--ax-surface);
  color: var(--ax-text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--ax-secondary);
  box-shadow: 0 0 0 4px rgba(234,88,12,.12);
  background: var(--ax-surface);
  color: var(--ax-text);
}
.form-text { font-size: .8rem; color: var(--ax-muted); }
.form-check-input:checked { background-color: var(--ax-secondary); border-color: var(--ax-secondary); }

.ax-editor { min-height: 320px; font-family: ui-monospace, Consolas, monospace; font-size: .86rem; line-height: 1.7; }

.ax-upload-preview {
  border: 1px dashed var(--ax-border); border-radius: .6rem;
  padding: .75rem; display: flex; align-items: center; gap: .85rem;
  background: var(--ax-surface-2); margin-top: .5rem;
}
.ax-upload-preview img { width: 68px; height: 68px; object-fit: cover; border-radius: .5rem; }

/* ------------------------------------------------------------- Buttons -- */
.btn { border-radius: .6rem; font-weight: 500; font-size: .9rem; padding: .55rem 1.05rem; font-family: var(--ax-font-head); }
.btn-ax-primary { background: linear-gradient(135deg, #EA580C, #F97316 60%, #FB923C); border: none; color: #fff; }
.btn-ax-primary:hover { color: #fff; filter: brightness(1.06); }
.btn-ax-outline { background: transparent; border: 1.5px solid var(--ax-border); color: var(--ax-text); }
.btn-ax-outline:hover { border-color: var(--ax-secondary); color: var(--ax-secondary); background: rgba(234,88,12,.05); }
.btn-sm { padding: .35rem .7rem; font-size: .82rem; }

/* -------------------------------------------------------------- Badges -- */
.ax-badge {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .74rem; font-weight: 600; padding: .24rem .62rem; border-radius: 999px;
  text-transform: capitalize;
}
.ax-badge-new         { background: rgba(234,88,12,.12);  color: #C2410C; }
.ax-badge-read        { background: rgba(100,116,139,.14);color: #475569; }
.ax-badge-replied     { background: rgba(20,184,166,.13); color: #0F766E; }
.ax-badge-closed      { background: rgba(100,116,139,.14);color: #475569; }
.ax-badge-spam        { background: rgba(239,68,68,.12);  color: #B91C1C; }
.ax-badge-shortlisted { background: rgba(245,158,11,.14); color: #B45309; }
.ax-badge-interviewing{ background: rgba(6,182,212,.14);  color: #0E7490; }
.ax-badge-hired       { background: rgba(20,184,166,.14); color: #0F766E; }
.ax-badge-rejected    { background: rgba(239,68,68,.12);  color: #B91C1C; }
.ax-badge-active      { background: rgba(20,184,166,.13); color: #0F766E; }
.ax-badge-inactive    { background: rgba(100,116,139,.14);color: #475569; }

/* -------------------------------------------------------------- Alerts -- */
.alert { border: none; border-left: 4px solid; border-radius: .6rem; font-size: .9rem; }
.alert-success { background: rgba(20,184,166,.1);  border-left-color: var(--ax-success); color: #0F766E; }
.alert-danger  { background: rgba(239,68,68,.1);   border-left-color: var(--ax-danger);  color: #B91C1C; }
.alert-warning { background: rgba(245,158,11,.11); border-left-color: var(--ax-warning); color: #B45309; }
.alert-info    { background: rgba(234,88,12,.09);  border-left-color: var(--ax-secondary); color: #C2410C; }

/*
 * Sandbox / sample-data warning.
 *
 * Deliberately NOT a .alert. Those carry no padding or line-height of their
 * own — they inherit Bootstrap's base — and this is the one banner on the
 * marketplace screens that has to be legible no matter what else loads, since
 * its whole job is to stop someone reading Amazon's canned $11.01 samples as
 * their own takings. Self-contained, and shared by the overview and the order
 * list so the same warning looks the same in both places.
 */
.nx-sample-note {
  display: flex; gap: .65rem; align-items: flex-start;
  padding: .8rem .95rem; margin-bottom: 1rem;
  border-radius: .6rem; font-size: .875rem; line-height: 1.55;
  background: rgba(239,68,68,.1); border: 1px solid rgba(220,38,38,.3);
  color: var(--ax-text);
}
.nx-sample-note > i    { color: var(--ax-danger); font-size: 1rem; line-height: 1.5; flex: none; }
.nx-sample-note strong { color: #B91C1C; }
.nx-sample-acts        { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .6rem; }

/* ---------------------------------------------------------- Pagination -- */
.pagination .page-link {
  border: 1.5px solid var(--ax-border); color: var(--ax-text);
  border-radius: .5rem !important; margin: 0 .15rem; font-size: .88rem;
  background: var(--ax-surface);
}
.pagination .page-item.active .page-link { background: var(--ax-secondary); border-color: var(--ax-secondary); color: #fff; }

/* ----------------------------------------------------------- Bar chart -- */
.ax-chart { display: flex; align-items: flex-end; gap: .4rem; height: 170px; padding-top: 1rem; }
.ax-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .4rem; min-width: 0; }
.ax-chart-bar {
  width: 100%; border-radius: .35rem .35rem 0 0;
  background: linear-gradient(180deg, #EA580C, #F97316 55%, #FB923C);
  min-height: 4px; transition: height .6s cubic-bezier(.16,1,.3,1);
  position: relative;
}
.ax-chart-bar[data-value]:hover::after {
  content: attr(data-value);
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: var(--ax-primary); color: #fff; font-size: .7rem;
  padding: .15rem .45rem; border-radius: .3rem; margin-bottom: .3rem; white-space: nowrap;
}
.ax-chart-label { font-size: .66rem; color: var(--ax-muted); white-space: nowrap; transform: rotate(-45deg); transform-origin: center; }

/* ---------------------------------------------------------- Login page -- */
.ax-login {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(800px 420px at 15% 10%, rgba(234,88,12,.34), transparent 60%),
    radial-gradient(700px 380px at 85% 25%, rgba(6,182,212,.26), transparent 60%),
    linear-gradient(145deg, #0F172A 0%, #172033 45%, #26201C 100%);
}
.ax-login-card {
  width: 100%; max-width: 430px;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 1.4rem;
  padding: 2.25rem;
  box-shadow: 0 28px 64px rgba(2,6,23,.42);
}

/* ------------------------------------------------------------ Utilities */
.ax-muted { color: var(--ax-muted); }
.ax-tabs .nav-link { border-radius: .55rem; font-size: .88rem; color: var(--ax-muted); font-family: var(--ax-font-head); }
.ax-tabs .nav-link.active { background: var(--ax-secondary); color: #fff; }
.ax-empty { text-align: center; padding: 3rem 1rem; color: var(--ax-muted); }
.ax-empty i { font-size: 2.6rem; color: var(--ax-border); display: block; margin-bottom: .75rem; }

/* ---------------------------------------------------------- Responsive -- */
@media (max-width: 991.98px) {
  .ax-sidebar { transform: translateX(-100%); }
  .ax-sidebar.show { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.45); }
  .ax-main { margin-left: 0; }
  .ax-content { padding: 1rem; }
  .ax-topbar { padding: .7rem 1rem; }
}

/* ---------------------------------------------------------------------------
   No sideways scroll, anywhere

   One over-wide element drags the whole page with it, and the reader is then
   fighting a horizontal scrollbar on every screen — not just the one at fault.
   `overflow-x: clip` contains it without creating a scroll container, so
   position:sticky headers keep working (overflow:hidden would break them).
--------------------------------------------------------------------------- */
html, body.ax-body { max-width: 100%; overflow-x: clip; }
.ax-main, .ax-content, .pt-main { min-width: 0; max-width: 100%; }

/* Grid children default to min-width:auto, which lets a long unbroken string
   inside a column push the column — and the page — wider than the screen. */
.row > [class*="col-"] { min-width: 0; }

/* An image or embed with an intrinsic width wider than its column is the
   other common culprit. */
.ax-content img, .pt-main img, .ax-card img { max-width: 100%; height: auto; }

@media (max-width: 575.98px) {
  .ax-content { padding: .75rem; }
  .ax-card { border-radius: .7rem; margin-bottom: 1rem; }
  .ax-card-head { padding: .85rem 1rem; }
  .ax-card-body { padding: 1rem; }
  .ax-topbar h1 { font-size: 1rem; }
  .ax-empty { padding: 2rem .75rem; }

  /* A row of filter or action buttons should wrap, not scroll. */
  .ax-card-head > .d-flex { flex-wrap: wrap; }

  /* A search field beside its button: let the field take the room and the
     button sit next to it rather than being pushed off the edge. */
  .ax-card-head form.d-flex { flex: 1 1 100%; }
  .ax-card-head form.d-flex .form-control { min-width: 0 !important; flex: 1 1 auto; }
}

/* --------------------------------------------------------------- Motion -- */
html { scroll-behavior: smooth; }

.ax-card, .ax-stat-card, .btn, .ax-icon-btn, .ax-badge,
.ax-nav-link, .form-control, .form-select {
  transition-timing-function: cubic-bezier(.16, 1, .3, 1);
}
.btn { transition: transform .18s cubic-bezier(.16,1,.3,1), filter .18s, background-color .18s, border-color .18s, color .18s; }
.btn:active { transform: translateY(1px); }
.ax-icon-btn:active { transform: scale(.94); }

/* Rows and cards arriving after a filter or a page change. Purely decorative,
   and off for anyone who has asked the system for less movement. */
@keyframes ax-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ax-card { animation: ax-rise .32s cubic-bezier(.16,1,.3,1) both; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .ax-stat-card:hover, .btn:active, .ax-icon-btn:active { transform: none; }
}

@media print {
  .ax-sidebar, .ax-topbar, .btn, .ax-icon-btn { display: none !important; }
  .ax-main { margin-left: 0; }
  body.ax-body { background: #fff; }

  /* The entry animation starts a card at opacity 0. Print engines do not
     always run animations, and a blank page is a poor way to find that out. */
  .ax-card { animation: none !important; opacity: 1 !important; }

  /* Print the whole table, not the slice that happened to be on screen. */
  .table-responsive { overflow: visible !important; box-shadow: none !important; }
}

/* ==========================================================================
   SHELL v2 — area tabs + contextual sidebar
   --------------------------------------------------------------------------
   Replaces the single 62-item accordion column. Only the chrome around the
   page lives here; every page component above (.ax-card, .ax-badge, buttons,
   tables, forms) is unchanged and keeps working exactly as before.
   ========================================================================== */

:root {
  --nx-bar-h:    56px;   /* dark brand bar          */
  --nx-tabs-h:   46px;   /* area tab strip          */
  --nx-top-h:    102px;  /* the two combined        */
  --nx-side-w:   242px;
  --nx-ink:      #0F172A;
  --nx-ink-2:    #1E293B;
}

.nx-body { background: var(--ax-bg); }

/* Keyboard users land here first. */
.nx-skip {
  position: fixed; top: .5rem; left: .5rem; z-index: 100;
  transform: translateY(-200%);
  background: var(--ax-secondary); color: #fff;
  padding: .55rem .9rem; border-radius: .5rem; font-size: .85rem; font-weight: 600;
  text-decoration: none; transition: transform .18s;
}
.nx-skip:focus { transform: translateY(0); color: #fff; }

/* ------------------------------------------------------------------ header */
.nx-top { position: sticky; top: 0; z-index: 40; }

.nx-top-bar {
  height: var(--nx-bar-h);
  background: var(--nx-ink);
  display: flex; align-items: center; gap: .75rem;
  padding: 0 1rem; color: #fff;
}

.nx-burger {
  border: 0; background: rgba(255,255,255,.08); color: #fff;
  width: 36px; height: 36px; border-radius: .55rem; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.nx-burger:hover { background: rgba(255,255,255,.16); }

.nx-brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; min-width: 0; }
.nx-brand img { height: 30px; width: auto; flex-shrink: 0; }
.nx-brand-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.nx-brand-txt .nm {
  color: #fff; font-family: var(--ax-font-head); font-weight: 600; font-size: .95rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nx-brand-txt .sub {
  color: #94A3B8; font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 500;
}

.nx-top-right { margin-left: auto; display: flex; align-items: center; gap: .5rem; min-width: 0; }

/* Pills that sit on the dark bar. */
.nx-chip {
  display: inline-flex; align-items: center; gap: .45rem;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.14);
  color: #E2E8F0; border-radius: .6rem; padding: .4rem .7rem;
  font-size: .84rem; font-weight: 500; max-width: 15rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.nx-chip:hover { background: rgba(255,255,255,.16); color: #fff; }
.nx-chip i { font-size: .95rem; opacity: .9; }
.nx-chip.dropdown-toggle::after { margin-left: .1rem; opacity: .6; }

.nx-me { padding: .3rem .55rem; }
.nx-me img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.nx-ini {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, #EA580C, #F97316); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: .68rem; font-weight: 700;
}

.nx-search { position: relative; display: flex; align-items: center; }
.nx-search i {
  position: absolute; left: .65rem; font-size: .9rem; color: #94A3B8; pointer-events: none;
}
.nx-search input {
  width: min(300px, 26vw); background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.14); border-radius: .6rem;
  padding: .42rem 2rem .42rem 2rem; color: #fff; font-size: .85rem;
}
.nx-search input::placeholder { color: #94A3B8; }
.nx-search input:focus {
  outline: none; background: rgba(255,255,255,.16);
  border-color: rgba(249,115,22,.6); box-shadow: 0 0 0 3px rgba(234,88,12,.18);
}
.nx-search input::-webkit-search-cancel-button { filter: invert(1); opacity: .5; }
.nx-search kbd {
  position: absolute; right: .5rem; background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.16); border-radius: .3rem;
  padding: 0 .32rem; font-size: .68rem; color: #CBD5E1; line-height: 1.35;
}
.nx-search input:focus ~ kbd { opacity: 0; }

/* ---------------------------------------------------------------- area tabs */
.nx-tabs {
  height: var(--nx-tabs-h);
  background: var(--ax-surface);
  border-bottom: 1px solid var(--ax-border);
  display: flex; align-items: stretch; padding: 0 .5rem 0 .75rem; gap: .25rem;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.nx-tabs-scroll {
  display: flex; align-items: stretch; gap: .1rem; flex: 1; min-width: 0;
  overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}
.nx-tabs-scroll::-webkit-scrollbar { display: none; }

.nx-tab {
  position: relative; display: inline-flex; align-items: center; gap: .45rem;
  padding: 0 .8rem; white-space: nowrap; text-decoration: none;
  color: var(--ax-muted); font-size: .875rem; font-weight: 500;
  border-bottom: 2px solid transparent; scroll-snap-align: center;
  transition: color .16s, border-color .16s, background-color .16s;
}
.nx-tab i { font-size: 1rem; opacity: .8; }
.nx-tab:hover { color: var(--ax-text); background: var(--ax-surface-2); }
.nx-tab.active {
  color: var(--ax-secondary); border-bottom-color: var(--ax-secondary); font-weight: 600;
}
.nx-tab.active i { opacity: 1; }

.nx-tab-dot {
  min-width: 17px; height: 17px; padding: 0 .28rem; border-radius: 9px;
  background: var(--ax-danger); color: #fff;
  font-size: .64rem; font-weight: 700; line-height: 17px; text-align: center;
}

.nx-tab-set { border-left: 1px solid var(--ax-border); margin-left: .35rem; padding-left: .85rem; }

/* Edge fade so a half-cut tab reads as "there is more", not as a bug. */
.nx-tabs.is-scrollable { position: relative; }
.nx-tabs.is-scrollable::after {
  content: ''; position: absolute; right: 3.4rem; top: 0; bottom: 1px; width: 2rem;
  background: linear-gradient(to right, transparent, var(--ax-surface));
  pointer-events: none;
}

/* ---------------------------------------------------------------- the shell */
.nx-shell { display: flex; align-items: flex-start; min-height: calc(100vh - var(--nx-top-h)); }

.nx-side {
  width: var(--nx-side-w); flex: 0 0 var(--nx-side-w);
  position: sticky; top: var(--nx-top-h);
  height: calc(100vh - var(--nx-top-h));
  background: var(--ax-surface); border-right: 1px solid var(--ax-border);
  display: flex; flex-direction: column;
}

.nx-side-head {
  display: flex; align-items: center; gap: .5rem;
  padding: .85rem 1rem .6rem; font-family: var(--ax-font-head);
  font-weight: 600; font-size: .95rem; color: var(--ax-text);
}
.nx-side-head i { color: var(--ax-secondary); font-size: 1.05rem; }
.nx-side-head span { flex: 1; min-width: 0; }
.nx-side-close {
  border: 0; background: transparent; color: var(--ax-muted); font-size: .95rem;
  width: 30px; height: 30px; border-radius: .45rem;
}
.nx-side-close:hover { background: var(--ax-bg); color: var(--ax-text); }

.nx-side-scroll { flex: 1; overflow-y: auto; padding: 0 .6rem 1rem; }
.nx-side-scroll::-webkit-scrollbar { width: 6px; }
.nx-side-scroll::-webkit-scrollbar-thumb { background: var(--ax-border); border-radius: 4px; }

.nx-side-sec {
  font-size: .66rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: #94A3B8; padding: .85rem .55rem .3rem;
}
.nx-side-sec:first-child { padding-top: .25rem; }

.nx-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .5rem .6rem; margin-bottom: .1rem; border-radius: .55rem;
  color: #475569; text-decoration: none; font-size: .875rem; font-weight: 500;
  transition: background-color .15s, color .15s;
}
.nx-link i { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; opacity: .75; }
.nx-link span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-link:hover { background: var(--ax-bg); color: var(--ax-text); }
.nx-link.active {
  background: rgba(234,88,12,.09); color: #C2410C; font-weight: 600;
  box-shadow: inset 2px 0 0 var(--ax-secondary);
}
.nx-link.active i { opacity: 1; color: var(--ax-secondary); }
.nx-ext { font-size: .72rem !important; opacity: .45 !important; width: auto !important; }

.nx-count {
  min-width: 18px; padding: 0 .3rem; border-radius: 9px; text-align: center;
  font-size: .66rem; font-weight: 700; line-height: 18px;
}
.nx-count.danger { background: rgba(220,38,38,.12); color: #B91C1C; }
.nx-count.warn   { background: rgba(245,158,11,.16); color: #B45309; }

.nx-side-foot {
  border-top: 1px solid var(--ax-border); padding: .55rem .6rem;
  display: flex; align-items: center; gap: .4rem;
}
.nx-side-foot a {
  display: inline-flex; align-items: center; gap: .45rem; text-decoration: none;
  color: var(--ax-muted); font-size: .8rem; padding: .4rem .55rem; border-radius: .5rem;
}
.nx-side-foot a:first-child { flex: 1; }
.nx-side-foot a:hover { background: var(--ax-bg); color: var(--ax-text); }
.nx-side-foot a.out:hover { background: rgba(220,38,38,.1); color: var(--ax-danger); }

/* --------------------------------------------------------------- the canvas */
.nx-content {
  flex: 1; min-width: 0; padding: 1.35rem 1.5rem 2rem;
  display: flex; flex-direction: column;
}
.nx-content > *:not(.nx-foot) { flex-shrink: 0; }

.nx-crumb {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  font-size: .78rem; color: var(--ax-muted); margin-bottom: .85rem;
}
.nx-crumb strong { color: var(--ax-text); font-weight: 600; }
.nx-crumb .sep { font-size: .6rem; opacity: .5; }

.nx-foot {
  margin-top: auto; padding-top: 1.75rem;
  font-size: .78rem; color: var(--ax-muted);
}

.nx-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  opacity: 0; visibility: hidden; transition: opacity .2s, visibility .2s; z-index: 39;
}
.nx-overlay.show { opacity: 1; visibility: visible; }

/* ------------------------------------------------------------- focus states */
.nx-tab:focus-visible, .nx-link:focus-visible, .nx-chip:focus-visible,
.nx-burger:focus-visible, .nx-side-foot a:focus-visible {
  outline: 2px solid var(--ax-secondary); outline-offset: 2px; border-radius: .5rem;
}

/* ------------------------------------------------------------- narrow width */
@media (max-width: 1199.98px) {
  .nx-search input { width: min(220px, 24vw); }
}

@media (max-width: 991.98px) {
  :root { --nx-top-h: 102px; }

  .nx-side {
    position: fixed; top: 0; left: 0; bottom: 0; height: 100dvh; z-index: 50;
    transform: translateX(-100%); transition: transform .24s cubic-bezier(.16,1,.3,1);
    box-shadow: 0 18px 40px rgba(15,23,42,.18);
  }
  .nx-side.show { transform: translateX(0); }
  .nx-content   { padding: 1rem 1rem 2rem; }
}

@media (max-width: 575.98px) {
  .nx-top-bar   { padding: 0 .65rem; gap: .5rem; }
  .nx-brand-txt .sub { display: none; }
  .nx-brand img { height: 26px; }
  .nx-search    { display: none; }        /* the tabs need the room */
  .nx-chip      { max-width: 8.5rem; padding: .35rem .55rem; }
  .nx-tabs      { padding-left: .4rem; }
  .nx-tab       { padding: 0 .6rem; font-size: .82rem; }
  .nx-content   { padding: .85rem .75rem 2rem; }
}

@media print {
  .nx-top, .nx-side, .nx-overlay, .nx-skip, .nx-crumb { display: none !important; }
  .nx-content { padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .nx-side, .nx-overlay, .nx-tab, .nx-link, .nx-skip { transition: none !important; }
}

/* ==========================================================================
   PORTAL v2 — upgraded tab strip + thumb-reachable bottom bar on phones
   ========================================================================== */

.pt-account {
  display: flex; align-items: center; gap: .5rem;
  font-size: .78rem; color: var(--ax-muted);
}
.pt-kind {
  display: inline-flex; align-items: center; gap: .3rem;
  background: rgba(234,88,12,.1); color: #C2410C;
  border-radius: 20px; padding: .1rem .5rem; font-size: .68rem; font-weight: 600;
}

/* The desktop tab strip gets the same active treatment as the admin tabs. */
.pt-nav a.active { font-weight: 600; }
.pt-nav.is-scrollable { position: relative; }

/* Bottom bar: only on phones, only when there is more than one destination. */
.pt-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: none; background: color-mix(in srgb, var(--ax-surface) 94%, transparent);
  backdrop-filter: blur(14px) saturate(160%);
  border-top: 1px solid var(--ax-border);
  padding-bottom: env(safe-area-inset-bottom);
}
.pt-bottom-in { display: flex; }
.pt-bottom a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: .15rem;
  padding: .5rem .25rem .45rem; text-decoration: none;
  color: var(--ax-muted); font-size: .66rem; font-weight: 500; min-width: 0;
}
.pt-bottom a i { font-size: 1.15rem; }
.pt-bottom a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-bottom a.active { color: var(--ax-secondary); }
.pt-bottom a.active i { transform: translateY(-1px); }

@media (max-width: 767.98px) {
  .pt-bottom.has-items { display: block; }
  .pt-bottom.has-items ~ .pt-foot,
  body.has-bottom-nav .pt-main { padding-bottom: 4.75rem; }
  body.has-bottom-nav .pt-nav  { display: none; }   /* the bottom bar replaces it */
}

/* ==========================================================================
   BODY v2 — page surfaces, tables, toolbars, row actions
   --------------------------------------------------------------------------
   Refines the components every screen already uses (.ax-card, .ax-table,
   .ax-badge, .ax-empty) rather than introducing a parallel set, so all 60-odd
   views improve without being individually rewritten. New classes are additive
   and optional: .nx-toolbar, .nx-rowacts, .ax-ref, .num.
   ========================================================================== */

/* ------------------------------------------------------------------- cards */
.ax-card {
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.03);
}

/* The head is a two-part bar: what the page is, and what you can do to it. */
.ax-card-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: .75rem 1rem;
  padding: .95rem 1.15rem; border-bottom: 1px solid var(--ax-border);
}
.ax-card-head h2, .ax-card-head h3 {
  font-family: var(--ax-font-head); font-size: 1.02rem; font-weight: 600;
  margin: 0; display: flex; align-items: center; min-width: 0;
}
.ax-card-head h2 i, .ax-card-head h3 i { color: var(--ax-secondary); opacity: .9; }
.ax-card-head > .d-flex { flex-wrap: wrap; }

/* A count next to a title is context, not a heading — quiet it down. */
.ax-card-head .ax-muted.fw-normal { font-size: .92rem; font-weight: 500 !important; }

/* --------------------------------------------------------------- toolbars */
/* Filters read as a single control group, distinct from page actions. */
.nx-toolbar {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  background: var(--ax-surface-2); border: 1px solid var(--ax-border);
  border-radius: .6rem; padding: .25rem .3rem;
}
.nx-toolbar .form-select,
.nx-toolbar .form-control {
  border: 1px solid transparent; background: transparent;
  box-shadow: none; font-size: .82rem; height: 30px; padding: .1rem .5rem;
}
.nx-toolbar .form-select:focus,
.nx-toolbar .form-control:focus {
  background: var(--ax-surface); border-color: var(--ax-border);
  box-shadow: 0 0 0 3px rgba(234,88,12,.12);
}
.nx-toolbar .btn { height: 30px; padding: .1rem .7rem; font-size: .82rem; }
.nx-toolbar-sep { width: 1px; align-self: stretch; background: var(--ax-border); margin: .15rem .1rem; }

/* A one-line summary under the head: "4 orders · ₹607.00 · 1 late". */
.nx-summary {
  display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; align-items: center;
  padding: .6rem 1.15rem; border-bottom: 1px solid var(--ax-border);
  background: var(--ax-surface-2); font-size: .82rem; color: var(--ax-muted);
}
.nx-summary b { color: var(--ax-text); font-weight: 600; }
.nx-summary .warn { color: #B45309; }
.nx-summary .bad  { color: var(--ax-danger); }

/* ------------------------------------------------------------------ tables */
.ax-table thead th {
  font-size: .68rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: #94A3B8; background: var(--ax-surface-2);
  padding: .6rem .85rem; white-space: nowrap; border-bottom: 1px solid var(--ax-border);
}
.ax-table tbody td {
  padding: .7rem .85rem; vertical-align: middle;
  border-bottom: 1px solid var(--ax-border); font-size: .875rem;
}
.ax-table tbody tr:hover { background: #FBFCFE; }

/* Money and counts line up only if the digits are the same width. */
.ax-table .num, .ax-table th.num, .nx-num {
  text-align: right; font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum"; white-space: nowrap;
}
.ax-table td.num { font-weight: 600; }

/* The quiet second line under a cell's main value. */
.ax-sub { font-size: .76rem; color: var(--ax-muted); margin-top: .1rem; line-height: 1.3; }

/* A machine reference (order id, SKU, licence key) is for reading and copying,
   not for shouting. Monospace and muted, never link-coloured. */
.ax-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .76rem; color: #64748B; background: var(--ax-surface-2);
  border: 1px solid var(--ax-border); border-radius: .35rem;
  padding: .08rem .35rem; display: inline-block; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}
a.ax-ref:hover { color: var(--ax-secondary); border-color: var(--ax-secondary); }

/* --------------------------------------------------------- row actions */
/* Four separate buttons per row is four times the visual weight of one.
   Group them so a row reads as one control cluster. */
.nx-rowacts { display: inline-flex; align-items: center; gap: .3rem; flex-wrap: nowrap; }
.nx-rowacts form { display: inline; margin: 0; }
.nx-rowacts .btn { padding: .2rem .55rem; font-size: .78rem; line-height: 1.45; }

/* Segmented group: buttons sit flush, so they read as one object. */
.nx-seg { display: inline-flex; border-radius: .5rem; overflow: hidden; border: 1px solid var(--ax-border); }
.nx-seg form { display: inline; margin: 0; }
.nx-seg > *, .nx-seg form > .btn {
  border: 0 !important; border-radius: 0 !important;
  padding: .22rem .6rem; font-size: .78rem; background: var(--ax-surface);
  color: var(--ax-text); line-height: 1.5;
}
.nx-seg > *:not(:last-child), .nx-seg form:not(:last-child) > .btn { border-right: 1px solid var(--ax-border) !important; }
.nx-seg .btn:hover { background: var(--ax-surface-2); color: var(--ax-secondary); }
.nx-seg .btn-ax-primary, .nx-seg .go {
  background: linear-gradient(135deg, #EA580C, #F97316); color: #fff; font-weight: 600;
}
.nx-seg .btn-ax-primary:hover, .nx-seg .go:hover { filter: brightness(1.06); color: #fff; }

/* Icon-only, for the destructive action that should not compete. */
.nx-ico {
  width: 28px; height: 28px; padding: 0 !important; display: inline-flex;
  align-items: center; justify-content: center; border-radius: .45rem;
  border: 1px solid var(--ax-border); background: var(--ax-surface);
  color: var(--ax-muted); font-size: .8rem;
}
.nx-ico:hover { color: var(--ax-danger); border-color: #FCA5A5; background: rgba(220,38,38,.06); }
.nx-ico.plain:hover { color: var(--ax-secondary); border-color: var(--ax-secondary); background: rgba(234,88,12,.06); }

/* ------------------------------------------------------------- status tone */
.ax-badge-ok      { background: rgba(22,163,74,.12);  color: #15803D; }
.ax-badge-info    { background: rgba(14,165,233,.13); color: #0369A1; }
.ax-badge-warn    { background: rgba(245,158,11,.16); color: #B45309; }
.ax-badge-bad     { background: rgba(220,38,38,.11);  color: #B91C1C; }
.ax-badge-muted   { background: rgba(100,116,139,.12);color: #64748B; }

/* ------------------------------------------------------------ empty states */
.ax-empty { padding: 2.75rem 1.25rem; }
.ax-empty i { font-size: 2.2rem; color: #CBD5E1; }
.ax-empty p { margin-bottom: .9rem; }

/* ------------------------------------------------------------------- forms */
.form-control:focus, .form-select:focus {
  border-color: rgba(249,115,22,.65);
  box-shadow: 0 0 0 3px rgba(234,88,12,.14);
}

/* --------------------------------------------------------------- narrow */
@media (max-width: 640px) {
  .ax-card-head { padding: .8rem .9rem; }
  .nx-summary   { padding: .55rem .9rem; }
  /* In stacked card mode the action cluster gets its own line. */
  .nx-rowacts, .nx-seg { flex-wrap: wrap; }
}

/* ==========================================================================
   BODY v3 — control sizing, page headers, settings surface
   --------------------------------------------------------------------------
   Two things were wrong with the body after v2.

   1. Every control in a card head sized itself independently. Bootstrap gives
      .form-control width:100%, so a search box inside a flex head claimed the
      whole row and pushed its own button onto the next line — the "giant
      search bar" on every list screen. Controls in a head are now one height
      (34px) and one rhythm, and none of them may grow.

   2. Configuration screens rendered as a wall: thirteen tab pills wrapping
      onto two rows, every field captioned with its raw database key, one
      button at the bottom of a very long page. Settings now use a vertical
      rail, grouped cards, real help text, and a save bar that stays with you.

   As with v2 this refines classes the views already use, so screens that are
   not touched individually still improve.
   ========================================================================== */

/* ------------------------------------------------------------ the top search
   It jumps you to a results page; it is not the page's main input, and at
   300px it read as one. Small, fixed, and out of the way. */
.nx-search input {
  width: 200px; height: 34px; font-size: .82rem;
  padding: 0 2.1rem 0 2rem; border-radius: .55rem;
}
@media (max-width: 1399.98px) { .nx-search kbd { display: none; } .nx-search input { padding-right: .6rem; } }
@media (max-width: 1199.98px) { .nx-search input { width: 158px; } }

/* ------------------------------------------------------------- card heading
   Title takes the slack; everything else is exactly as wide as it needs. */
.ax-card-head { padding: .8rem 1.05rem; gap: .55rem .9rem; }
.ax-card-head > h2, .ax-card-head > h3 { flex: 1 1 12rem; }
.ax-card-head > *:not(h2):not(h3) { flex: 0 0 auto; max-width: 100%; min-width: 0; }  /* a tool row wider than the card wraps instead of running off the edge */
.ax-card-head .form-control,
.ax-card-head .form-select { width: auto; }

/* One row of head actions, all the same height, right-aligned. */
.nx-head-acts {
  display: flex; align-items: center; justify-content: flex-end;
  gap: .4rem; flex-wrap: wrap;
}
.nx-head-acts .btn,
.nx-page-acts .btn {
  height: 34px; padding: 0 .8rem; font-size: .83rem;
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
}
.nx-head-acts .btn i, .nx-page-acts .btn i { font-size: .9rem; }

/* ------------------------------------------------------------ compact field
   The list-screen search, filter and date inputs. Fixed width, icon inside,
   same 34px as the buttons beside it. */
.nx-field { position: relative; display: inline-flex; align-items: center; }
.nx-field > i {
  position: absolute; left: .62rem; font-size: .82rem;
  color: #94A3B8; pointer-events: none;
}
.nx-field > input,
.nx-field > select {
  height: 34px; width: 210px; max-width: 100%;
  border: 1px solid var(--ax-border); border-radius: .55rem;
  background: var(--ax-surface); color: var(--ax-text);
  padding: 0 .65rem 0 2rem; font-size: .84rem; line-height: 32px;
  appearance: none;
}
.nx-field.sm > input, .nx-field.sm > select { width: 150px; }
.nx-field.bare > input, .nx-field.bare > select { padding-left: .65rem; }
.nx-field > select { padding-right: 1.8rem; background-image: none; }
.nx-field.sel::after {
  content: ''; position: absolute; right: .7rem; pointer-events: none;
  width: .42rem; height: .42rem; border-right: 1.5px solid #94A3B8;
  border-bottom: 1.5px solid #94A3B8; transform: translateY(-2px) rotate(45deg);
}
.nx-field > input:focus, .nx-field > select:focus {
  outline: none; border-color: rgba(249,115,22,.65);
  box-shadow: 0 0 0 3px rgba(234,88,12,.12);
}
.nx-field > input::-webkit-search-cancel-button { cursor: pointer; }

/* Filters that belong together keep the v2 grouping, at the new height. */
.nx-toolbar { padding: .22rem .28rem; gap: .3rem; }
.nx-toolbar .form-control,
.nx-toolbar .form-select { width: auto; flex: 0 1 auto; }
.nx-toolbar .nx-field > input,
.nx-toolbar .nx-field > select {
  height: 28px; line-height: 26px; border-color: transparent; background: transparent;
}
.nx-toolbar .btn { height: 28px; }

/* --------------------------------------------------------------- page header
   Title, one line of context, and the page's own actions — above the card,
   so the card head is free to be a toolbar. */
.nx-page {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: .6rem 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.nx-page-tx { min-width: 0; }
.nx-page h1 {
  font-family: var(--ax-font-head); font-size: 1.25rem; font-weight: 700;
  letter-spacing: -.012em; margin: 0; display: flex; align-items: center; gap: .5rem;
}
.nx-page h1 i { color: var(--ax-secondary); font-size: 1.15rem; }
.nx-page p { margin: .3rem 0 0; font-size: .82rem; color: var(--ax-muted); max-width: 74ch; }
.nx-page-acts { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }

/* ------------------------------------------------------------- KPI strip
   Four numbers that answer "is anything wrong?" before the table does. */
.nx-kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr));
  gap: .7rem; margin-bottom: 1rem;
}
.nx-kpi {
  display: flex; align-items: flex-start; gap: .65rem;
  background: var(--ax-surface); border: 1px solid var(--ax-border);
  border-radius: 12px; padding: .75rem .85rem; text-decoration: none; color: inherit;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
a.nx-kpi:hover { border-color: rgba(234,88,12,.4); color: inherit; }
.nx-kpi .ic {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 1rem;
  background: rgba(100,116,139,.1); color: #64748B;
}
.nx-kpi .v {
  font-family: var(--ax-font-head); font-size: 1.28rem; font-weight: 700;
  line-height: 1.15; font-variant-numeric: tabular-nums;
}
.nx-kpi .l { font-size: .76rem; color: var(--ax-muted); margin-top: .05rem; }
.nx-kpi.on   .ic { background: rgba(234,88,12,.1);  color: #C2410C; }
.nx-kpi.ok   .ic { background: rgba(22,163,74,.12); color: #15803D; }
.nx-kpi.warn .ic { background: rgba(245,158,11,.16);color: #B45309; }
.nx-kpi.bad  .ic { background: rgba(220,38,38,.11); color: #B91C1C; }
.nx-kpi.bad  .v  { color: #B91C1C; }

/* ---------------------------------------------------------------- density
   Rows were tall enough that eight of them filled the screen. */
.ax-table thead th { padding: .5rem .8rem; }
.ax-table tbody td { padding: .58rem .8rem; font-size: .86rem; }
.ax-table tbody tr td:first-child { padding-left: 1.05rem; }
.ax-table tbody tr td:last-child  { padding-right: 1.05rem; }
.ax-table thead th:first-child { padding-left: 1.05rem; }
.ax-table thead th:last-child  { padding-right: 1.05rem; }

/* The clickable name in a list row. */
.nx-title { font-weight: 600; color: var(--ax-text); text-decoration: none; }
.nx-title:hover { color: var(--ax-secondary); text-decoration: underline; }
.nx-slug {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .72rem; color: #94A3B8; margin-top: .1rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 22rem;
}

/* An icon is a picture, not a string. Printing "globe2" beside the globe
   told you what the developer typed, not what the row is. */
.nx-icotile {
  width: 32px; height: 32px; border-radius: .5rem;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ax-surface-2); border: 1px solid var(--ax-border);
  color: var(--ax-secondary); font-size: 1rem;
}

/* ------------------------------------------------------------ empty states */
.ax-empty { padding: 2.5rem 1.25rem; }
.ax-empty i { font-size: 2rem; color: #CBD5E1; margin-bottom: .55rem; }
.ax-empty p { font-size: .88rem; margin-bottom: .85rem; }
.ax-empty .btn { height: 34px; padding: 0 .9rem; font-size: .83rem; display: inline-flex; align-items: center; gap: .35rem; }

/* ==========================================================================
   SETTINGS SURFACE
   ========================================================================== */

.nx-set { display: grid; grid-template-columns: 15rem minmax(0, 1fr); gap: 1rem; align-items: start; }

.nx-set-rail {
  position: sticky; top: calc(var(--nx-top-h) + .9rem);
  background: var(--ax-surface); border: 1px solid var(--ax-border);
  border-radius: 12px; padding: .4rem;
  max-height: calc(100vh - var(--nx-top-h) - 2rem); overflow-y: auto;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.nx-set-rail::-webkit-scrollbar { width: 6px; }
.nx-set-rail::-webkit-scrollbar-thumb { background: var(--ax-border); border-radius: 4px; }
.nx-set-rail .hd {
  font-size: .64rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: #94A3B8; padding: .45rem .6rem .3rem;
}

.nx-set-tab {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  text-align: left; border: 0; background: transparent; border-radius: .55rem;
  padding: .48rem .6rem; margin-bottom: .05rem;
  font-size: .855rem; font-weight: 500; color: #475569; font-family: inherit;
  transition: background-color .15s, color .15s;
}
.nx-set-tab i { width: 18px; text-align: center; font-size: 1rem; opacity: .75; flex-shrink: 0; }
.nx-set-tab .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-set-tab .c {
  font-size: .66rem; font-weight: 600; color: #94A3B8;
  background: var(--ax-surface-2); border-radius: 9px; padding: 0 .35rem; line-height: 1.45;
}
.nx-set-tab:hover { background: var(--ax-bg); color: var(--ax-text); }
.nx-set-tab.active {
  background: rgba(234,88,12,.09); color: #C2410C; font-weight: 600;
  box-shadow: inset 2px 0 0 var(--ax-secondary);
}
.nx-set-tab.active i { color: var(--ax-secondary); opacity: 1; }
.nx-set-tab.active .c { background: rgba(234,88,12,.14); color: #C2410C; }
.nx-set-tab:focus-visible { outline: 2px solid var(--ax-secondary); outline-offset: -2px; }

/* Panel: a card per group, with a real heading and a sentence of purpose. */
.nx-set-panel > .ax-card { margin-bottom: 1rem; }
.nx-set-head { padding: .95rem 1.15rem .1rem; }
.nx-set-head h2 { font-family: var(--ax-font-head); font-size: 1.02rem; font-weight: 600; margin: 0; }
.nx-set-head p  { margin: .3rem 0 0; font-size: .81rem; color: var(--ax-muted); max-width: 72ch; }

/* Field grid. Two columns on a wide screen, one on a narrow one — and a
   textarea always takes the full width, so it is not a letterbox. */
.nx-fgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.15rem; }
.nx-fgrid .wide { grid-column: 1 / -1; }
@media (max-width: 767.98px) { .nx-fgrid { grid-template-columns: minmax(0, 1fr); } }

.nx-f label.form-label { margin-bottom: .3rem; }
.nx-fhelp { font-size: .765rem; color: var(--ax-muted); margin-top: .3rem; line-height: 1.45; }

/* The raw database key is a developer's detail. It is still there, one click
   away, instead of captioning every field on the page. */
.nx-fkey {
  display: none; margin-top: .3rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .7rem;
  color: #94A3B8; background: var(--ax-surface-2);
  border: 1px solid var(--ax-border); border-radius: .3rem; padding: 0 .3rem;
}
.nx-keys-cb { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.nx-keys-cb:checked ~ .nx-set .nx-fkey { display: inline-block; }

.nx-keyswitch {
  display: inline-flex; align-items: center; gap: .45rem; cursor: pointer;
  font-size: .78rem; color: var(--ax-muted); user-select: none;
  background: var(--ax-surface); border: 1px solid var(--ax-border);
  border-radius: 20px; padding: .3rem .7rem .3rem .55rem; height: 34px;
}
.nx-keyswitch:hover { color: var(--ax-text); }
.nx-keyswitch .dot {
  width: 26px; height: 15px; border-radius: 9px; background: #CBD5E1;
  position: relative; transition: background-color .16s; flex-shrink: 0;
}
.nx-keyswitch .dot::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px;
  border-radius: 50%; background: #fff; transition: transform .16s;
  box-shadow: 0 1px 2px rgba(15,23,42,.25);
}
.nx-keys-cb:checked ~ .nx-page .nx-keyswitch .dot { background: var(--ax-secondary); }
.nx-keys-cb:checked ~ .nx-page .nx-keyswitch .dot::after { transform: translateX(11px); }
.nx-keys-cb:focus-visible ~ .nx-page .nx-keyswitch { outline: 2px solid var(--ax-secondary); outline-offset: 2px; }

/* On/off settings read as a list of statements, not as stray checkboxes
   floating half a line below their neighbours. */
.nx-switches { display: flex; flex-direction: column; }
.nx-switch-row {
  display: flex; align-items: flex-start; gap: 1rem;
  padding: .7rem 0; border-bottom: 1px solid var(--ax-border);
}
.nx-switch-row:first-child { padding-top: .1rem; }
.nx-switch-row:last-child  { border-bottom: 0; padding-bottom: .1rem; }
.nx-switch-row .tx { flex: 1; min-width: 0; }
.nx-switch-row .tx b { display: block; font-size: .875rem; font-weight: 600; }
.nx-switch-row .form-check { margin: 0; padding-left: 0; min-height: 0; flex-shrink: 0; }
.nx-switch-row .form-check-input {
  margin: 0; float: none; width: 2.15rem; height: 1.2rem; cursor: pointer;
}

/* Save bar: it follows you down a long form instead of hiding at the bottom. */
.nx-savebar {
  position: sticky; bottom: 0; z-index: 20; margin-top: 1rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem .9rem; flex-wrap: wrap;
  background: var(--ax-surface);
  background: color-mix(in srgb, var(--ax-surface) 92%, transparent);
  backdrop-filter: blur(10px) saturate(150%);
  border: 1px solid var(--ax-border); border-radius: 12px; padding: .6rem .85rem;
  box-shadow: 0 -2px 16px rgba(15,23,42,.07);
}
.nx-savebar .note { font-size: .78rem; color: var(--ax-muted); }
.nx-savebar .acts { display: flex; align-items: center; gap: .45rem; margin-left: auto; }
.nx-savebar .btn { height: 36px; padding: 0 1rem; font-size: .85rem; display: inline-flex; align-items: center; gap: .4rem; }

@media (max-width: 991.98px) {
  .nx-set { grid-template-columns: minmax(0, 1fr); }
  .nx-set-rail {
    position: static; max-height: none; display: flex; gap: .2rem;
    overflow-x: auto; scrollbar-width: none; padding: .3rem;
  }
  .nx-set-rail::-webkit-scrollbar { display: none; }
  .nx-set-rail .hd { display: none; }
  .nx-set-tab { width: auto; white-space: nowrap; box-shadow: none !important; }
  .nx-set-tab .c { display: none; }
}

@media (max-width: 640px) {
  .nx-head-acts { width: 100%; justify-content: flex-start; }
  .nx-field { display: flex; flex: 1 1 12rem; }
  .nx-field > input, .nx-field > select { width: 100%; }
  .nx-page h1 { font-size: 1.12rem; }
  .nx-savebar { padding: .55rem .65rem; }
  .nx-savebar .note { display: none; }
  .nx-savebar .acts { width: 100%; }
  .nx-savebar .btn { flex: 1; justify-content: center; }
}

/* ------------------------------------------------------- card head, part 2
   A card head now leads with what you are looking at rather than repeating
   the page title, so it needs a lead slot that is allowed to take the slack. */
.nx-head-lead {
  flex: 1 1 12rem; min-width: 0; margin: 0;
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  font-family: var(--ax-font-head); font-size: .9rem; font-weight: 600;
  color: var(--ax-text);
}
.nx-head-lead .ax-muted { font-weight: 500; }

/* The active filter, shown as something you can take off again. */
.nx-fchip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: rgba(234,88,12,.09); color: #C2410C;
  border: 1px solid rgba(234,88,12,.22); border-radius: 20px;
  padding: .12rem .3rem .12rem .55rem; font-size: .78rem; font-weight: 600;
  max-width: 18rem; overflow: hidden;
}
.nx-fchip > i { font-size: .72rem; opacity: .8; }
.nx-fchip a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; color: inherit;
  text-decoration: none; flex-shrink: 0;
}
.nx-fchip a:hover { background: rgba(234,88,12,.18); color: #9A3412; }
.nx-fchip a i { font-size: .6rem; }

.nx-pager { padding: .85rem 1.05rem; border-top: 1px solid var(--ax-border); }
.nx-pager .pagination { margin: 0; }

/* ------------------------------------------------------------- form tabs
   Segmented, so a form with three sections does not look like navigation. */
.nx-ftabs {
  display: inline-flex; gap: .15rem; margin-bottom: 1rem; padding: .25rem;
  background: var(--ax-surface-2); border: 1px solid var(--ax-border);
  border-radius: .7rem; max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.nx-ftabs::-webkit-scrollbar { display: none; }
.nx-ftab {
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
  border: 0; background: transparent; border-radius: .55rem;
  padding: .38rem .8rem; font-family: var(--ax-font-head);
  font-size: .85rem; font-weight: 500; color: var(--ax-muted);
  transition: background-color .15s, color .15s;
}
.nx-ftab:hover { color: var(--ax-text); }
.nx-ftab.active { background: var(--ax-surface); color: var(--ax-text); font-weight: 600; box-shadow: 0 1px 2px rgba(15,23,42,.08); }
.nx-ftab .c { font-size: .68rem; font-weight: 600; color: #94A3B8; }
.nx-ftab.active .c { color: var(--ax-secondary); }
.nx-ftab:focus-visible { outline: 2px solid var(--ax-secondary); outline-offset: 1px; }

/* --------------------------------------------------------- 12-column grid
   The field schema already says how wide each field should be. A real grid
   honours 4- and 8-wide fields, which the old row/col markup rounded off. */
.nx-fgrid12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem 1.15rem; }
.nx-fgrid12 > .nx-f { grid-column: span 12; min-width: 0; }
.nx-fgrid12 > .nx-f[data-col="3"] { grid-column: span 3; }
.nx-fgrid12 > .nx-f[data-col="4"] { grid-column: span 4; }
.nx-fgrid12 > .nx-f[data-col="6"] { grid-column: span 6; }
.nx-fgrid12 > .nx-f[data-col="8"] { grid-column: span 8; }
@media (max-width: 991.98px) { .nx-fgrid12 > .nx-f[data-col="3"], .nx-fgrid12 > .nx-f[data-col="4"] { grid-column: span 6; } }
@media (max-width: 767.98px) { .nx-fgrid12 > .nx-f { grid-column: span 12 !important; } }

.nx-f .req { color: var(--ax-danger); font-weight: 700; cursor: help; }

/* ----------------------------------------------------------- compact list
   Short key/value rows inside a side card — previously an inline-styled
   d-flex with a !important border on every row. */
.nx-list { display: flex; flex-direction: column; }
.nx-list-row {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .55rem 1.05rem; border-bottom: 1px solid var(--ax-border); font-size: .82rem;
}
.nx-list-row.col { display: block; }
.nx-list-row:last-child { border-bottom: 0; }
.nx-list-row .k { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-list-row .v { flex-shrink: 0; color: var(--ax-muted); }
.nx-list-row .v b { color: var(--ax-text); font-variant-numeric: tabular-nums; }
.nx-list-row.more { justify-content: center; color: var(--ax-muted); font-size: .78rem; }

/* A select needs no magnifying glass, so it starts where its text starts. */
.nx-field.sel > select { padding-left: .65rem; }
/* A section with no match while you are searching, kept in place but quiet. */
.nx-set-tab.dim { opacity: .38; }

/* ==========================================================================
   LEGACY UPLIFT
   --------------------------------------------------------------------------
   Fifty-odd screens were written before .nx-page and .nx-head-acts existed.
   Rather than rewrite them one at a time, the two shapes they already use get
   the new proportions: a page heading above the card, and controls in a card
   head. Nothing here changes markup — only how the existing markup lands.
   ========================================================================== */

/* A screen that opens with a flex row holding an <h2 class="h5"> is a page
   header in older clothes. Give it the weight and spacing of .nx-page. */
.nx-content > .d-flex:has(h2.h5) { align-items: flex-start; margin-bottom: 1rem !important; }
.nx-content > .d-flex h2.h5,
.nx-content > form > .d-flex h2.h5 {
  font-family: var(--ax-font-head); font-size: 1.25rem; font-weight: 700;
  letter-spacing: -.012em; line-height: 1.25;
}
.nx-content > .d-flex h2.h5 i,
.nx-content > form > .d-flex h2.h5 i { color: var(--ax-secondary); font-size: 1.15rem; }
.nx-content > .d-flex > div > .small.ax-muted { font-size: .82rem; margin-top: .25rem; }

/* Every control in a page header or a card head is one height. This is what
   stops a search box from sizing itself and pushing its button onto the next
   line — the single most visible fault in the old body. */
.nx-content > .d-flex:has(h2.h5) .btn,
.ax-card-head .btn {
  height: 34px; padding: 0 .8rem; font-size: .83rem;
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
}
.ax-card-head .form-control,
.ax-card-head .form-select,
.nx-content > .d-flex:has(h2.h5) .form-control,
.nx-content > .d-flex:has(h2.h5) .form-select {
  height: 34px; width: auto; max-width: 100%; font-size: .84rem; padding: 0 .65rem;
}
.ax-card-head form.d-flex,
.nx-content > .d-flex:has(h2.h5) form.d-flex { align-items: center; }

/* A button that is only an icon should be square, not a wide slab. */
.ax-card-head .btn > i:only-child { margin: 0; }

/* The remaining pill tab strips (SEO, email, WhatsApp, Zoho) match the
   segmented control the forms now use, instead of a row of solid orange. */
.nav-pills.ax-tabs {
  display: inline-flex; flex-wrap: wrap; gap: .15rem !important; padding: .25rem;
  background: var(--ax-surface-2); border: 1px solid var(--ax-border); border-radius: .7rem;
  max-width: 100%;
}
.ax-tabs .nav-link { padding: .38rem .8rem; font-size: .85rem; font-weight: 500; }
.ax-tabs .nav-link:hover { color: var(--ax-text); }
.ax-tabs .nav-link.active {
  background: var(--ax-surface); color: var(--ax-text); font-weight: 600;
  box-shadow: 0 1px 2px rgba(15,23,42,.08);
}
.ax-tabs .nav-link.active i { color: var(--ax-secondary); }

/* A KPI is a number with a caption under it, not a number and a caption side
   by side — inline spans put them on one line. */
.nx-kpi .tx { display: flex; flex-direction: column; min-width: 0; }
.nx-kpi .l { line-height: 1.35; }
.ax-empty .btn i { font-size: .9rem; }

/* ------------------------------------------------- segmented group, fixed
   Two faults carried over from v2. The links and the form buttons in a
   Pack / Label / RTD group sat on different baselines, because only the
   buttons were flex items; and RTD never turned orange, because
   `.nx-seg form > .btn` outranks `.nx-seg .go` on specificity no matter which
   is written last. Both are decided here rather than by accident. */
.nx-seg { align-items: stretch; }
.nx-seg form { display: inline-flex; }
.nx-seg > *, .nx-seg form > .btn {
  display: inline-flex; align-items: center; justify-content: center;
}
.nx-seg form > .btn.go,
.nx-seg form > .btn.btn-ax-primary,
.nx-seg > a.go, .nx-seg > a.btn-ax-primary {
  background: linear-gradient(135deg, #EA580C, #F97316); color: #fff; font-weight: 600;
}
.nx-seg form > .btn.go:hover,
.nx-seg form > .btn.btn-ax-primary:hover { filter: brightness(1.06); color: #fff; }

/* ------------------------------------------------- legacy row actions, fixed
   Two faults that showed up on every list written before .nx-rowacts.

   .ax-icon-btn was display:grid — a block-level box. Inside the inline forms
   these buttons sit in, each one took its own line, so a row with four actions
   grew a vertical tower of buttons down its right-hand side and tripled the
   row height. white-space:nowrap on the cell could not fix that; only making
   the button itself an inline box could.

   And the heading flex from v2 swallowed the space in "Quotations (3)",
   because whitespace between flex items is discarded. */
.ax-icon-btn { display: inline-grid; width: 32px; height: 32px; border-radius: .5rem; vertical-align: middle; }
.ax-icon-btn + .ax-icon-btn { margin-left: .25rem; }
.ax-table td.ax-cell-actions form { display: inline-flex; margin: 0 0 0 .25rem; vertical-align: middle; }
.ax-table td.ax-cell-actions form:first-child { margin-left: 0; }
.ax-card-head h2, .ax-card-head h3 { gap: .4rem; }

/* ==========================================================================
   AUTH SCREENS — the device list only
   --------------------------------------------------------------------------
   The sign-in and code screens carry their own styles inline, in
   views/partials/auth-styles.php. A sign-in page is the one page that has to
   work when something else has gone wrong, and depending on this file meant
   that an upload which missed it left the door to the panel as an unstyled
   column of full-width boxes. Only the device list stays here, because it
   renders inside the admin and portal layouts, which load this file anyway.
   ========================================================================== */

/* Devices list, shown on the profile and portal account screens. */
.nx-dev { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--ax-border); }
.nx-dev:last-child { border-bottom: 0; }
.nx-dev .ic {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--ax-surface-2); color: var(--ax-muted); font-size: 1rem;
}
.nx-dev .tx { flex: 1; min-width: 0; }
.nx-dev .tx b { display: block; font-size: .875rem; font-weight: 600; }
.nx-dev .tx span { display: block; font-size: .76rem; color: var(--ax-muted); }
.nx-dev.here .ic { background: rgba(22,163,74,.12); color: #15803D; }

/* ===========================================================================
   CHROME v2 — pinned slim footer + a brand mark that survives a dark bar
   Appended 2026-09-08. Later rules win; nothing above is edited.
   =========================================================================== */

:root { --nx-foot-h: 26px; }

/* --- the footer ----------------------------------------------------------
   Was the last thing at the bottom of a scrolling canvas, so on the orders
   list you met it only after scrolling past sixty rows. Now it is pinned to
   the viewport, one line tall, and the canvas reserves its height so it can
   never sit on top of the final row. */
.nx-foot {
  position: fixed; left: var(--nx-side-w); right: 0; bottom: 0; z-index: 30;
  box-sizing: border-box;   /* padding must not add to the reserved height */
  height: var(--nx-foot-h); display: flex; align-items: center; gap: .35rem;
  margin: 0; padding: 0 1.5rem;
  font-size: .705rem; line-height: 1; letter-spacing: .005em;
  color: var(--ax-muted, #64748B);
  background: color-mix(in srgb, var(--ax-bg, #F1F5F9) 88%, transparent);
  border-top: 1px solid var(--ax-border, #E2E8F0);
  backdrop-filter: blur(6px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* color-mix is not everywhere yet; a flat background is a fine fallback. */
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .nx-foot { background: var(--ax-bg, #F1F5F9); }
}
.nx-foot .sep { opacity: .45; }
.nx-foot .dim { opacity: .72; }

.nx-content { padding-bottom: calc(var(--nx-foot-h) + 1.1rem); }

/* Off-canvas sidebar: the bar spans the full width. */
@media (max-width: 991.98px) {
  .nx-foot    { left: 0; padding: 0 1rem; }
  .nx-content { padding-bottom: calc(var(--nx-foot-h) + .9rem); }
}
@media (max-width: 575.98px) {
  .nx-foot { font-size: .66rem; padding: 0 .75rem; }
}
/* Printing a manifest or an invoice should not carry the chrome. */
@media print { .nx-foot { display: none; } }

/* --- the brand mark ------------------------------------------------------
   30px was sized for the padded website lockup. The mark's artwork fills its
   canvas, so at the same number it read noticeably smaller than the portal's
   and looked lost against the dark bar. */
.nx-brand img {
  height: 34px; width: auto; max-width: 150px; object-fit: contain;
  /* The mark is drawn for light backgrounds; a hair of lift keeps its edges
     from dissolving into the near-black header. */
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.nx-brand-txt .nm { font-size: 1.02rem; font-weight: 700; letter-spacing: -.01em; }
.nx-brand-txt .sub { font-size: .625rem; color: #A8B4C4; }

@media (max-width: 991.98px) { .nx-brand img { height: 30px; } }
@media (max-width: 575.98px) { .nx-brand img { height: 28px; } }

/* The portal's footer is styled inline in views/layouts/portal.php — that
   block is inline and always wins over this file, so keeping a copy here
   only creates a second source of truth. Deliberately not repeated. */


/* An icon action that reflects something already done, still clickable to do
   it again: is-sent = a quotation's email / WhatsApp / SMS already went out;
   is-on = the document is already in Zoho Books (re-pushing updates it).
   Both read as light green. ".wr" too: wr-modern.css (loaded after this file)
   restyles every .wr .ax-icon-btn, which used to hide these states. */
.ax-icon-btn.is-sent, .wr .ax-icon-btn.is-sent,
.ax-icon-btn.is-on, .wr .ax-icon-btn.is-on { background: #F0FDF4; color: #22C55E; border-color: #BBF7D0; }
.ax-icon-btn.is-sent:hover, .wr .ax-icon-btn.is-sent:hover,
.ax-icon-btn.is-on:hover, .wr .ax-icon-btn.is-on:hover { background: #DCFCE7; color: #16A34A; border-color: #86EFAC; }
.ax-icon-btn.is-sent:disabled, .wr .ax-icon-btn.is-sent:disabled { opacity: .75; }
html[data-bs-theme="dark"] .ax-icon-btn.is-sent, html[data-bs-theme="dark"] .wr .ax-icon-btn.is-sent,
html[data-bs-theme="dark"] .ax-icon-btn.is-on, html[data-bs-theme="dark"] .wr .ax-icon-btn.is-on { background: rgba(74,222,128,.10); color: #4ADE80; border-color: rgba(74,222,128,.35); }
html[data-bs-theme="dark"] .ax-icon-btn.is-sent:hover, html[data-bs-theme="dark"] .wr .ax-icon-btn.is-sent:hover,
html[data-bs-theme="dark"] .ax-icon-btn.is-on:hover, html[data-bs-theme="dark"] .wr .ax-icon-btn.is-on:hover { background: rgba(74,222,128,.18); color: #86EFAC; }

/* ===========================================================================
   LINE ITEMS v2 — editable rows that are not a table
   Appended 2026-09-08.

   Line items were an eight-column <table> of inputs: Item 250px, then HSN 90,
   Qty 80, Unit 80, Rate 120, GST 80, Amount 110. Once cell padding and the
   number spinners took their share, Qty and GST had roughly forty usable
   pixels — enough to show a comma and not the number. On a phone it was
   unusable.

   A row of inputs is a form, not a table: nothing is being compared down a
   column, so the grid buys nothing and costs every field its width. These rows
   are cards with labelled fields that wrap when they run out of room.

   The class names the calculation script uses (.item-row, .f-qty, .f-price,
   .f-gst, .f-amount, .sku-picker) are unchanged, so the arithmetic is
   untouched by this.
   =========================================================================== */

.nx-li { display: flex; flex-direction: column; gap: .6rem; }

.nx-li-row {
  border: 1px solid var(--ax-border, #E2E8F0); border-radius: 10px;
  background: var(--ax-surface, #fff); padding: .7rem .8rem;
  display: flex; flex-direction: column; gap: .55rem;
}
.nx-li-row:hover { border-color: rgba(234,88,12,.3); }

/* Row 1 — the picker, and the way out. */
.nx-li-head { display: flex; align-items: center; gap: .5rem; }
.nx-li-head .sku-picker {
  flex: 1 1 auto; min-width: 0; height: 36px;
  /* Bootstrap's -sm select carries a line-height that overflows a fixed 36px
     box and crops the text top and bottom. Stating both keeps the option text
     on its baseline inside the height this row needs. */
  line-height: 1.2; padding: .35rem 2rem .35rem .6rem; font-size: .875rem;
}
.nx-li-head .ax-icon-btn { flex: 0 0 auto; }

/* The line number, as printed in the # column of the document. */
.nx-li-no {
  flex: 0 0 auto; min-width: 1.75rem; height: 1.75rem; padding: 0 .4rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; border: 1px solid var(--ax-border, #E2E8F0);
  background: var(--ax-surface-2, #F8FAFC); color: var(--ax-muted, #64748B);
  font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.nx-li-desc.numbered { display: flex; align-items: center; gap: .5rem; }

/* Product search (quotation): replaces the SKU list, which stays hidden
   underneath as the value holder. */
.nx-sku { position: relative; flex: 1 1 auto; min-width: 0; }
.nx-sku-q { width: 100%; height: 36px; line-height: 1.2; font-size: .875rem; }
.nx-sku-list {
  position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: .25rem; list-style: none; max-height: 320px; overflow-y: auto;
  background: var(--ax-surface); border: 1px solid var(--ax-border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15,23,42,.14);
}
.nx-sku-list li {
  display: flex; align-items: baseline; gap: .75rem; padding: .45rem .6rem;
  border-radius: 7px; cursor: pointer; color: var(--ax-text); font-size: .875rem;
}
.nx-sku-list li .nm { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.nx-sku-list li .fr { flex: 0 0 auto; font-size: .75rem; color: var(--ax-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.nx-sku-list li .fr.out { color: #dc2626; }
.nx-sku-list li[data-i]:hover { background: var(--ax-surface-2); }
/* The keyboard row: tinted, not just surface-2, which in the dark theme is
   barely apart from the list behind it. */
.nx-sku-list li.on {
  background: color-mix(in srgb, var(--ax-secondary) 14%, var(--ax-surface));
  box-shadow: inset 3px 0 0 var(--ax-secondary);
}
.nx-sku-list mark { background: none; padding: 0; color: var(--ax-secondary); font-weight: 700; }
.nx-sku-list .nx-sku-note { cursor: default; color: var(--ax-muted); font-size: .8rem; }
/* Only the "no match" note showing: clicks go through to the description under it. */
.nx-sku-list.nx-sku-none { pointer-events: none; }

/* GSTIN check (wr-gstin.js): in a narrow column the tick or cross icon would
   hide the last characters of the number, so only the border colour shows. */
input[data-gstin="compact"].form-control.is-valid,
input[data-gstin="compact"].form-control.is-invalid { background-image: none; padding-right: .75rem; }

/* Row 2 — what it is. Always full width: descriptions are the long field and
   the one most often retyped. */
.nx-li-desc input { width: 100%; height: 36px; line-height: 1.2; font-size: .875rem; }

/* Row 3 — the numbers. Fixed comfortable widths that wrap rather than shrink,
   so a field is either its proper size or on the next line — never 40px. */
.nx-li-nums { display: flex; flex-wrap: wrap; gap: .55rem .7rem; align-items: flex-end; }
.nx-li-f { display: flex; flex-direction: column; gap: .18rem; }
.nx-li-f > span {
  font-size: .66rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ax-muted, #64748B);
}
.nx-li-f input { height: 36px; font-size: .875rem; line-height: 1.2; }
.nx-li-f.hsn  input { width: 7rem; }
.nx-li-f.qty  input { width: 5.5rem; }
.nx-li-f.unit input { width: 5.5rem; }
.nx-li-f.rate input { width: 8rem; }
.nx-li-f.gst  input { width: 5.5rem; }

/* The number the row is actually for. */
.nx-li-amt {
  margin-left: auto; text-align: right; padding-bottom: .1rem;
  display: flex; flex-direction: column; gap: .18rem;
  /* Reserved rather than shrink-to-fit: without a floor, a row showing
     2,500.00 wraps its amount to the next line while the row above showing
     0.00 does not, and two identical rows end up different heights. */
  flex: 0 0 auto; min-width: 8rem;
}
.nx-li-amt > span {
  font-size: .66rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ax-muted, #64748B);
}
.nx-li-amt .f-amount {
  font-size: 1.05rem; font-weight: 700; line-height: 1.6;
  font-variant-numeric: tabular-nums; color: var(--ax-text, #1E293B);
}

/* Spinners steal width from a field that is already narrow, and nobody has
   ever nudged a quantity one at a time with the mouse. */
.nx-li-f input[type=number]::-webkit-outer-spin-button,
.nx-li-f input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.nx-li-f input[type=number] { -moz-appearance: textfield; appearance: textfield; }

@media (max-width: 575.98px) {
  .nx-li-row { padding: .65rem .6rem; }
  .nx-li-nums { gap: .45rem .5rem; }
  .nx-li-f.hsn input, .nx-li-f.rate input { width: 6.5rem; }
  .nx-li-amt { width: 100%; margin-left: 0; text-align: left; }
  .nx-li-amt > span { display: none; }
}

/* ==========================================================================
   NEXORA CONSOLE — design system v4
   --------------------------------------------------------------------------
   A layer, not a fork. Everything below extends the tokens already declared
   at the top of this file and introduces no new colour outside them, so the
   screens that have not been converted yet keep rendering exactly as before.

   The direction is an OPERATIONS CONSOLE: a tool someone stands at and works
   through, not a page they read. Every decision follows from that.

     - Density is a feature. One fixed row rhythm, set once, so the eye can
       track down a column of 24 orders without re-measuring each line.
     - One action per row. A row that offers Pack, Label, RTD and Cancel makes
       the operator decide which of four applies before they can move; a row
       that offers only the step that is actually next does not.
     - Numbers are for comparing. Tabular figures everywhere, monospace for the
       identifiers and quantities that get scanned down a column.
     - Orange means ACT. It had leaked onto every link and icon in the panel,
       which is why nothing on a busy screen stood out. Here it is reserved
       for the thing to press and the place you are.
     - Colour carries state, and the same state is the same colour on every
       screen: amber needs you, slate is waiting, green is finished, red is
       dead or late.
   ========================================================================== */

:root {
  /* Row rhythm — the single number that sets the density of every list. */
  --nx-row:     2.75rem;
  --nx-gut:     1rem;

  /* State. Named for the situation, not the colour, so a screen reads by
     meaning and a later change of palette is one edit. */
  --nx-act:     #B45309;   --nx-act-bg:   rgba(245,158,11,.11);
  --nx-wait:    #64748B;   --nx-wait-bg:  rgba(100,116,139,.10);
  --nx-done:    #0F766E;   --nx-done-bg:  rgba(20,184,166,.12);
  --nx-dead:    #B91C1C;   --nx-dead-bg:  rgba(239,68,68,.10);

  --nx-rail:    3px;       /* the left marker on a row that needs attention */
  --nx-focus:   0 0 0 2px var(--ax-surface), 0 0 0 4px rgba(234,88,12,.55);
}

/* IBM Plex, one superfamily for the whole console.
   Chosen over the previous Inter + Poppins pairing because it was drawn for
   technical work: it has true tabular figures, holds its shape at .78rem in a
   dense table, and its mono sibling matches it exactly — so an order id sits
   in a row of prose without looking pasted in from another document. */
body.ax-body { font-family: 'IBM Plex Sans', system-ui, -apple-system, sans-serif; }
h1, h2, h3, h4, h5, h6 { font-family: 'IBM Plex Sans', system-ui, sans-serif; letter-spacing: -.018em; }

.nx-mono, .ax-ref, .nx-q .id {
  font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
}
.nx-num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

/* ------------------------------------------------------------- Console -- */
/*
 * `overflow: hidden` here was doing two kinds of damage, both silent.
 *
 * 1. It made the card a clipping container, and a clipping container is the
 *    containing block a sticky element is confined to. `.nx-q thead th` is
 *    `position: sticky; top: 0`, but it was sticking to the top of THIS box,
 *    which itself scrolls away with the page — so the table head scrolled off
 *    on every screen, at every width. The sticky head has never once worked.
 *
 * 2. Anything wider than the card was cut off rather than reachable. The
 *    orders queue with its select column has an intrinsic minimum of about
 *    1090px; below roughly 1366px the right-hand columns — State, Dispatch by
 *    and Action, the buttons the page exists for — were simply not on the
 *    page, and no amount of scrolling brought them back.
 *
 * With the card no longer clipping, the sticky head sticks to the real scroll
 * container (.nx-content) and stays put, and the overflow it used to swallow
 * becomes ordinary horizontal scroll on that same container.
 *
 * The corners are the only thing `overflow: hidden` was legitimately doing, so
 * the children round themselves instead.
 */
.nx-console { background: var(--ax-surface); border: 1px solid var(--ax-border);
              border-radius: var(--ax-radius); box-shadow: var(--ax-shadow);
              overflow: visible; margin-bottom: 1.15rem; }

.nx-console > :first-child {
  border-top-left-radius: var(--ax-radius); border-top-right-radius: var(--ax-radius);
}
.nx-console > :last-child {
  border-bottom-left-radius: var(--ax-radius); border-bottom-right-radius: var(--ax-radius);
}
/* A table cannot round its own corners, so its last row's end cells do it. */
.nx-console > .nx-q > tbody > tr:last-child > td:first-child {
  border-bottom-left-radius: var(--ax-radius);
}
.nx-console > .nx-q > tbody > tr:last-child > td:last-child {
  border-bottom-right-radius: var(--ax-radius);
}
.nx-console > .nx-q > tbody > tr:last-child > td { border-bottom: 0; }

/* ---- the command bar: what you are looking at, and how to narrow it ---- */
.nx-cmd      { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
               padding: .55rem var(--nx-gut); border-bottom: 1px solid var(--ax-border);
               background: var(--ax-surface); }
.nx-cmd .sp  { margin-left: auto; }

/* Lane tabs. Named nx-lanetab, NOT nx-tab: the layout shell already owns
   .nx-tabs / .nx-tab for the area strip across the top of every page, and that
   rule sets a fixed 46px height. Reusing the name gave the lane nav the area
   strip's geometry — invisible in a screenshot at one width, wrong everywhere
   else. A segmented control rather than four cards: the same information
   in a fifth of the height, and the count sits with its label instead of
   above it, which is how it gets read aloud. */
.nx-lanetabs     { display: flex; gap: .15rem; flex-wrap: wrap; }
.nx-lanetab  { display: inline-flex; align-items: center; gap: .4rem;
               padding: .4rem .7rem; border-radius: .45rem; border: 1px solid transparent;
               font-size: .855rem; font-weight: 500; color: var(--ax-muted);
               text-decoration: none; white-space: nowrap; transition: background .12s, color .12s; }
.nx-lanetab:hover      { background: var(--ax-surface-2); color: var(--ax-text); }
.nx-lanetab .c         { font-variant-numeric: tabular-nums; font-weight: 600;
                     font-size: .78rem; padding: .05rem .38rem; border-radius: .3rem;
                     background: var(--ax-surface-2); color: var(--ax-muted); }
.nx-lanetab[aria-current="true"]        { background: var(--ax-primary); color: #fff; }
.nx-lanetab[aria-current="true"] .c     { background: rgba(255,255,255,.18); color: #fff; }
.nx-lanetab.act[aria-current="true"]    { background: var(--nx-act);  }
.nx-lanetab.done[aria-current="true"]   { background: var(--nx-done); }
.nx-lanetab.dead[aria-current="true"]   { background: var(--nx-dead); }
.nx-lanetab.zero:not([aria-current="true"]) { opacity: .45; }

/* Search. Slash focuses it; the hint says so until it has focus. */
.nx-find     { position: relative; display: flex; align-items: center; min-width: 11rem; }
.nx-find i   { position: absolute; left: .6rem; color: var(--ax-muted); font-size: .85rem; pointer-events: none; }
.nx-find input {
  width: 100%; height: 2.1rem; padding: 0 1.9rem 0 1.9rem; font: inherit; font-size: .855rem;
  border: 1px solid var(--ax-border); border-radius: .45rem; background: var(--ax-surface-2); color: inherit;
}
.nx-find input:focus { background: var(--ax-surface); border-color: var(--ax-secondary); outline: none;
                       box-shadow: 0 0 0 3px rgba(234,88,12,.14); }
.nx-find kbd { position: absolute; right: .45rem; font-size: .68rem; color: var(--ax-muted);
               border: 1px solid var(--ax-border); border-radius: .25rem; padding: 0 .28rem;
               background: var(--ax-surface); font-family: inherit; }
.nx-find input:focus ~ kbd, .nx-find input:not(:placeholder-shown) ~ kbd { display: none; }

/* ---- the running total strip ---- */
.nx-strip    { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap;
               padding: .5rem var(--nx-gut); background: var(--ax-surface-2);
               border-bottom: 1px solid var(--ax-border); font-size: .82rem; color: var(--ax-muted); }
.nx-strip b  { color: var(--ax-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.nx-strip .bad  { color: var(--nx-dead); }
.nx-strip .sp   { margin-left: auto; }

/* ------------------------------------------------------------ The queue -- */
/* Deliberately NOT inside .table-responsive. That wrapper sets overflow-x,
   which computes overflow-y to auto and turns the wrapper into a scroll
   container — and a sticky thead then sticks to the top of a box that never
   scrolls vertically, i.e. it stops working the moment the list is long
   enough to need it. The queue shrinks to fit instead, and becomes a stack of
   cards below 768px where it no longer can. */
.nx-q        { width: 100%; border-collapse: collapse; table-layout: auto; }
.nx-q thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--ax-surface); border-bottom: 1px solid var(--ax-border);
  padding: .5rem .6rem; text-align: left; white-space: nowrap;
  font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ax-muted);
}
.nx-q tbody td { padding: .45rem .6rem; border-bottom: 1px solid var(--ax-border);
                 vertical-align: middle; font-size: .855rem; }
.nx-q tbody tr { height: var(--nx-row); }
.nx-q tbody tr:hover { background: var(--ax-surface-2); }
.nx-q tbody tr.on    { background: rgba(234,88,12,.055); }

/* Keyboard focus is a real position on this screen, so it gets a real mark. */
.nx-q tbody tr.cur > td:first-child { box-shadow: inset var(--nx-rail) 0 0 var(--ax-secondary); }
.nx-q tbody tr.cur   { background: rgba(234,88,12,.055); }

/* Late is a rail, not a word in a column: visible down the whole list at a
   glance, and it costs no horizontal space on a table that has none spare. */
.nx-q tbody tr.late > td:first-child { box-shadow: inset var(--nx-rail) 0 0 var(--nx-dead); }
.nx-q tbody tr.cur.late > td:first-child {
  box-shadow: inset var(--nx-rail) 0 0 var(--nx-dead), inset calc(var(--nx-rail) * 2) 0 0 var(--ax-secondary); }

.nx-q .pick  { width: 2.2rem; padding-left: .8rem; }
.nx-q .pick input { width: .95rem; height: .95rem; accent-color: var(--ax-secondary); cursor: pointer; }
.nx-q .num   { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* One line, always.
   A 36-character Flipkart id and a long SKU both wrap in a narrow column, and
   a table where some rows are one line and some are two loses the vertical
   rhythm the eye follows down it — which is the whole reason this list is
   dense. Truncate with an ellipsis; the full value stays in the title, and in
   the contents panel one keystroke away. */
.nx-q .id    { font-size: .8rem; display: block; max-width: 13rem;
               overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-q .m-sku { max-width: 11rem; }
.nx-q .m-sku > span:first-child {
               display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-q .m-awb, .nx-q .m-type { white-space: nowrap; }
.nx-q .sub   { font-size: .72rem; color: var(--ax-muted); margin-top: .1rem; }
.nx-q tbody tr.closed > td { opacity: .58; }

/* ---- state pill + the three-step meter ---- */
.nx-st       { display: inline-flex; align-items: center; gap: .32rem; font-size: .78rem;
               font-weight: 600; white-space: nowrap; }
.nx-st .dot  { width: .45rem; height: .45rem; border-radius: 50%; flex: none; }
.nx-st.act   { color: var(--nx-act);  } .nx-st.act  .dot { background: var(--nx-act);  }
.nx-st.wait  { color: var(--nx-wait); } .nx-st.wait .dot { background: var(--nx-wait); }
.nx-st.done  { color: var(--nx-done); } .nx-st.done .dot { background: var(--nx-done); }
.nx-st.dead  { color: var(--nx-dead); } .nx-st.dead .dot { background: var(--nx-dead); }

.nx-meter    { display: inline-flex; gap: 2px; margin-left: .4rem; vertical-align: middle;
               padding-left: .4rem; border-left: 1px solid var(--ax-border); }
.nx-meter i  { width: .45rem; height: .45rem; border-radius: 50%; background: var(--ax-border); display: block; }
.nx-meter i.on { background: var(--nx-act); }
.nx-meter.done i.on { background: var(--nx-done); }

/* ---- NEXT: the single thing this row is asking for ---- */
.nx-next     { display: flex; align-items: center; justify-content: flex-end; gap: .3rem; }
.nx-go {
  display: inline-flex; align-items: center; gap: .3rem; height: 1.85rem; padding: 0 .7rem;
  border: 0; border-radius: .42rem; background: var(--ax-secondary); color: #fff;
  font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: filter .12s, transform .06s;
}
.nx-go:hover  { filter: brightness(1.07); color: #fff; }
.nx-go:active { transform: translateY(1px); }
.nx-go.quiet  { background: var(--ax-surface-2); color: var(--ax-text); border: 1px solid var(--ax-border); }
.nx-go.quiet:hover { background: var(--ax-surface); border-color: var(--ax-secondary); color: var(--ax-secondary); }
.nx-go[disabled] { opacity: .45; cursor: not-allowed; }

.nx-x { display: inline-flex; align-items: center; justify-content: center;
        width: 1.85rem; height: 1.85rem; border: 1px solid transparent; border-radius: .42rem;
        background: none; color: var(--ax-muted); cursor: pointer; font-size: .82rem; }
.nx-x:hover { color: var(--nx-dead); border-color: #FCA5A5; background: rgba(220,38,38,.06); }

.nx-fin { font-size: .78rem; color: var(--ax-muted); display: inline-flex; align-items: center; gap: .3rem; }

/* ---------------------------------------------------- Selection toolbar --
   Rises from the bottom instead of pushing the table down: the rows under the
   cursor do not move the moment a checkbox is ticked. */
.nx-sel {
  position: fixed; left: 50%; bottom: 1.1rem; transform: translate(-50%, 130%);
  z-index: 1040; display: flex; align-items: center; gap: .55rem;
  padding: .5rem .65rem; border-radius: .7rem;
  background: var(--ax-primary); color: #fff;
  box-shadow: 0 10px 30px rgba(15,23,42,.28);
  transition: transform .18s cubic-bezier(.16,1,.3,1);
}
.nx-sel.up   { transform: translate(-50%, 0); }
.nx-sel .n   { font-size: .84rem; font-weight: 600; font-variant-numeric: tabular-nums;
               padding-right: .2rem; }
.nx-sel .btn { height: 1.9rem; padding: 0 .7rem; font-size: .8rem; }
.nx-sel .lnk { background: none; border: 0; color: rgba(255,255,255,.75); font: inherit;
               font-size: .8rem; cursor: pointer; text-decoration: underline; }
.nx-sel .lnk:hover { color: #fff; }
@media (prefers-reduced-motion: reduce) { .nx-sel { transition: none; } }

/* ------------------------------------------------------------- Tiles --
   The overview's answer to "what needs doing right now". A number you can
   read across the room, a label that says what it is, and the whole tile is
   the link to the list it counts. */
.nx-tiles  { display: grid; gap: .7rem; margin-bottom: 1.15rem;
             grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); }
.nx-tile   { display: flex; flex-direction: column; gap: .15rem;
             padding: .9rem 1rem; border-radius: var(--ax-radius);
             border: 1px solid var(--ax-border); background: var(--ax-surface);
             color: inherit; text-decoration: none; box-shadow: var(--ax-shadow);
             position: relative; overflow: hidden; transition: border-color .12s, transform .12s; }
.nx-tile::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--nx-rail);
                   background: var(--ax-border); }
.nx-tile:hover   { border-color: var(--ax-secondary); transform: translateY(-1px); color: inherit; }
.nx-tile .v      { font-size: 1.75rem; font-weight: 600; line-height: 1.1;
                   font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.nx-tile .l      { font-size: .78rem; color: var(--ax-muted); font-weight: 500; }
.nx-tile .h      { font-size: .72rem; color: var(--ax-muted); opacity: .85; }
.nx-tile.act::before  { background: var(--nx-act);  } .nx-tile.act  .v { color: var(--nx-act);  }
.nx-tile.dead::before { background: var(--nx-dead); } .nx-tile.dead .v { color: var(--nx-dead); }
.nx-tile.done::before { background: var(--nx-done); } .nx-tile.done .v { color: var(--nx-done); }
.nx-tile.calm::before { background: var(--ax-border); }
.nx-tile.calm .v      { color: var(--ax-muted); font-weight: 500; }

/* ------------------------------------------------------------- Sections -- */
.nx-sec     { display: flex; align-items: baseline; gap: .6rem; margin: 0 0 .55rem; }
.nx-sec h2  { font-size: .78rem; font-weight: 600; text-transform: uppercase;
              letter-spacing: .08em; color: var(--ax-muted); margin: 0; }
.nx-sec .r  { margin-left: auto; font-size: .8rem; }

/* ---- a compact one-line-per-thing list, for connections and activity ---- */
.nx-rows    { display: flex; flex-direction: column; }
.nx-row     { display: flex; align-items: center; gap: .75rem; padding: .6rem var(--nx-gut);
              border-bottom: 1px solid var(--ax-border); font-size: .855rem; }
.nx-row:last-child { border-bottom: 0; }
.nx-row .g  { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.nx-row .g .t { font-weight: 600; }
.nx-row .g .s { font-size: .74rem; color: var(--ax-muted); }
.nx-row .sp { margin-left: auto; }

/* A two-column split, in the console's own CSS rather than Bootstrap's grid.
   Three lines instead of a framework dependency, and it means a preview that
   cannot reach the CDN still shows the real layout rather than a stack. */
.nx-split { display: grid; gap: 0 1.15rem; align-items: start;
            grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 991.98px) { .nx-split { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------- Keyboard help -- */
.nx-keys   { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; padding: .55rem var(--nx-gut);
             border-top: 1px solid var(--ax-border); background: var(--ax-surface-2);
             font-size: .74rem; color: var(--ax-muted); }
.nx-keys kbd { font-family: 'IBM Plex Mono', monospace; font-size: .7rem;
               border: 1px solid var(--ax-border); border-bottom-width: 2px; border-radius: .25rem;
               padding: 0 .3rem; background: var(--ax-surface); color: var(--ax-text); }

/* ------------------------------------------------------------- Phone -- */
@media (max-width: 767.98px) {
  :root { --nx-gut: .8rem; }

  /* The queue becomes one card per order. The three things that decide what
     you do next — what it is, where it is, what it wants — stay on one line
     each, and the action stays a full-width target you can hit with a thumb
     while holding a parcel. */
  .nx-q, .nx-q tbody, .nx-q tr, .nx-q td { display: block; width: auto; }
  .nx-q thead { display: none; }
  .nx-q tbody tr { height: auto; padding: .7rem var(--nx-gut) .7rem calc(var(--nx-gut) + var(--nx-rail));
                   border-bottom: 1px solid var(--ax-border); position: relative; }
  .nx-q tbody td { border: 0; padding: .1rem 0; }
  .nx-q tbody tr.cur > td:first-child,
  .nx-q tbody tr.late > td:first-child { box-shadow: none; }
  .nx-q tbody tr.late::before,
  .nx-q tbody tr.cur::before { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--nx-rail); }
  .nx-q tbody tr.late::before { background: var(--nx-dead); }
  .nx-q tbody tr.cur::before  { background: var(--ax-secondary); }
  .nx-q .pick { position: absolute; top: .6rem; right: .55rem; width: auto; padding: 0; }
  /* The card is full width, so nothing needs truncating to hold a column. */
  .nx-q .id, .nx-q .m-sku, .nx-q .m-sku > span:first-child { max-width: none; }
  .nx-q .num  { text-align: left; }
  .nx-q td.m-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }

  /* The column headings are gone on a phone, so the two cells that are just a
     number or a date get a word. Without it "INR 56.00 / 14 Sep, 10:14" is two
     unlabelled facts and the date could be either of the two the row holds. */
  .nx-q td.m-due::before { content: 'Due '; color: var(--ax-muted); font-size: .78rem; }
  .nx-q td.m-due:has(.ax-muted)::before { content: none; }
  .nx-next    { justify-content: stretch; margin-top: .5rem; }
  .nx-next .nx-go { flex: 1; justify-content: center; height: 2.2rem; }

  .nx-lanetabs    { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .15rem; }
  .nx-cmd     { gap: .5rem; }
  /* The spacer exists to push the filters to the far end of a wide bar. On a
     phone everything is already stacked, so it only opened a gap. */
  .nx-cmd .sp { display: none; }
  .nx-find    { flex: 1 1 100%; }
  .nx-tiles   { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nx-tile .v { font-size: 1.5rem; }
  .nx-keys    { display: none; }
  .nx-sel     { left: .6rem; right: .6rem; bottom: .6rem; transform: translateY(130%); }
  .nx-sel.up  { transform: translateY(0); }
}

/* ==========================================================================
   APP SHELL — the page stops scrolling, the content scrolls
   --------------------------------------------------------------------------
   The whole document scrolled, so the header and the area tabs slid away the
   moment you moved down a list. On a screen whose job is to be worked through
   — twenty-four orders, eighteen returns, a stock table of two hundred SKUs —
   that means the navigation, the lane tabs and the filter you are using are
   the first things to disappear.

   Desktop is now a fixed frame: the top bar and the sidebar are pinned, and
   exactly one element scrolls. There is no second scrollbar and no nesting,
   because there is only ever one scroll container.

   PHONES ARE DELIBERATELY EXEMPT. A locked 100vh frame fights the mobile
   browser's own collapsing address bar, breaks pull-to-refresh, and traps
   people inside a short box on the one device with the least room. Below
   992px the document scrolls normally, which is what every phone user already
   expects.
   ========================================================================== */

/*
 * SCOPED TO `.nx-body`, WHICH ONLY THE ADMIN SHELL HAS.
 *
 * This was written against `body.ax-body`, and ax-body is on THREE layouts —
 * the admin shell, the staff portal, and the blank layout that prints invoices
 * and packing slips. Only the first has .nx-shell and .nx-content inside it.
 *
 * So the other two got the lock without the scroll container: overflow hidden
 * on html and body, and nothing underneath able to scroll. Every invoice
 * printed from the panel was cut off at the fold with no way to reach the rest
 * of it, and the entire staff portal became unscrollable on any desktop
 * screen — a worse version of the exact bug this block was written to fix.
 *
 * A locked frame is a promise that something inside scrolls instead. Only the
 * admin layout makes that promise, so only the admin layout gets the lock.
 */
@media (min-width: 992px) {
  html.nx-app, html.nx-app body.nx-body { height: 100%; overflow: hidden; }

  /* The frame: top chrome at its natural height, everything else fills what
     is left. No magic numbers — the row sizing does it. */
  html.nx-app body.nx-body { display: flex; flex-direction: column; }

  .nx-top    { flex: 0 0 auto; }

  /*
   * `align-items: stretch` is the load-bearing line here, and leaving it out
   * broke the page far worse than the scrolling it was meant to fix.
   *
   * .nx-shell is a flex ROW, so height is its CROSS axis. Its base rule sets
   * `align-items: flex-start`, which sizes both columns to their own content.
   * .nx-content therefore grew to the full height of the orders list — 1718px
   * inside a 798px shell — and `overflow-y: auto` on a box that is never
   * shorter than its content produces no scrollbar at all. With the shell
   * clipping the excess, the bottom 920px of the list could not be reached by
   * scrolling, by keyboard, or by scrollIntoView. It was not on the page.
   *
   * Stretching makes .nx-content exactly as tall as the frame, which is what
   * gives `overflow-y: auto` something to scroll.
   */
  .nx-shell  { flex: 1 1 auto; min-height: 0; overflow: hidden;
               align-items: stretch; }

  /* The sidebar was `position: sticky` against a scrolling document. Inside a
     fixed frame it simply is its own column, and scrolls on its own only when
     an area has more destinations than fit. */
  .nx-side   { position: static; height: auto; align-self: stretch;
               min-height: 0; overflow-y: auto; overscroll-behavior: contain; }

  /* THE one scroll container on the page. align-self repeats what the shell
     now says, so a future change to .nx-shell's alignment cannot quietly take
     the scrollbar away again. */
  .nx-content { align-self: stretch; height: 100%;
                min-height: 0; overflow-y: auto; overscroll-behavior: contain;
                scrollbar-gutter: stable; }

  /* And the containing block of everything absolutely placed inside it. A
     visually-hidden input (the Camera / Gallery file pickers on a return) is
     position: absolute; with no positioned box above it, it was placed against
     the whole page, at its spot inside the scrolled content, so the lowest one
     reached below the window. That made the locked frame scrollable: opening
     a return at #claim after "Update claim" slid the whole layout up, leaving
     a grey band above the footer. Positioned here, such elements scroll and
     clip with the content instead. */
  .nx-content { position: relative; }

  /*
   * A sticky table head only works against the element that actually scrolls,
   * which is now .nx-content — so it sticks to the top of the content area
   * rather than to a viewport it can no longer reach.
   *
   * The command bar and the count strip pin above it, in that order, so the
   * lane tabs and the filter you are using stay put while you work down the
   * list. Each offset is the total height of everything pinned above, which
   * is not a constant — the command bar wraps to two rows on a narrow window
   * — so admin.js measures the laid-out page and publishes the three values.
   * The fallbacks are what the bars measure at their usual single-row height,
   * so the stack is still roughly right for the instant before the script
   * runs and if it never runs at all.
   */
  .nx-console > .nx-cmd   { position: sticky; top: var(--nx-stick-cmd, 0);        z-index: 6; }
  .nx-console > .nx-strip { position: sticky; top: var(--nx-stick-strip, 3.3rem); z-index: 5; }
  .nx-q thead th          { top: var(--nx-stick-head, 5.6rem); }

  /* Pinned bars sit over the rows passing beneath them, so they cannot be
     translucent. */
  .nx-console > .nx-cmd,
  .nx-console > .nx-strip { background: var(--ax-surface); }

  /*
   * The gap above the pinned bar.
   *
   * A sticky element stops at the scrollport's PADDING edge, not its top, so
   * the canvas's own top padding stays open and rows scroll up through it in
   * plain sight. Pulling the bar up into that band instead would hide the top
   * of the bar itself as soon as it wraps to two rows, which is exactly what
   * it does on a narrow window — so the bar stays put and this covers the band
   * with the page's own background. Stretched a pixel wider each side to take
   * the console's border with it.
   *
   * Only while the bar is pinned (admin.js adds .nx-pinned). At rest the band
   * hung over the bottom of whatever sat just above the console — on a tablet,
   * where the page header wraps, that was its action buttons.
   */
  .nx-console.nx-pinned > .nx-cmd::before {
    content: ''; position: absolute; left: -1px; right: -1px; bottom: 100%;
    height: var(--nx-canvas-pad, 1.35rem);
    background: var(--ax-bg);
  }
}

/* A long form inside the frame still needs its save bar in reach. */
@media (min-width: 992px) {
  .nx-savebar { position: sticky; bottom: 0; }
}

/* ==========================================================================
   THE MID-WIDTH DEAD ZONE — 992px to 1199px
   --------------------------------------------------------------------------
   Between the point where the desktop frame takes over (992px) and about
   1150px, the queue did not fit and was CUT OFF, not scrolled.

   At 1024px the sidebar takes 242px and the canvas padding 48px, leaving the
   content area 767px. The orders table's intrinsic minimum is 888px — nine
   columns, every one of them `white-space: nowrap`. A table cannot shrink
   below that, so 121px of it hung outside the content box. It could not be
   reached by scrolling either: `body { overflow-x: clip }` contains the page
   (so the layout does not break) and the excess is simply gone, which on the
   orders screen meant the Action column — the buttons the page exists for.

   Widening the table's container is the only fix that does not damage it, so
   this band takes the space back from the chrome rather than from the data:
   a narrower sidebar, tighter canvas padding, tighter cells. The table itself
   is untouched, and above 1200px nothing here applies.

   Horizontal scrolling was the alternative and was rejected: it needs
   overflow-x on the wrapper, which computes overflow-y to `auto` and makes it
   a scroll container, and the sticky table head then sticks to the top of a
   box that never scrolls vertically — i.e. it stops working exactly when the
   list is long enough to need it. That trade is documented on .nx-q too.
   ========================================================================== */

@media (min-width: 992px) and (max-width: 1199.98px) {
  :root { --nx-side-w: 186px; }

  .nx-content     { padding-left: .85rem; padding-right: .85rem; }
  .nx-side-scroll { padding-left: .4rem; padding-right: .4rem; }
  .nx-link        { padding-left: .5rem; padding-right: .5rem; }

  /* Cells, not content: the values keep their size, the gaps around them
     give way. */
  .nx-q thead th,
  .nx-q tbody td  { padding-left: .35rem; padding-right: .35rem; }
  .nx-q .pick     { width: 1.8rem; padding-left: .45rem; }
  .nx-q .id       { max-width: 11rem; }
  .nx-q .m-sku    { max-width: 8.5rem; }

  /* The one piece of content that does give way: a date's seconds-level
     precision is never what anyone is reading at this width. */
  .nx-q .m-date   { font-size: .78rem; }
}

/* ==========================================================================
   OVERVIEW INFOGRAPHICS — the pictures on the marketplace overview
   --------------------------------------------------------------------------
   Four panels: a dispatch funnel, a deadline clock, a trend chart and a
   channel/stock split. All hand-drawn — no charting library for four shapes.

   COLOUR IS ASSIGNED BY THE JOB THE DATA DOES, which is the only rule that
   keeps a chart readable:

     · ORDERED SCALES (funnel stages, deadline severity) get ONE hue getting
       darker. Impossible to misread, and it survives every kind of colour
       blindness because the lightness carries the order on its own.

     · IDENTITY (which channel) gets distinct hues, fixed per channel so a
       filter never repaints the survivors. The pair was checked rather than
       eyeballed: cyan against violet measures ΔE 25.9 to normal vision and
       16.7 under deuteranopia, comfortably past the 15 and 8 floors.

     · The design system's STATE colours (act/wait/done/dead) are RESERVED and
       are never used as chart series. They are picked for meaning, not for
       separation, and they fail as data: amber against red is ΔE 9.1, below
       the point at which normal colour vision can tell two fills apart, and
       slate against teal is 9.3. They stay on pills and rails where each one
       appears alone beside its own word.

   Every series is direct-labelled as well as coloured, so nothing on this page
   has to be read by hue.
   ========================================================================== */

:root {
  /* Identity — fixed per channel, never per position. */
  --viz-c0: #0891B2;   /* Flipkart */
  --viz-c1: #6D28D9;   /* Amazon   */
  --viz-c2: #B45309;   /* Meesho   */
  --viz-c3: #64748B;   /* anything else — neutral, never a generated hue */

  /*
   * Ordered scale: dispatch stage, light to dark.
   *
   * The steps are spaced by how different they LOOK, not by how far apart
   * their hex codes are. An earlier set (300/400/500/600/800 straight off a
   * colour scale) failed on two counts: adjacent steps differed by 0.05 in
   * perceptual lightness where 0.06 is the floor, so the middle of the funnel
   * read as one colour; and the lightest step sat at 1.69:1 against white,
   * under the 2:1 minimum, so the top bar had no visible edge at all.
   */
  --viz-s0: #FB923C;  --viz-s1: #EA580C;  --viz-s2: #C2410C;
  --viz-s3: #9A3412;  --viz-s4: #7C2D12;

  /*
   * Ordered scale: urgency, light to dark. Darkest is most overdue.
   *
   * Four steps, all one hue. The fifth bucket — "no deadline given" — is
   * deliberately NOT on this ramp: it is not a fifth degree of urgency, it is
   * the absence of information, and putting it at the pale end of a red scale
   * would have claimed it was the least urgent rather than the least known.
   * It gets the neutral below, which is outside the scale on purpose.
   */
  --viz-d0: #7F1D1D;  --viz-d1: #B91C1C;  --viz-d2: #EF4444;
  --viz-d3: #F87171;  --viz-d4: #CBD5E1;

  --viz-grid: #E2E8F0;
  --viz-ink:  #0F172A;
}

/* ---------------------------------------------------------------- layout */
.nx-viz {
  display: grid; gap: 1rem; margin-bottom: 1.15rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nx-viz > .nx-card-wide { grid-column: span 2; }

@media (min-width: 1200px) {
  .nx-viz { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nx-viz > .nx-card-wide { grid-column: span 2; }
}
@media (max-width: 767.98px) {
  .nx-viz { grid-template-columns: minmax(0, 1fr); }
  .nx-viz > .nx-card-wide { grid-column: span 1; }
}

.nx-card {
  background: var(--ax-surface); border: 1px solid var(--ax-border);
  border-radius: var(--ax-radius); box-shadow: var(--ax-shadow);
  padding: .95rem 1.05rem 1rem; min-width: 0;
  display: flex; flex-direction: column;
}
.nx-card-h { display: flex; align-items: flex-start; gap: .75rem; margin-bottom: .85rem; }
.nx-card-h > div { min-width: 0; flex: 1; }
.nx-card-h h3 {
  font-family: var(--ax-font-head); font-size: .95rem; font-weight: 600;
  margin: 0 0 .15rem; letter-spacing: -.01em;
}
.nx-card-h p { margin: 0; font-size: .76rem; color: var(--ax-muted); line-height: 1.45; }
.nx-card-h p strong { color: var(--ax-text); font-variant-numeric: tabular-nums; }

.nx-card-f {
  margin-top: auto; padding-top: .7rem; border-top: 1px solid var(--ax-border);
  font-size: .75rem; color: var(--ax-muted);
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
}
.nx-card-f strong { color: var(--ax-text); font-variant-numeric: tabular-nums; }
.nx-card-f.bad i { color: var(--nx-dead); }
.nx-card-f.bad a { color: var(--nx-dead); font-weight: 600; }

.nx-card-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: .4rem; padding: 1.4rem .5rem;
  color: var(--ax-muted); text-align: center;
}
.nx-card-empty i { font-size: 1.5rem; opacity: .5; }
.nx-card-empty p { margin: 0; font-size: .8rem; }

/* ---------------------------------------------------------------- funnel */
.nx-funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.nx-funnel-s {
  display: grid; align-items: center; gap: .6rem;
  grid-template-columns: 8.5rem 1fr 3rem 4.5rem;
}
.nx-funnel-s .k { font-size: .78rem; color: var(--ax-text); }
.nx-funnel-s .bar { background: var(--ax-surface-2); border-radius: 5px; height: 1.45rem; overflow: hidden; }
.nx-funnel-s .fill {
  display: block; height: 100%; width: var(--w);
  /* 4px rounded data-end, anchored square to the baseline at the start. */
  border-radius: 0 5px 5px 0;
}
.nx-funnel-s .fill.s0 { background: var(--viz-s0); }
.nx-funnel-s .fill.s1 { background: var(--viz-s1); }
.nx-funnel-s .fill.s2 { background: var(--viz-s2); }
.nx-funnel-s .fill.s3 { background: var(--viz-s3); }
.nx-funnel-s .fill.s4 { background: var(--viz-s4); }
/* Values are text ink, never the series colour. */
.nx-funnel-s .n {
  font-size: .85rem; font-weight: 600; text-align: right;
  font-variant-numeric: tabular-nums; color: var(--ax-text);
}
.nx-funnel-s .at { font-size: .72rem; color: var(--ax-muted); text-align: right; white-space: nowrap; }

@media (max-width: 575.98px) {
  .nx-funnel-s { grid-template-columns: 6.5rem 1fr 2.5rem; }
  .nx-funnel-s .at { display: none; }
}

/* ------------------------------------------------------- deadline clock */
.nx-dl { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.nx-dl-r {
  display: grid; align-items: center; gap: .55rem;
  grid-template-columns: .6rem 8rem 1fr 2rem;
}
.nx-dl-r.zero { opacity: .45; }
.nx-dl-r .sw { width: .6rem; height: .6rem; border-radius: 2px; }
.nx-dl-r .k { font-size: .78rem; }
.nx-dl-r .track { background: var(--ax-surface-2); border-radius: 4px; height: .55rem; overflow: hidden; }
.nx-dl-r .fill { display: block; height: 100%; width: var(--w); border-radius: 4px; }
.nx-dl-r .n {
  font-size: .82rem; font-weight: 600; text-align: right;
  font-variant-numeric: tabular-nums;
}
.d0 { background: var(--viz-d0); } .d1 { background: var(--viz-d1); }
.d2 { background: var(--viz-d2); } .d3 { background: var(--viz-d3); }
.d4 { background: var(--viz-d4); }

/* ----------------------------------------------------------------- trend */
.nx-chart { margin: 0; }
.nx-chart svg { width: 100%; height: 190px; display: block; overflow: visible; }
.nx-chart .grid { stroke: var(--viz-grid); stroke-width: 1; }
.nx-chart .tick { font-size: 9px; fill: var(--ax-muted); font-variant-numeric: tabular-nums; }
.nx-chart .line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nx-chart .area { opacity: .1; }
/* A 2px surface ring keeps overlapping markers separable. */
.nx-chart .dot { stroke: var(--ax-surface); stroke-width: 2; }
.nx-chart .hit { fill: transparent; cursor: crosshair; }
.nx-chart .hit:hover { fill: rgba(15,23,42,.035); }

.line.c0, .dot.c0 { stroke: var(--viz-c0); } .area.c0 { fill: var(--viz-c0); }
.line.c1, .dot.c1 { stroke: var(--viz-c1); } .area.c1 { fill: var(--viz-c1); }
.line.c2, .dot.c2 { stroke: var(--viz-c2); } .area.c2 { fill: var(--viz-c2); }
.line.c3, .dot.c3 { stroke: var(--viz-c3); } .area.c3 { fill: var(--viz-c3); }
.dot.c0 { fill: var(--viz-c0); } .dot.c1 { fill: var(--viz-c1); }
.dot.c2 { fill: var(--viz-c2); } .dot.c3 { fill: var(--viz-c3); }

.nx-axis {
  display: flex; justify-content: space-between;
  font-size: .7rem; color: var(--ax-muted); margin-top: .3rem;
}

.nx-range { display: flex; gap: .15rem; background: var(--ax-surface-2);
            padding: .15rem; border-radius: .5rem; flex: 0 0 auto; }
.nx-range a {
  font-size: .72rem; padding: .2rem .5rem; border-radius: .38rem;
  color: var(--ax-muted); font-weight: 600; text-decoration: none;
}
.nx-range a:hover { color: var(--ax-text); }
.nx-range a.on { background: var(--ax-surface); color: var(--ax-text); box-shadow: var(--ax-shadow); }

.nx-delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.nx-delta.up   { color: var(--nx-done); }
.nx-delta.down { color: var(--nx-dead); }

/* ---------------------------------------------------------------- legend */
.nx-legend {
  list-style: none; margin: .6rem 0 0; padding: 0;
  display: flex; gap: .9rem; flex-wrap: wrap; font-size: .76rem;
}
.nx-legend.col { flex-direction: column; gap: .35rem; }
.nx-legend.wrap { gap: .6rem; margin-top: .45rem; font-size: .72rem; }
.nx-legend li { display: flex; align-items: center; gap: .35rem; color: var(--ax-muted); }
.nx-legend b { color: var(--ax-text); font-variant-numeric: tabular-nums; }
.nx-legend .sw { width: .7rem; height: .7rem; border-radius: 3px; flex: 0 0 auto; }
.nx-legend .sw.c0 { background: var(--viz-c0); } .nx-legend .sw.c1 { background: var(--viz-c1); }
.nx-legend .sw.c2 { background: var(--viz-c2); } .nx-legend .sw.c3 { background: var(--viz-c3); }

/* ----------------------------------------------------------------- donut */
.nx-donut-wrap { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nx-donut { width: 130px; height: 130px; flex: 0 0 auto; transform: rotate(-90deg); }
.nx-donut .ring { fill: none; stroke: var(--ax-surface-2); }
.nx-donut .seg  { fill: none; stroke-linecap: butt; }
.nx-donut .seg.c0 { stroke: var(--viz-c0); } .nx-donut .seg.c1 { stroke: var(--viz-c1); }
.nx-donut .seg.c2 { stroke: var(--viz-c2); } .nx-donut .seg.c3 { stroke: var(--viz-c3); }
/* The hole carries the total, counter-rotated back to upright. */
.nx-donut .mid-v, .nx-donut .mid-l { transform: rotate(90deg); transform-origin: 70px 70px; }
.nx-donut .mid-v { font-size: 22px; font-weight: 700; fill: var(--ax-text); font-variant-numeric: tabular-nums; }
.nx-donut .mid-l { font-size: 9px; fill: var(--ax-muted); text-transform: uppercase; letter-spacing: .08em; }

/* ----------------------------------------------------------------- stock */
.nx-stock { margin-top: 1rem; padding-top: .85rem; border-top: 1px solid var(--ax-border); }
.nx-stock-h {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; font-size: .76rem; color: var(--ax-muted); margin-bottom: .45rem;
}
.nx-stock-h a { text-decoration: none; }
/* 2px of surface between segments, so neighbours read as two things. */
.nx-meter { display: flex; gap: 2px; height: .65rem; border-radius: 4px; overflow: hidden;
            background: var(--ax-surface-2); }
.nx-meter .seg { width: var(--w); }
.m-ok      { background: var(--nx-done); }
.m-low     { background: var(--viz-s1); }
.m-out     { background: var(--nx-dead); }
.m-unknown { background: #CBD5E1; }
.nx-legend .sw.m-ok { background: var(--nx-done); } .nx-legend .sw.m-low { background: var(--viz-s1); }
.nx-legend .sw.m-out { background: var(--nx-dead); } .nx-legend .sw.m-unknown { background: #CBD5E1; }

/* -------------------------------------------------------- repeated log */
.nx-rep {
  display: inline-block; margin-left: .3rem; padding: 0 .3rem;
  border-radius: 3px; background: var(--nx-act-bg); color: var(--nx-act);
  font-size: .68rem; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------- tooltip */
.nx-tip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--ax-primary); color: #fff;
  font-size: .72rem; padding: .35rem .55rem; border-radius: .4rem;
  box-shadow: 0 6px 20px rgba(15,23,42,.22); max-width: 15rem;
  opacity: 0; transform: translateY(2px); transition: opacity .12s, transform .12s;
}
.nx-tip.on { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   MOTION
   --------------------------------------------------------------------------
   Every animation here runs ONCE, on load, and only when the panel is actually
   scrolled into view. The point is to show a bar's magnitude by how far it
   grows and a line's shape by how it draws — motion that carries the data.
   Nothing loops, nothing moves after it has arrived, and a page left open does
   not twitch at someone working next to it.

   All of it is off under prefers-reduced-motion, where every element is simply
   rendered in its final state.
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  /* Bars and meters grow from nothing to their width. The stagger follows the
     reading order, so the funnel fills top to bottom like a sentence. */
  .nx-viz.ready .nx-funnel-s .fill,
  .nx-viz.ready .nx-dl-r .fill,
  .nx-viz.ready .nx-meter .seg {
    animation: nx-grow .62s cubic-bezier(.22,.9,.32,1) backwards;
    animation-delay: calc(var(--i, 0) * 70ms);
  }

  /* The trend line draws itself left to right. */
  .nx-viz.ready .nx-chart .line {
    stroke-dasharray: 1; stroke-dashoffset: 0;
    animation: nx-draw .95s ease-out backwards;
  }
  .nx-viz.ready .nx-chart .area,
  .nx-viz.ready .nx-chart .dot { animation: nx-fade .5s ease-out .5s backwards; }

  /* The donut sweeps round from twelve o'clock. */
  .nx-viz.ready .nx-donut .seg {
    animation: nx-sweep .8s cubic-bezier(.22,.9,.32,1) backwards;
  }

  .nx-viz.ready .nx-card { animation: nx-rise .45s ease-out backwards; }
  .nx-viz.ready .nx-card:nth-child(2) { animation-delay: .06s; }
  .nx-viz.ready .nx-card:nth-child(3) { animation-delay: .12s; }
  .nx-viz.ready .nx-card:nth-child(4) { animation-delay: .18s; }
}

@keyframes nx-grow  { from { width: 0; } }
@keyframes nx-draw  { from { stroke-dashoffset: 1; } }
@keyframes nx-fade  { from { opacity: 0; } }
@keyframes nx-rise  { from { opacity: 0; transform: translateY(6px); } }
@keyframes nx-sweep { from { stroke-dasharray: 0 999; } }

/* The one exception that keeps moving: something genuinely overdue. It stops
   being decoration and starts being an alarm, so it is allowed to repeat —
   and it is the only thing on the page that does. */
@media (prefers-reduced-motion: no-preference) {
  .nx-card-f.bad i { animation: nx-pulse 2.4s ease-in-out infinite; }
}
@keyframes nx-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ==========================================================================
   PANELS THAT MUST STAY PUT WHILE A LIST SCROLLS
   --------------------------------------------------------------------------
   The Stock screen is a long list on the left and an "Add SKU" form on the
   right. Both sat in the same scrolling canvas, so working down 53 SKUs
   carried the form off the top of the screen — and the form is the thing you
   are there to use. Scrolling back up to reach it, then back down to find
   your place, for every SKU, is the whole task made twice as long.

   The form is pinned instead. It scrolls internally if it is ever taller than
   the frame, so a long form is still reachable; it is never taller than the
   window and never clipped.

   Only from 1200px, which is where Bootstrap's col-xl actually puts the two
   side by side. Below that they are stacked, the form is a section of the
   page rather than a companion to the list, and pinning it would cover the
   list it is meant to sit beside.
   ========================================================================== */

@media (min-width: 1200px) {
  #stock-form-card {
    position: sticky;
    /*
     * top: 0, not the height of the top bar.
     *
     * Sticky positions against the nearest SCROLLING ancestor, and since the
     * desktop frame that is .nx-content, whose top edge already sits below the
     * header. Offsetting by the header height again — which is what the older
     * sticky rules in this file do — would push the panel a further 100px down
     * and leave a gap the list scrolls through.
     */
    top: 0;
    max-height: calc(100vh - var(--nx-top-h) - 2.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  #stock-form-card::-webkit-scrollbar { width: 6px; }
  #stock-form-card::-webkit-scrollbar-thumb { background: var(--ax-border); border-radius: 4px; }
}

/*
 * The settings rail had the same stale offset.
 *
 * It was written when the whole document scrolled, so it pinned itself below
 * the header with `top: calc(var(--nx-top-h) + .9rem)`. Inside the fixed frame
 * that measurement is applied a second time, against a scrollport that already
 * starts below the header — so the rail floated ~100px too low and its bottom
 * was cut off. Corrected here rather than at the original rule, so the
 * pre-frame layout below 992px keeps the offset it still needs.
 */
@media (min-width: 992px) {
  .nx-set-rail {
    top: 0;
    max-height: calc(100vh - var(--nx-top-h) - 2.5rem);
  }
}

/* -------------------------------------------------------------------------
   Brand lockup — uppercase name, mark sits AFTER the text.
   The name reads as "W&R TECHNOLOGIES", matching the logo wordmark, and the
   W-mark trails it (markup already orders text → mark). site_name stays
   title-case in settings, emails, titles and the footer; only the header
   lockup is uppercased here.
   ------------------------------------------------------------------------- */
.nx-brand-txt .nm { text-transform: uppercase; letter-spacing: .02em; }

/* Header W-mark — smaller, so it sits level with the two-line name block
   instead of standing taller than it. */
.nx-brand img { height: 24px; }
@media (max-width: 991.98px) { .nx-brand img { height: 22px; } }

/* ==========================================================================
   AUDIT 2026-09 — phone polish. Later rules win; nothing above is edited.
   ========================================================================== */

/* Phones and tablets zoom the whole page when a field smaller than 16px is
   focused, and do not zoom back out. 16px stops that. */
@media (max-width: 991.98px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]):not(.nx-code),
  select, textarea, .form-control:not(.nx-code), .form-select { font-size: 16px !important; }
}

/* On phones the one-line footer is pinned to the bottom of the screen and sat
   on top of the save bar, hiding most of the Save button. The bar now stops
   just above it. */
@media (max-width: 991.98px) {
  .nx-savebar { bottom: var(--nx-foot-h, 26px); }
}

/* Mobile browsers count the space behind the address bar in 100vh, so a
   "full-height" screen was taller than the visible area. dvh is the visible
   height; browsers without it keep the vh value above. */
@supports (height: 100dvh) {
  .ax-main  { min-height: 100dvh; }
  .ax-login { min-height: 100dvh; }
}

/* ---- Quotation: Find customer (buyer card) ---- */
.nx-buyer-find { position: relative; }
.nx-buyer-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% - 1.4rem);
  margin: 0; padding: .25rem; list-style: none; max-height: 320px; overflow-y: auto;
  background: var(--ax-surface); border: 1px solid var(--ax-border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15,23,42,.14);
}
.nx-buyer-list li { padding: .5rem .65rem; border-radius: 8px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: .1rem .5rem; color: var(--ax-text); }
.nx-buyer-list li.on, .nx-buyer-list li[data-i]:hover { background: var(--ax-surface-2); }
.nx-buyer-list li small { grid-column: 1 / -1; color: var(--ax-muted); overflow-wrap: anywhere; }
.nx-buyer-list .nx-buyer-src { font-size: .72rem; color: var(--ax-muted); align-self: center; white-space: nowrap; }
.nx-buyer-list .nx-buyer-empty { cursor: default; color: var(--ax-muted); }
.nx-buyer-linked { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; font-size: .85rem; margin: -.25rem 0 .9rem; padding: .45rem .7rem; border-radius: 8px; background: color-mix(in srgb, #16a34a 10%, transparent); color: var(--ax-text); }
.nx-buyer-linked .bi { color: #16a34a; }

/* A flex child that may shrink below its content (used by eleven pages, but
   never defined until now): long emails and names truncate instead of
   pushing the page sideways on a phone. */
.min-w-0 { min-width: 0 !important; max-width: 100%; }
