/*
 * Printerei – Fussmatten «Vorlage wählen» (1.55.0, doormat.js). One frame per area: the sections are separated by
 * titles, spacing and thin lines; the mat stands on a floor. Sideways rows (groups, templates, colours) snap: the first
 * one to the start, the last one to the end, every one between to the middle.
 */
.dm { display: flex; flex-direction: column; gap: var(--space-5, 20px); margin-block: var(--space-4, 16px); }
.dm__sec { display: flex; flex-direction: column; gap: var(--space-3, 12px); min-width: 0; }
.dm__sec + .dm__sec { border-top: 1px solid var(--color-border, #dde2df); padding-top: var(--space-5, 20px); }
.dm__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.dm__title { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: var(--fs-base, 16px); font-weight: var(--fw-semibold, 600); color: var(--color-text, #18211f); }
.dm__title .icon { width: 18px; height: 18px; }
.dm__muted { color: var(--color-text-muted, #5c6763); font-size: var(--fs-sm, 14px); font-weight: 400; }
.dm__label { margin: 0; font-size: var(--fs-sm, 14px); font-weight: var(--fw-semibold, 600); display: flex; justify-content: space-between; gap: 8px; }
.dm__hint { margin: 0; font-size: var(--fs-xs, 12px); color: var(--color-text-muted, #5c6763); }
.dm__status { margin: 0; font-size: var(--fs-sm, 14px); color: var(--color-text-muted, #5c6763); min-height: 1.4em; }
.dm__status:empty { min-height: 0; }
.dm__btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* KI-Designer */
.dm__ki-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
@media (max-width: 560px) { .dm__ki-form { grid-template-columns: minmax(0, 1fr); } }
.dm__ki-res { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) {
	/* Phones: the three suggestions side by side, swiped like the templates. */
	.dm__ki-res { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; padding: 4px 2px 6px; }
	.dm__ki-res::-webkit-scrollbar { display: none; }
	.dm__ki-res .dm-tile--wide { flex: none; width: 72%; scroll-snap-align: center; }
	.dm__ki-res > :first-child { scroll-snap-align: start; }
	.dm__ki-res > :last-child { scroll-snap-align: end; }
}
.dm__take--in { margin-block: var(--space-4, 16px) var(--space-5, 20px); }

/* Groups and templates: sideways rows */
.dm__chips, .dm__track, .dm-sws { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none; }
.dm__chips::-webkit-scrollbar, .dm__track::-webkit-scrollbar, .dm-sws::-webkit-scrollbar { display: none; }
.dm__chips { gap: 8px; padding: 2px; }
.dm-chip { flex: none; scroll-snap-align: center; border: 1px solid var(--color-border, #dde2df); background: var(--color-surface, #fff); color: var(--color-text, #18211f); border-radius: var(--radius-pill, 999px); padding: 8px 14px; font: inherit; font-size: var(--fs-sm, 14px); font-weight: var(--fw-semibold, 600); cursor: pointer; transition: background var(--dur-base, .2s) var(--ease-out, ease), color var(--dur-base, .2s) var(--ease-out, ease); }
.dm-chip[aria-pressed="true"] { background: var(--color-secondary, #18211f); border-color: transparent; color: var(--color-on-secondary, #fff); }
.dm__track { gap: 12px; padding: 4px 2px 6px; }
.dm-tile { flex: none; width: 170px; scroll-snap-align: center; display: flex; flex-direction: column; gap: 6px; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; color: var(--color-text, #18211f); font: inherit; }
.dm__chips > :first-child, .dm__track > :first-child, .dm-sws > :first-child { scroll-snap-align: start; }
.dm__chips > :last-child, .dm__track > :last-child, .dm-sws > :last-child { scroll-snap-align: end; }
.dm-tile--wide { width: auto; }
.dm-tile__pic { display: grid; place-items: center; aspect-ratio: 4 / 3; border-radius: var(--radius-control, 10px); background: #cdc6ba; padding: 10px; transition: box-shadow var(--dur-base, .2s) var(--ease-out, ease), transform var(--dur-base, .2s) var(--ease-out, ease); }
.dm-tile__pic svg { width: 100%; height: 100%; filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .28)); }
@media (hover: hover) {
	.dm-tile:hover .dm-tile__pic { transform: translateY(-2px); }
}
.dm-tile[aria-selected="true"] .dm-tile__pic { box-shadow: 0 0 0 3px var(--color-primary, #0e6f6a); }
.dm-tile__name { font-size: var(--fs-sm, 14px); font-weight: var(--fw-semibold, 600); line-height: 1.25; }
.dm-tile__cat { font-size: var(--fs-xs, 12px); color: var(--color-text-muted, #5c6763); line-height: 1.35; }

/* The mat and its settings */
.dm__work { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--space-5, 20px) var(--space-6, 24px); }
@media (max-width: 900px) { .dm__work { grid-template-columns: minmax(0, 1fr); } }
.dm__stage { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dm__stage-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.dm__floor { display: grid; place-items: center; border-radius: var(--radius-card, 14px); padding: clamp(16px, 4vw, 32px); background: repeating-linear-gradient(90deg, rgba(120, 110, 95, .12) 0 2px, transparent 2px 46px), #cdc6ba; }
.dm__floor svg { width: 100%; height: auto; max-height: 420px; filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .35)); }
.dm__meta { margin: 0; font-size: var(--fs-xs, 12px); color: var(--color-text-muted, #5c6763); font-variant-numeric: tabular-nums; }
.dm__warn { margin: 0; font-size: var(--fs-sm, 14px); padding: 10px 14px; border-radius: var(--radius-control, 10px); background: #fff3dd; color: #8a5200; }
.dm__fields { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dm__group { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dm__group + .dm__group { border-top: 1px solid var(--color-border, #dde2df); padding-top: 16px; }
.dm-f { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm, 14px); font-weight: var(--fw-semibold, 600); }
.dm-f textarea { resize: vertical; }
.dm-pick { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dm-sws { gap: 8px; padding: 5px 4px; }
.dm-sw { flex: none; width: 44px; height: 44px; scroll-snap-align: center; position: relative; padding: 0; border-radius: 8px; border: 1px solid rgba(0, 0, 0, .18); cursor: pointer; transition: box-shadow var(--dur-base, .2s) var(--ease-out, ease), transform var(--dur-base, .2s) var(--ease-out, ease); }
@media (hover: hover) {
	.dm-sw:hover { transform: translateY(-1px); }
}
.dm-sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--color-surface, #fff), 0 0 0 4px var(--color-text, #18211f); }
.dm-sw span { position: absolute; inset: auto 0 3px; font-size: 9px; font-weight: 600; line-height: 1; text-align: center; }
.dm__reset { align-self: flex-start; }

/* «Gummirand zeigen»: a switch with a sliding knob (only the preview – every mat has its rubber edge) */
.dm-tog { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px 0; font: inherit; font-size: var(--fs-sm, 14px); font-weight: var(--fw-semibold, 600); color: var(--color-text, #18211f); cursor: pointer; }
.dm-tog__track { position: relative; flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--color-border-strong, #c3cbc7); transition: background var(--dur-base, .2s) var(--ease-out, ease); }
.dm-tog__knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform var(--dur-slow, .3s) var(--ease-out, ease); }
.dm-tog[aria-checked="true"] .dm-tog__track { background: var(--color-primary, #0e6f6a); }
.dm-tog[aria-checked="true"] .dm-tog__knob { transform: translateX(18px); }

.dm-chip:focus-visible, .dm-tile:focus-visible, .dm-sw:focus-visible, .dm-tog:focus-visible { outline: 3px solid var(--color-primary, #0e6f6a); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
	.dm__chips, .dm__track, .dm-sws { scroll-behavior: auto; }
	.dm-tog__knob, .dm-tog__track, .dm-tile__pic, .dm-sw, .dm-chip { transition: none; }
}

/* Template tab: the template's file and the Datencheck stay in the upload pane, the own upload goes. */
.wz-upload__pane.is-vorlage [data-dropzone],
.wz-upload__pane.is-vorlage [data-later-wrap],
.wz-upload__pane.is-vorlage [data-upload-title] { display: none; }

/* Fussmatten: three tabs in the switch («Vorlage wählen | Datei hochladen | Mit KI gestalten»), the thumb slides over three. */
.ai-switch:has(> :nth-child(3)) { grid-template-columns: repeat(3, minmax(0, 1fr)); --n: 3; }
.ai-switch:has(> :nth-child(3)[aria-selected="true"]) { --i: 2; }
.ai-switch:has(> :nth-child(3)) .ai-switch__tab { text-align: center; line-height: 1.15; }
@media (max-width: 479px) {
	.ai-switch:has(> :nth-child(3)) .ai-switch__tab { flex-direction: column; gap: 2px; padding-block: 6px; min-height: 3.25rem; }
}

/* Hidden stays hidden, also where the theme gives buttons and checks their own display. */
.dm [hidden][hidden] { display: none; }
.dm__take[hidden],
.dm__take [hidden][hidden] { display: none; }
