:root{
      --bg:#f4f5f7; --panel:#fff; --text:#16181d; --muted:#69707d;
      --line:#d8dde6; --accent:#111827; --danger:#b42318; --soft:#f8fafc;
    }
    *{box-sizing:border-box}
    body{
      margin:0;
      font-family:Inter,ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
      background:var(--bg);color:var(--text)
    }
    .app{display:grid;grid-template-columns:480px minmax(0,1fr);min-height:100vh}
    aside{
      background:var(--panel);border-right:1px solid var(--line);
      padding:22px;position:sticky;top:0;height:auto;overflow:auto
    }
    main{padding:28px;overflow:auto}
    h1{font-size:21px;margin:0 0 6px}
    .sub{font-size:13px;color:var(--muted);line-height:1.5;margin-bottom:18px}

    .drop{
      display:block;
      width:100%;
      border:2px dashed #cbd5e1;
      border-radius:12px;
      padding:22px 16px;
      text-align:center;
      background:#fafbfc;
      cursor:pointer;
      transition:border-color .15s ease, background-color .15s ease;
      margin-bottom:14px;
    }
    .drop:hover,.drop.drag{
      border-color:#64748b;
      background:#f4f6f8;
    }
    .drop-icon{
      display:none;
    }
    .drop strong{
      display:block;
      margin-bottom:6px;
      font-size:14px;
      line-height:1.3;
    }
    .drop span{
      display:block;
      font-size:12px;
      color:var(--muted);
      line-height:1.45;
    }
    input[type=file]{display:none}

    .price-card{
      margin:0 0 14px;padding:14px;border-radius:12px;background:#f7f8fa;
      border:1px solid #e7eaf0;font-size:12px
    }
    .price-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
    .price-head strong{font-size:13px}
    .price-total{font-size:18px;font-weight:800;white-space:nowrap}
    .price-lines{display:grid;gap:5px;color:var(--muted)}
    .price-line{display:flex;justify-content:space-between;gap:10px}
    .price-note{margin-top:8px;padding-top:8px;border-top:1px solid #e2e6ec;color:var(--muted);line-height:1.4}
    .price-warning{color:#b54708;font-weight:700}

    .price-sheet-wrap{position:relative;margin:0 0 14px}
    .price-sheet-button{
      width:100%;
      text-align:left;
      background:#f7f8fa;
      color:var(--text);
      border:1px solid #e7eaf0;
      padding:12px 14px;
      border-radius:10px;
      font-size:13px;
      font-weight:700;
    }
    .price-sheet-button::after{
      content:"Visa";
      float:right;
      color:var(--muted);
      font-size:11px;
      font-weight:600;
    }
    .price-sheet-button.open::after{content:"Dölj"}
    .price-sheet-popup{
      display:none;
      position:fixed;
      left:20px;
      top:20px;
      width:min(760px,calc(100vw - 40px));
      max-height:none;
      overflow-y:auto;
      overflow-x:hidden;
      z-index:99999;
      border:1px solid #dfe4ea;
      border-radius:12px;
      background:#fff;
      box-shadow:0 16px 40px rgba(0,0,0,.18);
      padding:12px;
    }
    .price-sheet-popup.open{display:block}
    .price-sheet-scroll{overflow-x:hidden;overflow-y:visible}
    .price-table{
      width:100%;
      table-layout:fixed;
      border-collapse:collapse;
      min-width:0;
      font-size:10px;
    }
    .price-table th,.price-table td{
      border:1px solid #dfe4ea;
      padding:6px 7px;
      text-align:right;
      white-space:normal;
      overflow-wrap:anywhere;
    }
    .price-table th:first-child,.price-table td:first-child{text-align:left}
    .price-table thead th{
      background:#f4f6f8;
      font-weight:700;
    }
    .price-sheet-note{
      margin-top:9px;
      color:var(--muted);
      font-size:11px;
      line-height:1.45;
    }

    .buttons{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:16px 0}
    button{border:0;border-radius:10px;padding:11px 12px;font-weight:700;cursor:pointer}
    .primary{background:var(--accent);color:#fff}
    .secondary{background:#eef0f3;color:#17191e}
    button:disabled{opacity:.6;cursor:default}

    .stats{
      font-size:12px;color:var(--muted);padding:12px;border-radius:10px;background:#f7f8fa
    }

    .list{margin-top:16px}
    .item{
      padding:12px;border:1px solid #e7eaf0;border-radius:12px;margin-bottom:10px;background:#fff;
      display:grid;grid-template-columns:62px minmax(0,1fr);gap:12px
    }
    .item img{width:62px;height:62px;object-fit:cover;border-radius:8px;background:#eee}
    .item .name{font-size:12px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
    .item .meta{font-size:11px;color:var(--muted);margin:3px 0 8px}
    .item-controls{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px}
    .item-controls label{font-size:10px;color:var(--muted)}
    .item-controls input{
      width:100%;margin-top:5px;padding:7px;font-size:12px;border:1px solid var(--line);
      border-radius:8px;background:#fff;color:var(--text)
    }
    .item-actions{display:flex;justify-content:flex-end;margin-top:8px}
    .item-actions button{padding:5px 8px;background:transparent;color:var(--danger);font-size:12px}

    .toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:14px}
    .toolbar .note{font-size:12px;color:var(--muted)}
    .sheet-wrap{display:flex;justify-content:center;min-width:max-content}
    .sheet{
      width:min(62vw,760px);
      background:#fff;box-shadow:0 8px 30px rgba(0,0,0,.12);
      position:relative;overflow:hidden;min-height:0
    }
    .sheet-inner{position:absolute;inset:0}
    .thumb{
      position:absolute;overflow:hidden;background:transparent;border:0
    }
    .thumb img{position:absolute;display:block;object-fit:contain;max-width:none!important;max-height:none;inset:0;display:grid;place-items:center;color:#9aa1ad;font-size:14px
    }
    .sheet-label{
      position:absolute;right:8px;bottom:6px;font-size:10px;color:#9aa1ad;
      background:#fff;padding:2px 5px;border-radius:4px
    }

    @media(max-width:900px){
      .app{grid-template-columns:1fr}
      aside{position:relative;height:auto;border-right:0;border-bottom:1px solid var(--line)}
      main{padding:16px}
      .sheet{width:100%}
    }
  
    .mode-switch{
      display:grid;
      grid-template-columns:1fr 1fr;
      gap:8px;
      margin:0 0 14px;
    }
    .mode-btn{
      border:1px solid var(--line);
      background:#f7f8fa;
      color:var(--text);
      padding:11px 12px;
      border-radius:10px;
      font-weight:700;
      cursor:pointer;
    }
    .mode-btn.active{
      background:var(--accent);
      color:#fff;
      border-color:var(--accent);
    }
    .transfer-controls{
      display:none;
      grid-template-columns:1fr 1fr;
      gap:10px;
      margin:0 0 14px;
      padding:12px;
      background:#f7f8fa;
      border:1px solid #e7eaf0;
      border-radius:12px;
    }
    .transfer-controls.active{display:grid}
    .transfer-controls label{
      font-size:11px;
      color:var(--muted);
    }
    .transfer-controls select,
    .transfer-controls input{
      width:100%;
      margin-top:5px;
      padding:9px;
      border:1px solid var(--line);
      border-radius:8px;
      background:#fff;
      color:var(--text);
    }


    .transfer-price-layout{
      display:grid;
      grid-template-columns:minmax(0,1fr) 220px;
      gap:18px;
      align-items:start;
      width:100%;
      min-width:0;
    }
    .transfer-price-main h3{
      margin:0 0 6px;
      font-size:16px;
      font-weight:800;
    }
    .transfer-price-section{
      margin:0 0 16px;
    }
    .transfer-price-title{
      font-size:13px;
      font-weight:800;
      text-decoration:underline;
      margin:0 0 4px;
    }
    .transfer-price-mini{
      width:100%;
      table-layout:fixed;
      border-collapse:collapse;
      font-size:11px;
    }
    .transfer-price-mini th,
    .transfer-price-mini td{
      border:0;
      padding:3px 7px;
      text-align:right;
      white-space:nowrap;
    }
    .transfer-price-mini th:first-child,
    .transfer-price-mini td:first-child{
      text-align:left;
      font-weight:700;
    }
    .transfer-price-mini thead th{
      background:transparent;
      font-weight:700;
    }
    .transfer-price-side{
      font-size:11px;
      line-height:1.4;
    }
    .transfer-price-side h4{
      margin:0 0 4px;
      font-size:12px;
      text-decoration:underline;
    }
    .transfer-side-box{
      margin-bottom:14px;
    }
    .transfer-side-table{
      width:100%;
      border-collapse:collapse;
    }
    .transfer-side-table td{
      padding:2px 0;
      border:0;
      text-align:left;
    }
    .transfer-side-table td:last-child{
      text-align:right;
      white-space:nowrap;
    }
    .transfer-bottom-box{
      margin-top:12px;
      border-top:1px solid #dfe4ea;
      padding-top:10px;
      font-size:11px;
      line-height:1.45;
    }
    @media(max-width:900px){
      .transfer-price-layout{
        grid-template-columns:1fr;
        min-width:0;
      }
    }


/* Responsive layout fix: prevent horizontal scrolling in iframe layouts */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

.app,
.layout,
.workspace,
.builder,
.dtf-app,
main {
  min-width: 0;
  max-width: 100%;
}

.sidebar,
.left-panel,
.controls,
.panel-left,
aside {
  min-width: 0;
  width: 100%;
  max-width: 480px;
  box-sizing: border-box;
}

.preview,
.preview-panel,
.main-panel,
.content,
.sheet-wrap,
.sheet-area {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

img,
canvas,
svg {
  max-width: 100%;
}

@media (max-width: 1100px) {
  .app,
  .layout,
  .workspace,
  .builder,
  .dtf-app {
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr) !important;
  }

  .sidebar,
  .left-panel,
  .controls,
  .panel-left,
  aside {
    max-width: 420px;
  }
}

@media (max-width: 820px) {
  .app,
  .layout,
  .workspace,
  .builder,
  .dtf-app {
    grid-template-columns: 1fr !important;
  }

  .sidebar,
  .left-panel,
  .controls,
  .panel-left,
  aside {
    max-width: none;
  }
}


/* Price popup must always render above the preview workspace */
#priceSheetPopup,
.price-sheet-popup {
  position: fixed !important;
  z-index: 2147483000 !important;
  isolation: isolate;
}

#priceSheetPopup .price-sheet,
.price-sheet-popup .price-sheet {
  position: relative;
  z-index: 2147483001 !important;
}

/* Keep preview-related layers below modal/popup UI */
.preview,
.preview-panel,
.sheet-wrap,
.sheet-area,
.sheet,
.thumb,
.main-panel {
  z-index: auto !important;
}



/* Root-level price popup: moved to <body> by JS so it can overlay both columns */
body > #priceSheetPopup {
  position: fixed !important;
  z-index: 2147483646 !important;
  max-width: calc(100vw - 24px) !important;
  box-sizing: border-box;
}

body > #priceSheetPopup * {
  box-sizing: border-box;
}



/* Final popup fix: popup is a direct body child and must overlay the whole app */
body > #priceSheetPopup{
  position:fixed !important;
  z-index:2147483647 !important;
  transform:none !important;
  contain:none !important;
  isolation:isolate !important;
}


/* White-heavy artwork preview aid: preview only, never exported */
.white-heavy-preview {
  background: #eceff2 !important;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}



/* Light-grey aid for white-heavy artwork in preview only */
.white-heavy-preview,
.white-heavy-preview-wrap {
  background-color: #e5e7eb !important;
}

.white-heavy-preview {
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.08);
}



/* Correct white-art preview backing */
.thumb.white-heavy-preview-wrap {
  background: #e5e7eb !important;
  border-radius: 2px;
}

.thumb.white-heavy-preview-wrap > img {
  background: transparent !important;
}



/* Left menu should grow with its content; no internal height limit */
.sidebar,
.left-panel,
.controls,
.panel-left,
aside,
.app > :first-child,
.layout > :first-child,
.workspace > :first-child,
.builder > :first-child,
.dtf-app > :first-child {
  height: auto !important;
  max-height: none !important;
  overflow-y: visible !important;
}







/* Checkerboard is now the only transparency/white-art background aid */
.white-heavy-preview,
.white-heavy-preview-wrap,
.thumb.white-heavy-preview-wrap,
.thumb.white-heavy-preview-wrap > img {
  background: transparent !important;
  background-color: transparent !important;
  box-shadow: none !important;
}



.project-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-top:12px;
}

.secondary-project-btn{
  min-height:48px;
  border:1px solid #d8dee8;
  border-radius:12px;
  background:#fff;
  color:#111827;
  font:inherit;
  font-weight:700;
  cursor:pointer;
}

.secondary-project-btn:hover{
  background:#f8fafc;
}

.secondary-project-btn:disabled{
  opacity:.6;
  cursor:wait;
}

@media(max-width:520px){
  .project-actions{
    grid-template-columns:1fr;
  }
}





/* Center only the preview sheet, without changing the main grid */
html,
body {
  max-width: 100%;
  overflow-x: hidden !important;
}

.main,
.main-content,
.content,
.workspace,
.app,
.layout,
.preview,
.preview-panel {
  min-width: 0 !important;
  max-width: 100% !important;
}

.preview,
.preview-panel {
  overflow-x: hidden !important;
}

/* The preview sheet itself is centered inside its available column */
#sheet {
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 100% !important;
}

