/* Scoped styles: no existing portal components are overwritten. */
#bs-dialog{box-sizing:border-box;position:fixed;inset:0;margin:0;width:100vw;height:100dvh;max-width:none;max-height:none;padding:0;overflow:hidden;border:0;border-radius:0;background:#f8fafc;color:#172033;box-shadow:0 22px 80px #02061788;font:14px/1.45 Inter,system-ui,Segoe UI,Arial,sans-serif;color-scheme:light}
#bs-dialog::backdrop{background:rgba(2,6,23,.76);backdrop-filter:blur(8px)}
#bs-dialog *,#bs-dialog *::before,#bs-dialog *::after{box-sizing:border-box}
#bs-dialog button,#bs-dialog input,#bs-dialog select{font:inherit}
#bs-dialog button,#bs-dialog .bs-main-btn{cursor:pointer;border:1px solid #cbd5e1;border-radius:10px;background:#fff;color:#172033;min-height:38px;padding:9px 12px;font-weight:700}
#bs-dialog button:disabled{cursor:not-allowed;opacity:.45}
#bs-dialog button:hover:not(:disabled),#bs-dialog .bs-main-btn:hover{border-color:#2563eb}
#bs-dialog :focus-visible{outline:3px solid #60a5fa;outline-offset:2px}
#bs-dialog .bs-shell{height:100%;display:flex;flex-direction:column;overflow:hidden}
#bs-dialog .bs-head{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:16px 22px;color:#fff;background:linear-gradient(110deg,#0d3d52,#126c8a 52%,#2853ba)}
#bs-dialog .bs-head small{font-size:10px;font-weight:900;letter-spacing:.14em;color:#bbf7d0}
#bs-dialog .bs-head h2{margin:4px 0;font-size:clamp(16px,2.3vw,25px);line-height:1.2;color:#fff}
#bs-dialog #bs-close{background:#ffffff29;color:#fff;border-color:#ffffff66;min-width:40px}
#bs-dialog .bs-toolbar{display:flex;align-items:center;gap:9px;flex-wrap:wrap;padding:10px 16px;background:#fff;border-bottom:1px solid #e2e8f0}
#bs-dialog .bs-toolbar .bs-primary{background:#047857;color:#fff;border-color:#047857}
#bs-dialog .bs-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e2e8f0;overflow:auto;flex-shrink:0;background:#fff}
#bs-dialog .bs-tabs button{white-space:nowrap;font-size:12px;padding:8px 11px;background:#eff6ff;border:1px solid transparent}
#bs-dialog .bs-tabs button[aria-selected=true]{background:#1d4ed8;color:#fff;border-color:#1d4ed8}
#bs-dialog .bs-workspace{min-height:0;flex:1;display:grid;grid-template-columns:minmax(260px,325px) minmax(0,1fr);overflow:hidden}
#bs-dialog .bs-controls{padding:18px;border-right:1px solid #cbd5e1;overflow-y:auto;background:#fff}
#bs-dialog .bs-controls section[hidden]{display:none}
#bs-dialog .bs-controls h3{font-size:16px;margin:0 0 16px;color:#17324d}
#bs-dialog .bs-controls label{display:grid;gap:6px;font-size:12px;font-weight:750;color:#334155;margin:0 0 13px}
#bs-dialog .bs-controls input:not([type=checkbox]):not([type=range]),#bs-dialog .bs-controls select{min-width:0;width:100%;min-height:37px;padding:7px 9px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#172033}
#bs-dialog input[type=range]{width:100%;accent-color:#176bd2;cursor:pointer}
#bs-dialog input[type=color]{min-height:39px;padding:1px!important}
#bs-dialog .bs-controls section>button{margin:3px 5px 6px 0}
#bs-dialog .bs-controls p{color:#64748b;font-size:12px}
#bs-dialog .bs-preview{display:flex;flex-direction:column;min-height:0;min-width:0;padding:13px 18px;background:#f0f5fa}
#bs-dialog .bs-preview-head{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap}
#bs-dialog .bs-preview-head strong{font-size:14px}
#bs-dialog .bs-preview-head label{display:flex;align-items:center;gap:7px;font-size:12px}
#bs-dialog .bs-preview-head select{min-height:35px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#172033}
#bs-dialog .bs-stage{display:grid;place-items:center;flex:1;min-height:0;overflow:hidden;margin-top:12px;border:1px solid #cbd5e1;border-radius:14px;background-color:#fff;background-image:linear-gradient(45deg,#e1e7ef 25%,transparent 25%,transparent 75%,#e1e7ef 75%),linear-gradient(45deg,#e1e7ef 25%,transparent 25%,transparent 75%,#e1e7ef 75%);background-size:22px 22px;background-position:0 0,11px 11}
#bs-dialog #bs-canvas{display:block;width:auto;height:auto;max-width:100%;max-height:100%;aspect-ratio:1;touch-action:none;cursor:grab;object-fit:contain}
#bs-dialog .bs-stage.bs-photo-ready{flex:none;align-self:center;justify-self:center;max-width:100%;max-height:100%;min-height:0;margin-left:auto;margin-right:auto}
#bs-dialog .bs-stage.bs-photo-ready #bs-canvas{width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain}
#bs-dialog #bs-canvas:active{cursor:grabbing}
#bs-dialog .bs-stage{position:relative}
#bs-dialog .bs-crop-overlay{position:absolute;z-index:3;pointer-events:auto;touch-action:none;border:1px solid #fff;box-shadow:0 0 0 1px #2563eb;cursor:move}
#bs-dialog .bs-crop-shade{position:absolute;inset:0;pointer-events:none;background:rgba(15,23,42,.28)}
#bs-dialog .bs-crop-box{position:absolute;inset:0;border:1px solid #f8fafc;box-shadow:0 0 0 9999px rgba(15,23,42,.28);pointer-events:none}
#bs-dialog .bs-crop-box span{position:absolute;width:9px;height:9px;border:1px solid #0f172a;border-radius:2px;background:#fff;pointer-events:auto;touch-action:none}
#bs-dialog .bs-crop-box span[data-handle=nw]{left:-5px;top:-5px;cursor:nwse-resize}
#bs-dialog .bs-crop-box span[data-handle=ne]{right:-5px;top:-5px;cursor:nesw-resize}
#bs-dialog .bs-crop-box span[data-handle=sw]{left:-5px;bottom:-5px;cursor:nesw-resize}
#bs-dialog .bs-crop-box span[data-handle=se]{right:-5px;bottom:-5px;cursor:nwse-resize}
#bs-dialog .bs-crop-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-bottom:9px}
#bs-dialog .bs-crop-actions button{font-size:11px;padding:7px 5px;min-height:34px}
#bs-dialog #bs-status{flex-shrink:0;margin:10px 0 0;min-height:35px;padding:8px 12px;border-radius:9px;background:#e0f2fe;color:#075985;font-size:12px;white-space:normal;overflow-wrap:anywhere}
#bs-dialog #bs-status[data-error=true]{background:#fee2e2;color:#991b1b}
#bs-dialog .bs-swatches{display:flex;flex-wrap:wrap;gap:6px;margin:6px 0}
#bs-dialog .bs-swatches button{font-size:11px;min-height:32px;padding:6px 8px}
#bs-dialog .bs-templates{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-height:400px;overflow:auto;margin-top:10px}
#bs-dialog .bs-template{display:flex;flex-direction:column;gap:4px;overflow:hidden;padding:5px!important;border-radius:10px!important;text-align:left}
#bs-dialog .bs-template.selected{border:2px solid #2563eb}
#bs-dialog .bs-template span{height:65px;width:100%;display:block;border-radius:6px}
#bs-dialog .bs-template small{font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#bs-dialog .bs-export-buttons{display:grid;grid-template-columns:1fr 1fr;gap:8px}
#bs-dialog .bs-export-buttons button{font-size:11px}
#bs-dialog hr{border:0;border-top:1px solid #e2e8f0;margin:16px 0}
@media(max-width:800px){#bs-dialog{inset:0;width:100vw;height:100dvh;max-height:100dvh;border:0;border-radius:0}#bs-dialog .bs-head{padding:10px 12px}#bs-dialog .bs-toolbar{padding:8px;gap:5px}#bs-dialog .bs-toolbar button,#bs-dialog .bs-toolbar .bs-main-btn{padding:7px;font-size:11px;min-height:33px}#bs-dialog .bs-tabs{padding:6px}#bs-dialog .bs-workspace{grid-template-columns:1fr;grid-template-rows:minmax(0,1fr) minmax(160px,40%)}#bs-dialog .bs-preview{grid-row:1;padding:8px}#bs-dialog .bs-controls{grid-row:2;border-right:0;border-top:1px solid #cbd5e1;padding:12px}#bs-dialog .bs-preview-head{gap:7px}#bs-dialog #bs-status{font-size:11px;padding:5px 7px;margin-top:6px}}
@media(prefers-reduced-motion:reduce){#bs-dialog *,#bs-dialog *::before,#bs-dialog *::after{animation:none!important;transition:none!important}}

/* Always-visible download actions; export buttons no longer hide behind a tab. */
#bs-dialog .bs-download-bar{flex:0 0 auto;padding:9px 18px 12px;background:#eff6ff;border-top:2px solid #bfdbfe;box-shadow:0 -4px 14px rgba(15,23,42,.08)}
#bs-dialog .bs-download-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px;color:#17324d}
#bs-dialog .bs-download-heading strong{font-size:14px;font-weight:850}
#bs-dialog #bs-quickSettings{min-height:30px;padding:5px 10px;border-color:#bfdbfe;background:#fff;color:#1d4ed8;font-size:11px}
#bs-dialog .bs-download-options{display:flex;align-items:center;flex-wrap:wrap;gap:8px}
#bs-dialog .bs-download-options>button{min-height:42px;padding:8px 13px;background:#fff;border-color:#93c5fd;color:#164e63}
#bs-dialog .bs-download-options>.bs-download-primary{background:#047857;border-color:#047857;color:#fff}
#bs-dialog .bs-download-choice{display:flex;align-items:center;gap:6px;padding:4px 6px;border:1px solid #cbd5e1;border-radius:11px;background:#fff;white-space:nowrap}
#bs-dialog .bs-download-choice label{font-size:12px;font-weight:800;color:#334155;white-space:nowrap}
#bs-dialog .bs-download-choice input[type=number]{width:56px;min-width:50px;height:33px;padding:4px 5px;border:1px solid #94a3b8;border-radius:7px;background:#fff;color:#172033;text-align:center}
#bs-dialog .bs-download-choice button{min-height:36px;padding:7px 10px;background:#dbeafe;color:#1d4ed8;border-color:#93c5fd}
@media(max-width:800px){
  #bs-dialog .bs-download-bar{padding:7px 9px 9px}
  #bs-dialog .bs-download-heading{margin-bottom:5px}
  #bs-dialog .bs-download-heading strong{font-size:13px}
  #bs-dialog .bs-download-options{display:grid;grid-template-columns:1fr;overflow:visible;padding-bottom:0}
  #bs-dialog .bs-download-options>button,#bs-dialog .bs-download-choice{width:100%}
  #bs-dialog .bs-download-options>button{min-height:38px;font-size:12px;padding:7px 10px}
  #bs-dialog .bs-download-choice{display:grid;grid-template-columns:minmax(112px,1fr) 52px minmax(150px,1.4fr)}
  #bs-dialog .bs-download-choice button{font-size:12px;white-space:normal}
}
@media(max-width:430px){
  #bs-dialog .bs-download-heading{align-items:flex-start;flex-direction:column}
  #bs-dialog .bs-download-choice{grid-template-columns:1fr 52px}
  #bs-dialog .bs-download-choice button{grid-column:1 / -1;width:100%}
}
