*{box-sizing:border-box}body{margin:0;font-family:Inter,system-ui,-apple-system,Segoe UI,sans-serif;background:#f5f7f4;color:#17221b}button,input{font:inherit}.topbar,.portal-head{height:72px;background:#fff;border-bottom:1px solid #dfe7df;display:flex;align-items:center;justify-content:space-between;padding:0 22px;position:sticky;top:0;z-index:20}.brandtext{font-size:24px;font-weight:900;letter-spacing:.12em}.subbrand{font-size:10px;letter-spacing:.24em;color:#50715d}.top-actions{display:flex;gap:10px;align-items:center}.status{padding:7px 10px;border-radius:999px;font-size:12px;font-weight:700}.status.demo{background:#fff4d6;color:#805800}.status.cloud{background:#ddf7e6;color:#146b39}.nav{background:#fff;display:flex;gap:4px;padding:8px 16px;overflow:auto;border-bottom:1px solid #dfe7df}.nav button{border:0;background:transparent;padding:10px 14px;border-radius:10px;font-weight:700;color:#5f6f64;white-space:nowrap}.nav button.active{background:#e7f3ea;color:#166534}main{max-width:1240px;margin:auto;padding:22px}.hero{background:linear-gradient(135deg,#133e25,#1c6a38);color:white;border-radius:22px;padding:34px}.hero h1{max-width:780px;margin:8px 0;font-size:34px}.hero p{max-width:800px;color:#dfeee4}.kicker{font-size:12px;font-weight:900;letter-spacing:.15em}.metrics{display:grid;grid-template-columns:repeat(6,1fr);gap:12px;margin:18px 0}.metric,.card{background:#fff;border:1px solid #e2e8e3;border-radius:18px;padding:18px;box-shadow:0 5px 20px #16301d0d}.metric span,.metric small{display:block;color:#6c7b70;font-size:12px}.metric b{font-size:25px;display:block;margin:8px 0}.card{margin:18px 0}.rules{display:grid;grid-template-columns:1fr 1fr;gap:10px}.pagehead{display:flex;justify-content:space-between;align-items:center}.pagehead h1{margin-bottom:4px}.pagehead p{margin-top:0;color:#6b786e}.primary{background:#166534;color:#fff;border:0;border-radius:12px;padding:11px 16px;font-weight:800}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:12px;border-bottom:1px solid #edf1ed}th{font-size:12px;color:#66756b}.empty{text-align:center;padding:30px;color:#718078}code{background:#eff3ef;padding:2px 5px;border-radius:5px}.portal-body{padding-bottom:95px}.portal-head{position:sticky}.lang{border:1px solid #d8e1da;background:#fff;border-radius:10px;padding:9px 12px;font-weight:800}.portal-hero{background:#173f29;color:#fff;padding:28px max(18px,calc((100vw - 1180px)/2));}.portal-hero h1{margin:6px 0 0;max-width:820px}.catalog-tools{max-width:1180px;margin:18px auto;padding:0 14px}.catalog-tools input{width:100%;padding:13px;border:1px solid #dce5de;border-radius:13px}.catalog-grid{max-width:1180px;margin:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:14px;padding:0 14px}.product{background:white;border:1px solid #e1e8e2;border-radius:18px;overflow:hidden;box-shadow:0 5px 20px #16301d0c}.photo{height:160px;background:#eef4ef;display:grid;place-items:center}.photo img{width:100%;height:100%;object-fit:cover}.photo-placeholder{font-weight:900;letter-spacing:.12em;color:#91a799}.pbody{padding:14px}.pbody small{color:#718077}.pbody h3{margin:5px 0 8px}.price{font-weight:900;font-size:23px;color:#155f34}.stock{display:inline-block;margin-top:8px;padding:5px 8px;border-radius:999px;font-size:11px;font-weight:800}.stock.ok{background:#e3f5e9;color:#166534}.stock.low{background:#fff3cf;color:#7a5700}.stock.out{background:#fce7e7;color:#9a1d1d}.qty{display:grid;grid-template-columns:38px 1fr 38px;gap:6px;margin-top:12px}.qty button,.qty input{height:38px;border:1px solid #dbe4dc;background:#fff;border-radius:10px;text-align:center}.notice{font-size:12px;color:#8a5b00;margin-top:8px;line-height:1.35}.orderbar{position:fixed;left:14px;bottom:14px;z-index:40;background:#fff;border:1px solid #dce5de;border-radius:16px;box-shadow:0 10px 30px #0002;padding:10px 12px;display:flex;align-items:center;gap:14px;max-width:calc(100vw - 145px)}.orderbar small,.orderbar b{display:block}.orderbar b{font-size:18px}.orderbar button{min-width:140px}dialog{border:0;border-radius:20px;padding:0;max-width:560px;width:calc(100% - 28px)}dialog::backdrop{background:#10211688}.dialog-card{padding:22px;position:relative}.x{position:absolute;right:12px;top:12px;border:0;background:#eff3ef;width:34px;height:34px;border-radius:50%}.oline{display:grid;grid-template-columns:1fr auto;gap:3px;padding:10px 0;border-bottom:1px solid #edf1ed}.oline small{grid-column:1/-1;color:#805800}.grand{display:flex;justify-content:space-between;font-size:21px;padding:16px 0}.fine{font-size:12px;color:#6c786f}.sendgrid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px}.sendgrid button{padding:11px;border-radius:10px;border:1px solid #ced9d0;background:#fff;font-weight:800}@media(max-width:850px){.metrics{grid-template-columns:repeat(2,1fr)}.rules{grid-template-columns:1fr}.hero h1{font-size:28px}.pagehead{align-items:flex-start;gap:12px}.orderbar{right:118px;max-width:none}.sendgrid{grid-template-columns:1fr}.nav{padding-left:8px}}.ghost{background:#fff;border:1px solid #d8e1da;border-radius:10px;padding:8px 11px;font-weight:700}.user-chip{font-size:12px;color:#53675a}.login-wrap{min-height:100vh;display:grid;place-items:center;padding:20px;background:linear-gradient(135deg,#eef7f0,#f8faf8)}.login-card{width:min(430px,100%);background:#fff;border:1px solid #dfe7df;border-radius:22px;padding:30px;box-shadow:0 18px 60px #14361f1a}.login-card h1{margin:22px 0}.login-card label{display:block;font-size:12px;font-weight:800;margin:14px 0 5px}.login-card input,.customer-fields input{width:100%;padding:12px;border:1px solid #d7e1d9;border-radius:11px}.login-card .primary{width:100%;margin:18px 0 10px}.login-card small{color:#6f7c73}.alert,.error{background:#fff0f0;color:#8f2525;border-color:#f4c7c7}.loading{padding:30px;text-align:center;color:#65766a}.block{display:block;margin-top:3px;color:#7a887f}.table-scroll{overflow:auto}.pill{display:inline-block;padding:4px 8px;border-radius:999px;background:#edf3ee;font-size:11px;font-weight:800}.row-actions{display:flex;gap:6px;flex-wrap:wrap}.mini{border:1px solid #cad7cd;background:#fff;border-radius:8px;padding:6px 8px;font-size:11px;font-weight:800}.mini.danger{color:#982525;border-color:#e7bebe}.meta{font-size:12px;color:#718077;min-height:18px;margin-bottom:5px}.customer-fields{display:grid;grid-template-columns:1fr 1fr;gap:10px}.customer-fields label{font-size:11px;font-weight:800}.wide{width:100%;margin-top:12px}.success-card{text-align:left}.success-mark{width:48px;height:48px;border-radius:50%;display:grid;place-items:center;background:#dff5e6;color:#166534;font-size:28px;font-weight:900}.order-number{font-size:22px;font-weight:900;color:#166534}.empty-catalog{grid-column:1/-1;text-align:center;padding:40px;color:#6d7b72}.portal-error{max-width:600px;margin:80px auto;padding:30px}.portal-error h2{margin-top:20px}@media(max-width:650px){.customer-fields{grid-template-columns:1fr}.user-chip{display:none}.topbar{padding:0 10px}.top-actions{gap:6px}.top-actions .ghost{padding:7px 8px;font-size:12px}}

.stock-warning{margin-top:10px;padding:10px 11px;border-radius:11px;background:#fff7df;border:1px solid #efd38a;color:#684b00;font-size:12px;line-height:1.4}
.oline .stock-warning{grid-column:1/-1;margin-top:5px}

/* BARAMA Cloud Portal v0.7 visual corrections */
html,body{max-width:100%;overflow-x:hidden}
.portal-version{margin-left:8px;font-weight:800;color:#166534;letter-spacing:.08em}
.catalog-grid{
  width:min(1220px,100%);
  max-width:1220px;
  margin:0 auto;
  padding:0 18px 110px;
  grid-template-columns:repeat(auto-fit,minmax(235px,1fr));
  justify-content:center;
  align-items:stretch;
}
.product{min-width:0;width:100%;display:flex;flex-direction:column}
.photo{height:190px;padding:12px;background:#f4f7f3}
.photo img{width:100%;height:100%;object-fit:contain;display:block}
.pbody{display:flex;flex-direction:column;flex:1;padding:16px}
.qty{
  width:100%;
  grid-template-columns:42px minmax(0,1fr) 42px;
  gap:8px;
  margin-top:14px;
}
.qty button,.qty input{
  width:100%;
  min-width:0;
  height:42px;
}
.qty button{font-size:19px;font-weight:800}
.qty input{padding:0 4px}
.stock-warning{width:100%;overflow-wrap:anywhere}
.catalog-tools{width:min(1220px,100%);max-width:1220px;padding:0 18px}
.orderbar{max-width:calc(100vw - 28px)}
@media (min-width:1280px){
  .catalog-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}
@media (max-width:900px){
  .catalog-grid{grid-template-columns:repeat(2,minmax(0,1fr));padding-left:12px;padding-right:12px}
  .photo{height:170px}
}
@media (max-width:560px){
  .catalog-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:0 10px 115px}
  .product{border-radius:15px}
  .photo{height:145px;padding:7px}
  .pbody{padding:11px}
  .pbody h3{font-size:17px;line-height:1.15}
  .meta{font-size:11px}
  .price{font-size:21px}
  .qty{grid-template-columns:36px minmax(0,1fr) 36px;gap:5px}
  .qty button,.qty input{height:38px}
  .stock-warning{font-size:11px;padding:8px}
  .orderbar{left:10px;right:10px;bottom:10px;max-width:none;justify-content:space-between}
  .orderbar button{min-width:130px}
}



/* BARAMA 6.0 Cloud v0.10 — cleaned product images, no per-product scaling.
   Goal: keep full products visible, reduce empty space, and avoid bottom clipping. */
.photo{overflow:hidden;background:#fff;height:190px;padding:8px;display:grid;place-items:center}
.photo img{width:100%;height:100%;object-fit:contain;object-position:center center;display:block}
.product{min-width:0;width:100%;display:flex;flex-direction:column}
.qty{width:100%;grid-template-columns:42px minmax(0,1fr) 42px}
.qty button,.qty input{min-width:0;width:100%}
@media (max-width:900px){
  .photo{height:178px;padding:8px}
}
@media (max-width:560px){
  .photo{height:152px;padding:6px}
}

/* BARAMA Cloud v0.11 - final product image scale corrections */
.product[data-sku="HB-RED"] .photo img{
  transform:scale(.78);
  transform-origin:center;
}
.product[data-sku="RBP"] .photo img{
  transform:scale(1.18);
  transform-origin:center;
}
.product[data-sku="QF-DONCHUY-4X5LB"] .photo img{
  transform:scale(1);
  transform-origin:center;
}


/* BARAMA Cloud v0.13 - Queso Fresco: force full package inside photo frame */
.product[data-sku="QF-DONCHUY-4X5LB"] .photo img{
  object-fit:contain !important;
  object-position:center center !important;
  transform:none !important;
  max-width:100%;
  max-height:100%;
}

/* BARAMA Cloud v0.15 — Existing catalog photos visible in Product Manager */
.admin-version{margin-left:7px;color:#166534;font-weight:900;letter-spacing:.08em}
.product-help{background:#f1f8f3;color:#315c40;margin-top:8px}
.product-thumb{width:58px;height:58px;object-fit:contain;background:#fff;border:1px solid #e1e8e2;border-radius:10px;padding:4px;display:block}
.empty-thumb{display:grid;place-items:center;font-weight:900;color:#9aab9f;background:#f4f7f3}
.product-editor{max-height:min(88vh,900px);overflow:auto}
.product-editor h2{margin:0 0 4px}
.editor-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:16px}
.editor-grid label,.photo-editor label{display:block;font-size:12px;font-weight:800;color:#425548}
.editor-grid input,.editor-grid select{width:100%;margin-top:5px;padding:11px;border:1px solid #d7e1d9;border-radius:10px;background:#fff}
.photo-editor{display:grid;grid-template-columns:180px 1fr;gap:16px;align-items:center;margin:18px 0;padding:14px;border:1px solid #e1e8e2;border-radius:14px;background:#f8faf8}
.photo-preview{height:145px;border:1px dashed #cbd8ce;border-radius:12px;background:#fff;display:grid;place-items:center;overflow:hidden;text-align:center;padding:8px;color:#6d7b72}
.photo-preview img{width:100%;height:100%;object-fit:contain;display:block}
.photo-preview small{display:block;margin-top:5px;font-weight:400}
.upload-label input{display:block;margin-top:8px;width:100%}
.check-grid{display:flex;gap:18px;flex-wrap:wrap;margin:12px 0 18px}
.check-grid label{font-size:13px;font-weight:700}
.editor-actions{display:flex;justify-content:flex-end;gap:9px;position:sticky;bottom:-22px;background:#fff;padding:14px 0 2px}
@media(max-width:650px){.editor-grid{grid-template-columns:1fr}.photo-editor{grid-template-columns:1fr}.photo-preview{height:180px}.pagehead{flex-direction:column}.pagehead .primary{width:100%}}

/* BARAMA Cloud v0.17 — Purchases → Inventory → Finance */
.purchase-flow{display:flex;justify-content:space-between;gap:18px;align-items:center;background:#f1f8f3;color:#315c40;margin-top:8px}
.purchase-flow span{font-size:13px;color:#587161}
.pill-ap{background:#fff3cf;color:#755500}.pill-paid{background:#e3f5e9;color:#166534}.pill-overdue{background:#fde7e7;color:#982525}.pill-due{background:#fff3cf;color:#755500}
.purchase-editor{width:min(1080px,calc(100vw - 28px));max-width:none;max-height:90vh;overflow:auto}
.purchase-editor h2,.purchase-detail h2{margin:0 0 4px}.purchase-header-grid,.purchase-extra-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:16px 0}.purchase-extra-grid{grid-template-columns:1fr 1fr}
.purchase-header-grid label,.purchase-extra-grid label,.field-block{font-size:12px;font-weight:800;color:#425548}.purchase-header-grid input,.purchase-header-grid select,.purchase-extra-grid input,.purchase-extra-grid textarea,.field-block textarea{width:100%;margin-top:5px;padding:11px;border:1px solid #d7e1d9;border-radius:10px;background:#fff}
.terms-box{padding:11px 13px;border-radius:11px;background:#f7faf7;border:1px solid #e0e8e1;color:#52675a;font-size:12px}.purchase-section-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:20px}.purchase-section-title h3{margin:0}
.purchase-line{border:1px solid #dfe8e1;border-radius:14px;padding:14px;margin:12px 0;background:#fbfcfb}.purchase-line-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}.purchase-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.purchase-grid label{font-size:11px;font-weight:800;color:#4c6052}.purchase-grid input,.purchase-grid select{width:100%;margin-top:5px;padding:10px;border:1px solid #d7e1d9;border-radius:9px;background:#fff}.span-2{grid-column:span 2}.line-costs{display:flex;justify-content:flex-end;gap:22px;margin-top:11px;padding-top:10px;border-top:1px dashed #dce5de;font-size:12px;color:#66786b}.line-costs b{color:#173f29;margin-left:5px}
.purchase-summary{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:16px}.purchase-summary span{background:#f5f8f5;border:1px solid #e0e7e1;border-radius:11px;padding:12px;color:#637369;font-size:12px}.purchase-summary b{display:block;color:#17221b;font-size:18px;margin-top:4px}.purchase-summary .grand-total{background:#e9f5ec;border-color:#cfe4d4}.purchase-summary .grand-total b{color:#166534;font-size:21px}.landed-note{margin-top:12px;padding:11px 13px;border-radius:11px;background:#fff8e7;border:1px solid #efdbab;color:#675321;font-size:12px;line-height:1.45}.purchase-detail{width:min(850px,calc(100vw - 28px));max-width:none}.detail-total{display:flex;justify-content:space-between;align-items:center;padding:14px;border-radius:12px;background:#eef7f0;margin:14px 0}.detail-total b{font-size:24px;color:#166534}
@media(max-width:850px){.purchase-header-grid,.purchase-grid{grid-template-columns:1fr 1fr}.purchase-summary{grid-template-columns:1fr 1fr}.purchase-flow{align-items:flex-start;flex-direction:column}.span-2{grid-column:span 2}}
@media(max-width:560px){.purchase-header-grid,.purchase-grid,.purchase-extra-grid,.purchase-summary{grid-template-columns:1fr}.span-2{grid-column:span 1}.purchase-editor{width:calc(100vw - 16px)}.line-costs{justify-content:space-between;gap:8px}.purchase-section-title{align-items:flex-start;flex-direction:column}.purchase-section-title .ghost{width:100%}}

/* BARAMA Cloud v0.17.1 — Purchase editor wide-screen correction */
#purchaseDialog{
  width:min(94vw,1320px);
  max-width:none;
  height:min(92vh,920px);
  max-height:92vh;
  overflow:hidden;
}
#purchaseDialog .purchase-editor{
  width:100%;
  max-width:none;
  height:100%;
  max-height:none;
  overflow-y:auto;
  overflow-x:hidden;
  padding:26px 30px 20px;
}
#purchaseDialog .editor-actions{
  bottom:0;
  z-index:3;
  padding:14px 0 6px;
}
@media(max-width:850px){
  #purchaseDialog{width:calc(100vw - 20px);height:94vh;max-height:94vh}
  #purchaseDialog .purchase-editor{padding:22px 18px 16px}
}
@media(max-width:560px){
  #purchaseDialog{width:calc(100vw - 10px);height:96vh;max-height:96vh;border-radius:14px}
  #purchaseDialog .purchase-editor{padding:18px 12px 12px}
}

/* BARAMA Cloud v0.18 — Manual completed sales + Accounts Receivable */
.sale-flow{display:flex;justify-content:space-between;gap:18px;align-items:center;background:#f1f8f3;color:#315c40;margin-top:8px}
.sale-flow span{font-size:13px;color:#587161}.pill-manual{background:#e8eefc;color:#294e9b}
#saleDialog{width:min(94vw,1260px);max-width:none;height:min(92vh,900px);max-height:92vh;overflow:hidden}
#saleDialog .sale-editor{width:100%;height:100%;overflow-y:auto;overflow-x:hidden;padding:26px 30px 20px}
.sale-editor h2{margin:0 0 4px}.sale-header-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:16px 0}
.sale-header-grid label,.sale-grid label{font-size:12px;font-weight:800;color:#425548}.sale-header-grid input,.sale-header-grid select,.sale-grid input,.sale-grid select{width:100%;margin-top:5px;padding:11px;border:1px solid #d7e1d9;border-radius:10px;background:#fff}
.sale-section-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:20px}.sale-section-title h3{margin:0}
.sale-line{border:1px solid #dfe8e1;border-radius:14px;padding:14px;margin:12px 0;background:#fbfcfb}.sale-line-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.sale-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.sale-line-meta{display:flex;justify-content:flex-end;gap:28px;margin-top:11px;padding-top:10px;border-top:1px dashed #dce5de;font-size:12px;color:#66786b}.sale-line-meta b{color:#173f29;margin-left:5px}.sale-line-meta .stock-short{color:#a12525}
.sale-summary{display:flex;justify-content:flex-end;margin-top:16px}.sale-summary span{min-width:250px;background:#e9f5ec;border:1px solid #cfe4d4;border-radius:11px;padding:12px;color:#637369;font-size:12px}.sale-summary b{display:block;color:#166534;font-size:24px;margin-top:4px}
#saleDialog .editor-actions{bottom:0;z-index:3;padding:14px 0 6px}
@media(max-width:850px){.sale-header-grid,.sale-grid{grid-template-columns:1fr 1fr}.sale-flow{align-items:flex-start;flex-direction:column}.sale-grid .span-2{grid-column:span 2}}
@media(max-width:560px){#saleDialog{width:calc(100vw - 10px);height:96vh;max-height:96vh;border-radius:14px}#saleDialog .sale-editor{padding:18px 12px 12px}.sale-header-grid,.sale-grid{grid-template-columns:1fr}.sale-grid .span-2{grid-column:span 1}.sale-line-meta{justify-content:space-between;gap:8px}.sale-section-title{align-items:flex-start;flex-direction:column}.sale-section-title .ghost{width:100%}.sale-summary span{width:100%;min-width:0}}

/* BARAMA Cloud v0.18 — official Raíces brand lockup.
   Uses the established BARAMA Produce Distribution artwork; no substitute font. */
.brand-lockup{display:flex;align-items:center;line-height:0;overflow:hidden}
.brand-logo{display:block;width:238px;max-width:100%;height:auto;object-fit:contain}
.admin-brand-wrap,.portal-brand-wrap{display:flex;align-items:center;gap:13px;min-width:0}
.admin-subbrand{white-space:nowrap;line-height:1.35}
.brand-login{justify-content:flex-start;margin:-4px 0 2px}
.brand-login .brand-logo{width:300px}
.brand-error .brand-logo{width:280px}
.brand-version{font-size:10px;letter-spacing:.08em;color:#819087;white-space:nowrap}
.portal-head{height:86px}
.portal-brand-wrap .brand-logo{width:270px}
.login-card{padding-top:26px}
@media(max-width:720px){
  .brand-logo{width:190px}
  .portal-brand-wrap .brand-logo{width:210px}
  .brand-login .brand-logo{width:260px}
  .admin-brand-wrap,.portal-brand-wrap{gap:7px}
  .admin-subbrand{font-size:8px;letter-spacing:.12em;white-space:normal;max-width:105px}
  .brand-version{display:none}
  .portal-head{height:78px;padding:0 12px}
}
@media(max-width:430px){
  .portal-brand-wrap .brand-logo{width:190px}
  .topbar .brand-logo{width:165px}
  .topbar .admin-subbrand{max-width:82px;font-size:7px}
  .brand-login .brand-logo{width:235px}
}

/* Final lockup sizing: keep the complete official mark visible inside headers. */
.topbar{height:88px}
.topbar .brand-logo{width:190px}
.portal-head{height:94px}
.portal-brand-wrap .brand-logo{width:205px}
.brand-login .brand-logo{width:300px}
.brand-error .brand-logo{width:280px}
@media(max-width:720px){
  .topbar{height:82px}
  .topbar .brand-logo{width:160px}
  .portal-head{height:86px}
  .portal-brand-wrap .brand-logo{width:180px}
  .brand-login .brand-logo{width:260px}
}
@media(max-width:430px){
  .topbar .brand-logo{width:145px}
  .portal-brand-wrap .brand-logo{width:165px}
  .brand-login .brand-logo{width:235px}
}

/* v0.18 purchasing documents, cost adjustments, and inventory write-offs */
.compact-head{gap:18px;align-items:flex-start}.compact-head h2{margin:0 0 4px}.soft-rule{border:0;border-top:1px solid #e7ece8;margin:20px 0}.document-list{display:grid;gap:8px}.document-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:11px 12px;border:1px solid #e1e8e2;border-radius:11px;background:#fafcfa}.document-row small{display:block;margin-top:3px;color:#6e7d72}.purchase-detail .pagehead{margin-bottom:8px}
#purchaseDocumentDialog .purchase-header-grid{grid-template-columns:1fr 2fr}#purchaseDocumentDialog .span-2{grid-column:auto}
#writeoffDialog .purchase-editor,#purchaseAdjustmentDialog .purchase-editor{width:min(1080px,calc(100vw - 28px));max-width:none;max-height:90vh;overflow:auto}
@media(max-width:700px){.compact-head{flex-direction:column}.compact-head .row-actions{width:100%}.compact-head .row-actions button{flex:1}.document-row{align-items:flex-start;flex-direction:column}#purchaseDocumentDialog .purchase-header-grid{grid-template-columns:1fr}}

/* v0.19 - gestión interna, gastos generales y conteo físico */
#supplierDialog .purchase-editor,#customerEditorDialog .purchase-editor,#expenseDialog .purchase-editor,#countDialog .purchase-editor{width:min(1050px,calc(100vw - 24px));max-width:none;max-height:91vh;overflow:auto}
#supplierDialog .field-block,#customerEditorDialog .field-block,#expenseDialog .field-block{display:block;margin:14px 0;font-size:13px;font-weight:700;color:#405647}
#supplierDialog textarea,#customerEditorDialog textarea,#expenseDialog textarea,#countDialog input{width:100%;margin-top:6px;padding:10px;border:1px solid #d7e1d9;border-radius:10px;background:#fff;font:inherit}
#supplierDialog input[type="checkbox"],#customerEditorDialog input[type="checkbox"]{width:auto;margin-right:8px}
.count-table{max-height:53vh;overflow:auto;border:1px solid #e0e9e2;border-radius:12px;margin:14px 0}
.count-table th{position:sticky;top:0;background:#f3f7f3;z-index:1}
.count-table input{width:115px!important;min-width:90px;text-align:right;margin:0!important}
.count-table td{padding:8px 12px}
.count-note{background:#edf5ef;color:#295a3b;padding:12px 14px;border-radius:11px;margin:10px 0;font-size:13px}
@media(max-width:620px){#supplierDialog .purchase-editor,#customerEditorDialog .purchase-editor,#expenseDialog .purchase-editor,#countDialog .purchase-editor{width:calc(100vw - 12px);padding:16px}.count-table{max-height:56vh}.count-table td,.count-table th{padding:8px}}
.expense-metrics{grid-template-columns:repeat(2,minmax(220px,1fr));max-width:600px}
@media(max-width:620px){.expense-metrics{grid-template-columns:1fr}}

/* v0.19.1 — delivery scheduling: admin only, no catalog changes */
.delivery-unset{font-size:12px;color:#87968b}.delivery-set{display:block;white-space:nowrap;color:#1d5d38}.delivery-set small{display:block;color:#65786b;margin-top:3px;font-size:12px}.schedule-button{color:#166534;border-color:#9ccbb0;background:#f2faf5}.schedule-button:hover{background:#e1f2e6}#deliveryScheduleDialog{width:min(760px,calc(100vw - 24px));max-width:none}#deliveryScheduleDialog .delivery-editor{padding:28px;max-height:90vh;overflow-y:auto}#deliveryScheduleDialog h2{margin:0 0 4px}.delivery-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:20px 0}.delivery-grid label{font-size:13px;font-weight:800;color:#425548}.delivery-grid input{width:100%;margin-top:6px;padding:12px;border:1px solid #d7e1d9;border-radius:10px;background:#fff}.delivery-hint{background:#eef7f0;border:1px solid #d4e7d9;border-radius:12px;padding:12px 14px;color:#345d43;font-size:13px;line-height:1.55}.delivery-editor .editor-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px}@media(max-width:600px){#deliveryScheduleDialog .delivery-editor{padding:22px 16px}.delivery-grid{grid-template-columns:1fr}.delivery-editor .editor-actions{flex-wrap:wrap}}

/* v0.19.2 — confirm reserved inventory only; no changes to public catalog */
#confirmOrderDialog{width:min(840px,calc(100vw - 20px));max-width:none}
#confirmOrderDialog .confirm-editor{padding:28px;max-height:90vh;overflow-y:auto}
#confirmOrderDialog h2{margin:0 0 7px;color:#193e28}
.confirm-hint{padding:14px 16px;border-radius:12px;background:#eef7f0;border:1px solid #cce5d3;color:#315a3e;font-size:13px;line-height:1.6}
.confirm-table-wrap{overflow-x:auto;margin:14px 0}.confirm-table th{white-space:nowrap}.confirm-table td{font-size:13px}.confirm-qty{color:#176534;font-weight:900}.confirm-pending{color:#965a05;font-weight:900}
.confirm-totals{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:14px 0}
.confirm-totals span{background:#f5f8f5;border:1px solid #e0e9e1;border-radius:12px;padding:12px;font-size:12px;color:#637768}.confirm-totals b{display:block;font-size:24px;color:#205b37;margin-top:4px}
.confirm-backorder{background:#fff6e3;border:1px solid #f2dfb5;border-radius:11px;padding:12px 14px;font-size:13px;color:#815600;font-weight:700}
.confirm-editor .editor-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px}
.confirm-editor .editor-actions button:disabled{opacity:.45;cursor:not-allowed}
#confirmOrderMsg .alert{padding:12px 14px;margin-top:12px;border-radius:10px}
@media(max-width:600px){#confirmOrderDialog .confirm-editor{padding:22px 14px}.confirm-totals{gap:5px}.confirm-totals span{padding:8px}.confirm-totals b{font-size:20px}.confirm-editor .editor-actions{flex-wrap:wrap}}

/* v0.19.3 — view order and manage pending quantities, admin only */
#orderDetailDialog,#orderPendingDialog{width:min(940px,calc(100vw - 22px));max-width:none}
#orderDetailDialog .order-details,#orderPendingDialog .order-details{padding:28px;max-height:90vh;overflow-y:auto}
.order-details h2{margin:0 0 8px;color:#193e28}.order-details h3{margin:18px 0 8px}
.order-detail-stats{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;margin:16px 0}
.order-detail-stats span{border:1px solid #dfe8e0;border-radius:10px;background:#f6faf7;padding:10px;font-size:11px;color:#637768}
.order-detail-stats b{display:block;font-size:20px;color:#1f5534;margin-top:5px}
.order-detail-values{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:14px 0;font-size:13px}
.order-detail-values span{padding:10px;border:1px solid #e0e8e2;border-radius:10px}.order-detail-values b{display:block;margin-top:5px}
.order-events{display:grid;gap:8px;max-height:190px;overflow:auto}.order-events>div{border:1px solid #e2e9e3;border-radius:9px;padding:9px 12px;font-size:13px}.order-events small{display:block;color:#66756c;margin-top:3px}
.order-details .field-block{display:block;margin:14px 0;font-size:13px;font-weight:700;color:#405647}
.order-details .field-block input,.order-details .field-block select,.order-details .field-block textarea{width:100%;margin-top:7px;padding:11px;border:1px solid #d7e1d9;border-radius:10px;background:#fff;font:inherit}
.order-details .editor-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px}
.order-details .editor-actions button:disabled{opacity:.45;cursor:not-allowed}
@media(max-width:620px){#orderDetailDialog .order-details,#orderPendingDialog .order-details{padding:20px 12px}.order-detail-stats{grid-template-columns:repeat(3,minmax(0,1fr))}.order-detail-values{grid-template-columns:1fr}}

/* v0.19.4 — Physical count workspace: near-full-screen desktop dialog.
   Visual-only change. Keep inventory, reservation, draft and finance logic intact. */
#countDialog{
  width:min(96vw,1600px);
  max-width:none;
  height:min(95vh,1050px);
  max-height:95vh;
  overflow:hidden;
}
#countDialog .count-editor{
  box-sizing:border-box;
  width:100%;
  max-width:none;
  height:100%;
  max-height:none;
  overflow:hidden;
  display:flex;
  flex-direction:column;
  padding:26px 30px 18px;
}
#countDialog .count-editor > h2,
#countDialog .count-editor > .fine,
#countDialog .count-editor > .purchase-header-grid,
#countDialog .count-editor > .count-note,
#countDialog .count-editor > #countMsg,
#countDialog .count-editor > .editor-actions{flex-shrink:0}
#countDialog .count-table{
  flex:1 1 auto;
  min-height:170px;
  max-height:none;
  overflow:auto;
  margin:12px 0;
}
#countDialog .count-table table{min-width:850px}
#countDialog .count-table th:first-child{width:35%}
#countDialog .count-table th:not(:first-child){width:16.25%}
#countDialog .count-table input{width:100%!important;max-width:170px}
#countDialog .editor-actions{bottom:0;z-index:3;padding:12px 0 0}
@media(max-width:850px){
  #countDialog{width:calc(100vw - 16px);height:95vh;max-height:95vh}
  #countDialog .count-editor{padding:20px 16px 12px}
}
@media(max-width:620px){
  #countDialog{width:calc(100vw - 8px);height:97vh;max-height:97vh;border-radius:14px}
  #countDialog .count-editor{width:100%;height:100%;max-height:none;padding:16px 12px 10px}
  #countDialog .count-table{max-height:none}
  #countDialog .count-table table{min-width:720px}
}

/* v0.19.5: distinct on-order availability without implying physical stock. */
.stock.preorder{background:#e9f3ff;color:#174f87;border:1px solid #cbdff7}
.preorder-admin{background:#e9f3ff;color:#174f87}

/* v0.19.6 — visual-only breakdown of orders; no financial or stock writes. */
.orders-table{min-width:1220px}
.orders-table th:nth-child(7),.orders-table td:nth-child(7){min-width:260px}
.order-money-guide{display:flex;gap:12px;align-items:flex-start;background:#f5faf6;color:#385d46;font-size:12px;line-height:1.55;margin-top:12px;margin-bottom:12px}
.order-money-guide>b{white-space:nowrap;color:#1c5331}
.order-money-grid{display:grid;grid-template-columns:1fr 1fr;gap:7px;min-width:245px}
.order-money-grid span{display:block;font-size:10px;color:#66766c;line-height:1.3}
.order-money-grid b{display:block;font-size:13px;margin-top:3px;color:#193e28;white-space:nowrap}
.order-money-grid .order-money-active b{color:#146b39}
.order-money-warning{display:block;color:#a14d00;font-weight:700;margin-top:5px}
.order-detail-values .order-detail-active{background:#eaf7ed;border-color:#b9dfc3}
.order-detail-values .order-detail-active b{font-size:18px;color:#146b39}
@media(max-width:800px){.order-money-guide{display:block}.order-money-guide>b{display:block;margin-bottom:4px}}
/* v0.19.7: editable web orders with customer-specific prices. */
#orderEditDialog{width:min(96vw,1160px);max-width:none;max-height:94vh;overflow-y:auto}
#orderEditDialog .order-edit-card{padding:27px 30px}
.order-edit-card h2{margin:0 0 8px;color:#19402a}
.order-edit-card .confirm-hint{padding:13px 15px;background:#f0f8f2;border:1px solid #d2e8d8;border-radius:12px;line-height:1.55}
.order-edit-amounts{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;margin:16px 0}
.order-edit-amounts span{border:1px solid #dfe9e1;background:#f5faf6;border-radius:12px;padding:12px;color:#536d5a;font-size:12px}
.order-edit-amounts b{display:block;color:#146b39;font-size:23px;margin-top:5px}
.order-edit-line{padding:15px;margin:12px 0;border:1px solid #dae6dd;border-radius:13px}
.order-edit-line-head{display:flex;justify-content:space-between;gap:10px;align-items:center}
.order-edit-line>label{display:block;font-size:12px;font-weight:700;margin-top:9px}
.order-edit-line select{width:100%;padding:10px;border:1px solid #d7e1d9;border-radius:9px;background:#fff;margin-top:5px}
.order-edit-fields{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;align-items:end;margin-top:12px}
.order-edit-fields label{font-size:12px;color:#405c48;font-weight:700;display:block}
.order-edit-fields input{width:100%;min-width:0;padding:10px;border:1px solid #d4e0d6;border-radius:9px;margin-top:6px}
.edit-base-price{display:block;padding:11px 3px;color:#46624e;font-weight:800}
.edit-subtotal-wrap{font-size:12px;color:#607466}
.edit-subtotal-wrap b{display:block;font-size:18px;color:#146b39;margin-top:8px}
.order-edit-reason{display:block;margin:16px 0;font-size:13px;font-weight:700;color:#405b48}
.order-edit-reason textarea{display:block;width:100%;margin-top:7px;padding:11px;border:1px solid #d5e2d8;border-radius:10px}
.order-edit-card .editor-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:16px}
.order-edit-card button:disabled{opacity:.5;cursor:not-allowed}
.edit-order-button{background:#eaf7ee;border-color:#a8d7b6;color:#166534}
.order-revised-note{display:block;margin-top:5px;color:#166534;font-size:11px;font-weight:700}
@media(max-width:850px){.order-edit-fields{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:620px){#orderEditDialog{width:calc(100vw - 8px);max-height:97vh}#orderEditDialog .order-edit-card{padding:18px 12px}.order-edit-fields{grid-template-columns:repeat(2,minmax(0,1fr))}.order-edit-amounts{grid-template-columns:1fr}.order-edit-card .editor-actions{flex-wrap:wrap}}


/* BARAMA v0.19.8 — órdenes compactas, sin tabla ancha ni desplazamiento lateral.
   Solo presentación: todas las acciones, valores y consultas originales se conservan. */
.orders-help-compact{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px;padding:11px 16px;margin:12px 0;font-size:12px;line-height:1.4;color:#425b49}
.orders-help-compact details{position:relative}
.orders-help-compact summary{cursor:pointer;color:#166534;font-weight:800;list-style:revert}
.orders-help-compact details[open]{width:100%}
.orders-help-compact details p{margin:9px 0 0;color:#54685a;max-width:1000px}
.orders-board{padding:0;margin-top:14px;overflow:visible;min-width:0}
.orders-board-header,.orders-board-row{display:grid;grid-template-columns:minmax(0,1.22fr) minmax(0,.87fr) minmax(0,2.05fr) minmax(0,.8fr) minmax(0,1.05fr);gap:14px;align-items:center}
.orders-board-header{padding:13px 16px;background:#f3f7f4;border-radius:18px 18px 0 0;color:#526a59;font-size:12px;font-weight:850}
.orders-board-row{padding:14px 16px;border-top:1px solid #e6ece7;background:#fff;min-width:0}
.orders-board-row:last-child{border-radius:0 0 18px 18px}
.orders-board-row>*{min-width:0;overflow-wrap:anywhere}
.orders-board-identity{display:flex;align-items:flex-start;flex-direction:column;gap:5px}
.orders-board-number{font-size:14px;line-height:1.2;color:#123d25;letter-spacing:.01em;white-space:nowrap}
.orders-board-customer{font-size:13px;line-height:1.32;color:#18281e;font-weight:650}
.orders-board-identity .pill{font-size:10px;padding:3px 8px}
.orders-board-dates{display:flex;flex-direction:column;align-items:flex-start;gap:3px;font-size:12px}
.orders-board-dates>b{font-size:12px;white-space:nowrap}
.orders-field-label{display:block;color:#738579;font-size:10px;font-weight:650;line-height:1.3}
.orders-board-dates .orders-field-label:not(:first-child){margin-top:5px}
.orders-board-dates .delivery-set{font-size:12px}
.orders-board-dates .delivery-set small{font-size:11px}
.orders-board-status{display:flex;flex-direction:column;align-items:flex-start;gap:4px;font-size:12px}
.orders-board-status .orders-field-label:not(:first-child){margin-top:7px}
.orders-board-status .pill{font-size:10px;max-width:100%;overflow-wrap:anywhere}
.order-compact-money{min-width:0}
.order-money-highlights{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:7px}
.order-money-highlights span{display:block;min-width:0;font-size:10px;color:#607466;line-height:1.2}
.order-money-highlights b{display:block;font-size:15px;line-height:1.15;margin-top:4px;color:#1e3827;white-space:nowrap}
.order-money-highlights .order-money-active b{color:#116638}
.order-money-secondary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;margin-top:9px;padding-top:7px;border-top:1px solid #edf1ed}
.order-money-secondary span{font-size:10px;color:#6d7d71;line-height:1.2;min-width:0}
.order-money-secondary b{display:block;font-size:11px;color:#264631;margin-top:3px;white-space:nowrap}
.order-compact-money .order-revised-note{font-size:10px;margin-top:5px}
.orders-board-actions{display:flex;flex-direction:column;align-items:stretch;gap:6px;min-width:0}
.orders-board-actions>.mini{padding:7px 5px;line-height:1.25;font-size:11px;white-space:normal}
.orders-view-button{color:#174c30}
.order-more-actions{position:relative;min-width:0}
.order-more-actions summary{list-style:none;cursor:pointer;text-align:center;padding:7px 5px;border:1px solid #b7d5c0;border-radius:8px;background:#f4faf5;color:#165b34;font-weight:800;font-size:11px;line-height:1.25}
.order-more-actions summary::-webkit-details-marker{display:none}
.order-more-actions summary span{display:inline-block;transition:transform .15s}
.order-more-actions[open] summary span{transform:rotate(180deg)}
.order-extra-buttons{display:grid;grid-template-columns:1fr;gap:6px;margin-top:7px;padding:8px;border:1px solid #d8e6db;border-radius:9px;background:#f8fbf8}
.order-extra-buttons .mini{width:100%;white-space:normal;line-height:1.25;padding:8px 4px;font-size:11px}
.orders-empty{padding:22px;color:#718078}
@media(max-width:1100px){
  .orders-board-header{display:none}
  .orders-board-row{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr) minmax(0,1.55fr);grid-template-areas:"identity dates money" "status actions money";align-items:start;gap:10px 15px}
  .orders-board-identity{grid-area:identity}
  .orders-board-dates{grid-area:dates}
  .orders-board-money{grid-area:money}
  .orders-board-status{grid-area:status}
  .orders-board-actions{grid-area:actions}
  .orders-board-row{border-top:0;border-bottom:1px solid #e3ebe5}
  .orders-board-row:first-child{border-radius:18px 18px 0 0}
}
@media(max-width:690px){
  .orders-board-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-areas:"identity dates" "money money" "status actions";gap:11px 12px}
  .orders-board-money{padding:9px;border-radius:10px;background:#f7faf7}
  .order-money-highlights b{font-size:16px}
  .orders-board-actions{align-self:start}
}
@media(max-width:390px){
  .orders-board-row{grid-template-columns:1fr;grid-template-areas:"identity" "dates" "money" "status" "actions"}
  .orders-board-dates{flex-direction:row;align-items:center;flex-wrap:wrap;gap:4px 8px}
  .orders-board-dates .orders-field-label:not(:first-child){margin-top:0}
}


/* BARAMA v0.19.9 — Compras sin desplazamiento horizontal.
   Solo presentación: sin modificaciones a recepción, lotes, A/P ni ajustes. */
#purchaseDetailDialog{
  width:min(96vw,1120px);max-width:none;max-height:94vh;
  overflow-y:auto;overflow-x:hidden;
}
#purchaseDetailDialog .purchase-detail{
  width:100%;max-width:none;min-width:0;
  padding:25px 28px 28px;overflow-x:hidden;
}
#purchaseDetailDialog .compact-head{padding-right:44px;align-items:center;flex-wrap:wrap;gap:12px}
#purchaseDetailDialog .compact-head>div:first-child{min-width:0;flex:1 1 280px}
#purchaseDetailDialog .compact-head h2{overflow-wrap:anywhere}
#purchaseDetailDialog .compact-head .row-actions{flex:0 1 auto;justify-content:flex-end}
#purchaseDetailDialog .detail-total{gap:12px;flex-wrap:wrap}
#purchaseDetailDialog .purchase-detail-table-wrap{width:100%;min-width:0;overflow-x:hidden}
#purchaseDetailDialog .purchase-detail-table,
#purchaseDetailDialog .purchase-adjustments-table{width:100%;min-width:0;table-layout:fixed}
#purchaseDetailDialog .purchase-detail-table th,
#purchaseDetailDialog .purchase-detail-table td,
#purchaseDetailDialog .purchase-adjustments-table th,
#purchaseDetailDialog .purchase-adjustments-table td{
  padding:12px 9px;overflow-wrap:anywhere;vertical-align:top;
}
#purchaseDetailDialog .purchase-detail-table th:first-child{width:38%}
#purchaseDetailDialog .purchase-detail-table th:nth-child(2){width:11%}
#purchaseDetailDialog .purchase-detail-table th:nth-child(3){width:15%}
#purchaseDetailDialog .purchase-detail-table th:nth-child(4){width:18%}
#purchaseDetailDialog .purchase-detail-table th:nth-child(5){width:18%}
#purchaseDetailDialog .purchase-detail-table th:not(:first-child),
#purchaseDetailDialog .purchase-detail-table td:not(:first-child){text-align:right}
#purchaseDetailDialog .purchase-adjustments-table th:nth-child(2){width:38%}
#purchaseDetailDialog .purchase-detail-table .block{overflow-wrap:anywhere;line-height:1.4}
#purchaseDetailDialog .document-row{min-width:0}
#purchaseDetailDialog .document-row>div:first-child{min-width:0;overflow-wrap:anywhere}
#purchaseDetailDialog .document-row .row-actions{flex-shrink:0}
/* Listado: columnas compactas en escritorio y tarjetas legibles en pantallas estrechas. */
.purchase-list-card{overflow-x:hidden}
.purchase-list-table{table-layout:fixed;width:100%}
.purchase-list-table th,.purchase-list-table td{padding:12px 9px;overflow-wrap:anywhere;vertical-align:middle}
.purchase-list-table th:nth-child(1){width:13%}
.purchase-list-table th:nth-child(2){width:21%}
.purchase-list-table th:nth-child(3){width:12%}
.purchase-list-table th:nth-child(4){width:12%}
.purchase-list-table th:nth-child(5){width:15%}
.purchase-list-table th:nth-child(6){width:20%}
.purchase-list-table th:nth-child(7){width:7%}
.purchase-list-table td:last-child{text-align:right}
.purchase-list-table .pill{white-space:normal}
@media(max-width:900px){
  #purchaseDetailDialog{width:calc(100vw - 16px);max-height:96vh}
  #purchaseDetailDialog .purchase-detail{padding:20px 18px}
  #purchaseDetailDialog .compact-head{align-items:flex-start}
  #purchaseDetailDialog .compact-head .row-actions{justify-content:flex-start}
  .purchase-list-card{padding:12px}
  .purchase-list-table thead{display:none}
  .purchase-list-table,.purchase-list-table tbody{display:block;width:100%}
  .purchase-list-table tr:not(.purchase-empty-row){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 14px;padding:14px;margin:0 0 12px;border:1px solid #e0e8e1;border-radius:12px;background:#fbfdfb}
  .purchase-list-table tr:not(.purchase-empty-row) td{display:block;border:0;padding:0;min-width:0;text-align:left}
  .purchase-list-table tr:not(.purchase-empty-row) td:before{content:attr(data-label);display:block;font-size:10px;font-weight:800;color:#66796b;margin-bottom:3px}
  .purchase-list-table tr:not(.purchase-empty-row) td:nth-child(2){grid-column:1/-1;grid-row:1;font-size:17px}
  .purchase-list-table tr:not(.purchase-empty-row) td:last-child{grid-column:1/-1}
  .purchase-list-table tr:not(.purchase-empty-row) td:last-child button{width:100%;padding:10px}
  .purchase-list-table .purchase-empty-row{display:table-row}
}
@media(max-width:700px){
  #purchaseDetailDialog .purchase-detail{padding:18px 14px}
  #purchaseDetailDialog .compact-head{padding-right:38px;gap:10px}
  #purchaseDetailDialog .compact-head>div:first-child{flex:1 1 auto;width:100%}
  #purchaseDetailDialog .compact-head .row-actions{width:100%;display:grid;grid-template-columns:repeat(2,minmax(0,1fr))}
  #purchaseDetailDialog .compact-head .row-actions button{min-width:0;padding:9px 7px;font-size:12px}
  #purchaseDetailDialog .detail-total b{font-size:21px}
  #purchaseDetailDialog .purchase-detail-table thead,
  #purchaseDetailDialog .purchase-adjustments-table thead{display:none}
  #purchaseDetailDialog .purchase-detail-table,
  #purchaseDetailDialog .purchase-detail-table tbody,
  #purchaseDetailDialog .purchase-adjustments-table,
  #purchaseDetailDialog .purchase-adjustments-table tbody{display:block;width:100%}
  #purchaseDetailDialog .purchase-detail-table tr,
  #purchaseDetailDialog .purchase-adjustments-table tr:not(:has(td[colspan])){display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:13px;margin:0 0 10px;border:1px solid #e0e8e1;border-radius:12px;background:#fbfdfb}
  #purchaseDetailDialog .purchase-detail-table td,
  #purchaseDetailDialog .purchase-adjustments-table tr:not(:has(td[colspan])) td{display:block;border:0;padding:0;text-align:left!important;min-width:0}
  #purchaseDetailDialog .purchase-detail-table td:before,
  #purchaseDetailDialog .purchase-adjustments-table tr:not(:has(td[colspan])) td:before{content:attr(data-label);display:block;font-size:10px;font-weight:800;color:#66796b;margin-bottom:4px}
  #purchaseDetailDialog .purchase-detail-table td:first-child,
  #purchaseDetailDialog .purchase-adjustments-table tr:not(:has(td[colspan])) td:nth-child(2){grid-column:1/-1}
  #purchaseDetailDialog .purchase-detail-table td:first-child{font-size:15px}
  #purchaseDetailDialog .purchase-adjustments-table tr:has(td[colspan]) td{display:block;padding:12px 4px;white-space:normal}
  #purchaseDetailDialog .document-row{align-items:stretch}
  #purchaseDetailDialog .document-row .row-actions{width:100%}
}
@media(max-width:390px){
  #purchaseDetailDialog{width:calc(100vw - 8px);max-height:97vh;border-radius:14px}
  #purchaseDetailDialog .purchase-detail{padding:16px 10px}
  .purchase-list-table tr:not(.purchase-empty-row){gap:8px}
}

/* v0.20.0 — inventario: modales amplios, sin desplazamiento horizontal */
#writeoffDialog,#correctionDialog{
  box-sizing:border-box;
  width:min(96vw,1440px);
  max-width:none;
  max-height:94vh;
  overflow-x:hidden;
  overflow-y:auto;
}
#writeoffDialog .purchase-editor,#correctionDialog .correction-editor{
  box-sizing:border-box;
  width:100%;max-width:none;max-height:none;
  padding:clamp(18px,2.5vw,34px);
  overflow-x:hidden;
}
#writeoffDialog .purchase-header-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
#writeoffDialog .purchase-grid{grid-template-columns:minmax(0,2fr) minmax(130px,1fr) minmax(0,1.4fr);gap:14px}
#writeoffDialog .purchase-grid .span-2{grid-column:auto}
#writeoffDialog .purchase-header-grid .span-2{grid-column:span 2}
#writeoffDialog .purchase-header-grid label,#writeoffDialog .purchase-grid label{min-width:0}
#writeoffDialog input,#writeoffDialog select,#writeoffDialog textarea,#correctionDialog input,#correctionDialog select,#correctionDialog textarea{box-sizing:border-box;max-width:100%;width:100%;min-width:0}
#writeoffDialog .purchase-header-grid textarea{min-height:84px;resize:vertical}
#writeoffDialog .purchase-section-title{flex-wrap:wrap}
#writeoffDialog .editor-actions,#correctionDialog .editor-actions{bottom:0;z-index:2;flex-wrap:wrap}
.inventory-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}
.inventory-history{overflow-x:auto}
.inventory-history table{min-width:0}
.correction-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:22px 0}
.correction-grid label{min-width:0;font-size:13px;font-weight:800;color:#425548}
.correction-grid label.corr-wide{grid-column:1/-1}
.correction-grid input,.correction-grid select,.correction-grid textarea{display:block;margin-top:7px;padding:12px;border:1px solid #d7e1d9;border-radius:10px;background:#fff;font:inherit}
.correction-grid textarea{resize:vertical;min-height:90px}
.correction-preview{padding:16px 18px;background:#edf7f0;border:1px solid #cfe6d4;border-radius:13px;color:#1e5233}
.correction-preview>small{display:block;margin-top:4px;color:#62766a}
.correction-stats{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;margin-top:14px}
.correction-stats span{padding:11px;background:#fff;border:1px solid #dbe9dd;border-radius:10px;font-size:12px;color:#6b786e}
.correction-stats b{display:block;margin-top:4px;font-size:22px;color:#19552f}
@media(max-width:800px){
  #writeoffDialog,#correctionDialog{width:calc(100vw - 14px);max-height:96vh}
  #writeoffDialog .purchase-header-grid,#writeoffDialog .purchase-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  #writeoffDialog .purchase-grid .span-2{grid-column:span 2}
  #writeoffDialog .purchase-header-grid .span-2{grid-column:span 2}
}
@media(max-width:540px){
  #writeoffDialog,#correctionDialog{width:calc(100vw - 8px);max-height:97vh;border-radius:13px}
  #writeoffDialog .purchase-editor,#correctionDialog .correction-editor{padding:20px 12px 12px}
  #writeoffDialog .purchase-header-grid,#writeoffDialog .purchase-grid,.correction-grid{grid-template-columns:1fr;gap:12px}
  #writeoffDialog .purchase-grid .span-2,#writeoffDialog .purchase-header-grid .span-2{grid-column:auto}
  .correction-stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .inventory-actions{width:100%}.inventory-actions button{flex:1}
}


/* BARAMA v0.20.1 — catálogo: encuadre específico, sin cambiar imágenes de Supabase.
   Ajuste aplicado solo a Coco Seco y Queso Oaxaca Don Chuy. */
.portal-body .product[data-photo-frame="coco-seco"] .photo,
.portal-body .product[data-photo-frame="queso-oaxaca"] .photo {
  overflow:hidden;
  background:#fff;
  display:grid;
  place-items:center;
}
.portal-body .product[data-photo-frame="coco-seco"] .photo img {
  width:100%;height:100%;object-fit:contain;object-position:center center;
  transform:translateY(-12%) scale(.83);transform-origin:center center;
}
.portal-body .product[data-photo-frame="queso-oaxaca"] .photo img {
  width:100%;height:100%;object-fit:contain;object-position:center center;
  transform:translateY(-9%) scale(.78);transform-origin:center center;
}
@media(max-width:560px){
  .portal-body .product[data-photo-frame="coco-seco"] .photo img{transform:translateY(-9%) scale(.86)}
  .portal-body .product[data-photo-frame="queso-oaxaca"] .photo img{transform:translateY(-7%) scale(.80)}
}

/* v0.20.5: Red Onion Jumbo — reduce scale a bit and keep full onion visible */
.portal-body .product[data-photo-frame="red-onion"] .photo{
  background:#fff;
  padding:12px 12px 16px;
}
.portal-body .product[data-photo-frame="red-onion"] .photo img{
  width:100%;
  height:100%;
  object-fit:contain;
  object-position:center center;
  transform:scale(.90) translateY(-2%);
  transform-origin:center center;
  display:block;
}
@media(max-width:560px){
  .portal-body .product[data-photo-frame="red-onion"] .photo{
    padding:10px 10px 14px;
  }
  .portal-body .product[data-photo-frame="red-onion"] .photo img{
    transform:scale(.88) translateY(-1%);
  }
}

/* v0.20.4: B2B required contact details; keeps catalog order dialog compact */
.order-contact-error{background:#fff0f0;border:1px solid #e6b5b5;color:#922525;border-radius:10px;padding:10px 12px;margin:12px 0 0;font-size:13px;font-weight:700}
.order-contact-error[hidden]{display:none}
.customer-fields input.invalid-contact{border:2px solid #c53d3d;outline-offset:2px}
.customer-fields label{line-height:1.5}
.order-no-phone{color:#9b4b17}

/* BARAMA v0.20.6 — Acciones de cantidades visibles y modales adaptables. */
#purchaseDetailDialog .purchase-qty-action{
  display:inline-flex;align-items:center;justify-content:center;
  margin-top:10px;padding:7px 11px;white-space:normal;
  background:#eaf5ed;border:1px solid #a8d2b2;color:#145c31;
  font-size:12px;line-height:1.25;cursor:pointer;
}
#purchaseDetailDialog .purchase-qty-action:hover{background:#d9eedf}
#purchaseAdjustmentDialog{
  width:min(96vw,1160px);max-width:none;max-height:94vh;
  overflow-y:auto;overflow-x:hidden;
}
#purchaseAdjustmentDialog .purchase-editor{
  width:100%;max-width:none;max-height:none;overflow:visible;
  padding:28px 32px 30px;
}
#purchaseAdjustmentDialog .purchase-header-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
#purchaseAdjustmentDialog .purchase-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
#purchaseAdjustmentDialog .purchase-header-grid label,
#purchaseAdjustmentDialog .purchase-grid label,
#purchaseAdjustmentDialog .purchase-extra-grid label{min-width:0}
#purchaseAdjustmentDialog .purchase-line{min-width:0}
#purchaseAdjustmentDialog .purchase-line-head{gap:10px;flex-wrap:wrap}
#purchaseAdjustmentDialog .purchase-summary{grid-template-columns:repeat(4,minmax(0,1fr))}
#purchaseQuantityDialog{width:min(94vw,760px);max-width:none;max-height:94vh;overflow-y:auto;overflow-x:hidden}
#purchaseQuantityDialog .purchase-editor{width:100%;max-width:none;max-height:none;overflow:visible;padding:26px 28px}
#purchaseQuantityDialog .purchase-header-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
#purchaseQuantityDialog .purchase-summary{grid-template-columns:repeat(3,minmax(0,1fr))}
@media(max-width:850px){
  #purchaseAdjustmentDialog .purchase-header-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  #purchaseAdjustmentDialog .purchase-summary{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:600px){
  #purchaseAdjustmentDialog,#purchaseQuantityDialog{width:calc(100vw - 12px);max-height:96vh}
  #purchaseAdjustmentDialog .purchase-editor,#purchaseQuantityDialog .purchase-editor{padding:22px 14px 18px}
  #purchaseAdjustmentDialog .purchase-header-grid,#purchaseAdjustmentDialog .purchase-grid,
  #purchaseAdjustmentDialog .purchase-extra-grid,#purchaseAdjustmentDialog .purchase-summary,
  #purchaseQuantityDialog .purchase-header-grid,#purchaseQuantityDialog .purchase-summary{grid-template-columns:1fr}
  #purchaseAdjustmentDialog .span-2,#purchaseQuantityDialog .span-2{grid-column:auto}
}


/* BARAMA v0.20.8 — Checkout claro y accesible en teléfonos.
   El badge de Netlify se desactiva en el panel de Netlify, no con CSS. */
@media (max-width: 650px) {
  .portal-body {
    padding-bottom: calc(120px + env(safe-area-inset-bottom, 0px));
  }
  .portal-body .orderbar {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
    min-width: 0;
    padding: 12px;
    gap: 12px;
    z-index: 50;
    border-radius: 16px;
    box-shadow: 0 6px 30px rgba(0,0,0,.20);
  }
  .portal-body .orderbar > div {
    flex: 0 1 38%;
    min-width: 0;
  }
  .portal-body .orderbar small {font-size: 12px;line-height: 1.3}
  .portal-body .orderbar b {font-size: 18px;white-space: nowrap}
  .portal-body .orderbar button {
    flex: 1 1 62%;
    min-width: 0;
    min-height: 52px;
    font-size: 15px;
    padding: 10px 12px;
    white-space: normal;
    line-height: 1.25;
  }
  .portal-body #orderDialog {
    width: calc(100vw - 20px);
    max-width: none;
    max-height: calc(100dvh - 22px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 16px;
  }
  .portal-body #orderDialog .dialog-card {padding: 22px 16px 14px}
  .portal-body #orderDialog .customer-fields {grid-template-columns: 1fr}
  .portal-body #orderDialog .customer-fields input {min-height: 46px;font-size: 16px}
  .portal-body #orderDialog .checkout-actions {
    position: sticky;
    bottom: 0;
    z-index: 3;
    padding: 12px 0 calc(8px + env(safe-area-inset-bottom, 0px));
    background: #fff;
    box-shadow: 0 -8px 14px rgba(255,255,255,.96);
  }
  .portal-body #orderDialog #place {min-height: 52px;margin: 0;font-size: 16px}
  .portal-body #orderDialog .oline {gap: 8px}
}
@media (max-width: 360px) {
  .portal-body .orderbar {left: 7px;right: 7px;gap: 8px;padding: 9px}
  .portal-body .orderbar b {font-size: 16px}
  .portal-body .orderbar button {font-size: 14px}
}

/* v0.21.1 — Botón para imprimir pedidos desde el detalle */
#orderDetailDialog #printOrderDetail{border-color:#8bb79a;color:#155c34;background:#f0f8f2;font-weight:800}
#orderDetailDialog #printOrderDetail:hover{background:#e3f3e8}
@media(max-width:620px){#orderDetailDialog .editor-actions{flex-wrap:wrap}#orderDetailDialog #printOrderDetail{flex:1 1 auto}}

/* v0.21.5 — confirmación de devolución a proveedor */
.return-confirm-line{display:flex;gap:12px;align-items:flex-start;padding:14px;border:1px solid #b7d8c4;background:#f0f8f2;border-radius:10px;margin:14px 0;font-size:14px;line-height:1.45}
.return-confirm-line input{flex:0 0 auto;accent-color:#166534;width:18px;height:18px;margin-top:2px}


/* v0.21.6 — Ventana ampliada para devolución de mercancía; evita
   el desbordamiento horizontal que ocultaba las cantidades y acciones. */
#purchaseReturnDialog {
  width: min(96vw, 1220px);
  max-width: none;
  max-height: 94vh;
  max-height: 94dvh;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: 20px;
}
#purchaseReturnDialog .supplier-return-editor {
  width: 100%;
  max-width: none;
  max-height: none;
  overflow: visible;
  padding: 28px 34px 24px;
}
#purchaseReturnDialog .purchase-header-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
}
#purchaseReturnDialog .purchase-header-grid label {
  min-width: 0;
  overflow-wrap: anywhere;
}
#purchaseReturnDialog .purchase-header-grid .span-4 {
  grid-column: 1 / -1;
}
#purchaseReturnDialog .purchase-header-grid textarea {
  display: block;
  width: 100%;
  min-height: 80px;
  resize: vertical;
  margin-top: 6px;
  padding: 11px;
  border: 1px solid #d7e1d9;
  border-radius: 10px;
  font: inherit;
}
#purchaseReturnDialog .purchase-summary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
#purchaseReturnDialog .purchase-summary span { min-width: 0; }
#purchaseReturnDialog .return-confirm-line span { min-width: 0; }
#purchaseReturnDialog .editor-actions {
  bottom: 0;
  flex-wrap: wrap;
  align-items: center;
  z-index: 2;
  padding-top: 12px;
  padding-bottom: 4px;
}
@media (max-width: 900px) {
  #purchaseReturnDialog .supplier-return-editor { padding: 24px 20px 20px; }
  #purchaseReturnDialog .purchase-header-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #purchaseReturnDialog .purchase-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 580px) {
  #purchaseReturnDialog {
    width: calc(100vw - 12px);
    max-height: 97vh;
    max-height: 97dvh;
    border-radius: 14px;
  }
  #purchaseReturnDialog .supplier-return-editor { padding: 22px 14px 16px; }
  #purchaseReturnDialog .purchase-header-grid { grid-template-columns: 1fr; }
  #purchaseReturnDialog .purchase-header-grid .span-2,
  #purchaseReturnDialog .purchase-header-grid .span-4 { grid-column: 1; }
  #purchaseReturnDialog .purchase-summary { grid-template-columns: 1fr; }
  #purchaseReturnDialog .editor-actions button { flex: 1 1 100%; }
}

/* BARAMA v0.21.7 - Registrar gasto en pantalla amplia, sin scroll lateral */
#expenseDialog { box-sizing:border-box; width:min(96vw,1400px); max-width:none; max-height:94vh; overflow-y:auto; overflow-x:hidden; }
#expenseDialog .expense-editor { box-sizing:border-box; width:100%; max-width:none; max-height:none; padding:clamp(20px,2.5vw,36px); overflow:visible; }
#expenseDialog .expense-editor .purchase-header-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px 24px; margin:16px 0; }
#expenseDialog .expense-editor label { min-width:0; font-size:14px; }
#expenseDialog .expense-editor .purchase-header-grid input, #expenseDialog .expense-editor .purchase-header-grid select { min-width:0; width:100%; font-size:16px; padding:13px 12px; }
#expenseDialog .expense-editor .span-2 {grid-column:1/-1;}
#expenseDialog .expense-editor .field-block textarea {min-height:100px; resize:vertical;}
#expenseDialog .expense-editor .editor-actions {position:sticky;bottom:-1px;background:#fff;padding:16px 2px 4px;z-index:2;}
@media(max-width:650px){#expenseDialog {width:calc(100vw - 12px);max-height:96vh;}#expenseDialog .expense-editor {padding:22px 16px;}#expenseDialog .expense-editor .purchase-header-grid{grid-template-columns:minmax(0,1fr);gap:12px;}#expenseDialog .expense-editor .span-2{grid-column:auto;}}
/* BARAMA v0.21.7 - Fletes sencillos */
#freightDialog{box-sizing:border-box;width:min(96vw,1180px);max-width:none;max-height:94vh;overflow-y:auto;overflow-x:hidden;}
#freightDialog .purchase-editor{width:100%;max-width:none;max-height:none;box-sizing:border-box;padding:clamp(18px,2.4vw,34px);overflow:visible;}
#freightDialog label{min-width:0;}
.freight-summary {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:12px 0;background:#edf8f0;border-radius:14px;padding:16px;}
.freight-summary span{font-size:13px;color:#55705e;}.freight-summary b{display:block;font-size:20px;color:#166534;margin-top:6px;}
.freight-purchase-choices{max-height:250px;overflow-y:auto;overflow-x:hidden;border:1px solid #dce5de;border-radius:12px;padding:10px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
.freight-purchase-choice{display:flex;gap:10px;align-items:flex-start;border:1px solid #edf1ed;border-radius:9px;padding:10px;font-size:13px;cursor:pointer;min-width:0;}
.freight-purchase-choice input{width:auto!important;flex:none;margin-top:4px;}.freight-purchase-choice.disabled{opacity:.55;cursor:not-allowed;}
.freight-check-all{display:flex;gap:20px;justify-content:space-between;flex-wrap:wrap;align-items:center;margin-top:14px;}.freight-check-all label{display:flex;gap:8px;align-items:center;}
.freight-list td{vertical-align:middle;white-space:nowrap;}.freight-list td:nth-child(3){white-space:normal;min-width:190px;}
@media(max-width:700px){#freightDialog .purchase-header-grid{grid-template-columns:repeat(2,minmax(0,1fr));}.freight-purchase-choices{grid-template-columns:1fr;}.freight-summary{grid-template-columns:1fr 1fr;}.freight-pay-card .pagehead{flex-direction:column;align-items:flex-start;}}
@media(max-width:480px){#freightDialog .purchase-header-grid{grid-template-columns:1fr;}.freight-summary{grid-template-columns:1fr;}#freightDialog{width:calc(100vw - 10px);}}

/* v0.21.8 — Vista sencilla, de sólo lectura, de reparto de fletes */
#freightDistributionDialog {width:min(1060px,calc(100vw - 24px));max-width:none;max-height:92vh;overflow:auto;}
#freightDistributionDialog .freight-distribution-card {padding:clamp(18px,3vw,30px);}
.freight-distribution-summary {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:20px 0 14px;}
.freight-distribution-summary>div {padding:16px;border-radius:13px;background:#f0f7f1;min-width:0;}
.freight-distribution-summary span {display:block;color:#5e7165;font-size:12px;}
.freight-distribution-summary b {display:block;margin-top:5px;font-size:23px;color:#155b31;}
.freight-distribution-status {padding:11px 14px;border-radius:10px;font-size:13px;font-weight:700;}
.freight-distribution-status.ok {background:#e7f6ec;color:#176138;}
.freight-distribution-status.warning {background:#fff1db;color:#805300;}
.freight-distribution-group {border:1px solid #dfe8e1;border-radius:14px;margin:14px 0;overflow:hidden;}
.freight-distribution-group-head {display:flex;justify-content:space-between;align-items:center;gap:10px;padding:14px 16px;background:#f7faf7;}
.freight-distribution-group-head>b {color:#155b31;font-size:19px;}
.freight-distribution-group .table-scroll {overflow-x:auto;}
.freight-distribution-group table {min-width:545px;}
.freight-distribution-loading {padding:22px;color:#627369;}
@media(max-width:650px){.freight-distribution-summary{grid-template-columns:1fr 1fr;}.freight-distribution-summary>div:last-child{grid-column:1/-1;}}

/* v0.21.9 — número de factura después de recepción. */
.purchase-invoice-cell{display:flex;flex-wrap:wrap;align-items:center;gap:7px;min-width:0}
.purchase-invoice-cell>span{overflow-wrap:anywhere}
.purchase-invoice-action{font-size:12px!important;padding:5px 9px!important;white-space:nowrap;vertical-align:middle}
.purchase-invoice-editor{width:min(94vw,540px)!important;max-width:540px;min-width:0;overflow-x:hidden}
.purchase-invoice-editor input{width:100%;max-width:100%;min-width:0}
#purchaseDetailDialog .compact-head .fine .purchase-invoice-action{margin:0 3px}
@media(max-width:650px){.purchase-invoice-editor{width:min(96vw,540px)!important;padding:20px 16px!important}.purchase-invoice-editor .editor-actions{flex-wrap:wrap}.purchase-invoice-editor .editor-actions button{flex:1 1 160px}}

/* v0.21.11 — self-service, non-destructive product image framing controls */
#productDialog{width:min(800px,calc(100vw - 24px));max-width:800px}
.product-editor{max-height:min(92vh,980px)}
.photo-editor{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:18px;align-items:start}
.photo-editor-preview{min-width:0}
.photo-preview{width:100%;height:auto;aspect-ratio:900/620;padding:5px;position:relative;display:grid;place-items:center;overflow:hidden}
.photo-preview canvas{width:100%;height:100%;display:block;touch-action:none;cursor:grab;background:#fff}
.photo-preview canvas:active{cursor:grabbing}
.photo-preview [hidden],.photo-adjust-controls[hidden]{display:none!important}
.photo-empty{font-size:13px;color:#607465;padding:15px}
.photo-preview-caption{display:block;text-align:center;font-size:11px;color:#637b6a;margin-top:6px}
.photo-editor-controls{min-width:0}
.photo-editor-controls .fine{line-height:1.5;margin:8px 0 10px}
.photo-adjust-controls{display:grid;gap:5px;margin-top:10px}
.photo-adjust-controls label{display:flex;justify-content:space-between;gap:8px;font-size:12px;color:#314a37;font-weight:800}
.photo-adjust-controls output{color:#136234;font-variant-numeric:tabular-nums}
.photo-adjust-controls input[type=range]{width:100%;accent-color:#16713b;cursor:pointer;margin:0 0 7px}
.photo-reset{margin:8px 0 4px;width:100%}
.photo-editor-tip{font-size:11px;color:#677768;font-weight:400;line-height:1.4}
#pPhotoStatus{margin-top:8px;min-height:20px;color:#315c40}
@media(max-width:650px){
 #productDialog{width:calc(100vw - 14px);max-width:none}
 .photo-editor{grid-template-columns:1fr}
 .photo-preview{aspect-ratio:900/620}
}

/* BARAMA Cloud v0.21.12 — transparente: precio del empaque + equivalente informativo */
.unit-comparison-editor{grid-column:1/-1;background:#f2f8f3;border:1px solid #d5e7d9;padding:15px;border-radius:14px;margin:4px 0;}
.unit-comparison-editor h3{margin:0 0 6px;color:#17452a;font-size:16px;}
.unit-comparison-editor .fine{line-height:1.5;margin:0 0 13px;color:#526b58;}
.comparison-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;}
.comparison-grid label{min-width:0;}
.comparison-approx{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:700;margin:12px 0!important;color:#34533b;}
.comparison-approx input{width:auto!important;margin:0!important;accent-color:#166534;}
.comparison-preview{background:#fff;border:1px solid #dce8de;border-radius:10px;padding:10px 12px;color:#13562c;font-weight:800;font-size:13px;line-height:1.45;margin-top:8px;}
.equivalent-table-price{color:#155f34!important;font-weight:800;}
.per-package-price{font-size:12px;color:#5b7263;font-weight:700;white-space:nowrap;}
.equivalent-price{margin-top:6px;padding:8px 10px;background:#eff8f1;color:#1c6238;border:1px solid #dcecdf;border-radius:9px;line-height:1.4;font-size:12px;}
.equivalent-price span{font-weight:500;}
.equivalent-price strong{font-weight:900;white-space:nowrap;}
.origin-meta{font-size:11px;color:#5f7869;margin:2px 0 7px;}
@media(max-width:650px){.comparison-grid{grid-template-columns:minmax(0,1fr);}.unit-comparison-editor{padding:12px;}}

/* v0.21.13 · Próxima disponibilidad sin alterar inventario o compras. */
.arrival-editor{grid-column:1/-1;border:1px solid #c9dfcf;border-radius:13px;background:#f4faf5;padding:14px;margin:5px 0;}
.arrival-editor h3{margin:0 0 8px;font-size:15px;color:#194c2e;}
.arrival-editor label{display:block;max-width:310px;font-weight:700;margin-top:10px;}
.arrival-editor input[type="date"]{display:block;width:100%;padding:10px;border:1px solid #b6d0be;border-radius:10px;margin-top:6px;color:#163e2a;background:#fff;}
.arrival-preview{font-size:14px;font-weight:900;background:#e2f3e6;border:1px solid #b9ddc3;border-radius:10px;padding:10px 12px;color:#166534;margin:12px 0 5px;}
.stock.arrival{background:#fff2d6;border:1px solid #e7ca7f;color:#81590f;font-size:12px;padding:7px 10px;}
.arrival-caveat{font-size:10px;line-height:1.4;color:#80632b;margin-top:6px;}
.photo{position:relative;}
.arrival-photo-chip{position:absolute;left:10px;top:10px;z-index:2;padding:5px 10px;border-radius:999px;background:#f5d877;color:#573b04;font-size:10px;font-weight:900;box-shadow:0 2px 7px #0001;pointer-events:none;}
.arrival-checkout{grid-column:1/-1;color:#81590f;font-size:11px;}

/* v0.21.14 · Optional manual availability badge; inventory remains authoritative. */
.availability-override-editor{grid-column:1/-1;border:1px solid #c7d6de;background:#f6f9fa;padding:14px;border-radius:13px;margin:5px 0}
.availability-override-editor h3{margin:0 0 8px;font-size:15px;color:#244c59}
.availability-override-editor label{display:block;max-width:365px;font-weight:700;margin-top:10px}
.availability-override-editor select{display:block;width:100%;margin-top:6px;padding:11px;background:#fff;border:1px solid #bdcfd4;border-radius:10px;color:#1c3c46}
.availability-override-preview{margin:12px 0 7px;background:#e5f0f4;color:#214d5b;border:1px solid #c8dfe5;padding:10px 12px;border-radius:10px;font-size:12px;font-weight:700;line-height:1.4}
.availability-override-preview.override-is-soldout{background:#faeaea;border-color:#edc6c6;color:#8c2d2d}
.availability-admin-badge{font-weight:700;color:#325869}
.manual-stock-caveat{font-size:11px;color:#815913;background:#fff8e7;border:1px solid #ead7b2;border-radius:9px;margin-top:7px;padding:7px 9px;line-height:1.35}

/* v0.21.15 · Arrival announcements always show alongside the current badge. */
.arrival-announcement{display:block;margin-top:9px;padding:9px 11px;border-radius:10px;background:#f3f9ef;border:1px solid #cbdcc4;color:#23562b;line-height:1.4}
.arrival-announcement-title{font-size:12px;font-weight:850;line-height:1.25}
.arrival-announcement-subtitle{font-size:10px;color:#647a5d;margin-top:4px}
@media(max-width:650px){.arrival-announcement{padding:8px 9px}}

/* v0.21.20 — Profit by month, accountant-safe estimate; inventory/photo systems unchanged. */
.profit-section{padding:24px 26px;border-color:#d9e5da}
.profit-section-header{display:flex;justify-content:space-between;align-items:flex-start;gap:20px;flex-wrap:wrap}
.profit-section-header h2{margin:4px 0 5px;color:#16492c;font-size:26px}
.profit-section-header .fine{margin:0;max-width:630px;line-height:1.5}
.profit-eyebrow{font-size:11px;font-weight:900;letter-spacing:.12em;color:#44785a}
.profit-selector{min-width:230px;display:flex;flex-direction:column;gap:6px;font-size:12px;font-weight:800;color:#415e4b}
.profit-selector select{padding:11px 12px;font:inherit;font-size:14px;min-width:230px;border:1px solid #bdcfbf;border-radius:10px;background:#fff;color:#123e29}
.profit-report{display:grid;grid-template-columns:minmax(230px,.9fr) minmax(320px,1.5fr);gap:24px;margin-top:18px;align-items:start}
.profit-estimate{background:linear-gradient(145deg,#154d30,#236c40);color:#fff;border-radius:18px;padding:26px;display:grid;gap:12px;min-width:0}
.profit-estimate.profit-negative{background:linear-gradient(145deg,#8c3836,#a24b39)}
.profit-estimate-overline{color:#dcefe2;font-size:12px;font-weight:700;line-height:1.4}
.profit-estimate-amount{font-size:clamp(29px,3vw,43px);font-weight:900;letter-spacing:-.03em;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.profit-estimate-sub{font-size:12px;line-height:1.5;color:#e4f1e8}
.profit-components{min-width:0}
.profit-row{display:flex;justify-content:space-between;align-items:baseline;gap:16px;padding:9px 0;border-bottom:1px solid #edf1ed;font-size:13px;line-height:1.4}
.profit-row span{color:#566b5a}
.profit-row strong{font-variant-numeric:tabular-nums;white-space:nowrap;font-size:15px}
.profit-row.profit-emphasis{font-weight:800}
.profit-row.profit-emphasis span,.profit-row.profit-total span{color:#174c2d}
.profit-row.profit-total{border-top:2px solid #bed8c1;border-bottom:0;font-weight:900}
.profit-row.profit-total strong{color:#136438;font-size:21px}
.profit-details{padding:10px 0 4px;border-top:1px solid #d9e5db;margin-top:4px}
.profit-details summary{cursor:pointer;font-size:13px;font-weight:800;color:#166534}
.profit-details>div{margin:8px 0 0 16px;padding-left:10px;border-left:2px solid #dbe7dd}
.profit-details .profit-row{font-size:12px}
.profit-separate{background:#f5f8f5;border:1px solid #e2ebe3;padding:12px;border-radius:12px;margin-top:10px}
.profit-separate .profit-row:last-child{border-bottom:0}
.profit-caveat{font-size:12px;line-height:1.55;margin-top:20px;padding:13px 15px;background:#fff9e9;border:1px solid #efdfb9;color:#694f18;border-radius:12px}
@media(max-width:850px){.profit-report{grid-template-columns:1fr}.profit-estimate{padding:20px}}
@media(max-width:600px){.profit-section{padding:16px}.profit-section-header{display:block}.profit-selector{margin-top:16px}.profit-selector select{width:100%}.profit-row{gap:8px}.profit-row strong{font-size:13px}.profit-row.profit-total strong{font-size:17px}}

/* v0.21.21 — Persistent customer order confirmation and self-service copy */
.portal-body #orderDialog .receipt-card {padding:24px;max-width:100%;}
.portal-body #orderDialog .receipt-intro {color:#53685b;line-height:1.5;margin:10px 0}
.portal-body #orderDialog .receipt-status {background:#fff7e0;border:1px solid #ead5a3;border-radius:12px;padding:11px 13px;color:#705017;line-height:1.5}
.portal-body #orderDialog .receipt-business {padding:10px 0;color:#284b36;line-height:1.5;overflow-wrap:anywhere}
.portal-body #orderDialog .receipt-business span {padding:0 5px;color:#a7b3a9}
.portal-body #orderDialog .receipt-card .oline span small {display:block;color:#65746b;font-size:12px;margin:4px 0 0}
.portal-body #orderDialog .receipt-reserved {margin:0 0 15px;text-align:right;color:#647568}
.portal-body #orderDialog .receipt-email-note,.portal-body #orderDialog .receipt-email-hint {background:#eff7f1;border:1px solid #c8e1cf;border-radius:10px;padding:12px;line-height:1.5;font-size:13px;color:#234d36;overflow-wrap:anywhere}
.portal-body #orderDialog .receipt-actions {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:15px 0}
.portal-body #orderDialog .receipt-actions button {background:#fff;border:1px solid #b5d0bb;border-radius:10px;min-height:46px;padding:11px 9px;color:#145e33;font-weight:750;cursor:pointer}
.portal-body #orderDialog .receipt-actions button:hover {background:#e9f6ec}
.portal-body #orderDialog .receipt-actions button:focus-visible {outline:3px solid #76be8a;outline-offset:2px}
.portal-body .last-receipt {border:1px solid #95bea0;border-radius:9px;background:#edf7ef;color:#19532d;font-weight:700;padding:9px 12px;cursor:pointer;min-height:40px}
.portal-body #orderDialog .receipt-card #receiptDone {margin-top:8px;min-height:44px}
@media(max-width:560px){
 .portal-body #orderDialog .receipt-card {padding:18px 14px 16px}
 .portal-body #orderDialog .receipt-actions {grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 .portal-body .orderbar .last-receipt {font-size:11px;line-height:1.2;padding:7px}
}
/* Keep re-open control outside the mobile bottom bar's width so checkout stays usable. */
.portal-body .orderbar .last-receipt {
 position:absolute;right:0;bottom:calc(100% + 8px);min-height:38px;
 min-width:0;max-width:75vw;padding:7px 13px;line-height:1.25;
 background:#edf7ef;box-shadow:0 5px 18px #00000016;
}
/* Keep the final action visible while the receipt details are scrollable. */
.portal-body #orderDialog {max-height: min(90dvh, 920px);overflow-y:auto;overscroll-behavior:contain}
.portal-body #orderDialog .receipt-card #receiptDone {
  position:sticky;bottom:0;z-index:4;display:block;
  box-shadow:0 -7px 13px #fffffff0;
}
@media(max-width:650px){.portal-body #orderDialog{max-height:calc(100dvh - 22px)}}

/* v0.21.22: auditoría y corrección segura de pedidos entregados */
#deliveredEditDialog{width:calc(100% - 18px);max-width:920px;max-height:96vh;overflow-y:auto}
#deliveredEditDialog .delivered-edit-card{padding:24px 27px}
.delivered-edit-card h2{margin:0 0 8px;color:#19402a}
.delivered-edit-card h3{margin:20px 0 5px;color:#19402a}
.delivered-edit-card .confirm-hint{padding:13px 15px;background:#f0f8f2;border:1px solid #d2e8d8;border-radius:12px;line-height:1.55}
.delivered-edit-card .order-edit-amounts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:16px 0}
.delivered-edit-card .order-edit-amounts span{border:1px solid #dfe9e1;background:#f5faf6;border-radius:12px;padding:12px;color:#536d5a;font-size:12px}
.delivered-edit-card .order-edit-amounts b{display:block;color:#146b39;font-size:23px;margin-top:5px}
.delivered-edit-card .order-edit-line{padding:14px;margin:10px 0;border:1px solid #dae6dd;border-radius:13px}
.delivered-edit-card .order-edit-line-head{display:flex;justify-content:space-between;gap:10px;align-items:center}
.delivered-edit-card .order-edit-line-head small{color:#597466}
.delivered-fields{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;align-items:end;margin-top:12px}
.delivered-fields label{font-size:12px;color:#405c48;font-weight:700}
.delivered-fields label span{display:block;padding:10px 0;font-size:16px;color:#19402a}
.delivered-fields input,.delivered-edit-card select{width:100%;min-width:0;padding:10px;border:1px solid #d4e0d6;border-radius:9px;margin-top:6px}
.delivered-edit-card .order-edit-line>label{display:block;font-size:12px;font-weight:700;margin-top:9px}
.delivered-subtotal{font-size:12px;color:#607466}
.delivered-subtotal b{display:block;font-size:18px;color:#146b39;margin-top:8px}
.delivered-check{display:flex!important;align-items:center;gap:9px;margin-top:10px!important}
.delivered-warning{padding:10px 13px;border:1px solid #e7dcc0;background:#fffcf1;border-radius:10px;line-height:1.5}
.delivered-edit-card .order-edit-reason{display:block;margin:16px 0;font-size:13px;font-weight:700;color:#405b48}
.delivered-edit-card .order-edit-reason textarea{display:block;width:100%;margin-top:7px;padding:11px;border:1px solid #d5e2d8;border-radius:10px;font:inherit}
.delivered-edit-card .editor-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:16px}
.delivered-edit-card button:disabled{opacity:.45;cursor:not-allowed}
@media(max-width:740px){.delivered-fields{grid-template-columns:repeat(2,minmax(0,1fr))}#deliveredEditDialog .delivered-edit-card{padding:20px 12px}}
@media(max-width:480px){.delivered-edit-card .order-edit-amounts{grid-template-columns:1fr}.delivered-edit-card .editor-actions{flex-wrap:wrap}}

/* v0.21.26 · Flete ARF independiente sin selección obligatoria de compras */
.freight-standalone-note{border:1px solid #cce2d2;border-radius:14px;background:#f2f8f3;padding:15px 18px;margin:18px 0;color:#184e32;font-size:14px;line-height:1.5;}
.freight-standalone-note>strong{font-size:15px;}.freight-standalone-note p{margin:6px 0 0;color:#3e634b;}

/* v0.21.27 · Flete ARF por importe total */
#freightDialog .purchase-header-grid.freight-total-fields{grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;}
#freightDialog #fAmount{font-weight:750;font-size:18px;}
@media(max-width:760px){#freightDialog .purchase-header-grid.freight-total-fields{grid-template-columns:repeat(2,minmax(0,1fr));}}
@media(max-width:520px){#freightDialog .purchase-header-grid.freight-total-fields{grid-template-columns:minmax(0,1fr);}}