/* Keep the sheet contents constrained to the sheet */
#sheetInner {
  max-width: 100% !important;
}






.app { column-gap: 6px !important; }


/* Precise spacing between menu and preview */
.app {
  column-gap: 6px !important;
}



/* Match the left menu to the 480px grid column */
.app > aside {
  width: 100%;
  max-width: 480px !important;
  box-sizing: border-box;
}



/* Spaced dotted outline around each placed image in the preview only */
#sheet .thumb {
  outline: none !important;
}

#sheet .thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background:
    repeating-linear-gradient(to right,
      rgba(17,24,39,.65) 0 2px,
      transparent 2px 7px) top left / 100% 1px no-repeat,
    repeating-linear-gradient(to right,
      rgba(17,24,39,.65) 0 2px,
      transparent 2px 7px) bottom left / 100% 1px no-repeat,
    repeating-linear-gradient(to bottom,
      rgba(17,24,39,.65) 0 2px,
      transparent 2px 7px) top left / 1px 100% no-repeat,
    repeating-linear-gradient(to bottom,
      rgba(17,24,39,.65) 0 2px,
      transparent 2px 7px) top right / 1px 100% no-repeat;
}



/* Upload gallery */
#files{display:none!important}
.gallery-modal{position:fixed;inset:0;z-index:100000;display:none;align-items:center;justify-content:center;padding:24px}.gallery-modal.open{display:flex}.gallery-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.48);backdrop-filter:blur(2px)}.gallery-dialog{position:relative;z-index:1;width:min(980px,calc(100vw - 32px));max-height:min(820px,calc(100vh - 32px));overflow:hidden;background:#fff;border:1px solid #dbe1e8;border-radius:16px;box-shadow:0 24px 70px rgba(15,23,42,.24);display:flex;flex-direction:column}.gallery-header{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:20px 22px 14px;border-bottom:1px solid #e5e7eb}.gallery-header h2{margin:0 0 4px;font-size:20px}.gallery-sub{color:#64748b;font-size:13px}.gallery-close{border:0;background:transparent;font-size:30px;line-height:1;cursor:pointer;padding:0 4px;color:#475569}.gallery-toolbar{display:flex;gap:10px;padding:14px 22px;border-bottom:1px solid #e5e7eb}.gallery-upload-btn,.gallery-add-btn{border:0;border-radius:10px;padding:10px 14px;font:inherit;font-weight:700;cursor:pointer}.gallery-upload-btn{background:#111827;color:#fff}.gallery-add-btn{background:#2563eb;color:#fff}.gallery-add-btn:disabled{opacity:.45;cursor:not-allowed}.gallery-grid{padding:18px 22px 22px;overflow:auto;display:grid;grid-template-columns:repeat(auto-fill,minmax(135px,1fr));gap:14px;min-height:220px}.gallery-card{position:relative;border:2px solid transparent;border-radius:12px;background:#f8fafc;overflow:hidden}.gallery-card.selected{border-color:#2563eb;box-shadow:0 0 0 2px rgba(37,99,235,.12)}.gallery-card.is-disabled{opacity:.68}.gallery-card.is-disabled .gallery-select{cursor:not-allowed}.gallery-card.is-disabled .gallery-name::after{content:" • Endast DTF";color:#b45309;font-weight:600}.gallery-select{display:block;width:100%;padding:0;border:0;background:transparent;cursor:pointer;text-align:left}.gallery-thumb{height:120px;display:grid;place-items:center;overflow:hidden;background:linear-gradient(45deg,#e5e7eb 25%,transparent 25%),linear-gradient(-45deg,#e5e7eb 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#e5e7eb 75%),linear-gradient(-45deg,transparent 75%,#e5e7eb 75%),#f8fafc;background-size:18px 18px;background-position:0 0,0 9px,9px -9px,-9px 0}.gallery-thumb img{width:100%;height:100%;object-fit:contain}.gallery-file-icon{font-weight:800;font-size:18px;color:#475569}.gallery-name{padding:9px 10px 11px;font-size:12px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gallery-delete{position:absolute;top:6px;right:6px;width:26px;height:26px;border:0;border-radius:999px;background:rgba(255,255,255,.92);color:#334155;font-size:18px;line-height:1;cursor:pointer;box-shadow:0 1px 5px rgba(15,23,42,.18)}.gallery-empty,.gallery-loading{padding:36px 22px;color:#64748b;text-align:center}@media(max-width:600px){.gallery-modal{padding:8px}.gallery-dialog{width:calc(100vw - 16px);max-height:calc(100vh - 16px)}.gallery-grid{grid-template-columns:repeat(2,minmax(0,1fr));padding:12px;gap:10px}}


/* Gallery delete button: centered red X */
.gallery-delete{
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding:0 !important;
  text-align:center !important;
  color:#dc2626 !important;
  font-size:22px !important;
  font-weight:700 !important;
  line-height:1 !important;
}



/* Checkerboard only on the sheet preview itself */
.sheet-wrap,
main,
.preview,
.preview-panel,
.sheet-area,
.preview-canvas,
.preview-surface {
  background: transparent !important;
  background-image: none !important;
}

#sheet {
  background-color: #f3f4f6 !important;
  background-image:
    linear-gradient(45deg, rgba(0,0,0,0.045) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0,0,0,0.045) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.045) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.045) 75%) !important;
  background-size: 24px 24px !important;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0 !important;
}



