:root { --navy:#17233d; --gold:#b08b43; --paper:#fff; --bg:#eef0f3; --line:#d5d9df; --muted:#687083; --danger:#9d2828; }
* { box-sizing:border-box; }
body { margin:0; color:#20242d; background:var(--bg); font-family:Arial, Helvetica, sans-serif; }
button,input,select,textarea { font:inherit; }
button { border:1px solid var(--line); border-radius:7px; background:#fff; cursor:pointer; padding:9px 13px; }
button:hover { border-color:var(--gold); }
button.primary { color:#fff; background:var(--navy); border-color:var(--navy); }
button.danger { color:#fff; background:var(--danger); border-color:var(--danger); }
button.danger:hover { border-color:#641818; background:#7f2020; }
button:disabled { cursor:not-allowed; opacity:.6; }
.app-header { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:18px 24px; background:#fff; border-bottom:3px solid var(--gold); }
.app-header h1 { margin:2px 0; color:var(--navy); font-size:25px; }
.app-header p,.sidebar p { margin:0; color:var(--muted); }
.eyebrow { color:var(--gold); font-size:12px; font-weight:700; letter-spacing:.12em; text-transform:uppercase; }
.toolbar { display:flex; flex-wrap:wrap; gap:8px; }
.app-layout { display:grid; grid-template-columns:280px minmax(0,1fr); min-height:calc(100vh - 91px); }
.sidebar { padding:20px; border-right:1px solid var(--line); }
.sidebar h2 { margin:0 0 8px; font-size:16px; }
.session-list { display:grid; gap:8px; margin-top:16px; }
.session-item { width:100%; text-align:left; padding:11px; background:#fff; }
.session-item.active { border-color:var(--gold); box-shadow:inset 3px 0 var(--gold); }
.session-item span { display:block; margin-top:4px; color:var(--muted); font-size:12px; }
.editor { padding:20px; }
form { display:grid; gap:10px; max-width:1200px; margin:auto; }
details { border:1px solid var(--line); border-radius:9px; background:#fff; }
summary { cursor:pointer; color:var(--navy); font-weight:700; padding:15px 17px; }
.grid,.stack,.people-grid { display:grid; gap:12px; padding:0 17px 17px; }
.grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
.grid.four { grid-template-columns:repeat(4,minmax(0,1fr)); }
.people-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
.stack { grid-template-columns:1fr; }
label { display:grid; align-content:start; gap:6px; color:var(--muted); font-size:12px; font-weight:700; }
label.wide { grid-column:1/-1; }
.field-action { display:flex; justify-content:flex-end; min-height:32px; }
.field-action button { padding:6px 9px; color:var(--navy); font-size:11px; font-weight:700; }
input,select,textarea { width:100%; border:1px solid var(--line); border-radius:6px; padding:10px; color:#222; background:#fff; }
textarea { min-height:92px; resize:vertical; line-height:1.45; }
textarea.large { min-height:190px; }
fieldset { display:grid; grid-template-columns:minmax(0,1fr) 70px; gap:8px; margin:0; border:1px solid var(--line); border-radius:7px; }
legend { color:var(--navy); font-size:12px; font-weight:700; }
dialog { width:100vw; max-width:none; height:100vh; max-height:none; margin:0; padding:0; border:0; background:#666; }
.preview-toolbar { position:sticky; top:0; z-index:5; display:flex; align-items:center; gap:12px; padding:10px 16px; background:#fff; border-bottom:1px solid var(--line); }
.preview-toolbar span { margin-right:auto; color:var(--muted); font-size:12px; }
.document-shell { display:grid; gap:24px; padding:24px; }
.official-document { position:relative; display:flex; flex-direction:column; width:210mm; height:297mm; margin:0 auto; padding:14mm 17mm 12mm; overflow:hidden; background:var(--paper); color:#000; font-family:"Times New Roman", serif; box-shadow:0 4px 24px #2228; page-break-after:always; }
.official-document:last-child { page-break-after:auto; }
.doc-header { display:grid; grid-template-columns:25mm 1fr 25mm; align-items:center; gap:4mm; border-bottom:1px solid #000; padding-bottom:3mm; text-align:center; }
.doc-header img { width:23mm; height:23mm; object-fit:contain; }
.doc-header h2 { margin:0 0 1.5mm; font-size:12pt; }
.doc-header p { margin:.6mm 0; font-size:8.5pt; }
.doc-title { margin:5mm 0 4mm; text-align:center; font-size:11pt; font-weight:700; }
.doc-title.continuation { font-size:9pt; }
.doc-body { font-size:11pt; line-height:1.55; text-align:justify; }
.doc-body p { margin:0; text-indent:12mm; }
.doc-body strong { font-weight:700; }
.signatures { display:grid; grid-template-columns:repeat(3,1fr); gap:8mm; margin-top:19mm; text-align:center; font-size:9pt; page-break-inside:avoid; }
.signature-line { border-top:1px solid #000; padding-top:2mm; }
.doc-footer { display:grid; grid-template-columns:1fr auto; gap:5mm; margin-top:auto; padding-top:2mm; border-top:1px solid #000; font-size:8pt; }
.doc-footer address { font-style:normal; text-align:center; }
.page-number::after { content:attr(data-page); }
@page { size:A4; margin:12mm 15mm 14mm; }
@media (max-width:900px) { .app-layout{grid-template-columns:1fr}.sidebar{border-right:0;border-bottom:1px solid var(--line)}.grid.four,.people-grid{grid-template-columns:repeat(2,1fr)} }
@media (max-width:600px) { .app-header{align-items:flex-start;flex-direction:column}.grid,.grid.four,.people-grid{grid-template-columns:1fr}.editor{padding:10px} }
@media print {
  body > :not(#previewDialog) { display:none !important; }
  #previewDialog { position:static; display:block; width:auto; height:auto; max-height:none; overflow:visible; background:#fff; }
  #documentPreview { display:block; padding:0; }
  .preview-toolbar { display:none; }
  .official-document { width:180mm; height:271mm; margin:0; padding:0; overflow:hidden; box-shadow:none; break-after:page; page-break-after:always; }
  .official-document:last-child { break-after:auto; page-break-after:auto; }
}
