@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;600;700;800&display=swap');
:root{--red:#b51f2a;--red-dark:#941923;--red-soft:#fff2f2;--ink:#262626;--muted:#727272;--line:#e7e2e2;--paper:#fff}*{box-sizing:border-box}html{scroll-behavior:smooth}body{margin:0;color:var(--ink);background:#fff;font:14px 'Roboto',sans-serif}a{color:inherit;text-decoration:none}.topbar{height:68px;padding:0 max(calc((100vw - 1240px)/2),4%);display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line);background:#fff}.brand{display:flex;align-items:center;gap:10px}.brand-mark{display:grid;place-items:center;width:38px;height:38px;background:var(--red);color:white;border-radius:7px;font:800 14px Roboto}.brand b,.brand small{display:block}.brand b{font:800 13px Roboto;letter-spacing:1px}.brand small{font-size:9px;letter-spacing:.8px;color:#888;margin-top:3px}.topbar nav{display:flex;gap:28px;color:#555;font-size:12px}.top-cta{font-weight:700;color:var(--red);font-size:12px}.intro{max-width:1240px;margin:auto;padding:52px 22px 48px;display:grid;grid-template-columns:1.3fr .7fr;align-items:center;gap:60px}.eyebrow{font-size:10px;letter-spacing:1.3px;color:var(--red);font-weight:800}.intro h1{font:800 clamp(36px,4.3vw,52px)/1.12 Roboto;letter-spacing:-2px;margin:14px 0}.intro h1 em{font-style:normal;color:var(--red)}.intro p{max-width:620px;color:#666;line-height:1.8;font-size:14px;margin:0 0 22px}.button{border:0;border-radius:6px;padding:12px 17px;display:inline-flex;align-items:center;justify-content:center;gap:12px;font:700 12px 'Roboto';cursor:pointer}.primary{background:var(--red);color:white}.primary:hover{background:var(--red-dark)}.secondary{background:#f3eeee;color:#5a3434}.quick-facts{border:1px solid #eadede;border-left:4px solid var(--red);padding:22px 24px;border-radius:7px;background:#fffdfd}.quick-facts b,.quick-facts span{display:block}.quick-facts b{font-size:13px}.quick-facts span{font-size:11px;color:#777;line-height:1.7;margin-top:5px}.quick-facts hr{border:0;border-top:1px solid var(--line);margin:15px 0}.editor-section,.template-section{max-width:1440px;margin:auto;padding:22px 22px 55px}.section-title{display:flex;align-items:end;justify-content:space-between;margin:0 0 17px}.section-title h2{font:700 25px Roboto;margin:7px 0 0;letter-spacing:-.6px}.save-state{font-size:11px;color:#6d806f}.workspace{display:grid;grid-template-columns:minmax(390px,470px) minmax(0,1fr);border:1px solid #e5dddd;border-radius:8px;overflow:hidden;align-items:start}.form-panel{padding:22px 24px;background:#fff}.step-title{display:flex;align-items:center;gap:11px;padding-bottom:12px;border-bottom:1px solid #eee;margin-bottom:13px}.step-title>span{width:26px;height:26px;display:grid;place-items:center;border-radius:50%;background:var(--red-soft);color:var(--red);font-weight:800;font-size:11px}.step-title b,.step-title small{display:block}.step-title b{font-size:13px}.step-title small{font-size:10px;color:#888;margin-top:3px}.step-gap{margin-top:23px}.form-panel label{display:block;font-size:11px;font-weight:700;color:#454545;margin:13px 0 6px}.form-panel input,.form-panel select,.form-panel textarea{width:100%;min-width:0;padding:10px 11px;border:1px solid #dedada;border-radius:5px;background:white;color:#333;font:12px 'Roboto';outline:none}.form-panel input:focus,.form-panel select:focus,.form-panel textarea:focus{border-color:#c75a61;box-shadow:0 0 0 2px #b51f2a12}.form-panel input[readonly]{background:#f8f6f6;color:#888}.rule-hint{font-size:10px;color:#8d4549;background:#fff5f5;border-left:3px solid #d36b71;padding:8px 10px;margin-top:8px;line-height:1.5}.field-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}.field-row.three{grid-template-columns:.7fr 1fr 1.3fr}.form-panel textarea{resize:vertical;min-height:210px;line-height:1.7;font-family:'Times New Roman',serif}.actions{display:flex;gap:9px;margin-top:17px}.actions .button{flex:1}.privacy-note{font-size:10px;line-height:1.6;color:#888;margin:12px 0 0}.preview-panel{background:#f2f0f0;padding:18px 22px 28px;min-width:0}.preview-head{display:flex;justify-content:space-between;align-items:center;margin:0 auto 14px;max-width:794px}.preview-head b,.preview-head small{display:block}.preview-head b{font-size:12px}.preview-head small{font-size:10px;color:#888;margin-top:4px}.preview-head>span{font-size:9px;letter-spacing:1px;color:#888}.paper-preview{width:100%;max-width:794px;min-height:1123px;margin:auto;padding:76px 75px;background:white;box-shadow:0 2px 12px #0000000b;color:#111;font:14px/1.5 'Times New Roman',serif;overflow-wrap:anywhere}.document-head{display:grid;grid-template-columns:1fr 1.25fr;gap:24px;text-align:center;font-size:12px}.agency-head b,.agency-head span,.national-head b,.national-head span{display:block}.agency-head b:first-child{font-weight:400}.agency-head span{margin-top:10px}.national-head b:first-child{font-size:12px}.national-head b:nth-child(2){font-size:12px;text-decoration:underline;text-underline-offset:4px;margin-top:4px}.national-head span{font-style:italic;margin-top:17px;font-size:11px}.document-title{text-align:center;margin:35px 0 20px}.document-title h2{font-size:15px;margin:0 0 4px;text-transform:uppercase}.document-title>b{font-size:13px}.recipient{font-style:italic;margin:18px 0}.document-body{white-space:pre-wrap;text-align:justify;text-indent:28px;line-height:1.55;min-height:260px}.document-bottom{display:grid;grid-template-columns:1fr 1fr;gap:15px;margin-top:30px;font-size:12px}.document-bottom>div:first-child b,.document-bottom>div:first-child span{display:block}.document-bottom>div:first-child span{margin-top:4px}.signature{text-align:center;display:flex;flex-direction:column;align-items:center;gap:5px}.signature b{text-transform:uppercase}.signature i{font-style:italic;font-size:10px}.signature strong{margin-top:52px}.template-section{padding-top:5px}.group-list{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}.group-chip{text-align:left;border:1px solid var(--line);background:white;border-radius:6px;padding:14px;cursor:pointer}.group-chip:hover{border-color:#c96b70;background:#fffafa}.group-chip b,.group-chip small{display:block}.group-chip b{font-size:12px}.group-chip small{font-size:10px;color:#888;margin-top:6px;line-height:1.5}.help-section{background:#fff8f8;border-top:1px solid #f0dddd;border-bottom:1px solid #f0dddd;padding:22px max(calc((100vw - 1240px)/2),4%);font-size:11px;line-height:1.7}.help-section>b{font-size:12px}.help-section p{color:#6f6565;margin:6px 0}.help-section a{color:var(--red);font-weight:700}footer{max-width:1240px;margin:auto;padding:24px 22px;display:flex;justify-content:space-between;align-items:center;color:#888;font-size:10px}footer .brand{color:#222}@media(max-width:900px){.intro{grid-template-columns:1fr .8fr;gap:20px}.workspace{grid-template-columns:minmax(340px,430px) minmax(0,1fr)}.paper-preview{padding:55px 38px}.group-list{grid-template-columns:repeat(2,1fr)}}@media(max-width:700px){.topbar{padding:0 15px}.topbar nav{display:none}.intro{grid-template-columns:1fr;padding:35px 18px}.quick-facts{max-width:none}.editor-section,.template-section{padding:18px 10px 35px}.workspace{grid-template-columns:1fr}.form-panel{padding:17px 14px}.preview-panel{padding:15px 7px}.paper-preview{min-height:900px;padding:45px 28px;font-size:12px}.document-head{gap:10px;font-size:10px}.national-head b:first-child{font-size:10px}.document-title{margin-top:28px}.group-list{grid-template-columns:1fr}.section-title h2{font-size:22px}.intro h1{font-size:39px}footer{padding:20px 14px;gap:12px;align-items:flex-start;flex-direction:column}}@media print{@page{size:A4;margin:0}body{background:#fff}.topbar,.intro,.editor-section>.section-title,.form-panel,.preview-head,.template-section,.help-section,footer{display:none!important}.editor-section{padding:0!important;margin:0!important}.workspace{display:block;border:0}.preview-panel{padding:0;background:white}.paper-preview{box-shadow:none;width:210mm;max-width:none;min-height:297mm;padding:25mm 20mm 25mm 30mm;margin:0;font-size:13pt;line-height:1.5}.document-head{font-size:11pt}.national-head b:first-child,.national-head b:nth-child(2){font-size:11pt}.document-title h2{font-size:14pt}.document-body{line-height:1.5}}


/* Legal-format preview: A4 geometry and Vietnamese administrative typography. */
.paper-preview{width:210mm;max-width:100%;min-height:297mm;padding:20mm 20mm 20mm 30mm;font-family:"Times New Roman",serif;font-size:13pt;line-height:1.5}
.document-head{grid-template-columns:1fr 1fr;gap:8mm;font-size:12pt;line-height:1.25}
.agency-head,.national-head{min-width:0}
.agency-head b,.national-head b{line-height:1.25}
.agency-head b:first-child{font-size:12pt}
.agency-head b:nth-child(2){font-size:12pt;font-weight:700}
.agency-head span{font-size:12pt;margin-top:8pt}
.national-head b:first-child{font-size:12pt;line-height:1.25}
.national-head b:nth-child(2){font-size:13pt;text-decoration:none;margin-top:4pt;line-height:1.25}
.national-head b:nth-child(2)::after{content:"";display:block;width:42%;border-top:1px solid #111;margin:3pt auto 0}
.national-head span{font-size:13pt;margin-top:12pt;line-height:1.35}
.document-title{margin:24pt 0 12pt}
.document-title h2{font-size:14pt;line-height:1.3;margin:0 0 5pt}
.document-title>b{font-size:13pt;line-height:1.4}
.recipient{font-size:13pt;line-height:1.5;margin:12pt 0}
.document-body{font-size:13pt;line-height:1.5;text-align:justify;text-indent:10mm;min-height:0}
.document-bottom{font-size:11pt;line-height:1.25;margin-top:24pt;break-inside:avoid}
.document-bottom>div:first-child{font-size:11pt}
.signature{font-size:13pt}
.signature i{font-size:11pt}
.signature strong{margin-top:48pt}
.paper-preview[data-group="state"] .document-head{grid-template-columns:1fr 1fr}
.paper-preview[data-group="contract"],.paper-preview[data-group="personal"]{font-size:13pt}
@media(max-width:700px){
 .paper-preview{width:100%;min-height:900px;padding:22mm 12mm 20mm 18mm;font-size:11pt}
 .document-head{gap:4mm;font-size:9pt}
 .agency-head b:first-child,.agency-head b:nth-child(2),.national-head b:first-child{font-size:9pt}
 .agency-head span,.national-head b:nth-child(2),.national-head span{font-size:9pt}
 .document-title h2{font-size:12pt}
 .document-title>b,.recipient,.document-body{font-size:11pt}
 .document-bottom{font-size:9pt}
}
@media print{
 @page{size:A4;margin:0}
 .paper-preview{width:210mm;max-width:none;min-height:297mm;padding:20mm 20mm 20mm 30mm;margin:0;font-size:13pt;line-height:1.5}
 .document-head{font-size:12pt}
 .agency-head b:first-child,.agency-head b:nth-child(2),.national-head b:first-child{font-size:12pt}
 .agency-head span,.national-head b:nth-child(2),.national-head span{font-size:13pt}
 .document-title h2{font-size:14pt}
 .document-body{font-size:13pt;line-height:1.5}
}


/* Dedicated editor workspace: 3/7 split with independent scrolling. */
.editor-page{height:100vh;overflow:hidden;background:#f5f3f3}
.editor-toolbar{height:62px;box-sizing:border-box;display:flex;align-items:center;gap:22px;padding:0 20px;background:#fff;border-bottom:1px solid #e7dddd;position:relative;z-index:5}
.editor-toolbar .brand{flex:0 0 auto}.toolbar-title{display:flex;flex-direction:column;gap:2px;flex:1}.toolbar-title b{font-size:14px}.toolbar-title small{font-size:11px;color:#777}
.editor-main{height:calc(100vh - 62px);display:grid;grid-template-columns:minmax(310px,30%) minmax(0,70%);overflow:hidden}
.editor-main>.form-panel{overflow:auto;min-width:0;padding:20px 22px;border-right:1px solid #e6dddd}
.editor-main>.preview-panel{display:flex;flex-direction:column;min-width:0;min-height:0;padding:0;background:#ece9e9}
.editor-main .preview-head{flex:0 0 auto;display:flex!important;align-items:center;justify-content:space-between;gap:12px;padding:12px 18px;background:#fff;border-bottom:1px solid #e4dddd}
.editor-main .preview-head>div:first-child{display:flex;flex-direction:column;gap:3px}.editor-main .preview-head small{font-size:11px;color:#777}
.zoom-tools{display:flex;align-items:center;gap:7px;white-space:nowrap}.zoom-tools button{border:1px solid #ddd;background:#fff;border-radius:5px;padding:6px 10px;color:#333;cursor:pointer;font:12px 'Roboto'}.zoom-tools button:hover{border-color:#b51f2a;color:#b51f2a}.zoom-tools #zoom-value{min-width:42px;text-align:center;font-size:12px;font-weight:700}
.paper-scroll{flex:1;min-height:0;overflow:auto;padding:22px 24px 45px;overscroll-behavior:contain}
.editor-main .paper-preview{width:210mm;max-width:none;min-height:297mm;margin:0 auto;box-sizing:border-box;padding:20mm 20mm 20mm 30mm;background:#fff;box-shadow:0 2px 14px #00000012;font:13pt/1.5 'Times New Roman',serif}
.editor-page .document-body{min-height:0}
.editor-page .form-panel .actions{position:sticky;bottom:-20px;background:#fff;padding:12px 0;border-top:1px solid #eee}
@media(max-width:950px){.editor-main{grid-template-columns:minmax(280px,35%) minmax(0,65%)}.editor-main>.form-panel{padding:16px}.paper-scroll{padding:14px}.zoom-tools{gap:4px}.zoom-tools button{padding:5px 7px}}
@media(max-width:700px){.editor-page{height:auto;min-height:100vh;overflow:auto}.editor-toolbar{padding:0 12px;gap:10px}.toolbar-title{display:none}.editor-main{height:auto;display:flex;flex-direction:column;overflow:visible}.editor-main>.form-panel{overflow:visible;border-right:0;border-bottom:1px solid #ddd}.editor-main>.preview-panel{height:75vh;min-height:540px}.editor-main .preview-head{padding:10px}.paper-scroll{padding:12px}.editor-main .paper-preview{margin:0}}


/* Full-screen and low-vision accessibility */
.access-tools{display:flex;align-items:center;gap:7px}.access-tools button{border:1px solid #ddd;background:#fff;border-radius:5px;padding:7px 10px;font:700 13px 'Roboto';cursor:pointer;color:#333}.access-tools button:hover{border-color:#b51f2a;color:#b51f2a}
.editor-toolbar{height:68px}.editor-main{height:calc(100vh - 68px)}
.editor-main .form-panel{font-size:calc(12px * var(--editor-ui-scale,1))}
.editor-main .form-panel label{font-size:calc(12px * var(--editor-ui-scale,1));margin-top:calc(14px * var(--editor-ui-scale,1));margin-bottom:calc(7px * var(--editor-ui-scale,1))}
.editor-main .form-panel input,.editor-main .form-panel select,.editor-main .form-panel textarea{font-size:calc(14px * var(--editor-ui-scale,1));padding:calc(10px * var(--editor-ui-scale,1))}
.editor-main .form-panel textarea{font-size:calc(15px * var(--editor-ui-scale,1));line-height:1.7}
.editor-fullscreen{position:fixed;inset:0;z-index:9999;width:100vw;height:100vh;background:#f5f3f3}
.editor-fullscreen .editor-main{height:calc(100vh - 68px)}
.editor-fullscreen .editor-toolbar{height:68px}
.editor-page:fullscreen{width:100vw;height:100vh;background:#f5f3f3}
.editor-page:fullscreen .editor-main{height:calc(100vh - 68px)}
.editor-page:fullscreen .paper-scroll{padding:28px}
.editor-page:fullscreen .editor-main .paper-preview{box-shadow:0 3px 18px #0002}
@media(max-width:700px){.access-tools{gap:4px}.access-tools button{padding:6px 7px;font-size:11px}.editor-toolbar{height:58px}.editor-main{height:auto}.editor-page:fullscreen .editor-main{height:calc(100vh - 58px)}}


/* Interface typography: Roboto. Official document preview remains Times New Roman. */
body{font-family:'Roboto',Arial,sans-serif}
.paper-preview{color:#000!important;font-family:'Times New Roman',serif}
.editor-main .paper-preview{color:#000!important}
.document-body p{margin:0 0 6pt;white-space:pre-wrap;text-indent:10mm}
.document-body p.body-heading{font-weight:700;text-indent:0;text-align:left;margin-top:8pt;margin-bottom:4pt}
.document-body p.body-subheading{font-weight:700;text-indent:0;text-align:left}
.document-body p.body-empty{height:6pt;margin:0}
.paper-preview[data-group="state"]{padding:20mm 20mm 20mm 30mm}
.paper-preview[data-group="party"]{padding:20mm 15mm 20mm 30mm}
.paper-preview[data-group="party"] .agency-head span::before{content:"*";display:block;text-align:center;font-size:14pt;line-height:1.2;margin:3pt 0}
.paper-preview[data-group="party"] .agency-head span{font-size:14pt;margin-top:0}
.paper-preview[data-group="party"] .agency-head b:first-child{font-size:14pt}
.paper-preview[data-group="party"] .agency-head b:nth-child(2){font-size:14pt;font-weight:700}
.paper-preview[data-group="party"] .national-head b:first-child{font-size:15pt;font-weight:700;text-decoration:none}
.paper-preview[data-group="party"] .national-head b:first-child::after{content:"";display:block;width:100%;border-bottom:1px solid #000;margin:3pt auto 0}
.paper-preview[data-group="party"] .national-head span{font-size:14pt;font-style:italic;margin-top:12pt}
.paper-preview[data-group="party"] .document-title h2{font-size:15.5pt;font-weight:700}
.paper-preview[data-group="party"] .document-title>b{font-size:14.5pt}
.paper-preview[data-group="party"] .document-body{font-size:14pt;line-height:1.5}
.paper-preview[data-group="party"] .recipient{font-size:14pt}
.paper-preview[data-group="party"] .document-bottom{font-size:12pt}
.paper-preview[data-group="party"] .signature{font-size:14pt}
.paper-preview[data-group="party"] .signature i{font-size:12pt}
.paper-preview[data-group="state"] .document-body{font-size:13pt;line-height:1.5}
.paper-preview[data-group="state"] .document-title h2{font-size:14pt}
.paper-preview[data-group="state"] .document-title>b{font-size:13pt}
.paper-preview[data-group="state"] .national-head b:first-child{font-size:12pt}
.paper-preview[data-group="state"] .national-head b:nth-child(2){font-size:13pt}
.paper-preview[data-group="state"] .agency-head b:first-child,.paper-preview[data-group="state"] .agency-head b:nth-child(2){font-size:12pt}
.paper-preview[data-group="state"] .agency-head b:nth-child(2)::after{content:"";display:block;width:42%;border-bottom:1px solid #000;margin:3pt auto 0}
@media print{
 .paper-preview[data-group="party"]{padding:20mm 15mm 20mm 30mm}
 .paper-preview[data-group="state"]{padding:20mm 20mm 20mm 30mm}
 .paper-preview[data-group="party"] .document-body{font-size:14pt}
}

/* Keep the national heading on one line in the A4 preview. */
.paper-preview[data-group="state"] .document-head{grid-template-columns:minmax(0,.9fr) minmax(0,1.1fr)}
.paper-preview[data-group="state"] .national-head{white-space:nowrap}
.paper-preview[data-group="state"] .national-head b:first-child{white-space:nowrap;display:block;font-size:12pt;letter-spacing:-.2pt}
@media(max-width:700px){.paper-preview[data-group="state"] .document-head{grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr)}.paper-preview[data-group="state"] .national-head b:first-child{font-size:9pt;letter-spacing:-.15pt}}

/* Header-level preview zoom controls */
.editor-toolbar .access-tools .zoom-tools{margin-right:4px;padding-right:10px;border-right:1px solid #e8e1e1}
.editor-toolbar .zoom-tools button{font-weight:500}
@media(max-width:700px){.editor-toolbar{height:auto;min-height:58px;flex-wrap:wrap;padding:8px 12px}.editor-toolbar .access-tools{width:100%;justify-content:flex-end;flex-wrap:wrap}.editor-toolbar .access-tools .zoom-tools{margin-right:2px;padding-right:6px;gap:3px}.editor-toolbar .zoom-tools button{padding:5px 6px;font-size:10px}.editor-toolbar .zoom-tools #zoom-value{min-width:34px;font-size:10px}.editor-main{height:auto}}