/* Gallery upload area styled like the original upload box */
.gallery-toolbar{
  padding:16px 22px 14px !important;
  border-bottom:1px solid #e5e7eb;
  display:block !important;
}

.gallery-upload-btn{
  width:100% !important;
  min-height:108px;
  display:flex !important;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:20px 16px !important;
  border:2px dashed #cbd5e1 !important;
  border-radius:12px !important;
  background:#fafbfc !important;
  color:#111827 !important;
  cursor:pointer;
  text-align:center;
  transition:border-color .15s ease, background-color .15s ease;
}

.gallery-upload-btn:hover{
  border-color:#64748b !important;
  background:#f4f6f8 !important;
}

.gallery-upload-btn strong{
  display:block;
  font-size:15px;
  font-weight:800;
}

.gallery-upload-btn span{
  display:block;
  font-size:12px;
  font-weight:500;
  color:#64748b;
}

.gallery-footer{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  padding:14px 22px 18px;
  border-top:1px solid #e5e7eb;
  background:#fff;
}

.gallery-footer .gallery-add-btn{
  min-width:150px;
  padding:11px 18px;
}



.gallery-upload-btn.drag{
  border-color:#2563eb !important;
  background:#eff6ff !important;
}



.dpi-value{
  font-weight:700;
  color:#334155;
}



.dpi-value{
  transition:color .12s ease;
}



/* Print-sheet heading above preview */
.print-sheet-header{
  width:min(62vw,760px);
  max-width:100%;
  margin:0 auto 12px;
}

.print-sheet-header-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  margin-bottom:12px;
  color:#1f2937;
}

.print-sheet-title{
  font-size:16px;
  font-weight:700;
  letter-spacing:.01em;
  white-space:nowrap;
}

.ark-build-version{
  display:inline-flex;
  align-items:center;
  margin-left:8px;
  padding:3px 7px;
  border:1px solid #cbd5e1;
  border-radius:999px;
  background:#f8fafc;
  color:#64748b;
  font-size:10px;
  line-height:1;
  font-weight:800;
  letter-spacing:.04em;
  vertical-align:2px;
}

.print-sheet-help{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:19px;
  height:19px;
  margin-left:5px;
  border:1px solid #64748b;
  border-radius:50%;
  font-size:12px;
  line-height:1;
  font-weight:600;
  color:#475569;
  vertical-align:1px;
}

.print-sheet-dimensions{
  font-size:16px;
  font-weight:600;
  text-align:right;
  white-space:nowrap;
}

.print-sheet-width-rule{
  display:flex;
  align-items:center;
  width:100%;
  color:#334155;
}

.rule-line{
  position:relative;
  height:1px;
  background:#94a3b8;
  flex:1;
}

.rule-line:first-child::before,
.rule-line:last-child::after{
  content:"";
  position:absolute;
  top:-10px;
  width:1px;
  height:20px;
  background:#94a3b8;
}

.rule-line:first-child::before{left:0;}
.rule-line:last-child::after{right:0;}

.rule-width{
  padding:0 12px;
  font-size:14px;
  font-weight:700;
  white-space:nowrap;
}

#sheetLabel{
  display:none !important;
}

@media(max-width:900px){
  .print-sheet-header{width:100%;}
}

@media(max-width:560px){
  .print-sheet-header-row{align-items:flex-start;}
  .print-sheet-title,
  .print-sheet-dimensions{font-size:14px;}
}




/* TRYCKARK header must match the preview sheet width exactly */
.preview-header,
.tryckark-header,
.print-sheet-header {
  box-sizing: border-box;
  width: 100% !important;
  max-width: 100% !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Give only the text breathing room; do not shrink the ruler */
#previewDimensions {
  box-sizing: border-box;
  padding-right: 8px;
  white-space: nowrap;
}

.preview-width-line,
.tryckark-width-line,
.print-sheet-width-line {
  box-sizing: border-box;
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

/* Keep the preview wrapper and header on the same available width */
main > .preview-header,
main > .tryckark-header,
main > .print-sheet-header,
main > .sheet-wrap {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box;
}



.auto-fit-option{
  display:flex;
  align-items:flex-start;
  gap:9px;
  margin-top:10px;
  padding:9px 10px;
  border:1px solid #e2e8f0;
  border-radius:9px;
  background:#f8fafc;
  cursor:pointer;
}

.auto-fit-option input{
  width:16px;
  height:16px;
  margin:2px 0 0;
  flex:0 0 auto;
}

.auto-fit-option span{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}

.auto-fit-option strong{
  font-size:11px;
  color:#334155;
}

.auto-fit-option small{
  font-size:10px;
  line-height:1.35;
  color:#64748b;
}



.used-fit-size{
  margin-top:10px;
  padding:8px 10px;
  border-radius:9px;
  background:#f8fafc;
  border:1px dashed #cbd5e1;
  font-size:12px;
  line-height:1.4;
  color:#475569;
}

.used-fit-size strong{
  color:#0f172a;
}


/* Collapsible price calculation */
.price-card{
  padding:0 !important;
  overflow:hidden;
}

.price-summary{
  width:100%;
  min-height:62px;
  padding:14px;
  border:0;
  background:transparent;
  color:inherit;
  font:inherit;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  cursor:pointer;
  text-align:left;
}

.price-summary:hover{
  background:#f1f4f7;
}

.price-summary-label{
  font-size:13px;
  font-weight:700;
}

.price-summary-right{
  display:flex;
  align-items:center;
  gap:9px;
  margin-left:auto;
}

.price-summary .price-total{
  font-size:18px;
  font-weight:800;
  white-space:nowrap;
}

.price-toggle-text{
  font-size:11px;
  font-weight:700;
  color:var(--muted);
  white-space:nowrap;
}

.price-toggle-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:18px;
  height:18px;
  font-size:18px;
  line-height:1;
  color:var(--muted);
  transition:transform .15s ease;
}

.price-summary[aria-expanded="true"] .price-toggle-icon{
  transform:rotate(180deg);
}

.price-details{
  padding:0 14px 14px;
  border-top:1px solid #e2e6ec;
}

.price-details[hidden]{
  display:none !important;
}

.price-details .price-lines{
  padding-top:12px;
}



/* Clickable source image thumbnail */
.source-image-thumb{
  cursor:zoom-in;
}

/* Original source preview popup */
.source-preview-modal{
  position:fixed;
  inset:0;
  z-index:100100;
  display:none;
  align-items:center;
  justify-content:center;
  padding:24px;
}

.source-preview-modal.open{
  display:flex;
}

.source-preview-backdrop{
  position:absolute;
  inset:0;
  background:rgba(15,23,42,.62);
  backdrop-filter:blur(2px);
}

