:root{
 --sun-bg:#f4f7f3;--sun-panel:#ffffff;--sun-ink:#1e2933;--sun-muted:#607077;--sun-line:#d9e3dd;
 --sun-green:#12a85b;--sun-green-dark:#087c42;--sun-green-soft:#e8f7ee;--sun-navy:#10394d;
 --sun-warm:#c47700;--sun-danger:#b42318;--sun-shadow:0 8px 24px rgba(22,55,42,.08)
}
*{box-sizing:border-box}html,body{background:var(--sun-bg)!important;color:var(--sun-ink)!important;font-family:Inter,Segoe UI,Arial,sans-serif}
body{min-height:100vh;background:linear-gradient(180deg,#f8faf8 0,#eef3ef 100%)!important}
.aurora,.cursor-glow,.cursor-dot{display:none!important}
.sidebar{background:#fff!important;border-right:1px solid var(--sun-line)!important;box-shadow:5px 0 24px rgba(23,52,41,.06)!important}
.sidebar .brand{display:flex!important;flex-direction:column!important;align-items:center!important;text-align:center!important;gap:8px!important;padding:14px 12px 12px!important;margin:8px!important;border:1px solid var(--sun-line)!important;border-radius:16px!important;background:#fff!important;box-shadow:var(--sun-shadow)!important}
.sidebar .brand img{width:100%!important;max-width:150px!important;height:auto!important;max-height:104px!important;object-fit:contain!important;border-radius:8px!important;box-shadow:none!important;background:#fff!important}
.sidebar .brand>div{display:block!important}.sidebar .brand strong{display:block!important;color:var(--sun-navy)!important;font-size:15px!important;letter-spacing:.02em}.sidebar .brand small{display:block!important;color:#6b7880!important;font-size:10px!important;margin-top:2px!important}
.nav-title{color:#78868d!important;font-size:10px!important;letter-spacing:.08em!important;font-weight:800!important}
.nav-link{color:#2f3d45!important;border:1px solid transparent!important;border-radius:10px!important;margin:2px 8px!important}.nav-link:hover,.nav-link.active{background:#eaf7ef!important;border-color:#c7e6d3!important;color:var(--sun-green-dark)!important}.nav-link.active .nav-icon,.nav-link:hover .nav-icon{color:var(--sun-green)!important}
.quick-sale{background:var(--sun-green)!important;color:#fff!important;border-radius:11px!important;box-shadow:0 7px 18px rgba(18,168,91,.22)!important}
.main{background:transparent!important}.topbar{background:rgba(255,255,255,.96)!important;border-bottom:1px solid var(--sun-line)!important;box-shadow:0 4px 16px rgba(23,52,41,.05)!important}
.content{padding:24px 28px 72px!important;max-width:1680px!important;margin:0 auto!important}.page-head{margin-bottom:16px!important}.page-head h1{color:var(--sun-navy)!important}.page-head p{color:var(--sun-muted)!important}
.panel-card,.card,.staff-panel,.report-filter{background:#fff!important;border:1px solid var(--sun-line)!important;box-shadow:var(--sun-shadow)!important;border-radius:16px!important}.panel-card:before{display:none!important}
.field input,.field select,.field textarea,.table-filter,.inline-edit{background:#fff!important;border:1px solid #cfdad3!important;color:var(--sun-ink)!important;min-height:42px}.field input:focus,.field select:focus,.field textarea:focus{border-color:#7ac99d!important;outline:3px solid rgba(18,168,91,.12)!important}
.btn{border:1px solid #cdd8d2!important;background:#fff!important;color:#24343b!important;box-shadow:0 3px 10px rgba(30,65,49,.06)!important}.btn.accent,.btn.success{background:var(--sun-green)!important;border-color:var(--sun-green)!important;color:#fff!important}.btn.warn{background:#fff5df!important;color:#8d5d00!important;border-color:#efd39a!important}.btn.danger{background:#fff0ef!important;color:#9f2218!important;border-color:#efc3bf!important}.btn.secondary{background:#f3f6f4!important;color:#32454d!important}
.data-table{background:#fff!important;border:1px solid var(--sun-line)!important}.data-table th{background:#13a45a!important;color:#fff!important;border-color:#13a45a!important}.data-table td{color:#2c3941!important;border-bottom:1px solid #e5ece8!important}.data-table tbody tr:hover{background:#f4fbf7!important}
.badge.ok-b{background:#e5f7ec!important;color:#126239!important}.badge.danger-b{background:#ffeded!important;color:#9f2218!important}.summary-box,.selected-doc,.notice,.kpi-mini{background:#f8fbf9!important;border:1px solid var(--sun-line)!important}
.global-alert{background:var(--sun-navy)!important;color:#fff!important}.global-alert.error{background:#8e2d27!important}.mobile-bottom{background:#fff!important;border-top:1px solid var(--sun-line)!important}.mobile-bottom a{color:#4b5b62!important}.mobile-bottom a:hover{color:var(--sun-green-dark)!important}
.dashboard-content{padding:26px 30px 72px!important}.dashboard-kpis .card{padding:20px!important;min-height:120px}.dashboard-sections{margin-top:20px!important;gap:18px!important}.dashboard-sections .card{padding:20px!important}
.table-toolbar{background:#fbfdfc!important;border:1px solid var(--sun-line)!important;padding:9px!important;border-radius:12px!important}.record-count{color:#66777f!important}
.staff-shell{gap:16px!important}.staff-panel{padding:18px!important}.staff-panel .table-toolbar{margin:0!important}.staff-panel .panel-title-row{gap:14px!important;align-items:flex-start!important}.staff-panel .table-scroll{margin-top:12px!important}.staff-form .form-grid{row-gap:14px!important}.permission-grid{background:#f7faf8!important;border:1px solid var(--sun-line)!important}
.report-page,.report-sheet{color:var(--sun-ink)}
@media(max-width:1100px){.content{padding:20px 18px 84px!important}.dashboard-content{padding:22px 18px 84px!important}.col-2,.col-3,.col-4,.col-5,.col-6,.col-8,.col-9{grid-column:span 6!important}}
@media(max-width:760px){.content{padding:14px 11px 80px!important}.dashboard-content{padding:15px 11px 82px!important}.page-head{flex-direction:column!important;align-items:stretch!important}.page-head .actions{width:100%!important;display:flex!important;overflow:auto!important}.page-head .actions .btn{flex:1!important}.form-grid{grid-template-columns:1fr!important;row-gap:12px!important}.col-2,.col-3,.col-4,.col-5,.col-6,.col-8,.col-9,.col-12{grid-column:1!important}.field{width:100%!important}.data-table th,.data-table td{padding:8px 7px!important;font-size:12px!important}.btn{font-size:12px!important}.sidebar .brand img{max-width:130px!important}.staff-panel{padding:13px!important}}
@media(max-width:480px){.content{padding-left:8px!important;padding-right:8px!important}.dashboard-kpis{gap:10px!important}.dashboard-kpis .card{padding:14px!important;min-height:104px}.panel-card{border-radius:13px!important}.staff-panel{border-radius:13px!important}}

/* V11 staff/settings/report utilities */
.staff-panel .panel-title-row>.table-toolbar{margin-left:auto!important;min-width:min(360px,48vw)!important}.staff-panel .table-filter{width:100%!important}.report-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.report-setting-row{display:grid;grid-template-columns:minmax(0,1fr) 130px auto;gap:8px;align-items:center;padding:10px 12px;border:1px solid var(--sun-line);border-radius:12px;background:#fff}.report-setting-row select{min-height:38px}.settings-stack{display:grid;gap:16px}.panel-section{background:#fff;border:1px solid var(--sun-line);border-radius:16px;padding:18px;box-shadow:var(--sun-shadow)}
@media(max-width:760px){.staff-panel .panel-title-row>.table-toolbar{width:100%!important;min-width:0!important}.report-settings-grid{grid-template-columns:1fr}.report-setting-row{grid-template-columns:1fr 110px auto}.panel-section{padding:13px}}

.panel-card:has(.staff-shell),.panel-card:has(.settings-stack){background:transparent!important;border:0!important;box-shadow:none!important;padding:0!important}
.staff-shell .staff-panel:first-child{margin-top:0!important}

/* V12 report/document toolbar reliability */
.report-toolbar{align-items:center!important;justify-content:flex-end!important}.report-toolbar .btn{min-height:40px;white-space:nowrap}.screen-toolbar{display:flex!important;align-items:center!important;gap:8px!important}
@media(max-width:760px){.report-toolbar,.screen-toolbar{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;width:100%!important}.report-toolbar .btn,.screen-toolbar .btn{width:100%!important}.report-sheet{overflow-x:hidden!important}.table-scroll{overflow-x:auto!important}}

.settings-stack .muted{font-size:11px!important;display:block!important;margin-top:3px;color:#63757b!important}.report-toolbar .btn,.screen-toolbar .btn{cursor:pointer!important}.report-table th,.report-table td{vertical-align:middle!important}


/* V13 print/report reliability + larger navigation */
.sidebar .nav-link{font-size:14px!important;font-weight:650!important;min-height:42px!important}.nav-title{font-size:11px!important}.report-toolbar,.screen-toolbar{gap:8px!important}.report-toolbar .btn,.screen-toolbar .btn{min-width:94px!important;padding:10px 13px!important;font-weight:700!important}.save-action-banner{display:flex!important;gap:8px!important;flex-wrap:wrap!important;align-items:center!important}.walk-in-field{display:block!important}.walk-in-field.is-hidden{display:none!important}@media(max-width:760px){.save-action-banner .btn{flex:1 1 130px}.report-toolbar,.screen-toolbar{grid-template-columns:repeat(2,minmax(0,1fr))!important}.sidebar .nav-link{font-size:14px!important}}
@media print{.screen-toolbar{display:none!important}.report-sheet{color:#1e2933!important;background:#fff!important}.report-table th{background:#12a85b!important;color:#fff!important;-webkit-print-color-adjust:exact;print-color-adjust:exact}}

.chart-card{min-height:320px!important}.chart-card canvas{width:100%!important;height:240px!important}.action-cell{display:flex!important;gap:6px!important;flex-wrap:wrap!important;align-items:center!important}.action-cell .btn{white-space:nowrap!important}@media(max-width:760px){.chart-card{min-height:290px!important}.chart-card canvas{height:210px!important}.action-cell .btn{flex:0 1 auto!important}}

/* V14 reliability */
.invoice-toolbar,.report-toolbar,.screen-toolbar{display:flex!important;align-items:center!important;justify-content:flex-end!important;gap:8px!important;flex-wrap:wrap!important}.invoice-toolbar .btn,.report-toolbar .btn,.screen-toolbar .btn{min-height:40px!important;font-weight:750!important}.toolbar{z-index:30!important}.report-sheet .screen-toolbar{margin-bottom:12px!important}@media(max-width:760px){.invoice-toolbar,.report-toolbar,.screen-toolbar{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;width:100%!important}.invoice-toolbar .btn,.report-toolbar .btn,.screen-toolbar .btn{width:100%!important}.walk-in-field{display:block!important}.walk-in-field.is-hidden{display:none!important}.walk-in-field[style*='display: none']{display:none!important}}
/* V16 document/report reliability */
.invoice-toolbar,.report-toolbar,.screen-toolbar{position:static!important;display:flex!important;justify-content:center!important;align-items:center!important;flex-wrap:wrap!important;width:100%!important;margin:0 auto 14px!important;z-index:2!important}
.invoice-toolbar .btn,.report-toolbar .btn,.screen-toolbar .btn{flex:0 0 auto!important;min-width:108px!important}
.document-sheet,.invoice-sheet,.sheet{max-width:100%!important;overflow:visible!important}
@media(max-width:760px){
 .invoice-toolbar,.report-toolbar,.screen-toolbar{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
 .invoice-toolbar .btn,.report-toolbar .btn,.screen-toolbar .btn{width:100%!important;min-width:0!important}
 .sheet{width:min(100%,72mm)!important;max-width:72mm!important;padding:10px!important;margin:0 auto!important}
 .sheet .head{gap:8px!important;flex-direction:column!important}
 .sheet .doc{text-align:left!important;width:100%!important}
 .sheet .party{grid-template-columns:1fr!important}
 .sheet .items{font-size:9px!important;table-layout:fixed!important}
 .sheet .items th,.sheet .items td{padding:4px!important;word-break:break-word!important}
 .sheet .items th:nth-child(1),.sheet .items td:nth-child(1){width:42%!important}
 .sheet .items th:nth-child(2),.sheet .items td:nth-child(2){width:18%!important}
 .sheet .items th:nth-child(3),.sheet .items td:nth-child(3){width:20%!important}
 .sheet .items th:nth-child(4),.sheet .items td:nth-child(4){width:20%!important}
}
@media print{
 .invoice-toolbar,.report-toolbar,.screen-toolbar{display:none!important}
 body{background:#fff!important}
}

/* V18: walk-in visibility + responsive report/document toolbars */
.walk-in-field.is-hidden{display:none!important}
.report-actions,.screen-toolbar,.invoice-toolbar{position:static!important;display:flex!important;justify-content:center!important;align-items:center!important;flex-wrap:wrap!important;gap:8px!important;width:100%!important;margin:0 auto 14px!important;z-index:2!important}
.report-actions .btn,.screen-toolbar .btn,.invoice-toolbar .btn{min-width:108px!important;min-height:40px!important}
@media(max-width:760px){.report-actions,.screen-toolbar,.invoice-toolbar{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}.report-actions .btn,.screen-toolbar .btn,.invoice-toolbar .btn{width:100%!important;min-width:0!important}.table-scroll{overflow-x:auto!important}}
@media print{.report-actions,.screen-toolbar,.invoice-toolbar{display:none!important}}

/* V19 final client fix: document/report controls stay above content, never overlay it. */
.report-actions,.screen-toolbar,.invoice-toolbar{position:relative!important;z-index:20!important;display:flex!important;justify-content:center!important;align-items:center!important;gap:9px!important;flex-wrap:wrap!important;width:100%!important;margin:0 auto 16px!important;padding:10px!important;background:#f7faf8!important;border:1px solid #d8e5df!important;border-radius:14px!important}
.report-actions .btn,.screen-toolbar .btn,.invoice-toolbar .btn{display:inline-flex!important;align-items:center!important;justify-content:center!important;min-width:104px!important;min-height:42px!important;white-space:nowrap!important}
.report-page .report-sheet,.sheet{position:relative!important;z-index:1!important}
.refund-panel{background:#fff7f5!important;border:1px solid #f1d1cc!important;border-radius:14px!important;padding:15px!important;margin-top:12px!important}
@media(max-width:760px){
 .report-actions,.screen-toolbar,.invoice-toolbar{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important;padding:8px!important}
 .report-actions .btn,.screen-toolbar .btn,.invoice-toolbar .btn{width:100%!important;min-width:0!important}
 .register-search .field{grid-column:1!important}.register-search .form-action{grid-column:1!important}
}
@media print{.report-actions,.screen-toolbar,.invoice-toolbar{display:none!important}}

/* V20: form grid/layout hardening - prevents narrow controls and horizontal overflow */
.form-grid{
  grid-template-columns:repeat(12,minmax(0,1fr)) !important;
  min-width:0 !important;
}
.form-grid > *{min-width:0 !important;}
.form-grid .field{min-width:0 !important;width:100% !important;}
.form-grid .field input,
.form-grid .field select,
.form-grid .field textarea{
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
}
.sale-entry-form{min-width:0 !important;width:100% !important;}
.sale-entry-form .form-grid{align-items:start !important;}
.sale-entry-form .summary-box{min-width:0 !important;}
.sale-entry-form .table-scroll{max-width:100% !important;min-width:0 !important;overflow-x:auto !important;}
.sale-entry-form .line-table{min-width:760px;}
.sale-entry-form .line-table select,
.sale-entry-form .line-table input{min-width:0 !important;}
@media(max-width:1100px){
  .sale-entry-form .col-3{grid-column:span 6 !important;}
  .sale-entry-form .col-4{grid-column:span 6 !important;}
  .sale-entry-form .col-6{grid-column:span 12 !important;}
}
@media(max-width:760px){
  .sale-entry-form .form-grid{grid-template-columns:minmax(0,1fr) !important;}
  .sale-entry-form .col-2,.sale-entry-form .col-3,.sale-entry-form .col-4,
  .sale-entry-form .col-5,.sale-entry-form .col-6,.sale-entry-form .col-8,.sale-entry-form .col-9,.sale-entry-form .col-12{
    grid-column:1 !important;
  }
  .sale-entry-form .field input,
  .sale-entry-form .field select,
  .sale-entry-form .field textarea{font-size:14px !important;min-height:42px !important;}
  .sale-entry-form .line-table{min-width:760px;}
}

/* Task 12: Customer previous balance status card */
.customer-balance-box{display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-height:42px;padding:10px 12px;border:1px solid var(--sun-line);border-radius:10px;background:#fff;}
.customer-balance-box .balance-status{font-size:11px;font-weight:800;letter-spacing:.04em;padding:5px 8px;border-radius:999px;}
.customer-balance-box strong{font-size:16px;line-height:1.2;}
.customer-balance-box small{flex-basis:100%;margin-top:-2px;}
.status-receivable{border-color:#fecaca!important;background:#fff7f7!important;color:#b91c1c;}
.status-receivable .balance-status{background:#fecaca;color:#991b1b;}
.status-payable{border-color:#bbf7d0!important;background:#f0fdf4!important;color:#15803d;}
.status-payable .balance-status{background:#bbf7d0;color:#166534;}
.status-settled{border-color:#d1d5db!important;background:#f8fafc!important;color:#111827;}
.status-settled .balance-status{background:#e5e7eb;color:#111827;}
.line-purchase-price{font-weight:700;white-space:nowrap;color:#475569;}
@media(max-width:760px){.customer-balance-box{min-height:48px;padding:9px 10px}.customer-balance-box strong{font-size:15px}}


/* V21 invoice UI/print polish */
.sale-entry-form .invoice-live-summary{
  width:max-content !important;
  max-width:100% !important;
  margin-left:auto !important;
  gap:12px !important;
  padding:9px 11px !important;
}
.sale-entry-form .invoice-live-summary span{font-size:11px !important;white-space:nowrap !important;}
.sale-entry-form .invoice-live-summary b{font-size:14px !important;margin-left:4px !important;}
.sale-entry-form .invoice-live-summary .btn{min-width:120px !important;min-height:36px !important;padding:7px 10px !important;}
@media(max-width:760px){
  .sale-entry-form .invoice-live-summary{width:100% !important;margin-left:0 !important;gap:8px !important;}
  .sale-entry-form .invoice-live-summary span{flex:1 1 calc(50% - 8px) !important;min-width:0 !important;}
  .sale-entry-form .invoice-live-summary .btn{width:100% !important;}
}


/* Fast Billing POS — desktop ERP style + mobile responsive */
.fast-billing-panel{background:linear-gradient(180deg,#fbfffd,#f3faf6);border:1px solid #cfe3d7;border-radius:18px;padding:16px;box-shadow:0 10px 28px rgba(24,72,54,.08)}
.fast-billing-head{display:flex;justify-content:space-between;gap:16px;align-items:flex-start;margin-bottom:14px}.fast-eyebrow{font-size:10px;font-weight:900;letter-spacing:.12em;color:#198754}.fast-billing-head h3{margin:2px 0 3px;font-size:18px;color:#163b2d}.fast-billing-head small{color:#6b7b75}.fast-shortcuts{font-size:11px;color:#687873;white-space:nowrap}.fast-shortcuts kbd{display:inline-flex;align-items:center;justify-content:center;border:1px solid #c5d6ce;border-bottom-width:2px;background:#fff;border-radius:6px;padding:3px 6px;font-weight:800;margin:0 2px}
.fast-billing-filters{display:grid;grid-template-columns:minmax(260px,2.2fr) 150px 180px 180px;gap:10px}.fast-billing-filters .field{margin:0}.fast-product-search{height:48px!important;font-size:15px!important;font-weight:700!important;border-color:#9dc9af!important;box-shadow:0 0 0 3px rgba(25,135,84,.07)}
.fast-product-results{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:9px;margin-top:12px;max-height:235px;overflow:auto;padding-right:2px}.fast-product-card{display:flex;justify-content:space-between;gap:10px;text-align:left;width:100%;border:1px solid #d8e5df;background:#fff;border-radius:12px;padding:10px 11px;cursor:pointer;transition:.15s ease;box-shadow:0 4px 12px rgba(24,72,54,.05)}.fast-product-card:hover{transform:translateY(-1px);border-color:#8bc6a5;box-shadow:0 8px 18px rgba(24,72,54,.11)}.fast-product-main,.fast-product-meta{display:flex;flex-direction:column;gap:3px;min-width:0}.fast-product-main strong{font-size:13px;color:#1f352d;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fast-product-main small,.fast-product-meta small{font-size:10px;color:#718078;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.fast-product-meta{text-align:right}.fast-product-meta b{font-size:13px;color:#12844f}.fast-empty{padding:15px;text-align:center;color:#6f8079;font-size:12px;background:#fff;border:1px dashed #ceded6;border-radius:10px}.fast-empty.loading{color:#198754}
.hold-title-input{min-width:180px!important;max-width:230px!important;height:36px;border:1px solid #d5e0db;border-radius:9px;padding:7px 10px;background:#fff}.held-bills-panel{margin-top:14px;background:#fff;border:1px solid #dce7e2;border-radius:15px;padding:14px}.held-bills-list{display:grid;gap:8px}.held-bill-row{display:flex;justify-content:space-between;align-items:center;gap:12px;border:1px solid #e1ebe6;border-radius:11px;padding:10px 12px;background:#fbfdfc}.held-bill-row>div:first-child{display:flex;flex-direction:column;gap:3px;min-width:0}.held-bill-row strong{font-size:12px;color:#163b2d}.held-bill-row span{font-size:13px;font-weight:700}.held-bill-row small{font-size:10px;color:#75837e}.held-actions{display:flex;gap:6px;flex-wrap:wrap}
@media(max-width:1100px){.fast-billing-filters{grid-template-columns:2fr 1fr 1fr}.fast-billing-filters .field:first-child{grid-column:1/-1}.fast-product-results{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:760px){.fast-billing-head{flex-direction:column}.fast-shortcuts{white-space:normal}.fast-billing-filters{grid-template-columns:1fr}.fast-billing-filters .field:first-child{grid-column:auto}.fast-product-results{grid-template-columns:1fr;max-height:260px}.hold-title-input{width:100%;max-width:none}.invoice-live-summary .hold-title-input{flex:1 1 100%;order:10}.held-bill-row{align-items:flex-start;flex-direction:column}.held-actions{width:100%}.held-actions .btn{flex:1}.fast-product-search{height:46px!important}}
.fast-search-combo{display:flex;gap:7px;align-items:stretch}.fast-search-combo .fast-product-search{flex:1;min-width:0}.fast-key-btn{min-width:46px;padding-inline:10px!important}.held-bills-panel{margin-top:18px}.held-bill-row{display:flex;justify-content:space-between;gap:14px;align-items:center;padding:12px 0;border-bottom:1px solid #e5ece8}.held-bill-row:last-child{border-bottom:0}.held-bill-row>div:first-child{display:flex;flex-direction:column;gap:2px}.held-bill-row strong{color:#173b2f}.held-bill-row span{font-weight:700}.held-bill-row small{color:#70817a}.held-actions{display:flex;gap:7px;flex-wrap:wrap}@media(max-width:760px){.fast-search-combo{flex-wrap:wrap}.fast-search-combo .fast-product-search{flex:1 1 100%}.fast-key-btn{flex:1}}

.sale-ui-fast-grid{grid-template-columns:minmax(260px,1.5fr) minmax(220px,1fr) minmax(180px,.8fr) auto!important}.row-product-select .erp-search-select-trigger{min-width:260px}.row-vendor-select .erp-search-select-trigger{min-width:190px}
@media(max-width:760px){.sale-ui-fast-grid{grid-template-columns:1fr!important}}
