/* TrykkKonfigurator – kundens designverktøy.
   Fargene kan overstyres fra temaet, f.eks.: .pd-app { --pd-accent: #c8102e; } */
.pd-app {
  --pd-ground: transparent; --pd-panel: #ffffff; --pd-panel-2: #f5f7fa; --pd-ink: #14213a; --pd-ink-2: #4d5a73; --pd-ink-3: #7c879c;
  --pd-line: #d7dde7; --pd-accent: #2f5bea; --pd-accent-ink: #ffffff; --pd-accent-soft: #e6ecfd;
  --pd-canvas: #e7ebf1; --pd-grid-line: rgba(20, 33, 58, .06); --pd-warn: #a45a06; --pd-warn-soft: #fdf1e1; --pd-ok: #177245;
  --pd-radius: 12px; --pd-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  container-type: inline-size; color: var(--pd-ink); background: var(--pd-ground); font-size: 15px; line-height: 1.5; margin-block: 1em;
}
.pd-app [hidden] { display: none !important; }
.pd-app *, .pd-app *::before, .pd-app *::after { box-sizing: border-box; }
.pd-app h2, .pd-app h3 { margin: 0; line-height: 1.15; color: var(--pd-ink); text-wrap: balance; }
.pd-app p { margin: 0; }
.pd-app :focus-visible { outline: 2px solid var(--pd-accent); outline-offset: 2px; }

/* Nøytraliser tema-stiler på knapper og felt */
.pd-app button, .pd-app input, .pd-app select, .pd-app textarea {
  font: inherit; color: inherit; letter-spacing: normal; text-transform: none; box-shadow: none; margin: 0; min-height: 0; line-height: 1.4;
}
.pd-app button { cursor: pointer; background: none; border: 0; padding: 0; border-radius: 0; text-align: inherit; }
.pd-app input[type=text], .pd-app input[type=email], .pd-app input[type=tel], .pd-app input[type=date], .pd-app input[type=number], .pd-app select, .pd-app textarea {
  background: var(--pd-panel-2); border: 1px solid var(--pd-line); border-radius: 8px; padding: 8px 10px; width: 100%; max-width: 100%; height: auto;
}
.pd-app textarea { resize: vertical; }
.pd-app input[type=file] { font-size: 13px; max-width: 100%; }
.pd-app input[type=range] { width: 100%; accent-color: var(--pd-accent); padding: 0; border: 0; background: none; }

/* Oppsett */
.pd-grid { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); }
.pd-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
@container (min-width: 760px) {
  .pd-grid { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
  .pd-summary { grid-column: 1 / -1; }
}
@container (min-width: 1180px) {
  .pd-grid { grid-template-columns: 320px minmax(0, 1fr) 320px; }
  .pd-summary { grid-column: auto; }
  .pd-preview, .pd-summary { position: sticky; top: 16px; align-self: start; }
}
.pd-panel { background: var(--pd-panel); border: 1px solid var(--pd-line); border-radius: var(--pd-radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pd-step { display: flex; align-items: baseline; gap: 10px; }
.pd-no { font: 600 13px/1 var(--pd-mono); color: var(--pd-accent); }
.pd-step h2 { font-size: 20px; }
.pd-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--pd-ink-2); font-weight: 600; }
.pd-muted { color: var(--pd-ink-2); font-size: 14px; }
.pd-fine { font-size: 13px; color: var(--pd-ink-2); }
.pd-loading { color: var(--pd-ink-2); }

/* Katalog */
.pd-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.pd-app .pd-gcard { background: var(--pd-panel-2); border: 1px solid var(--pd-line); border-radius: 10px; padding: 8px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 13px; line-height: 1.2; }
.pd-gcard[aria-pressed="true"] { border-color: var(--pd-accent); box-shadow: 0 0 0 1px var(--pd-accent) inset; background: var(--pd-accent-soft); }
.pd-gname { font-weight: 600; }
.pd-gcard small { color: var(--pd-ink-3); font-size: 11px; }
.pd-thumb { display: block; width: 100%; height: 78px; }
.pd-thumb img, .pd-thumb svg { width: 100%; height: 100%; object-fit: contain; display: block; }
.pd-pending { font: 600 10px/1.4 var(--pd-mono); color: var(--pd-warn); background: var(--pd-warn-soft); border-radius: 4px; padding: 1px 5px; }

.pd-color-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.pd-color-name { font-weight: 600; }
.pd-swatches, .pd-inks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pd-app .pd-sw { width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .2); }
.pd-inks .pd-sw { width: 26px; height: 26px; }
.pd-sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--pd-panel), 0 0 0 4px var(--pd-accent) !important; }
.pd-app .pd-inks input[type=color] { width: 32px; height: 32px; border: 0; padding: 0; background: none; }