.source-preview-dialog{
  position:relative;
  z-index:1;
  width:min(1100px,calc(100vw - 40px));
  max-height:calc(100vh - 40px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:#fff;
  border-radius:16px;
  box-shadow:0 24px 80px rgba(15,23,42,.3);
}

.source-preview-header{
  min-height:58px;
  padding:12px 16px 12px 20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  border-bottom:1px solid #e2e8f0;
}

.source-preview-title{
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:15px;
  font-weight:800;
  color:#0f172a;
}

.source-preview-close{
  flex:0 0 auto;
  width:38px;
  height:38px;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0;
  border:0;
  border-radius:999px;
  background:#f1f5f9;
  color:#dc2626;
  font-size:28px;
  line-height:1;
  cursor:pointer;
}

.source-preview-content{
  min-height:200px;
  overflow:auto;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  background:
    linear-gradient(45deg,#e5e7eb 25%,transparent 25%),
    linear-gradient(-45deg,#e5e7eb 25%,transparent 25%),
    linear-gradient(45deg,transparent 75%,#e5e7eb 75%),
    linear-gradient(-45deg,transparent 75%,#e5e7eb 75%),
    #f8fafc;
  background-size:24px 24px;
  background-position:0 0,0 12px,12px -12px,-12px 0;
}

.source-preview-content img{
  display:block;
  max-width:100%;
  max-height:calc(100vh - 150px);
  width:auto;
  height:auto;
  object-fit:contain;
}

@media(max-width:600px){
  .source-preview-modal{
    padding:8px;
  }

  .source-preview-dialog{
    width:calc(100vw - 16px);
    max-height:calc(100vh - 16px);
  }

  .source-preview-content{
    padding:10px;
  }
}



/* Logged-in account bar */
.account-bar{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:9px;
  margin-bottom:9px;
}
.account-name{
  max-width:210px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:11px;
  font-weight:700;
  color:#64748b;
}
.logout-form{margin:0}
.logout-btn{
  min-height:auto !important;
  padding:5px 9px !important;
  border:1px solid #d7dde5 !important;
  border-radius:7px !important;
  background:#fff !important;
  color:#475569 !important;
  font-size:10px !important;
  font-weight:700 !important;
  cursor:pointer;
}
.logout-btn:hover{background:#f8fafc !important}


/* Optional login popup */
.guest-name{color:#64748b;}
.login-modal{
  position:fixed; inset:0; z-index:100300; display:none;
  align-items:center; justify-content:center; padding:20px;
}
.login-modal.open{display:flex;}
.login-backdrop{
  position:absolute; inset:0; background:rgba(15,23,42,.62);
  backdrop-filter:blur(2px);
}
.login-dialog{
  position:relative; z-index:1; width:min(430px,calc(100vw - 32px));
  background:#fff; border-radius:16px; overflow:hidden;
  box-shadow:0 24px 80px rgba(15,23,42,.32);
}
.login-dialog-header{
  display:flex; align-items:flex-start; justify-content:space-between; gap:16px;
  padding:18px 18px 14px 20px; border-bottom:1px solid #e2e8f0;
}
.login-dialog-header h2{margin:0 0 4px;font-size:20px;}
.login-subtitle{font-size:12px;line-height:1.45;color:#64748b;}
.login-close{
  flex:0 0 auto; width:36px; height:36px; border:0; border-radius:999px;
  background:#f1f5f9; color:#dc2626; font-size:26px; line-height:1; cursor:pointer;
}
.login-form{display:flex;flex-direction:column;gap:13px;padding:18px 20px 20px;}
.login-form label{display:flex;flex-direction:column;gap:6px;font-size:12px;font-weight:700;color:#334155;}
.login-form input{
  width:100%;box-sizing:border-box;border:1px solid #cbd5e1;border-radius:9px;
  padding:10px 11px;font:inherit;font-weight:400;background:#fff;color:#0f172a;
}
.login-submit{
  margin-top:3px;border:0;border-radius:9px;padding:11px 14px;
  background:#111827;color:#fff;font-weight:800;cursor:pointer;
}
.login-submit:disabled{opacity:.65;cursor:wait;}
.login-message{min-height:18px;font-size:12px;line-height:1.4;}
.login-message.error{color:#b91c1c;}
.login-message.success{color:#15803d;}


/* Account registration + profile */
.account-tabs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:6px;
  padding:12px 20px 0;
  background:#fff;
}

.account-tab{
  min-height:39px;
  border:1px solid #dbe2ea;
  border-radius:9px;
  background:#f8fafc;
  color:#64748b;
  font:700 12px/1.2 system-ui,sans-serif;
  cursor:pointer;
}

.account-tab.active{
  background:#111827;
  border-color:#111827;
  color:#fff;
}

.account-panel[hidden]{
  display:none !important;
}

.register-note{
  padding:9px 10px;
  border-radius:8px;
  background:#f8fafc;
  color:#64748b;
  font-size:11px;
  line-height:1.45;
}

.profile-dialog{
  width:min(560px,calc(100vw - 32px)) !important;
  max-width:560px !important;
  max-height:calc(100vh - 40px);
  overflow:auto !important;
}

.profile-form{
  gap:12px !important;
}

.profile-account-readonly{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}

.profile-account-readonly > div{
  min-width:0;
  padding:9px 10px;
  border:1px solid #e2e8f0;
  border-radius:8px;
  background:#f8fafc;
}

.profile-account-readonly span{
  display:block;
  margin-bottom:3px;
  color:#64748b;
  font-size:10px;
  font-weight:700;
}

.profile-account-readonly strong{
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  color:#0f172a;
  font-size:12px;
}

.profile-section-title{
  margin-top:3px;
  color:#0f172a;
  font-size:13px;
  font-weight:800;
}

.profile-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:11px;
}

.profile-grid .profile-wide{
  grid-column:1/-1;
}

.account-bar .profile-btn{
  margin-left:auto;
}

@media(max-width:560px){
  .profile-account-readonly,
  .profile-grid{
    grid-template-columns:1fr;
  }
  .profile-grid .profile-wide{
    grid-column:auto;
  }
}


/* Keep TRYCKARK header/ruler exactly the same width as the preview sheet. */
@media (min-width: 901px) {
  main > .print-sheet-header {
    box-sizing: border-box !important;
    width: min(62vw, 760px) !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }

  main > .print-sheet-header .print-sheet-width-rule {
    width: 100% !important;
    max-width: 100% !important;
  }
}

@media (max-width: 900px) {
  main > .print-sheet-header {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
}


/* Only the selected account tab may be visible. This must override
   the generic .login-form { display:flex !important } modal rule. */
.login-modal .account-panel[hidden] {
  display: none !important;
}
.login-modal .account-panel:not([hidden]) {
  display: flex !important;
}


/* Checkout */
.checkout-button{border:0;border-radius:9px;padding:11px 14px;background:#15803d;color:#fff;font-weight:800;cursor:pointer}
.checkout-button:disabled{opacity:.5;cursor:not-allowed}
.checkout-modal[hidden]{display:none!important}
.checkout-modal{position:fixed;inset:0;z-index:2147482500;display:flex;align-items:center;justify-content:center;padding:20px}
.checkout-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.65);backdrop-filter:blur(3px)}
.checkout-dialog{position:relative;z-index:1;width:min(720px,calc(100vw - 32px));max-height:calc(100vh - 40px);display:flex;flex-direction:column;background:#fff;border-radius:16px;box-shadow:0 24px 90px rgba(15,23,42,.34);overflow:hidden}
.checkout-header{display:flex;justify-content:space-between;gap:18px;padding:18px 20px 15px;border-bottom:1px solid #e2e8f0}
.checkout-header h2{margin:0 0 4px;font-size:21px;color:#111827}.checkout-subtitle{font-size:12px;color:#64748b;line-height:1.45}
.checkout-close{width:36px;height:36px;flex:0 0 auto;border:0;border-radius:999px;background:#f1f5f9;color:#dc2626;font-size:25px;font-weight:700;cursor:pointer}
.checkout-body{overflow:auto;padding:18px 20px 20px}
.checkout-summary{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-bottom:18px}
.checkout-summary-item{padding:11px 12px;border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc;min-width:0}
.checkout-summary-item span{display:block;font-size:10px;font-weight:800;color:#64748b;text-transform:uppercase;letter-spacing:.04em;margin-bottom:4px}.checkout-summary-item strong{display:block;font-size:14px;color:#0f172a;overflow-wrap:anywhere}
.checkout-summary-item.checkout-total{background:#f0fdf4;border-color:#bbf7d0}.checkout-summary-item.checkout-total strong{font-size:18px;color:#166534}
.checkout-form h3{margin:0 0 12px;font-size:14px}.checkout-grid{display:grid;grid-template-columns:1fr 1fr;gap:11px}.checkout-wide{grid-column:1/-1}
.checkout-form label{display:flex;flex-direction:column;gap:6px;font-size:12px;font-weight:700;color:#334155}.checkout-form input[type=text],.checkout-form input[type=tel],.checkout-form textarea{box-sizing:border-box;width:100%;border:1px solid #cbd5e1;border-radius:9px;padding:10px 11px;background:#fff;font:400 14px/1.3 system-ui,sans-serif}.checkout-form textarea{resize:vertical;min-height:72px}.checkout-note-label{margin-top:12px}
.checkout-confirm{display:flex!important;flex-direction:row!important;align-items:flex-start;gap:9px!important;margin:15px 0 12px;padding:10px;border-radius:9px;background:#f8fafc}.checkout-confirm input{margin-top:2px}.checkout-confirm span{font-weight:600;line-height:1.4}
.checkout-submit{width:100%;min-height:44px;border:0;border-radius:9px;background:#111827;color:#fff;font-weight:800;cursor:pointer}.checkout-submit:disabled{opacity:.55;cursor:wait}.checkout-message{min-height:18px;margin:0 0 8px;font-size:12px}.checkout-message.error{color:#b91c1c}.checkout-message.success{color:#15803d}
.checkout-success{text-align:center;padding:24px 8px}.checkout-success-icon{width:52px;height:52px;margin:0 auto 12px;border-radius:999px;display:grid;place-items:center;background:#dcfce7;color:#15803d;font-size:28px;font-weight:900}.checkout-success h3{margin:0 0 8px}.checkout-success p{margin:0 0 18px;color:#475569}
body.checkout-open{overflow:hidden}
@media(max-width:620px){.checkout-summary,.checkout-grid{grid-template-columns:1fr}.checkout-wide{grid-column:auto}}

/* Precisely centered popup close icons.
   Draw the X geometrically instead of relying on the font glyph baseline. */
.login-close,
.source-preview-close,
.checkout-close,
.gallery-close {
  position: relative !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
  line-height: 0 !important;
  font-size: 0 !important;
  text-indent: -9999px;
  overflow: hidden;
}

.login-close::before,
.login-close::after,
.source-preview-close::before,
.source-preview-close::after,
.checkout-close::before,
.checkout-close::after,
.gallery-close::before,
.gallery-close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: 50% 50%;
}

.login-close::before,
.source-preview-close::before,
.checkout-close::before,
.gallery-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.login-close::after,
.source-preview-close::after,
.checkout-close::after,
.gallery-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.checkout-email-sent{color:#166534;font-weight:600;}
.checkout-email-warning{color:#9a3412;font-weight:600;}


/* Order history */
.orders-modal[hidden]{display:none!important}
.orders-modal{position:fixed;inset:0;z-index:2147482600;display:flex;align-items:center;justify-content:center;padding:20px}
.orders-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.65);backdrop-filter:blur(3px)}
.orders-dialog{position:relative;z-index:1;width:min(760px,calc(100vw - 32px));max-height:calc(100vh - 40px);display:flex;flex-direction:column;background:#fff;border-radius:16px;box-shadow:0 24px 90px rgba(15,23,42,.34);overflow:hidden}
.orders-header{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding:18px 20px 15px;border-bottom:1px solid #e2e8f0}
.orders-header h2{margin:0 0 4px;font-size:21px;color:#111827}.orders-subtitle{font-size:12px;color:#64748b;line-height:1.45}
.orders-close{width:36px;height:36px;flex:0 0 auto;border:0;border-radius:999px;background:#f1f5f9;color:#dc2626;cursor:pointer}
.orders-body{overflow:auto;padding:16px 20px 20px}.orders-list{display:grid;gap:10px}.orders-loading,.orders-empty{padding:28px 12px;text-align:center;color:#64748b;font-size:13px}.orders-message{min-height:0;margin-bottom:10px;font-size:12px}.orders-message:empty{display:none}.orders-message.error{display:block;color:#b91c1c}
.order-history-card{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px;border:1px solid #e2e8f0;border-radius:12px;background:#fff}.order-history-main{min-width:0}.order-history-top{display:flex;align-items:center;gap:9px;flex-wrap:wrap}.order-history-top strong{font-size:14px;color:#0f172a}.order-status{padding:3px 7px;border-radius:999px;background:#f1f5f9;color:#475569;font-size:10px;font-weight:800}.order-history-date{margin-top:4px;font-size:11px;color:#94a3b8}.order-history-desc{margin-top:6px;font-size:12px;color:#475569}.order-history-side{display:flex;flex-direction:column;align-items:flex-end;gap:8px;flex:0 0 auto}.order-history-side>strong{font-size:14px;color:#0f172a}.order-reopen-btn{min-height:36px;border:0;border-radius:8px;padding:8px 11px;background:#111827;color:#fff;font-size:11px;font-weight:800;cursor:pointer}.order-reopen-btn:disabled{opacity:.55;cursor:wait}
body.orders-open{overflow:hidden}
@media(max-width:620px){.order-history-card{align-items:stretch;flex-direction:column}.order-history-side{align-items:stretch}.order-reopen-btn{width:100%}}

.orders-close{position:relative!important;display:grid!important;place-items:center!important;padding:0!important;line-height:0!important;font-size:0!important;text-indent:-9999px;overflow:hidden}
.orders-close::before,.orders-close::after{content:"";position:absolute;left:50%;top:50%;width:16px;height:3px;border-radius:999px;background:currentColor;transform-origin:50% 50%}
.orders-close::before{transform:translate(-50%,-50%) rotate(45deg)}
.orders-close::after{transform:translate(-50%,-50%) rotate(-45deg)}


.account-admin-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:22px;
  padding:2px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  line-height:1;
  letter-spacing:.02em;
  background:#111827;
  color:#fff;
  white-space:nowrap;
}


/* Admin order list / completion status */
.order-history-card.completed{background:#f8fff9;border-color:#bbf7d0}
.order-history-customer{margin-top:7px;font-size:11px;line-height:1.45;color:#475569}
.order-history-customer strong{color:#0f172a}
.order-completed-label{display:inline-flex;align-items:center;padding:3px 7px;border-radius:999px;background:#dcfce7;color:#166534;font-size:10px;font-weight:800}
.order-completed-check{display:inline-flex;align-items:center;gap:7px;padding:6px 9px;border:1px solid #cbd5e1;border-radius:8px;background:#f8fafc;color:#334155;font-size:11px;font-weight:750;cursor:pointer;white-space:nowrap}
.order-completed-check input{width:16px;height:16px;margin:0;accent-color:#16a34a;cursor:pointer}
.order-completed-check input:disabled{cursor:wait;opacity:.6}


/* Admin production estimate - Epson SureColor G6000 standard mode */
.order-print-estimate{
  display:flex;
  align-items:baseline;
  gap:7px;
  flex-wrap:wrap;
  margin-top:8px;
  padding:7px 9px;
  border-radius:8px;
  background:rgba(15,23,42,.055);
  font-size:12px;
}
.order-print-estimate span{font-weight:650;color:#475569;}
.order-print-estimate strong{font-size:13px;color:#111827;}
.order-print-estimate small{color:#64748b;font-size:11px;}


/* Local gallery -> permanent account gallery migration */
.gallery-migrate-dialog{max-width:500px!important}
.gallery-migrate-body{padding:20px;display:flex;flex-direction:column;gap:16px}
.gallery-migrate-body p{margin:0;color:#475569;font-size:14px;line-height:1.55}
.gallery-migrate-actions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap}
.gallery-migrate-primary{width:auto!important;min-width:175px;margin:0!important}
.gallery-migrate-secondary{min-height:44px;padding:10px 14px;border:1px solid #cbd5e1;border-radius:9px;background:#fff;color:#334155;font:700 14px/1.2 system-ui,sans-serif;cursor:pointer}
.gallery-migrate-secondary:disabled,.gallery-migrate-primary:disabled{opacity:.55;cursor:not-allowed}
@media(max-width:560px){.gallery-migrate-actions{flex-direction:column-reverse}.gallery-migrate-primary,.gallery-migrate-secondary{width:100%!important}}


/* Bitmap/vector indicator in gallery thumbnails. */
.gallery-thumb{position:relative}
.gallery-kind-badge{
  position:absolute;
  left:7px;
  bottom:7px;
  z-index:3;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:21px;
  padding:3px 7px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.8);
  box-shadow:0 1px 4px rgba(15,23,42,.22);
  font-size:9px;
  line-height:1;
  font-weight:900;
  letter-spacing:.045em;
  pointer-events:none;
  backdrop-filter:blur(3px);
}
.gallery-kind-badge.is-vector{background:rgba(236,253,245,.94);color:#047857;border-color:rgba(16,185,129,.38)}
.gallery-kind-badge.is-bitmap{background:rgba(255,247,237,.95);color:#c2410c;border-color:rgba(249,115,22,.38)}
.gallery-kind-badge.is-loading{background:rgba(255,255,255,.9);color:#64748b}

.transfer-color-auto{
  box-sizing:border-box;
  min-height:42px;
  display:flex;
  align-items:center;
  padding:9px 12px;
  border:1px solid #d7dde5;
  border-radius:9px;
  background:#f8fafc;
  color:#111827;
  font-weight:800;
}
.transfer-color-auto::after{
  content:"Auto";
  margin-left:auto;
  padding:3px 7px;
  border-radius:999px;
  background:#e2e8f0;
  color:#475569;
  font-size:10px;
  font-weight:800;
  letter-spacing:.04em;
  text-transform:uppercase;
}
.transfer-color-auto.too-many{
  border-color:#f59e0b;
  background:#fff7ed;
  color:#9a3412;
}


/* Admin-only destructive action in order history. */
.order-delete-btn{
  border:1px solid #fecaca;
  border-radius:8px;
  background:#fff;
  color:#b91c1c;
  padding:8px 10px;
  font-size:11px;
  font-weight:800;
  cursor:pointer;
}
.order-delete-btn:hover{background:#fef2f2;border-color:#fca5a5}
.order-delete-btn:disabled{opacity:.55;cursor:wait}

/* Vector colour editor */
.vector-color-modal[hidden]{display:none!important}
.vector-color-modal{position:fixed;inset:0;z-index:2147483100;display:flex;align-items:center;justify-content:center;padding:20px}
.vector-color-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.64);backdrop-filter:blur(3px)}
.vector-color-dialog{position:relative;z-index:1;width:min(620px,calc(100vw - 32px));max-height:min(760px,calc(100vh - 32px));display:flex;flex-direction:column;background:#fff;border:1px solid #e2e8f0;border-radius:16px;overflow:hidden;box-shadow:0 24px 80px rgba(15,23,42,.34)}
.vector-color-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:18px 20px 15px;border-bottom:1px solid #e2e8f0}
.vector-color-header h2{margin:0 0 4px;font-size:21px;line-height:1.2;color:#111827}
.vector-color-sub{font-size:12px;line-height:1.45;color:#64748b;word-break:break-word}
.vector-color-close{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:999px;background:#f1f5f9;color:#dc2626;font:700 25px/1 system-ui,sans-serif;cursor:pointer}
.vector-color-body{padding:18px 20px;overflow:auto}
.vector-color-list{display:flex;flex-direction:column;gap:10px}
.vector-color-row{display:grid;grid-template-columns:minmax(120px,1fr) 42px minmax(260px,1.45fr);align-items:center;gap:12px;padding:11px 12px;border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc}
.vector-color-name{min-width:0;font-size:13px;font-weight:800;color:#1e293b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.vector-color-preview{width:42px;height:36px;border:1px solid #cbd5e1;border-radius:7px;background:#fff;box-shadow:inset 0 0 0 1px rgba(255,255,255,.45)}
.vector-cmyk-fields{display:grid;grid-template-columns:repeat(4,minmax(52px,1fr));gap:7px}
.vector-cmyk-fields label{display:grid;grid-template-columns:18px minmax(0,1fr);align-items:center;gap:4px;color:#475569;font:800 11px/1 system-ui,sans-serif}
.vector-cmyk-fields input{box-sizing:border-box;width:100%;height:36px;border:1px solid #cbd5e1;border-radius:7px;background:#fff;padding:6px 5px;font:700 12px/1 monospace;color:#111827;text-align:center}
.vector-color-note{margin-top:14px;padding:10px 12px;border-radius:8px;background:#f1f5f9;color:#64748b;font-size:11px;line-height:1.45}
.vector-color-footer{display:flex;justify-content:flex-end;gap:10px;padding:14px 20px 18px;border-top:1px solid #e2e8f0}
.vector-color-cancel,.vector-color-save{min-height:40px;padding:9px 14px;border-radius:8px;font-weight:800;cursor:pointer}
.vector-color-cancel{border:1px solid #cbd5e1;background:#fff;color:#334155}
.vector-color-save{border:1px solid #111827;background:#111827;color:#fff}
.vector-color-save:disabled{opacity:.55;cursor:wait}
.vector-color-btn{border:1px solid #cbd5e1!important;background:#fff!important;color:#334155!important}
.vector-color-btn:hover{background:#f8fafc!important;border-color:#94a3b8!important}
@media(max-width:660px){.vector-color-row{grid-template-columns:minmax(0,1fr) 42px;gap:8px}.vector-cmyk-fields{grid-column:1/-1;grid-template-columns:repeat(4,minmax(54px,1fr))}.vector-color-body{padding:14px}.vector-color-footer{padding:12px 14px 16px}}


/* Vector color editor: large clickable color swatch backed by the native color picker. */
.vector-color-picker-wrap{
  position:relative;
  display:inline-block;
  width:54px;
  height:40px;
  border:1px solid #cbd5e1;
  border-radius:8px;
  overflow:hidden;
  cursor:pointer;
  background:#fff;
  flex:0 0 auto;
}
.vector-color-picker{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  opacity:0;
  cursor:pointer;
  z-index:2;
  border:0;
  padding:0;
}
.vector-color-picker-wrap .vector-color-preview{
  position:absolute;
  inset:3px;
  display:block;
  border-radius:5px;
  border:1px solid rgba(15,23,42,.16);
  pointer-events:none;
}
.vector-color-picker-wrap:focus-within{
  outline:2px solid #2563eb;
  outline-offset:2px;
}


/* Refined vector color picker layout */
.vector-color-row{
  column-gap:18px;
}
.vector-color-picker-wrap{
  width:52px;
  height:36px;
  border:1px solid #b8c2cf;
  border-radius:10px;
  overflow:visible;
  background:#fff;
  box-shadow:none;
  margin-right:10px;
}
.vector-color-picker-wrap .vector-color-preview{
  inset:2px;
  border-radius:7px;
  border:1px solid rgba(15,23,42,.12);
  box-shadow:none;
}
.vector-color-picker{
  border-radius:10px;
}
.vector-cmyk-fields{
  gap:14px;
}
.vector-cmyk-fields label{
  gap:6px;
}

/* Keep the clickable swatch fully inside its grid cell. */
.vector-color-row{
  grid-template-columns:minmax(120px,1fr) 48px minmax(260px,1.45fr);
  column-gap:16px;
}
.vector-color-picker-wrap{
  box-sizing:border-box;
  width:48px;
  height:36px;
  margin-right:0;
  overflow:hidden;
  justify-self:center;
}
@media(max-width:660px){
  .vector-color-row{grid-template-columns:minmax(0,1fr) 48px;column-gap:12px}
}


/* Bitmap background removal editor */
.bitmap-bg-modal[hidden]{display:none!important}
.bitmap-bg-modal{position:fixed;inset:0;z-index:2147483110;display:flex;align-items:center;justify-content:center;padding:20px}
.bitmap-bg-backdrop{position:absolute;inset:0;background:rgba(15,23,42,.64);backdrop-filter:blur(3px)}
.bitmap-bg-dialog{position:relative;z-index:1;width:min(900px,calc(100vw - 32px));max-height:min(860px,calc(100vh - 32px));display:flex;flex-direction:column;background:#fff;border:1px solid #e2e8f0;border-radius:16px;overflow:hidden;box-shadow:0 24px 80px rgba(15,23,42,.34)}
.bitmap-bg-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;padding:18px 20px 15px;border-bottom:1px solid #e2e8f0}
.bitmap-bg-header h2{margin:0 0 4px;font-size:21px;line-height:1.2;color:#111827}
.bitmap-bg-sub{font-size:12px;line-height:1.45;color:#64748b;word-break:break-word}
.bitmap-bg-close{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:999px;background:#f1f5f9;color:#dc2626;font:700 25px/1 system-ui,sans-serif;cursor:pointer}
.bitmap-bg-body{padding:18px 20px;overflow:auto;display:flex;flex-direction:column;gap:12px}
.bitmap-bg-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap}
.bitmap-bg-picked{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.bitmap-bg-picked-label{font-size:12px;font-weight:800;color:#475569}
.bitmap-bg-picked-swatch{position:relative;display:inline-block;width:50px;height:38px;border:1px solid #cbd5e1;border-radius:10px;overflow:hidden;background:#fff;cursor:pointer}
.bitmap-bg-picked-swatch input{position:absolute;inset:0;width:100%;height:100%;opacity:0;cursor:pointer}
.bitmap-bg-picked-swatch span{position:absolute;inset:3px;border-radius:7px;border:1px solid rgba(15,23,42,.14);background:#fff;pointer-events:none}
.bitmap-bg-picked code{display:inline-flex;align-items:center;min-height:34px;padding:0 10px;border-radius:8px;background:#f8fafc;border:1px solid #e2e8f0;color:#0f172a;font:700 12px/1.2 ui-monospace,SFMono-Regular,Menlo,monospace}
.bitmap-bg-tolerance-group{display:grid;grid-template-columns:auto minmax(180px,280px) 76px;align-items:center;gap:10px;min-width:min(100%,420px);flex:1 1 340px}
.bitmap-bg-tolerance-group label{font-size:12px;font-weight:800;color:#475569}
.bitmap-bg-tolerance-group input[type="range"]{width:100%}
.bitmap-bg-tolerance-group input[type="number"]{width:76px;height:38px;border:1px solid #cbd5e1;border-radius:8px;padding:6px 8px;font:700 13px/1 ui-monospace,SFMono-Regular,Menlo,monospace;color:#111827;text-align:center}
.bitmap-bg-instruction{font-size:12px;line-height:1.45;color:#475569}
.bitmap-bg-canvas-wrap{display:flex;align-items:center;justify-content:center;min-height:220px;padding:12px;border:1px solid #e2e8f0;border-radius:12px;background:linear-gradient(45deg,#f8fafc 25%,#eef2f7 25%,#eef2f7 50%,#f8fafc 50%,#f8fafc 75%,#eef2f7 75%,#eef2f7 100%);background-size:24px 24px}
.bitmap-bg-canvas-wrap canvas{display:block;max-width:100%;max-height:58vh;border-radius:8px;box-shadow:0 8px 20px rgba(15,23,42,.12);background:transparent;cursor:crosshair}
.bitmap-bg-note{padding:10px 12px;border-radius:8px;background:#f1f5f9;color:#64748b;font-size:11px;line-height:1.45}
.bitmap-bg-footer{display:flex;justify-content:flex-end;gap:10px;padding:14px 20px 18px;border-top:1px solid #e2e8f0}
.bitmap-bg-cancel,.bitmap-bg-save{min-height:40px;padding:9px 14px;border-radius:8px;font-weight:800;cursor:pointer}
.bitmap-bg-cancel{border:1px solid #cbd5e1;background:#fff;color:#334155}
.bitmap-bg-save{border:1px solid #111827;background:#111827;color:#fff}
.bitmap-bg-save:disabled{opacity:.55;cursor:wait}
.bitmap-bg-btn{border:1px solid #cbd5e1!important;background:#fff!important;color:#334155!important}
.bitmap-bg-btn:hover{background:#f8fafc!important;border-color:#94a3b8!important}
@media(max-width:760px){.bitmap-bg-body{padding:14px}.bitmap-bg-toolbar{align-items:stretch}.bitmap-bg-tolerance-group{grid-template-columns:1fr 78px;gap:8px}.bitmap-bg-tolerance-group label{grid-column:1/-1}.bitmap-bg-tolerance-group input[type="range"]{grid-column:1/2}.bitmap-bg-tolerance-group input[type="number"]{grid-column:2/3;justify-self:end}.bitmap-bg-footer{padding:12px 14px 16px}}

.bitmap-bg-preview-status{
  align-self:flex-start;
  padding:7px 10px;
  border:1px solid #dbe3ec;
  border-radius:8px;
  background:#f8fafc;
  color:#334155;
  font-size:12px;
  font-weight:800;
}


/* PMS / named CMYK combobox in vector color editor */
.vector-color-dialog{width:min(780px,calc(100vw - 32px))}
.vector-color-row{grid-template-columns:minmax(130px,.9fr) 48px minmax(360px,1.7fr)}
.vector-color-controls{display:grid;gap:9px;min-width:0}
.vector-color-preset-label{display:grid;grid-template-columns:132px minmax(0,1fr);align-items:center;gap:9px;color:#475569;font:800 11px/1.2 system-ui,sans-serif}
.vector-color-preset-label>span{white-space:nowrap}
.vector-color-preset-label input{box-sizing:border-box;width:100%;height:36px;border:1px solid #cbd5e1;border-radius:7px;background:#fff;padding:6px 9px;font:700 12px/1.2 system-ui,sans-serif;color:#111827}
.vector-color-preset-label input:focus{outline:2px solid #2563eb;outline-offset:1px;border-color:#2563eb}
.vector-color-preset-label input.is-invalid{border-color:#f59e0b;background:#fffbeb}
@media(max-width:760px){
  .vector-color-row{grid-template-columns:minmax(0,1fr) 48px;column-gap:12px}
  .vector-color-controls{grid-column:1/-1}
  .vector-color-preset-label{grid-template-columns:1fr;gap:6px}
}

/* Vector colour editor alignment refinement */
.vector-color-row{
  grid-template-columns:minmax(130px,.9fr) 54px minmax(380px,1.8fr);
  column-gap:18px;
}
.vector-color-picker-wrap{
  box-sizing:border-box;
  width:54px;
  height:44px;
  padding:4px;
  margin:0;
  overflow:hidden;
  justify-self:center;
  align-self:center;
  border:1px solid #b8c2cf;
  border-radius:10px;
  background:#fff;
}
.vector-color-picker-wrap .vector-color-preview{
  inset:4px;
  width:auto;
  height:auto;
  box-sizing:border-box;
  border-radius:6px;
}
.vector-color-controls{
  display:flex;
  flex-direction:column;
  gap:14px;
  min-width:0;
}
.vector-color-preset-label{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  margin:0 auto 2px;
  width:100%;
  color:#475569;
  font:800 11px/1.2 system-ui,sans-serif;
  text-align:center;
}
.vector-color-preset-label>span{
  width:100%;
  text-align:center;
  white-space:nowrap;
}
.vector-color-preset-label input{
  width:min(100%,340px);
  margin:0 auto;
  text-align:left;
}
.vector-cmyk-fields{
  gap:16px;
}
@media(max-width:760px){
  .vector-color-row{grid-template-columns:minmax(0,1fr) 54px;column-gap:14px}
  .vector-color-controls{grid-column:1/-1;gap:12px}
  .vector-color-preset-label input{width:min(100%,360px)}
}

/* TEST-19: standardise Arkbuilder working popups to the 90% viewport rule.
   Keep account/login/confirmation dialogs compact; large work surfaces use 90vw x 90vh. */
.gallery-dialog,
.source-preview-dialog,
.checkout-dialog,
.orders-dialog,
.vector-color-dialog,
.bitmap-bg-dialog {
  box-sizing: border-box !important;
  width: 90vw !important;
  max-width: 90vw !important;
  height: 90vh !important;
  max-height: 90vh !important;
}

/* Price list intentionally keeps the original compact tooltip sizing.
   It is excluded from the TEST-19 90% modal rule. */
body > #priceSheetPopup {
  box-sizing: border-box !important;
  width: min(760px, calc(100vw - 40px)) !important;
  max-width: calc(100vw - 24px) !important;
  height: auto !important;
  max-height: calc(100vh - 24px) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}

/* Let the preview/editor bodies actually use the added height. */
.gallery-grid,
.source-preview-content,
.checkout-body,
.orders-body,
.vector-color-body,
.bitmap-bg-body {
  min-height: 0;
  flex: 1 1 auto;
}

.source-preview-content img {
  max-height: 100% !important;
}

.bitmap-bg-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
}

.bitmap-bg-canvas-wrap canvas {
  max-height: 100% !important;
}

/* TEST-20: keep gallery items compact inside the 90% modal.
   The 90vh gallery grid used to stretch its grid rows, making every card
   appear full-height even though the actual thumbnail was only at the top. */
.gallery-grid {
  align-content: start !important;
  align-items: start !important;
  grid-auto-rows: max-content !important;
}
.gallery-card {
  align-self: start !important;
  height: max-content !important;
  min-height: 0 !important;
}
.gallery-select {
  height: auto !important;
}
.gallery-thumb {
  height: 132px !important;
  min-height: 132px !important;
  max-height: 132px !important;
}
.gallery-name {
  min-height: 0 !important;
}
@media(max-width:600px){
  .gallery-thumb {
    height: 108px !important;
    min-height: 108px !important;
    max-height: 108px !important;
  }
}

/* TEST-26: gallery folders + search */
.gallery-toolbar{flex-wrap:wrap;align-items:stretch}.gallery-folder-btn{border:1px solid #cbd5e1;border-radius:10px;background:#fff;color:#334155;padding:10px 14px;font:700 13px/1.2 system-ui,sans-serif;cursor:pointer}.gallery-folder-btn:disabled{opacity:.45;cursor:not-allowed}.gallery-search-wrap{margin-left:auto;min-width:min(300px,100%);display:grid;grid-template-columns:auto minmax(160px,1fr);align-items:center;gap:8px;color:#64748b;font-size:12px;font-weight:700}.gallery-search-wrap input{width:100%;min-height:42px;border:1px solid #cbd5e1;border-radius:10px;background:#fff;padding:9px 11px;font:inherit;color:#0f172a}.gallery-breadcrumb{display:flex;align-items:center;gap:6px;flex-wrap:wrap;padding:9px 22px;border-bottom:1px solid #e5e7eb;background:#fff;font-size:12px}.gallery-breadcrumb button{border:0;background:transparent;padding:3px 2px;color:#334155;font:700 12px/1.2 system-ui,sans-serif;cursor:pointer}.gallery-breadcrumb button:hover{text-decoration:underline}.gallery-breadcrumb span{color:#94a3b8}.gallery-folder-card{position:relative;min-height:155px;border:1px solid #dbe1e8;border-radius:12px;background:#fff;overflow:hidden}.gallery-folder-open{width:100%;min-height:155px;border:0;background:transparent;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;padding:18px 12px;cursor:pointer;color:#0f172a}.gallery-folder-icon{font-size:36px;line-height:1}.gallery-folder-open strong{font-size:13px;max-width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gallery-folder-open span:last-child{font-size:10px;color:#64748b}.gallery-folder-delete{position:absolute;top:8px;right:8px;z-index:3;width:28px;height:28px;padding:0;border:0;border-radius:50%;background:#fff;color:#475569;box-shadow:0 1px 5px rgba(15,23,42,.18);cursor:pointer;font-size:20px;line-height:1;display:flex;align-items:center;justify-content:center}.gallery-path{padding:0 10px 9px;color:#64748b;font-size:9px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gallery-footer{justify-content:space-between}.gallery-move-controls{display:flex;align-items:center;gap:8px}.gallery-move-controls select{min-height:38px;max-width:240px;border:1px solid #cbd5e1;border-radius:9px;background:#fff;padding:7px 9px;color:#334155;font:600 12px/1.2 system-ui,sans-serif}@media(max-width:600px){.gallery-search-wrap{width:100%;margin-left:0;grid-template-columns:1fr}.gallery-search-wrap span{display:none}.gallery-footer{align-items:stretch;flex-direction:column}.gallery-move-controls{width:100%;flex-direction:column}.gallery-move-controls select,.gallery-move-controls .gallery-folder-btn,.gallery-footer .gallery-add-btn{width:100%;max-width:none}}


/* TEST-28: gallery layout and folder-action reliability */
.gallery-dialog{
  height:min(900px,calc(100vh - 32px));
  max-height:calc(100vh - 32px);
}
.gallery-toolbar{
  display:flex !important;
  flex-direction:column;
  gap:10px;
  padding:14px 22px 12px !important;
}
.gallery-upload-btn{
  min-height:88px;
  flex:0 0 auto;
}
.gallery-controls-row{
  display:flex;
  align-items:center;
  gap:10px;
  width:100%;
}
.gallery-controls-row .gallery-folder-btn{
  flex:0 0 auto;
  min-height:42px;
}
.gallery-controls-row .gallery-search-wrap{
  flex:1 1 auto;
  margin-left:0;
  min-width:0;
}
.gallery-grid{
  min-height:280px;
}
@media(max-width:600px){
  .gallery-dialog{height:calc(100vh - 16px);max-height:calc(100vh - 16px)}
  .gallery-toolbar{padding:10px 12px !important}
  .gallery-upload-btn{min-height:76px}
  .gallery-controls-row{flex-direction:column;align-items:stretch}
  .gallery-controls-row .gallery-folder-btn,.gallery-controls-row .gallery-search-wrap{width:100%}
}


/* TEST-30: compact upload strip, leaving more room for the gallery */
.gallery-toolbar{
  gap:8px;
  padding:10px 22px 9px !important;
}
.gallery-upload-btn{
  min-height:48px !important;
  padding:8px 14px !important;
  flex-direction:row !important;
  justify-content:center;
  gap:10px;
}
.gallery-upload-btn strong{
  font-size:14px;
  white-space:nowrap;
}
.gallery-upload-btn span{
  font-size:11px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.gallery-grid{
  min-height:360px;
}
@media(max-width:600px){
  .gallery-toolbar{padding:8px 12px !important}
  .gallery-upload-btn{min-height:46px !important;padding:8px 10px !important}
  .gallery-upload-btn span{display:none}
}

/* TEST-31: single-line compact gallery toolbar */
.gallery-toolbar{
  flex-direction:row !important;
  align-items:center !important;
  flex-wrap:nowrap !important;
  gap:8px !important;
  padding:8px 22px !important;
}
.gallery-upload-btn{
  width:auto !important;
  min-height:38px !important;
  height:38px !important;
  padding:7px 12px !important;
  flex:0 0 auto !important;
  border:1px dashed #94a3b8 !important;
  border-radius:9px !important;
  background:#f8fafc !important;
  color:#0f172a !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
}
.gallery-upload-btn strong{font-size:12px !important;line-height:1 !important}
.gallery-upload-btn span{display:none !important}
.gallery-controls-row{
  display:flex !important;
  flex:1 1 auto !important;
  min-width:0 !important;
  align-items:center !important;
  gap:8px !important;
}
.gallery-controls-row .gallery-folder-btn{min-height:38px !important;height:38px !important;padding:7px 12px !important}
.gallery-controls-row .gallery-search-wrap{min-width:0 !important;grid-template-columns:auto minmax(120px,1fr) !important}
.gallery-controls-row .gallery-search-wrap input{min-height:38px !important;height:38px !important;padding:7px 10px !important}
.gallery-breadcrumb{padding:6px 22px !important}
.gallery-grid{min-height:420px !important;padding-top:12px !important}
@media(max-width:700px){
  .gallery-toolbar{flex-wrap:wrap !important;padding:7px 12px !important}
  .gallery-upload-btn{flex:0 0 auto !important}
  .gallery-controls-row{flex:1 1 100% !important}
  .gallery-controls-row .gallery-search-wrap span{display:none !important}
  .gallery-grid{min-height:360px !important}
}

/* TEST-35: clearly distinguish permanent server items from temporary browser items. */
.gallery-storage-badge{position:absolute;left:6px;top:6px;z-index:4;display:inline-flex;align-items:center;min-height:20px;padding:3px 7px;border-radius:999px;font-size:8px;line-height:1;font-weight:900;letter-spacing:.04em;box-shadow:0 1px 5px rgba(15,23,42,.16)}
.gallery-storage-badge.is-permanent{background:rgba(236,253,245,.96);color:#047857;border:1px solid rgba(16,185,129,.42)}
.gallery-storage-badge.is-temporary{background:rgba(254,249,195,.97);color:#854d0e;border:1px solid rgba(202,138,4,.42)}
.gallery-promote{display:block;width:calc(100% - 18px);margin:0 9px 9px;padding:6px 8px;border:1px solid #cbd5e1;border-radius:8px;background:#fff;color:#0f172a;font:inherit;font-size:9px;font-weight:800;cursor:pointer}.gallery-promote:hover{background:#f8fafc}.gallery-promote:disabled{opacity:.55;cursor:wait}


/* TEST-37: fixed gallery viewport + always-visible action footer. */
.gallery-dialog{
  overflow:hidden !important;
  display:flex !important;
  flex-direction:column !important;
}
.gallery-header,
.gallery-toolbar,
.gallery-breadcrumb,
.gallery-footer{
  flex:0 0 auto !important;
}
.gallery-grid{
  flex:1 1 auto !important;
  min-height:0 !important;
  max-height:none !important;
  overflow-x:hidden !important;
  overflow-y:auto !important;
  scrollbar-gutter:stable both-edges !important;
  overscroll-behavior:contain;
  align-content:start !important;
  padding-bottom:24px !important;
}
.gallery-grid::-webkit-scrollbar{width:12px;}
.gallery-grid::-webkit-scrollbar-track{background:#f1f5f9;border-left:1px solid #e2e8f0;}
.gallery-grid::-webkit-scrollbar-thumb{background:#94a3b8;border:3px solid #f1f5f9;border-radius:999px;}
.gallery-grid::-webkit-scrollbar-thumb:hover{background:#64748b;}
.gallery-footer{
  position:relative !important;
  z-index:5 !important;
  background:#fff !important;
  box-shadow:0 -1px 0 #e5e7eb !important;
}
.gallery-file-icon-broken{
  padding:8px;
  text-align:center;
  font-size:11px;
  line-height:1.25;
  color:#64748b;
}
@media(max-width:700px){
  .gallery-grid{min-height:0 !important;padding-bottom:18px !important;}
}
