.template-page { width: min(1240px, calc(100% - 48px)); margin: 0 auto; }
.template-hero { padding: 130px 0 100px; max-width: 950px; }
.template-back { display: inline-flex; align-items: center; gap: 7px; margin-bottom: 38px; color: var(--muted); font-size: 13px; }
.template-back:hover { color: var(--accent); }
.template-hero h1 { margin: 0; font-size: clamp(38px, 5.2vw, 72px); line-height: 1.06; letter-spacing: -.055em; }
.template-intro { max-width: 760px; margin: 24px 0 0; color: var(--muted); font-size: 18px; line-height: 1.8; }
.template-meta { margin-top: 22px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.template-meta span { padding: 0 9px; color: var(--accent); }
.template-page .secondary-link { gap: 8px; }
.template-page .hero-actions i, .template-output-actions i { font-size: 18px; }
.template-editor { padding: 32px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); scroll-margin-top: 24px; }
.template-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.template-page h2 { margin: 0; font-size: clamp(23px, 3vw, 34px); letter-spacing: -.04em; line-height: 1.25; }
.template-hero .eyebrow, .template-editor .eyebrow, .template-guide .eyebrow, .template-related .eyebrow, .template-card .eyebrow { color: #a3a3ad; }
.template-guide .section-heading h2, .template-page .faq-section .section-heading h2, .template-related h2, .template-index-note h2 { font-size: clamp(36px, 5vw, 56px); letter-spacing: -.06em; line-height: 1.05; }
.template-presets { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 999px; flex-shrink: 0; }
.template-presets button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; cursor: pointer; }
.template-presets button[aria-pressed="true"] { background: var(--accent); color: #111; }
.template-editor-hint { color: var(--muted); line-height: 1.7; margin: 18px 0 24px; }
.template-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 0 20px; }
.template-toolbar label { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.template-toolbar input { min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--raised); color: var(--text); font: inherit; }
#draftStatus { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0; }
.template-paper { padding: 28px; border-radius: 10px; background: #fff; color: #20202b; color-scheme: light; }
.template-paper-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.template-paper-heading span { font-size: 9px; letter-spacing: .16em; color: #74717e; font-weight: 700; }
.template-paper-heading h2 { font-size: 25px; margin-top: 8px; }
.template-paper-heading p { color: #686570; font-size: 12px; margin: 0; white-space: nowrap; }
.template-grid-scroll { overflow-x: auto; border: 1px solid #ddd9e7; border-radius: 7px; }
.template-table { border-collapse: collapse; width: 100%; min-width: 960px; table-layout: fixed; }
.template-table th, .template-table td { border-right: 1px solid #e5e2ed; border-bottom: 1px solid #e5e2ed; vertical-align: top; padding: 6px; }
.template-table thead th { padding: 14px 6px; font-size: 11px; text-align: center; background: #f5f3fa; color: #51416b; }
.template-table th:first-child { width: 112px; }
.template-table tbody th { background: #faf9fc; }
.template-table tbody tr:last-child td, .template-table tbody tr:last-child th { border-bottom: 0; }
.template-table tr > :last-child { border-right: 0; }
.template-paper textarea { width: 100%; min-height: 90px; display: block; padding: 7px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: #20202b; font: inherit; font-size: 12px; line-height: 1.55; resize: vertical; }
.template-paper textarea::placeholder { color: #96929f; font-size: 11px; }
.template-paper textarea:hover { background: #f8f6fc; }
.template-paper textarea:focus { outline: 2px solid #7760a6; outline-offset: -2px; background: #faf8ff; }
.template-paper textarea.template-row-label { min-height: 90px; font-size: 11px; font-weight: 600; }
.template-extras { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.template-extras label { display: block; font-size: 12px; font-weight: 600; color: #51416b; }
.template-extras textarea { border: 1px solid #e5e2ed; min-height: 108px; margin-top: 9px; font-weight: 400; }
.template-paper-footer { display: flex; justify-content: space-between; margin: 22px 0 0; color: #827d8b; font-size: 9px; }
.template-output-actions { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; margin-top: 28px; }
.template-output-actions button { font-family: inherit; cursor: pointer; border: 0; }
.template-add { background: transparent; }
.template-output-hint { margin: 16px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; max-width: 820px; }
.template-message { color: var(--accent); font-size: 13px; line-height: 1.7; margin: 10px 0 0; }
.template-message:empty { display: none; }
.template-print-copy { display: none; }
.template-scroll-hint { display: none; }
.template-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.template-guide { padding: 88px 0 64px; }
.template-steps { list-style: none; counter-reset: steps; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin: 32px 0 0; }
.template-steps li { counter-increment: steps; border-top: 1px solid var(--line); padding-top: 24px; }
.template-steps li::before { content: '0' counter(steps); color: var(--accent); font-size: 12px; font-weight: 600; }
.template-steps h3 { margin: 20px 0 12px; font-size: 18px; letter-spacing: -.025em; }
.template-steps p, .template-related > p, .template-index-note p { color: var(--muted); line-height: 1.75; }
.template-context { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; padding: 0 0 48px; }
.template-context article { border-top: 1px solid var(--line); padding-top: 24px; }
.template-context h2 { font-size: clamp(23px, 2.5vw, 26px); }
.template-context p { color: var(--muted); line-height: 1.8; margin: 16px 0 0; }
.template-page .faq-section { width: 100%; padding: 64px 0; }
.template-page .faq-section .section-heading { margin-bottom: 32px; }
.template-related { padding: 16px 0 80px; }
.template-related-links { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0; }
.template-related-links a { min-height: 48px; padding: 12px 16px; display: inline-flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; }
.template-related-links a:hover { border-color: var(--accent); }
.template-related-links i:first-child { color: var(--accent); }
.template-related > p a { text-decoration: underline; text-underline-offset: 3px; }
.template-hero--index { padding: 130px 0 100px; }
.template-catalog { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.template-card { min-width: 0; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; display: flex; flex-direction: column; transition: border-color 180ms ease, background-color 180ms ease; }
@media (hover: hover) { .template-card:hover { border-color: #52465f; background: #141019; } }
.template-card-top { display: flex; justify-content: space-between; align-items: center; }
.template-card-top i { font-size: 27px; color: var(--accent); }
.template-card-top span { color: var(--subtle); font-size: 11px; }
.template-card-preview { padding: 14px; margin: 24px 0 28px; border-radius: 6px; background: #f5f3f9; }
.template-mini-head { width: 40%; height: 5px; margin: 0 0 12px; border-radius: 4px; background: #9b8eb3; }
.template-mini-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.template-mini-row span { min-height: 22px; border: 1px solid #e3ddec; }
.template-mini-row .filled { background: #e7dff3; }
.template-card h2 { font-size: 23px; }
.template-card > p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.8; margin: 16px 0 24px; }
.template-card-link { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; }
.template-card-link i { color: var(--accent); }
.template-index-note { padding: 80px 0; max-width: 740px; }
.template-index-note .secondary-link { margin-top: 16px; }
.template-page button:disabled { cursor: default; opacity: .5; }
@media (max-width: 1100px) {
    .template-catalog { grid-template-columns: repeat(2, 1fr); }
    .template-scroll-hint { display: block; margin: 0 0 12px; color: #74717e; font-size: 11px; line-height: 1.6; }
}
@media (max-width: 700px) {
    .template-page { width: calc(100% - 32px); }
    .template-hero { padding: 40px 0; }
    .template-hero h1 { font-size: 38px; }
    .template-intro { font-size: 16px; }
    .template-back { margin-bottom: 30px; }
    .template-editor { padding: 20px 14px; border-radius: 12px; }
    .template-editor-head { align-items: flex-start; flex-direction: column; gap: 20px; }
    .template-toolbar { align-items: flex-start; flex-direction: column; gap: 12px; }
    .template-toolbar label { flex-wrap: wrap; }
    .template-paper { padding: 18px 12px; }
    .template-paper-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
    .template-paper-heading h2 { font-size: 22px; }
    .template-extras { grid-template-columns: 1fr; gap: 18px; }
    .template-output-actions { gap: 16px; }
    .template-output-actions .primary-link { width: 100%; }
    .template-steps { grid-template-columns: 1fr; gap: 24px; }
    .template-context { grid-template-columns: 1fr; gap: 24px; padding-bottom: 32px; }
    .template-guide { padding: 56px 0 32px; }
    .template-catalog { grid-template-columns: 1fr; }
    .template-card { padding: 24px; }
    .template-meta span { padding: 0 5px; }
}
@media (prefers-reduced-motion: reduce) { .template-card { transition: none; } }
@media print {
    @page { size: A4 landscape; margin: 10mm; }
    :root { color-scheme: light; }
    body { background: white; color: #222; padding: 0; }
    body > :not(.template-page), .template-page > :not(.template-editor), .template-editor > :not(.template-paper) { display: none !important; }
    dialog::backdrop, [popover]::backdrop { display: none !important; background: transparent !important; }
    .template-page, .template-editor { width: 100%; margin: 0; padding: 0; border: 0; background: white; }
    .template-paper { padding: 0; border-radius: 0; }
    .template-paper, .template-paper * { color: #111 !important; border-color: #ccc !important; }
    .template-table tbody th { background: #fafafa; }
    .template-paper-heading { flex-direction: row; align-items: flex-end; margin-bottom: 5mm; }
    .template-paper-heading h2 { font-size: 19pt; }
    .template-paper-heading p { font-size: 9pt; }
    .template-grid-scroll { overflow: visible; border-radius: 0; }
    .template-table { min-width: 0; width: 100%; }
    .template-table th:first-child { width: 29mm; }
    .template-table thead th { padding: 3mm 1mm; font-size: 8pt; background: #eee; color: #222; }
    .template-table td, .template-table tbody th { height: 14mm; padding: 2mm 1.5mm; }
    .template-paper textarea, .template-scroll-hint { display: none !important; }
    .template-print-copy { display: block; min-height: 8mm; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 8pt; line-height: 1.4; font-weight: 400; }
    .template-row-label + .template-print-copy { font-weight: 600; }
    .template-extras { display: grid; grid-template-columns: 1fr 1fr; margin-top: 5mm; gap: 5mm; }
    .template-extras label { color: #222; font-size: 9pt; }
    .template-extras .template-print-copy { margin-top: 2mm; min-height: 18mm; padding: 2mm; border: 1px solid #ddd; }
    .template-paper-footer { margin-top: 4mm; font-size: 7pt; }
    .template-table tr, .template-extras label { break-inside: avoid; }
    .template-sr-only { display: none; }
}
