:root {
  --green: #0f9278;
  --green-dark: #08745f;
  --bg: #f4f5f7;
  --text: #101827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --red: #c1121f;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Segoe UI, Arial, sans-serif;
}
a { color: inherit; text-decoration: none; }

.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: 230px;
  padding: 22px 18px;
  background: var(--green);
  color: white;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 28px; }
.brand h1 { font-size: 18px; margin: 0; }
.brand p { font-size: 12px; margin: 4px 0 0; opacity: .85; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.18);
  font-weight: 800;
}
.brand-mark.large {
  width: 66px;
  height: 66px;
  margin: 0 auto 10px;
  background: var(--green);
  color: white;
}
.side-section {
  margin: 24px 0 10px;
  font-size: 12px;
  letter-spacing: 2px;
  opacity: .8;
}
.sidebar a {
  display: block;
  padding: 12px 10px;
  border-radius: 10px;
  font-weight: 700;
}
.sidebar a:hover { background: rgba(255,255,255,.16); }

.main {
  margin-left: 230px;
  padding: 24px 26px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
}
.topbar h2 { margin: 0; font-size: 24px; }
.topbar p { margin: 4px 0 0; color: var(--muted); }
.top-pills { display: flex; gap: 10px; }
.top-pills span {
  background: #e9eaee;
  color: #374151;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 16px;
}
.metric, .module-card, .panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.metric { min-height: 118px; padding: 20px; text-align: center; }
.metric span { color: var(--muted); display: block; margin-bottom: 8px; }
.metric strong { font-size: 32px; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin: 18px 0;
}
.module-card { padding: 20px; min-height: 105px; }
.module-card b { display: block; margin-bottom: 8px; }
.module-card span { color: var(--muted); }
.module-card:hover { border-color: var(--green); transform: translateY(-1px); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { padding: 18px; margin-bottom: 16px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.search { display: flex; gap: 8px; flex: 1; }
input, select, textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  background: white;
}
textarea { min-height: 80px; }
button, .button, .small-btn {
  border: 0;
  border-radius: 10px;
  padding: 11px 14px;
  background: var(--green);
  color: white;
  font-weight: 800;
  cursor: pointer;
}
.small-btn { padding: 7px 10px; font-size: 13px; }
button:hover, .button:hover { background: var(--green-dark); }

.table-wrap { overflow: auto; background: white; border-radius: 14px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; }
th { background: #f9fafb; color: #374151; }
.empty { padding: 24px; color: var(--muted); text-align: center; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 14px;
}
.form-grid label { font-weight: 700; color: #374151; }
.form-grid input, .form-grid select, .form-grid textarea { margin-top: 6px; }
.wide { grid-column: 1 / -1; }
.invoice-lines { display: grid; gap: 10px; }
.line { display: grid; grid-template-columns: 1fr 110px 130px; gap: 10px; }
.invoice-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #111827; margin-bottom: 18px; }
.invoice-head h1, .invoice-head h2 { margin-top: 0; }
.totals { margin-left: auto; max-width: 320px; font-size: 18px; }

.flash {
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 12px;
  background: #e0f2fe;
}
.flash.error { background: #fee2e2; color: #991b1b; }
.flash.success { background: #dcfce7; color: #166534; }

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #eef2f7, #d9f3ed);
}
.login-card {
  width: min(420px, calc(100vw - 32px));
  background: white;
  border-radius: 22px;
  padding: 32px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .14);
}
.login-card h1, .login-card p { text-align: center; }
.login-card label { display: block; margin-top: 14px; font-weight: 700; }
.login-card button { width: 100%; margin-top: 18px; }

@media print {
  .sidebar, .topbar, .toolbar, button { display: none !important; }
  .main { margin: 0; padding: 0; }
  .panel { border: 0; box-shadow: none; }
}

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; }
  .main { margin-left: 0; }
  .metrics, .module-grid, .split, .form-grid { grid-template-columns: 1fr; }
  .line { grid-template-columns: 1fr; }
}



/* FINAL MAQBOOL TAX INVOICE V3 */
.invoice-actions { display: flex; gap: 10px; margin-bottom: 14px; }
.tax-invoice-sheet {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 30px;
  background: white;
  color: #061735;
  padding: 10mm;
  border: 1px solid #ccd5e3;
  box-shadow: 0 8px 30px rgba(15, 23, 42, .14);
  font-size: 12px;
}
.tax-head { display: grid; grid-template-columns: 27% 36% 37%; gap: 10px; align-items: start; }
.tax-logo img { width: 100%; height: 145px; object-fit: contain; object-position: center; }
.tax-company { text-align: center; padding-top: 8px; }
.tax-company h1 { margin: 0; color: #061735; font-size: 46px; letter-spacing: 2px; line-height: .95; }
.tax-company h2 { margin: 6px 0 0; color: #c60000; font-size: 22px; }
.tax-company h3 { margin: 5px 0 8px; color: #061735; font-size: 23px; }
.tagline { background: #061735; color: white; font-weight: 800; padding: 7px 10px; border-radius: 3px; font-size: 11px; }
.tax-meta { border: 1.5px solid #061735; border-radius: 8px; overflow: hidden; }
.tax-meta-title { background: linear-gradient(#d50000, #b90000); color: white; font-size: 24px; font-weight: 900; text-align: center; padding: 9px; }
.meta-row { display: grid; grid-template-columns: 44% 56%; gap: 8px; padding: 10px 14px; align-items: center; }
.meta-row span { border-bottom: 1px solid #7e8aa0; min-height: 18px; }
.tax-contact { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 18px; border-top: 1px solid #8c98aa; margin-top: 8px; padding: 12px 12px 8px; }
.tax-contact p { margin: 7px 0; font-size: 13px; }
.tax-contact-sep { background: #8c98aa; }
.tax-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px; }
.tax-box { border: 1.5px solid #061735; border-radius: 7px; padding: 12px; position: relative; }
.tax-box-title { display: inline-block; background: #061735; color: white; padding: 7px 18px; border-radius: 5px 14px 0 0; font-weight: 900; margin: -13px 0 8px -13px; min-width: 122px; }
.tax-box-title.vehicle { min-width: 220px; }
.tax-box-title.small { display: block; margin: -13px -13px 9px; border-radius: 6px 6px 0 0; padding: 8px 12px; }
.tax-box-title.status { margin-top: 10px; }
.tax-line { display: grid; grid-template-columns: 190px 1fr; gap: 8px; align-items: end; padding: 6px 0; }
.tax-line span, .vehicle-lines span { border-bottom: 1px solid #7e8aa0; min-height: 18px; }
.vehicle-lines { display: grid; grid-template-columns: 1fr 1fr; gap: 25px 18px; padding-top: 16px; }
.vehicle-lines div { display: grid; grid-template-columns: 85px 1fr; gap: 8px; }
.tax-items { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 10px; }
.tax-items th { background: #061735; color: white; border: 1px solid #9aa5b7; padding: 7px 4px; text-align: center; }
.tax-items th:first-child { background: #c60000; }
.tax-items td { border: 1px solid #c1c8d3; height: 28px; padding: 4px; text-align: center; }
.tax-items .left { text-align: left; }
.tax-bottom { display: grid; grid-template-columns: 31% 38% 31%; gap: 12px; margin-top: 10px; }
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 10px; }
.status-row { grid-template-columns: repeat(3, 1fr); }
.payment p { font-size: 10px; margin: 9px 0; }
.words-policy b { color: #c60000; }
.policy-box { border: 1.5px solid #061735; border-radius: 8px; padding: 10px; margin-top: 15px; }
.policy-box h4 { color: #c60000; margin: 0 0 8px; font-size: 14px; }
.policy-box ul { margin: 0 0 0 17px; padding: 0; font-size: 10px; line-height: 1.55; }
.tax-total-box { border: 1px solid #061735; border-radius: 6px; overflow: hidden; align-self: start; }
.tax-total-box div { display: grid; grid-template-columns: 58% 42%; border-bottom: 1px solid #8d98aa; min-height: 34px; }
.tax-total-box b { background: #061735; color: white; padding: 9px 10px; font-size: 11px; }
.tax-total-box span { padding: 9px 10px; text-align: right; font-weight: 800; }
.tax-total-box .grand b, .tax-total-box .grand span { background: #c60000; color: white; font-size: 13px; }
.tax-total-box .balance b, .tax-total-box .balance span { background: white; color: #c60000; }
.sales-signature { text-align: center; margin: 18px auto 8px; width: 280px; border-bottom: 1px solid #061735; padding-bottom: 12px; font-weight: 900; }
.brands-line { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; text-align: center; align-items: end; border-top: 1px solid #8d98aa; padding-top: 8px; font-weight: 900; font-size: 10px; }
.brands-line span:nth-child(3), .brands-line span:nth-child(9) { color: #c60000; }
.tax-footer { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 12px; background: #061735; color: white; margin: 8px -10mm -10mm; padding: 13px 16px; text-align: center; align-items: center; }
.tax-footer b { font-size: 15px; }
.tax-footer div:nth-child(2) b { color: #ff2020; font-size: 26px; font-style: italic; }

@media print {
  @page { size: A4; margin: 0; }
  body { background: white; }
  .invoice-actions, .sidebar, .topbar, .flash { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .tax-invoice-sheet { width: 210mm; min-height: 297mm; margin: 0; border: 0; box-shadow: none; }
}

/* Sidebar logo repair */
.sidebar-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  object-position: center;
  box-shadow: 0 1px 8px rgba(0,0,0,.18);
}
.brand-mark { display: none; }

/* Barcode labels */
small, .small-note {
  display: block;
  margin-top: 5px;
  color: #6b7280;
  font-size: 12px;
}
.barcode-screen {
  margin-bottom: 14px;
}
.barcode-info-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
  max-width: 460px;
}
.barcode-info-card h3 {
  margin-top: 0;
}
.barcode-print-area {
  display: inline-block;
  background: white;
  border: 1px dashed #cbd5e1;
  padding: 10px;
}
.compact-barcode-label {
  width: 52mm;
  height: 25mm;
  border: 1px solid #111827;
  padding: 2mm;
  background: white;
  color: #111827;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1mm;
  overflow: hidden;
  font-family: Arial, sans-serif;
}
.label-top {
  display: flex;
  justify-content: space-between;
  gap: 2mm;
  align-items: center;
  font-size: 8px;
  line-height: 1.1;
}
.label-top b {
  font-size: 9px;
  max-width: 33mm;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.label-top span {
  font-size: 8px;
  font-weight: 700;
}
.real-barcode {
  width: 100%;
  height: 11mm;
  display: block;
}
.barcode-number {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .5px;
  text-align: center;
  line-height: 1;
}
.label-bottom {
  display: flex;
  justify-content: space-between;
  gap: 2mm;
  font-size: 8px;
  line-height: 1.1;
}
.label-bottom b {
  font-size: 9px;
}
@media print {
  @page { size: 56mm 29mm; margin: 1.5mm; }
  body { background: white !important; }
  .sidebar, .topbar, .toolbar, .flash, .no-print { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .barcode-print-area { border: 0; padding: 0; display: block; }
  .compact-barcode-label { margin: 0; page-break-after: avoid; }
}



/* Compact financial report print */
.print-report {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px;
}
.report-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 2px solid #061735;
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.report-header h1 { margin: 0; font-size: 28px; }
.report-header p { margin: 4px 0 0; color: #6b7280; }
.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.report-summary-grid div {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 10px;
  background: #f9fafb;
}
.report-summary-grid span { display: block; color: #6b7280; font-size: 13px; }
.report-summary-grid b { font-size: 18px; }
.report-analysis {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
  margin-bottom: 12px;
}
.report-analysis > div {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
}
.report-analysis h3, .report-chart h3, .report-table-section h3 { margin: 0 0 8px; }
.report-analysis p, .report-analysis li { font-size: 13px; line-height: 1.4; }
.report-chart {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
}
.report-bar-line {
  display: grid;
  grid-template-columns: 95px 1fr;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
  font-size: 12px;
}
.report-bar-line div {
  position: relative;
  background: #e5e7eb;
  border-radius: 999px;
  min-height: 22px;
  overflow: hidden;
}
.report-bar-line i {
  display: block;
  height: 22px;
  background: #0f9278;
  border-radius: 999px;
}
.report-bar-line b {
  position: absolute;
  left: 10px;
  top: 3px;
  font-size: 12px;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.report-table th, .report-table td {
  border: 1px solid #d1d5db;
  padding: 6px;
  text-align: left;
}
.report-table th {
  background: #061735;
  color: white;
}

@media print {
  @page { size: A4; margin: 8mm; }
  body { background: white !important; }
  .sidebar, .topbar, .toolbar, .report-toolbar, .flash { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .print-report {
    border: 0;
    border-radius: 0;
    padding: 0;
    font-size: 11px;
  }
  .report-header h1 { font-size: 22px; }
  .report-summary-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
  .report-summary-grid div { padding: 6px; border-radius: 6px; }
  .report-summary-grid span { font-size: 10px; }
  .report-summary-grid b { font-size: 13px; }
  .report-analysis { gap: 8px; margin-bottom: 8px; }
  .report-analysis > div, .report-chart { padding: 7px; border-radius: 6px; }
  .report-analysis p, .report-analysis li { font-size: 10px; line-height: 1.25; margin: 3px 0; }
  .report-chart { margin-bottom: 8px; }
  .report-bar-line { grid-template-columns: 70px 1fr; margin: 3px 0; font-size: 10px; }
  .report-bar-line div, .report-bar-line i { min-height: 16px; height: 16px; }
  .report-bar-line b { top: 2px; font-size: 9px; }
  .report-table { font-size: 9px; }
  .report-table th, .report-table td { padding: 4px; }
}

/* Clear sidebar grouping */
.side-section {
  margin-top: 22px;
  color: rgba(255,255,255,.75);
}
.sidebar a {
  margin: 3px 0;
}

/* Invoice 3 final template */
.invoice-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.invoice3-sheet {
  position: relative;
  width: 210mm;
  height: 297mm;
  margin: 0 auto 24px;
  background: white;
  box-shadow: 0 8px 30px rgba(15, 23, 42, .16);
  overflow: hidden;
}
.invoice3-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  z-index: 1;
}
.inv3 {
  position: absolute;
  z-index: 2;
  color: #061735;
  font-family: Arial, sans-serif;
  font-size: 8.2px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inv-no { left: 79.5%; top: 7.2%; width: 17%; }
.inv-date { left: 79.5%; top: 9.62%; width: 17%; }
.inv-time { left: 79.5%; top: 12.08%; width: 17%; }
.inv-customer-code { left: 79.5%; top: 17.05%; width: 17%; }

.bill-name { left: 25%; top: 29.25%; width: 22%; font-size: 8.4px; }
.bill-address { left: 25%; top: 31.35%; width: 22%; font-size: 8.4px; }
.bill-phone { left: 25%; top: 36.85%; width: 22%; font-size: 8.4px; }
.bill-email { left: 25%; top: 38.95%; width: 22%; font-size: 8.4px; }
.bill-terms { left: 25%; top: 41.08%; width: 22%; font-size: 8.4px; }

.row { top: calc(46.15% + (var(--i) - 1) * 2.18%); height: 1.6%; text-align: center; font-size: 7.5px; }
.r1 { --i: 1; } .r2 { --i: 2; } .r3 { --i: 3; } .r4 { --i: 4; } .r5 { --i: 5; }
.r6 { --i: 6; } .r7 { --i: 7; } .r8 { --i: 8; } .r9 { --i: 9; } .r10 { --i: 10; }
.sr { left: 3.45%; width: 3%; }
.part { left: 7.2%; width: 8.8%; }
.oem { left: 17.2%; width: 9%; }
.desc { left: 27.5%; width: 17.2%; text-align: left; }
.brand { left: 46.2%; width: 7%; }
.origin { left: 54.4%; width: 6%; }
.qty { left: 62.2%; width: 4%; }
.unit { left: 67.25%; width: 5%; }
.price { left: 73.4%; width: 7%; }
.discount { left: 82.4%; width: 5%; }
.total { left: 89.5%; width: 7.5%; }

.total.subtotal { left: 88.8%; top: 68.55%; width: 8%; text-align: right; }
.total.discount-total { left: 88.8%; top: 70.85%; width: 8%; text-align: right; }
.total.taxable { left: 88.8%; top: 73.15%; width: 8%; text-align: right; }
.total.vat { left: 88.8%; top: 75.45%; width: 8%; text-align: right; }
.total.grand { left: 88.8%; top: 77.75%; width: 8%; text-align: right; color: white; font-weight: 800; font-size: 8.5px; }
.total.paid { left: 88.8%; top: 80.35%; width: 8%; text-align: right; }
.total.balance { left: 88.8%; top: 82.95%; width: 8%; text-align: right; color: #c60000; font-weight: 800; }

@media print {
  @page { size: A4; margin: 0; }
  body { background: white !important; }
  .sidebar, .topbar, .toolbar, .flash, .invoice-actions, .no-print { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .invoice3-sheet {
    width: 210mm;
    height: 297mm;
    margin: 0;
    box-shadow: none;
    page-break-after: avoid;
  }
}

/* Invoice 3 fine alignment override */
/* Values are moved into the blank writing lines, away from labels and colons. */
.invoice3-sheet .inv3 {
  font-size: 7.2px;
  line-height: 1;
  padding: 0;
  margin: 0;
}

/* Top right invoice box */
.invoice3-sheet .inv-no {
  left: 83.4%;
  top: 7.62%;
  width: 12.5%;
}
.invoice3-sheet .inv-date {
  left: 83.4%;
  top: 10.08%;
  width: 12.5%;
}
.invoice3-sheet .inv-time {
  left: 83.4%;
  top: 12.55%;
  width: 12.5%;
}
.invoice3-sheet .inv-due {
  left: 83.4%;
  top: 15.02%;
  width: 12.5%;
}
.invoice3-sheet .inv-salesperson {
  left: 83.4%;
  top: 17.52%;
  width: 12.5%;
}
.invoice3-sheet .inv-customer-code {
  left: 83.4%;
  top: 20.02%;
  width: 12.5%;
}

/* Bill-to box */
.invoice3-sheet .bill-name {
  left: 27.2%;
  top: 29.78%;
  width: 19.2%;
  font-size: 7.2px;
}
.invoice3-sheet .bill-address {
  left: 27.2%;
  top: 31.95%;
  width: 19.2%;
  font-size: 7.2px;
}
.invoice3-sheet .bill-trn {
  left: 27.2%;
  top: 35.45%;
  width: 19.2%;
  font-size: 7.2px;
}
.invoice3-sheet .bill-phone {
  left: 27.2%;
  top: 37.65%;
  width: 19.2%;
  font-size: 7.2px;
}
.invoice3-sheet .bill-email {
  left: 27.2%;
  top: 39.85%;
  width: 19.2%;
  font-size: 7.2px;
}
.invoice3-sheet .bill-terms {
  left: 27.2%;
  top: 42.05%;
  width: 19.2%;
  font-size: 7.2px;
}

/* Vehicle box values */
.invoice3-sheet .veh-plate {
  left: 62.6%;
  top: 31.15%;
  width: 10.5%;
}
.invoice3-sheet .veh-model {
  left: 84.0%;
  top: 31.15%;
  width: 11.5%;
}
.invoice3-sheet .veh-make {
  left: 62.6%;
  top: 35.65%;
  width: 10.5%;
}
.invoice3-sheet .veh-year {
  left: 84.0%;
  top: 35.65%;
  width: 11.5%;
}
.invoice3-sheet .veh-vin {
  left: 62.6%;
  top: 40.30%;
  width: 10.5%;
}
.invoice3-sheet .veh-mileage {
  left: 84.0%;
  top: 40.30%;
  width: 11.5%;
}

/* Item rows: lower text slightly to sit inside cells */
.invoice3-sheet .row {
  top: calc(47.22% + (var(--i) - 1) * 2.18%);
  font-size: 6.8px;
}

@media print {
  .invoice3-sheet .inv3 {
    font-size: 7.2px;
  }
  .invoice3-sheet .row {
    font-size: 6.8px;
  }
}


/* CODEx invoice3 final alignment v4 */
.invoice3-sheet .inv3 {
  line-height: 1 !important;
  padding: 0 !important;
  margin: 0 !important;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  transform: translateY(-1.2mm);
}

.invoice3-sheet .inv-no,
.invoice3-sheet .inv-date,
.invoice3-sheet .inv-time,
.invoice3-sheet .inv-due,
.invoice3-sheet .inv-salesperson,
.invoice3-sheet .inv-customer-code {
  left: 83.1% !important;
  width: 12.8% !important;
  font-size: 7px !important;
}
.invoice3-sheet .inv-no { top: 7.52% !important; }
.invoice3-sheet .inv-date { top: 9.98% !important; }
.invoice3-sheet .inv-time { top: 12.45% !important; }
.invoice3-sheet .inv-due { top: 14.92% !important; }
.invoice3-sheet .inv-salesperson { top: 17.42% !important; }
.invoice3-sheet .inv-customer-code { top: 19.92% !important; }

.invoice3-sheet .bill-name,
.invoice3-sheet .bill-address,
.invoice3-sheet .bill-trn,
.invoice3-sheet .bill-phone,
.invoice3-sheet .bill-email,
.invoice3-sheet .bill-terms {
  left: 27.0% !important;
  width: 20.0% !important;
  font-size: 7px !important;
}
.invoice3-sheet .bill-name { top: 29.58% !important; }
.invoice3-sheet .bill-address { top: 31.75% !important; }
.invoice3-sheet .bill-trn { top: 35.25% !important; }
.invoice3-sheet .bill-phone { top: 37.45% !important; }
.invoice3-sheet .bill-email { top: 39.65% !important; }
.invoice3-sheet .bill-terms { top: 41.85% !important; }

.invoice3-sheet .veh-plate,
.invoice3-sheet .veh-model,
.invoice3-sheet .veh-make,
.invoice3-sheet .veh-year,
.invoice3-sheet .veh-vin,
.invoice3-sheet .veh-mileage {
  font-size: 7px !important;
}
.invoice3-sheet .veh-plate { left: 62.5% !important; top: 30.95% !important; width: 10.8% !important; }
.invoice3-sheet .veh-model { left: 84.0% !important; top: 30.95% !important; width: 11.6% !important; }
.invoice3-sheet .veh-make { left: 62.5% !important; top: 35.45% !important; width: 10.8% !important; }
.invoice3-sheet .veh-year { left: 84.0% !important; top: 35.45% !important; width: 11.6% !important; }
.invoice3-sheet .veh-vin { left: 62.5% !important; top: 40.10% !important; width: 10.8% !important; }
.invoice3-sheet .veh-mileage { left: 84.0% !important; top: 40.10% !important; width: 11.6% !important; }

.invoice3-sheet .total {
  left: 88.7% !important;
  width: 8.2% !important;
  text-align: right !important;
  font-size: 7px !important;
}
.invoice3-sheet .total.subtotal { top: 68.32% !important; }
.invoice3-sheet .total.discount-total { top: 70.62% !important; }
.invoice3-sheet .total.taxable { top: 72.92% !important; }
.invoice3-sheet .total.vat { top: 75.22% !important; }
.invoice3-sheet .total.grand { top: 77.44% !important; color: #fff !important; font-weight: 800; }
.invoice3-sheet .total.paid { top: 79.82% !important; }
.invoice3-sheet .total.balance { top: 82.12% !important; color: #c60000 !important; font-weight: 800; }

.invoice3-sheet .row {
  transform: translateY(-0.9mm);
  font-size: 6.6px !important;
}


/* CODEx invoice3 line tune v5 */
/* Put typed values slightly above the printed underline and hide the line behind the letters. */
.invoice3-sheet .inv-no,
.invoice3-sheet .inv-date,
.invoice3-sheet .inv-time,
.invoice3-sheet .inv-due,
.invoice3-sheet .inv-salesperson,
.invoice3-sheet .inv-customer-code,
.invoice3-sheet .bill-name,
.invoice3-sheet .bill-address,
.invoice3-sheet .bill-trn,
.invoice3-sheet .bill-phone,
.invoice3-sheet .bill-email,
.invoice3-sheet .bill-terms,
.invoice3-sheet .veh-plate,
.invoice3-sheet .veh-model,
.invoice3-sheet .veh-make,
.invoice3-sheet .veh-year,
.invoice3-sheet .veh-vin,
.invoice3-sheet .veh-mileage {
  transform: translateY(-2.15mm) !important;
  line-height: 1.05 !important;
  padding: 0 1mm 0 .6mm !important;
  background: rgba(255, 255, 255, .96) !important;
  box-sizing: border-box !important;
  height: 3.2mm !important;
  display: flex !important;
  align-items: center !important;
  white-space: nowrap !important;
  overflow: hidden !important;
}

/* Small individual correction for the right invoice box. */
.invoice3-sheet .inv-no { top: 7.72% !important; }
.invoice3-sheet .inv-date { top: 10.18% !important; }
.invoice3-sheet .inv-time { top: 12.65% !important; }
.invoice3-sheet .inv-due { top: 15.12% !important; }
.invoice3-sheet .inv-salesperson { top: 17.62% !important; }
.invoice3-sheet .inv-customer-code { top: 20.12% !important; }

/* Customer box values. */
.invoice3-sheet .bill-name { top: 29.78% !important; }
.invoice3-sheet .bill-address { top: 31.95% !important; }
.invoice3-sheet .bill-trn { top: 35.45% !important; }
.invoice3-sheet .bill-phone { top: 37.65% !important; }
.invoice3-sheet .bill-email { top: 39.85% !important; }
.invoice3-sheet .bill-terms { top: 42.05% !important; }

/* Vehicle box values. */
.invoice3-sheet .veh-plate { top: 31.15% !important; }
.invoice3-sheet .veh-model { top: 31.15% !important; }
.invoice3-sheet .veh-make { top: 35.65% !important; }
.invoice3-sheet .veh-year { top: 35.65% !important; }
.invoice3-sheet .veh-vin { top: 40.30% !important; }
.invoice3-sheet .veh-mileage { top: 40.30% !important; }

/* Totals are inside boxes, not underlines, so keep them centered instead of high. */
.invoice3-sheet .total {
  transform: translateY(0.15mm) !important;
  line-height: 1 !important;
  height: 3.5mm !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  background: transparent !important;
  padding: 0 .6mm 0 0 !important;
}
.invoice3-sheet .total.subtotal { top: 68.52% !important; }
.invoice3-sheet .total.discount-total { top: 70.82% !important; }
.invoice3-sheet .total.taxable { top: 73.12% !important; }
.invoice3-sheet .total.vat { top: 75.42% !important; }
.invoice3-sheet .total.grand { top: 77.64% !important; }
.invoice3-sheet .total.paid { top: 80.02% !important; }
.invoice3-sheet .total.balance { top: 82.32% !important; }


/* CODEx invoice3 clean line tune v6 */
/* Keep template lines continuous. Make printed values darker and sit naturally on the line. */
.invoice3-sheet .inv-no,
.invoice3-sheet .inv-date,
.invoice3-sheet .inv-time,
.invoice3-sheet .inv-due,
.invoice3-sheet .inv-salesperson,
.invoice3-sheet .inv-customer-code,
.invoice3-sheet .bill-name,
.invoice3-sheet .bill-address,
.invoice3-sheet .bill-trn,
.invoice3-sheet .bill-phone,
.invoice3-sheet .bill-email,
.invoice3-sheet .bill-terms,
.invoice3-sheet .veh-plate,
.invoice3-sheet .veh-model,
.invoice3-sheet .veh-make,
.invoice3-sheet .veh-year,
.invoice3-sheet .veh-vin,
.invoice3-sheet .veh-mileage {
  background: transparent !important;
  color: #061735 !important;
  font-size: 7.4px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  height: 3.0mm !important;
  padding: 0 !important;
  display: block !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-shadow:
    0 0 .45px #fff,
    0 .25px .35px #fff,
    0 -.25px .35px #fff;
  transform: translateY(-1.55mm) !important;
}

.invoice3-sheet .inv-no { top: 7.62% !important; }
.invoice3-sheet .inv-date { top: 10.08% !important; }
.invoice3-sheet .inv-time { top: 12.55% !important; }
.invoice3-sheet .inv-due { top: 15.02% !important; }
.invoice3-sheet .inv-salesperson { top: 17.52% !important; }
.invoice3-sheet .inv-customer-code { top: 20.02% !important; }

.invoice3-sheet .bill-name { top: 29.68% !important; }
.invoice3-sheet .bill-address { top: 31.85% !important; }
.invoice3-sheet .bill-trn { top: 35.35% !important; }
.invoice3-sheet .bill-phone { top: 37.55% !important; }
.invoice3-sheet .bill-email { top: 39.75% !important; }
.invoice3-sheet .bill-terms { top: 41.95% !important; }

.invoice3-sheet .veh-plate { top: 31.05% !important; }
.invoice3-sheet .veh-model { top: 31.05% !important; }
.invoice3-sheet .veh-make { top: 35.55% !important; }
.invoice3-sheet .veh-year { top: 35.55% !important; }
.invoice3-sheet .veh-vin { top: 40.20% !important; }
.invoice3-sheet .veh-mileage { top: 40.20% !important; }

.invoice3-sheet .total {
  background: transparent !important;
  text-shadow: none !important;
  color: #061735 !important;
  font-size: 7.7px !important;
  font-weight: 800 !important;
  transform: translateY(0) !important;
  height: 3.4mm !important;
  line-height: 3.4mm !important;
  display: block !important;
  padding: 0 .7mm 0 0 !important;
  text-align: right !important;
}
.invoice3-sheet .total.grand {
  color: #fff !important;
  font-size: 8px !important;
}
.invoice3-sheet .total.balance {
  color: #c60000 !important;
  font-size: 8px !important;
}


/* CODEx invoice3 text size and line tune v7 */
/* Bigger readable values. These fields sit ABOVE the printed underline. */
.invoice3-sheet .inv-no,
.invoice3-sheet .inv-date,
.invoice3-sheet .inv-time,
.invoice3-sheet .inv-due,
.invoice3-sheet .inv-salesperson,
.invoice3-sheet .inv-customer-code,
.invoice3-sheet .bill-name,
.invoice3-sheet .bill-address,
.invoice3-sheet .bill-trn,
.invoice3-sheet .bill-phone,
.invoice3-sheet .bill-email,
.invoice3-sheet .bill-terms,
.invoice3-sheet .veh-plate,
.invoice3-sheet .veh-model,
.invoice3-sheet .veh-make,
.invoice3-sheet .veh-year,
.invoice3-sheet .veh-vin,
.invoice3-sheet .veh-mileage {
  background: transparent !important;
  color: #061735 !important;
  font-size: 8.6px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  height: 3.4mm !important;
  padding: 0 !important;
  margin: 0 !important;
  display: block !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  letter-spacing: 0 !important;
  text-shadow:
    -0.45px 0 #fff,
    0.45px 0 #fff,
    0 -0.45px #fff,
    0 0.45px #fff;
  transform: translateY(-2.45mm) !important;
}

/* Right invoice box: value text above each underline. */
.invoice3-sheet .inv-no { top: 7.78% !important; left: 83.1% !important; width: 12.9% !important; }
.invoice3-sheet .inv-date { top: 10.24% !important; left: 83.1% !important; width: 12.9% !important; }
.invoice3-sheet .inv-time { top: 12.71% !important; left: 83.1% !important; width: 12.9% !important; }
.invoice3-sheet .inv-due { top: 15.18% !important; left: 83.1% !important; width: 12.9% !important; }
.invoice3-sheet .inv-salesperson { top: 17.68% !important; left: 83.1% !important; width: 12.9% !important; }
.invoice3-sheet .inv-customer-code { top: 20.18% !important; left: 83.1% !important; width: 12.9% !important; }

/* Bill-to box: value text above each underline. */
.invoice3-sheet .bill-name { top: 29.88% !important; left: 27.0% !important; width: 20.0% !important; }
.invoice3-sheet .bill-address { top: 32.05% !important; left: 27.0% !important; width: 20.0% !important; }
.invoice3-sheet .bill-trn { top: 35.55% !important; left: 27.0% !important; width: 20.0% !important; }
.invoice3-sheet .bill-phone { top: 37.75% !important; left: 27.0% !important; width: 20.0% !important; }
.invoice3-sheet .bill-email { top: 39.95% !important; left: 27.0% !important; width: 20.0% !important; }
.invoice3-sheet .bill-terms { top: 42.15% !important; left: 27.0% !important; width: 20.0% !important; }

/* Vehicle box: value text above each underline. */
.invoice3-sheet .veh-plate { top: 31.25% !important; left: 62.5% !important; width: 10.8% !important; }
.invoice3-sheet .veh-model { top: 31.25% !important; left: 84.0% !important; width: 11.6% !important; }
.invoice3-sheet .veh-make { top: 35.75% !important; left: 62.5% !important; width: 10.8% !important; }
.invoice3-sheet .veh-year { top: 35.75% !important; left: 84.0% !important; width: 11.6% !important; }
.invoice3-sheet .veh-vin { top: 40.40% !important; left: 62.5% !important; width: 10.8% !important; }
.invoice3-sheet .veh-mileage { top: 40.40% !important; left: 84.0% !important; width: 11.6% !important; }

/* Item table values: move down into the row, away from the header/border, and make readable. */
.invoice3-sheet .row {
  font-size: 8.0px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  color: #061735 !important;
  transform: translateY(1.15mm) !important;
  text-shadow:
    -0.35px 0 #fff,
    0.35px 0 #fff,
    0 -0.35px #fff,
    0 0.35px #fff;
}

/* Totals: bigger and centered inside total boxes. */
.invoice3-sheet .total {
  background: transparent !important;
  text-shadow: none !important;
  color: #061735 !important;
  font-size: 8.6px !important;
  font-weight: 900 !important;
  transform: translateY(0.45mm) !important;
  height: 3.6mm !important;
  line-height: 3.6mm !important;
  display: block !important;
  padding: 0 .7mm 0 0 !important;
  text-align: right !important;
}
.invoice3-sheet .total.grand {
  color: #fff !important;
  font-size: 9.0px !important;
}
.invoice3-sheet .total.balance {
  color: #c60000 !important;
  font-size: 9.0px !important;
}


/* CODEx compact new invoice page */
.compact-invoice h3 {
  margin: 14px 0 8px;
}
.invoice-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}
.compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}
.compact-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.compact-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.compact-grid .wide {
  grid-column: 1 / -1;
}
.customer-preview,
.scan-row #scan-info {
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #dce3ec;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
}
.new-customer-box,
.optional-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #dce3ec;
  border-radius: 10px;
  background: #fbfcfe;
}
.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.inline-check input {
  width: auto;
}
.scan-row {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 1.4fr;
  gap: 10px;
  align-items: stretch;
}
.items-scroll {
  overflow-x: auto;
  margin-top: 10px;
}
.invoice-entry-table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  font-size: 12px;
}
.invoice-entry-table th {
  background: #061735;
  color: #fff;
  padding: 8px 5px;
  border: 1px solid #d3dbe6;
  text-align: center;
  white-space: nowrap;
}
.invoice-entry-table th:first-child {
  background: #c60000;
}
.invoice-entry-table td {
  border: 1px solid #d3dbe6;
  padding: 4px;
}
.invoice-entry-table input,
.invoice-entry-table select {
  width: 100%;
  border: 0;
  min-height: 30px;
  padding: 4px 5px;
  background: transparent;
  font-size: 12px;
}
.invoice-entry-table .qty-input,
.invoice-entry-table .price-input,
.invoice-entry-table .discount-input,
.invoice-entry-table .line-total {
  text-align: right;
}
@media (max-width: 900px) {
  .compact-grid,
  .compact-grid.three,
  .compact-grid.four,
  .scan-row {
    grid-template-columns: 1fr;
  }
}


/* CODEx ERP v1 structure styles */
.command-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.command-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  min-height: 122px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.command-card span,
.command-card small {
  color: var(--muted);
  display: block;
}
.command-card strong {
  display: block;
  font-size: 26px;
  margin: 8px 0;
}
.command-card.good { border-left: 6px solid #13a66b; }
.command-card.danger { border-left: 6px solid #d31324; }
.command-card.normal { border-left: 6px solid #2f7df6; }
.command-card.caution { border-left: 6px solid #f59e0b; }
.command-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
}
.progress-track {
  height: 18px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0f9278, #13a66b);
}
.advice-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.erp-section-grid .module-card small,
.erp-card small {
  display: inline-block;
  margin-top: 12px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #e9f5f1;
  color: #08745f;
  font-size: 12px;
  font-weight: 800;
}
.erp-card.planned small {
  background: #fff7ed;
  color: #c2410c;
}
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.tag-list span {
  background: #f1f5f9;
  border: 1px solid #dce3ec;
  border-radius: 999px;
  padding: 8px 10px;
  font-weight: 700;
}
.big-number {
  font-size: 34px;
  font-weight: 900;
}
@media (max-width: 1100px) {
  .command-grid { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
}
@media (max-width: 760px) {
  .command-grid,
  .advice-columns { grid-template-columns: 1fr; }
}


/* CODEx purchase toolbar organization */
.purchase-top {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 2.2fr;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}
.purchase-title h3 {
  margin: 0 0 6px;
}
.purchase-actions {
  display: grid;
  gap: 10px;
  justify-items: end;
}
.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.primary-actions {
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}
.utility-actions button {
  background: #eef2f7;
  color: #0f172a;
}
.utility-actions button:hover {
  background: #dfe7f1;
}
.danger-btn {
  background: #c1121f !important;
  color: #fff !important;
}
.danger-btn:hover {
  background: #9f101a !important;
}
@media (max-width: 1100px) {
  .purchase-top {
    grid-template-columns: 1fr;
  }
  .purchase-actions,
  .action-group {
    justify-items: start;
    justify-content: flex-start;
  }
}


/* CODEx purchase product table layout */
.purchase-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #d7dee8;
  border-radius: 10px;
  background: #fff;
  padding-bottom: 8px;
}
.purchase-entry-table {
  min-width: 2350px;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
}
.purchase-entry-table th,
.purchase-entry-table td {
  padding: 0;
  border: 1px solid #d7dee8;
  border-left: 0;
  border-top: 0;
  vertical-align: middle;
}
.purchase-entry-table th {
  height: 42px;
  padding: 8px 6px;
  font-size: 11px;
  line-height: 1.1;
  white-space: normal;
  text-align: center;
}
.purchase-entry-table td input,
.purchase-entry-table td select {
  min-height: 36px;
  height: 36px;
  border: 0;
  border-radius: 0;
  padding: 6px 8px;
  font-size: 13px;
  background: transparent;
}
.purchase-entry-table td input:focus {
  outline: 2px solid rgba(15,146,120,.25);
  background: #f8fffc;
}
.purchase-entry-table th:nth-child(1),
.purchase-entry-table td:nth-child(1) { width: 130px; }
.purchase-entry-table th:nth-child(2),
.purchase-entry-table td:nth-child(2) { width: 135px; }
.purchase-entry-table th:nth-child(3),
.purchase-entry-table td:nth-child(3) { width: 260px; }
.purchase-entry-table th:nth-child(4),
.purchase-entry-table td:nth-child(4) { width: 130px; }
.purchase-entry-table th:nth-child(5),
.purchase-entry-table td:nth-child(5) { width: 140px; }
.purchase-entry-table th:nth-child(6),
.purchase-entry-table td:nth-child(6) { width: 110px; }
.purchase-entry-table th:nth-child(7),
.purchase-entry-table td:nth-child(7),
.purchase-entry-table th:nth-child(8),
.purchase-entry-table td:nth-child(8),
.purchase-entry-table th:nth-child(9),
.purchase-entry-table td:nth-child(9) { width: 80px; }
.purchase-entry-table th:nth-child(10),
.purchase-entry-table td:nth-child(10),
.purchase-entry-table th:nth-child(11),
.purchase-entry-table td:nth-child(11),
.purchase-entry-table th:nth-child(12),
.purchase-entry-table td:nth-child(12),
.purchase-entry-table th:nth-child(13),
.purchase-entry-table td:nth-child(13) { width: 95px; }
.purchase-entry-table th:nth-child(14),
.purchase-entry-table td:nth-child(14),
.purchase-entry-table th:nth-child(15),
.purchase-entry-table td:nth-child(15),
.purchase-entry-table th:nth-child(16),
.purchase-entry-table td:nth-child(16),
.purchase-entry-table th:nth-child(17),
.purchase-entry-table td:nth-child(17),
.purchase-entry-table th:nth-child(18),
.purchase-entry-table td:nth-child(18),
.purchase-entry-table th:nth-child(19),
.purchase-entry-table td:nth-child(19) { width: 130px; }
.purchase-entry-table th:nth-child(20),
.purchase-entry-table td:nth-child(20) { width: 150px; }

/* Keep the important identity columns visible while scrolling. */
.purchase-entry-table th:nth-child(1),
.purchase-entry-table td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 3;
  background: #fff;
}
.purchase-entry-table th:nth-child(1) {
  background: #c60000;
  color: #fff;
  z-index: 5;
}
.purchase-entry-table th:nth-child(2),
.purchase-entry-table td:nth-child(2) {
  position: sticky;
  left: 130px;
  z-index: 3;
  background: #fff;
}
.purchase-entry-table th:nth-child(2) {
  background: #061735;
  color: #fff;
  z-index: 5;
}
.purchase-entry-table th:nth-child(3),
.purchase-entry-table td:nth-child(3) {
  position: sticky;
  left: 265px;
  z-index: 3;
  background: #fff;
}
.purchase-entry-table th:nth-child(3) {
  background: #061735;
  color: #fff;
  z-index: 5;
}
.purchase-entry-table .qty-input,
.purchase-entry-table .free-input,
.purchase-entry-table .cost-input,
.purchase-entry-table .discount-input,
.purchase-entry-table .vat-input,
.purchase-entry-table .line-total,
.purchase-entry-table .sell-input,
.purchase-entry-table .margin-input,
.purchase-entry-table .min-input,
.purchase-entry-table .current-input,
.purchase-entry-table .after-input,
.purchase-entry-table .last-cost-input {
  text-align: right;
}
.purchase-entry-table tbody tr:nth-child(even) td {
  background-color: #fbfdff;
}
.purchase-entry-table tbody tr:hover td {
  background-color: #f1f8f5;
}


/* CODEx purchase barcode visibility */
.purchase-scan-panel {
  display: grid;
  grid-template-columns: minmax(260px, 420px) 1fr;
  gap: 12px;
  align-items: end;
  background: #f8fafc;
  border: 1px solid #d7dee8;
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
}
.purchase-scan-panel input {
  min-height: 44px;
  font-size: 16px;
  font-weight: 800;
  border: 2px solid #0f9278;
  background: #fff;
}
#purchase-scan-info {
  min-height: 44px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #d7dee8;
  color: #0f172a;
}
.purchase-entry-table td:nth-child(1),
.purchase-entry-table td:nth-child(2),
.purchase-entry-table td:nth-child(3) {
  background: #fff !important;
  overflow: visible !important;
}
.purchase-entry-table .barcode-input,
.purchase-entry-table .part-input,
.purchase-entry-table .desc-input {
  display: block !important;
  width: 100% !important;
  height: 36px !important;
  min-width: 0 !important;
  opacity: 1 !important;
  visibility: visible !important;
  color: #061735 !important;
  background: #fff !important;
  border: 1px solid #d7dee8 !important;
  border-radius: 4px !important;
  padding: 6px 8px !important;
  position: relative !important;
  z-index: 10 !important;
}
.purchase-entry-table .barcode-input:focus {
  border-color: #0f9278 !important;
  outline: 2px solid rgba(15,146,120,.25) !important;
}
@media (max-width: 900px) {
  .purchase-scan-panel {
    grid-template-columns: 1fr;
  }
}

/* Purchase Invoices Center */
.pi-page { display: grid; gap: 16px; }
.pi-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 12px; }
.pi-cards { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 12px; }
.kpi-card { background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 14px; }
.kpi-card span { display: block; color: #64748b; margin-bottom: 8px; }
.kpi-card strong { font-size: 22px; color: #061735; }
.kpi-card.warn strong { color: #c60000; }
.pi-filter { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 8px; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 12px; }
.pi-filter input, .pi-filter select, .attachment-form input, .payment-form input, .comment-form input { min-height: 38px; border: 1px solid #d7dee8; border-radius: 8px; padding: 8px 10px; }
.pi-layout { display: grid; grid-template-columns: minmax(460px, 1.15fr) minmax(420px, .85fr); gap: 16px; align-items: start; }
.pi-list, .pi-detail { background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 14px; }
.table-scroll { width: 100%; overflow: auto; }
.erp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.erp-table th { background: #061735; color: #fff; padding: 10px 8px; text-align: left; white-space: nowrap; }
.erp-table td { border-bottom: 1px solid #e7edf3; padding: 9px 8px; vertical-align: top; }
.erp-table.compact th, .erp-table.compact td { padding: 7px 6px; font-size: 12px; }
.selected-row td { background: #e8f7f2; }
.mini-btn, .status-pill { display: inline-block; padding: 5px 9px; border-radius: 999px; background: #e8f7f2; color: #0f9278; font-weight: 800; text-decoration: none; white-space: nowrap; }
.danger-light { background: #ffecec !important; color: #c60000 !important; }
.invoice-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; border-bottom: 1px solid #e7edf3; padding-bottom: 12px; margin-bottom: 12px; }
.invoice-head h3 { margin: 0 0 6px; }
.invoice-head p { margin: 0; color: #64748b; }
.invoice-total { font-size: 24px; font-weight: 900; color: #061735; white-space: nowrap; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.detail-grid div { border: 1px solid #e7edf3; border-radius: 10px; padding: 10px; background: #f8fafc; }
.detail-grid span { display: block; color: #64748b; font-size: 12px; margin-bottom: 5px; }
.detail-grid strong { color: #061735; }
.pi-tabs { display: grid; gap: 14px; }
.pi-tabs section { border-top: 1px solid #e7edf3; padding-top: 12px; }
.attachment-form, .payment-form, .comment-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.payment-form { grid-template-columns: repeat(4, 1fr) auto; }
.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.attachment-list a { background: #eef3f8; border-radius: 999px; padding: 6px 10px; color: #061735; text-decoration: none; font-weight: 800; }
@media (max-width: 1150px) {
  .pi-layout { grid-template-columns: 1fr; }
  .pi-cards, .pi-filter { grid-template-columns: repeat(2, 1fr); }
  .payment-form, .attachment-form, .comment-form { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar, .no-print, .pi-list { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .pi-layout { display: block; }
  .pi-detail { border: 0; padding: 0; }
}

/* CODEx compact purchase action buttons */
.purchase-top {
  grid-template-columns: minmax(280px, 1fr) minmax(420px, 1.45fr) !important;
  align-items: center !important;
  gap: 18px !important;
  padding: 4px 0 10px !important;
}
.purchase-title {
  max-width: 520px !important;
}
.purchase-title h3 {
  font-size: 17px !important;
  margin-bottom: 4px !important;
}
.purchase-title .muted,
.purchase-title p {
  font-size: 13px !important;
  line-height: 1.35 !important;
}
.purchase-actions {
  width: 100% !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 8px !important;
  justify-items: end !important;
}
.action-group {
  width: 100% !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 7px !important;
  justify-content: flex-end !important;
}
.primary-actions {
  padding-bottom: 7px !important;
  border-bottom: 1px solid #e5e7eb !important;
}
.purchase-actions button,
.pi-toolbar .btn,
.pi-filter .btn {
  min-height: 36px !important;
  height: 36px !important;
  padding: 0 13px !important;
  border-radius: 9px !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: auto !important;
  box-shadow: none !important;
}
.primary-actions button {
  min-width: 92px !important;
}
.utility-actions button {
  min-width: 70px !important;
}
.utility-actions button:nth-child(5),
.utility-actions button:nth-child(6) {
  min-width: 118px !important;
}
.danger-btn {
  min-width: 76px !important;
}
.pi-toolbar {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 7px !important;
  align-items: center !important;
  justify-content: flex-start !important;
  padding: 10px 12px !important;
}
.pi-toolbar .btn {
  min-width: 72px !important;
  text-decoration: none !important;
}
.pi-toolbar .btn:first-child {
  min-width: 110px !important;
}
.pi-toolbar .btn:nth-last-child(2) {
  min-width: 88px !important;
}
.pi-toolbar .danger-light {
  min-width: 110px !important;
}
.pi-filter {
  align-items: end !important;
}
@media (max-width: 1100px) {
  .purchase-top {
    grid-template-columns: 1fr !important;
  }
  .purchase-actions,
  .action-group {
    justify-items: start !important;
    justify-content: flex-start !important;
  }
}
@media (max-width: 700px) {
  .purchase-actions button,
  .pi-toolbar .btn,
  .pi-filter .btn {
    width: calc(50% - 4px) !important;
    min-width: 0 !important;
  }
}

/* Purchase Orders Center */
.po-page { display: grid; gap: 16px; }
.po-toolbar { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 10px 12px; }
.po-toolbar .btn, .workflow .btn, .po-save-row .btn { min-height: 36px; height: 36px; padding: 0 13px; border-radius: 9px; font-size: 12px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.po-toolbar .strong, .workflow .strong, .po-save-row .strong { background: #061735 !important; color: #fff !important; }
.inline-form { display: inline-flex; margin: 0; }
.po-cards { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 12px; }
.po-filter { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 8px; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 12px; }
.po-filter input, .po-filter select, .po-form input, .po-form select { min-height: 38px; border: 1px solid #d7dee8; border-radius: 8px; padding: 8px 10px; }
.po-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.po-panel { background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 14px; }
.po-items-table { min-width: 1050px; }
.po-items-table input { width: 100%; border: 1px solid #d7dee8; border-radius: 6px; padding: 6px; }
.po-save-row { display: flex; justify-content: flex-end; padding-top: 12px; }
.workflow { display: flex; flex-wrap: wrap; gap: 7px; border-top: 1px solid #e7edf3; border-bottom: 1px solid #e7edf3; padding: 10px 0; margin: 10px 0; }
.po-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
@media (max-width: 1150px) {
  .po-layout, .po-detail-grid { grid-template-columns: 1fr; }
  .po-cards, .po-filter { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  .sidebar, .topbar, .no-print, .po-layout, .po-toolbar, .po-filter { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .po-panel { border: 0; padding: 0; }
}

/* Supplier Payments Center */
.sp-page { display: grid; gap: 16px; }
.sp-toolbar { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 10px 12px; }
.sp-toolbar .btn, .sp-save-row .btn { min-height: 36px; height: 36px; padding: 0 13px; border-radius: 9px; font-size: 12px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.sp-toolbar .strong, .sp-save-row .strong { background: #061735 !important; color: #fff !important; }
.sp-cards { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }
.sp-chart, .sp-panel { background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 14px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 120px; gap: 10px; align-items: center; margin: 8px 0; }
.bar-row div { height: 12px; background: #edf2f7; border-radius: 999px; overflow: hidden; }
.bar-row i { display: block; height: 100%; background: #0f9278; border-radius: 999px; }
.sp-filter { display: grid; grid-template-columns: repeat(8, minmax(110px, 1fr)); gap: 8px; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 12px; }
.sp-filter input, .sp-filter select, .sp-panel input, .sp-panel select { min-height: 38px; border: 1px solid #d7dee8; border-radius: 8px; padding: 8px 10px; }
.sp-layout { display: grid; grid-template-columns: minmax(430px, .9fr) minmax(520px, 1.1fr); gap: 16px; align-items: start; }
.sp-save-row { display: flex; justify-content: flex-end; padding-top: 12px; }
@media (max-width: 1200px) {
  .sp-layout { grid-template-columns: 1fr; }
  .sp-cards { grid-template-columns: repeat(2, 1fr); }
  .sp-filter { grid-template-columns: repeat(2, 1fr); }
  .bar-row { grid-template-columns: 110px 1fr 100px; }
}
@media print {
  .sidebar, .topbar, .no-print, .sp-toolbar, .sp-filter, .sp-layout, .sp-chart { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .sp-panel { border: 0; padding: 0; }
}

/* Supplier Statement Center */
.ss-page { display: grid; gap: 16px; }
.ss-toolbar { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 10px 12px; }
.ss-toolbar .btn, .ss-filter .btn { min-height: 36px; height: 36px; padding: 0 13px; border-radius: 9px; font-size: 12px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.ss-filter { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 10px; align-items: end; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 12px; }
.ss-filter label { font-weight: 800; }
.ss-filter input, .ss-filter select { width: 100%; min-height: 38px; border: 1px solid #d7dee8; border-radius: 8px; padding: 8px 10px; margin-top: 4px; }
.ss-info { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
.ss-card { background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 14px; }
.wide-detail { grid-column: 1 / -1; }
.ss-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ss-summary div { border: 1px solid #e7edf3; border-radius: 10px; padding: 10px; background: #f8fafc; }
.ss-summary span { display: block; color: #64748b; font-size: 12px; margin-bottom: 5px; }
.ss-summary strong { font-size: 19px; color: #061735; }
.ss-summary .warn strong { color: #c60000; }
.ss-chart { display: grid; gap: 10px; }
.chart-month { display: grid; grid-template-columns: 85px 1fr 300px; gap: 10px; align-items: center; }
.stack { display: flex; height: 14px; background: #edf2f7; border-radius: 999px; overflow: hidden; }
.stack i { display: block; height: 100%; min-width: 2px; }
.purchase-bar, .purchase-dot { background: #0f9278; }
.payment-bar, .payment-dot { background: #2563eb; }
.return-bar, .return-dot { background: #f59e0b; }
.legend b { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin: 0 5px 0 12px; }
@media (max-width: 1150px) {
  .ss-info, .ss-filter { grid-template-columns: 1fr; }
  .chart-month { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar, .no-print, .ss-toolbar, .ss-filter { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .ss-card { border: 0; padding: 8px 0; }
}

/* Quotation Page */
.quote-page { display: grid; gap: 16px; }
.quote-actions { display: flex; flex-wrap: wrap; gap: 7px; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.quote-actions .btn { min-height: 36px; height: 36px; padding: 0 13px; border-radius: 9px; font-size: 12px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.quote-actions .strong { background: #061735 !important; color: #fff !important; }
.quote-entry, .quote-history { background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 14px; }
.quote-items { min-width: 1180px; }
.quote-items input, .quote-bottom input, .quote-bottom textarea { width: 100%; min-height: 34px; border: 1px solid #d7dee8; border-radius: 7px; padding: 7px; }
.quote-items .q-total, .quote-items .q-stock { background: #f8fafc; font-weight: 900; }
.quote-bottom { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; margin-top: 14px; }
.quote-summary-box { display: grid; gap: 8px; border: 1px solid #dfe5ec; border-radius: 12px; padding: 12px; }
.quote-print-sheet { background: #fff; color: #061735; width: 210mm; min-height: 297mm; margin: 0 auto; padding: 10mm; border: 1px solid #dfe5ec; box-shadow: 0 4px 18px rgba(15,23,42,.12); }
.quote-print-top { display: grid; grid-template-columns: 1fr 78mm; gap: 10mm; align-items: start; }
.quote-brand-block { display: grid; grid-template-columns: 42mm 1fr; gap: 7mm; align-items: center; }
.quote-brand-block img { width: 42mm; height: 34mm; object-fit: cover; }
.quote-brand-block h1 { margin: 0; font-size: 34pt; letter-spacing: 1px; color: #061735; }
.quote-brand-block h2 { margin: 0; font-size: 15pt; color: #c60000; }
.quote-brand-block h3 { margin: 3px 0; font-size: 16pt; }
.quote-brand-block p { margin: 5px 0 0; background: #061735; color: #fff; display: inline-block; padding: 4px 7px; border-radius: 3px; text-transform: uppercase; font-size: 7pt; font-weight: 900; }
.quote-title-card { border: 1.5px solid #061735; border-radius: 7px; overflow: hidden; }
.quote-title-card h2 { margin: 0 0 6px; padding: 7px; background: #c60000; color: #fff; text-align: center; font-size: 24pt; }
.quote-title-card div { display: grid; grid-template-columns: 35mm 1fr; gap: 4px; padding: 5px 8px; align-items: end; }
.quote-title-card span { font-size: 8pt; font-weight: 900; text-transform: uppercase; }
.quote-title-card b { border-bottom: 1px solid #8a94a6; min-height: 14px; font-size: 9pt; }
.quote-contact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14mm; border-top: 1px solid #8a94a6; margin: 8mm 0; padding-top: 5mm; font-weight: 800; font-size: 10pt; }
.quote-print-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 6mm; margin-bottom: 5mm; }
.print-panel { border: 1.5px solid #061735; border-radius: 7px; padding: 7mm 4mm 4mm; position: relative; min-height: 30mm; }
.print-panel h3 { position: absolute; top: -1px; left: -1px; margin: 0; background: #061735; color: #fff; padding: 4px 18px 4px 8px; border-radius: 6px 0 6px 0; font-size: 10pt; }
.print-panel p { font-size: 10pt; line-height: 1.5; font-weight: 800; }
.quote-print-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 8pt; }
.quote-print-table th { background: #061735; color: #fff; padding: 5px 3px; border: 1px solid #8a94a6; }
.quote-print-table th:first-child { background: #c60000; }
.quote-print-table td { height: 8mm; border: 1px solid #c8ced8; text-align: center; padding: 2px; }
.quote-print-bottom { display: grid; grid-template-columns: 1fr 1.2fr 70mm; gap: 6mm; margin-top: 6mm; }
.print-panel.small { min-height: 35mm; }
.policy p { font-size: 7.5pt; }
.print-total-box { border: 1px solid #8a94a6; border-radius: 6px; overflow: hidden; align-self: start; }
.print-total-box div { display: grid; grid-template-columns: 1fr 28mm; border-bottom: 1px solid #8a94a6; }
.print-total-box span { background: #061735; color: #fff; padding: 6px; font-size: 8pt; font-weight: 900; }
.print-total-box b { padding: 6px; text-align: right; }
.print-total-box .grand span, .print-total-box .grand b { background: #c60000; color: #fff; font-size: 10pt; }
.quote-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 40mm; margin: 18mm 10mm 8mm; text-align: center; font-weight: 900; text-transform: uppercase; }
.quote-signatures span { border-top: 1px solid #061735; padding-top: 5px; }
.quote-footer { background: #061735; color: #fff; margin: 0 -10mm -10mm; padding: 8px; text-align: center; font-weight: 900; }
@media screen {
  .quote-print-sheet { display: block; transform-origin: top center; }
}
@media max-width {
}
@media (max-width: 1100px) {
  .quote-bottom { grid-template-columns: 1fr; }
  .quote-print-sheet { width: 100%; min-height: auto; overflow: auto; }
}
@media print {
  .sidebar, .topbar, .flash, .no-print, .quote-form, .quote-history { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; background: #fff !important; }
  .quote-print-sheet { display: block !important; width: 210mm !important; min-height: 297mm !important; margin: 0 !important; padding: 9mm !important; border: 0 !important; box-shadow: none !important; page-break-after: avoid; }
  @page { size: A4 portrait; margin: 0; }
}

/* Customer Statement Center */
.cs-page { display: grid; gap: 16px; }
.cs-toolbar { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 10px 12px; }
.cs-toolbar .btn, .cs-filter .btn, .cs-payment-form .btn { min-height: 36px; height: 36px; padding: 0 13px; border-radius: 9px; font-size: 12px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.cs-toolbar .strong, .cs-payment-form .strong { background: #061735 !important; color: #fff !important; }
.cs-filter { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto; gap: 10px; align-items: end; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 12px; }
.cs-filter label, .cs-payment-form label { font-weight: 800; }
.cs-filter input, .cs-filter select, .cs-payment-form input, .cs-payment-form select { width: 100%; min-height: 38px; border: 1px solid #d7dee8; border-radius: 8px; padding: 8px 10px; margin-top: 4px; }
.cs-info { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
.cs-card { background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 14px; }
.cs-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cs-summary div, .cs-mini-summary div { border: 1px solid #e7edf3; border-radius: 10px; padding: 10px; background: #f8fafc; }
.cs-summary span { display: block; color: #64748b; font-size: 12px; margin-bottom: 5px; }
.cs-summary strong { font-size: 18px; color: #061735; }
.cs-summary .warn strong { color: #c60000; }
.cs-mini-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cs-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cs-payment-form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.cs-payment-form .wide { grid-column: 1 / -1; }
@media (max-width: 1150px) {
  .cs-info, .cs-layout, .cs-filter { grid-template-columns: 1fr; }
  .cs-mini-summary { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  .sidebar, .topbar, .no-print, .cs-toolbar, .cs-filter, .cs-layout { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .cs-card { border: 0; padding: 8px 0; }
}

/* Customer History Center */
.ch-page { display: grid; gap: 16px; }
.ch-toolbar { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 10px 12px; }
.ch-toolbar .btn, .ch-filter .btn, .ch-mini-form .btn, .ch-notes-form .btn { min-height: 36px; height: 36px; padding: 0 13px; border-radius: 9px; font-size: 12px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.ch-toolbar .strong { background: #061735 !important; color: #fff !important; }
.ch-filter { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 12px; }
.ch-filter label { font-weight: 800; }
.ch-filter select, .ch-mini-form input, .ch-notes-form textarea { width: 100%; min-height: 38px; border: 1px solid #d7dee8; border-radius: 8px; padding: 8px 10px; margin-top: 4px; }
.ch-info { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; }
.ch-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.ch-card { background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 14px; }
.simple-info-table { width: 100%; border-collapse: collapse; }
.simple-info-table td { border-bottom: 1px solid #e7edf3; padding: 9px; }
.simple-info-table td:first-child { color: #64748b; font-weight: 800; }
.simple-info-table td:last-child { text-align: right; font-weight: 900; color: #061735; }
.ch-mini-form { display: grid; grid-template-columns: repeat(5, 1fr) auto; gap: 8px; margin-top: 10px; }
.ch-notes-form { display: grid; gap: 8px; }
.print-only { display: none; }
@media (max-width: 1150px) {
  .ch-info, .ch-grid { grid-template-columns: 1fr; }
  .ch-mini-form { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  .sidebar, .topbar, .no-print, .ch-toolbar, .ch-filter, .flash { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .ch-card { border: 0; padding: 8px 0; }
  .print-only { display: block; }
}

/* Customer Balance merged view */
.balance-focus { border: 2px solid #dfe5ec; }
.balance-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.balance-heading h3 { margin: 0 0 4px; }
.balance-heading p { margin: 0; color: #64748b; }
.balance-status { display: inline-flex; align-items: center; justify-content: center; min-height: 34px; padding: 0 14px; border-radius: 999px; font-weight: 900; white-space: nowrap; }
.balance-status.good { background: #dcfce7; color: #15803d; }
.balance-status.care { background: #fef3c7; color: #b45309; }
.balance-status.bad { background: #fee2e2; color: #b91c1c; }
.balance-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.balance-cards div, .balance-reminder div { border: 1px solid #e7edf3; border-radius: 10px; padding: 12px; background: #f8fafc; }
.balance-cards span, .balance-reminder span { display: block; color: #64748b; font-size: 12px; margin-bottom: 6px; }
.balance-cards strong, .balance-reminder strong { font-size: 20px; color: #061735; }
.balance-cards .warn strong { color: #c60000; }
.balance-reminder { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
@media (max-width: 900px) {
  .balance-heading { align-items: flex-start; flex-direction: column; }
  .balance-cards, .balance-reminder { grid-template-columns: 1fr; }
}

/* Top Customers and Accounts Receivable */
.tc-page, .ar-page { display: grid; gap: 16px; }
.tc-toolbar, .ar-toolbar { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 10px 12px; }
.tc-toolbar .btn, .ar-toolbar .btn { min-height: 36px; height: 36px; padding: 0 13px; border-radius: 9px; font-size: 12px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; }
.tc-cards { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; }
.ar-cards { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 12px; }
.tc-card, .ar-card { background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 14px; }
.top-bar { display: grid; grid-template-columns: 220px 1fr 120px; gap: 10px; align-items: center; margin: 9px 0; }
.top-bar div { height: 14px; background: #edf2f7; border-radius: 999px; overflow: hidden; }
.top-bar i { display: block; height: 100%; background: #0f9278; border-radius: 999px; }
.top-bar span, .top-bar strong { font-weight: 900; }
@media (max-width: 1100px) {
  .tc-cards, .ar-cards { grid-template-columns: repeat(2, 1fr); }
  .top-bar { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .topbar, .no-print, .tc-toolbar, .ar-toolbar { display: none !important; }
  .main { margin: 0 !important; padding: 0 !important; }
  .tc-card, .ar-card { border: 0; padding: 8px 0; }
}

/* Supplier Core 4 Pages */
.supplier-page { display: grid; gap: 16px; }
.supplier-toolbar, .supplier-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 10px 12px; }
.supplier-toolbar .btn, .supplier-filter .btn, .supplier-form .btn { min-height: 36px; height: 36px; padding: 0 13px; border-radius: 9px; font-size: 12px; font-weight: 900; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.supplier-toolbar .strong, .supplier-form .strong { background: #061735 !important; color: #fff !important; }
.supplier-filter input, .supplier-filter select, .supplier-form input, .supplier-form select { min-height: 38px; border: 1px solid #d7dee8; border-radius: 8px; padding: 8px 10px; }
.supplier-filter input { min-width: 280px; flex: 1; }
.supplier-layout { display: grid; grid-template-columns: 380px 1fr; gap: 16px; align-items: start; }
.supplier-card { background: #fff; border: 1px solid #dfe5ec; border-radius: 12px; padding: 14px; }
.supplier-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.supplier-form .wide { grid-column: 1 / -1; }
.button-row { display: flex; flex-wrap: wrap; gap: 5px; min-width: 360px; }
.button-row form { display: inline-flex; margin: 0; }
.danger-mini { background: #fee2e2 !important; color: #b91c1c !important; border: 0; cursor: pointer; }
.status-pill.good { background: #dcfce7; color: #15803d; }
.status-pill.watch { background: #fef3c7; color: #b45309; }
.status-pill.risk { background: #fee2e2; color: #b91c1c; }
@media (max-width: 1100px) { .supplier-layout { grid-template-columns: 1fr; } .supplier-form { grid-template-columns: 1fr; } }

/* Sales Control Center layout repair */
.clean-sales-control {
  padding: 22px 24px;
}
.sales-control-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.sales-control-head h3 {
  margin: 0 0 8px;
}
.sales-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 12px 0 16px;
}
.sales-actions .button {
  min-width: 138px;
  text-align: center;
  line-height: 1.2;
  padding: 11px 14px;
  white-space: nowrap;
}
.sales-advice {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  background: #f7fafc;
  border: 1px solid #dfe7ef;
  border-left: 4px solid var(--green);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 4px;
  clear: both;
}
.sales-advice span {
  display: block;
  line-height: 1.45;
}
@media (max-width: 700px) {
  .sales-actions .button {
    width: 100%;
  }
  .sales-advice {
    display: block;
  }
}


/* RC1 unified A4 print engine */
@page {
  size: A4;
  margin: 8mm;
}
@media print {
  html, body {
    width: 210mm;
    min-height: 297mm;
    background: #fff !important;
    color: #07142b !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .sidebar,
  .topbar,
  .toolbar,
  .no-print,
  .action-grid,
  .sales-actions,
  .quote-actions,
  .cs-toolbar,
  .pi-toolbar,
  .sp-toolbar,
  .ss-toolbar,
  .report-actions,
  .custom-date,
  button,
  .button,
  .btn,
  .mini-btn,
  .small-btn {
    display: none !important;
  }
  .main {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .panel,
  .module-card,
  .metric,
  .cs-card,
  .ss-card,
  .sp-card,
  .pi-card,
  .smart-panel,
  .smart-kpi,
  .settings-panel,
  .acct-panel,
  .mg-panel,
  .inv-panel {
    box-shadow: none !important;
    border: 1px solid #d8e0e8 !important;
    page-break-inside: avoid;
  }
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    page-break-inside: auto;
  }
  thead {
    display: table-header-group;
  }
  tfoot {
    display: table-footer-group;
  }
  tr {
    page-break-inside: avoid;
  }
  th, td {
    border: 1px solid #b9c4d1 !important;
    padding: 5px !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
    vertical-align: top !important;
    overflow-wrap: anywhere;
  }
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
  input,
  textarea,
  select {
    border: 0 !important;
    background: transparent !important;
    color: #07142b !important;
    font: inherit !important;
    padding: 0 !important;
  }
  a {
    color: #07142b !important;
    text-decoration: none !important;
  }
  .page-break {
    page-break-before: always;
  }
  .print-page-number:after {
    content: "Page " counter(page);
  }
}
