/* Classic-ERP theme: muted slate/steel palette, dense grids, beveled controls.
   Deliberately low-chroma to evoke older enterprise software. */
:root {
  --bg:        #d7d7d2;
  --panel:     #eceae4;
  --panel-2:   #e2e0d8;
  --content:   #ffffff;
  --border:    #b3b1a8;
  --border-dk: #97958c;
  --titlebar:  linear-gradient(180deg, #3d4a5e 0%, #2c3645 100%);
  --menubar:   linear-gradient(180deg, #51617c 0%, #44526a 100%);
  --accent:    #3a5778;
  --accent-2:  #4d6f95;
  --text:      #232830;
  --muted:     #6a7078;
  --field-bg:  #ffffff;
  --row-alt:   #f6f6f3;
  --row-hover: #e6eef6;
  --row-sel:   #d3e2f2;
  --ok:        #4f7a46;
  --ok-bg:     #e4efe0;
  --warn:      #8a6d2f;
  --warn-bg:   #f4ecd8;
  --bad:       #9a4a44;
  --bad-bg:    #f1ddda;
  --info:      #3f6080;
  --info-bg:   #dde7f1;
  --neutral:   #5d636b;
  --neutral-bg:#e7e6e1;
  --shadow:    0 2px 8px rgba(0,0,0,.18);
  --mono: "Consolas","SFMono-Regular",Menlo,monospace;
  --ui: "Segoe UI",Tahoma,Geneva,Verdana,sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); }

/* ----------------------------------------------------------------- login */
#login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 600px at 70% -10%, #46566e 0%, transparent 60%),
    linear-gradient(135deg, #2c3645 0%, #1e2530 100%);
}
.login-card {
  width: 760px; max-width: 94vw;
  background: var(--panel);
  border: 1px solid var(--border-dk);
  box-shadow: var(--shadow);
  display: grid; grid-template-columns: 1.1fr 1fr;
}
.login-brand {
  background: var(--titlebar);
  color: #eef2f7; padding: 34px 30px;
  display: flex; flex-direction: column; gap: 10px;
}
.login-brand .logo {
  width: 46px; height: 46px; border: 2px solid #9fb3cb; color: #cfe0f2;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; border-radius: 4px; margin-bottom: 6px;
}
.login-brand h1 { margin: 0; font-size: 22px; letter-spacing: .5px; }
.login-brand p { margin: 0; color: #aebdce; font-size: 12.5px; line-height: 1.6; }
.login-brand .ver { margin-top: auto; color: #8595a8; font-size: 11px; }
.login-form { padding: 30px 28px; }
.login-form h2 { margin: 0 0 4px; font-size: 16px; }
.login-form .hint { margin: 0 0 18px; color: var(--muted); font-size: 12px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 7px 9px; font-family: var(--ui); font-size: 13px;
  background: var(--field-bg); color: var(--text);
  border: 1px solid var(--border-dk); border-top-color: #8a887f; border-radius: 2px;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.2);
}
.login-error { color: var(--bad); background: var(--bad-bg); border: 1px solid #d8b5b1;
  padding: 7px 10px; font-size: 12px; margin-bottom: 12px; border-radius: 2px; }
.demo-accounts { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.demo-accounts h3 { margin: 0 0 8px; font-size: 11.5px; text-transform: uppercase; color: var(--muted); letter-spacing: .5px; }
.demo-list { display: flex; flex-direction: column; gap: 4px; max-height: 150px; overflow: auto; }
.demo-item {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  padding: 5px 8px; background: var(--content); border: 1px solid var(--border);
  cursor: pointer; font-size: 12px; border-radius: 2px;
}
.demo-item:hover { background: var(--row-hover); border-color: var(--accent-2); }
.demo-item .who { font-weight: 600; }
.demo-item .role { color: var(--muted); font-size: 11px; }

/* ---------------------------------------------------------------- buttons */
.btn {
  font-family: var(--ui); font-size: 12.5px; cursor: pointer;
  padding: 6px 13px; color: var(--text);
  background: linear-gradient(180deg, #fdfdfc 0%, #e3e1d9 100%);
  border: 1px solid var(--border-dk); border-radius: 2px;
}
.btn:hover { background: linear-gradient(180deg, #ffffff 0%, #e9e7df 100%); border-color: var(--accent-2); }
.btn:active { background: #dcdad2; }
.btn.primary { color:#fff; border-color:#2d465f; background:linear-gradient(180deg,#52749a 0%,#3a5778 100%); }
.btn.primary:hover { background: linear-gradient(180deg, #5b80aa 0%, #406185 100%); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: #c79; }
.btn.block { width: 100%; padding: 9px; font-size: 13.5px; }
.btn.sm { padding: 3px 8px; font-size: 11.5px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ------------------------------------------------------------------ shell */
#app { display: flex; flex-direction: column; height: 100vh; }
.titlebar {
  background: var(--titlebar); color: #eef2f7;
  display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 38px; flex: none;
  border-bottom: 1px solid #1c232e;
}
.titlebar .logo {
  width: 24px; height: 24px; border: 1px solid #8aa0bc; color: #cfe0f2; border-radius: 3px;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.titlebar .app-name { font-size: 14.5px; font-weight: 600; letter-spacing: .4px; }
.titlebar .org { color: #aebdce; font-size: 12px; padding-left: 10px; border-left: 1px solid #4a5a70; }
.titlebar .spacer { flex: 1; }
.titlebar .clock { color: #aebdce; font-size: 12px; font-variant-numeric: tabular-nums; }
.titlebar .user { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.titlebar .user .avatar {
  width: 24px; height: 24px; border-radius: 50%; background: #5b6f8c; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
}
.titlebar .user .role { color: #aebdce; font-size: 11px; }

.menubar { background: var(--menubar); display: flex; align-items: stretch; height: 34px; flex: none; border-bottom: 1px solid #34405230; box-shadow: 0 1px 0 rgba(0,0,0,.15); }
.menubar .m {
  display: flex; align-items: center; gap: 7px; padding: 0 15px; color: #dde5f0; cursor: pointer;
  font-size: 12.5px; border-right: 1px solid rgba(255,255,255,.06); user-select: none;
}
.menubar .m .g { font-size: 13px; opacity: .85; }
.menubar .m:hover { background: rgba(255,255,255,.08); color: #fff; }
.menubar .m.active { background: var(--bg); color: var(--accent); font-weight: 600; }

.body { flex: 1; display: flex; min-height: 0; }
.sidebar { width: 234px; flex: none; background: var(--panel); border-right: 1px solid var(--border-dk); overflow: auto; }
.sidebar .grp { padding: 9px 12px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.sidebar .item {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 14px; cursor: pointer;
  font-size: 12.5px; color: var(--text); border-left: 3px solid transparent;
}
.sidebar .item .g { width: 16px; text-align: center; color: var(--accent); opacity: .8; }
.sidebar .item:hover { background: var(--row-hover); }
.sidebar .item.active { background: var(--row-sel); border-left-color: var(--accent); font-weight: 600; }
.sidebar .item.child { padding-left: 30px; font-size: 12px; color: var(--muted); }
.sidebar .item .count { margin-left: auto; font-size: 10.5px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 0 6px; }

.main { flex: 1; min-width: 0; overflow: auto; background: var(--bg); padding: 12px; }
.statusbar {
  height: 24px; flex: none; background: var(--panel); border-top: 1px solid var(--border-dk);
  display: flex; align-items: center; gap: 14px; padding: 0 12px; font-size: 11.5px; color: var(--muted);
}
.statusbar .seg { padding-right: 14px; border-right: 1px solid var(--border); }
.statusbar .spacer { flex: 1; }

/* ------------------------------------------------------------------ panels */
.panel { background: var(--content); border: 1px solid var(--border-dk); border-radius: 2px; margin-bottom: 12px; }
.panel > .head {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: linear-gradient(180deg, #f3f2ee 0%, #e6e4dc 100%);
  border-bottom: 1px solid var(--border); font-weight: 600; font-size: 13px;
}
.panel > .head .g { color: var(--accent); }
.panel > .head .sub { font-weight: 400; color: var(--muted); font-size: 12px; }
.panel > .head .spacer { flex: 1; }
/* a panel body lays its content out as blocks: the shell's .body (flex, sidebar + main) is a different thing -
   as flex it shrank tables to their content and let wide ones push past the panel instead of scrolling */
.panel > .body { padding: 12px; display: block; }
.page-title { display: flex; align-items: center; gap: 10px; margin: 2px 2px 12px; }
.page-title h1 { font-size: 18px; margin: 0; font-weight: 600; }
.page-title .desc { color: var(--muted); font-size: 12.5px; }
.crumbs { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.crumbs b { color: var(--text); }

/* ------------------------------------------------------------------- cards */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(184px, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpi {
  background: var(--content); border: 1px solid var(--border-dk); border-top: 3px solid var(--accent);
  padding: 11px 13px; border-radius: 2px; cursor: default;
}
.kpi .label { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; }
.kpi .value { font-size: 23px; font-weight: 600; margin-top: 5px; font-variant-numeric: tabular-nums; }
.kpi .value.sm { font-size: 18px; }
.kpi .sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.kpi.accent2 { border-top-color: #5a7a52; }
.kpi.accent3 { border-top-color: #8a6d2f; }
.kpi.accent4 { border-top-color: #9a4a44; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 1100px) { .grid2, .grid3 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------- table */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar input[type=search], .toolbar input.search {
  padding: 6px 9px; border: 1px solid var(--border-dk); border-radius: 2px; min-width: 220px; font-size: 12.5px;
}
.toolbar select { padding: 5px 7px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; }

/* every data table scrolls inside its own box, across and down, its header row kept in view (sticky th);
   a box with its own height (modals, reports) keeps that */
.tablewrap { overflow: auto; max-height: 70vh; border: 1px solid var(--border-dk); background: var(--content); }
.tablewrap > table.grid > thead th { z-index: 2; }
.tablewrap:not(.jc-work-wrap) > table.grid > tfoot td { position: sticky; bottom: 0; z-index: 1; background: var(--panel-2); }
table.grid { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.grid th {
  position: sticky; top: 0; text-align: left; padding: 7px 10px; white-space: nowrap;
  background: linear-gradient(180deg, #f1f0ec 0%, #e3e1d9 100%);
  border-bottom: 1px solid var(--border-dk); border-right: 1px solid var(--border);
  font-weight: 600; cursor: pointer; user-select: none;
}
table.grid th .arrow { color: var(--accent); font-size: 10px; margin-left: 3px; }
table.grid th.nosort { cursor: default; }
table.grid td { padding: 6px 10px; border-bottom: 1px solid #ececec; border-right: 1px solid #f0f0f0; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
table.grid tr:nth-child(even) td { background: var(--row-alt); }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover td { background: var(--row-hover); }
table.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.muted { color: var(--muted); }
table.grid .filters th { background: var(--panel-2); padding: 4px 6px; cursor: auto; }
table.grid .filters input, table.grid .filters select { width: 100%; padding: 3px 5px; font-size: 11.5px; border: 1px solid var(--border); border-radius: 2px; }
.rowactions { display: flex; gap: 5px; }
.empty { padding: 26px; text-align: center; color: var(--muted); }

.pager { display: flex; align-items: center; gap: 10px; margin-top: 9px; font-size: 12px; color: var(--muted); }
.pager .spacer { flex: 1; }

/* ------------------------------------------------------------------ badges */
.badge { display: inline-block; padding: 1px 8px; border-radius: 9px; font-size: 11px; font-weight: 600; border: 1px solid; line-height: 1.5; }
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: #bcd3b3; }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: #ddca9d; }
.badge.bad { color: var(--bad); background: var(--bad-bg); border-color: #d8b5b1; }
.badge.info { color: var(--info); background: var(--info-bg); border-color: #b6c8db; }
.badge.neutral { color: var(--neutral); background: var(--neutral-bg); border-color: #cdccc4; }
.yn { font-weight: 600; }
.yn.y { color: var(--ok); }
.yn.n { color: var(--muted); }

/* ------------------------------------------------------------------- modal */
.modal-bg { position: fixed; inset: 0; background: rgba(20,25,33,.5); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 36px 16px; overflow: auto; }
.modal { width: 720px; max-width: 96vw; background: var(--panel); border: 1px solid var(--border-dk); box-shadow: var(--shadow); border-radius: 3px; }
.modal .m-head { background: var(--titlebar); color: #eef2f7; padding: 9px 14px; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; }
.modal .m-head .spacer { flex: 1; }
.modal .m-head .x { cursor: pointer; opacity: .8; font-size: 16px; }
.modal .m-head .x:hover { opacity: 1; }
.modal .m-body { padding: 14px 16px; max-height: 64vh; overflow: auto; background: var(--panel); }
.modal .m-foot { padding: 10px 14px; display: flex; gap: 8px; border-top: 1px solid var(--border); background: var(--panel-2); }
.modal .m-foot .spacer { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-field label { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); margin-bottom: 3px; }
.form-field label .req, table.grid th .req { color: var(--bad); }
.form-field .info-i { width: 13px; height: 13px; border: 1px solid var(--muted); color: var(--muted); border-radius: 50%; font-size: 9px; display: inline-flex; align-items: center; justify-content: center; cursor: help; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 6px 8px; font-family: var(--ui); font-size: 12.5px;
  border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg);
}
.form-field textarea { min-height: 64px; resize: vertical; font-family: var(--ui); }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
.form-field input[readonly], .form-field .ro { background: #efeee9; color: var(--muted); }
.form-field .gst-fetch-row { display: flex; gap: 8px; align-items: stretch; }
.form-field .gst-fetch-row input { flex: 1 1 auto; }
.form-field .gst-fetch-row .btn { flex: 0 0 auto; white-space: nowrap; }
/* Product master: long fields get a roomier, wrapping box */
.form-field.big input, .form-field.big select, .form-field.big textarea { font-size: 13.5px; padding: 8px 10px; }
.form-field.big textarea { min-height: 38px; line-height: 1.35; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.form-field textarea[data-pm="ProductName"], .form-field input[data-pm="ProductName"],.form-field textarea[data-pm="RegionalName"] { min-height: 38px; }
.form-field textarea[lang="mr"] { font-size: 15px; }
/* dropdown + quick-add "+" button */
.lookup-row { display: flex; gap: 6px; align-items: stretch; }
.lookup-row select { flex: 1 1 auto; min-width: 0; }
.add-btn { flex: 0 0 auto; width: 30px; border: 1px solid var(--border-dk); background: var(--panel-2);
  color: var(--accent); font-size: 17px; line-height: 1; border-radius: 2px; cursor: pointer; }
.add-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
/* quick-add modal form */
.ql-form { display: flex; flex-direction: column; gap: 10px; min-width: 320px; }
.ql-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.ql-field input { padding: 7px 9px; font-size: 13px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); }
/* base-unit merged cell in the packing-units grid */
table.grid.pm-units td.base-cell { font-style: italic; font-size: 11.5px; }
.form-field .chk { display: flex; align-items: center; gap: 7px; }
.form-field .chk input { width: auto; }
/* "Have different shipping address?" toggle + the collapsible shipping block */
.form-field.ship-toggle { margin-top: 2px; padding-top: 11px; border-top: 1px dashed var(--border); }
.form-field.ship-toggle label { color: var(--text); font-size: 12.5px; cursor: pointer; margin-bottom: 0; }
.ship-fields { display: contents; }
.ship-fields[hidden] { display: none; }
/* organization "other registrations": type + number + Add, then chips */
.reg-add-row { display: flex; gap: 6px; align-items: stretch; }
.reg-add-row select { flex: 0 0 130px; }
.reg-add-row input { flex: 1 1 auto; min-width: 0; }
.reg-add-row .btn { flex: 0 0 auto; white-space: nowrap; }
.reg-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; min-height: 18px; }
.reg-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; background: var(--panel-2); border: 1px solid var(--border-dk); border-radius: 12px; font-size: 12px; font-family: var(--mono, monospace); }
.reg-chip b { font-family: var(--ui); font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--accent); }
.reg-chip .reg-x { cursor: pointer; color: var(--muted); font-size: 11px; margin-left: 2px; }
.reg-chip .reg-x:hover { color: var(--bad); }
.form-msg { color: var(--bad); background: var(--bad-bg); border: 1px solid #d8b5b1; padding: 7px 10px; font-size: 12px; margin-bottom: 10px; border-radius: 2px; }

/* ------------------------------------------------------------------ charts */
.chart svg { display: block; width: 100%; height: auto; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.legend .it { display: flex; align-items: center; gap: 5px; }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.barrow { display: grid; grid-template-columns: 130px 1fr 64px; align-items: center; gap: 8px; margin: 5px 0; font-size: 12px; }
.barrow .track { background: var(--panel-2); border: 1px solid var(--border); height: 15px; border-radius: 2px; overflow: hidden; }
.barrow .fill { height: 100%; background: linear-gradient(180deg, #5a7ea6 0%, #3a5778 100%); }
.barrow .lbl { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barrow .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ------------------------------------------------------------ reports tab */
/* call-to-action panel body (e.g. "Open Reports" on a dashboard) */
.cta-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text); }
.cta-row > div { flex: 1; min-width: 220px; }
.cta-row .btn { white-space: nowrap; }
/* small inline label before the visualisation switcher in a panel head */
.chip-label { font-weight: 400; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-right: 2px; }
/* chart-type switcher chips (a denser .chip variant) */
.chip.active, .chart-chip.active { background: var(--row-sel); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.chart-chip { padding: 2px 8px; font-size: 11.5px; }
/* recommended-visualisation footnote under a chart */
.rec-note { margin-top: 10px; padding-top: 8px; border-top: 1px solid #ececec; font-size: 11.5px; color: var(--muted); }
.rec-note b { color: var(--accent); }

/* ------------------------------------------------------------------ admin */
.split { display: grid; grid-template-columns: 250px 1fr; gap: 12px; align-items: start; }
.tablelist { background: var(--content); border: 1px solid var(--border-dk); max-height: 72vh; overflow: auto; }
.tablelist .grp { padding: 7px 10px 3px; font-size: 10.5px; text-transform: uppercase; color: var(--muted); letter-spacing: .5px; background: var(--panel-2); position: sticky; top: 0; }
.tablelist .t { padding: 5px 12px; cursor: pointer; font-size: 12.5px; display: flex; gap: 8px; align-items: center; }
.tablelist .t:hover { background: var(--row-hover); }
.tablelist .t.active { background: var(--row-sel); font-weight: 600; }
.tablelist .t .g { color: var(--accent); width: 15px; text-align: center; }
.tablelist .t .count { margin-left: auto; color: var(--muted); font-size: 10.5px; }
.subtabs { display: flex; gap: 0; margin-bottom: 12px; border-bottom: 1px solid var(--border-dk); }
.subtabs .st { padding: 7px 16px; cursor: pointer; font-size: 12.5px; border: 1px solid transparent; border-bottom: none; color: var(--muted); }
.subtabs .st.active { background: var(--content); border-color: var(--border-dk); color: var(--accent); font-weight: 600; border-radius: 3px 3px 0 0; margin-bottom: -1px; }
table.detail { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.detail th, table.detail td { text-align: left; padding: 6px 10px; border-bottom: 1px solid #ececec; }
table.detail th { background: var(--panel-2); font-weight: 600; white-space: nowrap; }
table.detail td.mono { font-family: var(--mono); font-size: 12px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; margin: 3px 4px 3px 0; background: var(--panel); border: 1px solid var(--border-dk); border-radius: 12px; font-size: 12px; cursor: pointer; }
.chip:hover { background: var(--row-hover); border-color: var(--accent-2); }
.chip .g { color: var(--accent); }
.rel-cols { columns: 2; }
.tag { display:inline-block; padding:0 6px; font-size:10.5px; border-radius:3px; border:1px solid var(--border); background:var(--panel-2); color:var(--muted); margin-left:6px; }
.tag.pk { color:#8a6d2f; background:var(--warn-bg); border-color:#ddca9d; }
.tag.fk { color:var(--info); background:var(--info-bg); border-color:#b6c8db; }

/* ----------------------------------------------------------------- tooltip */
#tooltip {
  position: fixed; z-index: 100; max-width: 320px; padding: 8px 11px;
  background: #2b3340; color: #eef2f7; font-size: 12px; line-height: 1.5;
  border: 1px solid #1b2128; border-radius: 4px; box-shadow: var(--shadow);
  pointer-events: none; opacity: 0; transition: opacity .08s; white-space: pre-line; }
#tooltip.show { opacity: 1; }
#tooltip .tt-title { font-weight: 700; margin-bottom: 2px; color: #fff; }
.help { cursor: help; border-bottom: 1px dotted var(--muted); }
.info-dot { display:inline-flex; width:15px; height:15px; align-items:center; justify-content:center; border:1px solid var(--muted); color:var(--muted); border-radius:50%; font-size:10px; cursor:help; }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 30px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------- customer form */
/* Wider modal for the Customer record (many sections) */
.modal.modal-wide { width: 860px; }
/* Section dividers inside the form grid */
.form-section-hdr {
  grid-column: 1 / -1;
  margin-top: 6px; padding: 4px 0 2px;
  border-top: 1px solid var(--border);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .55px;
  color: var(--muted);
}
.form-section-hdr:first-child { margin-top: 0; border-top: none; }

/* ---- Delivery addresses sub-panel (inside customer edit modal) ---- */
.cust-addr-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 2px solid var(--border-dk);
}
.cust-addr-hdr {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
  font-size: 12px; font-weight: 700; color: var(--text);
  text-transform: uppercase; letter-spacing: .4px;
}
.cust-addr-title { color: var(--accent); }
.cust-addr-list { display: flex; flex-direction: column; gap: 7px; }
.addr-row {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: 3px;
  padding: 8px 10px;
}
.addr-top {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 5px;
}
.addr-label { font-weight: 600; font-size: 12.5px; color: var(--text); }
.addr-top .btn { margin-left: auto; }
.addr-body { font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.addr-line { }
.addr-remarks { font-style: italic; }
/* click-through: a message only - shown or faded out, it must never swallow a
   click meant for what lies under it */
.toast { position: fixed; bottom: 34px; right: 16px; z-index: 120; background: #2b3340; color: #fff; padding: 10px 14px; border-radius: 3px; box-shadow: var(--shadow); font-size: 12.5px; opacity: 0; transform: translateY(8px); transition: all .15s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
/* refused / failed (toast(msg, 'bad'), older code says 'err'), done, and a notice */
.toast.err, .toast.bad { background: #7a3a36; }
.toast.ok { background: #3f6045; }
.toast.info { background: #34506e; }

/* ------------------------------------------------------ invoice billing */
.bill-head { display: grid; grid-template-columns: 150px 170px 150px 1fr; gap: 12px; background: var(--content);
  border: 1px solid var(--border-dk); padding: 10px 14px; margin-bottom: 12px; align-items: start; }
.bill-head label { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin-bottom: 3px; }
.bill-head .bill-no { font-size: 16px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.bill-head input[type=date] { padding: 5px 7px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; }
.bill-head .bill-cust { font-size: 12.5px; }
.bill-head .bill-cust .badge { margin-left: 6px; }
.bill-head .bill-no-hint { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
/* billing customer cell: search box + quick-add "+", GST / region details below */
.bill-head .bill-cust .lookup-row { max-width: 600px; }
.bill-head .bill-cust .ta-wrap > input { padding: 5px 8px; font-size: 13px; font-family: var(--ui); background: var(--field-bg);
  border: 1px solid var(--border-dk); border-radius: 2px; }
.bill-head .bill-cust .ta-wrap > input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
.bill-head .bill-cust .ta-wrap > input:disabled { background: #efeee9; color: var(--muted); }
.bill-head .bill-cust .ta-pop { min-width: 420px; }
.bill-cust-info { margin-top: 5px; font-size: 12px; line-height: 1.6; }
/* Last saved: the bill just saved (the screen moved on to a new one), with
   Print again / Open - at the right of the screen title */
.bill-screen .page-title { flex-wrap: wrap; row-gap: 6px; }
.last-saved { margin: -2px 0 -2px auto; display: inline-flex; align-items: center; flex-wrap: wrap; gap: 0 6px; padding: 2px 10px;
  font-size: 12px; line-height: 18px; background: var(--ok-bg); border: 1px solid #bcd3b3; border-radius: 3px; color: var(--text); }
.last-saved .ls-ok { color: var(--ok); font-weight: 700; }
.last-saved b { color: var(--ok); font-variant-numeric: tabular-nums; }
.last-saved .ls-sep { color: var(--muted); }
.last-saved .ls-cust { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.last-saved a { font-weight: 600; text-decoration: none; }
.last-saved a:hover { text-decoration: underline; }

/* purchase-doc header: wider Date/No column for the stacked mini-table */
.bill-head.pd-head { grid-template-columns: 150px 290px 130px 1fr; }
/* Date / No as a borderless two-column table - value sits under its heading */
.dn-table { border-collapse: collapse; }
.dn-table th, .dn-table td { border: 0; padding: 0 26px 0 0; text-align: left; vertical-align: middle; background: none; }
.dn-table th label { margin-bottom: 3px; }
.dn-table td .bill-no { white-space: nowrap; }

/* purchase entry: Add items - the Scan button, the scan box and the item search */
.scan-row { display: flex; gap: 8px; align-items: center; }
.scan-row input { flex: 1; max-width: 420px; padding: 7px 9px; font-size: 13px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); }

/* item cell opens the picker popup */
table.grid.bill-items input.pd-item { cursor: pointer; }

/* totals box: Tax Total sub-label + Other Charges button row + grand total */
.bill-totals .bt-sub { font-size: 10.5px; color: var(--muted); font-weight: 400; }
.bill-totals .bt-chg .btn { font-size: 11.5px; }
/* purchase Round Off row: the nearest-rupee button beside the typed box */
.bill-totals .pd-ro-in { display: flex; align-items: center; gap: 6px; }
.bill-totals .pd-ro-in .btn { font-size: 11.5px; padding: 3px 7px; }
.bill-totals .grand { background: var(--panel-2); font-weight: 700; font-size: 14px; color: var(--accent); }

/* Other Charges popup: ± toggle + charge name + float amount per row */
.chg-box { min-width: 360px; }
.chg-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.chg-sign { flex: 0 0 30px; width: 30px; height: 30px; border: 1px solid var(--border-dk); border-radius: 2px;
  background: var(--ok-bg, #e7f0e7); color: var(--ok, #2c6e2c); font-size: 17px; font-weight: 700; line-height: 1; cursor: pointer; }
.chg-sign.minus { background: #f6e8e8; color: var(--bad); }
.chg-sign:disabled { opacity: .5; cursor: default; }
.chg-name { flex: 1; font-size: 12.5px; }
.chg-row input { flex: 0 0 130px; text-align: right; padding: 7px 9px; font-size: 13px;
  border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); font-variant-numeric: tabular-nums; }
.chg-net { display: flex; justify-content: space-between; border-top: 1px dashed var(--border-dk);
  margin-top: 10px; padding-top: 8px; font-size: 12.5px; font-weight: 700; }

/* known-lots popup */
.lp-box { min-width: 480px; max-width: 640px; }
.modal.modal-wide .lp-box { max-width: none; }
.lp-note { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.lp-box tr.pick { cursor: pointer; }
/* the lot popup is worked from the keyboard: the highlighted lot (arrows, or the mouse over it) */
.lp-box tr.pick.lp-on td, .lp-box tr.pick:hover td { background: var(--accent); color: #fff; }
.lp-box tr.pick.lp-on td .muted, .lp-box tr.pick.lp-on td.muted, .lp-box tr.pick:hover td .muted, .lp-box tr.pick:hover td.muted { color: rgba(255,255,255,.8); }
.lp-box tr.pick.lp-expired td:first-child b { text-decoration: line-through; text-decoration-color: rgba(154,74,68,.6); }
.lp-q { display: block; width: 100%; box-sizing: border-box; margin: 0 0 8px; padding: 7px 9px; font-size: 13px; border: 1px solid var(--accent-2); border-radius: 2px; background: var(--field-bg); }
.lp-q:focus { outline: 2px solid rgba(77,111,149,.35); }
.lp-keys { margin-top: 7px; font-size: 11.5px; color: var(--muted); }
.lp-keys kbd, .lp-box td.empty kbd { display: inline-block; padding: 0 5px; border: 1px solid var(--border-dk); border-bottom-width: 2px; border-radius: 3px; background: var(--content); font: 11px var(--mono); color: var(--text); margin: 0 1px; }
.lp-scroll thead th { position: sticky; top: 0; z-index: 1; }

/* item-picker popup: column select + search + live suggestions + detail row */
.ip-box { min-width: 560px; max-width: 760px; }
.ip-row { display: flex; gap: 8px; margin-bottom: 8px; }
.ip-row select { flex: 0 0 160px; }
.ip-row input { flex: 1; min-width: 0; }
.ip-row select, .ip-row input { padding: 7px 9px; font-size: 13px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); }
.ip-list { max-height: 240px; overflow: auto; border: 1px solid var(--border); }
.ip-item { padding: 6px 10px; font-size: 12.5px; cursor: pointer; border-bottom: 1px dotted var(--border); display: flex; align-items: baseline; gap: 6px; }
.ip-item:last-child { border-bottom: 0; }
.ip-item:hover, .ip-item.active { background: var(--accent); color: #fff; }
.ip-item:hover .muted, .ip-item.active .muted, .ip-item:hover .ta-side, .ip-item.active .ta-side { color: rgba(255,255,255,.8); }
.ip-item mark { background: var(--warn-bg); padding: 0; font-weight: 600; color: inherit; }
.ip-item:hover mark, .ip-item.active mark { background: transparent; text-decoration: underline; }
.ip-none { padding: 14px; font-size: 12.5px; color: var(--muted); text-align: center; }
.ip-detail { margin-top: 10px; }

/* line-item table: inputs sit flush inside the cells */
table.grid.bill-items th { font-size: 10.5px; }
table.grid.bill-items td { padding: 2px 4px; vertical-align: middle; }
table.grid.bill-items input, table.grid.bill-items select {
  width: 100%; border: 1px solid transparent; background: transparent; padding: 5px 6px; font-size: 12.5px;
  border-radius: 2px; font-family: var(--ui); }
table.grid.bill-items input:hover, table.grid.bill-items select:hover { border-color: var(--border); background: var(--content); }
table.grid.bill-items input:focus, table.grid.bill-items select:focus { outline: none; border-color: var(--accent-2);
  background: var(--field-bg); box-shadow: 0 0 0 2px rgba(77,111,149,.16); }
table.grid.bill-items input.num { text-align: right; font-variant-numeric: tabular-nums; }
/* a discount the line got by itself (Sales Discount, or the lot's own) */
table.grid.bill-items input.disc-auto, table.grid.bill-items input.disc-auto:hover { background: var(--ok-bg); border-color: #b9d1b1; font-weight: 600; }
.row-del { color: var(--muted); cursor: pointer; display: inline-block; width: 20px; text-align: center; border-radius: 3px; }
.row-del:hover { color: var(--bad); background: var(--bad-bg); }
/* billing lines: full-width table (the shell's generic .body rule would make the
   panel body a flex row that shrinks the table to its content), delete action
   first, read-only Item Code, empty-bill hint */
.panel.bill-lines > .body { display: block; }
table.grid.bill-items td.bill-del { text-align: center; }
table.grid.bill-items td.bill-code { font-variant-numeric: tabular-nums; color: var(--muted); }
table.grid.bill-items tr.bill-empty td { cursor: default; background: var(--content); white-space: normal; max-width: none; }
/* a line whose qty was just bumped by Select Item */
@keyframes bill-flash { from { background-color: #f6e3a6; } }
table.grid.bill-items tr.flash td { animation: bill-flash 1.1s ease-out; }

/* Select Item: wide search box in the items panel head */
.bill-sel { position: relative; flex: 0 1 560px; min-width: 240px; margin-left: 14px; font-weight: 400; }
.bill-sel-ico { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); z-index: 1; color: var(--accent); font-size: 14px; pointer-events: none; }
.bill-sel .ta-wrap > input { padding: 6px 9px 6px 27px; font-size: 13px; font-family: var(--ui); background: var(--field-bg);
  border: 1px solid var(--border-dk); border-radius: 2px; }
.bill-sel .ta-wrap > input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
.bill-sel .ta-wrap > input:disabled { background: #efeee9; }
.bill-sel .ta-pop { min-width: 460px; max-height: min(430px, 55vh); }   /* every item that matches, in a taller scrolling list */

/* totals box, right-aligned under the items */
.bill-totals { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.bill-totals .bt-box { width: 320px; background: var(--content); border: 1px solid var(--border-dk); }
.bill-totals .bt-box > div { display: flex; justify-content: space-between; align-items: center;
  padding: 6px 12px; font-size: 12.5px; border-bottom: 1px solid #ececec; }
.bill-totals .bt-box > div:last-child { border-bottom: none; }
.bill-totals .num { font-variant-numeric: tabular-nums; }
.bill-totals .bt-disc input { width: 110px; text-align: right; padding: 4px 6px; border: 1px solid var(--border-dk);
  border-radius: 2px; font-variant-numeric: tabular-nums; }
.bill-totals .bt-disc input.bad { border-color: var(--bad); background: var(--bad-bg); }   /* more than the bill */
.bill-totals .bt-disc input:disabled { background: #efeee9; color: var(--text); }          /* locked (rights / read-only) */
/* this login's discount limit (Administration > Users) under the Discount box */
.bill-totals .bt-box > .bt-dlimit { justify-content: flex-end; padding: 2px 12px 5px; font-size: 11px; }
.bill-totals .bt-box > .bt-dlimit[hidden] { display: none; }
.bill-totals .bt-total { background: var(--panel-2); font-weight: 700; font-size: 14px; color: var(--accent); }
/* mode of payment rows under the TOTAL: mode (+ card link), amount, remove;
   then Paid, Balance due (Udhaari) and Remaining */
.bill-totals .bt-box > .bt-pay-head { padding: 4px 12px; background: var(--panel); font-size: 10.5px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .4px; }
.bill-totals .bt-pay-head a { font-size: 11.5px; text-transform: none; letter-spacing: 0; }
.bill-totals .bt-box > .bt-pay { gap: 6px; padding: 4px 6px 4px 12px; }
.bill-totals .bt-pay-mode { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.bill-totals .pay-card { font-size: 10.5px; color: var(--accent); align-self: flex-start; }
.bill-totals .bt-pay input { width: 110px; text-align: right; padding: 4px 6px; border: 1px solid var(--border-dk);
  border-radius: 2px; font-variant-numeric: tabular-nums; }
.bill-totals .bt-pay input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
.bill-totals .bt-pay input:disabled { background: #efeee9; color: var(--text); }
.bill-totals .bt-pay input.bad { border-color: var(--bad); background: var(--bad-bg); }
.bill-totals .bt-paid { font-weight: 600; }
.bill-totals .bt-udhaari { color: var(--warn); font-weight: 600; }
.bill-totals .bt-rem { font-weight: 700; }
.bill-totals .bt-rem.due .num { color: var(--bad); }
.bill-totals .bt-rem.done .num { color: var(--ok); }
/* beside TOTAL: what the payment modes still leave of it (the Remaining row
   below may be out of sight on a laptop screen) */
.bill-totals .bt-left { margin-left: 8px; padding: 0 5px; font-size: 11px; font-weight: 600; color: var(--bad); background: var(--bad-bg);
  border: 1px solid #dcb3ae; border-radius: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; vertical-align: 1px; }
.bill-totals .bt-left[hidden] { display: none; }

/* Mode of Payment selector + card details (small dialogs) */
.modal.modal-sm { width: 500px; }
.pay-modes { display: flex; flex-direction: column; gap: 5px; }
.pay-mode { display: grid; grid-template-columns: 18px 128px 1fr; align-items: center; gap: 8px; padding: 7px 10px;
  background: var(--content); border: 1px solid var(--border); border-radius: 2px; cursor: pointer; font-size: 12.5px; }
.pay-mode:hover { background: var(--row-hover); border-color: var(--accent-2); }
.pay-mode:has(input:checked) { background: var(--row-sel); border-color: var(--accent-2); }
.pay-mode input { margin: 0; }
.pay-mode .muted { font-size: 11.5px; }
.card-note { color: var(--warn); background: var(--warn-bg); border: 1px solid #ddca9d; padding: 7px 10px; font-size: 12px;
  margin-bottom: 12px; border-radius: 2px; }

/* Delivery Status: badge beside Status, a delivered line's truck (instead of
   its delete), the checklist popup with its log */
.bill-head .bill-status { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.row-lock { color: var(--ok); cursor: help; display: inline-block; width: 20px; text-align: center; }
.dl-intro { margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.dl-intro.dl-untracked { color: var(--warn); background: var(--warn-bg); border: 1px solid #ddca9d; padding: 7px 10px; border-radius: 2px; }
.dl-wrap { max-height: 44vh; }
table.grid.dl-table tbody tr { cursor: default; }
table.grid.dl-table td { padding: 4px 8px; vertical-align: middle; }
table.grid.dl-table th.num, .dl-log table.grid th.num { text-align: right; }
table.grid.dl-table .dl-chk { width: 34px; text-align: center; }
table.grid.dl-table input[type=checkbox] { margin: 0; cursor: pointer; }
table.grid.dl-table input[type=checkbox]:disabled { cursor: default; }
table.grid.dl-table .dl-name { max-width: 260px; }
table.grid.dl-table input[type=number] { width: 96px; padding: 4px 6px; text-align: right; font-family: var(--ui); font-size: 12.5px;
  border: 1px solid var(--border-dk); border-radius: 2px; font-variant-numeric: tabular-nums; }
table.grid.dl-table input[type=number]:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
table.grid.dl-table input[type=number]:disabled { background: #efeee9; color: var(--muted); }
table.grid.dl-table input.bad { border-color: var(--bad); background: var(--bad-bg); }
table.grid.dl-table tr.dl-on td { background: var(--ok-bg); }
.dl-log { margin-top: 12px; font-size: 12px; }
.dl-log > summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.dl-log .tablewrap { margin-top: 6px; max-height: 26vh; }
.modal .m-foot .dl-after { align-self: center; font-size: 12px; color: var(--muted); }

/* action button grid */
.bill-actions { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
@media (max-width: 1100px) { .bill-actions { grid-template-columns: repeat(4, 1fr); } }
/* billing foot: the action buttons in the room left of the totals box (the
   totals come first in the page, for the Tab order), so Save and the TOTAL
   stay in view together on a laptop screen - in the same 7-per-row order as
   ever. Labels wrap at spaces (Replace-ment at its soft hyphen), and inside a
   word only when nothing else fits. Below 1280px the buttons stack under the
   totals again. */
.bill-foot { display: flex; flex-direction: row-reverse; align-items: flex-start; gap: 12px; }
.bill-foot > .bill-actions { flex: 1 1 auto; min-width: 0; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.bill-foot > .bill-totals { flex: none; margin-bottom: 0; }
.bill-foot .bill-btn > span { overflow-wrap: anywhere; }
@media (max-width: 1279px) { .bill-foot { flex-direction: column; align-items: stretch; } }
@media (max-width: 1100px) { .bill-foot > .bill-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bill-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 58px; padding: 8px 6px; background: linear-gradient(180deg, #f7f6f2 0%, #e9e7df 100%);
  border: 1px solid var(--border-dk); border-radius: 3px; cursor: pointer; font-size: 11px; color: var(--text);
  text-align: center; line-height: 1.2; }
.bill-btn:hover { border-color: var(--accent-2); background: linear-gradient(180deg, #ffffff 0%, #e9eef4 100%); }
.bill-btn:active { background: #dcdad2; }
.bill-btn > :first-child { font-size: 18px; color: var(--accent); }
.bill-btn span { font-size: 11px; }
.bill-btn.primary { background: linear-gradient(180deg, #52749a 0%, #3a5778 100%); border-color: #2d465f; color: #fff; }
.bill-btn.primary > :first-child { color: #fff; }
.bill-btn.primary:hover { background: linear-gradient(180deg, #5b80aa 0%, #406185 100%); }
.bill-btn.danger { color: var(--bad); }
.bill-btn.danger > :first-child { color: var(--bad); }
.bill-btn.ph { opacity: .62; }
.bill-btn.ph:hover { opacity: .85; }
/* an action that needs something first (Delivery Status needs a saved bill) */
.bill-btn:disabled, .bill-btn:disabled:hover { opacity: .45; cursor: default; border-color: var(--border-dk);
  background: linear-gradient(180deg, #f7f6f2 0%, #e9e7df 100%); }
/* Print tile with its settings gear in the corner (a button can't hold a button) */
.bill-btn-wrap { position: relative; display: grid; }
.bill-btn-cfg { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; display: inline-flex; align-items: center;
  justify-content: center; padding: 0; border: 1px solid transparent; border-radius: 3px; background: none; color: var(--muted);
  font-size: 13px; line-height: 1; cursor: pointer; }
.bill-btn-cfg:hover { color: var(--accent); background: var(--row-hover); border-color: var(--border); }
.bill-btn-cfg:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 0; }

/* View History: filter tabs, filters, the list */
.modal.modal-hist { width: 880px; }
.hist-tabs { display: flex; margin-bottom: 10px; border-bottom: 1px solid var(--border-dk); }
.hist-tab { padding: 7px 16px; margin-bottom: -1px; font-family: var(--ui); font-size: 12.5px; color: var(--muted); background: none;
  border: 1px solid transparent; border-bottom: none; border-radius: 3px 3px 0 0; cursor: pointer; }
.hist-tab:hover { color: var(--accent); background: var(--row-hover); }
.hist-tab.active { background: var(--content); border-color: var(--border-dk); color: var(--accent); font-weight: 600; }
.hist-tab:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.hist-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-height: 30px; margin-bottom: 8px; font-size: 12.5px; }
.hist-filters label { display: inline-flex; align-items: center; gap: 6px; }
/* From, To and Clear wrap together, at the right of their row (never From at
   the end of one row and To at the start of the next) */
.hist-dates { flex: none; display: inline-flex; align-items: center; gap: 14px; margin-left: auto; white-space: nowrap; }
.hist-filters select, .hist-filters input[type=date] { padding: 4px 6px; font-family: var(--ui); font-size: 12.5px;
  background: var(--field-bg); border: 1px solid var(--border-dk); border-radius: 2px; }
.hist-filters select { max-width: 340px; }
.hist-filters input[type=checkbox] { margin: 0; }
.hist-only { cursor: pointer; }
.hist-item input { width: 280px; }
/* Item-wise: the bill's own items, one click each */
.hist-onbill { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; color: var(--muted); }
.hist-onbill[hidden], .hist-filters [data-hist-allitems][hidden] { display: none; }
.hist-onbill .btn { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-only.na { visibility: hidden; }          /* n/a for Customer bills; keeps the row from jumping */
.hist-sum { min-height: 17px; margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.hist-sum b { color: var(--text); }
.hist-wrap { max-height: 46vh; }
table.grid.hist-table th.num { text-align: right; }
table.grid.hist-table tr.pick:focus { outline: 2px solid var(--accent-2); outline-offset: -2px; }
table.grid.hist-table tr.hist-cur td { background: var(--row-sel); }
table.grid.hist-table tr.hist-msg td { cursor: default; background: var(--content); white-space: normal; max-width: none; }
table.grid.hist-table td.hist-bad { color: var(--bad); }
.hist-note { font-size: 11.5px; }
.hist-tag { margin-left: 4px; padding: 0 4px; font-size: 10px; color: var(--info); background: var(--info-bg);
  border: 1px solid #b6c8db; border-radius: 3px; }

/* Print: paper-size window and Print settings */
.print-saved { margin-bottom: 10px; padding: 7px 10px; font-size: 12.5px; color: var(--ok); background: var(--ok-bg);
  border: 1px solid #bcd3b3; border-radius: 2px; }
.print-sizes { display: flex; gap: 10px; }
.print-sizes .btn { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.print-sizes .btn b { font-size: 15px; }
.print-sizes .btn span { font-size: 11px; opacity: .8; }
.print-opts { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 12.5px; }
.print-opts label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.print-opts input { margin: 0; }
.print-opts .spacer { flex: 1; }
.modal.modal-ps { width: 660px; }
.ps-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin-bottom: 10px; font-size: 12.5px; }
.ps-lbl { min-width: 130px; font-weight: 600; }
.ps-size { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; background: var(--content);
  border: 1px solid var(--border); border-radius: 2px; cursor: pointer; }
.ps-size:has(input:checked) { background: var(--row-sel); border-color: var(--accent-2); }
.ps-size input { margin: 0; }
.ps-direct { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; padding: 8px 10px; font-size: 12.5px;
  background: var(--content); border: 1px solid var(--border); border-radius: 2px; cursor: pointer; }
.ps-direct:has(input:checked) { background: var(--row-sel); border-color: var(--accent-2); }
.ps-direct input { margin: 2px 0 0; }
.ps-direct .muted { display: block; font-size: 11.5px; }
.ps-help { padding: 10px 12px; font-size: 12px; line-height: 1.5; background: var(--info-bg); border: 1px solid #b6c8db; border-radius: 3px; }
.ps-help-title { margin-bottom: 4px; font-weight: 700; color: var(--info); }
.ps-help p { margin: 4px 0; }
.ps-help ol { margin: 6px 0; padding-left: 20px; }
.ps-help li { margin-bottom: 6px; }
.ps-help code { padding: 0 3px; font-family: var(--mono); font-size: 11.5px; background: rgba(255,255,255,.7); border-radius: 2px; }
.ps-target { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.ps-tname { flex: 0 0 50px; font-weight: 600; }
/* the whole target stays readable - it wraps only at its spaces (never inside
   --kiosk-printing or the path; a part wider than the whole box still wraps
   inside, as a last resort) - and one click selects all of it */
.ps-help .ps-cmd { flex: 1; min-width: 0; padding: 4px 6px; font-family: var(--mono); font-size: 11px; line-height: 1.45; color: var(--text);
  background: var(--content); border: 1px solid var(--border-dk); border-radius: 2px; user-select: all; }
.ps-help .ps-cmd .ps-tok { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.ps-target .btn { flex: none; min-width: 76px; }
.modal-ps .form-msg { margin: 10px 0 0; }

/* Hold: the bills on hold as sheet tabs along the foot of the billing screen
   (like minimised mail drafts / Excel sheet tabs). The screen fills the main
   area edge to edge (over .main's 12px padding) as a column: the bill scrolls
   in its own body and the strip stays below it - always in view, and never
   over the bill (a sticky strip would cover the action buttons whenever a
   long bill is not scrolled to its end). */
.bill-screen { position: relative; display: flex; flex-direction: column; height: calc(100% + 24px); margin: -12px; }
.bill-screen > .bill-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: 12px; }
#main:has(> .bill-screen) { overflow: hidden; }                  /* the bill body scrolls instead */
/* an action on the bill is running (a save, hold, open...): the bill is locked
   (inert, see setBusy in app.js). It dims, and says what it waits for, only
   once that takes a moment - a quick save on a fast line does not flicker. */
.bill-screen.busy { cursor: progress; }
.bill-screen > .bill-body > *, .bill-screen > .bill-tabs { transition: opacity .12s; }
.bill-screen.busy > .bill-body > *, .bill-screen.busy > .bill-tabs { opacity: .5; transition: opacity .2s .3s; }
.bill-busy { position: absolute; left: 50%; bottom: 64px; z-index: 5; transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; font-size: 12.5px; font-weight: 600; color: var(--text); background: var(--content); border: 1px solid var(--border-dk);
  border-radius: 3px; box-shadow: var(--shadow); white-space: nowrap; pointer-events: none; opacity: 0; visibility: hidden; }
.bill-busy::before { content: ''; flex: none; width: 13px; height: 13px; border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite; }
.bill-screen.busy > .bill-busy { opacity: 1; visibility: visible; transition: opacity .2s .3s, visibility 0s .3s; }
.bill-tabs { flex: none; display: flex; align-items: flex-start; gap: 4px; padding: 0 12px 6px;
  background: var(--panel); border-top: 1px solid var(--border-dk); box-shadow: 0 -2px 5px rgba(0,0,0,.07); overflow: hidden; }
/* only the held tabs scroll sideways: "Current bill" and "+ New bill" stay in view */
.bill-tabs .bt-held { flex: 0 1 auto; min-width: 0; display: flex; align-items: flex-start; gap: 4px; margin-top: -1px;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
.bill-tabs .bt-held > .bill-tab { margin-top: 0; }
.bill-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; margin-top: -1px; padding: 0 11px;
  border: 1px solid var(--border-dk); border-top: 0; border-radius: 0 0 5px 5px; background: var(--panel-2);
  font-family: var(--ui); font-size: 12px; color: var(--text); white-space: nowrap; }
/* the bill on screen: white, a bar in the accent colour, as if part of the sheet above */
.bill-tab.cur { background: var(--content); box-shadow: inset 0 3px 0 var(--accent); color: var(--accent); font-weight: 600; }
.bill-tab .bt-ico { opacity: .8; }
.bill-tab.held { padding: 0 3px 0 0; max-width: 300px; }
.bill-tab.held:hover { background: var(--row-hover); }
.bill-tab .bt-open { display: inline-flex; align-items: baseline; gap: 6px; min-width: 0; height: 100%; padding: 0 4px 0 11px;
  background: none; border: 0; font: inherit; color: inherit; cursor: pointer; }
.bill-tab .bt-open > * { align-self: center; }
.bill-tab .bt-name { overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.bill-tab .bt-meta { color: var(--muted); font-size: 11.5px; }
.bill-tab .bt-no { font-size: 10.5px; color: var(--info); background: var(--info-bg); border: 1px solid #b6c8db; border-radius: 3px; padding: 0 4px; }
.bill-tab .bt-x { flex: none; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: 3px; color: var(--muted); font-size: 11px; cursor: pointer; }
.bill-tab .bt-x:hover { color: var(--bad); background: var(--bad-bg); }
.bill-tab.new { background: transparent; border-style: dashed; color: var(--accent); font-weight: 600; cursor: pointer; }
.bill-tab.new:hover { background: var(--row-hover); border-style: solid; }
.bill-tabs button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }
.bill-tabs .bt-hint { align-self: center; min-width: 0; margin-left: 6px; font-size: 11.5px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
/* a tab that just appeared (Hold) */
@keyframes held-flash { 0%, 35% { background-color: #f6e3a6; border-color: #c9a64a; } }
.bill-tab.flash { animation: held-flash 1.8s ease-out; }
/* messages float above the strip, so they never hide the tab just held */
body:has(#bill-tabs) .toast { bottom: 70px; }

/* ------------------------------------------------------ print invoice */
#print-area { display: none; }
@media print {
  body.printing #app, body.printing #modal-root, body.printing #tooltip, body.printing .toast { display: none !important; }
  body.printing #print-area { display: block; }
  #print-area { color: #000; font-family: var(--ui); }
}
/* the sheet prints (A4 / A5): only ever in #print-area (hidden on screen) and
   in the bill print layout designer's preview (.bpd-paper), so not tied to
   print media. The al-* / st / c classes are the owner's layout
   (billSheetHtml in app.js): a block aligned otherwise than usual. */
.pi { padding: 4px; }
.pi-top { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 2px solid #000; padding-bottom: 6px; }
.pi-top.st { flex-direction: column; align-items: flex-start; gap: 2px; }
.pi-top.st.al-c { align-items: center; text-align: center; }
.pi-top.st.al-r { align-items: flex-end; text-align: right; }
.pi-org { font-size: 18px; font-weight: 700; }
.pi-orgd { font-size: 11px; }
.pi-title { font-size: 14px; letter-spacing: 1px; }
.pi-meta { display: flex; justify-content: space-between; gap: 20px; font-size: 11px; margin: 10px 0; }
.pi-meta.al-l { justify-content: flex-start; }
.pi-meta.al-c { justify-content: center; text-align: center; }
.pi-meta.al-r { justify-content: flex-end; text-align: right; }
.pi-items { width: 100%; border-collapse: collapse; font-size: 11px; }
.pi-items th, .pi-items td { border: 1px solid #999; padding: 4px 6px; text-align: left; }
.pi-items .r, .pi-tot .r { text-align: right; }
.pi-items .c { text-align: center; }
.pi-items td.code { white-space: nowrap; }
.pi-tot { display: flex; justify-content: flex-end; margin-top: 10px; }
.pi-tot.al-l { justify-content: flex-start; }
.pi-tot.al-c { justify-content: center; }
.pi-tot table { font-size: 12px; border-collapse: collapse; min-width: 240px; }
.pi-tot td { padding: 3px 8px; }
.pi-tot tr.g td { border-top: 2px solid #000; font-weight: 700; font-size: 13px; }
.pi-tot tr.ph td { padding-top: 8px; font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: #444; }
.pi-tot tr.pm td { font-size: 11px; }
.pi-tot tr.due td { border-top: 1px solid #000; font-weight: 700; }
.pi-terms { margin-top: 14px; font-size: 10px; line-height: 1.4; }
.pi-by { margin-top: 10px; font-size: 11px; }
.pi-terms.al-c, .pi-by.al-c { text-align: center; }
.pi-terms.al-r, .pi-by.al-r { text-align: right; }
.pi-foot { margin-top: 24px; font-size: 10px; color: #444; text-align: center; }
.pi-foot.al-l { text-align: left; }
.pi-foot.al-r { text-align: right; }
/* a field's own style (the bill print layout designer): fa-* its line's
   alignment, .bps the text - its size against the field's own (z-*), bold
   set on (b1) or off (b0, the labels in it too), italic, underline */
.pi .fa-l { text-align: left; }
.pi .fa-c { text-align: center; }
.pi .fa-r { text-align: right; }
.pi-meta > .fg { flex: 1 1 0; }
/* purchase prints (the owner's purchase print layout): a return's note, the amount in words / settlement / notes, the signatures */
.pi-note { margin: 6px 0; padding: 4px 8px; border: 1px solid #999; font-size: 11px; }
.pi-note.al-c, .pi-extra.al-c { text-align: center; }
.pi-note.al-r, .pi-extra.al-r { text-align: right; }
.pi-extra { margin-top: 10px; font-size: 11px; line-height: 1.5; }
.pi-sign { display: flex; justify-content: space-between; gap: 20px; margin-top: 40px; font-size: 11.5px; }
.pi-sign > div:last-child { text-align: right; }
.pi-by.al-c { text-align: center; }
.pi-by.al-r { text-align: right; }
.bps.z-s { font-size: .85em; }
.bps.z-l { font-size: 1.25em; }
.bps.z-x { font-size: 1.5em; }
.bps.b1 { font-weight: 700; }
.bps.b0, .bps.b0 b { font-weight: 400; }
.bps.i1 { font-style: italic; }
.bps.u1 { text-decoration: underline; }

/* =================================================================== owner:
   View Schema (animated ER diagram), field nicknames, audit history */

/* ---- diagram canvas: dark "blueprint" look ---- */
.viz-wrap {
  position: relative;
  height: calc(100vh - 215px);
  min-height: 460px;
  border: 1px solid var(--border-dk);
  border-radius: 4px;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 75% -10%, rgba(77,111,149,.35) 0%, transparent 60%),
    radial-gradient(700px 500px at 10% 110%, rgba(69,161,148,.18) 0%, transparent 55%),
    linear-gradient(135deg, #1b2330 0%, #141a24 100%);
  box-shadow: inset 0 0 60px rgba(0,0,0,.45), var(--shadow);
  animation: vizfade .45s ease both;
}
@keyframes vizfade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#viz-svg { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#viz-svg:active { cursor: grabbing; }

/* ---- edges: flowing relation lines ---- */
.viz-edge {
  fill: none;
  stroke: rgba(127,166,217,.38);
  stroke-width: 1.4;
  stroke-dasharray: 7 6;
  animation: vizflow 1.1s linear infinite;
  transition: stroke .25s, stroke-width .25s, opacity .3s;
}
@keyframes vizflow { to { stroke-dashoffset: -13; } }
.viz-edge.hot {
  stroke: #ffd479;
  stroke-width: 2.6;
  animation-duration: .45s;
  filter: drop-shadow(0 0 5px rgba(255,212,121,.85));
}
.viz-edge.dim { opacity: .12; }

/* ---- nodes ---- */
.viz-node { cursor: pointer; }
.viz-node.pop { animation: vizpop .5s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes vizpop { from { opacity: 0; transform: scale(.3); } to { opacity: 1; } }
.viz-node .vn-box {
  fill: rgba(26,34,46,.94);
  stroke-width: 1.6;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.5));
  transition: fill .2s, stroke-width .2s;
}
.viz-node .vn-name { fill: #e8edf4; font: 600 12px var(--ui); pointer-events: none; }
.viz-node .vn-count { fill: #8fa0b5; font: 10px var(--mono); pointer-events: none; }
.viz-node .vn-sname { fill: #7e8da3; font: 9.5px var(--mono); pointer-events: none; }
.viz-node .vn-sname.head { fill: rgba(255,255,255,.78); }
.viz-node .vn-ldb { fill: #d9a94e; font: italic 9px var(--mono); pointer-events: none; opacity: .92; }
.viz-node .vn-ldb.head { fill: #ffe3a3; }
.viz-panel .vp-ldb {
  font: 11px var(--mono); color: #ffd479; background: rgba(217,169,78,.12);
  border: 1px solid rgba(217,169,78,.35); border-radius: 4px; padding: 5px 8px; margin: 6px 0;
}
.viz-panel .vp-ldb b { color: #ffe3a3; }
.vl-chip.ldb { font-style: italic; color: #ffe3a3; }
.viz-node .vn-glyph { fill: #fff; font-size: 12px; pointer-events: none; }
.viz-node .vn-dot { filter: drop-shadow(0 0 4px currentColor); }
.viz-node:hover .vn-box, .viz-node.hot .vn-box { fill: rgba(38,50,68,.97); stroke-width: 2.6; filter: url(#vz-glow) drop-shadow(0 3px 8px rgba(0,0,0,.55)); }
.viz-node.dim { opacity: .18; transition: opacity .3s; }
.viz-node.hit .vn-box { stroke: #ffd479 !important; stroke-width: 3; animation: vizpulse 1s ease-in-out infinite; }
@keyframes vizpulse { 50% { stroke-width: 5; } }

/* expanded (focused) entity box */
.viz-node.focus .vn-head { opacity: .92; }
.viz-node.focus .vn-x { fill: rgba(255,255,255,.85); font-size: 11px; cursor: pointer; }
.viz-node.focus .vn-x:hover { fill: #fff; }
.vn-col rect { fill: transparent; transition: fill .15s; }
.vn-col:hover rect { fill: rgba(255,212,121,.16); }
.vn-col .vn-ckey { font: 10px var(--mono); fill: #6b7c92; }
.vn-col .vn-ckey.pk { fill: #ffd479; }
.vn-col .vn-ckey.fk { fill: #7fa6d9; }
.vn-col .vn-ctxt { font: 11px var(--ui); fill: #c8d2de; pointer-events: none; }
.vn-col .vn-ctxt.nick { fill: #ffe3a3; font-style: italic; }
.vn-col .vn-ctype { font: 9px var(--mono); fill: #5e6d80; pointer-events: none; }
.vn-col .vn-cldb { font: italic 8.5px var(--mono); fill: #c9a154; pointer-events: none; opacity: .9; }

/* ---- legend + side panel ---- */
.viz-legend {
  position: absolute; left: 10px; bottom: 10px;
  display: flex; gap: 6px; flex-wrap: wrap; max-width: 55%;
}
.vl-chip {
  font-size: 10.5px; color: #dfe6ee; background: rgba(20,27,37,.85);
  border: 1px solid rgba(255,255,255,.14); border-left: 3px solid var(--c);
  padding: 3px 8px; border-radius: 3px; backdrop-filter: blur(2px);
}
.viz-panel {
  position: absolute; top: 10px; right: 10px; width: 270px; max-height: calc(100% - 20px);
  overflow: auto; padding: 12px 14px;
  background: rgba(18,24,33,.92); border: 1px solid rgba(255,255,255,.16); border-radius: 6px;
  color: #d6dde6; backdrop-filter: blur(3px); box-shadow: 0 6px 22px rgba(0,0,0,.5);
  animation: vizfade .4s ease both;
}
.viz-panel .vp-kicker { font: 700 9.5px var(--ui); letter-spacing: 1.4px; color: #8fa0b5; margin-bottom: 4px; }
.viz-panel .vp-title { font: 600 15px var(--ui); color: #fff; margin-bottom: 3px; }
.viz-panel .vp-mono { font: 10.5px var(--mono); color: #8fa0b5; margin-bottom: 8px; }
.viz-panel .vp-p { font-size: 11.5px; line-height: 1.55; margin: 6px 0; color: #c2cbd6; }
.viz-panel .vp-p code, .viz-panel .vp-mono code { color: #ffd479; }
.viz-panel .vp-stats { display: flex; gap: 10px; margin: 8px 0; font-size: 11px; color: #9fb0c4; flex-wrap: wrap; }
.viz-panel .vp-stats b { color: #fff; }
.viz-panel .vp-find { background: rgba(77,111,149,.16); border: 1px solid rgba(127,166,217,.3); border-radius: 5px; padding: 8px 10px; margin: 10px 0; }
.viz-panel .vp-find-h { font-weight: 700; font-size: 11px; color: #ffd479; margin-bottom: 5px; }
.viz-panel .vp-steps { margin: 0; padding-left: 17px; font-size: 11.5px; line-height: 1.7; color: #d6dde6; }
.viz-panel .btn { margin-top: 4px; }
.nick-badge {
  font: 600 10px var(--ui); color: #7a5c12; background: #ffe9b8; border: 1px solid #d9b65e;
  border-radius: 3px; padding: 1px 6px; vertical-align: middle;
}

/* ---- owner field rename (forms) ---- */
.lbl-edit {
  display: inline-block; margin-left: 5px; padding: 0 4px; border-radius: 3px;
  color: var(--accent); cursor: pointer; opacity: 0; font-size: 11px;
  transition: opacity .15s, background .15s, transform .15s;
}
.form-field:hover .lbl-edit { opacity: .85; }
.lbl-edit:hover { background: var(--row-sel); opacity: 1; transform: scale(1.25); }
.lbl-txt.nick { border-bottom: 1px dashed #c9963c; color: #7a5c12; }
.nick-info { background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: 9px 11px; font-size: 12px; line-height: 1.7; }
.nick-info code { font-family: var(--mono); background: #fff; border: 1px solid var(--border); padding: 0 4px; border-radius: 2px; }
.nick-cell { color: #7a5c12; }

/* ---- audit history page ---- */
.audit-list { display: flex; flex-direction: column; gap: 0; }
.audit-row {
  display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px 8px 2px;
  border-bottom: 1px dotted var(--border);
  animation: auditin .4s ease both;
}
.audit-row:last-child { border-bottom: 0; }
@keyframes auditin { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.audit-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; }
.audit-dot.ok { background: var(--info); box-shadow: 0 0 0 3px var(--info-bg); }
.audit-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.audit-line { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.audit-line code { font-family: var(--mono); font-size: 11px; background: var(--panel-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 2px; }
.audit-arrow b { color: var(--accent); }
.audit-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ---- Inventory: Product Master + Replacements ---------------------------- */
/* units grid: keep checkboxes/radios natural-sized despite bill-items 100% width */
table.grid.pm-units input[type=checkbox], table.grid.pm-units input[type=radio] { width: auto; cursor: pointer; }
table.grid.pm-units td[data-uhint] { font-size: 11px; white-space: normal; }
.pm-cats select:disabled { opacity: .55; }
.pm-actions { margin-top: 2px; }
/* Product Master > Bill of Materials: the child / parent product grids */
.pm-bom { display: flex; flex-direction: column; gap: 16px; }
.pm-bom-title { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 13px; }
.pm-bom-grid td .ta-wrap { position: relative; }
.pm-bom-grid td .ta-wrap > input { width: 100%; min-width: 220px; }
.pm-bom-sub { font-size: 11px; margin-top: 2px; }
.pm-bom-grid tfoot td { font-size: 13px; padding: 8px; border-top: 1px solid var(--border-dk); }
.pm-bom-radio { align-items: center; }
/* Inventory > Bill of Materials: the BOM products list beside one parent's child lines */
.bom-split { grid-template-columns: 300px 1fr; }
.bom-q { width: 100%; padding: 5px 8px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; background: var(--field-bg); margin-bottom: 8px; }
.bom-list { max-height: 62vh; overflow: auto; }
.bom-list table.grid { width: 100%; table-layout: fixed; }
.bom-list th:nth-child(2), .bom-list td:nth-child(2) { width: 86px; }
.bom-list th:last-child, .bom-list td:last-child { width: 44px; }
.bom-list td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bom-list td:first-child { white-space: normal; overflow-wrap: anywhere; line-height: 1.3; }
.bom-list td .bom-code { display: block; font-size: 10.5px; }
.bom-list tr.pick { cursor: pointer; }
.bom-list tr.pick:hover td { background: var(--panel-2); }
.bom-list tr.pick.on td { background: var(--accent); color: #fff; }
.bom-list tr.pick.on td.muted, .bom-list tr.pick.on td .muted { color: rgba(255,255,255,.8); }
.bom-note { font-size: 11.5px; margin-top: 8px; }
.bom-head { grid-template-columns: 150px 110px 110px 100px 120px 1fr; }
.bom-open { font-size: 12px; margin-left: 8px; }
.bom-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12px; }
.bom-foot .spacer { flex: 1; }
/* BOM rates: the parent's Sale Rate / MRP always on show, the "Rates follow the child products" tick over its rate in every price list */
.bom-now { font-size: 12.5px; white-space: nowrap; }
.bom-now b { color: var(--accent); font-size: 14px; }
.panel .head .bom-now { font-weight: 400; color: var(--text); }
.bom-rates { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 24px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2); }
.bom-rates .bom-link { display: flex; align-items: flex-start; gap: 8px; flex: 1 1 320px; font-size: 12.5px; cursor: pointer; }
.bom-rates .bom-link input { margin: 2px 0 0; width: 15px; height: 15px; flex: none; accent-color: var(--accent); }
table.grid.bom-rates-grid { width: auto; min-width: 380px; font-size: 12px; }
.bom-rates-grid td, .bom-rates-grid th { padding: 4px 10px; }
.bom-rates-grid td.bom-off { color: var(--warn); font-weight: 600; }
/* Price Lists: a BOM product whose rate follows its children (not typed) */
table.grid.pl-table td.pl-bom small.badge { margin-left: 6px; font-size: 9.5px; }
/* Settings > Price lists: who approves price changes / sees purchase prices */
.pa-people { margin-top: 14px; }
.pa-table { width: auto; min-width: 640px; font-size: 12.5px; }
.pa-table td, .pa-table th { padding: 6px 12px; }
.pa-table .pa-col { text-align: left; }
.pa-table .pa-col small { margin-left: 4px; font-size: 11px; }
.pa-note { font-size: 11.5px; margin-top: 8px; max-width: 900px; }
@media (max-width: 900px) { .bom-split { grid-template-columns: 1fr; } }
/* quick-add product dialog (from a BOM line) */
.qp-form { min-width: 420px; }
.ql-row { display: flex; gap: 10px; }
.ql-row .ql-field { flex: 1; min-width: 0; }
.ql-field select { padding: 7px 9px; font-size: 13px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); }
/* claim form: hidden repair-charges wrapper must stay collapsed */
[data-rp-charges][hidden] { display: none; }

/* ---- Admin: Users & Access (owner console) -------------------------------- */
th.ax-vert { height: 118px; vertical-align: bottom; padding: 6px 4px; }
th.ax-vert span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11px; letter-spacing: .02em; }
.ax-form { flex: 1; min-width: 0; }
.ax-sec-hdr { margin: 14px 0 8px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .55px; color: var(--muted); }
.ax-access { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 14px; align-items: start; }
@media (max-width: 1150px) { .ax-access { grid-template-columns: minmax(0, 1fr); } }
.ax-acol { min-width: 0; border: 1px solid var(--border); border-radius: 3px; padding: 8px 10px; background: #fbfbf9; }
.ax-sub { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; font-weight: 700; font-size: 12.5px; margin-bottom: 6px; }
.ax-subnote { font-weight: 400; font-size: 11.5px; color: var(--muted); }
.pt-unsaved { font-weight: 600; font-size: 11px; color: var(--warn); background: var(--warn-bg); border: 1px solid #ddca9d; border-radius: 9px; padding: 0 8px; }
/* quick switch: the Modify button on bills, per user */
.ax-quick { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 8px 14px; padding: 10px 12px; margin-bottom: 12px;
  background: var(--info-bg); border: 1px solid #b6c8db; border-left: 4px solid var(--accent); border-radius: 3px; }
.ax-quick.off { border-left-color: var(--warn); background: var(--warn-bg); border-color: #ddca9d; }
.axq-title { font-size: 13px; white-space: nowrap; }
.axq-seg { display: inline-flex; border: 1px solid var(--border-dk); border-radius: 3px; overflow: hidden; background: var(--content); }
.axq-opt { position: relative; cursor: pointer; }
.axq-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.axq-opt span { display: inline-block; padding: 5px 18px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.axq-opt + .axq-opt span { border-left: 1px solid var(--border-dk); }
.axq-opt input:checked + span { background: var(--accent); color: #fff; }
.ax-quick.off .axq-opt input:checked + span { background: var(--warn); }
.axq-opt input:focus-visible + span { outline: 2px solid var(--accent-2); outline-offset: -3px; }
.axq-opt input:disabled + span { cursor: default; opacity: .8; }
.axq-help { font-size: 12px; line-height: 1.45; }
.axq-src { display: inline-flex; gap: 6px; align-items: center; justify-self: end; }
@media (max-width: 900px) { .ax-quick { grid-template-columns: minmax(0, 1fr); } .axq-src { justify-self: start; } }
/* the discount limit per user, under the Modify switch: a % box (blank = no limit) */
.ax-quick.ax-disc { background: var(--content); border-color: var(--border); }
.axq-num { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12.5px; }
.axq-num input { width: 86px; text-align: right; padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; }
/* roles: assign + "what it allows" */
.ax-rolelist { display: flex; flex-direction: column; gap: 6px; }
.ax-rrow { border: 1px solid var(--border); border-radius: 3px; background: var(--content); padding: 6px 9px; }
.ax-rrow.sel { border-color: var(--accent-2); box-shadow: inset 3px 0 0 var(--accent); }
.ax-rhead { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; }
.ax-rhead .spacer { flex: 1; }
.ax-rchk { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 12.5px; }
.ax-rchk input { width: auto; margin: 0; cursor: pointer; }
.ax-rexp { font-family: var(--ui); font-size: 11.5px; padding: 2px 6px; border: 1px solid transparent; border-radius: 3px; background: none; color: var(--accent); cursor: pointer; }
.ax-rexp:hover { border-color: var(--border); background: var(--panel); }
.ax-rdesc { font-size: 11.5px; color: var(--muted); margin: 2px 0 0 21px; }
.ax-rtree { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.ax-rexp:focus-visible, .pt-reset:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }

/* ---- access rights: permission trees ---------------------------------------- */
/* Connectors follow the category tree (.otree): 1px rails, rounded elbows.
   Geometry: a guide column (.pt-g) is 18px wide with its rail at x=8; the fold
   column (.pt-tw) is 16px wide with its centre at x=8 - so a parent's fold
   button sits exactly on top of its children's rail. */
.ptree { padding: 2px 0 4px; }
.pt-row { display: flex; align-items: center; min-height: 26px; position: relative; padding-right: 6px; border-radius: 2px; }
.pt-g { flex: 0 0 18px; align-self: stretch; position: relative; }
.pt-g.rail::before, .pt-g.tee::before, .pt-g.end::before { content: ''; position: absolute; left: 8px; top: 0; border-left: 1px solid var(--border-dk); }
.pt-g.rail::before, .pt-g.tee::before { bottom: 0; }
.pt-g.tee::after { content: ''; position: absolute; left: 8px; top: 50%; width: 10px; border-top: 1px solid var(--border-dk); }
.pt-g.end::before { height: 50%; width: 10px; border-bottom: 1px solid var(--border-dk); border-bottom-left-radius: 4px; }
.pt-tw { flex: 0 0 16px; align-self: stretch; position: relative; display: flex; align-items: center; justify-content: center; }
.pt-tw.leaf::before { content: ''; position: absolute; left: 0; right: 3px; top: 50%; border-top: 1px solid var(--border-dk); }
.pt-tw.open::after { content: ''; position: absolute; left: 8px; top: 50%; bottom: 0; border-left: 1px solid var(--border-dk); }
.pt-fold { position: relative; z-index: 1; width: 15px; height: 15px; padding: 0 0 1px; display: inline-flex; align-items: center; justify-content: center;
  font: 700 12px/1 var(--ui); color: var(--accent); background: var(--content); border: 1px solid var(--border-dk); border-radius: 3px; cursor: pointer; }
.pt-fold:hover { border-color: var(--accent); background: var(--row-hover); }
.pt-fold:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.pt-tw .pt-dot { position: relative; z-index: 1; width: 15px; text-align: center; background: var(--content); color: var(--accent); font-size: 11px; line-height: 15px; }
.pt-knot { position: relative; z-index: 1; width: 5px; height: 5px; border-radius: 50%; background: var(--border-dk); }
/* everything right of the connectors: wraps onto more lines when narrow while
   the rails keep running the full row height */
.pt-body { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; row-gap: 2px; padding: 2px 0; }
.pt-body > .pt-dot { color: var(--accent); margin: 0 6px 0 4px; }
.pt-main { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; cursor: pointer; min-width: 0; }
.pt-main input[type=checkbox] { width: auto; margin: 0; flex: none; cursor: pointer; }
.pt-main input:disabled { cursor: default; }
.pt-main .pt-dot { color: var(--accent); }
.pt-label { font-size: 12.5px; }
.pt-row.grp { min-height: 30px; }
.pt-code { margin-left: 8px; font-family: var(--mono); font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.pt-count { margin-left: 8px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.pt-changed { margin-left: 8px; font-size: 10.5px; font-weight: 600; color: var(--warn); white-space: nowrap; }
.pt-meta { margin-left: 8px; display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pt-src { font-size: 11px; color: var(--muted); white-space: nowrap; }
.pt-tag { font-size: 10.5px; font-weight: 600; padding: 0 6px; line-height: 16px; border-radius: 8px; border: 1px solid; white-space: nowrap; }
.pt-tag.add { color: var(--ok); background: var(--ok-bg); border-color: #bcd3b3; }
.pt-tag.rem { color: var(--bad); background: var(--bad-bg); border-color: #d8b5b1; }
.pt-reset { font-family: var(--ui); font-size: 11px; padding: 0 6px; line-height: 16px; border: 1px solid var(--border); border-radius: 3px; background: var(--content); color: var(--accent); cursor: pointer; white-space: nowrap; }
.pt-reset:hover { border-color: var(--accent); }
.pt-why { font-size: 11px; font-style: italic; color: var(--muted); }
.ptree .pt-row:not(.grp):hover { background-color: var(--row-hover); }
.pt-row.ov-add { box-shadow: inset 3px 0 0 var(--ok); background-image: linear-gradient(90deg, var(--ok-bg), rgba(255,255,255,0) 75%); }
.pt-row.ov-rem { box-shadow: inset 3px 0 0 var(--bad); background-image: linear-gradient(90deg, var(--bad-bg), rgba(255,255,255,0) 75%); }
.pt-row.blocked .pt-main, .pt-row.blocked .pt-code { opacity: .55; }
.pt-tools { display: flex; align-items: center; gap: 6px; margin: 2px 0 6px; flex-wrap: wrap; }
.pt-tools .spacer { flex: 1; }
.pt-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.pt-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.lg-box { display: inline-flex; width: 13px; height: 13px; align-items: center; justify-content: center; font-style: normal; font-size: 9px; line-height: 1;
  color: #fff; background: var(--content); border: 1px solid var(--border-dk); border-radius: 2px; }
.lg-box.on { background: var(--accent); border-color: var(--accent); }
.lg-box.some::after { content: ''; width: 7px; border-top: 2px solid var(--accent); }
.pt-banner { padding: 7px 10px; margin: 2px 0 8px; font-size: 12px; color: var(--info); background: var(--info-bg); border: 1px solid #b6c8db; border-radius: 3px; }
/* read-only tree of one role: granted ticked, the rest muted; groups flow in columns */
.pt-tick { flex: 0 0 14px; height: 14px; margin: 0 6px 0 4px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; line-height: 1; color: #fff; background: var(--content); border: 1px solid var(--border-dk); border-radius: 2px; }
.pt-tick.on { background: var(--accent); border-color: var(--accent); }
.ptree.ro { columns: 2 250px; column-gap: 18px; }
.ptree.ro .pt-block { break-inside: avoid; margin-bottom: 4px; }
.ptree.ro .pt-row { min-height: 22px; }
.ptree.ro .pt-label { font-size: 12px; }
.ptree.ro .pt-row.off .pt-label { color: var(--muted); }
.ptree.ro .pt-row.grp .pt-label { margin-left: 4px; }
/* Roles & Permissions: the same tree, one column per role */
.ax-ttwrap { max-height: 72vh; }
.tt-legend { padding: 7px 10px; margin: 0; border-bottom: 1px solid var(--border); }
table.grid.ax-tt tbody tr { cursor: default; }
table.grid.ax-tt td { padding: 0; }
table.grid.ax-tt td.tt-name { padding: 0 10px 0 8px; max-width: none; overflow: visible; }
table.grid.ax-tt th.tt-name { vertical-align: bottom; }
/* the sticky header stays above the scrolled rows' positioned connectors and
   fold buttons (z-index 1) */
table.grid.ax-tt thead th { z-index: 2; }
table.grid.ax-tt .pt-row { min-height: 30px; }
table.grid.ax-tt .pt-body { padding-left: 4px; }
/* rails bridge the 1px row border */
table.grid.ax-tt .pt-g.rail::before, table.grid.ax-tt .pt-g.tee::before, table.grid.ax-tt .pt-tw.open::after { bottom: -1px; }
table.grid.ax-tt td.tt-c { width: 44px; padding: 0 4px; text-align: center; }
table.grid.ax-tt td.tt-c input { width: auto; margin: 0; vertical-align: middle; cursor: pointer; }
table.grid.ax-tt td.tt-own input { pointer-events: none; }
table.grid.ax-tt td.tt-own { background: #eef2f6; }
table.grid.ax-tt tr.tt-grp td { background: var(--panel-2); }
table.grid.ax-tt tr.tt-grp td.tt-own { background: #e3e8ee; }
table.grid.ax-tt th.tt-own span { color: var(--accent); }

/* ---- a sub-permission the user lacks: locked controls say why ---------------- */
.perm-lock { display: inline-flex; }
/* disabled controls swallow hover - let the wrapper show its tip */
.perm-lock > :disabled { pointer-events: none; }
.bill-actions > .perm-lock { display: flex; }
.bill-actions > .perm-lock > .bill-btn { flex: 1; }
/* Save keeps its corner of the 7-wide button grid when the Modify button is
   not shown for this account (one button fewer) */
@media (min-width: 1101px) {
  .bill-actions > .bill-btn[data-act="save"], .bill-actions > .perm-lock:has(> [data-act="save"]) { grid-column-end: -1; }
}
/* a saved bill this account may not modify: the note under the bill header */
.perm-note.bill-lock-note { margin: -4px 0 12px; }
/* Mode of Payment: a mode this account may not use (Credit without its right) */
.pay-mode.off { cursor: not-allowed; background: var(--panel-2); }
.pay-mode.off:hover { background: var(--panel-2); border-color: var(--border); }
.pay-mode.off b { color: var(--muted); }
.pay-mode.off .muted { color: var(--warn); }
/* (a disabled .bill-btn looks the same everywhere - see .bill-btn:disabled above) */
.perm-note { margin: -4px 0 10px; padding: 6px 10px; font-size: 12px; color: var(--warn); background: var(--warn-bg); border: 1px solid #ddca9d; border-radius: 3px; }
.perm-note.form-lock { margin: 0 0 12px; }
/* Purchase entry: the entry just saved, named above the new one (its Barcode print and Open) */
.perm-note.pd-last { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; color: var(--ok); background: var(--ok-bg); border-color: #bcd3b3; }
.perm-note.pd-last .spacer { flex: 1; }
/* a form field this account may see but not change */
.form-field .lbl-lock { color: var(--warn); font-size: 11px; cursor: help; }
.form-field.locked input, .form-field.locked select { background: #efeee9; color: var(--muted); }
.perm-tag { font-size: 11px; font-weight: 400; color: var(--warn); background: var(--warn-bg); border: 1px solid #ddca9d; border-radius: 9px; padding: 0 8px; cursor: help; }

/* ---- typeahead (suggestion dropdown) --------------------------------------- */
.ta-wrap { position: relative; flex: 1; min-width: 0; }
.ta-wrap > input, .ta-wrap > textarea { width: 100%; }
.ta-pop {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 70;
  background: var(--content); border: 1px solid var(--border-dk); border-top: 0;
  box-shadow: 0 6px 14px rgba(0,0,0,.14); max-height: 262px; overflow: auto;
}
.ta-pop.ta-fixed { position: fixed; right: auto; border-top: 1px solid var(--border-dk); z-index: 130; }
.ta-item { padding: 6px 10px; font-size: 12.5px; cursor: pointer; border-bottom: 1px dotted var(--border); display: flex; align-items: baseline; gap: 6px; }
.ta-item:last-child { border-bottom: 0; }
.ta-item.active, .ta-item:hover { background: var(--accent); color: #fff; }
.ta-item.active .muted, .ta-item:hover .muted, .ta-item.active .ta-side, .ta-item:hover .ta-side { color: rgba(255,255,255,.8); }
.ta-item mark { background: var(--warn-bg); padding: 0; font-weight: 600; color: inherit; }
.ta-item.active mark, .ta-item:hover mark { background: transparent; text-decoration: underline; }
.ta-side { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; }
/* item code column inside a suggestion row */
.ta-code { flex: 0 0 86px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ta-item.active .ta-code, .ta-item:hover .ta-code { color: rgba(255,255,255,.8); }
/* "nothing found" note + action rows (e.g. + Add new customer) */
.ta-empty { padding: 8px 10px; font-size: 12.5px; color: var(--muted); }
/* an item search with more matches than the list holds: how many, under the rows */
.ta-more { font-size: 11.5px; border-top: 1px dotted var(--border); }
.ta-action { padding: 7px 10px; font-size: 12.5px; font-weight: 600; color: var(--accent); cursor: pointer;
  background: var(--panel); border-top: 1px solid var(--border); }
.ta-action.active, .ta-action:hover { background: var(--accent); color: #fff; }
/* a trailing action stays visible while a long result list scrolls */
.ta-pop > .ta-action:last-child { position: sticky; bottom: 0; }
.ta-note { font-size: 11.5px; margin-top: 4px; }
.ta-note.bad { color: #a33; }

/* ---- category tree diagram ------------------------------------------------- */
.ct-box { margin-top: 14px; border-top: 1px dashed var(--border-dk); padding-top: 10px; }
.ct-legend { font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.ct-tree { line-height: 2.1; overflow-x: auto; }
.ct-line { white-space: nowrap; }
.ct-branch { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ct-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px 2px;
  border: 1px solid var(--border-dk); border-radius: 3px; background: var(--panel-2);
  font-size: 12px; user-select: none;
}
.ct-pill.clickable { cursor: pointer; }
.ct-pill.clickable:hover { border-color: var(--accent); }
.ct-pill.root { font-weight: 600; }
.ct-pill.sel { background: var(--accent); border-color: var(--accent); color: #fff; }
.ct-pill.sel .ct-slot { color: rgba(255,255,255,.75); }
.ct-pill.orphan { border-color: #c9963c; color: #7a5c12; background: var(--warn-bg); }
.ct-pill.demo { font-size: 10.5px; padding: 0 6px 1px; cursor: default; }
.ct-slot { font-size: 10px; color: var(--muted); font-family: var(--mono); }
.ct-orphans { margin-top: 10px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---- inverted category tree (org-chart) ------------------------------------ */
/* roots wrap onto rows inside a capped box - a catalogue with hundreds of flat
   values must not stretch the page sideways */
.ot-scroll { overflow: auto; display: flex; flex-wrap: wrap; gap: 14px 30px; align-items: flex-start; padding: 8px 2px 12px; max-height: 380px; }
.ct-details > summary { cursor: pointer; font-size: 12px; color: var(--accent); margin: 2px 0 6px; }
.otree ul { display: flex; justify-content: center; padding: 16px 0 0; margin: 0; position: relative; }
.otree > ul { padding-top: 0; }
.otree li { list-style: none; position: relative; padding: 16px 7px 0; display: flex; flex-direction: column; align-items: center; }
/* connectors: horizontal rail + vertical drop per child */
.otree li::before, .otree li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 16px; border-top: 1px solid var(--border-dk); }
.otree li::after { right: auto; left: 50%; border-left: 1px solid var(--border-dk); }
.otree li:first-child::before { border-top: none; }
.otree li:last-child::after { border-top: none; border-left: 1px solid var(--border-dk); }
.otree li:last-child::before { border-right: 1px solid var(--border-dk); border-radius: 0 4px 0 0; }
.otree li:first-child::after { border-radius: 4px 0 0 0; }
.otree li:only-child::before { display: none; }
.otree li:only-child::after { border-top: none; border-radius: 0; }
.otree > ul > li::before, .otree > ul > li::after { display: none; }
.otree > ul > li { padding-top: 0; }
.ot-node {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border: 1px solid var(--border-dk); border-radius: 3px; background: var(--panel-2);
  font-size: 12.5px; white-space: nowrap; user-select: none; position: relative;
}
.ot-node.clickable { cursor: pointer; }
.ot-node.clickable:hover { border-color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.10); }
.ot-node.sel { background: var(--accent); border-color: var(--accent); color: #fff; }
.ot-node.sel .ct-slot { color: rgba(255,255,255,.75); }
.ot-acts { display: none; gap: 3px; margin-left: 3px; }
.ot-node:hover .ot-acts { display: inline-flex; }
.ot-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 17px; height: 17px; border: 1px solid var(--border-dk); border-radius: 3px;
  background: var(--content); color: var(--text); font-size: 10.5px; cursor: pointer;
}
.ot-btn:hover { border-color: var(--accent); color: var(--accent); }
.ot-node.sel .ot-btn { background: rgba(255,255,255,.9); }

/* ---- Opening Stock ---------------------------------------------------------- */
.os-qty { width: 104px; }
.os-qty.os-saved { background: var(--ok-bg); border-color: #6a5; }
.os-steps { margin: 0 0 4px 18px; padding: 0; font-size: 12.5px; line-height: 1.8; }
.os-result { margin-top: 8px; font-size: 12.5px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 3px; padding: 8px 10px; }
.os-skips ul { margin: 4px 0 0 18px; padding: 0; }
.bad-text { color: #a33; }

/* ---- login brand footer (SapiensAI note) ------------------------------------ */
.login-brand .brand-note {
  margin-top: 8px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.14);
  color: #8595a8; font-size: 11px; line-height: 1.8;
}
.login-brand .brand-note a { color: #aecbe8; text-decoration: none; }
.login-brand .brand-note a:hover { text-decoration: underline; }

/* ---- Opening Stock: editable grid, voucher bar ------------------------------ */
.os-grid td select { min-width: 110px; }
.os-num { width: 92px; }
tr.os-dirty td { background: #fdf6e0; }
tr.os-dirty td:first-child { box-shadow: inset 3px 0 0 #c9963c; }
.os-bar {
  display: flex; gap: 12px; align-items: center; margin-top: 10px;
  background: var(--panel); border: 1px solid var(--border-dk); border-radius: 3px;
  padding: 8px 12px; font-size: 12.5px;
}
.os-voucher { text-align: center; display: flex; flex-direction: column; gap: 6px; padding: 6px 4px; }
.os-vno { font-size: 26px; font-weight: 700; letter-spacing: 1px; color: var(--accent); font-family: var(--mono); }
.os-voucher .os-skips { text-align: left; }
table.grid.os-grid input.os-num { min-width: 84px; }
table.grid.os-grid td input[type=text] { min-width: 150px; }

/* ---- login: business code, activation, licenses ----------------------------- */
.field label .opt { color: var(--muted); font-weight: 400; font-size: 11px; }
.login-alt { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; }
.login-alt a { color: var(--accent); text-decoration: none; }
.login-alt a:hover { text-decoration: underline; }
/* the field app (Delivery / Technician) under the sign-in form */
.login-app { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.login-app .btn { font-weight: 600; }
.login-app-note { margin-top: 6px; font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.45; }
.login-app-note a { color: var(--accent); }
/* show / hide password: a small eye inside the box, there only once something is typed */
.pw-wrap { position: relative; }
.field .pw-wrap input { padding-right: 34px; }
.pw-wrap input::-ms-reveal, .pw-wrap input::-ms-clear { display: none; }   /* Edge's own eye would make two */
.pw-eye {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  width: 26px; height: 24px; padding: 0; border: 0; background: transparent;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); cursor: pointer; border-radius: 2px;
}
.pw-eye:hover { color: var(--accent); background: var(--row-hover); }
.pw-eye svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.act-done { font-size: 16px; font-weight: 600; color: var(--ok); margin-bottom: 6px; }
.act-code {
  font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: 2px;
  color: var(--accent); background: var(--panel-2); border: 1px dashed var(--border-dk);
  border-radius: 4px; text-align: center; padding: 10px 8px; margin: 10px 0 14px;
}
.lic-key { font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: 1px; color: var(--accent); padding: 4px 0; }
.lic-key-sm { font-family: var(--mono); font-size: 11.5px; background: var(--panel-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 2px; white-space: nowrap; }

/* ---- plans and end dates (the platform Super Admin; a business's notice) ---- */
.pl-inline { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pl-inline .pl-days { width: 64px; }
.pl-biz td { vertical-align: middle; }
.pl-biz select { max-width: 190px; }
.pl-biz td.pl-c { text-align: center; }
.pl-plans td { white-space: normal; vertical-align: top; }
.pl-preview { margin-top: 10px; padding: 8px 12px; border: 1px dashed var(--border-dk); background: var(--panel-2); font-size: 12.5px; line-height: 1.6; }
.pl-mods { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; margin-top: 8px; }
.pl-mod { border: 1px solid var(--border); background: var(--panel-2); padding: 6px 8px; }
.pl-mod-h { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 2px 0 4px; }
.pl-tick { display: flex; gap: 6px; align-items: flex-start; padding: 2px 0; font-size: 12.5px; cursor: pointer; }
.pl-tick input { margin-top: 2px; }
.pl-tick.pl-core { color: var(--muted); cursor: default; }
.pl-tick.pl-all { margin-top: 10px; }
.pl-sets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 16px; }
.sub-banner { background: var(--warn-bg); color: var(--warn); border-bottom: 1px solid #ddca9d; padding: 5px 12px; font-size: 12.5px; }
.sub-ended {
  position: fixed; inset: 0; z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 600px at 70% -10%, #46566e 0%, transparent 60%),
    linear-gradient(135deg, #2c3645 0%, #1e2530 100%);
}
.sub-ended .sub-card { width: 520px; max-width: 94vw; background: var(--panel); border: 1px solid var(--border-dk); box-shadow: var(--shadow); padding: 28px 30px; text-align: center; }
.sub-ended .logo { width: 46px; height: 46px; margin: 0 auto 10px; border: 2px solid var(--accent); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 700; border-radius: 4px; }
.sub-ended h1 { margin: 0 0 6px; font-size: 22px; color: var(--bad); }
.sub-ended p { margin: 8px 0; line-height: 1.55; }
.sub-ended .sub-biz { font-weight: 700; font-size: 15px; }
.sub-ended .sub-ask { font-weight: 700; font-size: 14px; }
.sub-ended .sub-contact { margin: 14px auto 18px; padding: 10px 14px; border: 1px solid var(--border); background: var(--panel-2); display: table; text-align: left; line-height: 1.7; }
.sub-ended .sub-contact a, .pl-preview a { color: var(--accent); }

/* ---- CRM: customer import modal --------------------------------------------- */
.ci-step { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ci-step:first-child { padding-top: 0; }
.ci-step:last-child { border-bottom: none; padding-bottom: 0; }
.ci-num { flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.ci-main { flex: 1; min-width: 0; }
.ci-title { font-weight: 600; font-size: 13px; margin: 2px 0 7px; }
.ci-line { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ci-line input[type=file] { flex: 0 1 auto; min-width: 0; max-width: 100%; font-size: 12.5px; }
.ci-line .ci-note { flex: 1 1 260px; }
.ci-note { color: var(--muted); font-size: 12px; line-height: 1.5; }
.ci-main > .ci-note { margin-top: 5px; }
.ci-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.ci-chip { padding: 2px 10px; border: 1px solid var(--border-dk); border-radius: 12px; background: var(--panel-2); font-size: 12px; }
.ci-chip b { font-variant-numeric: tabular-nums; margin-left: 2px; }
.ci-chip.ok { color: var(--ok); background: var(--ok-bg); border-color: #bcd3b3; }
.ci-chip.bad { color: var(--bad); background: var(--bad-bg); border-color: #d8b5b1; }
.ci-chip.warn { color: var(--warn); background: var(--warn-bg); border-color: #ddca9d; }
.ci-banner { padding: 8px 11px; border: 1px solid; border-radius: 3px; font-size: 12.5px; line-height: 1.5; margin-bottom: 8px; }
.ci-banner.ok { color: var(--ok); background: var(--ok-bg); border-color: #bcd3b3; }
.ci-banner.bad { color: var(--bad); background: var(--bad-bg); border-color: #d8b5b1; font-weight: 600; }
.ci-banner.warn { color: var(--warn); background: var(--warn-bg); border-color: #ddca9d; }
.ci-confirm { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-weight: 600; color: var(--text); cursor: pointer; }
.ci-confirm input { margin: 0; }
.ci-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.ci-tools .spacer { flex: 1; }
.ci-tools .btn.active { background: var(--row-sel); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.ci-issues { max-height: 300px; overflow: auto; border: 1px solid var(--border-dk); background: var(--content); }
/* fixed widths keep the Problem column in view; the other cells cut long text short */
.ci-issues table.grid { table-layout: fixed; }
.ci-issues .ci-c-row { width: 52px; }
.ci-issues .ci-c-cust { width: 21%; }
.ci-issues .ci-c-col { width: 19%; }
.ci-issues .ci-c-val { width: 17%; }
.ci-issues table.grid th { cursor: default; z-index: 1; }
.ci-issues table.grid tbody tr { cursor: default; }
.ci-issues table.grid td { vertical-align: top; max-width: none; }
.ci-issues td.ci-msg { white-space: normal; }
.ci-issues td.ci-val { font-family: var(--mono); font-size: 11.5px; }
.ci-issues tr.ci-error td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
.ci-issues tr.ci-warning td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.ci-more { margin-top: 5px; }
/* Product import: the changes an exported file makes (old value -> new value) */
.ci-chip.pi-chg { color: var(--accent); background: var(--row-sel); border-color: var(--accent); }
.pi-changes { margin-bottom: 10px; }
.pi-changes td.pi-old { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(127,127,127,.5); }
.pi-changes td.pi-new { color: var(--accent); font-weight: 600; }
/* Export products: one line per part when the catalogue needs several files */
.pe-parts { display: flex; flex-direction: column; gap: 6px; }
.pe-part { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 7px 10px; border: 1px solid var(--border); border-radius: 3px; background: var(--panel-2); font-size: 12.5px; }
.pe-part .spacer { flex: 1; }
.pe-part .btn.done { border-color: var(--ok); color: var(--ok); }
/* Incentives: Applies to (All users / Selected users only + the tick list) */
.ic-applies { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12.5px; }
.ic-applies-field { margin-top: 10px; }
.ic-users-mode { display: flex; gap: 16px; flex-wrap: wrap; margin: 2px 0 6px; font-size: 12.5px; }
.ic-users-mode label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.ic-users-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.ic-users-tools input[type=search] { flex: 1 1 140px; min-width: 0; }
.ic-users-list { max-height: 210px; overflow: auto; border: 1px solid var(--border-dk); background: var(--content); padding: 4px 6px; display: flex; flex-direction: column; gap: 2px; }
.ic-user { display: flex; align-items: center; gap: 6px; padding: 3px 2px; font-size: 12.5px; cursor: pointer; }
.ic-user[hidden] { display: none; }
.ic-user b { font-weight: 600; }
/* Product bulk import: the animated check list (each check turns green, amber or red in turn) */
.vi-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.vi-step { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 3px; background: var(--panel-2); font-size: 12.5px; opacity: .55; transition: opacity .3s, background .3s, border-color .3s; }
.vi-step.run, .vi-step.ok, .vi-step.warn, .vi-step.bad { opacity: 1; }
.vi-step.ok { background: var(--ok-bg); border-color: #bcd3b3; }
.vi-step.warn { background: var(--warn-bg); border-color: #ddca9d; }
.vi-step.bad { background: var(--bad-bg); border-color: #d8b5b1; }
.vi-step.skip { opacity: .45; }
.vi-ico { flex: 0 0 22px; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: #fff; background: var(--border-dk); }
.vi-step.run .vi-ico { background: transparent; }
.vi-step.run .vi-ico .spinner { width: 16px; height: 16px; border-width: 2px; }
.vi-step.ok .vi-ico { background: var(--ok); animation: vi-pop .35s ease-out; }
.vi-step.warn .vi-ico { background: var(--warn); animation: vi-pop .35s ease-out; }
.vi-step.bad .vi-ico { background: var(--bad); animation: vi-shake .4s ease-out; }
.vi-label { flex: 1; min-width: 0; }
.vi-label b { font-weight: 600; }
.vi-sub { color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.vi-step.bad .vi-sub { color: var(--bad); }
.vi-step.warn .vi-sub { color: var(--warn); }
.vi-count { font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; }
@keyframes vi-pop { 0% { transform: scale(.4); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes vi-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .vi-step.ok .vi-ico, .vi-step.warn .vi-ico, .vi-step.bad .vi-ico { animation: none; } }
.btn .spinner { width: 11px; height: 11px; border-width: 2px; margin-top: -2px; }
/* phones: each issue becomes a small labelled block instead of a wide table row */
@media (max-width: 640px) {
  .ci-step { gap: 8px; }
  .ci-issues table.grid, .ci-issues tbody, .ci-issues tr, .ci-issues table.grid td { display: block; width: auto; }
  .ci-issues colgroup, .ci-issues thead { display: none; }
  .ci-issues tr { padding: 6px 9px; border-bottom: 1px solid var(--border); }
  .ci-issues table.grid td { border: none; padding: 1px 0; white-space: normal; text-align: left; background: transparent; }
  .ci-issues table.grid tr:nth-child(even) { background: var(--row-alt); }
  .ci-issues table.grid td:empty { display: none; }
  .ci-issues td[data-l]::before { content: attr(data-l) ": "; color: var(--muted); font-family: var(--ui); font-size: 11px; }
  .ci-issues tr.ci-error td:first-child, .ci-issues tr.ci-warning td:first-child { box-shadow: none; }
  .ci-issues tr.ci-error { box-shadow: inset 3px 0 0 var(--bad); }
  .ci-issues tr.ci-warning { box-shadow: inset 3px 0 0 var(--warn); }
  .ci-issues td.ci-msg { margin-top: 3px; }
}

/* ---- bill items: Lot No / Discount columns, the totals row, return mode ---- */
table.grid.bill-items tfoot td { font-weight: 600; background: var(--panel-2); border-top: 2px solid var(--border-dk); padding: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.grid.bill-items input.bad { border-color: var(--bad); background: var(--bad-bg); }
/* Sales Return mode: the item search glows yellow so a return is never typed as a sale */
.bill-sel.ret-mode .ta-wrap > input { background: #fff6bf; border-color: #d9a900; box-shadow: 0 0 0 3px rgba(240,185,0,.35), 0 0 14px rgba(240,185,0,.75); }
.bill-sel.ret-mode .ta-wrap > input:focus { border-color: #c79a00; box-shadow: 0 0 0 3px rgba(240,185,0,.5), 0 0 18px rgba(240,185,0,.9); }
.bill-sel.ret-mode .bill-sel-ico { color: #b58900; }
.bill-btn.on { background: #fff6bf; border-color: #d9a900; }
.bill-btn.on > :first-child { color: #b58900; }
/* Mode of Payment popup: an amount beside each mode */
.pay-mode { grid-template-columns: 18px 128px 1fr 118px; }
.pay-mode .pay-amt { width: 110px; padding: 4px 6px; text-align: right; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pay-mode .pay-amt:disabled { background: #efeee9; color: var(--muted); }
.pay-mode .pay-amt.bad { border-color: var(--bad); background: var(--bad-bg); }
/* document pickers (Pull from…, Modify): a filter row under the headings */
table.grid.pick-table tr.pick-filters th { padding: 3px 4px; background: var(--panel-2); }
table.grid.pick-table tr.pick-filters input { font-size: 12px; padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; }

/* ---- sidebar: folds to a thin strip (the ⟨ at its top) ---- */
.sb-toggle { position: sticky; top: 0; z-index: 1; display: flex; justify-content: flex-end; padding: 3px 8px; cursor: pointer; color: var(--muted);
  font-size: 13px; line-height: 18px; background: var(--panel); border-bottom: 1px solid var(--border); user-select: none; }
.sb-toggle:hover { color: var(--accent); background: var(--row-hover); }
.body.sb-folded .sidebar { width: 26px; overflow: hidden; }
.body.sb-folded .sidebar .grp, .body.sb-folded .sidebar .item { display: none; }
.body.sb-folded .sb-toggle { justify-content: center; padding: 8px 0; border-bottom: none; }

/* ---- Price Lists screen ---- */
.pl-split { grid-template-columns: 260px minmax(0, 1fr); }
.pl-new { display: flex; gap: 6px; margin-bottom: 8px; }
.pl-new input { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; }
.pl-list .item { border-left: 3px solid transparent; }
.pl-formula { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2); font-size: 12.5px; }
.pl-formula select, .pl-formula input { padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; }
.pl-radios { display: inline-flex; gap: 10px; }
.pl-radios label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.pl-filter { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; }
.pl-layers { display: flex; flex-direction: column; gap: 6px; }
.pl-layer { display: grid; grid-template-columns: 190px minmax(0, 1fr) 24px; align-items: center; gap: 8px; }
.pl-layer select, .pl-layer input { padding: 5px 7px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; }
.pl-res-head { margin: 4px 0 6px; font-size: 12.5px; }
.pl-res-head label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.pl-split .panel > .body { display: block; }
.pl-list .item .count { margin-left: auto; }
.pl-list .item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; font-size: 12.5px; border-left: 3px solid transparent; }
.pl-list .item:hover { background: var(--row-hover); }
.pl-list .item.active { background: var(--row-sel); border-left-color: var(--accent); font-weight: 600; }
.pl-list .item .g { color: var(--accent); opacity: .8; }
.pl-list .item .count { font-size: 10.5px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 0 6px; }

/* ---- return lines on a bill (Sales Return toggle), pay popup without tick boxes, Pull popup bar ---- */
table.grid.bill-items tr.ret td { background: #fff6bf; }
table.grid.bill-items tr.ret input { background: #fffbe0; }
table.grid.bill-items tr.ret td[data-calc="amt"] { color: var(--bad); font-weight: 600; }
.ret-tag { color: #b58900; font-weight: 700; }
.pi tr.ret td { background: #fff6bf; }
.pay-mode { grid-template-columns: 140px 1fr 118px; cursor: default; }
.pay-mode.on { background: var(--row-sel); border-color: var(--accent-2); }
.pick-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: 0 0 8px; font-size: 12.5px; }
.pick-bar label { display: inline-flex; align-items: center; gap: 6px; }
.pick-bar select { padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; }

/* ---- opened-bill lock note, Other Details form, return popup, Invoice Payments, Delivery Status ---- */
.bill-lock-note .btn { margin: 0 6px; vertical-align: middle; }
.od-grid { grid-template-columns: 1fr 1fr; }
.od-field { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.od-field > span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.od-field input, .od-field textarea { padding: 5px 8px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; font-family: var(--ui); }
.od-field textarea { resize: vertical; }
.od-field:has(textarea) { grid-column: 1 / -1; }
table.grid.rp-table tr.muted td { color: var(--muted); }
.ip-mode { text-decoration: none; color: var(--text); }
.ip-mode:hover { color: var(--accent); }
.ip-mode .ip-pen { color: var(--accent); margin-left: 4px; font-size: 12px; }
.ds-table input.bad { border-color: var(--bad); background: var(--bad-bg); }
.bill-foot > .muted { align-self: center; font-size: 12px; }

/* ---- lots popup (purchase), settings page, quick-add item ---- */
table.grid.lp-table td.lp-pl { font-size: 11.5px; max-width: 220px; white-space: normal; }
table.grid.lp-table tr.lp-new td { background: var(--panel-2); }
table.grid.lp-table tr.lp-new input { width: 100%; box-sizing: border-box; padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12px; }
.set-grid { grid-template-columns: 1fr 1fr 1fr; }
.set-grid .od-field select { padding: 5px 8px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; }
.set-grid .od-field small { margin-top: 4px; line-height: 1.4; }
@media (max-width: 1100px) { .set-grid { grid-template-columns: 1fr; } }
.od-field select { padding: 5px 8px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; font-family: var(--ui); }

/* Mode of Payment popup (bills, Invoice Payments, receipts): live figures,
   amount boxes that close once the total is allocated, bank account, notes */
.modal.modal-pay { width: 600px; }
/* Multiple payments: a row per payment (mode, amount, reference) */
.modal.modal-pay.modal-mp { width: 760px; }
.mp-table td { vertical-align: top; }
.mp-table select, .mp-table input { width: 100%; box-sizing: border-box; }
.modal-mp .mp-table select.pay-bank { display: block; width: 100%; max-width: none; margin-top: 4px; }
.mp-table .mp-hint { font-size: 10.5px; line-height: 1.3; margin-top: 2px; }
.mp-table tr.mp-fixed td { background: var(--panel-2); }
.pay-sum { display: flex; gap: 16px; flex-wrap: wrap; margin: 0 0 8px; padding: 7px 10px; font-size: 12.5px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 2px; }
.pay-sum b { font-variant-numeric: tabular-nums; }
.pay-sum .ps-left b { color: var(--bad); }
.pay-sum.done .ps-left b { color: var(--ok); }
.pay-sum.over { border-color: var(--bad); background: var(--bad-bg); }
.pay-sum.bad { border-color: var(--bad); }
.pay-mode { grid-template-columns: minmax(150px, 1.2fr) 118px auto; cursor: default; }
.pay-mode.on { background: var(--row-sel); border-color: var(--accent-2); }
.pay-mode .pm-name { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.pay-mode .pm-notes { font-size: 10.5px; color: var(--accent); }
.pay-mode .pm-notes:empty { display: none; }
.pay-mode .pay-amt { width: 110px; text-align: right; padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px;
  font-size: 12.5px; font-variant-numeric: tabular-nums; background: var(--field-bg); }
.pay-mode .pay-amt:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
.pay-mode .pay-amt.bad { border-color: var(--bad); background: var(--bad-bg); }
.pay-mode .pay-amt:disabled { background: #efeee9; color: var(--muted); }
.pay-mode .pm-extra { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.pay-mode .pay-bank, .pay-mode .pay-ref { padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 11.5px;
  font-family: var(--ui); max-width: 160px; background: var(--field-bg); }
.pay-mode .pay-ref { width: 110px; }
/* Credit (Udhaari) with an amount: its credit days and a reference, on a line of their own */
.pay-mode .pm-credit { grid-column: 1 / -1; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding-top: 4px; font-size: 12px; }
.pay-mode .pm-credit[hidden] { display: none; }
.pay-mode .pm-credit label { display: inline-flex; align-items: center; gap: 6px; }
.pay-mode .pm-credit .pay-days { width: 64px; padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; text-align: right; font-size: 12px; background: var(--field-bg); }
.pay-mode .pm-credit .pay-days.bad { border-color: var(--bad); background: var(--bad-bg); }
.pay-mode .pm-credit .pm-cref { flex: 1; min-width: 200px; }
.pay-mode .pm-credit .pm-cref .pay-ref { flex: 1; width: auto; }
/* Advance / Credit Note with an amount: the vouchers / credit notes it adjusts
   (click to pick again); red while they are not picked */
.pay-mode .pm-links { grid-column: 1 / -1; padding-top: 4px; font-size: 12px; color: var(--muted); }
.pay-mode .pm-links[hidden] { display: none; }
.pay-mode .pm-links a { color: var(--accent); text-decoration: none; border-bottom: 1px dashed currentColor; }
.pay-mode .pm-links.miss a { color: var(--bad); font-weight: 600; }
/* the picker: which vouchers / credit notes, how much of each */
table.grid.lk-table input[data-lk-amt] { width: 100%; box-sizing: border-box; text-align: right; padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px;
  font-size: 12px; font-variant-numeric: tabular-nums; background: var(--field-bg); }
table.grid.lk-table input[data-lk-amt].bad { border-color: var(--bad); background: var(--bad-bg); }
.lk-sum { margin-top: 8px; font-size: 12.5px; font-weight: 600; }
.lk-sum.bad { color: var(--bad); }
/* GSTIN: the ⇣ Fetch beside the box, and what the GST portal holds (after a fetch) */
.gst-row { display: flex; gap: 6px; align-items: stretch; }
.gst-row input { flex: 1; min-width: 0; }
.gst-row .gst-btn { white-space: nowrap; }
.form-field.gst-info { border: 1px solid var(--border); border-left: 3px solid var(--accent-2); background: var(--panel-2); border-radius: 3px; padding: 8px 10px; font-size: 12.5px; display: block; }
.gst-info .gi-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.gst-info .gi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 3px 16px; }
.gst-info .gi-row { display: flex; gap: 8px; min-width: 0; }
.gst-info .gi-row span { color: var(--muted); flex: 0 0 130px; }
.gst-info .gi-row b { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.gst-info .gi-sub { margin-top: 6px; font-weight: 600; }
.gst-info .gi-list { margin: 2px 0 0 18px; padding: 0; }
.gst-info .gi-note { margin-top: 6px; font-size: 11.5px; }
/* Users & Access > API Keys */
.ak-intro { margin: 0 0 10px; font-size: 12.5px; line-height: 1.45; }
/* Select Item on a bill: the item's stock on each suggestion */
.ta-stock { font-weight: 600; color: var(--ok); }
.ta-stock.none { color: var(--bad); }
.ta-item.active .ta-stock, .ta-item:hover .ta-stock { color: #fff; }
/* purchase entry: the Save button pressed, saving and saved; a line's challan tag */
.bill-btn:active:not(:disabled) { transform: scale(.95); }
.bill-btn.busy { opacity: .85; animation: btn-pulse 1s ease-in-out infinite; }
.bill-btn.saved, .bill-btn.saved:disabled { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); opacity: 1; animation: btn-saved .7s ease-out; }
.bill-btn.saved > :first-child { color: var(--ok); }
@keyframes btn-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(.96); } }
@keyframes btn-saved { 0% { transform: scale(.92); box-shadow: 0 0 0 0 rgba(79,122,70,.55); } 60% { transform: scale(1.05); box-shadow: 0 0 0 12px rgba(79,122,70,0); } 100% { transform: scale(1); box-shadow: none; } }
.pd-src { display: block; margin-top: 2px; font-size: 10.5px; color: var(--accent); white-space: nowrap; }
.pd-src.pending { color: #8a6d1f; }
.pd-src.settled { color: var(--ok); }
table.grid.pc-table tr.pc-had td { color: var(--muted); }
table.grid.pc-table tr.pc-head td { background: var(--panel-2); }
.pay-note { margin-top: 8px; min-height: 16px; }
.bill-totals .pay-extra { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }

/* cash tender: the denomination table */
.dn-table td, .dn-table th { padding: 5px 8px; }
.dn-table .dn-val { font-weight: 600; white-space: nowrap; }
.dn-table .dn-qty { width: 84px; text-align: right; padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; }
.dn-table .dn-qty:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
.dn-table .dn-qty.bad { border-color: var(--bad); background: var(--bad-bg); }
.dn-table tfoot td { font-weight: 600; }
.dn-table .dn-tot td { background: var(--panel-2); font-size: 13px; }
.dn-table .dn-chg td { color: var(--ok); }
.dn-table .dn-short td { color: var(--warn); }

/* bill line: the small arrow beside Lot No opens the item's lot popup */
table.grid.bill-items td.bill-lot { position: relative; }
table.grid.bill-items td.bill-lot input { padding-right: 16px; }
table.grid.bill-items .lot-pick { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); border: 0; background: none;
  color: var(--muted); cursor: pointer; font-size: 10px; padding: 2px; line-height: 1; }
table.grid.bill-items .lot-pick:hover { color: var(--accent); }
.lp-table tr.pick:focus { outline: 2px solid var(--accent-2); outline-offset: -2px; }

/* Finance > Receipts (the billing-screen layout) */
table.grid.rc-items input[type=number] { width: 100%; box-sizing: border-box; text-align: right; }
table.grid.rc-items tr.ret td { background: var(--warn-bg); }
.rc-actions { grid-template-columns: repeat(7, minmax(0, 1fr)); }

/* Inventory > HSN Codes: the HSN list picker */
.hsn-box { min-width: 640px; }
.hsn-note { margin: 0 0 6px; font-size: 12px; min-height: 16px; }
table.grid.hsn-table td.hsn-desc { white-space: normal; max-width: none; line-height: 1.35; }
table.grid.hsn-table input[type=number] { width: 96px; text-align: right; padding: 3px 6px; border: 1px solid var(--border-dk); border-radius: 2px; }
table.grid.hsn-table mark { background: var(--warn-bg); padding: 0; font-weight: 600; }
.hsn-picked { margin-top: 6px; font-size: 11.5px; max-height: 40px; overflow: auto; }

/* Sales > Job Card: the printed form as a screen */
.jc-card { background: var(--content); border: 1px solid var(--border-dk); padding: 12px 14px; margin-bottom: 12px; }
.jc-top { display: grid; grid-template-columns: 160px 1fr 170px 160px 210px; gap: 12px; align-items: start; }
.jc-field { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; min-width: 0; }
.jc-field > span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.jc-field > span small { text-transform: none; letter-spacing: 0; }
.jc-field input, .jc-field textarea { padding: 5px 8px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; font-family: var(--ui); background: var(--field-bg); }
.jc-field input:focus, .jc-field textarea:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
.jc-field input:disabled, .jc-field textarea:disabled { background: #efeee9; color: var(--text); }
.jc-field textarea { resize: vertical; }
.jc-field textarea.jc-terms { font-family: 'Nirmala UI', 'Noto Sans Devanagari', 'Mangal', var(--ui); line-height: 1.5; }
.jc-field.jc-full { margin: 10px 0; }
.jc-no { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.jc-no > span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.jc-no > b { font-size: 16px; color: var(--accent); font-variant-numeric: tabular-nums; }
.jc-title { text-align: center; font-size: 17px; font-weight: 700; letter-spacing: 2px; margin: 10px 0; color: var(--accent); }
.jc-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.jc-box { border: 1px solid var(--border); padding: 8px 10px; display: flex; flex-direction: column; gap: 7px; background: var(--panel); }
.jc-box-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 8px 0 4px; }
.jc-box .jc-box-h { margin: 0; text-align: center; }
.jc-box .bill-cust-info { margin: 0; }
table.grid.jc-work td { padding: 2px 4px; vertical-align: middle; }
table.grid.jc-work input { width: 100%; box-sizing: border-box; padding: 4px 6px; border: 1px solid transparent; background: transparent; font-size: 12.5px; font-family: var(--ui); }
table.grid.jc-work input:hover { border-color: var(--border); background: var(--content); }
table.grid.jc-work input:focus { outline: none; border-color: var(--accent-2); background: var(--content); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
table.grid.jc-work input.num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid.jc-work tfoot td { background: var(--panel-2); }
table.grid.jc-work tfoot input { background: var(--field-bg); border-color: var(--border-dk); }
.jc-actions { grid-template-columns: repeat(7, minmax(0, 1fr)); }
/* the ADVANCE row: the voucher (read-only) on the left, the mode beside the amount */
.jc-advrow { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.jc-advl { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.jc-advr { white-space: nowrap; }
table.grid.jc-work tfoot input.jc-voucher { width: 96px; background: #f3f2ec; border-color: var(--border); color: var(--accent); font-weight: 700; text-align: center; cursor: default; }
table.grid.jc-work tfoot input.jc-voucher:focus { box-shadow: none; border-color: var(--border); }
table.grid.jc-work tr.jc-addrow td { padding: 6px 4px; background: var(--content); }
/* the job category bar on top of the card: the owner's list, its rate, where it goes */
.jc-catbar { display: grid; grid-template-columns: minmax(240px, 320px) 170px minmax(200px, 260px) 1fr; gap: 14px; align-items: end; padding: 8px 10px; margin-bottom: 10px; border: 1px solid var(--border); background: var(--panel); }
.jc-catbar select { padding: 5px 8px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; font-family: var(--ui); background: var(--field-bg); }
.jc-catbar select:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
.jc-catbar select:disabled { background: #efeee9; color: var(--text); }
.jc-cathelp { font-size: 11.5px; padding-bottom: 7px; }
/* Warranty: Yes / No radios in the machine box */
.jc-radios { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; min-height: 29px; }
.jc-radio { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; cursor: pointer; }
.jc-field .jc-radio input[type="radio"] { width: auto; padding: 0; margin: 0; border: 0; box-shadow: none; accent-color: var(--accent); }
/* work lines free under warranty: 0 and locked */
table.grid.jc-work tr.jc-locked td { background: #f3f2ec; }
table.grid.jc-work tr.jc-locked input:disabled { color: var(--muted); cursor: not-allowed; }
.jc-lock { color: var(--muted); font-size: 12px; cursor: help; }
table.grid.jc-work .ta-wrap { display: block; }
/* the job card's advance: its mode of payment beside the amount, the voucher it made */
.jc-advmode { font-size: 11.5px; padding: 2px 4px; margin-left: 8px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); font-family: var(--ui); }
.jc-advnote { font-weight: 400; text-transform: none; letter-spacing: 0; }
/* Sales > Advance Voucher / Refund: the small money forms */
.vc-form .vc-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 10px 0; align-items: start; }
.vc-form .vc-head { grid-template-columns: 220px 170px 1fr; align-items: end; margin-top: 0; }
.vc-form .vc-refs { grid-template-columns: 200px 1fr; }
.vc-form select { padding: 5px 8px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; font-family: var(--ui); background: var(--field-bg); }
.vc-form select:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
.vc-form select:disabled { background: #efeee9; color: var(--text); }
.vc-form .req { color: var(--bad); font-weight: 700; }
.vc-form .jc-field > span .req { text-transform: none; }
.vc-form .lookup-row { max-width: 600px; }
.vc-form .lookup-row .ta-wrap { flex: 1; }
.vc-form .ta-wrap > input { width: 100%; box-sizing: border-box; padding: 5px 8px; font-size: 13px; font-family: var(--ui); background: var(--field-bg); border: 1px solid var(--border-dk); border-radius: 2px; }
.vc-form .ta-wrap > input:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
.vc-form .ta-wrap > input:disabled { background: #efeee9; color: var(--muted); }
.vc-form .bill-cust-info { margin-top: 3px; }
.vc-minus { color: var(--bad); }
.vc-settle { font-size: 12px; margin-top: 10px; padding-top: 8px; border-top: 1px dotted var(--border); }
/* Finance > Payment Voucher and its Petty Expense tab */
.pv-form .pv-acct { display: flex; gap: 6px; align-items: stretch; }
.pv-form .pv-acct select { flex: 1 1 auto; min-width: 0; }
.pv-form .vc-row.pv-party { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.pv-form .vc-row.pv-petty-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 150px minmax(0, 1.6fr); }
.pv-form .jc-radios small { flex-basis: 100%; }
.pv-form .pv-cash-note { font-size: 12px; }
.pv-form .pv-made { font-size: 11.5px; margin-top: 6px; }
.pv-form .perm-note { margin: 6px 0; }
.pv-list { margin-top: 12px; }
.pv-list .kpis { margin: 10px 0; }
.pv-table tbody tr[data-pv-id] { cursor: pointer; }
.pv-table tbody tr[data-pv-id]:hover > td { background: var(--row-hover); }
.pv-table tbody tr.pv-cur > td { background: var(--row-sel); }
.pv-table .pv-note { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi .pv-sign { margin-top: 26px; }
@media (max-width: 1100px) { .pv-form .vc-row.pv-petty-row, .pv-form .vc-row.pv-party { grid-template-columns: 1fr 1fr; } }
.vc-actions { grid-template-columns: repeat(5, minmax(0, 1fr)); }
/* Sales > Job Pending: the job cards with status, follow-ups, reminders */
.jp-filter { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 400; }
.jp-filter select, .panel > .head .jp-q { font-size: 12px; padding: 3px 6px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); font-family: var(--ui); }
.panel > .head .jp-q { width: 220px; }
table.grid.jp-table td { vertical-align: middle; }
table.grid.jp-table tr[data-id] { cursor: pointer; }
table.grid.jp-table select, table.grid.jp-table input[type="date"] { font-size: 12px; padding: 3px 5px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); font-family: var(--ui); max-width: 100%; }
table.grid.jp-table select:disabled, table.grid.jp-table input:disabled { background: #efeee9; color: var(--muted); }
.jp-sub { display: block; font-size: 11px; line-height: 1.3; }
.jp-sub.jp-late { color: var(--bad); font-weight: 700; }
/* a delivery photo from the field app (Delivery Status, the bill's delivery log) */
.dp-photo { display: block; width: 100%; max-height: 60vh; object-fit: contain; background: #111; border-radius: 3px; }
.dp-items { margin: 8px 0 0; padding-left: 18px; }
.jp-x { width: 34px; text-align: center; }
.jp-cancel { border: 1px solid var(--bad); color: var(--bad); background: var(--bad-bg); border-radius: 2px; width: 24px; height: 24px; line-height: 20px; font-weight: 700; cursor: pointer; padding: 0; font-family: var(--ui); }
.jp-cancel:hover { background: var(--bad); color: #fff; }
.jp-cancel.off { display: inline-block; width: 24px; height: 24px; line-height: 22px; color: #c9c7bf; border: 1px solid #e3e1d9; border-radius: 2px; cursor: default; background: transparent; }
tr.jp-cancelled td { color: var(--muted); background: #f6f5f0; }
tr.jp-due-row td { background: #fff8e6; }
.jp-due { color: var(--bad); font-weight: 700; display: block; font-size: 11px; }
.jp-detail { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 14px; }
.jp-f { display: flex; flex-direction: column; font-size: 12.5px; min-width: 0; }
.jp-f > span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.jp-hist { max-height: 46vh; overflow: auto; border: 1px solid var(--border); background: var(--panel); padding: 4px 8px; }
.jp-h { display: grid; grid-template-columns: 132px 80px 1fr auto; gap: 8px; padding: 4px 0; border-bottom: 1px dotted var(--border); font-size: 12px; align-items: baseline; }
.jp-h:last-child { border-bottom: 0; }
.jp-h-when { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.jp-h-act { font-weight: 700; }
.jp-h-act.ok { color: var(--ok); } .jp-h-act.warn { color: var(--warn); } .jp-h-act.bad { color: var(--bad); } .jp-h-act.info { color: var(--info); }
.jp-h-txt { white-space: pre-wrap; word-break: break-word; }
.jp-h-by { white-space: nowrap; font-size: 11px; }
.set-grid .od-field.set-text { grid-column: 1 / -1; }
.set-grid .od-field.set-text textarea { font-family: 'Nirmala UI', 'Noto Sans Devanagari', 'Mangal', var(--ui); line-height: 1.5; }

/* the printed job card (the printed form's layout) */
@media print {
  body.printing { background: #fff; }
  .jcp { font-family: 'Nirmala UI', 'Noto Sans Devanagari', 'Mangal', Arial, sans-serif; font-size: 11.5px; color: #000; width: 186mm; margin: 0 auto; page-break-inside: avoid; }
  .jcp-org { text-align: center; font-weight: 700; font-size: 14px; margin-bottom: 4px; }
  .jcp-head { display: flex; justify-content: space-between; align-items: flex-start; }
  .jcp-cell { border: 1px solid #000; padding: 3px 6px; min-width: 60mm; margin-bottom: 2px; font-size: 12px; }
  .jcp-headr .jcp-cell { min-width: 72mm; }
  .jcp-title { text-align: center; font-weight: 700; font-size: 16px; letter-spacing: 1px; margin: 6px 0 4px; }
  .jcp-title .jcp-no { font-size: 11px; font-weight: 400; margin-left: 10px; }
  .jcp table { width: 100%; border-collapse: collapse; }
  .jcp-cm th, .jcp-cm td, .jcp-work th, .jcp-work td, .jcp-foot td { border: 1px solid #000; padding: 3px 6px; font-size: 12px; }
  .jcp-cm th { font-weight: 700; text-align: center; width: 25%; }
  .jcp-cm td.l { font-weight: 700; width: 14%; white-space: nowrap; }
  .jcp-cm td.blank { border-left: 1px solid #000; }
  .jcp-issue { border: 1px solid #000; border-top: 0; padding: 4px 6px; min-height: 15mm; }
  .jcp-issue b, .jcp-sp b, .jcp-terms b { font-weight: 700; }
  .jcp-text { white-space: pre-wrap; margin-top: 2px; line-height: 1.45; }
  .jcp-sp { border: 1px solid #000; border-top: 0; padding: 3px 6px; }
  .jcp-work th { font-weight: 700; text-align: center; }
  .jcp-work td { height: 5.4mm; }
  .jcp-work th.r, .jcp-work td.r { text-align: right; width: 13%; }
  .jcp-foot { margin-top: -1px; }
  .jcp-foot td { vertical-align: top; }
  .jcp-foot td.jcp-left { width: 58%; border-right: 0; }
  .jcp-foot td.jcp-sums { padding: 0; }
  .jcp-foot td.jcp-sums table td { border: 1px solid #000; font-weight: 700; }
  .jcp-foot td.jcp-sums table td.r { text-align: right; width: 40%; }
  .jcp-lbl { font-weight: 700; margin-right: 6px; }
  .jcp-box { display: inline-block; border: 1px solid #000; min-width: 50mm; min-height: 6mm; padding: 2px 6px; vertical-align: middle; }
  .jcp-terms { border: 1px solid #000; border-top: 0; padding: 4px 6px; min-height: 28mm; }
  .jcp-sign { display: flex; justify-content: space-between; margin-top: 4px; page-break-inside: avoid; }
  .jcp-sign .jcp-box { min-width: 60mm; min-height: 8mm; font-weight: 700; }
}

/* =================================================================== Reports:
   Payment Modes by User, Debit-Credit, Customer Ledger, custom reports */
/* the shell's .body is a flex row; a report panel's body is a plain block, so charts and tables span it */
[data-rp-body] .panel > .body, [data-cr-result] .panel > .body, .panel.cr-design > .body, .panel.rp-cust-card > .body { display: block; }
[data-vz] { width: 100%; min-width: 0; }
.rp-filters { align-items: flex-end; background: var(--panel); border: 1px solid var(--border); padding: 7px 9px; border-radius: 2px; gap: 8px 10px; }
.rp-f { display: flex; flex-direction: column; gap: 2px; }
.rp-f > span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.rp-f select, .rp-f input { padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; background: var(--field-bg); }
.rp-q input { width: 220px; }
.rp-cust .ta-wrap { width: 290px; }
.rp-cust .ta-wrap input { width: 100%; box-sizing: border-box; }
.rp-chk { flex-direction: row; align-items: center; gap: 5px; font-size: 12px; padding-bottom: 5px; cursor: pointer; }
.rp-quick { display: flex; align-items: center; flex-wrap: wrap; gap: 0 2px; }
.rp-loading { opacity: .5; pointer-events: none; transition: opacity .15s; }
.rp-note { font-size: 12px; color: var(--info); background: var(--info-bg); border: 1px solid #c3d3e4; padding: 6px 10px; border-radius: 2px; margin: 0 0 10px; }
.rp-seg { display: inline-flex; }
.rp-seg .btn { border-radius: 0; margin-left: -1px; }
.rp-seg .btn:first-child { border-radius: 2px 0 0 2px; margin-left: 0; }
.rp-seg .btn:last-child { border-radius: 0 2px 2px 0; }
.rp-seg .btn.on { background: var(--row-sel); border-color: var(--accent); color: var(--accent); font-weight: 600; position: relative; }
.rp-grid { margin-bottom: 0; }
.rp-detail { max-height: 72vh; border: 0; }
.rp-detail table.grid tfoot td, table.rp-matrix tfoot td { font-weight: 600; background: var(--panel-2); border-top: 2px solid var(--border-dk); position: sticky; bottom: 0; }
.rp-detail table.grid thead th { position: sticky; top: 0; z-index: 1; }
table.rp-matrix th.rp-gh { text-align: center; background: var(--panel-2); }
table.grid tr.rp-grow td { background: #e9eef4 !important; cursor: default; border-top: 1px solid #c9d4e0; }
table.grid tr.rp-sub td { font-weight: 600; background: var(--panel-2) !important; cursor: default; }
table.grid tr.rp-memo td { color: var(--muted); font-style: italic; }
/* Customer Outstanding: a summary line opens the customer's bills, a detail line its voucher */
table.grid.co-table tbody tr[data-co-v], .co-summary table.grid.co-table tbody tr[data-co-cust] { cursor: pointer; }
table.grid.co-table tr.co-cust td { border-top: 2px solid var(--border-dk); }
table.grid.co-table tr.co-credit td { color: var(--muted); }
table.grid.co-table tr.co-subtotal td { font-weight: 600; background: var(--panel-2); border-bottom: 2px solid var(--border-dk); }
/* Stock Ledger: a line opens its voucher, an item heading opens the item's ledger */
table.grid.sl-table tbody tr[data-sl-ref], table.grid.sl-table tbody tr[data-sl-item] { cursor: pointer; }
table.grid.sl-table tbody tr.sl-noref td { cursor: default; }
table.grid.sl-table tr.sl-item td { border-top: 2px solid var(--border-dk); }
table.grid.sl-table tr.sl-close td { font-weight: 600; color: var(--muted); }
.sl-kind { font-size: 11px; }
.rp-filters .sl-all { align-self: flex-end; }
/* Administration > Approvals: a row opens the request; its kind as a small tag; Refuse / Approve on the row */
table.grid.ap-table tbody tr[data-ap-row] { cursor: pointer; }
table.grid.ap-table td.ap-what { white-space: normal; min-width: 150px; max-width: 300px; }
table.grid.ap-table td.ap-wrap { white-space: normal; min-width: 90px; max-width: 190px; }
table.grid.ap-table td.ap-acts { white-space: nowrap; text-align: right; }
table.grid.ap-table td.ap-acts .btn + .btn { margin-left: 6px; }
.ap-kind { display: inline-block; padding: 1px 6px; border: 1px solid var(--border); border-radius: 3px; font-size: 11px; white-space: nowrap; background: var(--panel-2); }
.ap-kind.ap-challan { color: var(--info); background: var(--info-bg); border-color: #b6c8db; }
.ap-kind.ap-price { color: var(--warn); background: var(--warn-bg); border-color: #ddca9d; }
.ap-kind.ap-claim { color: var(--neutral); background: var(--neutral-bg); border-color: #cdccc4; }
.ap-kind.ap-entry { color: var(--accent); background: var(--panel-2); border-color: var(--accent); }
/* entries sent for approval (Settings > Approvals): the maker's chip in the title bar, the settings ticks by menu */
.titlebar .aprchip { display: inline-flex; align-items: center; margin-left: 10px; }
.titlebar .aprchip[hidden] { display: none; }
.titlebar .apr-chip { color: #e6edf5; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.18); border-radius: 12px; white-space: nowrap; }
.titlebar .apr-chip.wait { background: rgba(200,150,40,.22); border-color: rgba(230,190,90,.55); }
.titlebar .apr-chip .count { margin-left: 4px; }
.apr-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 6px 18px; }
.apr-group .apr-gh { font-weight: 600; margin: 6px 0 2px; color: var(--accent); }
.apr-lines td.num, .apr-lines th.num { text-align: right; }
/* Approvals: what a request changes, field by field (saved now -> becomes) */
table.grid.apr-changes td { white-space: normal; vertical-align: top; word-break: break-word; }
table.grid.apr-changes td.apr-at { min-width: 120px; max-width: 260px; }
table.grid.apr-changes td.apr-was { color: var(--bad); background: #fbf3f2; min-width: 140px; max-width: 320px; }
table.grid.apr-changes td.apr-now { color: var(--ok); background: var(--ok-bg); font-weight: 600; min-width: 140px; max-width: 320px; }
table.grid.apr-changes tr.apr-gone td.apr-was { text-decoration: line-through; }
/* Job Card: a saved card's details are locked until Change details (the Modify PIN) */
.perm-note.jc-locknote { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.perm-note.jc-locknote .btn { margin-left: auto; }
#jc-screen .jc-card input:disabled, #jc-screen .jc-card textarea:disabled, #jc-screen .jc-card select:disabled { background: #f3f2ee; color: #4a4a48; cursor: not-allowed; }
table.grid td.rp-wrap { white-space: normal; min-width: 180px; max-width: 420px; }
.rp-neg { color: var(--bad); }
.rp-dr { color: #8a4f17; }
.rp-cr { color: var(--ok); }
.rp-more { padding: 8px 10px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.rp-chips { margin: -4px 0 8px; }
.rp-chips .chip b { margin-left: 4px; color: var(--accent); }
/* Audit History > Special Report > Sales Audit: the kinds of change (several at once) and the view */
.sa-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0 2px; margin: 0 0 10px; }
.sa-chips .chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sa-chips .rp-seg { margin: 3px 0; }
.modal.modal-wide.sa-modal { width: min(1180px, calc(100vw - 32px)); }
.rp-cust-card .rp-cname { font-size: 17px; font-weight: 600; margin-bottom: 2px; }
.rp-cstats { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.rp-cstats b { color: var(--text); margin-left: 3px; }
/* the voucher popup */
.rp-kvs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; margin-bottom: 6px; }
.rp-kv > span { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.rp-kv b { font-weight: 600; font-size: 13px; }
.kpi .value small.rp-drcr { font-size: 13px; color: var(--muted); margin-left: 2px; }
.rp-tot { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 10px; }
.rp-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 12px 0 6px; font-weight: 600; }
.rp-pays span { display: inline-block; margin: 0 16px 4px 0; }
table.grid.rp-mini td { white-space: normal; }
/* Add New report gallery */
.modal.modal-wide { width: 1000px; }
.rp-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 8px; }
.rp-tpl { text-align: left; display: flex; flex-direction: column; gap: 3px; padding: 9px 11px; background: var(--content); border: 1px solid var(--border-dk); border-radius: 3px; cursor: pointer; font: inherit; color: var(--text); }
.rp-tpl:hover, .rp-tpl:focus { border-color: var(--accent); background: var(--row-hover); outline: none; }
.rp-tpl .g { color: var(--accent); font-size: 16px; }
.rp-tpl b { font-size: 12.5px; }
.rp-tpl span:not(.g) { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.rp-tpl i { font-size: 10.5px; color: var(--accent-2); font-style: normal; margin-top: auto; }
.rp-blank { background: var(--panel); }
.rp-form label { display: block; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.rp-form input[type=text] { display: block; width: 100%; box-sizing: border-box; margin-top: 3px; padding: 6px 8px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 13px; color: var(--text); }
.rp-form .rp-chk { display: flex; color: var(--text); }
/* the custom report designer */
.cr-design > .body { padding: 10px 12px 4px; }
.cr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; }
.cr-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cr-row.cr-top { align-items: flex-start; }
.cr-lbl { min-width: 118px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.cr-top .cr-lbl { padding-top: 6px; }
.cr-chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.cr-chips > select, .cr-chips select[data-cr] { font-size: 12px; padding: 3px 5px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); }
.cr-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; background: var(--row-sel); border: 1px solid #9fb6cf; border-radius: 12px; font-size: 12px; }
.cr-chip select { font-size: 11.5px; padding: 0 2px; border: 1px solid var(--border); border-radius: 2px; background: #fff; }
.cr-chip .mv { cursor: pointer; color: var(--accent); padding: 0 1px; }
.cr-chip .x, .cr-filter .x, .cr-val .x { cursor: pointer; color: var(--muted); margin-left: 3px; }
.cr-chip .x:hover, .cr-filter .x:hover, .cr-val .x:hover { color: var(--bad); }
select.cr-add { font-size: 12px; padding: 3px 5px; border: 1px dashed var(--border-dk); border-radius: 2px; background: #fff; color: var(--accent); }
.cr-filters { display: flex; flex-direction: column; gap: 5px; flex: 1; align-items: flex-start; }
.cr-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 4px 7px; background: var(--panel); border: 1px solid var(--border); border-radius: 3px; font-size: 12px; }
.cr-filter input, .cr-filter select { font-size: 12px; padding: 2px 5px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); }
.cr-filter input[type=text] { width: 150px; }
.cr-filter input[type=number] { width: 100px; }
.cr-vals { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cr-val { background: var(--row-sel); border: 1px solid #9fb6cf; border-radius: 10px; padding: 0 7px; }
@media (max-width: 1150px) { .cr-grid { grid-template-columns: 1fr; } }
/* charts */
.vz-svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.vz-tick { font-size: 10.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.vz-end { font-size: 10.5px; fill: var(--text); font-weight: 600; }
.vz-hit { fill: transparent; }
.vz-hit:hover { fill: rgba(58, 87, 120, .07); }
.vz-x .vz-hair { stroke: #8a8f96; stroke-width: 1; opacity: 0; }
.vz-x:hover .vz-hair { opacity: 1; }
.vz-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--text); margin-top: 8px; }
.vz-legend .it { display: inline-flex; align-items: center; gap: 5px; }
.vz-sw { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.vz-ln { width: 14px; height: 2px; display: inline-block; border-radius: 1px; }
.vz-empty { padding: 22px; text-align: center; }
.vz-multi.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.vz-mt { font-size: 12px; font-weight: 600; margin: 2px 0 4px; }
.vzb-row { display: grid; grid-template-columns: minmax(90px, 200px) 1fr auto; gap: 10px; align-items: center; margin: 5px 0; font-size: 12px; }
.vzb-lbl { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.vzb-track { position: relative; height: 16px; }
.vzb-one { position: absolute; top: 0; bottom: 0; border-radius: 0 3px 3px 0; cursor: default; }
.vzb-zero { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--border-dk); }
.vzb-stack { display: flex; height: 100%; border-radius: 0 3px 3px 0; overflow: hidden; }
.vzb-seg { height: 100%; min-width: 1px; cursor: default; }
.vzb-seg + .vzb-seg { border-left: 2px solid #fff; }
.vzb-one:hover, .vzb-seg:hover { filter: brightness(1.1); }
.vzb-val { font-variant-numeric: tabular-nums; min-width: 78px; text-align: right; font-size: 11.5px; }
.vzd { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.vzd-legend { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
.vzd-it { display: grid; grid-template-columns: 12px minmax(80px, 240px) auto 52px; gap: 8px; align-items: center; }
.vzd-it .l { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.vzd-it .muted { text-align: right; }
.vzd-c1 { font-size: 8px; fill: var(--muted); }
.vzd-c2 { font-size: 11px; fill: var(--text); font-weight: 600; }
.vzd circle:hover { opacity: .85; }
@media print {
  .rp-print { color: #000; font-family: var(--ui); }
  .rp-print-sub { font-size: 11px; margin: 6px 0 10px; }
  .rp-print .kpis { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
  .rp-print .kpi { border: 1px solid #999; border-top-width: 2px; padding: 4px 8px; min-width: 120px; }
  .rp-print .kpi .value { font-size: 15px; }
  .rp-print .grid2 { display: block; }
  .rp-print .panel { border: 0; margin: 8px 0; }
  .rp-print .panel > .head { font-weight: 700; padding: 4px 0; border-bottom: 1px solid #000; display: flex; gap: 6px; background: none; }
  .rp-print .panel > .body { padding: 4px 0; }
  .rp-print .tablewrap { overflow: visible; max-height: none; border: 0; }
  .rp-print table.grid { border-collapse: collapse; width: 100%; font-size: 9.5px; }
  .rp-print table.grid th, .rp-print table.grid td { border: 1px solid #999; padding: 2px 4px; white-space: normal; max-width: none; position: static; }
  .rp-print .chip, .rp-print .chip-label, .rp-print .rp-seg, .rp-print .rp-more, .rp-print .rec-note, .rp-print .vz-hit, .rp-print .vz-x { display: none !important; }
  .rp-print .rp-note { border: 0; background: none; padding: 2px 0; color: #000; }
}

/* customer form: the note under City (PIN found, new city added...) and the add-city question */
.city-msg { font-size: 11.5px; margin-top: 3px; line-height: 1.4; color: var(--muted); }
.city-msg.ok { color: var(--ok); background: var(--ok-bg); border: 1px solid #bcd3b3; border-radius: 2px; padding: 2px 7px; display: inline-block; }
.city-msg.info { color: var(--info); }
.city-msg.warn { color: var(--warn); }
.city-msg.bad { color: var(--bad); }
.modal.modal-sm { width: 460px; }

/* Sales > Quotation > Save Formats: the formats popup and an admin's format window */
table.grid.qf-table td.qf-prods { white-space: normal; min-width: 260px; max-width: 520px; font-size: 12px; line-height: 1.5; }
table.grid.qf-table td.qf-acts { white-space: nowrap; text-align: right; }
table.grid.qf-table td.qf-acts .btn + .btn { margin-left: 4px; }
.lp-box tr.pick.lp-on td.qf-prods .muted, .lp-box tr.pick.lp-on td .jp-sub { color: rgba(255,255,255,.8); }
.qf-ed .qf-field { display: block; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.qf-ed .qf-field > input, .qf-ed .qf-field .ta-wrap input { display: block; width: 100%; box-sizing: border-box; margin-top: 3px; padding: 6px 8px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 13px; color: var(--text); background: var(--field-bg); }
.qf-ed .qf-field .ta-wrap { display: block; }
table.grid.qf-items td input[type=number] { width: 90px; text-align: right; padding: 3px 6px; border: 1px solid var(--border-dk); border-radius: 2px; }
table.grid.qf-items tr.qf-missing td { color: var(--bad); text-decoration: line-through; }

/* a bill line's Lot No is read-only - picked from the item's lots (click, the down arrow, Alt+Down or F4) */
table.grid.bill-items td.bill-lot input[data-f="lotNo"][readonly]:not(:disabled) { cursor: pointer; background: #f7f6f1; }
table.grid.bill-items td.bill-lot input[data-f="lotNo"][readonly]:focus { background: var(--field-bg); }
/* Job Pending: the invoice of a Complete job */
.jp-bill.due { color: var(--warn); font-weight: 600; }
.jp-bill.ok { color: var(--ok); }

/* a bill line with goods delivered is locked as a whole */
table.grid.bill-items tr.bill-delivered td { background: #f1f4ef !important; }
table.grid.bill-items tr.bill-delivered input:disabled { color: var(--text); background: transparent; border-color: transparent; }
/* the owner's Print history link on a saved document, and reprints in Print History */
.bill-prints { display: inline-block; margin-top: 3px; font-size: 11.5px; }
table.grid tr.pl-reprint td:first-child { box-shadow: inset 3px 0 0 var(--warn); }

/* the Modify PIN popup: four digits, checked as the fourth is typed */
.modal.modal-pin { width: 380px; }
.pin-in { display: block; width: 100%; box-sizing: border-box; font-size: 26px; letter-spacing: 14px; text-align: center; padding: 8px 10px;
  border: 1px solid var(--border-dk); border-radius: 3px; background: var(--field-bg); font-family: var(--mono); }
.pin-in:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(77,111,149,.2); }
.pin-msg { margin-top: 8px; color: var(--bad); font-size: 12.5px; }
.modal.shake { animation: pin-shake .32s; }
@keyframes pin-shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* the barcode scanner: the camera with its aiming frame, the code box, what was found */
.modal.modal-scan { width: 520px; }
.scan-box { display: flex; flex-direction: column; gap: 8px; }
.scan-cam { position: relative; background: #111; border-radius: 3px; overflow: hidden; aspect-ratio: 4 / 3; max-height: 46vh; }
.scan-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-aim { position: absolute; left: 12%; right: 12%; top: 32%; bottom: 32%; border: 2px solid rgba(255,255,255,.85); border-radius: 4px; box-shadow: 0 0 0 999px rgba(0,0,0,.28); }
.scan-aim::after { content: ''; position: absolute; left: 6px; right: 6px; top: 50%; height: 2px; background: #e34948; opacity: .8; }
.scan-note { font-size: 12.5px; }
.scan-in { width: 100%; box-sizing: border-box; padding: 8px 10px; font-size: 14px; font-family: var(--mono); border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); }
.scan-in:focus { outline: none; border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(77,111,149,.18); }
.scan-msg { min-height: 18px; font-size: 13px; }
.scan-msg.ok { color: var(--ok); font-weight: 600; }
.scan-msg.bad { color: var(--bad); }
.scan-log { margin: 0; padding: 0 0 0 18px; max-height: 120px; overflow: auto; font-size: 12px; color: var(--muted); }
.bill-lines .head .bill-scan { margin-left: 6px; font-weight: 400; }

/* purchase entry: the scan box and the item search side by side */
.scan-row.pd-add-row { flex: 1; flex-wrap: wrap; }   /* fills the panel: the item search sits beside the scan box */
.pd-add-row > input[data-pd-scan] { flex: 0 1 260px; font-family: var(--mono); }
.pd-find { position: relative; flex: 1 1 320px; max-width: 520px; }
.pd-find .ta-wrap > input { width: 100%; box-sizing: border-box; padding: 7px 9px; font-size: 13px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); }
.pd-find .ta-pop { min-width: 420px; }
.lp-new .lp-next { font-size: 14px; }
.lp-new input[type=date] { min-width: 126px; }
.lp-new input[type=number] { min-width: 72px; }
.lp-new input[type=text] { min-width: 84px; }
.lp-new select { min-width: 110px; }
table.grid.bill-items td.bill-lot input[data-pd-lot][readonly] { cursor: pointer; }
table.grid.bill-items td.bill-lot input[data-pd-lot]:disabled { cursor: default; }
/* the purchase lot popup: a Qty box per lot, the supplier's markup, the last purchases below */
.lp-box input.lp-qty { width: 72px; box-sizing: border-box; padding: 3px 5px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12px; }
.lp-note .lp-mk { color: var(--accent-2); font-weight: 600; }
.lp-hist { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 8px; }
.lp-hist-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 6px; }
.lp-hist-head select { padding: 2px 4px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12px; }
.tablewrap.lp-hist-wrap { max-height: 24vh; }
.pd-mneg { color: var(--bad); font-weight: 600; }
/* the purchase item grid: two dozen columns at their own widths - it scrolls sideways rather than squeezing them */
table.grid.bill-items.pd-items { min-width: 1980px; }

/* Purchasing > Barcode Print */
.panel.bc-panel > .body { display: block; }
table.grid.bc-table select { width: 100%; box-sizing: border-box; }
table.grid.bc-table input[data-bf="qty"] { width: 100%; box-sizing: border-box; text-align: right; }
.bc-dup { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 14px; padding: 0 2px; }
.bc-dup:hover { color: var(--accent); }
.bc-preview { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.bc-zoom { overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.25); background: #fff; }
.bc-prev-note { font-size: 12px; }

/* a label (screen and print): the fields at their places, in millimetres */
.bcl { position: relative; overflow: hidden; background: #fff; color: #000; box-sizing: border-box; font-family: Arial, Helvetica, sans-serif; }
.bcl-el { position: absolute; box-sizing: border-box; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #000; }
.bcl-el.bcl-wrap { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bcl-el.bcl-bar { overflow: visible; }
.bcl-svg { display: block; width: 100%; fill: #000; }
.bcl-hr { text-align: center; font-family: Consolas, 'Courier New', monospace; letter-spacing: .5px; line-height: 1.1; white-space: nowrap; overflow: hidden; }
.bcl-nobar { display: flex; align-items: center; justify-content: center; border: 1px dashed #999; color: #777; font-size: 6pt; }

/* the label designer: the label drawn large on the left, its settings on the right */
.modal.modal-bcd { width: 940px; }
.bcd { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; align-items: start; }
.bcd-stage { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 14px; background: repeating-conic-gradient(#e9e8e3 0 25%, #f4f3ef 0 50%) 0 0 / 16px 16px; border: 1px solid var(--border); border-radius: 3px; overflow: auto; }
.bcd-zoom { position: relative; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); outline: none; }
.bcd-zoom:focus-visible { box-shadow: 0 0 0 3px rgba(77,111,149,.45), 0 2px 8px rgba(0,0,0,.25); }
.bcd-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; touch-action: none; user-select: none; }
.bcd-canvas [data-el] { cursor: move; outline: 1px dashed rgba(58,87,120,.35); outline-offset: 0; }
.bcd-canvas [data-el]:hover { outline-color: rgba(58,87,120,.8); }
.bcd-canvas [data-el][data-sel] { outline: 1.5px solid var(--accent-2); background: rgba(77,111,149,.08); z-index: 2; }   /* above overlapping fields: its handle stays reachable */
.bcd-h { position: absolute; right: 0; bottom: 0; width: 2.2mm; height: 2.2mm; background: var(--accent-2); cursor: nwse-resize; border-radius: 1px 0 0 0; }
/* a turned field: its handle moves to the corner that lands bottom-right on screen */
.bcl-r90 > .bcd-h { bottom: auto; top: 0; }
.bcl-r180 > .bcd-h { right: auto; bottom: auto; left: 0; top: 0; }
.bcl-r270 > .bcd-h { right: auto; left: 0; }
.bcd-note { font-size: 11.5px; }
.bcd-hint { font-size: 11.5px; }
.bcd-side { display: flex; flex-direction: column; gap: 10px; max-height: 64vh; overflow: auto; }
.bcd-sec { border: 1px solid var(--border); border-radius: 3px; padding: 8px 10px; background: var(--panel-2); display: flex; flex-direction: column; gap: 6px; }
.bcd-row { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 12.5px; }
.bcd-row input[type=number] { width: 64px; }
.bcd-row input[type=text] { width: 100%; box-sizing: border-box; }
.bcd-row label { display: inline-flex; align-items: center; gap: 4px; }
.bcd-row label:has(input[type=text]) { display: flex; flex: 1 1 100%; flex-direction: column; align-items: stretch; }
.bcd-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 6px; }
.bcd-f { display: flex; align-items: center; gap: 6px; padding: 3px 5px; border-radius: 2px; cursor: pointer; font-size: 12.5px; }
.bcd-f:hover { background: var(--row-hover); }
.bcd-f.on { background: var(--row-sel); font-weight: 600; }
@media (max-width: 760px) { .bcd { grid-template-columns: 1fr; } .bcd-side { max-height: none; } }

/* ---- Bill print layout designer (Organization > Settings, the print window):
   the sample bill drawn as it prints (the .pi / .pt print rules) on a paper,
   its blocks / headings chosen and dragged there; the lists on the right ---- */
.modal.modal-bpd { width: 1180px; max-width: calc(100vw - 24px); }
.bpd-tabs { align-items: flex-end; }
.bpd-applies { margin-left: auto; align-self: center; padding: 0 4px 4px; font-size: 11.5px; }
.bpd-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.bpd-stage { padding: 14px; overflow: auto; max-height: 66vh; border: 1px solid var(--border); border-radius: 3px;
  background: repeating-conic-gradient(#e9e8e3 0 25%, #f4f3ef 0 50%) 0 0 / 16px 16px; }
.bpd-paper { margin: 0 auto; padding: 10px; background: #fff; color: #000; font-family: var(--ui); box-shadow: 0 2px 8px rgba(0,0,0,.25); user-select: none; touch-action: none; }
.bpd-paper.bpd-a4 { width: 186mm; zoom: .82; }
.bpd-paper.bpd-a5 { width: 124mm; }
/* a document the owner prints landscape on this paper: the sheet turned sideways (297 / 210 mm less the margins) */
.bpd-paper.bpd-a4.bpd-land { width: 273mm; zoom: .62; }
.bpd-paper.bpd-a5.bpd-land { width: 186mm; zoom: .82; }
/* the designer's bar: the documents (sales / purchase) above the paper tabs; the orientation beside Preview as */
.bpd-fam { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.bpd-orient .bpd-seg { align-self: center; }
.bpd-tabs .bpd-kind { white-space: nowrap; }
.bpd-paper.bpd-thermal { width: 76mm; padding: 8px 4px; zoom: 1.3; }
.bpd-paper [data-bpe] { cursor: grab; outline: 1px dashed transparent; outline-offset: 1px; }
.bpd-paper [data-bpe]:hover { outline-color: rgba(58,87,120,.6); }
.bpd-paper .bpd-on { outline: 2px solid var(--accent-2) !important; background-color: rgba(77,111,149,.07); }
.bpd-paper .bpd-drag { opacity: .45; cursor: grabbing; }
.bpd-paper th.bpd-drop-b { box-shadow: inset 4px 0 0 var(--ok); }
.bpd-paper th.bpd-drop-a { box-shadow: inset -4px 0 0 var(--ok); }
.bpd-paper :not(th).bpd-drop-b { box-shadow: 0 -4px 0 var(--ok); }
.bpd-paper :not(th).bpd-drop-a { box-shadow: 0 4px 0 var(--ok); }
.bpd-paper .bpd-none { color: #888; font-style: italic; }
.bpd-side { display: flex; flex-direction: column; gap: 10px; max-height: 66vh; overflow: auto; }
.bpd-sec { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 3px; background: var(--panel-2); font-size: 12.5px; }
.bpd-list { display: flex; flex-direction: column; gap: 2px; }
.bpd-row { display: flex; align-items: center; gap: 6px; padding: 2px 4px; border: 1px solid transparent; border-radius: 2px; background: var(--content); cursor: pointer; }
.bpd-row:hover { border-color: var(--border-dk); }
.bpd-row.sel { background: var(--row-sel); border-color: var(--accent-2); font-weight: 600; }
.bpd-row.off .bpd-lbl { color: var(--muted); text-decoration: line-through; }
.bpd-row.bpd-drag { opacity: .6; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.bpd-row input[type=checkbox] { margin: 0; }
.bpd-grip { padding: 0 2px; color: var(--muted); cursor: grab; touch-action: none; user-select: none; }
.bpd-lbl { flex: 1 1 auto; min-width: 0; }
.bpd-mv { width: 18px; padding: 0; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--panel-2); color: var(--muted); font-size: 9px; line-height: 14px; cursor: pointer; }
.bpd-mv:hover { border-color: var(--accent); color: var(--accent); }
.bpd-field { display: flex; flex-direction: column; gap: 4px; }
.bpd-field > span { font-size: 11.5px; color: var(--muted); }
.bpd-field input[type=text] { width: 100%; box-sizing: border-box; }
.bpd-seg { display: inline-flex; align-self: flex-start; border: 1px solid var(--border-dk); border-radius: 3px; overflow: hidden; }
.bpd-seg button { padding: 3px 10px; border: 0; border-right: 1px solid var(--border-dk); background: var(--content); color: var(--text); font-family: var(--ui); font-size: 12px; cursor: pointer; }
.bpd-seg button:last-child { border-right: 0; }
.bpd-seg button.on { background: var(--accent); color: #fff; }
.bpd-colbox { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--border-dk); }
.bpd-check { display: flex; align-items: center; gap: 6px; }
.bpd-note { font-size: 11.5px; }
.bpd-hint { margin-top: 8px; font-size: 11.5px; }
/* a line of a block, chosen for its style; the style box (align, size, B / I / U) */
.bpd-paper [data-bpf]:hover { outline: 1px dotted rgba(58,87,120,.7); }
.bpd-paper .bpd-fon { outline: 2px solid var(--ok) !important; }
.bpd-stylebox { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--border-dk); }
.bpd-togs { display: flex; align-items: center; gap: 4px; }
.bpd-tog { width: 28px; height: 24px; padding: 0; border: 1px solid var(--border-dk); border-radius: 3px; background: var(--content); color: var(--text); font-family: var(--ui); font-size: 13px; cursor: pointer; }
.bpd-tog.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.bpd-org { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 6px; border-top: 1px dashed var(--border-dk); }
.bpl-sum { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; }
@media (max-width: 900px) { .bpd-main { grid-template-columns: 1fr; } .bpd-side, .bpd-stage { max-height: none; } }

/* printed labels: a roll prints one label per page (the page is the label);
   an A4 sheet prints them in a grid */
@media print {
  body.bc-printing { margin: 0; }
  body.bc-printing #print-area { padding: 0; margin: 0; }
  .bcl-roll .bcl { break-after: page; page-break-after: always; }
  .bcl-roll .bcl:last-child { break-after: auto; page-break-after: auto; }
  .bcl-sheet { display: grid; justify-content: start; }
  .bcl-sheet .bcl { break-inside: avoid; page-break-inside: avoid; }
  .bcl-svg rect { fill: #000; }
}
/* PIN boxes: masked text (not password fields - no "save password" for a PIN) */
.pin-mask { -webkit-text-security: disc; }
.modal.modal-lots { width: min(1400px, 96vw); }   /* the purchase lot popup: up to twenty columns side by side */
/* Price Lists: the ✕ on a list deletes it (after a confirm); a default list (filled from the lots) is tagged */
.pl-list .item .pl-iname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pl-list .item .pl-lot { font-size: 10px; padding: 0 5px; }
.pl-list .item .pl-x { color: var(--muted); padding: 0 4px; border-radius: 2px; cursor: pointer; line-height: 1.4; }
.pl-list .item .pl-x:hover, .pl-list .item .pl-x:focus-visible { color: var(--bad); background: var(--bad-bg); outline: none; }
.pl-base { display: inline-flex; align-items: center; gap: 6px; }
.pl-base select:disabled { opacity: .55; }
.pl-lotnote { margin: 8px 12px; }
/* another price list as a column: read-only, a base for the formula */
table.grid th.pl-lcol small { display: block; font-weight: 400; color: var(--muted); font-size: 9.5px; text-transform: none; }
table.grid td.pl-lcell { background: var(--panel-2); font-variant-numeric: tabular-nums; }
/* Inventory > Lots */
.panel.lots-panel > .body { display: block; }
.lots-q { padding: 5px 8px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; width: 300px; max-width: 46vw; margin-right: 6px; background: var(--field-bg); }
.lots-wrap { max-height: 72vh; }
table.grid.lots-table td { white-space: nowrap; }
/* the item picker on top, the empty screen until an item is picked, the cells typed over */
.lots-bar { background: var(--panel); border: 1px solid var(--border); padding: 7px 9px; border-radius: 2px; align-items: flex-end; }
.lots-pick { display: flex; flex-direction: column; gap: 2px; }
.lots-pick > span { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.lots-pick input { padding: 5px 8px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 13px; width: 420px; max-width: 60vw; background: var(--field-bg); }
.lots-pick .ta-pop { min-width: 520px; }
.lots-all { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding-bottom: 5px; }
.lots-empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.lots-note { margin: 6px 2px; font-size: 12px; }
.lots-chg { font-size: 12px; margin-right: 6px; color: var(--warn); font-weight: 600; }
table.grid.lots-table td.lot-ed { padding: 2px 4px; }
table.grid.lots-table input.lot-in { box-sizing: border-box; padding: 3px 5px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; background: var(--field-bg); width: 104px; }
table.grid.lots-table input.lot-in[type=number] { width: 84px; text-align: right; }
table.grid.lots-table input.lot-in[type=date] { width: 128px; }
table.grid.lots-table input.lot-in[data-lf="warrantyDays"] { width: 64px; }
table.grid.lots-table input.lot-in.lot-chg { background: var(--warn-bg); border-color: #ddca9d; font-weight: 600; box-shadow: inset 0 -2px 0 var(--warn); }
table.grid.lots-table tr.lot-hl td { background: #fff7d6; }
table.grid.lots-table tr.lot-empty td { color: var(--muted); }
.lot-kept { margin-left: 3px; font-size: 11px; color: var(--accent); cursor: help; }
.lot-edhint { font-weight: 400; color: var(--muted); font-size: 10px; }
.lot-wait { font-size: 10.5px; color: var(--warn); white-space: nowrap; }
/* the price list table keeps its columns readable (the price-list columns add width): it scrolls sideways instead */
table.grid.pl-table { width: max-content; min-width: 100%; }
/* Inventory > Products List: the name and the filter box share each heading (one sticky row) */
.prl-panel .tablewrap.prl-wrap { max-height: calc(100vh - 250px); }
table.grid.prl-table { width: max-content; min-width: 100%; }
table.grid.prl-table th.prl-th { vertical-align: top; padding: 5px 6px; }
table.grid.prl-table th .prl-lbl { margin-bottom: 4px; }
table.grid.prl-table th.num .prl-lbl { text-align: right; }
table.grid.prl-table th input, table.grid.prl-table th select { width: 100%; min-width: 74px; box-sizing: border-box; padding: 3px 5px; font-size: 11.5px; font-weight: 400; border: 1px solid var(--border); border-radius: 2px; cursor: text; }
table.grid.prl-table th select { cursor: pointer; }
table.grid.prl-table .prl-wide { min-width: 260px; }
table.grid.prl-table tr.prl-off td { color: var(--muted); }
table.grid.prl-table td.prl-more { cursor: pointer; text-align: left; }
/* the product form in a popup (Products List) */
.modal.modal-pm { width: 1200px; }
.modal.modal-pm .m-body { max-height: calc(100vh - 170px); background: var(--content); }
table.grid.pl-table td input[type=number] { min-width: 84px; }
/* Inventory > Edit Item Rates */
.panel.itr-main > .body { display: block; }
.tablewrap.itr-wrap { max-height: calc(100vh - 300px); }
table.grid.pl-table td.itr-over input { border-color: var(--bad); color: var(--bad); }
table.grid.pl-table td.itr-over.pl-lcell { color: var(--bad); }
/* Inventory > Edit Stock Options */
.panel.so-main > .body { display: block; }
.panel.so-main .head select { padding: 3px 6px; margin-right: 6px; font-size: 12.5px; }
.tablewrap.so-wrap { max-height: calc(100vh - 300px); }
table.grid.so-table td input[type=text] { min-width: 96px; }
table.grid.so-table td select { width: 100%; min-width: 120px; }
table.grid.so-table td input[type=number]::placeholder { color: var(--muted); font-style: italic; }
table.grid.so-table td.so-stock { white-space: nowrap; }
table.grid.so-table td.so-stock .badge { font-size: 9.5px; margin-left: 4px; }
table.grid.so-table tr.so-off td { color: var(--muted); }
table.grid.so-table tr.so-err td { background: var(--bad-bg, #fbe4e4); }
.so-bulk input, .so-bulk select { font-size: 12.5px; }
/* Purchasing > To be Ordered */
.panel.tbo-main > .body { display: block; }
.tbo-bar select { padding: 3px 6px; font-size: 12.5px; max-width: 240px; }
.tbo-bar .pl-search { width: 200px; padding: 3px 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; }
table.grid.tbo-table th { white-space: normal; vertical-align: bottom; }
table.grid.tbo-table td:nth-child(2) { min-width: 200px; }
table.grid.tbo-table small.tbo-sub { display: block; font-size: 10.5px; line-height: 1.25; }
table.grid.tbo-table td.tbo-qty { font-weight: 700; color: var(--accent); }
table.grid.tbo-table td.tbo-neg { color: var(--bad); font-weight: 600; }
table.grid.tbo-table tr.tbo-grp td { background: var(--panel-2); border-top: 2px solid var(--border-dk); }
/* the job card work details scroll in their own box too, looking as before */
.tablewrap.jc-work-wrap { border: 0; background: none; max-height: 55vh; }
/* sales return: which stock the goods go back into */
.rs-choices { display: flex; flex-direction: column; gap: 8px; }
.rs-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid var(--border-dk); border-radius: 3px; background: var(--field-bg); cursor: pointer; text-align: left; font-size: 13px; }
.rs-choice span { color: var(--muted); font-size: 12px; }
.rs-choice:hover, .rs-choice:focus-visible { border-color: var(--accent-2); background: var(--row-hover); outline: none; }
.rs-choice.on { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.rs-tag { display: block; margin-top: 2px; padding: 0 4px; border: 1px solid var(--border); border-radius: 2px; background: var(--ok-bg); color: var(--ok); font-size: 10.5px; cursor: pointer; white-space: nowrap; }
.rs-tag.ex { background: var(--bad-bg); color: var(--bad); }
.rs-tag:disabled { cursor: default; }
/* a bill line that came in from a kit (BOM product picked on the bill) */
.kit-tag { display: inline-block; margin-top: 2px; padding: 0 4px; border: 1px solid var(--border); border-radius: 2px; background: var(--panel-2); color: var(--accent); font-size: 10.5px; white-space: nowrap; }
.bill-retstock { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--muted); }
.bill-retstock select { padding: 3px 5px; font-size: 12px; border: 1px solid var(--border-dk); border-radius: 2px; }
.pm-ro { background: var(--panel-2) !important; color: var(--text); cursor: default; }
/* Stock Move */
.sm-grid .sm-note { grid-column: span 2; }
.sm-hold { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 3px; font-size: 12.5px; }
.sm-n { font-size: 11px; }
/* Replacement In / Out */
.rv-tabs { margin-bottom: 10px; }
.rv-only { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12.5px; }
.rv-acts { white-space: nowrap; }
.rv-acts .btn { margin-right: 4px; }
.rv-actions { margin: 0 0 12px; }
table.grid.rv-table input[type=number], table.grid.rv-table input[type=text] { width: 100%; box-sizing: border-box; }
/* Stock In - What came back: a checklist; a ticked line is highlighted, an unticked one greyed */
.rv-in-note { padding: 7px 10px; font-size: 12px; border-bottom: 1px solid var(--border); }
table.grid.rv-check tbody tr[data-oi] { cursor: pointer; }
table.grid.rv-check tbody tr.rv-on td { background: var(--row-sel); }
table.grid.rv-check tbody tr.rv-off td { color: var(--muted); }
table.grid.rv-check input[type=checkbox] { width: 15px; height: 15px; cursor: pointer; }
/* Purchasing > Purchase Return */
.pr-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.pr-grid .pr-wide { grid-column: 1 / -1; }
.pr-src { margin: 0 0 12px; padding: 8px 12px; border: 1px solid var(--border); border-left: 3px solid var(--accent-2); background: var(--panel-2); font-size: 12.5px; display: flex; align-items: center; gap: 10px; }
.panel .head .pr-add .ta-wrap { width: 340px; }
.panel .head .pr-add input { width: 100%; box-sizing: border-box; }
table.grid.pr-table td { vertical-align: middle; }
table.grid.pr-table select { width: 100%; }
.pr-exp { font-size: 11px; }
.pr-ro { display: block; text-align: right; color: var(--muted); }
.pr-foot { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; margin: 0 0 12px; }
.pr-notes { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.pr-warn { color: var(--bad); background: var(--bad-bg); border: 1px solid #d8b5b1; padding: 6px 10px; border-radius: 2px; }
table.pr-tot { min-width: 280px; border-collapse: collapse; font-size: 13px; background: var(--panel-2); border: 1px solid var(--border); }
table.pr-tot td { padding: 5px 10px; }
table.pr-tot tr.g td { border-top: 2px solid var(--border-dk); font-weight: 700; font-size: 14px; }
.pr-kpis { margin-top: 4px; }
@media (max-width: 760px) { .pr-foot { flex-direction: column; } table.pr-tot { width: 100%; } .panel .head .pr-add .ta-wrap { width: 100%; } }
@media print {
  .rv-pnote { margin: 6px 0; padding: 4px 8px; border: 1px solid #999; font-size: 11px; }
  .rv-sign { display: flex; justify-content: space-between; margin-top: 40px; font-size: 11.5px; }
  .rv-sign div:last-child { text-align: right; }
}

/* a time of day the 12-hour way (Settings: day close, cashier shifts) */
.tp { display: inline-flex; align-items: center; gap: 3px; }
.tp select { padding: 4px 5px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tp .tp-colon { font-weight: 600; color: var(--muted); }
.tp .tp-ap { min-width: 38px; padding: 4px 7px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--panel-2); font-size: 11.5px; font-weight: 600; cursor: pointer; color: var(--accent); }
.tp .tp-ap.pm { background: var(--accent-2); color: #fff; border-color: var(--accent); }
.tp.empty .tp-ap, .tp.empty .tp-colon, .tp.empty [data-tp-m] { opacity: .45; }
.sh-table td { vertical-align: middle; }
.dc-status { margin-top: 10px; font-size: 12.5px; line-height: 1.6; }
.dc-status code { font-size: 11.5px; background: var(--panel-2); padding: 1px 5px; border-radius: 2px; }
.dc-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
/* Settings > Daily email & backup, and the Super Admin's restore dialog */
[data-bk-body] { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12.5px; }
.bk-h { margin: 16px 0 6px; font-size: 13px; font-weight: 600; color: var(--accent); }
.bk-h .muted { font-weight: 400; font-size: 12px; }
.bk-p { margin: 4px 0 8px; line-height: 1.55; }
.bk-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.bk-table td { vertical-align: middle; }
.bk-log { margin-top: 10px; }
.bk-log summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.bk-loglist { margin: 4px 0 0 18px; padding: 0; line-height: 1.6; }
.bk-preview { max-height: 62vh; overflow: auto; background: #eef2f5; border: 1px solid var(--border); border-radius: 4px; }

/* the day close in the top bar: the chip, the clock counting the last 30 minutes down */
.titlebar .dayclose { display: inline-flex; align-items: center; gap: 7px; margin-left: 12px; padding: 3px 9px 3px 7px; border-radius: 12px; font-size: 12px; color: #e6edf5; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); white-space: nowrap; }
.titlebar .dayclose[hidden] { display: none; }
.titlebar .dayclose .dc-dot { width: 8px; height: 8px; border-radius: 50%; background: #8fc27f; box-shadow: 0 0 0 2px rgba(143,194,127,.25); }
.titlebar .dayclose.closed { background: rgba(170,70,60,.28); border-color: rgba(230,120,110,.5); }
.titlebar .dayclose.closed .dc-dot { background: #e38a82; box-shadow: 0 0 0 2px rgba(227,138,130,.25); }
.titlebar .dayclose .dc-sub { color: #aebdce; font-size: 11px; }
.titlebar .dayclose .dc-count { font-variant-numeric: tabular-nums; font-size: 13px; }
.titlebar .dayclose .btn.sm { padding: 1px 7px; font-size: 11px; margin-left: 2px; }
.titlebar .dayclose.soon { background: rgba(212,160,60,.22); border-color: rgba(240,190,90,.6); animation: dc-pulse 2s ease-in-out infinite; }
.titlebar .dayclose.soon.last { background: rgba(190,70,60,.3); border-color: rgba(240,120,110,.7); animation-duration: 1s; }
.dc-clock { width: 20px; height: 20px; flex: none; }
.dc-clock .dc-face { fill: rgba(255,255,255,.1); stroke: #f0d58a; stroke-width: 1.6; }
.dc-clock .dc-hand { stroke: #fff; stroke-width: 1.7; stroke-linecap: round; transform-origin: 12px 12px; }
.dc-clock .dc-min { animation: dc-sweep 4s linear infinite; }
.dc-clock .dc-hour { animation: dc-sweep 48s linear infinite; }
.dc-clock .dc-pin { fill: #f0d58a; }
.dayclose.last .dc-clock .dc-face { stroke: #f2a09a; }
@keyframes dc-sweep { to { transform: rotate(360deg); } }
@keyframes dc-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(240,190,90,.0); } 50% { box-shadow: 0 0 0 4px rgba(240,190,90,.28); } }

/* End shift: the cash declaration popup */
.es-table { width: 100%; }
.es-table .es-grp td { background: var(--panel-2); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; padding: 4px 8px; }
.es-earlier { font-size: 12px; margin: 0 0 8px; padding: 6px 10px; background: var(--info-bg); border: 1px solid #b6c8db; border-radius: 3px; color: var(--info); }
.es-done { text-align: center; padding: 10px 0 2px; }
.es-done .es-big { font-size: 30px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.es-done .es-figs { display: flex; justify-content: center; gap: 28px; margin: 14px 0 8px; }
.es-done .es-figs div { display: flex; flex-direction: column; gap: 2px; }
.es-done .es-figs span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.es-done .es-figs b { font-size: 17px; font-variant-numeric: tabular-nums; }
.es-done .es-figs b.ok { color: var(--ok); }
.es-done .es-figs b.bad { color: var(--bad); }
.es-done .es-figs b.warn { color: var(--warn); }

/* Reports: Cash Declaration, and Cash declared under the Payment Modes matrix */
.cd-table tfoot td { font-weight: 600; }
.cd-table.cd-den td, .cd-table.cd-den th { white-space: nowrap; }
.cd-table tr.cd-amt td { font-weight: 400; font-size: 11.5px; }
.rp-matrix tr.rp-decl td { border-top: 2px solid var(--border-dk); background: var(--panel-2); }
.rp-matrix tr.rp-decl-user td { border-top: 1px dashed var(--border); font-weight: 400; background: var(--panel); cursor: pointer; }
.rp-matrix tr.rp-decl-user .rp-decl-name { padding-left: 16px; }
.cd-table tr.cd-super td { color: var(--muted); font-style: italic; }
/* Inventory > HSN Codes: the GST % cell of the HSN list / Fill GST rates (a % box, the schedule's rates to click) */
.hsn-table td.hm-gst { white-space: nowrap; text-align: right; }
.hsn-table td.hm-gst input { width: 64px; }
.hsn-table td.hm-gst input.hm-choose { border-color: var(--warn); background: var(--warn-bg); }
/* filled in from the schedule, but the schedule has other rates for some goods of the code: check it */
.hsn-table td.hm-gst input.hm-check { border-color: var(--warn); border-style: dashed; }
.hsn-table .hm-pct { margin-left: 2px; color: var(--muted); }
.hsn-table .hm-chips { display: block; margin-top: 3px; }
.hsn-table .hm-chip { font: inherit; font-size: 11px; line-height: 1; padding: 2px 6px; margin-left: 3px; border: 1px solid var(--border-dk); border-radius: 9px; background: var(--panel); color: var(--text); cursor: pointer; }
.hsn-table .hm-chip:hover:not(:disabled) { background: var(--row-sel); }
.hsn-table th input[data-hm-all] { margin: 0; }
/* the supplier quick-add's GST No + Fetch, and what the portal holds under it */
.ql-field.ql-gst { display: flex; flex-direction: column; gap: 3px; }
.ql-gst-info { font-size: 11.5px; min-height: 0; }
.ql-gst-info:empty { display: none; }
.hm-bulk { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin: 4px 0 8px; font-size: 12.5px; }
.hm-bulk .hm-chip { font: inherit; font-size: 12px; padding: 3px 9px; border: 1px solid var(--border-dk); border-radius: 10px; background: var(--panel); color: var(--text); cursor: pointer; }
.hm-bulk .hm-chip:hover { background: var(--row-sel); }
.hm-bulk input { width: 64px; }
.hsn-picked { max-height: 3.2em; overflow: hidden; }
/* a mode's cell: what was paid back in it (already taken off) / the system's cash at the count, small under the figure */
.rp-back { font-size: 10.5px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.rp-matrix th .rp-th-sub { font-size: 10px; font-weight: 400; color: var(--muted); }
/* Auto update beside Refresh on the money reports */
.page-title .rp-auto { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; margin-right: 4px; }
.page-title .rp-auto input { margin: 0; }

/* Price Lists: the chosen list's column, changed cells, the filter note, the Create / Save dialogs, the vouchers */
table.grid.pl-table th.pl-cur, table.grid.pl-table td.pl-cur { background: var(--row-sel); }
table.grid.pl-table td.pl-chg { box-shadow: inset 0 -3px 0 var(--warn); }
table.grid.pl-table td.pl-chg input { background: var(--warn-bg); border-color: #ddca9d; font-weight: 600; }
.pl-filternote { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--info-bg); font-size: 12.5px; }
.pl-main .head .pl-search { width: 200px; max-width: 32vw; padding: 3px 6px; margin-right: 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; }
table.grid.pl-table td.pl-more { cursor: pointer; text-align: left; }
/* Sales > Sales Discount: the discounts on the left, the chosen one's particulars and products */
.sdc-list .item .sdc-itxt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.sdc-list .item .sdc-itxt small { color: var(--muted); font-size: 10.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sdc-list .item.sdc-off .pl-iname { color: var(--muted); }
.sdc-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2); font-size: 12.5px; }
.sdc-form .sdc-f { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 11.5px; }
.sdc-form .sdc-f input, .sdc-form .sdc-f select { padding: 5px 7px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; color: var(--text); background: var(--field-bg, #fff); }
.sdc-form .sdc-name input { width: 220px; }
.sdc-form .sdc-num input { width: 110px; }
.sdc-form .sdc-or { color: var(--muted); padding-bottom: 6px; }
.sdc-form .sdc-active { display: inline-flex; align-items: center; gap: 5px; padding-bottom: 6px; cursor: pointer; }
.sdc-form-new { padding: 0; border: 0; background: none; }
.sdc-note { padding: 6px 12px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--info-bg); }
.pl-create { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 10px 12px; align-items: center; }
.pl-create input[type=text], .pl-create select, .pl-create input[type=number] { padding: 5px 7px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; }
.pl-create input[type=text] { width: 100%; box-sizing: border-box; }
.pl-create .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pl-preview { padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 2px; font-size: 12.5px; }
.pl-kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px 12px; font-size: 12.5px; }
.pl-kv b { color: var(--muted); font-weight: 600; }
.pl-vbar { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; font-size: 12.5px; }
.pl-vbar select { padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; }
table.grid.pl-vch tr.pick { cursor: pointer; }
table.grid.pl-vch tr.pick:hover td { background: var(--row-hover); }
.pl-vbadge { margin-left: 4px; font-size: 10px; padding: 0 5px; }
.pl-main .head .sub { margin-left: 8px; }

/* Sales Register: a bill's lines together, the bill-level cells on its first line */
table.grid.rp-register { width: max-content; min-width: 100%; }
table.grid.rp-register tr.sr-first td { border-top: 2px solid var(--border-dk); }
table.grid.rp-register tr.sr-more td { color: inherit; }
table.grid.rp-register tr[data-rp-v] { cursor: pointer; }
table.grid.rp-register tfoot td { font-weight: 600; }

/* Profit Margin: a grouping's two levels (the second indented under the first), a loss in red */
table.grid.mg-table { width: max-content; min-width: 100%; }
table.grid.mg-table tr.mg-l1 td:first-child { font-weight: 600; }
table.grid.mg-table tr.mg-l1.mg-has td { border-top: 2px solid var(--border-dk); font-weight: 600; }
table.grid.mg-table tr.mg-l2 td:first-child { padding-left: 26px; }
table.grid.mg-table tr[data-rp-v] { cursor: pointer; }
table.grid.mg-table tfoot td { font-weight: 600; }
table.grid.mg-table th small { display: block; font-weight: 400; color: var(--muted); font-size: 10px; }
.mg-neg { color: var(--bad); }
.mg-doubt { color: var(--warn); font-weight: 600; }
.mg-src { font-size: 11.5px; white-space: nowrap; }
.mg-srcs span { white-space: nowrap; }
/* Sales by Category: the filter rows - column, value, include / exclude */
.sc-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; background: var(--panel); border: 1px solid var(--border); border-top: 0; padding: 6px 9px; margin: -1px 0 10px; border-radius: 0 0 2px 2px; }
.sc-flabel { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.sc-frow { display: flex; align-items: center; gap: 4px; background: var(--content); border: 1px solid var(--border-dk); border-radius: 2px; padding: 3px 4px; }
.sc-frow.sc-fnew { border-style: dashed; }
.sc-frow select, .sc-frow input { padding: 3px 5px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; background: var(--field-bg); }
.sc-fval { width: 220px; }
.sc-fval input { width: 100%; box-sizing: border-box; }
.sc-frow select.sc-op-out { color: var(--bad); font-weight: 600; }
.sc-frow select.sc-op-in { color: var(--ok); font-weight: 600; }
.sc-fhelp { font-size: 11.5px; cursor: help; }
/* Reports > Sales > Incentive Report: the product filter's value box, a heading and a total per user, the Columns pick */
.sc-frow input.ir-fq { width: 180px; }
/* the report fits the screen: headings and the text columns wrap (the figures stay on one line) */
table.grid.mg-table.ir-table { width: 100%; }
table.grid.ir-table th { white-space: normal; }
table.grid.ir-table tbody tr:not(.ir-user):not(.ir-sub) td:not(.num) { white-space: normal; max-width: 240px; }
table.grid.ir-table tr.ir-user td { background: var(--panel-2); border-top: 2px solid var(--border-dk); }
table.grid.ir-table tr.ir-sub td { font-weight: 600; background: var(--row-alt); }
.ir-colall { display: block; padding: 4px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.ir-collist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; max-height: 50vh; overflow: auto; }
.ir-collist label { display: flex; align-items: center; gap: 6px; }
/* ☰ Columns on every report's table (the business owner): the button in the table's head, a column the
   report did not show before (muted until ticked), a total's label in front of a figure, none in print */
.panel > .head .rp-cols-btn { margin-left: 8px; flex: none; }
.ir-collist label.rpc-new { color: var(--muted); }
.rp-foot-lbl { font-weight: 600; margin-right: 4px; }
.rp-print .rp-cols-btn { display: none !important; }
.rp-f.mg-chk > span:last-child { display: flex; align-items: center; gap: 4px; font-size: 12.5px; padding: 4px 0; }

/* Thermal (80 mm roll) receipt: a 40-column text receipt, 72 mm wide. The
   type is JetBrains Mono (OFL, public/fonts - shipped with the app, so every
   counter PC prints the same): thick strokes that a thermal head prints dark,
   where the thin Courier New came out faint. Its characters are 0.6 em, so
   2.95 mm type puts 40 columns in 70.8 mm. Everything is semi-bold (600), the
   important lines extra-bold (800, <b>), the amount due bigger (.xl: 26
   columns at 4.3 mm); black on white, the rules are rows of = and -
   (thermalBillHtml in app.js). */
@font-face { font-family: "ERP Receipt Mono"; font-style: normal; font-weight: 600; font-display: block;
  src: url(../fonts/jetbrains-mono-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "ERP Receipt Mono"; font-style: normal; font-weight: 600; font-display: block;
  src: url(../fonts/jetbrains-mono-latin-ext-600-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "ERP Receipt Mono"; font-style: normal; font-weight: 800; font-display: block;
  src: url(../fonts/jetbrains-mono-latin-800-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "ERP Receipt Mono"; font-style: normal; font-weight: 800; font-display: block;
  src: url(../fonts/jetbrains-mono-latin-ext-800-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
#print-area .pt, .bpd-paper .pt { width: 72mm; margin: 0 auto; color: #000; font-family: "ERP Receipt Mono", "Lucida Console", "Courier New", monospace;
  font-size: 2.95mm; font-weight: 600; line-height: 1.3; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
#print-area .pt pre, .bpd-paper .pt pre { margin: 0; font: inherit; color: #000; white-space: pre; overflow: hidden; }
#print-area .pt b, .bpd-paper .pt b { font-weight: 800; }
#print-area .pt .xl, .bpd-paper .pt .xl { font-size: 4.3mm; font-weight: 800; line-height: 1.25; }
#print-area .pt .xl.nb, .bpd-paper .pt .xl.nb { font-weight: 600; }   /* a large field the owner set not bold */
.bpd-paper .pt .bpd-none { color: #888; font-style: italic; font-weight: 400; }
#print-area .pt-bc, .bpd-paper .pt-bc { padding: 1mm 0 0.5mm; text-align: center; }
#print-area .pt-bc svg, .bpd-paper .pt-bc svg { display: block; width: 54mm; height: 9mm; margin: 0 auto; }

/* ---- billing items table (Sales -> Invoices and the other bill screens):
   Item Name wraps in a box at the header's small text size and its column is
   dragged wider or narrower on the grip at the header's right edge (like an
   Excel column); the table is as wide as its columns and scrolls sideways
   inside its box. The box shows about five lines and scrolls on its own;
   the totals and the action buttons stay pinned under it. ---- */
table.grid.bill-table { table-layout: fixed; min-width: 100%; }
.col-grip { position: absolute; top: 0; right: 0; width: 8px; height: 100%; cursor: col-resize; touch-action: none; z-index: 3; }
.col-grip::after { content: ''; position: absolute; top: 22%; bottom: 22%; right: 2px; width: 2px; border-left: 1px solid var(--border-dk); border-right: 1px solid var(--border-dk); }
.col-grip:hover::after, .col-grip.on::after { top: 0; bottom: 0; border-color: var(--accent); background: var(--accent); }
table.grid.bill-table td.bill-name { white-space: normal; max-width: none; overflow: visible; }
table.grid.bill-table td.bill-name textarea {
  display: block; width: 100%; min-height: 24px; max-height: 120px; margin: 0; resize: none; overflow: hidden; overflow-y: auto;
  font: 500 10.5px/1.3 var(--ui); white-space: pre-wrap; overflow-wrap: anywhere; field-sizing: content;
  border: 1px solid transparent; background: transparent; padding: 4px 6px; border-radius: 2px; color: var(--text); }
table.grid.bill-table td.bill-name textarea:hover { border-color: var(--border); background: var(--content); }
table.grid.bill-table td.bill-name textarea:focus { outline: none; border-color: var(--accent-2); background: var(--field-bg); box-shadow: 0 0 0 2px rgba(77,111,149,.16); }
table.grid.bill-table td.bill-name textarea:disabled { color: var(--text); }
table.grid.bill-items tr.ret td.bill-name textarea { background: #fffbe0; }
table.grid.bill-items tr.bill-delivered td.bill-name textarea:disabled { background: transparent; border-color: transparent; }
/* The items box is a fixed five-line window (header + 5 rows + the totals
   row, plus the sideways scrollbar) that scrolls the rest inside, so the totals and the buttons under it
   keep their place as lines are added and the page itself need not scroll. */
.tablewrap.bill-wrap { height: 248px; overflow: auto; overscroll-behavior: contain; }
.tablewrap.bill-wrap > table.grid > tfoot td { position: sticky; bottom: 0; z-index: 1; }

/* Settings > Billing counter: one tick box per rule, its explanation under the label */
.set-ticks { display: flex; flex-direction: column; gap: 10px; }
.set-tick { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; cursor: pointer; max-width: 980px; }
.set-tick input { margin: 2px 0 0; width: 15px; height: 15px; flex: none; accent-color: var(--accent); }
.set-tick > span { display: flex; flex-direction: column; gap: 2px; }
/* a tick box among a panel's fields (Sale Rate limit: staff only increase) takes the whole row */
.set-grid > .set-tick { grid-column: 1 / -1; margin-top: 4px; }
.set-tick small { line-height: 1.45; }
/* a Sales Return: what it sets against the customer's udhaari */
.bill-head .bill-no-hint.bill-ret-adj { color: var(--ok); }
.bill-head .bill-no-hint.bill-ret-adj:empty { display: none; }
/* End shift signed staff out for the day: the card says so; Users & Access lets them in again */
.es-done .es-out { margin-top: 10px; text-align: left; }
.ax-shift { margin-top: 3px; font-size: 11.5px; color: var(--warn); white-space: nowrap; }
.ax-shift .btn { margin-left: 4px; }
/* Payment Modes by User: the Internal vouchers column (returns set against udhaari) sits apart from the money and the credit */
table.rp-matrix th.rp-internal, table.rp-matrix td.rp-internal { border-left: 2px solid var(--border-dk); }
/* Purchase entry tools: + / ✎ beside the supplier, ✎ beside a line's item, Import from Excel, Scan document and their review popup */
.pd-sup-row .ta-wrap { flex: 1 1 auto; min-width: 0; }
.pd-item-cell { display: flex; align-items: center; gap: 2px; }
.pd-item-cell input.pd-item { flex: 1 1 auto; min-width: 0; }
.pd-edit { flex: none; border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 13px; padding: 0 3px; line-height: 1; }
.pd-edit:hover { color: var(--accent); }
.panel > .head .btn.sm + .btn.sm { margin-left: 6px; }
.btn.pd-off { opacity: .7; }
.pdi-step { display: flex; align-items: center; gap: 8px; margin: 6px 0; font-size: 13px; flex-wrap: wrap; }
.pdi-msg { min-height: 20px; margin-top: 8px; font-size: 12.5px; }
.pdi-issues { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }
.pds-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.pds-pick label.btn { cursor: pointer; }
.pds-pick label.btn.disabled { opacity: .5; cursor: default; pointer-events: none; }
.pds-file { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12.5px; }
.pds-file:empty { display: none; }
.pds-file img { max-width: 120px; max-height: 120px; border: 1px solid var(--border); border-radius: 2px; object-fit: contain; background: #fff; }
.pds-pdf { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 70px; border: 1px solid var(--border-dk); border-radius: 2px; font-weight: 700; color: var(--bad); background: var(--panel-2); }
.modal.modal-pdr { width: min(1500px, 97vw); }
.pdr-head { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(240px, 1.4fr) repeat(3, minmax(90px, .6fr)); gap: 10px 16px; padding: 8px 10px; margin-bottom: 6px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 3px; font-size: 12.5px; }
.pdr-head label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 3px; }
.pdr-head label .badge { text-transform: none; letter-spacing: 0; margin-left: 4px; }
.pdr-head select { width: 100%; min-width: 0; padding: 4px 6px; }
.pdr-usehead { display: flex; align-items: center; gap: 6px; font-size: 12.5px; margin: 4px 0 8px; cursor: pointer; }
.pdr-notes { font-size: 12px; color: var(--warn); background: var(--warn-bg); border: 1px solid #ddca9d; border-radius: 3px; padding: 5px 10px; margin-bottom: 8px; }
.pdr-notes ul { margin: 3px 0 0; padding-left: 18px; }
.pdr-how { font-size: 12px; margin: 0 0 8px; }
.tablewrap.pdr-wrap { max-height: 52vh; overflow: auto; }
table.grid.pdr-table td { vertical-align: top; font-size: 12px; }
table.grid.pdr-table td.pdr-doc { min-width: 200px; max-width: 320px; white-space: normal; }
table.grid.pdr-table th.pdr-prod-th { min-width: 300px; }
/* the chip over the product box; the box and + New side by side */
.pdr-prod { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 6px; }
.pdr-prod > .badge { grid-column: 1 / -1; justify-self: start; }
.pdr-prod select { width: 100%; min-width: 0; padding: 3px 5px; font-size: 12px; }
table.grid.pdr-table tr.pdr-off td { color: var(--muted); }
table.grid.pdr-table tr.pdr-bad td { background: var(--bad-bg); }
.pdr-note { color: var(--warn); font-size: 11.5px; }
.pdr-sum { font-size: 12.5px; align-self: center; }


/* Reports > Registers: one row per voucher; a void / cancelled one is struck through and counts in no total */
table.grid.rg-table { width: max-content; min-width: 100%; }
table.grid.rg-table tbody tr[data-rg-id], table.grid.jc-table tbody tr[data-jc-id], table.grid.jc-status tbody tr[data-jc-st] { cursor: pointer; }
table.grid.rg-table td.rg-t { white-space: normal; min-width: 80px; max-width: 300px; }
table.grid tr.rg-void td { text-decoration: line-through; color: var(--muted); }
table.grid tr.rg-void td .badge { text-decoration: none; }
.rp-note.rg-desc { color: var(--muted); background: var(--panel); border-color: var(--border); }
/* Reports > Sales > Job Cards by User / Job Card Status: a count opens its cards */
table.grid.jc-table { width: max-content; min-width: 100%; }
table.grid.jc-table a.jc-drill { color: var(--accent); text-decoration: none; font-weight: 600; }
table.grid.jc-table a.jc-drill:hover { text-decoration: underline; }
table.grid.jc-status tr.jc-on td { background: var(--row-sel); }
table.grid.jc-table tfoot td { font-weight: 600; }

/* ---- Purchase Challan: the owner's approval, serial numbers, the lot popup's Qty ---- */
.sidebar .item .count.warn { color: var(--warn); background: var(--warn-bg); border-color: #ddca9d; font-weight: 600; }
.subtabs .st .count { font-size: 10.5px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 0 6px; margin-left: 4px; }
.subtabs .st .count.warn { color: var(--warn); background: var(--warn-bg); border-color: #ddca9d; font-weight: 600; }
.bill-btn.ok { color: var(--ok); }
.bill-btn.ok > :first-child { color: var(--ok); }
.perm-note.pd-refused { color: var(--bad); background: var(--bad-bg); border-color: #d8b5b1; }
.pd-sn { display: block; margin-top: 3px; padding: 1px 6px; font-size: 10.5px; font-family: var(--ui); color: var(--ok); background: var(--ok-bg); border: 1px solid #bcd3b3; border-radius: 3px; cursor: pointer; white-space: nowrap; }
.pd-sn.short { color: var(--bad); background: var(--bad-bg); border-color: #d8b5b1; font-weight: 600; }
.pd-sn:hover { filter: brightness(0.97); }
.modal.modal-serials { width: 520px; max-width: 96vw; }
.sn-wrap { max-height: 52vh; overflow: auto; }
table.grid.sn-table td { padding: 3px 6px; }
table.grid.sn-table input[type=text] { width: 100%; box-sizing: border-box; padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-family: var(--mono); font-size: 12.5px; }
table.grid.sn-table input.sn-bad { border-color: var(--bad); background: var(--bad-bg); }
table.grid.sn-table td.sn-why { color: var(--bad); font-size: 11.5px; }
table.grid.lp-table th.lp-qty-h, table.grid.lp-table td.lp-qty-c { background: #eef4ea; }
table.grid.lp-table tr.lp-new td.lp-qty-c { background: #e3eedc; }
.ca-sn { margin-top: 2px; font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: normal; word-break: break-word; }
/* ---- serial numbers on a bill: the line's badge, the pickers, the finders, the prints ---- */
.bill-name .bill-sn-wrap:empty { display: none; }
.bill-sn { margin-top: 2px; }
table.grid.sn-pick td { padding: 4px 6px; }
table.grid.sn-pick td:first-child { text-align: center; }
table.grid.sn-pick b.sn-no { font-family: var(--mono); font-size: 12.5px; }
.lp-box tr.pick.sn-on td { background: var(--ok-bg); }
.lp-box tr.pick.sn-on.lp-on td { background: var(--accent); }
.sn-typed { margin-top: 8px; padding: 7px 9px; border: 1px dashed var(--border-dk); border-radius: 2px; font-size: 12px; }
.sn-typed label { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sn-typed input { width: 190px; padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-family: var(--mono); font-size: 12.5px; }
.sn-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.sn-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 7px; font-family: var(--mono); font-size: 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 3px; }
.sn-chip button { border: 0; background: none; color: var(--bad); cursor: pointer; padding: 0 2px; font-size: 11px; }
.ta-sn { font-family: var(--mono); }
.ta-code.ta-sn { flex-basis: 140px; color: var(--text); }
.prl-sn { margin-left: 12px; width: 230px; font-weight: normal; }
.prl-sn input { width: 100%; box-sizing: border-box; padding: 3px 7px; font-size: 12px; }
.pi-items .pi-sn { margin-top: 1px; font-size: 0.85em; color: #333; word-break: break-word; }
.ca-actions { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.ca-doc .head .sub { white-space: normal; }

/* ---- Administration > Incentives, Payroll > Employee Ledger, Payment to employee ---- */
.ic-head { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(130px, 0.8fr) minmax(140px, 0.8fr) auto auto; gap: 10px 14px; align-items: end; padding: 10px 12px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.ic-head .od-field { margin: 0; }
.ic-head .ic-active > span:last-child { display: flex; align-items: center; gap: 6px; min-height: 30px; font-size: 12px; }
.ic-head-acts { display: flex; gap: 6px; align-items: center; }
.ic-period { grid-column: 1 / -1; font-size: 12px; }
.ic-bulk .muted { margin-left: auto; font-size: 11.5px; }
@media (max-width: 900px) { .ic-head { grid-template-columns: 1fr 1fr; } }
table.grid.ic-table td.pl-cur input { width: 100%; box-sizing: border-box; }
.el-body { padding: 10px 12px; }
.el-who { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.el-who .el-name { font-size: 15px; }
.el-who .btn { margin-left: 8px; }
.pl-list .item .count.el-neg { color: var(--bad); }
table.grid.el-table tfoot td { font-weight: 600; }
.pv-emps .tablewrap { max-height: 260px; overflow: auto; }
table.grid.pv-emp-table td, table.grid.pv-emp-table th { white-space: nowrap; }
table.grid.pv-emp-table th small { display: block; font-weight: 400; color: var(--muted); }
table.grid.pv-emp-table tr.pick { cursor: pointer; }
table.grid.pv-emp-table tr.pv-emp-on td { background: var(--row-sel); font-weight: 600; }
table.grid.pv-emp-table tr.pick:focus { outline: 2px solid var(--accent-2); outline-offset: -2px; }
table.grid.ic-table th small { display: block; font-weight: 400; font-size: 10px; color: var(--muted); }
/* a bill's customer: what they owe under the box (custDueHtml) */
.cust-due { margin-top: 3px; font-size: 12.5px; }
.cust-due.due b { color: var(--bad); font-size: 13.5px; }
.cust-due.ok b { color: var(--ok); }
.spinner.sm { width: 10px; height: 10px; border-width: 2px; }
.sdc-form .sdc-day input { width: 140px; }

/* ---- Payroll (the owner): employees, the month's pay run, payslips ---- */
table.grid.pr-emps th small, table.grid.pr-run th small { display: block; font-weight: 400; font-size: 10px; color: var(--muted); }
table.grid.pr-emps tr.pick { cursor: pointer; }
table.grid.pr-emps tr.pick:focus { outline: 2px solid var(--accent-2); outline-offset: -2px; }
table.grid.pr-emps tr.muted td { color: var(--muted); }
.panel .head .pr-inact { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 400; margin-right: 8px; }
.pr-form .pr-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--accent); margin: 14px 0 6px; padding-bottom: 3px; border-bottom: 1px solid var(--border); }
.pr-form .pr-sec:first-child { margin-top: 0; }
.pr-grid3 { grid-template-columns: 1fr 1fr 1fr; }
@media (max-width: 700px) { .pr-grid3 { grid-template-columns: 1fr; } }
.pr-form .pr-tick { display: flex; align-items: center; gap: 6px; min-height: 29px; font-size: 12.5px; }
.pr-form .pr-note { margin: 0 0 8px; font-size: 12px; }
.pr-form .pr-logins { flex-direction: row; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 10px; }
.pr-form .pr-hint { display: block; }
.pr-bar .pr-wdnote { font-size: 11.5px; align-self: flex-end; padding-bottom: 6px; }
.pr-bar .pr-status { align-self: flex-end; padding-bottom: 5px; font-size: 12px; }
.pr-bar input[type=number] { width: 80px; }
.pr-runs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 12px; }
.pr-runs .btn .badge { margin-left: 4px; }
.pr-paidnote { margin-bottom: 10px; }
table.grid.pr-run td { vertical-align: top; }
table.grid.pr-run td input[type=number] { width: 92px; box-sizing: border-box; padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; text-align: right; }
table.grid.pr-run td.pr-days input { width: 64px; }
table.grid.pr-run td.pr-amt small { display: block; margin-top: 2px; }
table.grid.pr-run td input.pr-lnote { display: block; width: 92px; margin: 3px 0 0 auto; box-sizing: border-box; padding: 2px 5px; border: 1px solid var(--border); border-radius: 2px; font-size: 11px; }
table.grid.pr-run td .pr-inc { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap; }
table.grid.pr-run td.pr-net { white-space: nowrap; }
table.grid.pr-run tfoot td { font-weight: 600; }
.pr-notes { margin-top: 10px; max-width: 720px; }
.pr-notes textarea { width: 100%; box-sizing: border-box; }
.pr-pay .form-grid { margin-top: 4px; }
/* Print all: a payslip a page */
#print-area .pr-slip + .pr-slip { break-before: page; page-break-before: always; }
#print-area .pr-slip .pi-items { margin-top: 6px; }
/* the Add products filter popup: Include / Exclude per row, Select all products, the products of another list */
.pl-layer { grid-template-columns: 190px 96px minmax(0, 1fr) 24px; }
.pl-layer select.sc-op-in { color: var(--ok); font-weight: 600; }
.pl-layer select.sc-op-out { color: var(--bad); font-weight: 600; }
.pf-all { margin: 0 0 8px; font-size: 12.5px; }
.pf-all label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.pl-res-head .pf-taken { margin-left: 18px; color: var(--warn); }
@media (max-width: 700px) { .pl-layer { grid-template-columns: 1fr 1fr; } .pl-layer input { grid-column: 1 / -1; } }
/* Incentives: the profit margin of a unit */
table.grid.ic-table td.ic-margin { white-space: nowrap; }
table.grid.ic-table td.ic-margin .ic-left { display: block; font-size: 10.5px; margin-top: 1px; }
/* Payroll > Attendance: a box a day */
.att-legend { font-size: 11.5px; margin: 0 0 8px; line-height: 1.9; }
.att-key { display: inline-block; width: 18px; text-align: center; font-weight: 700; border: 1px solid var(--border); border-radius: 2px; margin: 0 2px 0 8px; }
.att-key:first-child { margin-left: 0; }
table.grid.att-grid { table-layout: auto; }
table.grid.att-grid th.att-d, table.grid.att-grid td.att-c { width: 24px; min-width: 24px; max-width: 24px; padding: 4px 0; text-align: center; font-size: 11.5px; }
table.grid.att-grid th.att-d small { display: block; font-weight: 400; font-size: 9px; color: var(--muted); }
table.grid.att-grid th.att-d[data-att-col] { cursor: pointer; }
table.grid.att-grid th.att-d[data-att-col]:hover { background: var(--row-hover); }
table.grid.att-grid th.att-today { box-shadow: inset 0 -2px 0 var(--accent-2); }
table.grid.att-grid .att-sun { background: var(--neutral-bg); }
table.grid.att-grid th.att-fut { color: var(--muted); }
table.grid.att-grid td.att-c { cursor: pointer; font-weight: 700; user-select: none; border-left: 1px solid var(--border); }
table.grid.att-grid td.att-c:focus { outline: 2px solid var(--accent-2); outline-offset: -2px; }
table.grid.att-grid td.att-x { cursor: default; background: repeating-linear-gradient(135deg, transparent 0 4px, var(--panel-2) 4px 6px); }
.att-P, table.grid.att-grid td.att-P { color: var(--ok); background: var(--ok-bg); }
.att-A, table.grid.att-grid td.att-A { color: var(--bad); background: var(--bad-bg); }
.att-H, table.grid.att-grid td.att-H { color: var(--warn); background: var(--warn-bg); }
.att-L, table.grid.att-grid td.att-L { color: var(--info); background: var(--info-bg); }
table.grid.att-grid td.att-chg { box-shadow: inset 0 0 0 2px var(--accent-2); }
table.grid.att-grid td.att-name, table.grid.att-grid th.att-name { min-width: 150px; white-space: nowrap; position: sticky; left: 0; background: var(--content); z-index: 1; }
table.grid.att-grid th.att-name { background: inherit; }
table.grid.att-grid .att-t { min-width: 34px; font-size: 12px; }
table.grid.att-grid th.att-t small { display: block; font-weight: 400; font-size: 9.5px; color: var(--muted); }
table.grid.pr-run td.pr-days .pr-att { display: block; margin-top: 2px; font-size: 10.5px; white-space: normal; max-width: 150px; }
/* Payroll > Salary Payment */
table.grid.pr-sp td.pr-amt input { width: 92px; }
table.grid.pr-sp select { max-width: 112px; }
table.grid.pr-sp .pr-lnote { width: 92px; }
.pr-sp-tick { width: 26px; text-align: center; }
.pr-vouchers { white-space: nowrap; }
.pr-pay-sum { margin: 10px 0; width: 100%; }
/* the pay sheet: one A4 landscape page */
.pr-sheet { font-size: var(--f); }
.pr-sheet-sub { font-size: var(--f); margin: 4px 0 6px; }
.pr-sheet-t { width: 100%; border-collapse: collapse; font-size: var(--f); }
.pr-sheet-t th, .pr-sheet-t td { border: 1px solid #888; padding: var(--p) 5px; text-align: left; white-space: nowrap; line-height: 1.15; }
.pr-sheet-t th { background: #eee; font-weight: 700; }
.pr-sheet-t .r { text-align: right; }
.pr-sheet-t .c { text-align: center; }
.pr-sheet-t tfoot td { font-weight: 700; border-top: 2px solid #000; }
.pr-sheet-job { color: #555; font-size: .88em; }
.pr-sheet-sign { min-width: 80px; }
.pr-sheet-foot { margin: 14px 0 4px; }
.pr-slip-paid { margin-top: 10px; }
/* Payroll > Settings */
.pr-set-day { display: flex; align-items: flex-end; gap: 10px; }
.pr-set-day .od-field { width: 120px; }
.pr-set-day > .muted { padding-bottom: 7px; font-size: 12.5px; }
.pr-set-note { margin: 10px 0 0; font-size: 12px; }
.pr-set-example { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--neutral-bg); font-size: 12.5px; }
.pr-set-sum { margin-top: 4px; font-size: 13.5px; }
.pr-set-foot { display: flex; align-items: center; gap: 12px; margin: 12px 0 4px; font-size: 12px; }
.pr-salarynote { margin: 0 0 8px; font-size: 12px; }

/* ---- 2026-11-08: Sales > Customer Outstanding (follow-ups), quotation terms, designer document picker ---- */
table.grid.jp-table tr[data-cid] { cursor: pointer; }
table.grid.co-fu-table td:nth-child(5) select { min-width: 170px; }
.co-note { color: var(--ink, #333); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; }
.co-form label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); }
.co-form select, .co-form input { font-size: 12.5px; padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); font-family: var(--ui); }
.co-form .co-form-note { flex: 1 1 220px; }
tr.co-bill { cursor: pointer; }
tr.co-credit td { color: var(--muted); }
.modal.modal-dt { width: 640px; max-width: 96vw; }
textarea.dt-text { width: 100%; box-sizing: border-box; font-family: 'Nirmala UI', 'Noto Sans Devanagari', 'Mangal', var(--ui); font-size: 13px; line-height: 1.5; padding: 6px 8px; border: 1px solid var(--border-dk); border-radius: 2px; resize: vertical; }
.dt-links { margin-top: 6px; font-size: 12px; }
.bpd-kind { align-self: center; display: inline-flex; align-items: center; gap: 6px; margin-left: 14px; padding: 0 4px 4px; font-size: 12px; color: var(--muted); }
.bpd-kind select { font-size: 12px; padding: 2px 6px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); font-family: var(--ui); }
.cl-noprint { align-self: center; font-size: 11.5px; margin-left: 8px; }

/* ---- Organization > Window Access (the owner's) ---- */
.wa-panel .head select { font-size: 12.5px; padding: 3px 6px; margin-left: 8px; max-width: 420px; border: 1px solid var(--border-dk); border-radius: 2px; background: var(--field-bg); font-family: var(--ui); }
.wa-panel .head .wa-q { width: 220px; font-size: 12px; padding: 3px 8px; border: 1px solid var(--border-dk); border-radius: 2px; }
.wa-info, .wa-foot { font-size: 11.5px; margin: 2px 0 8px; line-height: 1.45; }
.wa-foot { margin: 8px 0 0; }
.wa-wrap { max-height: 62vh; overflow: auto; }
.wa-table th { position: sticky; top: 0; z-index: 1; }
.wa-table td, .wa-table th { padding: 4px 8px; vertical-align: middle; }
.wa-table .c { text-align: center; }
.wa-table tr.wa-menu th { position: static; text-align: left; background: var(--panel-head, #e8edf5); font-weight: 600; }
.wa-table tr.wa-menu label { display: inline-flex; align-items: center; gap: 6px; margin-right: 10px; }
.wa-table tr.wa-dis td { color: var(--muted); }
.wa-table tr.wa-hid .wa-lbl { color: var(--muted); text-decoration: line-through; }
.wa-table tr.wa-set td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.wa-table .wa-no { font-size: 11px; }
.wa-table select { font-size: 12px; padding: 1px 4px; }
.wa-days { width: 84px; font-size: 12px; padding: 2px 6px; text-align: right; }
.wa-actions { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--border); }
.wa-actions .spacer { flex: 1; }
.wa-table tr.wa-menu th { top: auto; }
.wa-note { margin: 0 0 10px; }

/* ------------------------------------------------------------------ GST tab (public/js/gst.js) */
.spinner.sm { width: 11px; height: 11px; border-width: 2px; }
.gst-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 12px; margin-bottom: 12px; background: var(--content); border: 1px solid var(--border-dk); border-left: 3px solid var(--accent); border-radius: 2px; }
.gst-biz { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gst-gstin { font-family: var(--mono); font-weight: 600; letter-spacing: .5px; padding: 1px 6px; background: var(--info-bg); border: 1px solid #b9cbe0; border-radius: 3px; }
.gst-gstin.bad { background: var(--bad-bg); border-color: #d8b5b1; color: var(--bad); }
.gst-conn { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 280px; }
.gst-dot { width: 9px; height: 9px; border-radius: 50%; background: #b8b6ae; display: inline-block; }
.gst-dot.on { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.gst-in { padding: 4px 7px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; width: 190px; }
.gst-in.otp { width: 110px; font-family: var(--mono); letter-spacing: 2px; }
.gst-in.sm { width: 130px; padding: 2px 5px; font-size: 11.5px; }
.gst-barr { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.gst-barr .gst-calls { background: transparent; border-color: transparent; color: var(--muted, #666); text-decoration: underline dotted; }
.gst-barr .gst-calls:hover { border-color: var(--line, #ccc); color: inherit; }
.gst-us-kpis { margin: 8px 0; }
.gst-warnline { flex-basis: 100%; font-size: 12px; color: var(--warn); }
.gst-warnline.info { color: var(--info); }
.gst-f { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.gst-f select, .gst-f input { padding: 4px 6px; border: 1px solid var(--border-dk); border-radius: 2px; font-size: 12.5px; color: var(--text); }
.gst-quick { display: inline-flex; gap: 4px; }
.gst-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.gst-card { border: 1px solid var(--border); border-radius: 3px; padding: 9px 11px; background: #fbfbf9; display: flex; flex-direction: column; gap: 6px; }
.gst-card-h { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.gst-card-t { font-size: 12px; flex: 1; }
.gst-card-f { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 11.5px; }
.gst-card-f .btn { white-space: nowrap; flex: none; }
.gst-tw { max-height: 62vh; margin-bottom: 8px; }
.gst-tw table.grid tbody tr { cursor: default; }
.gst-tw table.grid td.wrap { white-space: normal; min-width: 240px; max-width: 420px; }
.gst-tw table.grid th.num { text-align: right; }
.gst-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; border-bottom: 1px solid var(--border-dk); }
.gst-tab { border: 1px solid var(--border); border-bottom: none; background: var(--panel-2); padding: 5px 12px; font-size: 12.5px; cursor: pointer; border-radius: 3px 3px 0 0; color: var(--text); font-family: var(--ui); }
.gst-tab.on { background: var(--content); border-color: var(--border-dk); font-weight: 600; position: relative; top: 1px; }
.gst-tab .count { font-size: 10.5px; color: var(--muted); margin-left: 4px; }
.gst-issues { display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow: auto; }
.gst-issue { font-size: 12.5px; padding: 3px 0; border-bottom: 1px dashed #e4e2da; }
.gst-ok { color: var(--ok); font-size: 12.5px; }
.gst-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
table.grid.gst-3b td { white-space: nowrap; }
table.grid.gst-3b tr.gst-sec td { background: var(--panel-2); font-weight: 600; }
.gst-num { width: 110px; padding: 2px 5px; text-align: right; font-variant-numeric: tabular-nums; border: 1px solid var(--border); border-radius: 2px; font-size: 12px; }
/* Upload Return > Details to be uploaded > B2B: the editable rows */
table.grid.gst-b2b-ed td, table.grid.gst-b2b-ed th { white-space: nowrap; vertical-align: middle; padding: 3px 5px; }
table.grid.gst-b2b-ed select { font-size: 12px; padding: 1px 2px; max-width: 128px; border: 1px solid var(--border); border-radius: 2px; background: #fff; }
table.grid.gst-b2b-ed td.gst-wrap { white-space: normal; min-width: 110px; }
table.grid.gst-b2b-ed .gst-num { width: 84px; }
table.grid.gst-b2b-ed .gst-gstin { width: 122px; padding: 2px 5px; font-family: var(--mono); font-size: 11.5px; text-transform: uppercase; border: 1px solid var(--border); border-radius: 2px; }
table.grid.gst-b2b-ed tr.gst-ed td { background: var(--warn-bg); }
table.grid.gst-b2b-ed .gst-bad { border-color: var(--bad); background: var(--bad-bg); }
table.grid.gst-b2b-ed tfoot tr.gst-ed-books td { color: var(--muted); font-weight: normal; }
.gst-ed-bar { margin: 4px 0 6px; }
.gst-u2-notes:empty { display: none; }
.gst-u2-notes { margin-top: 6px; }
.gst-u2-also { font-size: 12px; margin-top: 6px; }
.gst-tw table.grid tr.gst-cn td.num { color: var(--bad); }   /* a credit note: its amounts come off */
/* GST > Overview */
.gst-ovd-two { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .gst-ovd-two { grid-template-columns: minmax(0, 1fr); } }
.gst-ovd-two h4 { margin: 2px 0 6px; }
.gst-tw table.grid tbody tr.gst-click { cursor: pointer; }
.gst-tw table.grid tbody tr.gst-click:hover td { background: var(--panel-2); }
.gst-tw table.grid tr.gst-ovd-books td { color: var(--muted); font-style: italic; }
table.grid.gst-kv td { white-space: normal; }
table.grid.gst-kv td:first-child { width: 170px; }
ul.gst-docs { margin: 4px 0 8px 18px; padding: 0; font-size: 12.5px; }
/* Details to be uploaded: the name box with Fetch, the B2C / HSN rows, the e-invoice preview */
.gst-namebox { display: inline-flex; align-items: center; gap: 3px; }
table.grid.gst-b2b-ed .btn.gst-fetch { padding: 1px 6px; font-size: 11.5px; white-space: nowrap; }
table.grid.gst-b2b-ed .gst-was { font-size: 11px; white-space: normal; }
table.grid.gst-b2b-ed input.gst-hsn { width: 78px; padding: 2px 5px; border: 1px solid var(--border); border-radius: 2px; font-size: 12px; font-family: var(--mono); }
table.grid.gst-b2b-ed input.gst-qty { width: 70px; }
table.grid.gst-b2b-ed input.gst-tax { width: 80px; }
table.grid.gst-b2b-ed input.gst-nohsn { border-color: var(--bad); }
table.grid.gst-b2b-ed input.gst-nohsn::placeholder { color: var(--bad); }
table.grid.gst-b2b-ed tr.gst-removed input, table.grid.gst-b2b-ed tr.gst-removed select { text-decoration: line-through; background: transparent; }
.gst-hs-note { margin: 0 0 6px; font-size: 12px; }
.gst-issue .gst-ig-btn { margin-left: 8px; padding: 0 8px; font-size: 11.5px; vertical-align: baseline; }
.gst-issue.ignored { color: var(--muted); }
.gst-issue.ignored .gst-ig-text { text-decoration: line-through; text-decoration-color: rgba(0, 0, 0, 0.25); }
.gst-issue .gst-ig-by { font-size: 11.5px; margin: 2px 0 0 4px; }
.gst-issue .gst-ig-by .btn { margin-left: 6px; padding: 0 7px; font-size: 11px; }
.gst-ig-hist { margin-top: 4px; }
.gst-ig-what { font-weight: 600; }
table.grid.gst-b2b-ed td.gst-hsncell { white-space: normal; max-width: 110px; font-size: 11.5px; }
/* Documents issued (table 13): a row per kind, then its series */
table.grid.gst-doc-ed tr.gst-doc-type td { background: var(--panel-2); font-size: 12.5px; }
table.grid.gst-doc-ed input.gst-doc-no { width: 130px; text-align: left; }
table.grid.gst-doc-ed input.gst-doc-n { width: 80px; }
.gst-hs-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 4px; }
.gst-hs-head h4 { margin: 0; }
.gst-einv-opts { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.gst-einv-tbl table.grid td:last-child { white-space: normal; min-width: 260px; }
.gst-einv-tbl .badge { white-space: normal; display: inline-block; max-width: 440px; line-height: 1.35; text-align: left; }
/* B2C (others): a books row removed (struck through, ↺ brings it back) */
table.grid.gst-b2b-ed tr.gst-removed td { color: var(--muted); background: var(--panel-2); }
table.grid.gst-b2b-ed tr.gst-removed td:not(.gst-rowbtns) { text-decoration: line-through; }
table.grid.gst-b2b-ed td.gst-rowbtns { white-space: nowrap; }
table.grid.gst-b2b-ed td.gst-rowbtns .btn + .btn, table.grid.gst-b2b-ed td.gst-rowbtns .badge + .btn { margin-left: 3px; }
/* Nil rated (table 8) as on the portal */
.gst-nil table.grid th.num { white-space: normal; min-width: 150px; }
table.grid.gst-b2b-ed input.gst-nil-num { width: 130px; }
/* Details to be uploaded > B2B: rows added by hand (not in the books) */
table.grid.gst-b2b-ed tr.gst-new td { background: var(--ok-bg, #e8f2e4); }
table.grid.gst-b2b-ed tr.gst-prob td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
table.grid.gst-b2b-ed input.gst-party { width: 118px; padding: 2px 5px; border: 1px solid var(--border); border-radius: 2px; font-size: 12px; }
table.grid.gst-b2b-ed input.gst-inum { width: 96px; padding: 2px 5px; border: 1px solid var(--border); border-radius: 2px; font-size: 12px; }
table.grid.gst-b2b-ed input.gst-date { width: 114px; padding: 1px 3px; border: 1px solid var(--border); border-radius: 2px; font-size: 12px; }
.gst-cmp-row { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 8px; font-size: 11.5px; }
.gst-json { width: 100%; min-height: 320px; font-family: var(--mono); font-size: 11.5px; border: 1px solid var(--border-dk); padding: 8px; box-sizing: border-box; }
.gst-pre { max-height: 50vh; overflow: auto; font-size: 11.5px; background: var(--panel); padding: 8px; }
.gst-steps { display: flex; flex-direction: column; gap: 12px; }
.gst-step { padding-bottom: 12px; border-bottom: 1px dashed #e0ded6; }
.gst-step:last-child { padding-bottom: 0; border-bottom: none; }
.gst-step-err { margin-top: 8px; }
.gst-step { display: flex; gap: 10px; align-items: flex-start; }
.gst-step-n { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 600; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.gst-step-b { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; flex: 1; }
.set-tick-inline { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; }
table.grid.gst-status td.gst-cell { font-size: 12px; }
.gst-cell.ok { color: var(--ok); }
.gst-cell.bad { color: var(--bad); font-weight: 600; }
.gst-cell.warn { color: var(--warn); }
.gst-cell.muted { color: var(--muted); }
table.grid.gst-vend td.gst-mini { text-align: center; font-size: 11px; color: var(--ok); padding: 4px 3px; min-width: 30px; }
table.grid.gst-vend td.gst-mini.bad { background: var(--bad-bg); color: var(--bad); }
.gst-kpi { cursor: pointer; }
.gst-kpi.on { outline: 2px solid var(--accent-2); }
.gst-cmp { white-space: nowrap; }

/* ------------------------------------------------------------------ TDS tab (public/js/tds.js) */
.tds-files { margin-top: 8px; font-size: 12px; line-height: 1.9; }
.tds-file { white-space: nowrap; }
.tds-form .od-field small label { color: var(--text); }

/* a Yes / No question (askYesNo): a small dialog */
.modal-bg.yn-ask .modal { max-width: 460px; }
.modal-bg.yn-ask .m-body p { margin: 0 0 8px; }
ul.dc-what { margin: 4px 0 0 18px; padding: 0; font-size: 13px; }
ul.dc-what li { margin: 3px 0; }

/* Window Access per action: a tick with its days box */
.wa-table .wa-act { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.wa-table .wa-act .wa-days { width: 52px; }
.wa-table th small { font-weight: normal; }

/* Window Access: every tick left-aligned (the user, 2026-11-17) */
.wa-table .c, .wa-table th.c, .wa-table td.c { text-align: left; }

/* the screen guard (Settings > Security; staff): the faint login watermark and the cover while the software is not in front */
#guard-wm { position: fixed; inset: 0; z-index: 2147483000; pointer-events: none; background-repeat: repeat; }
#guard-cover { position: fixed; inset: 0; z-index: 2147483600; background: #f4f5f7; display: flex; align-items: center; justify-content: center; cursor: pointer; }
#guard-cover[hidden] { display: none; }
#guard-cover > div { text-align: center; color: var(--muted); font-size: 15px; }
#guard-cover b { display: block; color: var(--text, #1f2933); font-size: 17px; margin-bottom: 4px; }
@media print { #guard-wm, #guard-cover { display: none !important; } }
body.printing #guard-wm, body.printing #guard-cover { display: none !important; }

/* Audit History: Purchase Audit, Payment Audit, Error List */
table.grid small.pa-sub { display: block; font-size: 10.5px; line-height: 1.25; }
table.grid.pa-table tr[data-pa-doc], table.grid.py-table tr[data-py-kind] { cursor: pointer; }
table.grid.er-table tr.er-grp th { text-align: left; background: var(--panel-2); position: static; }
table.grid.er-table tr.er-check { cursor: pointer; }
table.grid.er-table tr.er-check.er-ok { cursor: default; }
table.grid.er-table tr.er-check.er-ok td { color: var(--muted); }
table.grid.er-table small.er-help { display: block; font-size: 11px; line-height: 1.3; }
table.grid.er-table tr.er-rows > td { background: var(--content); padding: 4px 8px 10px; }
.sec-note { margin-top: 8px; font-size: 12px; }
.ax-inuse { color: var(--ok, #1b7f3b); }
