
:root,.dark{--background:#f4f7fc;--foreground:#172440;--card:#ffffff;--card-foreground:#172440;--popover:#ffffff;--popover-foreground:#172440;--primary:#174bce;--primary-foreground:#ffffff;--secondary:#eaf0ff;--secondary-foreground:#174bce;--muted:#edf1f8;--muted-foreground:#647189;--accent:#eaf0ff;--accent-foreground:#174bce;--border:#dfe6f1;--input:#d2dbea;--ring:#174bce;--radius:.75rem}
*{box-sizing:border-box}body{margin:0;background:#f4f7fc;color:#172440;font-family:'Tahoma','Arial',sans-serif;font-size:16px;line-height:1.65}button,input,select{font:inherit}button,a,input,select{touch-action:manipulation}button{cursor:pointer}button:disabled{opacity:.5;cursor:not-allowed}button:focus-visible,a:focus-visible{outline:3px solid #7195ef;outline-offset:3px}h1,h2,h3,p{margin:0}h1{font-size:2rem;font-weight:700;line-height:1.45;letter-spacing:-.03em}h2{font-size:1.2rem;font-weight:700}h3{font-size:1rem;font-weight:700}p{color:#647189}small,.small{font-size:.875rem;color:#647189}a{color:inherit;text-decoration:none}.topbar{background:white;border-bottom:1px solid #dfe6f1;display:flex;align-items:center;justify-content:space-between;padding:20px max(24px,calc((100vw - 1200px)/2));gap:20px}.brand{display:flex;gap:12px;align-items:center;font-weight:700;font-size:1.25rem;white-space:nowrap}.brand small{display:block;font-size:.8rem;font-weight:400}.brand-icon{display:grid;place-items:center;width:44px;height:44px;background:#174bce;color:white;border-radius:13px}nav{display:flex;align-items:center;gap:6px}.nav{padding:10px 17px;border-radius:9px;color:#647189;font-size:.95rem;background:none;border:0}.nav.active{color:#174bce;background:#eaf0ff;font-weight:700}.icon-button{padding:10px;border:0;background:transparent;color:#647189}main{max-width:1200px;padding:32px 24px 70px;margin:auto;min-height:75vh}.breadcrumb{font-size:.875rem;color:#647189;margin-bottom:22px}.breadcrumb span{margin:0 12px;color:#a8b2c2}.page-title{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:30px}.page-title p{margin-top:6px}.primary,.secondary{border:1px solid transparent;padding:10px 17px;border-radius:9px;display:inline-flex;align-items:center;justify-content:center;gap:8px;font-size:.95rem;font-weight:700;min-height:44px}.primary{background:#174bce;color:white}.primary:hover{background:#103ba9}.secondary{background:white;color:#35445e;border-color:#dfe6f1}.text-button{background:none;border:0;color:#174bce;font-size:.9rem;padding:7px 0}.actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.round-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}.round-card{background:white;border:1px solid #dfe6f1;border-radius:16px;text-align:left;padding:24px;transition:transform .15s,box-shadow .15s}.round-card:hover{transform:translateY(-3px);box-shadow:0 12px 30px #174bce0c;border-color:#90afff}.round-card-top{display:flex;justify-content:space-between;color:#174bce;margin-bottom:22px}.round-card h2{font-size:1.35rem}.round-card p{margin-top:6px;font-size:.95rem}.round-bottom{display:flex;gap:20px;margin-top:22px;border-top:1px solid #eef1f7;padding-top:16px;font-size:.9rem;color:#647189}.badge{display:inline-block;font-size:.8rem;padding:4px 10px;border-radius:7px;font-weight:400;vertical-align:middle;white-space:nowrap;line-height:1.6;background:#edf1f8;color:#647189}.badge.open,.badge.approved{background:#e0f5ed;color:#08704a}.badge.pending{background:#fff0d4;color:#91580a}.badge.closed,.badge.cancelled{background:#eef0f4;color:#647189}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-bottom:28px}.stats article{background:white;border:1px solid #dfe6f1;border-radius:13px;padding:20px}.stats article:first-child{background:#174bce;color:white;border-color:#174bce}.stats span{display:flex;gap:8px;font-size:.9rem;color:#647189}.stats article:first-child span,.stats article:first-child small{color:#d5e2ff}.stats strong{display:block;font-size:1.9rem;font-weight:700;margin:13px 0 3px;line-height:1.4;word-break:break-word}.stats em{font-size:.875rem;margin-left:7px;font-weight:400;font-style:normal}.stats small{font-size:.8rem}.tab-list{background:transparent!important;padding:0!important;margin-bottom:15px;gap:6px!important;height:auto!important;flex-wrap:wrap}.tab-list button{font-size:.95rem!important;padding:11px 18px!important;border-radius:9px!important;min-height:44px}.tab-list button[data-state=active]{background:#e5edff!important;color:#174bce!important;box-shadow:none!important}.panel{background:white;border:1px solid #dfe6f1;border-radius:15px;padding:24px}.section-title{display:flex;align-items:center;justify-content:space-between;gap:15px;margin-bottom:24px}th{color:#647189!important;font-size:.875rem!important;height:48px!important;background:#f8faff}td{font-size:.95rem!important;padding:16px 8px!important}.product-name{display:flex;align-items:center;gap:12px;min-width:170px}.product-name img,.image-empty{width:52px;height:52px;border-radius:9px;object-fit:cover}.image-empty{display:grid;place-items:center;background:#edf1f8;color:#8e9db5}.left{color:#08704a}.out,.danger{color:#bb303d!important}.danger-bg{background:#bb303d}.empty{border:1px dashed #c9d5e9;background:#ffffff;border-radius:17px;padding:65px 24px;display:flex;align-items:center;flex-direction:column;text-align:center;gap:14px;color:#7a8bab}.empty h2,.empty h3{color:#172440}.empty .primary{margin-top:8px}.empty.compact{border:none;padding:36px 15px}.order-list{display:grid;grid-template-columns:repeat(2,1fr);gap:18px}.order-card{border:1px solid #dfe6f1;border-radius:12px;padding:20px}.order-title{display:flex;justify-content:space-between;gap:16px;margin-bottom:15px}.order-title .badge{margin-top:5px}.order-title strong{font-size:1.15rem}.order-line{display:flex;justify-content:space-between;gap:15px;padding:8px 0;font-size:.95rem}.order-actions{border-top:1px solid #eef1f7;margin-top:13px;padding-top:15px}.summary-pair{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:25px}.summary-pair>div{background:#f4f7fc;padding:20px;border-radius:12px;color:#647189}.summary-pair strong{display:block;color:#172440;font-size:1.5rem;margin-top:7px}.summary-row{display:grid;grid-template-columns:1fr 1fr auto;gap:16px;border-bottom:1px solid #eef1f7;padding:15px 0;font-size:.95rem}.summary-row>span:nth-child(2){color:#647189}.spaced{margin-top:28px}.login{max-width:430px;background:white;border:1px solid #dfe6f1;border-radius:18px;margin:40px auto;padding:32px}.login h1{font-size:1.6rem;margin-bottom:7px}.login p{font-size:.95rem;margin-bottom:22px}.login-icon{display:grid;place-items:center;background:#eaf0ff;color:#174bce;width:58px;height:58px;border-radius:16px;margin-bottom:20px}.login .primary{width:100%}.login>.text-button{display:block;margin:14px auto 0}label{display:block;font-size:.9rem;font-weight:700;margin-bottom:16px}input,select{display:block;margin-top:7px;width:100%;border:1px solid #cbd6e7;border-radius:9px;background:white;padding:10px 12px;color:#172440;min-height:45px}input:focus,select:focus{outline:2px solid #90afff;border-color:#174bce}input:disabled{background:#f0f3f8}.form-pair{display:grid;grid-template-columns:1fr 1fr;gap:16px}.full{width:100%}.app-dialog{max-width:480px!important;border-radius:16px!important;background:white!important;padding:26px!important;max-height:90vh;overflow-y:auto}.app-dialog form{margin-top:8px}.app-dialog p{margin-bottom:15px}.app-dialog h2{font-size:1.25rem!important}.upload{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;height:160px;background:#f2f6ff;border:1px dashed #a8bfed;border-radius:12px;color:#174bce;gap:8px;cursor:pointer}.upload img{width:100%;height:100%;object-fit:contain}.upload input{position:absolute;inset:0;opacity:0;cursor:pointer;height:100%;margin:0}.shop-layout{display:grid;grid-template-columns:minmax(0,1fr) 320px;gap:25px;align-items:start}.catalog{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}.catalog-card{background:white;border:1px solid #dfe6f1;border-radius:14px;overflow:hidden}.catalog-card>img{width:100%;aspect-ratio:4/3;object-fit:cover}.catalog-placeholder{aspect-ratio:4/3;display:flex;flex-direction:column;align-items:center;justify-content:center;background:#eaf0ff;color:#8aa3d6;gap:10px;font-size:.9rem}.catalog-body{padding:20px}.catalog-body h2{font-size:1.1rem}.price-row{display:flex;align-items:center;justify-content:space-between;margin:12px 0 18px;gap:10px}.price-row strong{color:#174bce;font-size:1.25rem}.price-row span{font-size:.85rem}.catalog-body label{margin-bottom:0}.catalog-body input{width:100%}.cart{background:white;border:1px solid #dfe6f1;border-radius:14px;padding:24px;position:sticky;top:20px}.cart h2{margin-bottom:20px}.cart>p{font-size:.9rem}.cart-total{display:flex;justify-content:space-between;gap:12px;border-top:1px solid #dfe6f1;margin-top:18px;padding:20px 0;align-items:center}.cart-total strong{color:#174bce;font-size:1.5rem}.cart .small{margin-top:12px}.order-status{border:1px solid #bad3ed;background:#edf5ff;border-radius:13px;padding:22px;margin-bottom:24px}.order-status h3{margin:8px 0}.order-status p{font-size:.95rem;margin-bottom:15px}.order-status .text-button{margin-left:15px}.message{background:#e5f5ed;border:1px solid #b7ddc9;border-radius:10px;padding:12px 16px;margin-bottom:20px;display:flex;justify-content:space-between;gap:15px;overflow-wrap:anywhere}.message.error{background:#fff0f1;border-color:#edc2c8;color:#9b2733}.message button{border:0;background:none;font-size:.875rem;text-decoration:underline;flex-shrink:0}footer{text-align:center;border-top:1px solid #dfe6f1;padding:24px;color:#8a97ad;font-size:.8rem}
@media(max-width:900px){.stats{grid-template-columns:repeat(2,1fr)}.round-grid{grid-template-columns:repeat(2,1fr)}.shop-layout{grid-template-columns:1fr}.cart{position:static}.order-list{grid-template-columns:1fr}.catalog{grid-template-columns:repeat(2,1fr)}}@media(max-width:600px){.topbar{padding:15px 16px;align-items:flex-start;flex-wrap:wrap;gap:15px}.brand small{font-size:.75rem}nav{width:100%;justify-content:flex-start}.nav{padding:8px 14px}main{padding:22px 16px 45px}h1{font-size:1.6rem}.page-title{align-items:flex-start;flex-direction:column;margin-bottom:22px}.page-title>.primary{width:100%}.round-grid{grid-template-columns:1fr}.stats{gap:10px}.stats article{padding:15px}.stats strong{font-size:1.5rem}.stats span{font-size:.8rem}.panel{padding:16px}.section-title{align-items:flex-start;flex-direction:column}.tab-list button{padding:9px 10px!important;font-size:.85rem!important}.catalog{grid-template-columns:1fr}.summary-row{grid-template-columns:1fr auto;gap:5px}.summary-row>span:nth-child(2){grid-column:1;font-size:.85rem}.summary-row b{grid-column:2;grid-row:1/3;align-self:center}.summary-pair{gap:10px}.summary-pair>div{padding:14px}.summary-pair strong{font-size:1.25rem}.login{padding:24px;margin:15px auto}.cart{padding:20px}.order-title{flex-wrap:wrap}.app-dialog{width:calc(100% - 28px)!important}}


.badge.sold-out{background:#ffe7e9;color:#ad2535;font-weight:700}.purchaser-list{display:block;min-width:140px;max-width:260px;white-space:normal;overflow-wrap:anywhere}

[hidden]{display:none!important}.table-wrap{overflow-x:auto}table{width:100%;border-collapse:collapse;text-align:left}th,td{border-bottom:1px solid #e5ebf5}dialog.app-dialog{border:1px solid #dfe6f1;width:min(480px,calc(100vw - 30px));margin:auto;color:#172440}dialog::backdrop{background:#17244080}.dialog-close{float:right;border:0;background:none;font-size:24px;padding:0 8px}.tab-list{display:flex;gap:8px}.tab-list button{border:0;background:transparent;border-radius:9px;color:#647189}.tab-list button[aria-selected=true]{background:#eaf0ff;color:#174bce;font-weight:bold}.catalog-card>img{display:block}.login p{margin-bottom:16px}.brand-icon{font-size:14px}#modal-error{margin-top:12px}#modal-body h2{margin-bottom:18px}


/* ===== HomeMade Bakery V6 Responsive Order Management ===== */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}body{overflow-x:hidden}img{max-width:100%}
.order-table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;border:1px solid #e5ebf5;border-radius:12px}
.order-table{min-width:980px;background:#fff}.order-table th,.order-table td{vertical-align:middle;padding:14px 12px!important}.order-table th{white-space:nowrap}.order-table tbody tr:last-child td{border-bottom:0}.order-table td:nth-child(1){min-width:130px}.order-table td:nth-child(2){min-width:310px}.order-table td:nth-child(3){min-width:90px}.order-table td:nth-child(4){min-width:115px}.order-table td:nth-child(5){min-width:105px}.order-table td:nth-child(6){min-width:210px}.order-items-inline{display:flex;gap:6px;flex-wrap:wrap}.order-item-chip{display:inline-flex;padding:4px 9px;border-radius:999px;background:#f2f5fa;color:#35445e;font-size:.84rem;white-space:nowrap}.order-total{color:#174bce;white-space:nowrap}.order-row-actions{flex-wrap:nowrap}.compact-btn{min-height:38px;padding:7px 12px}.order-toolbar p{margin-top:3px}
@media (max-width:900px){.topbar{position:relative}.page-title>.actions{width:100%}.page-title>.actions>*{flex:1 1 auto}.order-table{min-width:850px}.catalog-card>img,.catalog-placeholder{aspect-ratio:16/10}.shop-layout{gap:18px}}
@media (max-width:600px){body{font-size:15px}.topbar{padding:12px 14px}.brand-icon{width:40px;height:40px}.brand{font-size:1.1rem}nav{overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:2px}.nav{white-space:nowrap;min-height:42px}main{padding:18px 12px 38px}.page-title>.actions{display:grid;grid-template-columns:1fr 1fr}.page-title>.actions>*{width:100%;min-height:44px}.stats{grid-template-columns:1fr 1fr}.stats article{min-width:0}.stats strong{font-size:1.25rem}.stats span{line-height:1.35}.panel{padding:12px}.order-table-wrap{border:0;overflow:visible}.order-table{min-width:0;display:block;background:transparent}.order-table thead{display:none}.order-table tbody{display:grid;gap:12px}.order-table tr{display:grid;grid-template-columns:1fr auto;background:#fff;border:1px solid #dfe6f1;border-radius:12px;padding:14px}.order-table td{display:grid!important;grid-template-columns:92px minmax(0,1fr);gap:8px;border:0!important;padding:6px 0!important;min-width:0!important;align-items:start}.order-table td:before{content:attr(data-label);color:#647189;font-size:.82rem;font-weight:400}.order-table td:nth-child(1){grid-column:1/-1;border-bottom:1px solid #eef1f7!important;padding-bottom:10px!important;margin-bottom:2px}.order-table td:nth-child(1):before{display:none}.order-table td:nth-child(4){grid-column:1/-1}.order-table td:nth-child(6){grid-column:1/-1;border-top:1px solid #eef1f7!important;padding-top:11px!important;margin-top:3px}.order-items-inline{gap:5px}.order-item-chip{white-space:normal}.order-row-actions{flex-wrap:wrap}.order-row-actions .primary,.order-row-actions .text-button{min-height:40px;padding:8px 12px}.catalog-body{padding:16px}.catalog-card>img,.catalog-placeholder{aspect-ratio:4/3}.cart{padding:16px}.form-pair{grid-template-columns:1fr}.message{padding:10px 12px}}
@media (max-width:380px){.stats{grid-template-columns:1fr}.page-title>.actions{grid-template-columns:1fr}.summary-pair{grid-template-columns:1fr}.order-table td{grid-template-columns:78px minmax(0,1fr)}}
@media (orientation:landscape) and (max-height:600px){main{padding-top:16px}.topbar{padding-top:10px;padding-bottom:10px}.catalog{grid-template-columns:repeat(2,minmax(0,1fr))}.shop-layout{grid-template-columns:minmax(0,1fr) 300px}.cart{position:sticky;top:10px}.order-table-wrap{overflow-x:auto}.order-table{min-width:850px;display:table}.order-table thead{display:table-header-group}.order-table tbody{display:table-row-group}.order-table tr{display:table-row;padding:0;border:0}.order-table td{display:table-cell!important;padding:12px 10px!important;border-bottom:1px solid #e5ebf5!important}.order-table td:before{display:none}.order-table td:nth-child(n){min-width:initial;grid-column:auto}.order-row-actions{flex-wrap:nowrap}}

/* HomeMade Bakery V7 — Owner Finance */
.finance-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin:0 0 22px}
.finance-stats article{background:#fff;border:1px solid #dce5f4;border-radius:16px;padding:18px}
.finance-stats span{display:block;color:#64748b;font-size:.9rem;margin-bottom:8px}
.finance-stats strong{font-size:1.55rem;color:#0f2747}
.finance-note{margin-top:16px}
@media(max-width:900px){.finance-stats{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:520px){.finance-stats{grid-template-columns:1fr}.finance-stats article{padding:14px}}

/* HomeMade Bakery V8 Finance Dashboard */
.finance-five{grid-template-columns:repeat(5,minmax(0,1fr))}
.finance-heading{margin-top:28px}
@media(max-width:1100px){.finance-five{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:760px){.finance-five{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:520px){.finance-five{grid-template-columns:1fr}}

/* HomeMade Bakery V8.3 date range */
.finance-filter{display:flex;gap:12px;align-items:end;flex-wrap:wrap;margin:4px 0 22px;padding:16px;border:1px solid var(--line,#dbe4f2);border-radius:14px;background:#f8fbff}
.finance-filter label{display:grid;gap:6px;min-width:170px}
.finance-filter input{min-height:42px}
.finance-presets{display:flex;gap:8px;flex-wrap:wrap}
@media(max-width:700px){
  .finance-filter{display:grid;grid-template-columns:1fr 1fr;align-items:end}
  .finance-filter label{min-width:0}
  .finance-presets{grid-column:1/-1}
}
@media(max-width:480px){
  .finance-filter{grid-template-columns:1fr}
  .finance-presets{grid-column:auto}
  .finance-filter>button{width:100%}
}

/* HomeMade Bakery V9 Dashboard */
.dashboard-kpis{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px;margin:0 0 24px}
.dashboard-kpis article{background:#fff;border:1px solid var(--line,#dbe4f2);border-radius:16px;padding:18px}
.dashboard-kpis span{display:block;color:#60708a;margin-bottom:12px}
.dashboard-kpis strong{font-size:1.55rem}
.dashboard-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.dashboard-grid section{min-width:0}
.stock-alert{color:#c62828;font-weight:700}.stock-warn{color:#9a6700;font-weight:700}.stock-ok{color:#087443;font-weight:700}
@media(max-width:1050px){.dashboard-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:760px){.dashboard-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.dashboard-grid{grid-template-columns:1fr}}
@media(max-width:480px){.dashboard-kpis{grid-template-columns:1fr}}

/* HomeMade Bakery V9.2 Summary round selector */
.summary-round-filter{display:flex;align-items:end;gap:12px;margin:0 0 18px;padding:14px 16px;background:#f8fbff;border:1px solid var(--line,#dbe4f2);border-radius:14px}
.summary-round-filter label{display:grid;gap:6px;min-width:280px;font-weight:600}
.summary-round-filter select{min-height:42px}
@media(max-width:600px){.summary-round-filter label{min-width:0;width:100%}}

/* HomeMade Bakery V9.3 — admin round picker */
.admin-round-picker{display:flex;gap:10px;align-items:end;flex-wrap:wrap;margin-bottom:10px}
.admin-round-picker label{display:grid;gap:5px;min-width:260px;font-size:.85rem;color:#60708a}
.admin-round-picker select{min-height:42px}
@media(max-width:600px){.admin-round-picker{display:grid;grid-template-columns:1fr}.admin-round-picker label{min-width:0;width:100%}}

/* HomeMade Bakery V10 — simplified round workflow */
.round-summary-kpis{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:14px;margin:0 0 22px}
.round-summary-kpis article{background:#f8fbff;border:1px solid var(--line,#dbe4f2);border-radius:16px;padding:17px}
.round-summary-kpis span{display:block;color:#60708a;margin-bottom:10px}
.round-summary-kpis strong{font-size:1.35rem}
@media(max-width:1000px){.round-summary-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:650px){.round-summary-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:420px){.round-summary-kpis{grid-template-columns:1fr}}

/* HomeMade Bakery V10.1 — scalable round hub */
.round-hub-head{display:flex;justify-content:space-between;align-items:flex-start;gap:18px;margin:0 0 22px}
.round-hub-head h1{margin:0 0 6px}
.round-hub-head p{margin:0;color:#60708a}
.round-hub-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:20px}
.round-hub-kpis article{background:#fff;border:1px solid var(--line,#dbe4f2);border-radius:16px;padding:18px}
.round-hub-kpis span{display:block;color:#60708a;margin-bottom:9px}
.round-hub-kpis strong{font-size:1.35rem}
.round-list-panel{padding:20px}
.round-list-table td,.round-list-table th{vertical-align:middle}
.latest-label{display:inline-block;margin-left:8px;padding:3px 7px;border-radius:999px;background:#e9f8f1;color:#087b54;font-weight:600}
.history-status{color:#718096;font-size:.9rem}
.round-pagination{display:flex;align-items:center;justify-content:center;gap:14px;padding-top:18px}
@media(max-width:850px){
 .round-hub-head{flex-direction:column}
 .round-hub-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
 .round-list-panel{padding:14px}
}
@media(max-width:520px){
 .round-hub-kpis{grid-template-columns:1fr 1fr}
 .round-hub-head .actions{width:100%}
 .round-hub-head .actions button{flex:1}
}

/* HomeMade Bakery V10.2 — polished all-sales report */
.sales-report-head{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;margin:0 0 20px}
.sales-report-head h1{margin:8px 0 4px;font-size:2rem}
.sales-report-head p{margin:0;color:#66758d}
.report-back{border:0;background:transparent;padding:0;color:#1f55d5;cursor:pointer}
.report-range-badge{background:#eef4ff;border:1px solid #d7e3fb;border-radius:12px;padding:10px 14px;color:#52647e}
.sales-report-panel{background:#fff;border:1px solid var(--line,#dbe4f2);border-radius:20px;padding:24px}
.sales-date-filter{display:flex;align-items:end;gap:12px;padding:16px;background:#f8fbff;border:1px solid #dce6f4;border-radius:16px;margin-bottom:22px}
.sales-date-filter .filter-title{display:grid;gap:3px;margin-right:auto}
.sales-date-filter .filter-title span{font-size:.82rem;color:#718096}
.sales-date-filter label{display:grid;gap:6px;font-weight:600}
.sales-date-filter input{min-height:42px}
.date-arrow{padding-bottom:11px;color:#8290a6}
.sales-kpis{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin-bottom:30px}
.sales-kpis article{min-width:0;border:1px solid #dce5f2;border-radius:16px;padding:18px;background:#fff}
.sales-kpis article span{display:block;color:#63738b;margin-bottom:10px}
.sales-kpis article strong{display:block;font-size:1.55rem;white-space:nowrap;margin-bottom:8px}
.sales-kpis article small{display:block;color:#8490a3;line-height:1.35}
.sales-kpis .hero{background:#f5f8ff;border-color:#cfdcf7}
.sales-kpis .net{background:#f2fbf7;border-color:#d1ecdf}
.report-table-head{display:flex;justify-content:space-between;align-items:end;margin:0 0 10px}
.report-table-head h2{margin:0 0 3px;font-size:1.15rem}
.report-table-head p{margin:0;color:#78869a;font-size:.9rem}
.sales-report-table th{white-space:nowrap}
.sales-report-table .num{text-align:right;font-variant-numeric:tabular-nums}
.sales-report-table tbody tr:hover{background:#fafcff}
.sales-report-table tfoot td{border-top:2px solid #dbe4f2;background:#f8fafc}
.sales-report-table .net-value{font-size:1.03rem}
.report-empty{display:grid;gap:4px;text-align:center;padding:32px;color:#77859a}
.report-empty b{color:#25344d}
@media(max-width:1000px){.sales-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}.sales-date-filter{flex-wrap:wrap}.sales-date-filter .filter-title{width:100%;margin-bottom:4px}}
@media(max-width:650px){.sales-report-head{align-items:flex-start;flex-direction:column}.report-range-badge{width:100%}.sales-report-panel{padding:14px}.sales-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.sales-date-filter label{flex:1;min-width:130px}.date-arrow{display:none}.sales-date-filter button{width:100%}}
@media(max-width:420px){.sales-kpis{grid-template-columns:1fr}}

/* HomeMade Bakery V10.3 — clean round header controls */
.round-control-bar{display:flex;justify-content:space-between;align-items:end;gap:16px;margin:0 0 22px;padding:14px 16px;background:#fff;border:1px solid var(--line,#dbe4f2);border-radius:16px}
.round-selector-block{display:grid;gap:6px;min-width:300px}
.control-label{font-size:.82rem;color:#687890;font-weight:600}
.round-selector-block select{min-height:44px;background:#fff}
.round-nav-actions{display:flex;gap:8px;flex-wrap:wrap}
.round-nav-actions button{min-height:42px}
.round-title-row{display:flex;justify-content:space-between;align-items:center;gap:18px;margin-bottom:20px}
.round-title-line{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.round-title-line h1{margin:0;font-size:2rem}
.round-title-row p{margin:6px 0 0;color:#66758d}
.round-manage-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;justify-content:flex-end}
.round-manage-actions button{min-height:42px}
.round-tabs{margin-top:18px}
@media(max-width:850px){
 .round-control-bar,.round-title-row{align-items:stretch;flex-direction:column}
 .round-selector-block{min-width:0;width:100%}
 .round-nav-actions,.round-manage-actions{justify-content:flex-start}
}
@media(max-width:520px){
 .round-nav-actions,.round-manage-actions{display:grid;grid-template-columns:1fr 1fr;width:100%}
 .round-nav-actions button,.round-manage-actions button{width:100%}
 .round-title-line h1{font-size:1.65rem}
}

/* HomeMade Bakery V10.4 — balanced report date filter */
.sales-date-filter{
  display:grid;
  grid-template-columns:minmax(210px,1fr) 165px 20px 165px 96px;
  align-items:end;
  gap:12px;
  padding:18px 20px;
  margin-bottom:22px;
  background:#f8fbff;
  border:1px solid #dce6f4;
  border-radius:16px;
}
.sales-date-filter .filter-title{
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-self:center;
  gap:4px;
  margin:0;
  padding-right:18px;
}
.sales-date-filter .filter-title b{font-size:1rem}
.sales-date-filter .filter-title span{font-size:.82rem;color:#718096}
.sales-date-filter label{
  display:grid;
  grid-template-rows:auto 44px;
  gap:7px;
  font-weight:600;
  margin:0;
}
.sales-date-filter input{
  width:100%;
  min-width:0;
  height:44px;
  box-sizing:border-box;
}
.sales-date-filter .date-arrow{
  display:flex;
  height:44px;
  align-items:center;
  justify-content:center;
  padding:0;
  color:#8795aa;
}
.sales-date-filter button{
  width:96px;
  height:44px;
  align-self:end;
  margin:0;
}
@media(max-width:900px){
  .sales-date-filter{
    grid-template-columns:1fr 1fr 20px 1fr;
  }
  .sales-date-filter .filter-title{grid-column:1/-1;padding:0 0 4px}
  .sales-date-filter button{grid-column:4;width:100%}
}
@media(max-width:650px){
  .sales-date-filter{display:grid;grid-template-columns:1fr 1fr;gap:12px;padding:16px}
  .sales-date-filter .filter-title{grid-column:1/-1}
  .sales-date-filter .date-arrow{display:none}
  .sales-date-filter label{min-width:0}
  .sales-date-filter button{grid-column:1/-1;width:100%}
}
@media(max-width:430px){
  .sales-date-filter{grid-template-columns:1fr}
  .sales-date-filter .filter-title,.sales-date-filter button{grid-column:1}
}

/* HomeMade Bakery V10.5 — unified UI polish, no business-logic changes */
:root{
  --hc-radius:16px;
  --hc-soft:#f7faff;
  --hc-muted:#687890;
  --hc-line:#dce5f2;
}
.panel{border-radius:var(--hc-radius);box-shadow:0 1px 2px rgba(24,55,95,.025)}
.panel>h2:first-child,.section-title h2{letter-spacing:-.01em}
.stats{gap:14px}
.stats article{border-radius:var(--hc-radius);padding:18px 20px;min-height:112px;display:flex;flex-direction:column;justify-content:center}
.stats article span{color:var(--hc-muted);margin-bottom:9px}
.stats article strong{font-variant-numeric:tabular-nums;letter-spacing:-.02em}
.tab-list{gap:6px;padding:4px;background:#f4f7fc;border-radius:14px;width:max-content;max-width:100%}
.tab-list button{border-radius:10px;min-height:42px;padding:0 16px}
.tab-list button[aria-selected="true"]{background:#fff;box-shadow:0 1px 4px rgba(33,65,110,.08)}
table{border-collapse:separate;border-spacing:0;width:100%}
thead th{background:#f6f8fc;color:#53647d;font-size:.9rem;font-weight:600}
th,td{padding-top:14px;padding-bottom:14px}
tbody tr:last-child td{border-bottom:0}
.table-wrap{border-radius:12px;overflow-x:auto}
button,.button{transition:transform .12s ease,box-shadow .12s ease,background .12s ease}
button:not(:disabled):active,.button:not(:disabled):active{transform:translateY(1px)}
.empty{border-radius:16px}
.small{color:var(--hc-muted)}
/* Products: clearer separation between stock/order information */
.product-row,.product-card{border-radius:14px}
.product-row img,.product-card img{border-radius:10px}
/* Orders: one order = one visually readable horizontal unit */
.order-row,.order-card{border-radius:14px}
.order-status{white-space:nowrap}
/* Round summary / finance: consistent numeric hierarchy */
.summary-grid strong,.finance-grid strong,.sales-kpis strong{font-variant-numeric:tabular-nums}
.num{font-variant-numeric:tabular-nums}
/* Mobile keeps controls usable rather than cramped */
@media(max-width:700px){
 .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
 .stats article{min-height:96px;padding:14px}
 .tab-list{width:100%;overflow-x:auto;justify-content:flex-start}
 .tab-list button{white-space:nowrap}
 .panel{padding:14px}
}
@media(max-width:420px){
 .stats{grid-template-columns:1fr 1fr}
 .stats article strong{font-size:1.35rem}
}

/* HomeMade Bakery V10.8 — customer order link UX */
.round-manage-actions button[data-action="customer-link"]{
  border-color:#bfd0f3;
  background:#f7faff;
  color:#174bbd;
}
.round-manage-actions button[data-action="customer-link"]:hover{
  background:#eef4ff;
}

/* HomeMade Bakery V10.9 — customer mobile ordering UX */
.qty-label{font-weight:600;margin:14px 0 7px}
.qty-stepper{display:grid;grid-template-columns:44px minmax(70px,1fr) 44px;gap:8px;align-items:center}
.qty-stepper input{height:44px;text-align:center;font-weight:700;font-size:1rem;margin:0;-moz-appearance:textfield}
.qty-stepper input::-webkit-outer-spin-button,.qty-stepper input::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
.qty-btn{height:44px;border:1px solid #cfdcf0;border-radius:10px;background:#f7faff;color:#174bbd;font-size:1.3rem;font-weight:700;padding:0}
.qty-btn:not(:disabled):hover{background:#edf3ff}
.catalog-card{overflow:hidden}
.catalog-body{padding-bottom:18px}
.cart{border-radius:16px}
@media(max-width:760px){
 .shop-layout{display:block}
 .catalog{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 .catalog-card h2{font-size:1.05rem}
 .catalog-card .price-row{align-items:flex-start;gap:6px}
 .cart{position:static;margin-top:16px}
}
@media(max-width:480px){
 .catalog{grid-template-columns:1fr}
 .catalog-card{display:grid;grid-template-columns:42% 58%}
 .catalog-card>img,.catalog-card>.catalog-placeholder{height:100%;min-height:210px;object-fit:cover}
 .catalog-body{padding:14px}
 .qty-stepper{grid-template-columns:42px 1fr 42px}
}

/* HomeMade Bakery V10.10 — clean customer mode */
body.customer-mode .topbar nav{display:none!important}
body.customer-mode .topbar{
  justify-content:center;
}
body.customer-mode .brand{
  pointer-events:none;
  cursor:default;
}
body.customer-mode footer{
  text-align:center;
}
@media(max-width:700px){
 body.customer-mode .topbar{padding-left:16px;padding-right:16px}
 body.customer-mode .brand{margin:auto}
}


/* V10.11 — Customer desktop layout: 3 products in one row + order panel */
@media (min-width:1180px){
  body.customer-mode .shop-layout{grid-template-columns:minmax(0,1fr) 300px;gap:22px}
  body.customer-mode .catalog{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
  body.customer-mode .catalog-body{padding:16px}
  body.customer-mode .catalog-card>img,
  body.customer-mode .catalog-placeholder{aspect-ratio:4/3}
  body.customer-mode .cart{padding:20px}
}

/* HomeMade Bakery V10.16 — Payment summary / PromptPay */
.payment-badge{display:inline-flex;align-items:center;padding:6px 10px;border-radius:999px;font-size:.82rem;font-weight:700;white-space:nowrap}.payment-badge.paid{background:#e2f6ed;color:#08784e}.payment-badge.unpaid{background:#fff4d6;color:#936100}.success-btn{background:#0b8a5a!important;color:#fff!important;border-color:#0b8a5a!important}.payment-order-table{min-width:1180px}.payment-card{background:#fff;border:1px solid #dce5f2;border-radius:20px;padding:26px;max-width:520px;margin:8px auto;color:#13213b}.pay-brand{display:flex;align-items:center;gap:12px;padding-bottom:18px;border-bottom:1px solid #e5ebf5}.pay-brand .brand-icon{display:grid;place-items:center;width:44px;height:44px;border-radius:12px;background:#1f53d5;color:#fff}.pay-brand b{display:block;font-size:1.25rem}.pay-brand small{display:block;color:#687890;margin-top:2px}.pay-meta{padding:18px 0 10px}.pay-meta h2{margin:0 0 4px!important}.pay-meta p{margin:0;color:#687890}.pay-lines{border-top:1px solid #edf1f7;border-bottom:1px solid #edf1f7;padding:10px 0}.pay-line{display:flex;justify-content:space-between;gap:20px;padding:7px 0}.pay-total{display:flex;justify-content:space-between;align-items:center;padding:18px 0}.pay-total strong{font-size:1.75rem;color:#174bce}.pay-qr-wrap{background:#f7f9fd;border-radius:16px;padding:20px;text-align:center}.payment-qr{width:240px;height:240px;margin:0 auto 14px;background:#fff;padding:8px;border-radius:10px}.payment-qr img,.payment-qr canvas{display:block!important;width:224px!important;height:224px!important}.pay-recipient{display:flex;flex-direction:column;gap:3px}.pay-recipient strong{font-size:1.2rem}.pay-recipient span{color:#53647d}.pay-note{text-align:center;color:#687890;font-size:.88rem;margin:14px 0 0}.payment-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}.payment-actions button{flex:1 1 145px}.app-dialog:has(.payment-card){width:min(620px,calc(100vw - 24px))}@media(max-width:600px){.payment-card{padding:18px 14px;border-radius:16px}.payment-qr{width:220px;height:220px}.payment-qr img,.payment-qr canvas{width:204px!important;height:204px!important}.pay-total strong{font-size:1.5rem}.payment-actions{display:grid;grid-template-columns:1fr}.payment-actions button{width:100%}}


/* HomeMade Bakery V10.17 — Fullscreen payment summary, desktop + mobile */
.app-dialog:has(.payment-shell){
  width:min(980px,calc(100vw - 28px));
  height:min(760px,calc(100dvh - 28px));
  max-width:none;max-height:none;
  padding:0!important;margin:auto;border:0;border-radius:20px;
  overflow:hidden;background:#fff;box-shadow:0 24px 70px rgba(15,35,70,.25)
}
.app-dialog:has(.payment-shell) #modal-body{height:100%;overflow:hidden}
.app-dialog:has(.payment-shell) .dialog-close{position:absolute;z-index:20;right:15px;top:12px;width:36px;height:36px;border:0;background:transparent;font-size:1.8rem;line-height:1;color:#16233d}
.app-dialog:has(.payment-shell)::backdrop{background:rgba(20,34,57,.48)}
.payment-shell{height:100%;display:grid;grid-template-rows:minmax(0,1fr) 62px;background:#fff}
.payment-card-v17{max-width:none!important;margin:0!important;padding:22px 26px 14px!important;border:0!important;border-radius:0!important;display:grid;grid-template-columns:minmax(0,1.42fr) minmax(300px,.9fr);gap:24px;min-height:0;overflow:hidden}
.pay-order-panel,.pay-promptpay-panel{min-width:0;min-height:0}
.pay-order-panel{display:flex;flex-direction:column}
.payment-card-v17 .pay-brand{padding:0 0 14px;border-bottom:1px solid #e4eaf4;flex:0 0 auto}
.payment-card-v17 .pay-brand .brand-icon{width:42px;height:42px}
.payment-card-v17 .pay-brand b{font-size:1.35rem}
.pay-customer{display:flex;align-items:center;gap:12px;padding:14px 0 10px;flex:0 0 auto}
.pay-avatar{width:42px;height:42px;border-radius:50%;display:grid;place-items:center;background:#f6dce9;color:#7c3157;font-weight:800;font-size:1.1rem}
.pay-customer h2{margin:0 0 2px!important;font-size:1.35rem}.pay-customer p{margin:0;color:#63738b;font-size:.9rem}
.pay-section-title{margin:8px 0 8px;font-size:1rem}
.pay-items-table{border:1px solid #e4eaf4;border-radius:12px;overflow:hidden;min-height:0;display:flex;flex-direction:column}
.pay-item-head,.pay-item-row{display:grid;grid-template-columns:minmax(0,1.7fr) 62px 86px 90px;align-items:center;gap:8px}
.pay-item-head{background:#eef5ff;color:#52647d;font-size:.78rem;font-weight:700;padding:9px 12px}
.pay-item-list{min-height:0;overflow:hidden}
.pay-item-row{padding:9px 12px;border-top:1px solid #edf1f7;font-size:.86rem}.pay-item-row:first-child{border-top:0}
.pay-item-qty,.pay-item-price,.pay-item-sum{text-align:right;font-variant-numeric:tabular-nums}.pay-item-sum{font-weight:800}
.pay-grand-total{display:grid;grid-template-columns:1fr auto auto;align-items:center;gap:20px;padding:14px 4px 10px;border-top:1px solid #e4eaf4;margin-top:10px}.pay-grand-total span{font-weight:700}.pay-grand-total strong{font-size:1.65rem;color:#1450db}
.pay-info-note{margin-top:auto;background:#eef7ff;border-radius:12px;padding:11px 13px;display:grid;gap:2px;color:#53647d;font-size:.82rem}.pay-info-note b{color:#1761ba}
.pay-promptpay-panel{background:#f5f9ff;border-radius:16px;padding:14px;display:flex;flex-direction:column}
.promptpay-title{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:10px}.promptpay-title>b{font-size:1rem}.promptpay-title>span{border:1px solid #194e82;padding:3px 8px;font-weight:800;color:#194e82;background:#fff}
.scb-pay-card{background:#fff;border-radius:14px;overflow:hidden;display:flex;flex-direction:column;align-items:center;min-height:0;flex:1;border:1px solid #e2e8f2}
.scb-head{width:100%;height:48px;display:flex;align-items:center;justify-content:center;gap:5px;background:#5a3592;color:#fff;font-size:1.55rem;font-weight:800;letter-spacing:.03em}.scb-head span{color:#ffbf27}
.payment-card-v17 .payment-qr{width:188px;height:188px;padding:6px;margin:12px auto 7px;border-radius:8px;flex:0 0 auto}
.payment-card-v17 .payment-qr img,.payment-card-v17 .payment-qr canvas{width:176px!important;height:176px!important;display:block!important}
.payment-card-v17 .pay-recipient{gap:1px;text-align:center}.payment-card-v17 .pay-recipient small{color:#687890;font-size:.72rem}.payment-card-v17 .pay-recipient b{font-size:1rem}.payment-card-v17 .pay-recipient strong{font-size:1.12rem}
.pay-amount{width:calc(100% - 28px);display:flex;align-items:center;justify-content:space-between;border-top:1px solid #dfe6f0;margin-top:9px;padding:9px 0 0}.pay-amount span{font-weight:700}.pay-amount strong{font-size:1.55rem;color:#1450db}
.scb-pay-card>p{margin:7px 8px 9px;color:#728098;font-size:.68rem;text-align:center}
.payment-actions-v17{height:62px;margin:0!important;padding:8px 26px 12px;display:grid!important;grid-template-columns:1fr 1fr 1fr;gap:10px;border-top:1px solid #e4eaf4;background:#fff}
.payment-actions-v17 button{width:100%;height:42px;margin:0!important;min-width:0}

@media(max-width:720px){
 .app-dialog:has(.payment-shell){width:calc(100vw - 12px);height:calc(100dvh - 12px);border-radius:16px}
 .app-dialog:has(.payment-shell) .dialog-close{right:8px;top:7px;width:32px;height:32px;font-size:1.5rem}
 .payment-shell{grid-template-rows:minmax(0,1fr) 54px}
 .payment-card-v17{padding:12px 12px 8px!important;grid-template-columns:1fr;grid-template-rows:auto minmax(0,1fr);gap:8px}
 .payment-card-v17 .pay-brand{padding:0 34px 8px 0}.payment-card-v17 .pay-brand .brand-icon{width:34px;height:34px;border-radius:9px}.payment-card-v17 .pay-brand b{font-size:1.05rem}.payment-card-v17 .pay-brand small{font-size:.72rem}
 .pay-customer{padding:8px 0 5px}.pay-avatar{width:32px;height:32px;font-size:.9rem}.pay-customer h2{font-size:1.05rem!important}.pay-customer p{font-size:.74rem}
 .pay-section-title{display:none}.pay-items-table{border-radius:9px}.pay-item-head{display:none}.pay-item-row{grid-template-columns:minmax(0,1fr) auto;padding:5px 8px;font-size:.74rem}.pay-item-qty,.pay-item-price{display:none}.pay-item-sum{text-align:right}
 .pay-grand-total{padding:7px 2px 4px;margin-top:5px;gap:8px;font-size:.78rem}.pay-grand-total strong{font-size:1.18rem}
 .pay-info-note{display:none}
 .pay-promptpay-panel{padding:7px;border-radius:12px;min-height:0}.promptpay-title{margin-bottom:5px}.promptpay-title>b{font-size:.8rem}.promptpay-title>span{font-size:.68rem;padding:2px 5px}
 .scb-head{height:31px;font-size:1.05rem}
 .payment-card-v17 .payment-qr{width:min(37dvh,164px);height:min(37dvh,164px);padding:5px;margin:6px auto 3px}
 .payment-card-v17 .payment-qr img,.payment-card-v17 .payment-qr canvas{width:calc(min(37dvh,164px) - 10px)!important;height:calc(min(37dvh,164px) - 10px)!important}
 .payment-card-v17 .pay-recipient small{font-size:.6rem}.payment-card-v17 .pay-recipient b{font-size:.78rem}.payment-card-v17 .pay-recipient strong{font-size:.88rem}
 .pay-amount{margin-top:4px;padding-top:4px;width:calc(100% - 18px);font-size:.72rem}.pay-amount strong{font-size:1.05rem}.scb-pay-card>p{font-size:.55rem;margin:3px 4px 5px}
 .payment-actions-v17{height:54px;padding:6px 10px 8px;gap:6px}.payment-actions-v17 button{height:38px;padding:0 6px;font-size:.74rem}
}
@media(max-width:390px){
 .payment-card-v17{padding:10px 9px 6px!important}.pay-item-row{font-size:.7rem}.payment-card-v17 .payment-qr{width:min(34dvh,148px);height:min(34dvh,148px)}.payment-card-v17 .payment-qr img,.payment-card-v17 .payment-qr canvas{width:calc(min(34dvh,148px) - 10px)!important;height:calc(min(34dvh,148px) - 10px)!important}
}
@media(max-height:650px) and (min-width:721px){
 .app-dialog:has(.payment-shell){height:calc(100dvh - 12px)}.payment-card-v17{padding-top:12px!important;padding-bottom:8px!important}.payment-card-v17 .payment-qr{width:160px;height:160px}.payment-card-v17 .payment-qr img,.payment-card-v17 .payment-qr canvas{width:148px!important;height:148px!important}.pay-info-note{display:none}.pay-item-row{padding-top:6px;padding-bottom:6px}
}


/* ============================================================
   V10.36 — V10.17 VISUAL BASE + V10.35 FUNCTION COMPATIBILITY
   Targeted fix: Admin Order page must fit without horizontal scroll.
   ============================================================ */

html, body { max-width:100%; overflow-x:hidden; }
*, *::before, *::after { box-sizing:border-box; }

/* Admin order table: use available viewport, never push actions off-screen */
#ordersPanel,
.orders-panel,
.orders-wrap,
.orders-table-wrap,
.table-wrap {
  width:100% !important;
  max-width:100% !important;
  min-width:0 !important;
}

/* Desktop order table */
@media (min-width: 901px) {
  #ordersPanel table,
  .orders-table {
    width:100% !important;
    max-width:100% !important;
    table-layout:fixed !important;
    border-collapse:collapse;
  }

  #ordersPanel th,
  #ordersPanel td,
  .orders-table th,
  .orders-table td {
    min-width:0 !important;
    overflow-wrap:anywhere;
    word-break:normal;
    vertical-align:middle;
  }

  /* compact proportional columns */
  #ordersPanel th:nth-child(1), #ordersPanel td:nth-child(1),
  .orders-table th:nth-child(1), .orders-table td:nth-child(1) { width:11% !important; }

  #ordersPanel th:nth-child(2), #ordersPanel td:nth-child(2),
  .orders-table th:nth-child(2), .orders-table td:nth-child(2) { width:29% !important; }

  #ordersPanel th:nth-child(3), #ordersPanel td:nth-child(3),
  .orders-table th:nth-child(3), .orders-table td:nth-child(3) { width:8% !important; }

  #ordersPanel th:nth-child(4), #ordersPanel td:nth-child(4),
  .orders-table th:nth-child(4), .orders-table td:nth-child(4) { width:10% !important; }

  #ordersPanel th:nth-child(5), #ordersPanel td:nth-child(5),
  .orders-table th:nth-child(5), .orders-table td:nth-child(5) { width:10% !important; }

  #ordersPanel th:nth-child(6), #ordersPanel td:nth-child(6),
  .orders-table th:nth-child(6), .orders-table td:nth-child(6) { width:11% !important; }

  #ordersPanel th:nth-child(7), #ordersPanel td:nth-child(7),
  .orders-table th:nth-child(7), .orders-table td:nth-child(7) { width:21% !important; }

  /* management actions: compact and wrap INSIDE its cell */
  #ordersPanel td:last-child,
  .orders-table td:last-child {
    white-space:normal !important;
  }

  #ordersPanel td:last-child > *,
  .orders-table td:last-child > * {
    max-width:100% !important;
  }

  #ordersPanel td:last-child button,
  #ordersPanel td:last-child a,
  .orders-table td:last-child button,
  .orders-table td:last-child a {
    font-size:12px !important;
    line-height:1.25 !important;
    min-width:0 !important;
    max-width:100% !important;
    padding:7px 8px !important;
    margin:2px !important;
    white-space:normal !important;
  }
}

/* If an old wrapper explicitly enabled sideways scrolling, neutralize it */
#ordersPanel,
#ordersPanel > div,
.orders-panel,
.orders-wrap,
.orders-table-wrap {
  overflow-x:visible !important;
}

/* Tablet/mobile: turn each order into readable stacked cells rather than sideways scroll */
@media (max-width:900px) {
  #ordersPanel,
  .orders-panel,
  .orders-wrap,
  .orders-table-wrap { overflow-x:hidden !important; }

  #ordersPanel table,
  .orders-table {
    width:100% !important;
    min-width:0 !important;
    table-layout:auto !important;
  }

  #ordersPanel th,
  #ordersPanel td,
  .orders-table th,
  .orders-table td {
    min-width:0 !important;
    max-width:none !important;
    white-space:normal !important;
    overflow-wrap:anywhere !important;
  }

  #ordersPanel td:last-child button,
  #ordersPanel td:last-child a,
  .orders-table td:last-child button,
  .orders-table td:last-child a {
    min-width:0 !important;
    max-width:100% !important;
    white-space:normal !important;
  }
}

/* V10.35 payment/save-image modal safety */
.payment-modal,
.payment-modal-card,
.payment-summary,
.payment-card,
#paymentModal,
#paymentModal > div {
  max-width:calc(100vw - 24px) !important;
}

.payment-modal img,
.payment-summary img,
.payment-card img,
#paymentModal img {
  max-width:100% !important;
  height:auto !important;
}


/* ============================================================
   V10.37 — ADMIN ORDER FIT / NO HORIZONTAL SCROLL
   Keep V10.36 appearance and functions; fix Order page only.
   ============================================================ */

@media (min-width: 901px) {
  /* Order section gets the available width but never exceeds viewport */
  #ordersPanel,
  .orders-panel,
  .orders-wrap,
  .orders-table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  #ordersPanel table,
  .orders-table {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    table-layout: fixed !important;
  }

  /* Seven columns = compact proportions that total 100% */
  #ordersPanel th:nth-child(1), #ordersPanel td:nth-child(1),
  .orders-table th:nth-child(1), .orders-table td:nth-child(1) { width: 12% !important; }

  #ordersPanel th:nth-child(2), #ordersPanel td:nth-child(2),
  .orders-table th:nth-child(2), .orders-table td:nth-child(2) { width: 29% !important; }

  #ordersPanel th:nth-child(3), #ordersPanel td:nth-child(3),
  .orders-table th:nth-child(3), .orders-table td:nth-child(3) { width: 8% !important; }

  #ordersPanel th:nth-child(4), #ordersPanel td:nth-child(4),
  .orders-table th:nth-child(4), .orders-table td:nth-child(4) { width: 10% !important; }

  #ordersPanel th:nth-child(5), #ordersPanel td:nth-child(5),
  .orders-table th:nth-child(5), .orders-table td:nth-child(5) { width: 10% !important; }

  #ordersPanel th:nth-child(6), #ordersPanel td:nth-child(6),
  .orders-table th:nth-child(6), .orders-table td:nth-child(6) { width: 10% !important; }

  #ordersPanel th:nth-child(7), #ordersPanel td:nth-child(7),
  .orders-table th:nth-child(7), .orders-table td:nth-child(7) { width: 21% !important; }

  #ordersPanel th,
  #ordersPanel td,
  .orders-table th,
  .orders-table td {
    min-width: 0 !important;
    max-width: none !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
  }

  /* Product pills remain compact and can wrap */
  #ordersPanel td:nth-child(2),
  .orders-table td:nth-child(2) {
    overflow: visible !important;
  }

  /* Action column: arrange buttons inside the cell instead of extending right */
  #ordersPanel td:nth-child(7),
  .orders-table td:nth-child(7) {
    overflow: visible !important;
  }

  #ordersPanel td:nth-child(7) > div,
  .orders-table td:nth-child(7) > div {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 5px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  #ordersPanel td:nth-child(7) button,
  #ordersPanel td:nth-child(7) a,
  .orders-table td:nth-child(7) button,
  .orders-table td:nth-child(7) a {
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 34px !important;
    padding: 6px 8px !important;
    margin: 0 !important;
    font-size: 11px !important;
    line-height: 1.25 !important;
    white-space: normal !important;
    word-break: normal !important;
  }

  /* Main blue summary/payment action stays prominent but compact */
  #ordersPanel td:nth-child(7) button:first-child,
  .orders-table td:nth-child(7) button:first-child {
    flex: 1 1 78px !important;
  }
}

/* Prevent any legacy minimum width from recreating the scrollbar */
#ordersPanel table,
.orders-table,
#ordersPanel tbody,
#ordersPanel tr,
.orders-table tbody,
.orders-table tr {
  min-width: 0 !important;
}

/* Tablet/mobile: no sideways table scrolling */
@media (max-width: 900px) {
  #ordersPanel,
  .orders-panel,
  .orders-wrap,
  .orders-table-wrap {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    overflow-x:hidden !important;
  }

  #ordersPanel table,
  .orders-table {
    width:100% !important;
    min-width:0 !important;
    max-width:100% !important;
    table-layout:fixed !important;
  }

  #ordersPanel th,
  #ordersPanel td,
  .orders-table th,
  .orders-table td {
    min-width:0 !important;
    white-space:normal !important;
    overflow-wrap:anywhere !important;
  }
}


/* ==========================================================
   V10.38 ACTUAL ORDER FIX
   Actual markup:
   .order-table-wrap > table.order-table.payment-order-table
   Previous patch targeted #ordersPanel, which does not exist.
   ========================================================== */

.order-table-wrap{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  overflow-x:hidden!important;
}

.order-table.payment-order-table{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;             /* overrides old 980/1180px */
  table-layout:fixed!important;
}

.order-table.payment-order-table th,
.order-table.payment-order-table td{
  min-width:0!important;             /* overrides nth-child min widths */
  max-width:none!important;
  box-sizing:border-box!important;
  padding:12px 8px!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
}

/* 7 real columns — total 100% */
.order-table.payment-order-table th:nth-child(1),
.order-table.payment-order-table td:nth-child(1){width:12%!important}
.order-table.payment-order-table th:nth-child(2),
.order-table.payment-order-table td:nth-child(2){width:28%!important}
.order-table.payment-order-table th:nth-child(3),
.order-table.payment-order-table td:nth-child(3){width:8%!important}
.order-table.payment-order-table th:nth-child(4),
.order-table.payment-order-table td:nth-child(4){width:10%!important}
.order-table.payment-order-table th:nth-child(5),
.order-table.payment-order-table td:nth-child(5){width:10%!important}
.order-table.payment-order-table th:nth-child(6),
.order-table.payment-order-table td:nth-child(6){width:11%!important}
.order-table.payment-order-table th:nth-child(7),
.order-table.payment-order-table td:nth-child(7){width:21%!important}

.order-table.payment-order-table .order-items-inline{
  display:flex!important;
  flex-wrap:wrap!important;
  gap:5px!important;
  min-width:0!important;
}
.order-table.payment-order-table .order-item-chip{
  max-width:100%!important;
  white-space:normal!important;
  padding:4px 7px!important;
  font-size:12px!important;
}

.order-table.payment-order-table .order-row-actions{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
  gap:5px!important;
  width:100%!important;
  min-width:0!important;
  align-items:stretch!important;
}

.order-table.payment-order-table .order-row-actions button,
.order-table.payment-order-table .order-row-actions a{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  min-height:34px!important;
  height:auto!important;
  margin:0!important;
  padding:6px 5px!important;
  font-size:11px!important;
  line-height:1.2!important;
  white-space:normal!important;
  overflow-wrap:anywhere!important;
}

/* Summary/payment gets a full row inside management cell */
.order-table.payment-order-table .order-row-actions > :first-child{
  grid-column:1/-1!important;
}

/* Important: override old landscape rule that restores min-width:850px */
@media (orientation:landscape) and (max-height:600px){
  .order-table-wrap{overflow-x:hidden!important}
  .order-table.payment-order-table{
    width:100%!important;
    min-width:0!important;
    table-layout:fixed!important;
  }
  .order-table.payment-order-table td:nth-child(n){
    min-width:0!important;
  }
  .order-table.payment-order-table .order-row-actions{
    display:grid!important;
    grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
    flex-wrap:wrap!important;
  }
}

/* Phone: keep the existing V10.17 card-style order layout */
@media (max-width:600px){
  .order-table-wrap{overflow-x:hidden!important}
  .order-table.payment-order-table{
    min-width:0!important;
    width:100%!important;
    display:block!important;
    table-layout:auto!important;
  }
  .order-table.payment-order-table thead{display:none!important}
  .order-table.payment-order-table tbody{
    display:grid!important;
    gap:12px!important;
  }
  .order-table.payment-order-table tr{
    display:grid!important;
    grid-template-columns:1fr!important;
    width:100%!important;
    min-width:0!important;
  }
  .order-table.payment-order-table td{
    width:100%!important;
    min-width:0!important;
    display:grid!important;
    grid-template-columns:88px minmax(0,1fr)!important;
  }
  .order-table.payment-order-table .order-row-actions{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}


/* V10.40 — My Account (Supabase Auth) */
.account-dialog{max-width:480px;width:100%}
.account-dialog-head{padding-right:26px;margin-bottom:18px}
.account-dialog-head h2{margin:0 0 6px;color:#0b2345;font-size:24px}
.account-dialog-head p{margin:0;color:#64748b;line-height:1.5}
.account-password-form{display:grid;gap:16px}
.account-password-form label{display:grid;gap:7px;font-weight:700;color:#17233b}
.password-field{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:7px;align-items:stretch}
.password-field input{width:100%;min-width:0;height:44px;border:1px solid #cbd8ea;border-radius:9px;padding:0 12px;font:inherit}
.password-toggle{min-width:64px;border:1px solid #cbd8ea;background:#f7f9fc;border-radius:9px;padding:0 10px;color:#1748b8;font-weight:700;cursor:pointer}
.account-password-note{margin:-3px 0 0;color:#64748b;font-size:13px;line-height:1.5}
@media(max-width:600px){
  .account-dialog-head h2{font-size:20px}
  .password-field{grid-template-columns:minmax(0,1fr) 58px}
  .password-toggle{min-width:0;padding:0 6px;font-size:12px}
}

/* V10.43 — fresh mobile redesign; desktop V10.40 untouched */
@media(max-width:600px){
html,body{width:100%!important;max-width:100%!important;overflow-x:hidden!important}
body{background:#f6f8fc!important;font-size:14px!important}
.topbar{position:sticky!important;top:0!important;z-index:50!important;display:flex!important;flex-direction:column!important;align-items:stretch!important;padding:8px 10px!important;gap:7px!important;background:#fff!important}
.topbar nav{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:5px!important;width:100%!important}
.topbar nav .nav,.topbar nav button{width:100%!important;min-width:0!important;padding:8px 3px!important;margin:0!important;font-size:11px!important;white-space:normal!important}
main{width:100%!important;max-width:100%!important;min-width:0!important;padding:10px!important;overflow-x:hidden!important}

/* products */
.shop-layout{display:block!important;width:100%!important;min-width:0!important}
.catalog{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important;width:100%!important;min-width:0!important}
.catalog-card{display:flex!important;flex-direction:column!important;width:100%!important;min-width:0!important;margin:0!important;border-radius:13px!important;overflow:hidden!important;background:#fff!important}
.catalog-card>img{display:block!important;width:100%!important;height:auto!important;max-height:none!important;aspect-ratio:auto!important;object-fit:contain!important;object-position:center!important}
.catalog-body{padding:8px!important;min-width:0!important}
.catalog-card h2,.catalog-card h3{font-size:12px!important;line-height:1.25!important;margin:0 0 5px!important;min-height:30px!important;word-break:normal!important;overflow-wrap:break-word!important}
.catalog-card .price{font-size:15px!important}
.qty-label{font-size:11px!important;margin:7px 0 3px!important}
.qty-stepper{display:grid!important;grid-template-columns:30px minmax(0,1fr) 30px!important;gap:4px!important;width:100%!important;min-width:0!important}
.qty-stepper input,.qty-stepper button,.qty-btn{width:100%!important;min-width:0!important;height:32px!important;min-height:32px!important;padding:0!important}
.cart{position:static!important;width:100%!important;max-width:100%!important;min-width:0!important;margin-top:10px!important;padding:12px!important}

/* tabs */
.tabs{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:5px!important;width:100%!important}
.tabs>*{width:100%!important;min-width:0!important;padding:8px 4px!important;font-size:12px!important;text-align:center!important}

/* order cards */
.order-table-wrap{width:100%!important;max-width:100%!important;min-width:0!important;overflow:visible!important}
table.order-table.payment-order-table{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;table-layout:auto!important}
table.order-table.payment-order-table thead{display:none!important}
table.order-table.payment-order-table tbody{display:grid!important;gap:10px!important;width:100%!important;min-width:0!important}
table.order-table.payment-order-table tr{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;padding:12px!important;margin:0!important;border:1px solid #dfe7f2!important;border-radius:14px!important;background:#fff!important}
table.order-table.payment-order-table tr>td:nth-child(n){display:grid!important;grid-template-columns:88px minmax(0,1fr)!important;gap:8px!important;align-items:start!important;width:100%!important;max-width:100%!important;min-width:0!important;height:auto!important;padding:7px 0!important;border:0!important;border-bottom:1px solid #edf2f7!important;overflow:visible!important;white-space:normal!important;font-size:13px!important;line-height:1.4!important;word-break:normal!important;overflow-wrap:break-word!important}
table.order-table.payment-order-table tr>td:last-child{border-bottom:0!important}
table.order-table.payment-order-table td:nth-child(1)::before{content:"ลูกค้า"}
table.order-table.payment-order-table td:nth-child(2)::before{content:"รายการสินค้า"}
table.order-table.payment-order-table td:nth-child(3)::before{content:"จำนวน"}
table.order-table.payment-order-table td:nth-child(4)::before{content:"ยอดรวม"}
table.order-table.payment-order-table td:nth-child(5)::before{content:"ออเดอร์"}
table.order-table.payment-order-table td:nth-child(6)::before{content:"การชำระเงิน"}
table.order-table.payment-order-table td:nth-child(7)::before{content:"จัดการ"}
table.order-table.payment-order-table td::before{display:block!important;color:#718096!important;font-size:11px!important;font-weight:700!important;white-space:normal!important}
.order-items-inline{display:flex!important;flex-direction:column!important;flex-wrap:nowrap!important;align-items:flex-start!important;width:100%!important;max-width:100%!important;min-width:0!important;gap:5px!important}
.order-item-chip{display:inline-flex!important;width:auto!important;max-width:100%!important;min-width:0!important;padding:5px 8px!important;font-size:11px!important;line-height:1.3!important;white-space:normal!important;word-break:normal!important;overflow-wrap:break-word!important}
.order-row-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important;width:100%!important;min-width:0!important}
.order-row-actions>:first-child{grid-column:1/-1!important}
.order-row-actions button,.order-row-actions a{display:flex!important;align-items:center!important;justify-content:center!important;width:100%!important;min-width:0!important;min-height:38px!important;padding:7px 6px!important;font-size:11px!important;line-height:1.25!important;white-space:normal!important;word-break:normal!important}

/* modal/payment/account */
dialog,.modal,.app-dialog{width:calc(100vw - 16px)!important;max-width:calc(100vw - 16px)!important;max-height:calc(100dvh - 16px)!important;margin:auto!important;padding:12px!important;overflow-x:hidden!important;overflow-y:auto!important;border-radius:15px!important}
#modal-body,.payment-modal,.payment-summary,.payment-card,.account-dialog{width:100%!important;max-width:100%!important;min-width:0!important}
.payment-summary img,.payment-card img,#modal-body img{max-width:100%!important;height:auto!important}
.password-field{display:grid!important;grid-template-columns:minmax(0,1fr) 58px!important;gap:6px!important;width:100%!important;min-width:0!important}
.password-field input{width:100%!important;min-width:0!important;height:42px!important}
.password-toggle{width:100%!important;min-width:0!important;padding:0 4px!important;font-size:11px!important}

/* generic safety */
.panel,.card,.admin-card,.summary-card{width:100%!important;max-width:100%!important;min-width:0!important}
.toolbar,.actions,.admin-actions,.round-actions,.dashboard-actions{display:flex!important;flex-wrap:wrap!important;gap:6px!important;width:100%!important;min-width:0!important}
.toolbar button,.actions button,.admin-actions button,.round-actions button,.dashboard-actions button{flex:1 1 auto!important;min-width:0!important;max-width:100%!important;padding:8px!important;font-size:11px!important;white-space:normal!important}
}

/* V10.44 — Cost & Expense entry restored to Owner finance */
.finance-cost-head{align-items:center}
.expense-entry-box{margin-top:16px;padding:16px;border:1px solid #dbe5f2;border-radius:14px;background:#f8fbff;display:flex;align-items:center;justify-content:space-between;gap:16px}
.expense-entry-box h3{margin:0 0 4px}
.expense-entry-box p{margin:0}
@media(max-width:600px){
 .finance-cost-head{align-items:stretch!important}
 .finance-cost-head>.primary{width:100%!important}
 .expense-entry-box{display:grid!important;grid-template-columns:1fr!important;padding:12px!important;gap:10px!important}
 .expense-entry-box .primary{width:100%!important}
}

/* V10.47 — HomeMade Bakery logo */
.brand-mark,.brand-logo,.logo-mark,.app-logo{
  overflow:hidden!important;
  background:#fff!important;
  padding:2px!important;
}
.brand-mark img,.brand-logo img,.logo-mark img,.app-logo img{
  display:block!important;
  width:100%!important;
  height:100%!important;
  object-fit:contain!important;
  border-radius:inherit!important;
}
@media(max-width:600px){
  .brand-mark,.brand-logo,.logo-mark,.app-logo{
    min-width:38px!important;
    width:38px!important;
    height:38px!important;
  }
}

/* V10.48 — actual .brand-icon logo fix */
.brand-icon{
  background:#fff!important;
  overflow:hidden!important;
  padding:1px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
}
.brand-icon img{
  display:block!important;
  width:100%!important;
  height:100%!important;
  object-fit:contain!important;
  border-radius:inherit!important;
}

/* V10.49 — cleaner payment summary, especially mobile */
.payment-shell{width:min(940px,calc(100vw - 28px))!important;max-width:940px!important}
.payment-card-v17{display:grid!important;grid-template-columns:minmax(0,1.35fr) minmax(300px,.8fr)!important;gap:18px!important;padding:20px!important;background:#fff!important}
.pay-order-panel,.pay-promptpay-panel{min-width:0!important}
.pay-brand{display:flex!important;align-items:center!important;gap:10px!important;padding-bottom:12px!important;border-bottom:1px solid #e5ebf3!important}
.pay-brand .brand-icon{width:54px!important;height:54px!important;min-width:54px!important;border-radius:12px!important}
.pay-brand b{font-size:20px!important}
.pay-brand small{display:block!important;margin-top:2px!important;color:#718096!important}
.pay-customer{margin:14px 0 12px!important}
.pay-items-table{overflow:hidden!important;border:1px solid #e3eaf4!important;border-radius:12px!important}
.pay-grand-total{margin-top:12px!important;padding:12px 14px!important;border-radius:12px!important;background:#f6f9ff!important}
.pay-info-note{margin-top:12px!important;border-radius:12px!important}
.pay-promptpay-panel{padding:0!important}
.scb-pay-card{height:100%!important;min-height:0!important;padding-bottom:14px!important}
.payment-qr{display:flex!important;align-items:center!important;justify-content:center!important;padding:14px 14px 6px!important}
.payment-qr img{width:min(220px,72%)!important;height:auto!important;object-fit:contain!important}
.pay-recipient{padding:4px 16px 10px!important}
.pay-amount{margin:0 14px!important;padding:12px 0!important}
.payment-actions-v17{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:8px!important;padding:10px 20px 18px!important}
.payment-actions-v17 button{min-height:42px!important;width:100%!important}

@media(max-width:600px){
 .payment-shell{width:calc(100vw - 12px)!important;max-width:calc(100vw - 12px)!important}
 .payment-card-v17{display:block!important;padding:12px!important}
 .pay-brand{padding:0 0 9px!important}
 .pay-brand .brand-icon{width:44px!important;height:44px!important;min-width:44px!important}
 .pay-brand b{font-size:16px!important}
 .pay-brand small{font-size:10px!important}
 .pay-customer{margin:10px 0!important}
 .pay-customer h2{font-size:16px!important;margin:0!important}
 .pay-customer p{font-size:11px!important;margin:2px 0 0!important}
 .pay-section-title{font-size:13px!important;margin:10px 0 6px!important}
 .pay-item-head{display:none!important}
 .pay-item-row{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:3px 8px!important;padding:7px 9px!important}
 .pay-item-name{grid-column:1/2!important;font-size:11px!important;white-space:normal!important;overflow-wrap:break-word!important}
 .pay-item-qty{grid-column:2/3!important;grid-row:1!important;font-size:11px!important}
 .pay-item-price{display:none!important}
 .pay-item-sum{grid-column:2/3!important;font-size:11px!important;font-weight:700!important}
 .pay-grand-total{display:grid!important;grid-template-columns:1fr auto!important;gap:2px 8px!important;padding:9px 10px!important;margin-top:7px!important}
 .pay-grand-total b{font-size:11px!important}
 .pay-grand-total span{font-size:10px!important}
 .pay-grand-total strong{grid-column:2!important;grid-row:1/3!important;align-self:center!important;font-size:18px!important}
 .pay-info-note{display:none!important}
 .pay-promptpay-panel{margin-top:10px!important}
 .promptpay-title{padding:8px 10px!important}
 .promptpay-title b{font-size:12px!important}
 .promptpay-title span{font-size:10px!important;padding:4px 7px!important}
 .scb-pay-card{border-radius:12px!important}
 .scb-head{font-size:17px!important;padding:5px!important}
 .payment-qr{padding:8px 8px 2px!important}
 .payment-qr img{width:150px!important;max-width:48vw!important}
 .pay-recipient{padding:2px 10px 6px!important;line-height:1.25!important}
 .pay-recipient small{font-size:9px!important}
 .pay-recipient b{font-size:12px!important}
 .pay-recipient strong{font-size:14px!important}
 .pay-amount{margin:0 10px!important;padding:8px 0!important}
 .pay-amount span{font-size:11px!important}
 .pay-amount strong{font-size:19px!important}
 .scb-pay-card>p{font-size:8px!important;margin:5px 8px 0!important}
 .payment-actions-v17{position:sticky!important;bottom:0!important;grid-template-columns:1.2fr 1fr 1.1fr!important;gap:5px!important;padding:8px 12px 10px!important;background:#fff!important}
 .payment-actions-v17 button{min-height:38px!important;padding:5px!important;font-size:10px!important;line-height:1.2!important}
}


/* =========================================================
   V10.50 — DESKTOP PAYMENT SUMMARY FIX
   Desktop only. Mobile V10.49 remains unchanged.
   ========================================================= */
@media (min-width: 601px) {
  .payment-shell{
    width:min(920px, calc(100vw - 48px))!important;
    max-width:920px!important;
    max-height:calc(100vh - 36px)!important;
    overflow:hidden!important;
  }

  .payment-card-v17{
    width:100%!important;
    box-sizing:border-box!important;
    display:grid!important;
    grid-template-columns:minmax(0, 1.45fr) minmax(300px, .85fr)!important;
    gap:18px!important;
    padding:18px 18px 12px!important;
    overflow:hidden!important;
  }

  .pay-order-panel,
  .pay-promptpay-panel{
    min-width:0!important;
    width:100%!important;
    box-sizing:border-box!important;
  }

  .pay-order-panel{
    overflow:hidden!important;
  }

  .pay-promptpay-panel{
    display:block!important;
    overflow:hidden!important;
  }

  .pay-items-table{
    width:100%!important;
    max-width:100%!important;
    box-sizing:border-box!important;
    overflow:hidden!important;
  }

  .pay-item-head,
  .pay-item-row{
    width:100%!important;
    box-sizing:border-box!important;
  }

  .scb-pay-card{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    box-sizing:border-box!important;
    height:auto!important;
    min-height:0!important;
  }

  .payment-qr{
    padding:10px 12px 4px!important;
  }

  .payment-qr img{
    display:block!important;
    width:min(190px, 70%)!important;
    max-width:190px!important;
    height:auto!important;
    margin:0 auto!important;
    object-fit:contain!important;
  }

  .pay-recipient{
    padding:3px 14px 8px!important;
  }

  .pay-amount{
    margin:0 12px!important;
    padding:10px 0!important;
  }

  .payment-actions-v17{
    width:100%!important;
    box-sizing:border-box!important;
    display:grid!important;
    grid-template-columns:repeat(3, minmax(0, 1fr))!important;
    gap:8px!important;
    padding:8px 18px 14px!important;
    overflow:hidden!important;
  }

  .payment-actions-v17 button{
    width:100%!important;
    min-width:0!important;
    min-height:40px!important;
    white-space:normal!important;
  }
}


/* =========================================================
   V10.51 — CRITICAL DESKTOP OUTER DIALOG WIDTH FIX
   The previous version widened .payment-shell but the parent
   #modal.app-dialog was still constrained by legacy rules.
   Mobile layout remains untouched.
   ========================================================= */
@media (min-width: 601px) {
  html body dialog#modal.app-dialog:has(.payment-shell) {
    width: min(980px, calc(100vw - 64px)) !important;
    min-width: min(820px, calc(100vw - 64px)) !important;
    max-width: 980px !important;
    height: min(720px, calc(100vh - 48px)) !important;
    max-height: calc(100vh - 48px) !important;
    padding: 0 !important;
    margin: auto !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 18px !important;
  }

  html body dialog#modal.app-dialog:has(.payment-shell) #modal-body {
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  html body dialog#modal.app-dialog:has(.payment-shell) .payment-shell {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 100% !important;
  }

  html body dialog#modal.app-dialog:has(.payment-shell) .payment-card-v17 {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    grid-template-columns: minmax(0, 1.45fr) minmax(310px, .85fr) !important;
  }
}


/* =========================================================
   V10.52 — COMPACT DESKTOP PRODUCT CARDS
   Desktop product page only.
   Keep full product image (no crop) and two cards per row.
   ========================================================= */
@media (min-width: 769px) {
  /* Product page: do not stretch product cards across a wide monitor */
  body:not(.admin-mode) .shop-main,
  body:not(.admin-mode) .shop-layout,
  body:not(.admin-mode) .products-area {
    min-width: 0 !important;
  }

  body:not(.admin-mode) .products-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
    width: min(720px, 100%) !important;
    max-width: 720px !important;
    align-items: start !important;
  }

  body:not(.admin-mode) .product-card {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    border-radius: 14px !important;
    overflow: hidden !important;
  }

  body:not(.admin-mode) .product-card .product-image,
  body:not(.admin-mode) .product-card .product-img,
  body:not(.admin-mode) .product-card > img {
    width: 100% !important;
    height: 205px !important;
    max-height: 205px !important;
    display: block !important;
    object-fit: contain !important;
    object-position: center !important;
    background: #fff !important;
  }

  body:not(.admin-mode) .product-card .product-body,
  body:not(.admin-mode) .product-card .product-info,
  body:not(.admin-mode) .product-card .product-content {
    padding: 12px !important;
  }

  body:not(.admin-mode) .product-card h3,
  body:not(.admin-mode) .product-card .product-name {
    font-size: 15px !important;
    line-height: 1.3 !important;
    margin: 0 0 10px !important;
  }

  body:not(.admin-mode) .product-card .price,
  body:not(.admin-mode) .product-card .product-price {
    font-size: 20px !important;
  }

  body:not(.admin-mode) .product-card .stock,
  body:not(.admin-mode) .product-card .product-stock {
    font-size: 12px !important;
  }

  body:not(.admin-mode) .product-card .qty-row,
  body:not(.admin-mode) .product-card .quantity-row,
  body:not(.admin-mode) .product-card .qty-control {
    min-height: 38px !important;
  }
}

/* Medium desktop / tablet landscape still keeps two columns, but scales down cleanly */
@media (min-width: 769px) and (max-width: 1100px) {
  body:not(.admin-mode) .products-grid {
    width: min(650px, 100%) !important;
    gap: 12px !important;
  }

  body:not(.admin-mode) .product-card .product-image,
  body:not(.admin-mode) .product-card .product-img,
  body:not(.admin-mode) .product-card > img {
    height: 185px !important;
    max-height: 185px !important;
  }
}


/* =========================================================
   V10.53 — CUSTOMER ORDER PAGE / DESKTOP
   Actual selectors: .shop-layout .catalog .catalog-card
   ========================================================= */
@media (min-width: 769px) {
  .shop-layout{
    display:grid!important;
    grid-template-columns:minmax(0, 680px) 290px!important;
    gap:20px!important;
    align-items:start!important;
    justify-content:start!important;
  }

  .shop-layout .catalog{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:14px!important;
    width:100%!important;
    max-width:680px!important;
    min-width:0!important;
  }

  .shop-layout .catalog-card{
    width:100%!important;
    min-width:0!important;
    max-width:none!important;
    border-radius:14px!important;
    overflow:hidden!important;
  }

  .shop-layout .catalog-card > img{
    display:block!important;
    width:100%!important;
    height:190px!important;
    max-height:190px!important;
    object-fit:contain!important;
    object-position:center!important;
    background:#fff!important;
  }

  .shop-layout .catalog-body{
    padding:12px!important;
  }

  .shop-layout .catalog-body h2{
    font-size:14px!important;
    line-height:1.3!important;
    min-height:36px!important;
    margin:0 0 8px!important;
  }

  .shop-layout .price-row{
    margin:0 0 12px!important;
    gap:8px!important;
  }

  .shop-layout .price-row strong{
    font-size:20px!important;
  }

  .shop-layout .qty-label{
    font-size:12px!important;
    margin-bottom:6px!important;
  }

  .shop-layout .qty-stepper{
    gap:6px!important;
  }

  .shop-layout .qty-stepper input{
    min-width:0!important;
    height:38px!important;
  }

  .shop-layout .qty-btn{
    width:38px!important;
    min-width:38px!important;
    height:38px!important;
    padding:0!important;
  }

  .shop-layout .cart{
    width:290px!important;
    max-width:290px!important;
    min-width:0!important;
    position:sticky!important;
    top:88px!important;
  }
}

@media (min-width: 769px) and (max-width: 1050px){
  .shop-layout{
    grid-template-columns:minmax(0,600px) 270px!important;
    gap:14px!important;
  }
  .shop-layout .catalog{max-width:600px!important;}
  .shop-layout .catalog-card > img{
    height:168px!important;
    max-height:168px!important;
  }
  .shop-layout .cart{
    width:270px!important;
    max-width:270px!important;
  }
}


/* V10.54 — Public purchase link:
   same customer ordering UI as the main order page; no admin/store-management information. */
body.public-shop .admin-nav,
body.public-shop .admin-only,
body.public-shop .management-only,
body.public-shop .account-menu,
body.public-shop .logout-button,
body.public-shop .admin-header-actions {
  display:none!important;
}


/* =========================================================
   V10.55 — PRODUCT IMAGE: SHOW FULL UPLOADED IMAGE
   No fixed height / no crop. Preserve original aspect ratio.
   Applies to normal order page + public purchase link.
   ========================================================= */
.shop-layout .catalog-card > img,
.catalog .catalog-card > img,
.catalog-card img {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center !important;
  background: #fff !important;
}

/* Override previous desktop fixed-height rules */
@media (min-width: 769px) {
  .shop-layout .catalog-card > img,
  .catalog .catalog-card > img,
  .catalog-card img {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
  }
}

/* Same behavior on phone/tablet */
@media (max-width: 768px) {
  .shop-layout .catalog-card > img,
  .catalog .catalog-card > img,
  .catalog-card img {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    object-fit: contain !important;
  }
}
