/* 3D Verket order tool, material list and forms.
   Uses the theme tokens when present, with fallbacks so it works in any theme.
   Radius rule: panels and cards use --r-card, buttons and inputs use --r-ctl, chips and swatches are round. */

.tdv-app, .tdv-materials, .tdv-table-wrap, .tdv-form {
  --_bg: var(--bg, #f4f4f5);
  --_surface: var(--surface, #fcfcfd);
  --_surface-2: var(--surface-2, #ececee);
  --_ink: var(--ink, #17171a);
  --_muted: var(--muted, #5f5f69);
  --_line: var(--line, #dedee3);
  --_line-2: var(--line-2, #cfcfd6);
  --_accent: var(--accent, #e8703a);
  --_accent-ink: var(--accent-ink, #17171a);
  --_accent-text: var(--accent-text, #a8441c);
  --_err: var(--err, #b42318);
  --_ok: var(--ok, #1f7a4d);
  --_r-card: var(--r-card, 14px);
  --_r-ctl: var(--r-ctl, 10px);
  --_mono: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  --_ease: cubic-bezier(.16, 1, .3, 1);
  --tdv-plate: #2b2d31;
  --tdv-plate-line: #45484e;
  color: var(--_ink);
}
@media (prefers-color-scheme: dark) {
  .tdv-app { --tdv-plate: #24262a; --tdv-plate-line: #3d4046; }
}

.tdv-app *, .tdv-app *::before, .tdv-app *::after { box-sizing: border-box; }
.tdv-app .icon, .tdv-form .icon, .tdv-thumb-fallback .icon { width: 1.15em; height: 1.15em; flex: none; }
.tdv-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons ---------- */
.tdv-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: 0 1.25rem; border-radius: var(--_r-ctl); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .975rem; line-height: 1; white-space: nowrap; cursor: pointer;
  text-decoration: none; transition: transform .15s var(--_ease), background-color .2s, border-color .2s, opacity .2s;
}
.tdv-btn:active:not(:disabled) { transform: translateY(1px) scale(.985); }
.tdv-btn-primary { background: var(--_accent); color: var(--_accent-ink); }
.tdv-btn-primary:hover:not(:disabled) { background: color-mix(in oklab, var(--_accent) 88%, var(--_ink)); }
.tdv-btn-ghost { background: transparent; color: var(--_ink); border-color: var(--_line-2); }
.tdv-btn-ghost:hover { border-color: var(--_ink); }
.tdv-btn:disabled { opacity: .55; cursor: not-allowed; }
.tdv-btn:focus-visible, .tdv-icon-btn:focus-visible, .tdv-link-btn:focus-visible, .tdv-drop:focus-visible { outline: 2px solid var(--_accent); outline-offset: 2px; }

.tdv-icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--_r-ctl);
  border: 1px solid var(--_line); background: var(--_surface); color: var(--_ink); cursor: pointer; padding: 0;
}
.tdv-icon-btn:hover { border-color: var(--_line-2); }
.tdv-link-btn {
  display: inline-flex; align-items: center; gap: .4rem; padding: .25rem 0; border: 0; background: none;
  color: var(--_accent-text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.tdv-link-btn:hover { text-decoration-thickness: 2px; }

/* ---------- empty state / drop zone ---------- */
.tdv-app { position: relative; }
.tdv-drop {
  position: relative; display: grid; place-items: center; min-height: clamp(320px, 52vh, 520px);
  border: 1.5px dashed var(--_line-2); border-radius: var(--_r-card); background:
    radial-gradient(circle at 1px 1px, color-mix(in oklab, var(--_ink) 12%, transparent) 1px, transparent 0) 0 0 / 22px 22px,
    var(--_surface);
  cursor: pointer; transition: border-color .2s, background-color .2s;
}
.tdv-drop:hover, .tdv-app.is-dragging .tdv-drop { border-color: var(--_accent); }
.tdv-drop-inner { display: grid; justify-items: center; gap: .75rem; text-align: center; padding: 2rem; max-width: 34rem; }
.tdv-drop-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: color-mix(in oklab, var(--_accent) 16%, transparent); color: var(--_accent-text); font-size: 28px; }
.tdv-drop-icon .icon { width: 30px; height: 30px; }
.tdv-drop-title { margin: .25rem 0 0; font-size: clamp(1.35rem, 2.4vw, 1.75rem); font-weight: 650; letter-spacing: -.02em; }
.tdv-drop-sub { margin: 0 0 .5rem; color: var(--_muted); max-width: 40ch; }

.tdv-app[data-state="empty"] .tdv-work, .tdv-app[data-state="empty"] .tdv-done { display: none; }
.tdv-app[data-state="work"] .tdv-drop, .tdv-app[data-state="work"] .tdv-done { display: none; }
.tdv-app[data-state="done"] .tdv-drop, .tdv-app[data-state="done"] .tdv-work { display: none; }

.tdv-app[data-state="work"].is-dragging::after {
  content: "Släpp för att lägga till"; position: absolute; inset: 0; z-index: 5; display: grid; place-items: center;
  border: 2px dashed var(--_accent); border-radius: var(--_r-card); font-weight: 650; font-size: 1.25rem;
  background: color-mix(in oklab, var(--_surface) 86%, transparent); backdrop-filter: blur(4px);
}

/* ---------- workspace ---------- */
.tdv-work {
  display: grid; gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "stage" "side";
}
.tdv-stage-col { grid-area: stage; min-width: 0; }
.tdv-side { grid-area: side; display: grid; gap: 12px; min-width: 0; align-content: start; }
@media (min-width: 1024px) {
  .tdv-work { grid-template-columns: minmax(0, 1.45fr) minmax(360px, 1fr); grid-template-areas: "stage side"; align-items: start; }
  .tdv-side { position: sticky; top: calc(var(--header-h, 72px) + 16px); }
  .admin-bar .tdv-side { top: calc(var(--header-h, 72px) + 48px); }
  .tdv-panel { max-height: calc(100dvh - var(--header-h, 72px) - 250px); overflow: auto; overscroll-behavior: contain; }
}

.tdv-stage {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--_r-card); overflow: hidden;
  background: radial-gradient(120% 90% at 50% 0%, color-mix(in oklab, var(--_surface) 100%, transparent), var(--_surface-2));
  border: 1px solid var(--_line);
}
@media (max-width: 640px) { .tdv-stage { aspect-ratio: 1 / 1; } }
.tdv-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.tdv-stage-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; }
.tdv-stage-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 2rem; background: color-mix(in oklab, var(--_surface) 70%, transparent); }
.tdv-stage-msg[hidden] { display: none; }
.tdv-stage-error { display: grid; justify-items: center; gap: .25rem; max-width: 36ch; color: var(--_ink); }
.tdv-stage-error .icon { width: 36px; height: 36px; color: var(--_err); }
.tdv-stage-error p { margin: 0; }
.tdv-skel { display: grid; justify-items: center; gap: 1rem; color: var(--_muted); }
.tdv-skel span { width: 120px; height: 120px; border-radius: var(--_r-card); background: linear-gradient(100deg, var(--_surface-2) 30%, var(--_surface) 50%, var(--_surface-2) 70%) 0 0 / 300% 100%; animation: tdv-shimmer 1.3s linear infinite; }
.tdv-skel p { margin: 0; font-size: .925rem; }
.tdv-skel-lines { display: grid; gap: 14px; padding: 8px 0; }
.tdv-skel-lines span { height: 56px; border-radius: var(--_r-ctl); background: linear-gradient(100deg, var(--_surface-2) 30%, var(--_surface) 50%, var(--_surface-2) 70%) 0 0 / 300% 100%; animation: tdv-shimmer 1.3s linear infinite; }
.tdv-skel-lines span:nth-child(2) { width: 70%; }
@keyframes tdv-shimmer { to { background-position: -300% 0; } }

.tdv-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 1rem 0 0; padding: 0; }
.tdv-stats > div { padding: .25rem 1rem; border-left: 1px solid var(--_line); min-width: 0; }
.tdv-stats > div:first-child { border-left: 0; padding-left: 0; }
.tdv-stats dt { display: flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--_muted); }
.tdv-stats dd { margin: .2rem 0 0; font-family: var(--_mono); font-size: .95rem; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .tdv-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: .75rem; }
  .tdv-stats > div:nth-child(3) { border-left: 0; padding-left: 0; }
}

.tdv-notices { display: grid; gap: .5rem; margin-top: 1rem; }
.tdv-notices:empty { display: none; }
.tdv-note { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem 1rem; border-radius: var(--_r-ctl); background: var(--_surface-2); font-size: .925rem; }
.tdv-note > .icon { margin-top: .15rem; color: var(--_accent-text); }
.tdv-note.is-error { background: color-mix(in oklab, var(--_err) 9%, var(--_surface)); }
.tdv-note.is-error > .icon { color: var(--_err); }
.tdv-note p { margin: 0; }
.tdv-note p + p { margin-top: .35rem; }

.tdv-models-head { display: flex; align-items: center; justify-content: space-between; margin: 1.75rem 0 .75rem; }
.tdv-app .tdv-h { margin: 0; font-size: 1.05rem; font-weight: 650; letter-spacing: -.01em; line-height: 1.3; }
.tdv-app .tdv-models { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.tdv-app .tdv-models > li { margin: 0; }
.tdv-model { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: .75rem; padding: .5rem .5rem .5rem .5rem; border: 1px solid var(--_line); border-radius: var(--_r-card); background: var(--_surface); transition: border-color .2s; }
.tdv-model.is-active { border-color: var(--_ink); box-shadow: inset 0 0 0 1px var(--_ink); }
.tdv-model-main { display: flex; align-items: center; gap: .85rem; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tdv-model-main img, .tdv-thumb-ph { width: 56px; height: 56px; border-radius: var(--_r-ctl); background: var(--_surface-2); flex: none; object-fit: contain; display: grid; place-items: center; color: var(--_muted); }
.tdv-model-txt { display: grid; min-width: 0; }
.tdv-model-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdv-model-sub { font-size: .85rem; color: var(--_muted); }
.tdv-model-price { font-family: var(--_mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.tdv-model-del { border-color: transparent; color: var(--_muted); }
.tdv-model-del:hover { color: var(--_err); border-color: var(--_line); }
.tdv-chip { display: inline-block; padding: .2rem .6rem; border-radius: 999px; background: var(--_surface-2); font-size: .78rem; font-weight: 600; color: var(--_muted); white-space: nowrap; }
.tdv-chip.is-error { background: color-mix(in oklab, var(--_err) 12%, var(--_surface)); color: var(--_err); }
.tdv-progress { display: block; width: 84px; height: 4px; border-radius: 999px; overflow: hidden; background: var(--_surface-2); }
.tdv-progress i { display: block; height: 100%; background: var(--_accent); transform-origin: 0 50%; transition: transform .2s linear; }
.tdv-spin { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--_line-2); border-top-color: var(--_accent); animation: tdv-rot .8s linear infinite; }
@keyframes tdv-rot { to { transform: rotate(1turn); } }

/* ---------- settings panel ---------- */
.tdv-panel { background: var(--_surface); border: 1px solid var(--_line); border-radius: var(--_r-card); padding: 1.25rem; }
.tdv-panel-empty { padding: .5rem 0; color: var(--_muted); }
.tdv-panel-head { margin-bottom: .5rem; }
.tdv-panel-file { display: flex; align-items: center; gap: .5rem; margin: 0; font-weight: 650; min-width: 0; }
.tdv-panel-file span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdv-group { border: 0; margin: 1.15rem 0 0; padding: 0; min-width: 0; }
.tdv-group legend, .tdv-label { display: flex; gap: .5rem; align-items: baseline; padding: 0; margin-bottom: .55rem; font-size: .875rem; font-weight: 650; }
.tdv-legend-val { font-weight: 450; color: var(--_muted); }
.tdv-opt { font-weight: 400; color: var(--_muted); }
.tdv-help { margin: .45rem 0 0; font-size: .82rem; color: var(--_muted); line-height: 1.45; }
.tdv-help a { color: var(--_accent-text); }
.tdv-help:empty { display: none; }

.tdv-panel label { position: relative; cursor: pointer; }
.tdv-panel input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tdv-panel label:has(input:focus-visible) { outline: 2px solid var(--_accent); outline-offset: 2px; }

.tdv-mats { display: grid; gap: .4rem; }
.tdv-opt-mat { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name price" "tag price"; column-gap: .75rem; padding: .65rem .85rem; border: 1px solid var(--_line); border-radius: var(--_r-ctl); transition: border-color .15s, background-color .15s; }
.tdv-opt-mat:hover { border-color: var(--_line-2); }
.tdv-opt-mat.is-on { border-color: var(--_ink); box-shadow: inset 0 0 0 1px var(--_ink); }
.tdv-mat-name { grid-area: name; font-weight: 650; }
.tdv-mat-tag { grid-area: tag; font-size: .8rem; color: var(--_muted); }
.tdv-mat-price { grid-area: price; align-self: center; font-family: var(--_mono); font-size: .9rem; font-variant-numeric: tabular-nums; }

.tdv-swatches-pick { display: flex; flex-wrap: wrap; gap: .5rem; }
.tdv-sw { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--_line); }
.tdv-sw > span:not(.tdv-sr) { width: 28px; height: 28px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--_ink) 18%, transparent); }
.tdv-sw.is-on { border: 2px solid var(--_ink); }

.tdv-seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; padding: 3px; border-radius: var(--_r-ctl); background: var(--_surface-2); }
.tdv-seg label { display: grid; justify-items: center; align-content: center; gap: .1rem; min-height: 40px; padding: .35rem .25rem; border-radius: calc(var(--_r-ctl) - 3px); text-align: center; font-size: .875rem; transition: background-color .15s; }
.tdv-seg label b { font-weight: 600; white-space: nowrap; }
.tdv-seg label small { font-size: .72rem; color: var(--_muted); font-family: var(--_mono); white-space: nowrap; }
.tdv-seg label.is-on { background: var(--_surface); box-shadow: 0 1px 2px rgb(20 20 24 / .12), 0 0 0 1px var(--_line); }
.tdv-seg-q label { min-height: 50px; }

.tdv-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.tdv-row2 .tdv-group { margin-top: 1.15rem; }
.tdv-stepper { display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; border: 1px solid var(--_line-2); border-radius: var(--_r-ctl); overflow: hidden; height: 42px; background: var(--_surface); }
.tdv-stepper button { border: 0; background: var(--_surface-2); color: var(--_ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.tdv-stepper button:hover { background: var(--_line); }
.tdv-stepper input, .tdv-scale input { width: 100%; min-width: 0; border: 0; background: transparent; color: var(--_ink); text-align: center; font: inherit; font-family: var(--_mono); font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.tdv-stepper input::-webkit-inner-spin-button, .tdv-scale input::-webkit-inner-spin-button { -webkit-appearance: none; }
.tdv-scale { display: flex; align-items: center; height: 42px; padding: 0 .75rem 0 .25rem; border: 1px solid var(--_line-2); border-radius: var(--_r-ctl); background: var(--_surface); }
.tdv-scale span { color: var(--_muted); }
.tdv-stepper:focus-within, .tdv-scale:focus-within { outline: 2px solid var(--_accent); outline-offset: 1px; }
.tdv-disc-hint { margin-top: .6rem; }

.tdv-leads { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.tdv-opt-lead { display: grid; gap: .1rem; padding: .65rem .85rem; border: 1px solid var(--_line); border-radius: var(--_r-ctl); }
.tdv-opt-lead.is-on { border-color: var(--_ink); box-shadow: inset 0 0 0 1px var(--_ink); }
.tdv-lead-name { font-weight: 650; }
.tdv-lead-time { font-size: .82rem; color: var(--_muted); }
.tdv-lead-price { font-size: .8rem; font-family: var(--_mono); }

.tdv-panel textarea, .tdv-form input:not([type="file"]):not([type="hidden"]), .tdv-form textarea {
  width: 100%; padding: .7rem .85rem; border: 1px solid var(--_line-2); border-radius: var(--_r-ctl);
  background: var(--_surface); color: var(--_ink); font: inherit; font-size: .95rem; line-height: 1.4;
}
.tdv-panel textarea:focus, .tdv-form input:focus, .tdv-form textarea:focus { outline: 2px solid var(--_accent); outline-offset: 1px; border-color: transparent; }
.tdv-apply-all { margin-top: 1rem; font-size: .9rem; text-align: left; }

.tdv-price { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--_line); }
.tdv-price-rows > div { display: flex; justify-content: space-between; padding: .2rem 0; font-size: .925rem; color: var(--_muted); }
.tdv-price-rows > div span:last-child { font-family: var(--_mono); color: var(--_ink); font-variant-numeric: tabular-nums; }
.tdv-price-rows > .is-good span:last-child { color: var(--_ok); }
.tdv-price-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: .5rem; }
.tdv-price-total span { font-weight: 600; }
.tdv-price-total strong { font-family: var(--_mono); font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- summary bar ---------- */
.tdv-summary {
  position: sticky; bottom: 12px; z-index: 4;
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1.5rem;
  padding: 1rem 1rem 1rem 1.25rem; border-radius: var(--_r-card); border: 1px solid var(--_line);
  background: color-mix(in oklab, var(--_surface) 92%, transparent); backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px -18px rgb(20 20 24 / .35);
}
.tdv-sum-info { display: flex; align-items: center; gap: 1.75rem; min-width: 0; }
.tdv-sum-count { margin: 0; font-weight: 650; white-space: nowrap; }
.tdv-sum-blocked { font-weight: 400; color: var(--_muted); font-size: .875rem; }
.tdv-sum-rows { display: flex; gap: 1.5rem; margin: 0; }
.tdv-sum-rows div { display: grid; }
.tdv-sum-rows dt { font-size: .78rem; color: var(--_muted); }
.tdv-sum-rows dd { margin: 0; font-family: var(--_mono); font-variant-numeric: tabular-nums; }
.tdv-sum-total { display: grid; justify-items: end; text-align: right; }
.tdv-sum-total span { font-size: .78rem; color: var(--_muted); }
.tdv-sum-total strong { font-family: var(--_mono); font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tdv-sum-total small { font-size: .75rem; color: var(--_muted); }
.tdv-add { min-width: 220px; }
@media (max-width: 900px) {
  .tdv-summary { grid-template-columns: minmax(0, 1fr) auto; gap: .75rem 1rem; bottom: 8px; }
  .tdv-sum-info { grid-column: 1 / -1; justify-content: space-between; gap: 1rem; }
  .tdv-sum-total { justify-items: start; text-align: left; }
  .tdv-add { min-width: 0; }
}
@media (max-width: 480px) {
  .tdv-sum-rows { display: none; }
  .tdv-sum-total small { display: none; }
  .tdv-sum-total span { white-space: nowrap; }
  .tdv-add span { font-size: .925rem; }
}

/* Desktop: the summary sits under the settings panel instead of floating over the preview. */
@media (min-width: 1024px) {
  .tdv-summary { position: static; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem 1rem; padding: 1rem 1.25rem; box-shadow: none; backdrop-filter: none; background: var(--_surface); }
  .tdv-sum-info { grid-column: 1 / -1; justify-content: space-between; gap: 1rem; }
  .tdv-sum-total { justify-items: start; text-align: left; }
  .tdv-add { min-width: 0; }
}

/* ---------- done state ---------- */
.tdv-done-card { display: grid; justify-items: center; gap: .75rem; text-align: center; padding: clamp(2rem, 6vw, 4rem) 1.5rem; border: 1px solid var(--_line); border-radius: var(--_r-card); background: var(--_surface); }
.tdv-done-icon .icon { width: 56px; height: 56px; color: var(--_ok); }
.tdv-done-card h2 { margin: 0; font-size: clamp(1.4rem, 2.6vw, 2rem); letter-spacing: -.02em; outline: 0; }
.tdv-done-card p { margin: 0; color: var(--_muted); max-width: 46ch; }
.tdv-done-warn { color: var(--_err) !important; }
.tdv-done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin: .75rem 0 .25rem; }

/* ---------- materials page ---------- */
.tdv-materials { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 1rem; margin: 2rem 0; }
.tdv-mat { display: flex; flex-direction: column; gap: .75rem; padding: 1.5rem; border: 1px solid var(--_line); border-radius: var(--_r-card); background: var(--_surface); }
.tdv-mat h3 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.tdv-mat-tagline { margin: .15rem 0 0; color: var(--_accent-text); font-weight: 600; font-size: .95rem; }
.tdv-mat > p { margin: 0; color: var(--_muted); line-height: 1.55; }
.tdv-mat-facts { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin: 0; padding: .75rem 0; border-top: 1px solid var(--_line); }
.tdv-mat-facts dt { font-size: .78rem; color: var(--_muted); }
.tdv-mat-facts dd { margin: .15rem 0 0; font-size: .925rem; }
.tdv-swatches { list-style: none; margin: auto 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .85rem; }
.tdv-swatches li { display: inline-flex; align-items: center; gap: .4rem; }
.tdv-swatch { width: 16px; height: 16px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--_ink) 20%, transparent); }
.tdv-table-wrap { overflow-x: auto; margin: 2rem 0; border: 1px solid var(--_line); border-radius: var(--_r-card); background: var(--_surface); }
.tdv-compare { width: 100%; border-collapse: collapse; font-size: .925rem; }
.tdv-compare caption { text-align: left; padding: 1rem 1.25rem .25rem; font-weight: 650; font-size: 1.05rem; }
.tdv-compare th, .tdv-compare td { padding: .8rem 1.25rem; text-align: left; vertical-align: top; }
.tdv-compare thead th { font-size: .78rem; font-weight: 600; color: var(--_muted); border-bottom: 1px solid var(--_line); }
.tdv-compare tbody th { font-weight: 650; white-space: nowrap; }
.tdv-compare tbody tr:nth-child(even) { background: color-mix(in oklab, var(--_surface-2) 55%, transparent); }

/* ---------- forms ---------- */
.tdv-form { margin: 2rem 0; padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--_line); border-radius: var(--_r-card); background: var(--_surface); }
.tdv-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.25rem; }
.tdv-field { display: grid; gap: .45rem; align-content: start; }
.tdv-field label { font-weight: 600; font-size: .9rem; }
.tdv-span { grid-column: 1 / -1; }
.tdv-field input[type="file"] { font: inherit; font-size: .9rem; color: var(--_muted); }
.tdv-field .tdv-help { margin: 0; }
.tdv-field.has-error input, .tdv-field.has-error textarea { border-color: var(--_err); }
.tdv-error { margin: 0; color: var(--_err); font-size: .85rem; font-weight: 500; }
.tdv-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.tdv-form-status { margin: 1rem 0; font-weight: 500; }
.tdv-form-status:empty { display: none; }
.tdv-form-status.is-ok { color: var(--_ok); }
.tdv-form-status.is-error { color: var(--_err); }
.tdv-form.is-sent .tdv-form-grid { opacity: .5; }
@media (max-width: 640px) { .tdv-form-grid { grid-template-columns: 1fr; } }

.tdv-thumb { border-radius: var(--_r-ctl, 10px); background: var(--surface-2, #ececee); object-fit: contain; }
.tdv-thumb-fallback { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 10px; background: var(--surface-2, #ececee); color: var(--muted, #5f5f69); }

@media (prefers-reduced-motion: reduce) {
  .tdv-app *, .tdv-form * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