.pd-own { border: 1px dashed var(--pd-line); border-radius: 10px; }
.pd-own summary { list-style: none; padding: 12px 14px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.pd-own summary::-webkit-details-marker { display: none; }
.pd-own summary small { display: block; color: var(--pd-ink-2); font-size: 13px; }
.pd-plus { width: 28px; height: 28px; border-radius: 8px; background: var(--pd-accent-soft); color: var(--pd-accent); display: grid; place-items: center; font-weight: 700; flex: none; }
.pd-own-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.pd-field { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.pd-field > span { font-size: 13px; color: var(--pd-ink-2); font-weight: 500; }

.pd-app .pd-btn { display: inline-flex; justify-content: center; align-items: center; border: 1px solid var(--pd-line); background: var(--pd-panel-2); color: var(--pd-ink); border-radius: 10px; padding: 10px 14px; font-weight: 600; text-decoration: none; }
.pd-app .pd-btn:hover { border-color: var(--pd-ink-3); }
.pd-app .pd-btn:disabled { opacity: .6; cursor: progress; }
.pd-app .pd-primary { background: var(--pd-accent); border-color: var(--pd-accent); color: var(--pd-accent-ink); }
.pd-app .pd-ghost { background: transparent; padding: 8px 12px; font-size: 14px; }
.pd-app .pd-danger { color: #c0392b; }
.pd-add-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pd-app .pd-add { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--pd-line); background: var(--pd-panel-2); }
.pd-app .pd-add:hover { border-color: var(--pd-accent); }
.pd-add b { font-size: 16px; }
.pd-add small { color: var(--pd-ink-2); font-size: 12px; }
.pd-ic { font: 600 18px/1 var(--pd-mono); color: var(--pd-accent); margin-bottom: 6px; }

/* Forhåndsvisning */
.pd-live { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--pd-ok); font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.pd-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pd-tabs { display: flex; gap: 4px; background: var(--pd-panel-2); border: 1px solid var(--pd-line); border-radius: 10px; padding: 4px; overflow-x: auto; }
.pd-app .pd-tab { flex: 1 0 auto; border-radius: 7px; padding: 7px 12px; font-size: 14px; font-weight: 500; color: var(--pd-ink-2); display: flex; gap: 6px; align-items: center; justify-content: center; white-space: nowrap; }
.pd-tab[aria-selected="true"] { background: var(--pd-panel); color: var(--pd-ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.pd-tab em { font: 600 11px/1.5 var(--pd-mono); font-style: normal; background: var(--pd-accent-soft); color: var(--pd-accent); border-radius: 999px; padding: 0 6px; }
.pd-tab em:empty { display: none; }
.pd-stage { position: relative; height: min(66vh, 620px); min-height: 380px; border-radius: 10px; background-color: var(--pd-canvas);
  background-image: linear-gradient(var(--pd-grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--pd-grid-line) 1px, transparent 1px); background-size: 24px 24px; overflow: hidden; }
.pd-svg { width: 100%; height: 100%; display: block; touch-action: none; }
.pd-view-tag { position: absolute; left: 14px; top: 12px; font: 600 11px/1 var(--pd-mono); letter-spacing: .12em; color: var(--pd-ink-3); pointer-events: none; }
.pd-stage-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font: 12px/1.4 var(--pd-mono); color: var(--pd-ink-3); }
.pd-svg [data-print] { cursor: grab; }
.pd-svg [data-handle] { cursor: nwse-resize; }
.pd-editor { border-top: 1px solid var(--pd-line); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.pd-editor-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pd-editor-head h3 { font-size: 17px; }
.pd-dim { font-family: var(--pd-mono); }
.pd-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pd-range { display: flex; flex-direction: column; gap: 2px; }
.pd-rl { display: flex; justify-content: space-between; font-size: 13px; color: var(--pd-ink-2); }
.pd-rl output { font: 600 12px/1.6 var(--pd-mono); color: var(--pd-ink); }
.pd-note { font-size: 13px; border-radius: 8px; padding: 8px 10px; background: var(--pd-panel-2); color: var(--pd-ink-2); }
.pd-warn { background: var(--pd-warn-soft); color: var(--pd-warn); }
.pd-editor-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Oppsummering */
.pd-sum-garment { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; background: var(--pd-panel-2); }
.pd-sum-garment .pd-thumb { width: 56px; height: 64px; flex: none; }
.pd-sum-garment b { display: block; font-size: 16px; }
.pd-sum-garment span, .pd-sum-garment small { display: block; color: var(--pd-ink-2); font-size: 13px; }
.pd-qty { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.pd-stepper { display: flex; align-items: center; border: 1px solid var(--pd-line); border-radius: 10px; overflow: hidden; }
.pd-app .pd-stepper button { background: var(--pd-panel-2); width: 38px; height: 38px; font-size: 18px; text-align: center; }
.pd-app .pd-stepper input { width: 64px; border: 0; border-radius: 0; text-align: center; background: var(--pd-panel); font: 600 15px var(--pd-mono); -moz-appearance: textfield; }
.pd-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }
.pd-sizes { border: 1px solid var(--pd-line); border-radius: 10px; }
.pd-sizes summary { padding: 10px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; font-weight: 500; }
.pd-size-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0 12px 12px; }
.pd-size-grid label { display: flex; flex-direction: column; gap: 2px; font: 600 12px var(--pd-mono); color: var(--pd-ink-2); }
.pd-app .pd-size-grid input { padding: 6px; text-align: center; font-family: var(--pd-mono); }
.pd-size-status { font: 12px var(--pd-mono); padding: 0 12px 12px; }
.pd-bad { color: var(--pd-warn); } .pd-good { color: var(--pd-ok); }
.pd-places-head { margin-bottom: 8px; }
.pd-place-count { font-family: var(--pd-mono); }
.pd-places { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pd-app .pd-places button { width: 100%; text-align: left; border: 1px solid var(--pd-line); background: var(--pd-panel-2); border-radius: 10px; padding: 9px 12px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: baseline; }
.pd-places button[aria-current="true"] { border-color: var(--pd-accent); background: var(--pd-accent-soft); }
.pd-pv { font: 600 11px/1.6 var(--pd-mono); color: var(--pd-accent); text-transform: uppercase; letter-spacing: .06em; grid-row: span 2; }
.pd-pt { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-pd { font: 12px/1.4 var(--pd-mono); color: var(--pd-ink-2); }
.pd-empty { color: var(--pd-ink-3); font-size: 14px; }
.pd-contact { display: flex; flex-direction: column; gap: 10px; }
.pd-error { color: #b42318; font-size: 14px; font-weight: 600; }
.pd-hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.pd-sent { display: flex; flex-direction: column; gap: 12px; }
.pd-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.pd-toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--pd-ink); color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 14px; z-index: 99999; max-width: calc(100vw - 32px); }
.pd-toast[hidden] { display: none; }

@container (max-width: 480px) {
  .pd-add-row, .pd-grid2 { grid-template-columns: 1fr; }
  .pd-stage { height: 420px; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) { .pd-app * { transition: none !important; animation: none !important; } }

/* Produktinfo */
.pd-product { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: 10px; background: var(--pd-panel-2); }
.pd-product-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pd-product-head b { font-size: 16px; line-height: 1.25; }
.pd-price { font-weight: 600; white-space: nowrap; }
.pd-sku { font: 12px/1.4 var(--pd-mono); color: var(--pd-ink-3); }
.pd-product .pd-muted { font-size: 13px; }
.pd-app .pd-link { font-size: 13px; font-weight: 600; color: var(--pd-accent); text-decoration: none; }
.pd-app .pd-link:hover { text-decoration: underline; }

/* Fargevalg med variantbilde */
.pd-app .pd-sw-img { width: 40px; height: 40px; border-radius: 8px; border-color: var(--pd-line); }

/* Bilder av plagget som faner */
.pd-tabs { background: none; border: 0; padding: 0 0 2px; gap: 8px; }
.pd-tabs[hidden] { display: none; }
.pd-app .pd-tab { flex: 0 0 auto; position: relative; flex-direction: column; gap: 4px; padding: 4px; border: 1px solid var(--pd-line); border-radius: 10px; background: var(--pd-panel); }
.pd-tab[aria-selected="true"] { border-color: var(--pd-accent); box-shadow: 0 0 0 1px var(--pd-accent); background: var(--pd-panel); }
.pd-tab-img { width: 64px; height: 64px; display: block; border-radius: 6px; overflow: hidden; background: #fff; }
.pd-tab-img img, .pd-tab-img svg { width: 100%; height: 100%; object-fit: contain; display: block; }
.pd-tab-name { font-size: 12px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-tab em { position: absolute; top: -6px; right: -6px; background: var(--pd-accent); color: var(--pd-accent-ink); }
.pd-view-tag[hidden] { display: none; }

/* Scene med produktfoto */
.pd-stage-photo { background: #fff; background-image: none; }
.pd-color-note { font-size: 13px; color: var(--pd-warn); background: var(--pd-warn-soft); border-radius: 8px; padding: 8px 10px; }
.pd-color-note[hidden] { display: none; }

/* Liste over trykk */
.pd-pv { display: flex; align-items: center; gap: 6px; }
.pd-pv-img { width: 28px; height: 28px; flex: none; border-radius: 4px; overflow: hidden; background: #fff; border: 1px solid var(--pd-line); }
.pd-pv-img img, .pd-pv-img svg { width: 100%; height: 100%; object-fit: contain; display: block; }
.pd-color-row { flex-direction: column; align-items: flex-start; gap: 2px; }
.pd-color-name { font-size: 14px; line-height: 1.3; }

/* Hurtigvalg for rotasjon */
.pd-rot-quick { display: flex; gap: 6px; margin-top: 6px; }
.pd-app .pd-rot-quick .pd-btn { padding: 4px 10px; font-size: 13px; font-family: var(--pd-mono); }
.pd-app .pd-rot-quick .pd-btn[aria-pressed="true"] { border-color: var(--pd-accent); color: var(--pd-accent); background: var(--pd-accent-soft); }
