:root {
  color-scheme: light;
  --ink: #1c2833;
  --muted: #667582;
  --line: #dce3e8;
  --paper: #ffffff;
  --canvas: #f3f6f8;
  --navy: #102f45;
  --teal: #087d7f;
  --teal-dark: #056466;
  --accent-soft: #dff4f0;
  font-family: Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink); font-size: 16px; line-height: 1.5; }
button, input, textarea { font: inherit; }
.site-header { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 5vw; background: var(--navy); }
.brand { color: #fff; font-family: Arial, sans-serif; font-size: 1.1rem; font-weight: 800; letter-spacing: .05em; text-decoration: none; }
.brand span { margin-left: .65rem; color: #b9d4dd; font-size: .8rem; font-weight: 500; letter-spacing: .02em; }
.site-account { display: flex; align-items: center; gap: .8rem; color: #dcebf0; font-family: Arial, sans-serif; font-size: .85rem; }
.site-user { max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-form { margin: 0; }
.logout-button { padding: .42rem .68rem; border: 1px solid rgba(255, 255, 255, .45); border-radius: 3px; background: transparent; color: #fff; cursor: pointer; font-family: Arial, sans-serif; font-size: .78rem; font-weight: 700; }
.logout-button:hover, .logout-button:focus-visible { border-color: #fff; background: rgba(255, 255, 255, .1); }
.site-shell { width: min(1160px, calc(100% - 2rem)); margin: 0 auto; padding: 4rem 0; }
.auth-shell { display: grid; min-height: calc(100vh - 70px); place-items: center; padding: 2rem 1rem; }
.auth-card { width: min(100%, 430px); padding: clamp(1.6rem, 5vw, 2.5rem); border: 1px solid var(--line); border-top: 4px solid var(--teal); background: #fff; box-shadow: 0 12px 32px rgba(23, 44, 59, .1); }
.auth-card h1 { font-size: clamp(2rem, 8vw, 2.65rem); }
.auth-help { margin-bottom: 1.6rem; color: var(--muted); font-family: Arial, sans-serif; font-size: .92rem; }
.auth-error { margin-bottom: 1.4rem; padding: .75rem .85rem; border-left: 3px solid #a52a2a; background: #fff3f1; color: #762020; font-family: Arial, sans-serif; font-size: .87rem; }
.auth-submit { width: 100%; min-height: 46px; cursor: pointer; }
.catalog-header { max-width: 680px; margin-bottom: 2.4rem; }
.eyebrow, .card-category, .field-group { margin: 0 0 .35rem; color: var(--teal); font-family: Arial, sans-serif; font-size: .76rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: .7rem; color: var(--navy); font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.1; }
h2 { color: var(--navy); line-height: 1.2; }
.catalog-header > p:last-child { color: var(--muted); font-size: 1.1rem; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 1rem; }
.template-card { display: flex; min-height: 275px; flex-direction: column; padding: 1.7rem; border: 1px solid var(--line); border-top: 4px solid var(--teal); background: var(--paper); box-shadow: 0 8px 22px rgba(23, 44, 59, .06); }
.template-card h2 { font-size: 1.45rem; }
.template-card > p:not(.card-category) { color: var(--muted); }
.card-meta { display: flex; flex-wrap: wrap; gap: .45rem; margin: auto 0 1.4rem; color: var(--muted); font-family: Arial, sans-serif; font-size: .82rem; }
.card-meta span { padding: .25rem .45rem; border-radius: 3px; background: #edf3f5; }
.button { display: inline-block; width: fit-content; padding: .7rem 1rem; border: 0; border-radius: 3px; background: var(--teal); color: #fff; font-family: Arial, sans-serif; font-size: .9rem; font-weight: 700; text-decoration: none; }
.button:hover, .button:focus-visible { background: var(--teal-dark); }
.button.secondary { background: var(--navy); }
.empty-state { padding: 2rem; border: 1px dashed #aab9c2; background: #fff; }
.editor-page .site-shell { width: min(1500px, calc(100% - 2rem)); padding-top: 2rem; }
.editor-topbar { display: flex; justify-content: space-between; gap: 1.5rem; align-items: end; margin-bottom: 1.5rem; }
.editor-topbar h1 { margin-bottom: 0; font-size: clamp(1.7rem, 3vw, 2.5rem); }
.back-link { display: inline-block; margin-bottom: 1.1rem; color: var(--teal-dark); font-family: Arial, sans-serif; font-size: .9rem; font-weight: 700; text-decoration: none; }
.preview-status { padding: .35rem .6rem; background: var(--accent-soft); color: #176564; font-family: Arial, sans-serif; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.editor-layout { display: grid; grid-template-columns: minmax(285px, 360px) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.form-panel { position: sticky; top: 1rem; padding: 1.5rem; border: 1px solid var(--line); background: #fff; box-shadow: 0 8px 22px rgba(23, 44, 59, .05); }
.form-panel h2 { margin-bottom: .35rem; font-size: 1.3rem; }
.form-help { margin-bottom: 1.4rem; color: var(--muted); font-family: Arial, sans-serif; font-size: .87rem; }
.field { margin-bottom: 1.2rem; }
.field-group { margin-bottom: .15rem; font-size: .67rem; }
.field label { display: block; margin-bottom: .35rem; font-family: Arial, sans-serif; font-size: .9rem; font-weight: 700; }
.field input:not([type='checkbox']), .field textarea { width: 100%; padding: .62rem .7rem; border: 1px solid #b7c5ce; border-radius: 3px; background: #fff; color: var(--ink); }
.field textarea { min-height: 112px; resize: vertical; }
.field input:focus, .field textarea:focus { outline: 3px solid rgba(8, 125, 127, .2); border-color: var(--teal); }
.field input[aria-invalid='true'], .field textarea[aria-invalid='true'], .paper [data-editable-block][aria-invalid='true'] { border-color: #a52a2a; outline: 3px solid rgba(165, 42, 42, .14); }
.field small { display: block; margin-top: .3rem; color: var(--muted); font-family: Arial, sans-serif; font-size: .78rem; }
.boolean-field { padding: .75rem; background: #f0f7f7; }
.boolean-field label { margin: 0; cursor: pointer; }
.form-message { margin: 0 0 1.2rem; padding: .7rem .8rem; border-left: 3px solid var(--teal); background: #eef8f6; color: var(--ink); font-family: Arial, sans-serif; font-size: .84rem; }
.form-message[data-type='error'] { border-color: #a52a2a; background: #fff3f1; color: #762020; }
.form-message[hidden] { display: none; }
.download-button { width: 100%; min-height: 46px; margin-top: .35rem; cursor: pointer; }
.download-button:disabled { background: #5d7778; cursor: wait; opacity: .85; }
.generation-note { margin: 1.5rem 0 0; color: var(--muted); font-family: Arial, sans-serif; font-size: .84rem; }
.preview-panel { min-width: 0; overflow: auto; padding: 1rem; background: #e5ecef; }
.paper { width: min(100%, 820px); min-height: 1050px; margin: 0 auto; padding: clamp(2rem, 6vw, 5.8rem); background: #fff; box-shadow: 0 2px 10px rgba(17, 41, 56, .15); color: #181818; font-size: 1rem; line-height: 1.65; }
.paper h2 { margin: 0 0 2rem; color: #111; font-size: 1.15rem; text-align: center; text-transform: uppercase; }
.paper p { margin-bottom: 1rem; text-align: justify; }
.paper .document-meta { margin: 0 0 2.4rem; color: #555; font-family: Arial, sans-serif; font-size: .8rem; text-align: right; }
.paper [data-field] { font-weight: 700; white-space: pre-wrap; }
.paper [data-editable-block] { margin-bottom: .35rem; padding: .65rem .75rem; border: 1px dashed #8aa8aa; border-radius: 3px; background: #fbfefe; white-space: pre-wrap; }
.paper [data-editable-block]:hover { border-color: var(--teal); }
.paper [data-editable-block]:focus { outline: 3px solid rgba(8, 125, 127, .2); border-color: var(--teal); background: #fff; }
.editable-restore { margin: 0 0 1rem auto; padding: .25rem .45rem; border: 0; background: transparent; color: var(--teal-dark); cursor: pointer; font-family: Arial, sans-serif; font-size: .75rem; font-weight: 700; text-decoration: underline; }
.editable-restore[hidden] { display: none; }
.paper .conditional-section { margin: 1.5rem 0; padding: 1rem; border-left: 3px solid var(--teal); background: #f1f8f8; }
.paper .conditional-section[hidden] { display: none; }
@media (max-width: 780px) { .site-header { align-items: flex-start; flex-direction: column; padding-top: .9rem; padding-bottom: .9rem; } .site-account { width: 100%; justify-content: space-between; } .brand span { display: block; margin: .1rem 0 0; } .site-shell { padding: 2.2rem 0; } .editor-layout { grid-template-columns: 1fr; } .form-panel { position: static; } .editor-topbar { align-items: start; flex-direction: column; } .preview-panel { padding: .5rem; } .paper { min-height: 800px; } }
