:root{--sidebar-w:248px;--bg:#eef2f7;--surface:#fff;--text:#1f2937;--muted:#64748b;--border:#e5e7eb;--primary:#0f766e;--blue:#1d4ed8;--danger:#b91c1c;--radius:16px;--shadow:0 8px 26px rgba(15,23,42,.06)}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;width:100%;overflow-x:hidden;background:var(--bg);color:var(--text);font-family:Arial,Helvetica,sans-serif}body{max-width:100vw}.layout{display:grid;grid-template-columns:var(--sidebar-w) minmax(0,1fr);min-height:100vh;align-items:start}.sidebar{position:sticky;top:0;height:100vh;overflow-y:auto;overflow-x:hidden;background:linear-gradient(180deg,#f8fbff,#eef6ff);color:#12324a;padding:22px;border-right:1px solid #d8e6f4}.brand-logo-wrap{text-align:center;margin-bottom:10px}.brand-logo{width:88px;height:88px;object-fit:contain;background:#fff;border:1px solid #dce8f4;border-radius:18px;padding:8px;filter:drop-shadow(0 5px 12px rgba(15,47,87,.12))}.brand{font-size:26px;font-weight:800;color:#0f2f57}.store-name{font-size:13px;color:#476581;margin:10px 0 16px;font-weight:700}.nav-section-title{font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:#64748b;margin:16px 4px 7px;font-weight:800}.sidebar nav a{display:block;color:#12324a;text-decoration:none;padding:10px 12px;border-radius:10px;margin-bottom:6px;background:#fff;border:1px solid #d8e6f4;box-shadow:0 2px 6px rgba(15,47,87,.04);line-height:1.25}.sidebar nav a:hover{background:#e7f1fb;border-color:#9fc3e8}.content{min-width:0;width:100%;padding:24px;overflow:visible}.topbar{display:flex;justify-content:space-between;align-items:center;gap:12px;background:#fff;padding:16px 20px;border-radius:var(--radius);box-shadow:var(--shadow);margin-bottom:18px}.page-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:16px}.page-head h1{margin:0}.muted,.small,.note{color:var(--muted)}.small,.note{font-size:13px}.grid{display:grid;gap:18px}.grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}.card{background:#fff;border-radius:var(--radius);padding:20px;box-shadow:var(--shadow);min-width:0}.stat,.stat-value{font-size:30px;font-weight:800;margin-top:8px}.stat-label{font-size:13px;color:#64748b;font-weight:700}.premium{background:linear-gradient(135deg,#172554,#0f766e);color:#fff}.premium .stat-label{color:#cbd5e1}.form-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.form-grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.form-group{display:flex;flex-direction:column;gap:6px;min-width:0}.form-group label{font-size:13px;font-weight:700}input,select,textarea,button{font:inherit;max-width:100%}input,select,textarea{width:100%;padding:10px 12px;border:1px solid #cbd5e1;border-radius:10px;background:#fff}textarea{min-height:88px;resize:vertical}.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;background:var(--primary);color:#fff;border:none;padding:10px 15px;border-radius:10px;text-decoration:none;cursor:pointer;white-space:nowrap}.btn.secondary,.btn-secondary{background:var(--blue);color:#fff}.btn.danger,.btn-danger{background:var(--danger);color:#fff}.compact-btn{padding:7px 10px;font-size:13px}.actions,.toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.flash{padding:12px 14px;border-radius:10px;margin-bottom:14px}.flash.success{background:#dcfce7;color:#166534}.flash.error{background:#fee2e2;color:#991b1b}.badge,.status-pill{display:inline-block;padding:5px 9px;border-radius:999px;background:#dbeafe;color:#1d4ed8;font-size:12px;font-weight:700}.login-wrap{min-height:100vh;display:grid;place-items:center;background:linear-gradient(135deg,#172554,#0f766e);padding:18px}.login-card{width:420px;max-width:100%;background:#fff;padding:30px;border-radius:18px;box-shadow:0 20px 60px rgba(0,0,0,.2)}.table-scroll-wrapper,.table-responsive,.scroll-x,.pos-table-wrap,.product-editor-scroll,.product-list-scroll,.invoice-scroll-wrapper{display:block;width:100%;max-width:100%;overflow:auto;-webkit-overflow-scrolling:touch;background:#fff;border:1px solid var(--border);border-radius:14px;box-shadow:0 8px 24px rgba(15,23,42,.05);margin-top:12px}.table-scroll-wrapper{max-height:70vh}.product-editor-scroll{max-height:58vh}.product-list-scroll{max-height:66vh}.invoice-scroll-wrapper{max-height:72vh}.pos-table-wrap{max-height:62vh}.table-scroll-wrapper>.table,.table-responsive>.table,.scroll-x>.table,.pos-table-wrap>.table,.product-editor-scroll>.table,.product-list-scroll>.table,.invoice-scroll-wrapper>.table{margin:0!important;box-shadow:none!important;border-radius:0!important}table.table,.table{width:100%;min-width:860px;border-collapse:separate!important;border-spacing:0;background:#fff}.table th,.table td{padding:11px 12px;border:1px solid #e5e7eb;font-size:14px;vertical-align:top;white-space:nowrap}.table td:first-child,.table th:first-child{white-space:normal;min-width:150px}.table thead th,.table tr:first-child th,.table th{position:sticky;top:0;z-index:6;background:#f8fafc!important;box-shadow:0 1px 0 #e5e7eb;font-weight:800;text-align:left; min-width: 150px;}.table td form{margin:0}.product-layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:18px;align-items:start}.product-edit-table{min-width:1180px!important}.product-list-table{min-width:1100px!important}.stock-maintenance-table{min-width:1050px!important}.pos-layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:18px;align-items:start}.pos-summary-card{position:sticky;top:24px;background:linear-gradient(180deg,#0f172a,#102a43);color:#fff}.pos-billing-table,.billing-table{min-width:1100px!important}.billing-shell{padding:24px;border:1px solid #dbe5f0;background:linear-gradient(180deg,#fff,#f8fbff)}.live-results{position:absolute;z-index:35;max-height:260px;overflow:auto;background:#fff;border:1px solid #cbd5e1;border-radius:12px;box-shadow:0 16px 30px rgba(15,23,42,.12);display:none}.live-results.show{display:block}.live-item{display:flex;justify-content:space-between;gap:12px;width:100%;border:none;background:#fff;padding:11px 12px;text-align:left;cursor:pointer;border-bottom:1px solid #eef2f7}.live-item:hover{background:#eff6ff}.summary-line{display:flex;justify-content:space-between;padding:8px 0;border-bottom:1px dashed #d1d5db}.summary-line:last-child{border-bottom:0}.totals{max-width:420px;margin-left:auto}.footer-note{margin-top:18px;text-align:center;color:#64748b;font-size:12px}.modal-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.45);display:none;align-items:center;justify-content:center;z-index:70;padding:18px}.modal-backdrop.show{display:flex}.modal-card{background:#fff;border-radius:18px;padding:20px;max-width:640px;width:100%;box-shadow:0 24px 60px rgba(15,23,42,.25)}.modal-card-lg{max-width:920px}.modal-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.modal-close{border:none;background:#e2e8f0;color:#0f172a;width:34px;height:34px;border-radius:999px;cursor:pointer;font-size:22px;line-height:1}.business-medical_store .topbar{border-left:5px solid #0f766e}.business-clothing_store .topbar{border-left:5px solid #7c3aed}.business-electronics_store .topbar{border-left:5px solid #2563eb}.business-general_store .topbar{border-left:5px solid #ea580c}@media(max-width:1280px){.grid-4{grid-template-columns:repeat(2,minmax(0,1fr))}.pos-layout{grid-template-columns:1fr}.pos-summary-card{position:static}}@media(max-width:1100px){.layout{display:block}.sidebar{position:relative;height:auto;max-height:330px;border-right:0;border-bottom:1px solid #d8e6f4}.sidebar nav{display:grid;grid-template-columns:repeat(2,minmax(150px,1fr));gap:6px}.nav-section-title{grid-column:1/-1}.content{padding:18px}.grid-3,.grid-4,.form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.product-layout{grid-template-columns:1fr}.table-scroll-wrapper{max-height:68vh}}@media(max-width:720px){.content{padding:12px}.sidebar{padding:16px;max-height:280px}.sidebar nav{grid-template-columns:1fr}.grid-2,.grid-3,.grid-4,.form-grid,.form-grid-2,.billing-top-grid,.pos-toolbar-left{grid-template-columns:1fr!important}.topbar,.page-head,.line-items-toolbar{flex-direction:column;align-items:flex-start;gap:10px}.card{padding:14px}.toolbar input,.toolbar select{width:100%}.table-scroll-wrapper{max-height:64vh}.table th,.table td{font-size:13px;padding:9px 8px}.table{min-width:760px}.pos-billing-table,.billing-table{min-width:980px!important}.product-edit-table{min-width:980px!important}.product-list-table{min-width:920px!important}.login-card{width:calc(100vw - 28px)}}@media print{html,body{overflow:visible!important;background:#fff!important}.layout,.content,.card,.table-scroll-wrapper,.table-responsive,.scroll-x,.pos-table-wrap,.invoice-scroll-wrapper{display:block!important;overflow:visible!important;height:auto!important;max-height:none!important;box-shadow:none!important;border:0!important}.sidebar,.topbar,.footer-note,.no-print,.actions .btn{display:none!important}.table,.pos-billing-table,.billing-table,.product-edit-table,.product-list-table{min-width:0!important}.table th{position:static!important}.table th,.table td{white-space:normal!important;font-size:11px;padding:5px}}


/* V68 CLEAN CORE PATCH - old stacked bill overrides removed. */
html,body{height:100%;}
body{font-size:15px;line-height:1.45;}
.layout{height:100vh;overflow:hidden;}
.content{height:100vh;overflow:auto;scrollbar-gutter:stable;padding-bottom:36px;}
.topbar{position:relative;top:0;z-index:25;border:1px solid var(--border);}
.card{border:1px solid var(--border);}
.section-head,.list-topbar{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:14px;}
.table-scroll-wrapper,.table-responsive,.scroll-x,.invoice-scroll-wrapper{overflow:auto;-webkit-overflow-scrolling:touch;}
.modal-backdrop{overflow:auto;align-items:flex-start;padding:24px 12px;}
.modal-card{max-height:calc(100vh - 48px);overflow:auto;}
@media(max-width:980px){.content{padding-left:12px;padding-right:12px}.card{overflow:hidden}.toolbar .btn,.actions .btn{white-space:normal;text-align:center}}
@media(max-width:720px){input,select,textarea{font-size:16px}.modal-card{max-height:calc(100vh - 24px)}.modal-backdrop{padding:12px 8px}}
/* V68 Analytics clean layout */
.filter-bar{display:grid;grid-template-columns:150px 150px minmax(220px,1fr) auto;gap:10px;align-items:end;}
.filter-bar .form-group{gap:4px;}.filter-bar input,.filter-bar select{height:36px;padding:7px 9px;}
.kpi-grid{display:grid;grid-template-columns:repeat(5,minmax(150px,1fr));gap:12px;overflow-x:auto;padding-bottom:4px;}
.kpi-card{min-width:150px;padding:14px;}.kpi-value{font-size:22px;line-height:1.15;}
.two-col{display:grid;grid-template-columns:1fr;gap:16px;}.two-col>.grid{display:grid;grid-template-columns:1fr;gap:16px;}
.two-col .card{overflow:hidden;padding:16px;}.two-col .table-scroll-wrapper{overflow:auto;max-height:58vh;border-radius:12px;}.two-col .table{min-width:900px;}
@media(max-width:900px){.filter-bar{grid-template-columns:1fr 1fr}.filter-bar .form-group:last-child{grid-column:1/-1}.filter-bar .btn{width:100%}.kpi-grid{grid-template-columns:repeat(5,150px)}}
@media(max-width:620px){.filter-bar{grid-template-columns:1fr}}

/* V71 UI STABILITY PATCH - dashboard + reports + responsive sections */
.business-cloth_store .topbar{border-left:5px solid #db2777}
.nav-more{margin:8px 0 10px;background:#fff;border:1px solid #d8e6f4;border-radius:12px;padding:8px 10px;box-shadow:0 2px 6px rgba(15,47,87,.04)}
.nav-more summary{cursor:pointer;font-weight:800;color:#12324a}.nav-more a{margin-top:6px!important}
.stat-card{min-height:112px;display:flex;flex-direction:column;justify-content:center;border:1px solid var(--border);overflow:hidden}.stat-value{overflow-wrap:anywhere;line-height:1.15}.renewal-card{display:flex;justify-content:space-between;gap:16px;align-items:center;flex-wrap:wrap}
.category-pro-panel{margin-top:18px;background:linear-gradient(135deg,#0f172a,#0f766e);color:#fff;border-radius:20px;padding:18px;box-shadow:0 14px 36px rgba(15,23,42,.14);overflow:hidden}.category-pro-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;flex-wrap:wrap;margin-bottom:14px}.category-pro-head h2{margin:0 0 6px;font-size:22px}.category-pro-head p{margin:0;color:#dbeafe}.category-pro-badge{background:rgba(255,255,255,.16);border:1px solid rgba(255,255,255,.25);border-radius:999px;padding:7px 12px;font-weight:900;font-size:12px}.category-pro-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.category-pro-card{background:rgba(255,255,255,.11);border:1px solid rgba(255,255,255,.18);border-radius:16px;padding:14px;min-width:0}.category-pro-card.hot{background:rgba(255,255,255,.18)}.category-pro-card .k{font-size:12px;color:#cbd5e1;font-weight:800;text-transform:uppercase;letter-spacing:.04em}.category-pro-card .v{font-size:26px;font-weight:900;margin:7px 0;overflow-wrap:anywhere}.category-pro-card .h{font-size:12px;color:#e2e8f0;line-height:1.35}.category-pro-actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:14px}.category-pro-actions .btn.secondary{background:rgba(255,255,255,.18);border:1px solid rgba(255,255,255,.25)}
.dashboard-graphs{align-items:stretch}.chart-card{min-height:300px;overflow:hidden}.info-chip{display:inline-flex;align-items:center;padding:4px 9px;border-radius:999px;background:#eef2ff;color:#3730a3;font-size:12px;font-weight:800}.bar-chart{height:220px;display:flex;align-items:flex-end;gap:4px;padding:14px 4px 4px;border-radius:16px;background:linear-gradient(180deg,#f8fafc,#eef2ff);overflow:hidden}.bar-wrap{height:100%;flex:1;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;min-width:6px}.bar{width:100%;max-width:22px;min-height:3px;border-radius:9px 9px 3px 3px;background:linear-gradient(180deg,#2563eb,#0f766e);box-shadow:0 8px 18px rgba(37,99,235,.18)}.bar-wrap small{font-size:9px;color:#64748b;margin-top:5px;white-space:nowrap}.monthly .bar{background:linear-gradient(180deg,#7c3aed,#2563eb)}.yearly .bar{background:linear-gradient(180deg,#0f766e,#16a34a)}.compare-bars{height:240px;display:grid;grid-template-columns:repeat(3,1fr);gap:18px;align-items:end;text-align:center;background:#f8fafc;border-radius:16px;padding:18px}.compare-bars>div{height:100%;display:flex;flex-direction:column;justify-content:flex-end;gap:6px;align-items:center}.compare-bar{width:72px;min-height:16px;border-radius:14px 14px 4px 4px;background:#2563eb}.compare-bar.success{background:linear-gradient(180deg,#16a34a,#0f766e)}.compare-bar.danger{background:linear-gradient(180deg,#ef4444,#f97316)}.text-success{color:#15803d}.text-danger{color:#dc2626}
.table-scroll-wrapper .btn,.table-responsive .btn{white-space:nowrap}.search{max-width:320px}.nowrap{white-space:nowrap}.section-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}.toolbar{max-width:100%}.toolbar input,.toolbar select{min-width:150px}.product-search-bar{justify-content:flex-end}.product-upload-card .btn{width:100%}
@media(max-width:1280px){.category-pro-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:900px){.category-pro-panel{padding:14px}.category-pro-grid{grid-template-columns:1fr}.dashboard-graphs{grid-template-columns:1fr!important}.bar-chart{height:180px}.compare-bars{height:210px}.compare-bar{width:48px}.renewal-card{display:block}.renewal-card .actions{margin-top:12px}.toolbar{display:grid;grid-template-columns:1fr;align-items:stretch}.toolbar .btn,.toolbar input,.toolbar select{width:100%;max-width:none}.page-head .toolbar{width:100%;justify-content:stretch}.product-search-bar{justify-content:stretch}.stat-card{min-height:94px}.stat-value{font-size:24px}}
@media(max-width:720px){.category-pro-card .v{font-size:22px}.page-head .badge{max-width:100%;white-space:normal}.topbar{position:relative}.content{height:auto;min-height:100vh}.layout{height:auto;overflow:visible}}


/* V72 DASHBOARD UI FIX - clean aligned dashboard only */
.dashboard-page .content{
    background:linear-gradient(180deg,#f8fbff 0%,#eef2f7 55%,#eef2f7 100%);
}
.dashboard-page .page-head.dashboard-title,
.dashboard-page .page-head{
    background:#ffffff;
    border:1px solid #dbe5f0;
    border-radius:20px;
    padding:18px 20px;
    box-shadow:0 10px 28px rgba(15,23,42,.06);
    align-items:center;
}
.dashboard-page .page-head h1{font-size:28px;line-height:1.15;}
.dashboard-page .dashboard-stat-grid{
    grid-template-columns:repeat(auto-fit,minmax(210px,1fr)) !important;
    gap:16px;
}
.dashboard-page .stat-card{
    position:relative;
    overflow:hidden;
    min-height:118px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
    border:1px solid #dbeafe;
    background:linear-gradient(135deg,#ffffff 0%,#f8fbff 100%);
}
.dashboard-page .stat-card:before{
    content:"";
    position:absolute;
    width:92px;height:92px;right:-32px;top:-32px;
    border-radius:999px;
    background:rgba(15,118,110,.10);
}
.dashboard-page .dashboard-stat-grid-secondary .stat-card:before{background:rgba(29,78,216,.10);}
.dashboard-page .stat-label{
    position:relative;
    font-size:12px;
    text-transform:uppercase;
    letter-spacing:.05em;
    color:#64748b;
}
.dashboard-page .stat-value{
    position:relative;
    font-size:clamp(23px,3vw,32px);
    line-height:1.15;
    overflow-wrap:anywhere;
    color:#0f172a;
}
.dashboard-page .category-pro-panel{
    margin-top:18px;
    border:1px solid rgba(255,255,255,.28);
    background:linear-gradient(135deg,#0f172a 0%,#134e4a 55%,#0f766e 100%);
}
.dashboard-page .category-pro-grid{
    grid-template-columns:repeat(auto-fit,minmax(190px,1fr)) !important;
}
.dashboard-page .category-pro-card{
    min-height:118px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
}
.dashboard-page .category-pro-actions .btn{
    min-height:42px;
}
.dashboard-page .dashboard-detail-grid{
    grid-template-columns:repeat(auto-fit,minmax(280px,1fr)) !important;
}
.dashboard-page .dashboard-info-card p{
    margin:9px 0;
    overflow-wrap:anywhere;
}
.dashboard-page .topbar{
    flex-wrap:wrap;
}
@media(max-width:1100px){
    .dashboard-page .sidebar{max-height:none;}
    .dashboard-page .dashboard-stat-grid{grid-template-columns:repeat(2,minmax(0,1fr)) !important;}
}
@media(max-width:700px){
    .dashboard-page .dashboard-stat-grid,
    .dashboard-page .dashboard-detail-grid,
    .dashboard-page .category-pro-grid{grid-template-columns:1fr !important;}
    .dashboard-page .page-head{padding:14px;align-items:flex-start;}
    .dashboard-page .stat-card{min-height:100px;}
    .dashboard-page .category-pro-actions{display:grid;grid-template-columns:1fr;}
    .dashboard-page .category-pro-actions .btn{width:100%;white-space:normal;}
}
