.product-template-page { --template-white: var(--color-paper); --template-overlay: rgba(25, 24, 20, .6); }
.template-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) auto; align-items: end; gap: 16px; margin: 28px 0 16px; }
.template-toolbar label { display: grid; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.template-toolbar input,.template-toolbar select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.template-toolbar .admin-button { min-height: 44px; }
.template-count { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.template-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; }
.template-card { margin: 0; min-width: 0; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.template-image-button { display: block; width: 100%; padding: 0; border: 1px solid var(--line); background: var(--template-white); cursor: zoom-in; }
.template-image-button:hover { border-color: var(--admin-green); }
.template-image-button:active { border-color: var(--admin-ink); }
.template-image-button img { display: block; width: 100%; height: auto; aspect-ratio: 540 / 362; object-fit: contain; }
.template-image-error { display: block; padding: 12px; color: var(--red); font-size: 13px; }
.template-image-error[hidden] { display: none; }
#template-retry[hidden] { display: none; }
.template-card h2 { margin: 14px 0 5px; font: inherit; font-size: 19px; font-weight: 600; }
.template-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.template-card small { display: block; margin-top: 8px; color: var(--admin-green); }
.template-empty { grid-column: 1 / -1; padding: 48px 16px; background: var(--surface); text-align: center; color: var(--muted); }
.template-preview { width: min(920px,calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 24px; border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.template-preview::backdrop { background: var(--template-overlay); }
.template-preview header,.template-preview footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.template-preview header>div { min-width: 0; }
.template-preview h2 { margin: 0; font-size: 26px; overflow-wrap: anywhere; }
.template-preview p { margin: 6px 0 16px; color: var(--muted); overflow-wrap: anywhere; }
.template-preview>img { display: block; width: 100%; max-height: 65vh; object-fit: contain; background: var(--template-white); }
.template-preview footer { margin-top: 20px; color: var(--muted); font-size: 13px; }
.product-template-page :is(button,a,input,select):focus-visible { outline: 3px solid var(--admin-gold); outline-offset: 3px; }
.product-template-page .admin-button { white-space: nowrap; }
@media(max-width:1000px) { .template-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; } }
@media(max-width:600px) { .template-toolbar { grid-template-columns: minmax(0,1fr) auto; gap: 12px; } .template-toolbar label:first-child { grid-column: 1 / -1; } .template-grid { grid-template-columns: minmax(0,1fr); gap: 24px; } .template-preview { padding: 16px; } .template-preview h2 { font-size: 22px; } }
