:root {
    --ink: #18333d;
    --muted: #60757c;
    --paper: #fffdf8;
    --cream: #f4f0e7;
    --teal: #126e72;
    --teal-dark: #0a5054;
    --blue: #daeef3;
    --gold: #f8e7b1;
    --coral: #f7d3c8;
    --line: #d9e1df;
    --white: #fff;
    --shadow: 0 14px 35px rgba(20, 61, 68, .10);
}

* { box-sizing: border-box; }
html { font-size: 17px; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: ui-rounded, "Avenir Next", "Segoe UI", sans-serif; }
button, input, textarea { font: inherit; }
button { color: inherit; }

.topbar { height: 82px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(24px, calc((100vw - 1120px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255, 253, 248, .96); }
.brand { display: flex; gap: 12px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 13px; background: var(--teal); color: white; font: 800 24px/1 Georgia, serif; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.2rem; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: .74rem; }
.plain-button, .back-button { border: 0; background: transparent; color: var(--teal-dark); font-weight: 750; cursor: pointer; }
.top-actions { display: flex; gap: 8px; }

main { min-height: calc(100vh - 82px); }
.hero, .workspace { width: min(100% - 36px, 1040px); margin: 0 auto; }
.hero { padding: 66px 0 72px; text-align: center; }
.eyebrow, .step-label { margin: 0 0 12px; color: var(--teal); font-size: .75rem; font-weight: 850; letter-spacing: .14em; }
h1 { margin: 0; font: 700 clamp(2.3rem, 6vw, 4.3rem)/1.02 Georgia, serif; letter-spacing: -.045em; }
.hero-copy { max-width: 620px; margin: 18px auto 38px; color: var(--muted); font-size: 1.08rem; }
.action-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.action-card { min-height: 160px; padding: 22px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; text-align: left; background: white; border: 2px solid transparent; border-radius: 22px; box-shadow: var(--shadow); cursor: pointer; transition: transform .15s, border-color .15s; }
.action-card.featured { grid-column: 1 / -1; min-height: 128px; border-color: rgba(18, 110, 114, .18); background: linear-gradient(110deg, #f0faf6, #fff); }
.action-card:hover, .action-card:focus-visible { transform: translateY(-3px); border-color: var(--teal); outline: none; }
.action-card strong, .action-card small { display: block; }
.action-card strong { font-size: 1.05rem; }
.action-card small { margin-top: 7px; color: var(--muted); line-height: 1.35; }
.action-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; font-weight: 850; }
.action-icon.blue { background: var(--blue); }
.action-icon.gold { background: var(--gold); }
.action-icon.coral { background: var(--coral); }
.action-icon.mint { background: #d8efe4; }
.action-icon.violet { color: #55348d; background: #ece3ff; }
.wizard-card { background: linear-gradient(135deg, #fff, #f8f3ff); border-color: rgba(85, 52, 141, .14); }
.editor-card { background: linear-gradient(135deg, #fff, #f1fbf8); border-color: rgba(18, 110, 114, .14); }
.arrow { color: var(--teal); font-size: 1.35rem; }
.stats { margin: 32px auto 0; display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 8px 26px; color: var(--muted); font-size: .9rem; }
.stats strong { color: var(--ink); }
.status-dot { width: 8px; height: 8px; display: inline-block; margin-right: 6px; border-radius: 50%; background: #48a86d; }

.workspace { padding: 42px 0 80px; }
.workspace-head { display: grid; grid-template-columns: 110px 1fr; align-items: start; margin-bottom: 28px; }
.workspace-head h2 { margin: 0; font: 700 clamp(2rem, 4vw, 3rem)/1.1 Georgia, serif; }
.workspace-head p:last-child { color: var(--muted); }
.view-panel { margin-left: 110px; }
.search-box span, .update-form label > span { display: block; margin-bottom: 8px; font-weight: 800; }
.search-box input, .text-input, textarea { width: 100%; border: 2px solid var(--line); border-radius: 16px; background: white; color: var(--ink); }
.search-box input { height: 58px; padding: 0 18px; font-size: 1.05rem; }
.text-input { height: 54px; padding: 0 15px; }
.search-box input:focus, textarea:focus { border-color: var(--teal); outline: 3px solid rgba(18, 110, 114, .12); }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0; }
.filter-button { padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: white; cursor: pointer; }
.filter-button.active { color: white; background: var(--teal); border-color: var(--teal); }
.result-count { color: var(--muted); font-size: .9rem; }
.card-list { display: grid; gap: 10px; }
.list-card { width: 100%; padding: 18px 20px; display: grid; grid-template-columns: 1fr auto; gap: 14px; text-align: left; border: 1px solid var(--line); border-radius: 16px; background: white; cursor: pointer; }
.list-card:hover { border-color: var(--teal); }
.list-card strong, .list-card small { display: block; }
.list-card small { margin-top: 5px; color: var(--muted); }
.badge { align-self: center; padding: 5px 9px; border-radius: 999px; background: var(--cream); color: var(--muted); font-size: .75rem; }
.empty { padding: 36px; border: 1px dashed var(--line); border-radius: 16px; text-align: center; color: var(--muted); }

.safety-note { margin-bottom: 22px; padding: 16px 18px; display: flex; gap: 12px; border-radius: 14px; background: #e8f4ed; }
.safety-note strong { color: #266842; }
.update-form { display: grid; gap: 20px; }
textarea { min-height: 118px; padding: 14px; resize: vertical; }
.primary-button { min-height: 54px; padding: 0 20px; border: 0; border-radius: 14px; color: white; background: var(--teal); font-weight: 850; cursor: pointer; }
.primary-button:hover { background: var(--teal-dark); }
.file-input { width: 100%; padding: 18px; border: 2px dashed var(--line); border-radius: 16px; background: white; }
.mapping-grid { display: grid; gap: 12px; margin: 18px 0; }
.mapping-row { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; align-items: center; }
.mapping-row select { width: 100%; min-height: 46px; padding: 0 10px; border: 2px solid var(--line); border-radius: 12px; background: white; }
code { padding: 2px 5px; border-radius: 5px; background: rgba(255,255,255,.7); }

.intake-progress { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 28px; }
.intake-progress button { display: flex; align-items: center; gap: 8px; padding: 10px; border: 0; border-bottom: 3px solid var(--line); color: var(--muted); background: transparent; cursor: pointer; }
.intake-progress button.active { color: var(--teal-dark); border-color: var(--teal); }
.intake-progress b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--cream); }
.intake-progress button.active b { color: white; background: var(--teal); }
.section-intro { margin-bottom: 24px; }
.section-intro h3 { margin: 0; font: 700 1.65rem/1.2 Georgia, serif; }
.section-intro p { margin: 7px 0 0; color: var(--muted); }
.form-grid, .role-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid label, .role-grid label { display: block; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid span, .role-grid span { display: block; margin-bottom: 7px; font-weight: 750; }
.form-grid input, .form-grid select, .role-grid input { width: 100%; height: 50px; padding: 0 13px; border: 2px solid var(--line); border-radius: 12px; color: var(--ink); background: white; }
.form-grid input:focus, .form-grid select:focus, .role-grid input:focus { border-color: var(--teal); outline: 3px solid rgba(18,110,114,.10); }
.repeat-head { display: flex; align-items: center; justify-content: space-between; margin-top: 28px; }
.small-button, .secondary-button { padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: white; font-weight: 750; cursor: pointer; }
.repeat-list { display: grid; gap: 10px; }
.child-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr auto; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.child-row input, .child-row select { min-width: 0; height: 44px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; }
.remove-child { width: 42px; border: 0; border-radius: 10px; color: #8b3b35; background: var(--coral); cursor: pointer; }
.document-picker { display: grid; gap: 10px; margin-top: 16px; max-height: 480px; overflow: auto; }
.document-choice { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.document-choice input { width: 22px; height: 22px; accent-color: var(--teal); }
.document-choice strong, .document-choice small { display: block; }
.document-choice small { margin-top: 4px; color: var(--muted); }
.coverage { min-width: 84px; text-align: right; color: var(--teal-dark); font-size: .78rem; font-weight: 800; }
.coverage-bar { width: 84px; height: 6px; margin-top: 5px; overflow: hidden; border-radius: 99px; background: var(--line); }
.coverage-bar i { display: block; height: 100%; background: var(--teal); }
.intake-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 26px; }
.intake-actions .primary-button { margin-left: auto; }
.form-message { min-height: 24px; color: var(--teal-dark); font-weight: 700; }
.preview-box { margin-top: 24px; padding: 22px; border: 2px solid var(--teal); border-radius: 18px; background: white; }
.preview-box h3 { margin-top: 0; }
.preview-box ul { padding-left: 20px; }
.preview-approval { display: grid; gap: 12px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.preview-approval label span { display: block; margin-bottom: 7px; font-weight: 800; }
.change-documents-button { margin: 14px 0 2px; }
.wide-dialog { width: min(92vw, 760px); }
.dialog-document-picker { max-height: 52vh; margin-bottom: 12px; }

.editor-intro { display: flex; gap: 18px; align-items: center; margin-bottom: 22px; padding: 22px; border-radius: 22px; background: linear-gradient(135deg, #e9f8f3, #f5efff 70%, #fff8e4); }
.editor-intro h3 { margin: 0; font: 700 1.75rem/1.2 Georgia, serif; }
.editor-intro p:last-child { margin: 7px 0 0; color: var(--muted); }
.editor-layout { display: grid; grid-template-columns: minmax(270px, .8fr) minmax(0, 1.35fr); gap: 18px; align-items: start; }
.editor-browser, .editor-workbench { border: 1px solid var(--line); border-radius: 20px; background: white; box-shadow: 0 8px 24px rgba(20, 61, 68, .06); }
.editor-browser { position: sticky; top: 18px; padding: 18px; }
.editor-browser .search-box input { height: 50px; font-size: .94rem; }
.editor-filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 10px; }
.editor-filters .filter-button { padding: 7px 10px; font-size: .76rem; }
.editor-template-list { display: grid; gap: 7px; max-height: 650px; overflow: auto; padding-right: 3px; }
.editor-template { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #fff; text-align: left; cursor: pointer; }
.editor-template:hover, .editor-template.active { border-color: var(--teal); background: #f2fbf8; }
.editor-template strong, .editor-template small { display: block; }
.editor-template strong { font-size: .88rem; line-height: 1.25; }
.editor-template small { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.editor-chevron { color: var(--teal); font-size: 1.4rem; }
.editor-workbench { min-height: 430px; padding: 24px; }
.editor-empty { min-height: 380px; display: grid; place-content: center; gap: 8px; }
.editor-empty strong, .editor-empty span, .editor-loading { display: block; }
.editor-loading { padding: 24px; color: var(--muted); text-align: center; }
.editor-selection-head { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.editor-selection-head h3 { margin: 0; font: 700 1.8rem/1.15 Georgia, serif; }
.editor-selection-head p:last-child { margin: 6px 0 0; color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.impact-bubble { width: 102px; min-height: 102px; display: grid; place-content: center; text-align: center; border-radius: 50%; color: white; background: linear-gradient(145deg, var(--teal), #7f62b5); }
.impact-bubble strong, .impact-bubble small { display: block; }
.impact-bubble strong { font-size: 1.65rem; }
.impact-bubble small { max-width: 80px; font-size: .62rem; line-height: 1.2; }
.impact-card { margin: 20px 0; padding: 16px; border-radius: 15px; background: #edf8f3; }
.impact-card.single { background: #f5f1fb; }
.impact-card > p { margin-bottom: 0; }
.impact-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.impact-chips span { padding: 6px 9px; border-radius: 999px; background: white; color: #285b4b; font-size: .72rem; font-weight: 750; }
.editor-steps { display: grid; gap: 12px; }
.editor-step { display: grid; grid-template-columns: 42px 1fr; gap: 12px; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.editor-step-number { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: white; background: var(--teal); font-weight: 900; }
.editor-step h4 { margin: 2px 0 5px; font-size: 1rem; }
.editor-step p { margin: 0 0 13px; color: var(--muted); line-height: 1.45; }
.editor-download { display: inline-flex; align-items: center; text-decoration: none; }
.editor-rule { display: grid; gap: 3px; padding: 12px; border-radius: 12px; background: #fff5d7; }
.editor-rule span { color: #6f6035; font-size: .78rem; }
.editor-publish-form { display: grid; gap: 13px; }
.editor-publish-form label > span { display: block; margin-bottom: 7px; font-weight: 800; }
.editor-publish-form label small { color: var(--muted); font-weight: 500; }
.editor-safety { display: flex; gap: 10px; margin-top: 16px; padding: 13px; border-radius: 13px; color: #315d4a; background: #e8f4ed; font-size: .82rem; }
.recipe-explainer { display: grid; grid-template-columns: 42px 1fr; gap: 12px; margin: 20px 0; padding: 17px; border-radius: 16px; color: #315d4a; background: #e8f4ed; }
.recipe-explainer > span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: #fff; }
.recipe-explainer strong, .recipe-explainer p { display: block; }
.recipe-explainer p { margin: 5px 0 0; line-height: 1.45; }
.section-picker { display: grid; gap: 9px; }
.section-picker > .eyebrow { margin-bottom: 2px; }
.section-choice { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-align: left; cursor: pointer; }
.section-choice:hover, .section-choice:focus-visible { border-color: var(--teal); background: #f2fbf8; transform: translateY(-1px); }
.section-choice strong, .section-choice small { display: block; }
.section-choice strong { font-size: .96rem; }
.section-choice small { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.publish-success { color: #207041; font-weight: 900; }

.wizard-hero { display: flex; gap: 18px; align-items: center; padding: 24px; margin-bottom: 18px; border-radius: 22px; background: linear-gradient(135deg, #e6f5ef, #f4edff 72%, #fff4d6); }
.wizard-hero h3, .wizard-topline h3, #wizardFinish h3 { margin: 0; font: 700 1.8rem/1.2 Georgia, serif; }
.wizard-hero p:last-child, .wizard-topline p:last-child, #wizardFinish > p { margin: 7px 0 0; color: var(--muted); }
.wizard-spark { flex: 0 0 auto; width: 66px; height: 66px; display: grid; place-items: center; border-radius: 22px; color: white; background: linear-gradient(145deg, var(--teal), #7f62b5); font-size: 2rem; box-shadow: 0 12px 28px rgba(74, 71, 139, .22); }
.client-file-list { display: grid; gap: 12px; }
.client-file-card { width: 100%; display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 18px 20px; border: 1px solid var(--line); border-radius: 17px; background: white; text-align: left; cursor: pointer; }
.client-file-card:hover { border-color: #7f62b5; box-shadow: var(--shadow); }
.client-file-card strong, .client-file-card small { display: block; }
.client-file-card small { margin-top: 5px; color: var(--muted); }
.wizard-topline { display: grid; grid-template-columns: 1fr auto; gap: 18px; align-items: center; }
.wizard-score { width: 94px; height: 94px; display: grid; place-content: center; text-align: center; border-radius: 50%; color: white; background: conic-gradient(#7f62b5, var(--teal)); box-shadow: 0 12px 28px rgba(18, 110, 114, .18); }
.wizard-score strong, .wizard-score span { display: block; }
.wizard-score strong { font-size: 1.35rem; }
.wizard-score span { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; }
.wizard-progress { display: flex; gap: 8px; margin: 24px 0; overflow-x: auto; padding-bottom: 4px; }
.wizard-progress span { flex: 1 0 38px; height: 8px; border-radius: 99px; background: var(--line); }
.wizard-progress span.done { background: var(--teal); }
.wizard-progress span.current { background: #7f62b5; box-shadow: 0 0 0 4px rgba(127, 98, 181, .12); }
.wizard-question-form { display: grid; gap: 13px; }
.reuse-summary { padding: 14px 16px; border-radius: 14px; color: #315d4a; background: #e8f4ed; }
.reuse-summary strong { display: block; }
.question-card { display: grid; grid-template-columns: 38px 1fr; gap: 13px; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.question-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; color: #55348d; background: #ece3ff; font-size: .78rem; font-weight: 850; }
.question-card label > span { display: block; margin-bottom: 5px; font-weight: 800; }
.question-card small { display: block; margin-bottom: 9px; color: var(--muted); }
.question-card input, .question-card select, .question-card textarea { width: 100%; min-height: 48px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.question-card input:focus, .question-card select:focus, .question-card textarea:focus { border-color: #7f62b5; outline: 3px solid rgba(127, 98, 181, .11); }
.question-card.reused { border-color: #b9dcc9; background: #fbfffc; }
.reused-tag { display: inline-block; margin-left: 7px; padding: 3px 7px; border-radius: 99px; color: #266842; background: #dff1e7; font-size: .66rem; vertical-align: middle; }
.wizard-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; }
#wizardFinish { padding: 34px; text-align: center; border-radius: 24px; background: linear-gradient(145deg, #effaf5, #fff, #f7f0ff); box-shadow: var(--shadow); }
.finish-burst { width: 82px; height: 82px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 50%; color: white; background: linear-gradient(145deg, var(--teal), #7f62b5); font-size: 2.4rem; }
#generateDocuments { margin-top: 22px; }
.generated-list { display: grid; gap: 10px; margin-top: 22px; text-align: left; }
.generated-file { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.generated-file strong, .generated-file small { display: block; }
.generated-file small { margin-top: 4px; color: var(--muted); }
.save-all-panel { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px 18px; align-items: center; margin: 26px 0 18px; padding: 22px; border: 2px solid rgba(18, 121, 123, .28); border-radius: 22px; background: linear-gradient(135deg, #effbf8, #f8f5ff); text-align: left; box-shadow: 0 14px 32px rgba(12, 52, 63, .08); }
.save-all-panel[hidden] { display: none; }
.save-all-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 17px; color: #fff; background: linear-gradient(135deg, #117b7d, #6755b5); font-size: 30px; font-weight: 900; }
.save-all-copy { display: grid; gap: 4px; }
.save-all-copy strong { color: var(--ink); font-size: 1.13rem; }
.save-all-copy span { color: var(--muted); line-height: 1.45; }
.save-folder-button { grid-column: 3; grid-row: 1 / span 2; }
.zip-download-button { grid-column: 2; width: max-content; padding: 10px 16px; font-size: .9rem; }
.save-all-message { grid-column: 1 / -1; margin: 0; text-align: center; }
.download-button { padding: 9px 12px; border-radius: 10px; color: white; background: var(--teal); text-decoration: none; font-weight: 800; }

dialog { width: min(92vw, 680px); max-height: 85vh; padding: 34px; border: 0; border-radius: 22px; box-shadow: 0 26px 80px rgba(9, 46, 51, .3); color: var(--ink); }
dialog::backdrop { background: rgba(15, 40, 45, .55); }
.dialog-close { float: right; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--cream); font-size: 1.5rem; cursor: pointer; }
.password-show-row { display: flex !important; align-items: center; gap: 9px; font-weight: 750; }
.password-show-row input { width: 19px; height: 19px; accent-color: var(--teal); }
.password-rules { display: grid; gap: 5px; padding: 15px 17px; border-radius: 15px; background: #eef8f4; color: var(--teal-dark); }
.password-rules span::before { content: "✓ "; font-weight: 900; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.detail-list { max-height: 300px; overflow: auto; padding-left: 22px; }
.help-steps { display: grid; gap: 16px; padding-left: 24px; }
.muted { color: var(--muted); }
.qa-card { background: linear-gradient(145deg, #f0fbff, #f7f4ff); border-color: #cfe2ee; }
.qa-intro { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; margin-bottom: 24px; padding: 24px; border-radius: 22px; background: linear-gradient(135deg, #eaf9f6, #f7f3ff); }
.qa-intro h3, .qa-intro p { margin: 0; }
.qa-intro .eyebrow { margin-bottom: 5px; }
.qa-shield { display: grid; place-items: center; width: 70px; height: 70px; border-radius: 24px; color: #fff; background: linear-gradient(145deg, var(--teal), #735bb5); font-size: 2rem; font-weight: 900; box-shadow: 0 12px 28px rgba(24, 94, 99, .2); }
.qa-steps { display: grid; gap: 14px; }
.qa-step-card { display: grid; grid-template-columns: auto 1fr; gap: 16px; padding: 22px; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.qa-step-card.featured { border: 2px solid rgba(18, 121, 123, .35); background: #fbfffe; }
.qa-step-card h4, .qa-step-card p { margin-top: 0; }
.qa-step-number { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: #fff; background: var(--teal); font-size: 1.15rem; font-weight: 900; }
.qa-file-picker { display: block; margin-bottom: 12px; padding: 14px; border: 2px dashed #bad4d5; border-radius: 14px; background: #f8fcfc; }
.qa-step-card > div > .secondary-button + form { margin-top: 14px; }
.qa-file-picker span { display: block; margin-bottom: 8px; font-weight: 800; }
.qa-run-button { min-width: 230px; }
.qa-approval-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.qa-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 24px 0 16px; }
.qa-summary:empty { display: none; }
.qa-summary > div { display: grid; gap: 2px; padding: 16px; border-radius: 16px; background: #eef4f5; text-align: center; }
.qa-summary strong { font-size: 1.65rem; }
.qa-summary span { color: var(--muted); font-size: .82rem; font-weight: 800; }
.qa-summary .qa-pass { background: #e5f6eb; color: #21673c; }
.qa-summary .qa-warning { background: #fff5d8; color: #805d00; }
.qa-summary .qa-fail { background: #ffe7e4; color: #8a3026; }
.qa-summary .qa-approved { grid-column: 1 / -1; grid-template-columns: auto 1fr; align-items: center; background: linear-gradient(135deg, #def5e6, #edf8ff); }
.qa-results { display: grid; gap: 10px; }
.qa-result { border: 1px solid var(--line); border-radius: 15px; background: #fff; overflow: hidden; }
.qa-result summary { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; cursor: pointer; list-style: none; }
.qa-result summary::-webkit-details-marker { display: none; }
.qa-result summary strong, .qa-result summary small { display: block; }
.qa-result summary small { margin-top: 3px; color: var(--muted); }
.qa-result summary > b { text-transform: uppercase; font-size: .75rem; }
.qa-result-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; background: #68828a; font-weight: 900; }
.qa-result.pass .qa-result-icon { background: #2c8a50; }
.qa-result.warning .qa-result-icon { background: #c08a17; }
.qa-result.fail .qa-result-icon { background: #c54b3e; }
.qa-result-body { padding: 0 18px 16px 64px; }
.qa-result-body ul { margin: 4px 0 12px; padding-left: 20px; }
.qa-checks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.qa-checks span { padding: 6px 9px; border-radius: 99px; font-size: .8rem; font-weight: 800; }
.qa-checks .ok { color: #21673c; background: #e5f6eb; }
.qa-checks .bad { color: #8a3026; background: #ffe7e4; }

/* AI Template Builder */
.ai-builder-hero { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; margin-bottom: 16px; padding: 25px; border-radius: 24px; background: linear-gradient(135deg, #e6f8f4 0%, #f2efff 60%, #fff8e8 100%); box-shadow: 0 16px 38px rgba(22, 60, 72, .08); }
.ai-builder-hero h3, .ai-builder-hero p { margin: 0; }
.ai-builder-hero h3 { margin-bottom: 7px; font-family: Georgia, serif; font-size: clamp(1.5rem, 3vw, 2.25rem); color: var(--ink); }
.ai-builder-spark { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 20px; color: white; background: linear-gradient(135deg, var(--teal), #7561bf); font-size: 1.8rem; box-shadow: 0 10px 24px rgba(72, 77, 158, .25); }
.ai-connection-pill { max-width: 220px; padding: 9px 12px; border-radius: 999px; color: #765d14; background: #fff3c9; text-align: center; font-size: .72rem; font-weight: 900; }
.ai-connection-pill.connected { color: #17623a; background: #ddf5e6; }
.ai-safety-strip { display: flex; gap: 10px; margin-bottom: 18px; padding: 15px 18px; border: 1px solid #b7ddd4; border-radius: 15px; color: #285d51; background: #f3fbf9; }
.ai-builder-progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 22px 0; }
.ai-builder-progress span { display: flex; gap: 8px; align-items: center; justify-content: center; min-height: 44px; padding: 8px; border-radius: 13px; color: var(--muted); background: #edf1f2; font-size: .8rem; font-weight: 900; }
.ai-builder-progress b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; background: #91a2a7; }
.ai-builder-progress .active { color: #fff; background: linear-gradient(135deg, var(--teal), #376f91); }
.ai-builder-progress .active b { color: var(--teal); background: #fff; }
.ai-builder-progress .done { color: #296843; background: #dff3e6; }
.ai-builder-progress .done b { background: #318553; }
.ai-template-form { display: grid; gap: 16px; }
.ai-template-form[hidden],
.ai-analysis-stage[hidden],
.ai-review-stage[hidden] { display: none !important; }
.ai-builder-card { display: grid; grid-template-columns: 48px 1fr; gap: 17px; padding: 22px; border: 1px solid var(--line); border-radius: 21px; background: #fff; box-shadow: 0 10px 25px rgba(22, 60, 72, .06); }
.ai-builder-card h4, .ai-builder-card p { margin-top: 0; }
.ai-builder-card h4 { margin-bottom: 5px; font-size: 1.16rem; }
.ai-card-number { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; color: #fff; background: var(--teal); font-size: 1.15rem; font-weight: 900; }
.ai-drop-zone { display: grid; gap: 4px; place-items: center; min-height: 130px; padding: 22px; border: 2px dashed #9cc8c4; border-radius: 18px; background: #f5fcfa; text-align: center; cursor: pointer; }
.ai-drop-zone input { width: 100%; max-width: 430px; }
.ai-drop-zone strong { color: var(--teal); }
.ai-drop-zone span { color: var(--muted); font-size: .82rem; }
.ai-file-list { display: grid; gap: 8px; margin-top: 12px; }
.ai-file-list > span { color: var(--muted); font-size: .86rem; }
.ai-file-row { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.ai-file-row strong, .ai-file-row small { display: block; }
.ai-file-row small { margin-top: 3px; color: var(--muted); }
.ai-file-row em { padding: 5px 8px; border-radius: 8px; color: #446873; background: #eaf1f3; font-size: .7rem; font-style: normal; font-weight: 900; }
.ai-analyze-button { width: 100%; margin-top: 12px; font-size: 1rem; }
.ai-analysis-stage { padding: 55px 24px; border-radius: 24px; background: linear-gradient(150deg, #edf9f7, #f7f3ff); text-align: center; }
.ai-thinking-orb { display: grid; place-items: center; width: 82px; height: 82px; margin: 0 auto 18px; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--teal), #7561bf); font-size: 2rem; animation: aiPulse 1.6s ease-in-out infinite; }
.ai-thinking-bar { max-width: 480px; height: 9px; margin: 22px auto 0; border-radius: 99px; background: #d9e5e6; overflow: hidden; }
.ai-thinking-bar span { display: block; width: 42%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #7561bf); animation: aiScan 1.4s ease-in-out infinite; }
@keyframes aiPulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 14px rgba(80, 101, 173, .08); } }
@keyframes aiScan { 50% { transform: translateX(138%); } }
.ai-review-stage { display: grid; gap: 18px; }
.ai-review-summary-actions { display: grid; gap: 10px; min-width: 230px; }
.ai-review-summary-actions small { color: var(--muted); text-align: center; }
.ai-review-head { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; padding: 23px; border-radius: 21px; background: linear-gradient(135deg, #edf9f7, #f5f2ff); }
.ai-review-head h3, .ai-review-head p { margin-top: 0; }
.ai-review-score { display: grid; place-items: center; min-width: 125px; min-height: 95px; padding: 14px; border-radius: 18px; color: #fff; background: var(--teal); text-align: center; }
.ai-review-score strong, .ai-review-score span { display: block; }
.ai-review-score strong { font-size: 1.35rem; }
.ai-review-score span { font-size: .72rem; font-weight: 800; }
.ai-warning-box { display: grid; gap: 5px; padding: 16px 18px; border-left: 5px solid #d4971e; border-radius: 13px; color: #735417; background: #fff6dc; }
.ai-review-group { padding: 20px; border: 1px solid var(--line); border-radius: 21px; background: #f9fbfb; }
.ai-review-group-head { display: flex; gap: 18px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.ai-review-group-head > div { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: center; }
.ai-review-group-head h4, .ai-review-group-head p { margin: 0; }
.ai-review-group-head p { grid-column: 2; color: var(--muted); font-size: .84rem; }
.ai-review-icon { grid-row: 1 / 3; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: #fff; background: #5b6f9e; font-weight: 900; }
.ai-review-list { display: grid; gap: 12px; }
.ai-review-item { display: grid; gap: 11px; padding: 17px; border: 2px solid transparent; border-radius: 16px; background: #fff; box-shadow: 0 5px 14px rgba(22, 60, 72, .05); }
.ai-review-item[data-decision="approved"] { border-color: #72bd8b; background: #f6fcf8; }
.ai-review-item[data-decision="rejected"] { opacity: .65; border-color: #c8cfd1; background: #f2f4f4; }
.ai-review-item-top { display: flex; gap: 14px; justify-content: space-between; align-items: center; }
.ai-review-item-top .badge { margin-left: 8px; }
.ai-review-item label { display: grid; gap: 5px; }
.ai-review-item label > span { color: #48616a; font-size: .76rem; font-weight: 900; }
.ai-review-item input, .ai-review-item select, .ai-review-item textarea, .ai-decision { width: 100%; padding: 10px 11px; border: 1px solid #bdced2; border-radius: 10px; background: #fff; font: inherit; }
.ai-review-item .ai-decision { width: auto; min-width: 145px; font-weight: 900; }
.ai-reason { margin: 0; padding: 10px 12px; border-radius: 10px; color: #526970; background: #f0f5f6; font-size: .82rem; }
.ai-publish-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, .55fr); gap: 16px 24px; align-items: end; padding: 24px; border: 2px solid #8ccbc0; border-radius: 22px; background: linear-gradient(135deg, #effbf8, #f8f5ff); }
.ai-publish-panel h4, .ai-publish-panel p { margin-top: 0; }
.ai-preview-actions { display: grid; gap: 9px; padding: 15px; border: 1px solid #b8d8d2; border-radius: 15px; background: rgba(255,255,255,.72); }
.ai-preview-actions .primary-button, .ai-preview-actions .secondary-button { width: 100%; text-align: center; }
.ai-preview-status { color: var(--muted); font-size: .78rem; font-weight: 800; text-align: center; }
.ai-publish-actions { display: flex; gap: 10px; grid-column: 1 / -1; justify-content: flex-end; }
.ai-publish-panel .form-message { grid-column: 1 / -1; margin: 0; }
.ai-published-card { padding: 45px 25px; border-radius: 24px; background: linear-gradient(135deg, #e5f7ec, #eef6ff); text-align: center; }
.ai-published-card > span { display: grid; place-items: center; width: 78px; height: 78px; margin: 0 auto 18px; border-radius: 50%; color: #fff; background: #318553; font-size: 2rem; font-weight: 900; }
.ai-published-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 22px; }
.editor-ai-change-card { display: grid; gap: 16px; margin: 18px 0; padding: 22px; border: 2px solid #91cfc3; border-radius: 21px; background: linear-gradient(135deg, #edf9f7, #f6f2ff); }
.editor-ai-change-head { display: grid; grid-template-columns: auto 1fr; gap: 15px; align-items: start; }
.editor-ai-change-head > span { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; color: #fff; background: linear-gradient(135deg, var(--teal), #7561bf); font-size: 1.3rem; }
.editor-ai-change-head h4, .editor-ai-change-head p { margin-top: 0; }
.editor-ai-change-head h4 { margin-bottom: 5px; font-size: 1.2rem; }
.editor-ai-change-card form { display: grid; gap: 12px; }
.editor-ai-change-card label { display: grid; gap: 6px; font-weight: 800; }
.editor-ai-change-card textarea { width: 100%; padding: 13px; border: 1px solid #aac9c6; border-radius: 13px; background: #fff; font: inherit; line-height: 1.5; resize: vertical; }
.editor-ai-change-card .primary-button { width: 100%; }

@media (max-width: 780px) {
    .qa-summary { grid-template-columns: repeat(2, 1fr); }
    .qa-approval-row { grid-template-columns: 1fr; }
    .save-all-panel { grid-template-columns: auto 1fr; }
    .save-folder-button, .zip-download-button { grid-column: 1 / -1; grid-row: auto; width: 100%; text-align: center; }
    .action-grid { grid-template-columns: 1fr; }
    .action-card { min-height: 120px; }
    .workspace-head { grid-template-columns: 1fr; gap: 18px; }
    .view-panel { margin-left: 0; }
    .child-row { grid-template-columns: 1fr; }
    .remove-child { width: 100%; height: 40px; }
    .editor-layout { grid-template-columns: 1fr; }
    .editor-browser { position: static; }
    .editor-template-list { max-height: 350px; }
    .ai-builder-hero { grid-template-columns: auto 1fr; }
    .ai-connection-pill { grid-column: 1 / -1; max-width: none; }
    .ai-builder-progress { grid-template-columns: 1fr; }
    .ai-builder-progress span { justify-content: flex-start; }
    .ai-review-head, .ai-publish-panel { grid-template-columns: 1fr; }
    .ai-review-group-head { align-items: flex-start; flex-direction: column; }
    .ai-publish-actions { grid-column: auto; flex-direction: column; }
}

@media (max-width: 480px) {
    .qa-intro, .qa-step-card { grid-template-columns: 1fr; }
    .qa-result-body { padding-left: 16px; }
    html { font-size: 16px; }
    .topbar { height: 72px; padding: 0 16px; }
    .brand small { display: none; }
    .hero { padding-top: 42px; }
    .action-card { padding: 16px; }
    .stats { display: grid; }
    dialog { padding: 24px; }
    .form-grid, .role-grid { grid-template-columns: 1fr; }
    .form-grid .wide { grid-column: auto; }
    .intake-progress button { justify-content: center; }
    .intake-progress span { display: none; }
    .document-choice { grid-template-columns: auto 1fr; }
    .coverage { grid-column: 2; text-align: left; }
    .wizard-topline { grid-template-columns: 1fr; }
    .wizard-score { width: 76px; height: 76px; }
    .question-card { grid-template-columns: 1fr; }
    .question-number { display: none; }
    .wizard-actions { flex-direction: column; }
    .wizard-actions button { width: 100%; }
    .generated-file { grid-template-columns: 1fr; }
    .editor-intro { align-items: flex-start; }
    .editor-selection-head { grid-template-columns: 1fr; }
    .impact-bubble { width: 84px; min-height: 84px; }
    .editor-step { grid-template-columns: 1fr; }
    .editor-safety { display: grid; }
    .ai-builder-card { grid-template-columns: 1fr; }
    .ai-file-row, .ai-review-item-top { align-items: flex-start; }
    .ai-review-item-top { flex-direction: column; }
    .ai-review-item .ai-decision { width: 100%; }
}

