:root {
  --green: #17483d;
  --green-dark: #10382f;
  --green-soft: #e8f0ed;
  --ink: #17201e;
  --muted: #68726f;
  --line: #dfe4e2;
  --cream: #f5f3ed;
  --paper: #fff;
  --gold: #b48a47;
  --danger: #a33f37;
  --shadow: 0 18px 50px rgba(18, 49, 42, .09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--cream); font-family: "Segoe UI", Arial, sans-serif; line-height: 1.45; }
button, input, textarea { font: inherit; }
button { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app-shell { min-height: 100vh; }
.topbar { height: 78px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; color: white; background: var(--green); position: sticky; top: 0; z-index: 20; box-shadow: 0 4px 18px rgba(7, 29, 24, .2); }
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-mark { width: 40px; height: 40px; border: 1px solid rgba(255,255,255,.4); display: grid; place-items: center; font: 700 21px Georgia, serif; position: relative; }
.brand-mark::after { content:""; position:absolute; width: 5px; height: 5px; right: -3px; top: -3px; background: var(--gold); border-radius: 50%; }
.brand strong { font: 700 22px Georgia, serif; display: block; letter-spacing: .02em; }
.brand small { display: block; color: rgba(255,255,255,.67); font-size: 10px; text-transform: uppercase; letter-spacing: .14em; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.save-status { margin-right: 12px; font-size: 12px; color: rgba(255,255,255,.75); display: flex; align-items:center; gap: 7px; }
.save-status i { width: 7px; height: 7px; border-radius: 50%; background: #7fd1a7; }

.button { border: 0; border-radius: 4px; padding: 11px 16px; font-size: 13px; font-weight: 650; display: inline-flex; gap: 9px; align-items: center; justify-content:center; cursor: pointer; transition: .2s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.button-primary { background: #d9a852; color: #1d2b27; box-shadow: 0 5px 16px rgba(0,0,0,.12); }
.button-primary:hover { background: #e2b664; }
.button-ghost { background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.3); }
.button-outline { background: white; border: 1px solid #aab4b1; }
.button-dark { color: white; background: var(--green); }
.button-large { padding: 14px 22px; }

.workspace { max-width: 1500px; margin: 0 auto; display: grid; grid-template-columns: 310px minmax(0, 1fr); align-items: start; }
.steps-panel { position: sticky; top: 78px; height: calc(100vh - 78px); padding: 52px 34px 28px; border-right: 1px solid #e2ded5; display: flex; flex-direction: column; }
.eyebrow { color: var(--gold); font-weight: 800; letter-spacing: .16em; font-size: 10px; }
.aside-intro h1, .mobile-title h1 { margin: 13px 0 15px; font: 500 37px/1.08 Georgia, serif; color: var(--green-dark); }
.aside-intro p { color: var(--muted); font-size: 13px; max-width: 220px; }
.step-list { display: grid; gap: 4px; margin-top: 28px; }
.step { position: relative; display: grid; grid-template-columns: 37px 1fr; grid-template-rows: auto auto; gap: 0 10px; text-align: left; border: 0; background: transparent; padding: 11px 12px; cursor:pointer; border-radius: 5px; }
.step::before { content:""; position:absolute; left:0; top:10px; bottom:10px; width: 2px; background: transparent; }
.step.active { background: rgba(255,255,255,.8); }
.step.active::before { background: var(--green); }
.step > span { grid-row: 1 / span 2; width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #cfd6d3; border-radius:50%; font-size: 9px; font-weight: 800; color: #87908e; }
.step.active > span { background: var(--green); color: white; border-color: var(--green); }
.step b { font-size: 12px; }
.step small { color: #8a9390; font-size: 10px; }
.privacy-note { margin-top:auto; display:flex; gap:11px; padding: 15px; background: #ecebe5; color: var(--muted); border-radius:5px; font-size: 10px; }
.privacy-note svg { flex: 0 0 auto; color: var(--green); }
.privacy-note p { margin: 0; }
.privacy-note strong { color: var(--ink); }

.editor-panel { background: white; min-height: calc(100vh - 78px); box-shadow: var(--shadow); }
.mobile-title { display:none; }
.editor-section { padding: 46px 64px; border-bottom: 1px solid #ecefed; scroll-margin-top: 78px; }
.section-heading { display:flex; gap: 16px; margin-bottom: 28px; }
.section-number { width: 34px; height: 34px; border: 1px solid #cad3d0; border-radius:50%; display:grid; place-items:center; font-size:9px; font-weight:800; color:var(--green); flex: 0 0 auto; }
.section-heading h2 { margin:0 0 3px; font: 600 24px Georgia, serif; color:var(--green-dark); }
.section-heading p, .agreements-head p, .logos-block p { margin:0; color: var(--muted); font-size:12px; }

.audio-drop { min-height: 130px; border: 1px dashed #aebcb8; background:#fbfcfb; display:flex; align-items:center; padding: 24px; gap:18px; border-radius:6px; transition:.2s; }
.audio-drop.dragover { border-color: var(--green); background: var(--green-soft); }
.upload-icon { width:50px; height:50px; display:grid; place-items:center; border-radius:50%; background:var(--green-soft); color:var(--green); }
.upload-icon svg { width:23px; height:23px; }
.drop-copy { min-width: 220px; display:grid; }
.drop-copy strong { font-size:13px; }
.drop-copy span { font-size:10px; color:var(--muted); margin-top:3px; }
.audio-drop .or { font: italic 12px Georgia,serif; color:#9aa19f; }
.record-button { display:flex; align-items:center; gap:9px; border:0; background:transparent; font-size:12px; cursor:pointer; }
.record-button i { width:11px; height:11px; border:2px solid white; outline:1px solid #bc4949; background:#bc4949; border-radius:50%; }
.record-button.recording i { animation: pulse 1.3s infinite; }
.record-button.recording span::after { content:" · Detener"; color:var(--danger); }
@keyframes pulse { 50% { box-shadow:0 0 0 7px rgba(188,73,73,.14); } }
.audio-player { display:flex; align-items:center; gap:16px; margin-top:14px; padding:14px 16px; background:var(--green-soft); border-radius:5px; }
.round-play { width:37px; height:37px; border:0; border-radius:50%; background:var(--green); color:white; display:grid; place-items:center; cursor:pointer; }
.round-play svg { fill:currentColor; stroke:none; }
.player-main { flex:1; }
.waveform { height:28px; display:flex; align-items:center; gap:3px; overflow:hidden; }
.waveform i { width:2px; min-width:2px; border-radius:2px; background:#7fa299; opacity:.65; }
.waveform i.played { background:var(--green); opacity:1; }
.time-row { display:flex; justify-content:space-between; font-size:9px; color:var(--muted); }
.icon-button { border:0; background:transparent; color:#66736f; cursor:pointer; padding:8px; }
.transcribe-row { display:flex; align-items:center; gap:18px; margin-top:18px; }
.helper { margin:0; color:var(--muted); font-size:10px; }
.progress-wrap { flex:1; max-width:380px; }
.progress-copy { display:flex; justify-content:space-between; font-size:10px; color:var(--muted); margin-bottom:5px; }
.progress-track { height:5px; background:#dfe8e5; border-radius:9px; overflow:hidden; }
.progress-track i { display:block; width:0; height:100%; background:var(--green); transition:.2s; }
.hidden { display:none !important; }

.field-grid { display:grid; gap:16px; }
.field-grid.two { grid-template-columns:1fr 1fr; }
.field { display:block; margin-bottom:18px; position:relative; }
.field > span, .field-label { display:block; font-size:9px; letter-spacing:.11em; font-weight:800; color:#5a6662; margin-bottom:7px; }
.field input, .field textarea { width:100%; border:1px solid #d7ddda; border-radius:4px; padding:12px 13px; color:var(--ink); background:#fff; outline:none; transition:.2s; resize:vertical; }
.field input:focus, .field textarea:focus { border-color:var(--green); box-shadow:0 0 0 3px rgba(23,72,61,.08); }
.field input::placeholder, .field textarea::placeholder { color:#a3aaa8; }
.field.fixed input { background:#f2f4f3; color:#52605c; padding-right:50px; }
.field.fixed i { position:absolute; right:10px; top:35px; font-style:normal; font-size:7px; font-weight:800; color:#8a9491; letter-spacing:.1em; }
.field em { font-style:normal; color:#9ca5a2; font-weight:500; text-transform:none; letter-spacing:0; float:right; }
.field > small { color:#929a97; font-size:9px; display:block; margin-top:4px; }
.transcript-field { padding:14px; background:#f7f7f4; border-radius:5px; }
.logos-block { display:flex; align-items:center; justify-content:space-between; padding-top:6px; }
.logo-slots { display:flex; gap:10px; }
.logo-slot { width:126px; height:74px; border:1px dashed #bcc6c3; display:grid; place-items:center; cursor:pointer; position:relative; overflow:hidden; border-radius:4px; background:#fbfcfb; }
.logo-slot > span { display:grid; place-items:center; color:var(--green); font-size:18px; }
.logo-slot small { font-size:9px; color:var(--muted); }
.logo-slot img { display:none; max-width:90%; max-height:80%; object-fit:contain; }
.logo-slot.has-image img { display:block; }
.logo-slot.has-image > span { display:none; }
.remove-logo { display:none; position:absolute; top:3px; right:4px; width:20px; height:20px; border:0; border-radius:50%; background:#fff; box-shadow:0 1px 5px #aaa; cursor:pointer; }
.logo-slot.has-image .remove-logo { display:block; }

.agreements-head { display:flex; justify-content:space-between; align-items:end; margin:24px 0 12px; }
.text-button { border:0; color:var(--green); font-weight:700; font-size:11px; background:transparent; cursor:pointer; padding:6px; }
.agreements { display:grid; gap:8px; }
.agreement { display:grid; grid-template-columns:32px minmax(0,1.7fr) minmax(140px,.8fr) 140px 34px; gap:9px; align-items:center; border:1px solid #e0e5e3; border-radius:4px; padding:10px; background:#fbfcfb; }
.agreement .index { width:27px; height:27px; border-radius:50%; background:var(--green-soft); color:var(--green); display:grid; place-items:center; font-size:9px; font-weight:800; }
.agreement input { width:100%; border:0; border-bottom:1px solid #dce2df; padding:8px 3px; outline:none; background:transparent; font-size:11px; }
.agreement input:focus { border-color:var(--green); }
.remove-row { border:0; background:transparent; cursor:pointer; color:#9b5e59; font-size:18px; }

.participants { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.participant-card { border:1px solid #dee4e1; padding:17px; border-radius:5px; position:relative; background:#fff; }
.participant-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:13px; }
.participant-head strong { font:600 14px Georgia,serif; color:var(--green-dark); }
.participant-card .field { margin-bottom:10px; }
.participant-card .field input { padding:9px 10px; font-size:11px; }
.signature-preview { height:74px; border:1px dashed #c3cdca; display:grid; place-items:center; margin-top:12px; position:relative; overflow:hidden; background:#fbfcfb; }
.signature-preview img { max-width:90%; max-height:68px; object-fit:contain; display:none; }
.signature-preview.has-signature img { display:block; }
.signature-preview.has-signature button span { display:none; }
.signature-preview button { border:0; background:transparent; color:var(--green); cursor:pointer; font-size:10px; font-weight:700; position:absolute; inset:0; }
.signature-preview.has-signature button { opacity:0; }
.signature-preview.has-signature:hover button { opacity:1; background:rgba(255,255,255,.88); }
.add-card { width:100%; min-height:80px; margin-top:12px; border:1px dashed #aebcb8; background:#fbfcfb; display:flex; align-items:center; justify-content:center; gap:8px; cursor:pointer; border-radius:5px; color:var(--green); }
.add-card span { font-size:20px; }
.add-card b { font-size:12px; }
.add-card small { color:var(--muted); }
.editor-footer { padding:28px 64px; background:var(--green-dark); color:white; display:flex; align-items:center; justify-content:space-between; }
.editor-footer div { display:grid; }
.editor-footer strong { font:600 18px Georgia,serif; }
.editor-footer span { font-size:10px; color:rgba(255,255,255,.65); }

.signature-dialog { width:min(670px,calc(100% - 30px)); border:0; padding:0; border-radius:7px; box-shadow:0 30px 90px rgba(0,0,0,.28); }
.signature-dialog::backdrop { background:rgba(10,28,24,.65); backdrop-filter:blur(3px); }
.dialog-card { padding:26px; }
.dialog-head { display:flex; justify-content:space-between; align-items:start; }
.dialog-head h3 { font:600 24px Georgia,serif; color:var(--green-dark); margin:4px 0 18px; }
.dialog-close { border:0; background:transparent; font-size:26px; cursor:pointer; }
.signature-tabs { display:flex; border-bottom:1px solid var(--line); margin-bottom:16px; }
.signature-tabs button { border:0; background:transparent; padding:10px 18px; font-size:11px; cursor:pointer; border-bottom:2px solid transparent; }
.signature-tabs button.active { border-color:var(--green); color:var(--green); font-weight:700; }
.sign-pane { display:none; }
.sign-pane.active { display:block; }
#signatureCanvas { width:100%; height:200px; border:1px dashed #aebcb8; background:#fdfdfc; touch-action:none; }
.signature-upload { height:200px; border:1px dashed #aebcb8; display:flex; flex-direction:column; align-items:center; justify-content:center; cursor:pointer; }
.signature-upload span { font-size:25px; color:var(--green); }
.signature-upload small { color:var(--muted); margin-top:4px; }
.dialog-actions { display:flex; justify-content:flex-end; gap:9px; margin-top:18px; }
.dialog-actions .button-ghost { color:var(--ink); border-color:#c7cfcc; }
.toast { position:fixed; right:24px; bottom:24px; z-index:50; background:#172c27; color:white; padding:13px 18px; border-radius:4px; font-size:12px; box-shadow:0 12px 30px rgba(0,0,0,.2); transform:translateY(20px); opacity:0; pointer-events:none; transition:.25s; }
.toast.show { opacity:1; transform:none; }

#pdfMount { position:absolute; left:0; top:0; z-index:-1000; width:210mm; pointer-events:none; }
#pdfMount.rendering { position:fixed; z-index:1000; background:#fff; }
.pdf-document { width:210mm; min-height:296mm; padding:16mm 17mm 17mm; background:white; color:#1d2825; font-family:Arial,sans-serif; font-size:10pt; line-height:1.55; }
.pdf-header { display:flex; justify-content:space-between; align-items:center; min-height:27mm; border-bottom:2px solid #1a4b40; padding-bottom:5mm; }
.pdf-logos { display:flex; gap:5mm; align-items:center; }
.pdf-logos img { max-width:37mm; max-height:19mm; object-fit:contain; }
.pdf-heading { text-align:right; }
.pdf-heading h1 { margin:0; font:700 20pt Georgia,serif; color:#17483d; }
.pdf-heading p { margin:1mm 0 0; font-size:8pt; letter-spacing:.08em; text-transform:uppercase; color:#68726f; }
.pdf-meta { display:grid; grid-template-columns:1fr 1fr; border:1px solid #d7dfdc; margin:7mm 0; }
.pdf-meta div { padding:3mm; border-bottom:1px solid #d7dfdc; }
.pdf-meta div:nth-child(odd) { border-right:1px solid #d7dfdc; }
.pdf-meta .wide { grid-column:1/-1; border-right:0; }
.pdf-meta b, .pdf-section h2 { color:#17483d; font-size:7.5pt; letter-spacing:.09em; text-transform:uppercase; display:block; margin-bottom:1mm; }
.pdf-section { margin:7mm 0; break-inside:avoid; }
.pdf-section h2 { border-bottom:1px solid #b48a47; padding-bottom:2mm; font-size:9pt; }
.pdf-body { white-space:pre-wrap; text-align:justify; }
.pdf-agreements { width:100%; border-collapse:collapse; font-size:8pt; }
.pdf-agreements th { text-align:left; color:white; background:#17483d; padding:2.2mm; }
.pdf-agreements td { border:1px solid #d7dfdc; padding:2.2mm; vertical-align:top; }
.pdf-signatures { display:grid; grid-template-columns:1fr 1fr; gap:8mm 9mm; margin-top:7mm; }
.pdf-signature { text-align:center; break-inside:avoid; padding-top:3mm; }
.pdf-signature img { height:19mm; max-width:52mm; object-fit:contain; display:block; margin:0 auto -1mm; }
.pdf-sign-line { border-top:1px solid #505b58; padding-top:2mm; }
.pdf-signature strong { display:block; }
.pdf-signature span { color:#68726f; font-size:8pt; }
.pdf-footer { margin-top:12mm; border-top:1px solid #d7dfdc; padding-top:3mm; font-size:7.5pt; color:#78817f; display:flex; justify-content:space-between; }

@media (max-width: 920px) {
  .topbar { padding:0 18px; }
  .save-status, .top-actions .button-ghost { display:none; }
  .workspace { display:block; }
  .steps-panel { display:none; }
  .mobile-title { display:block; padding:32px 24px 0; }
  .editor-section { padding:35px 24px; }
  .audio-drop { flex-wrap:wrap; }
  .drop-copy { flex:1; min-width:180px; }
  .field-grid.two, .participants { grid-template-columns:1fr; }
  .agreement { grid-template-columns:28px 1fr 32px; }
  .agreement input:nth-of-type(2), .agreement input:nth-of-type(3) { grid-column:2; }
  .agreement .remove-row { grid-column:3; grid-row:1; }
  .logos-block { align-items:flex-start; gap:18px; flex-direction:column; }
  .editor-footer { padding:25px 24px; gap:20px; }
}

@media (max-width: 560px) {
  .brand small { display:none; }
  .top-actions .button-primary { padding:10px; font-size:0; }
  .top-actions .button-primary svg { margin:0; }
  .editor-section { padding:31px 18px; }
  .audio-drop { justify-content:center; text-align:center; }
  .drop-copy { flex-basis:100%; }
  .transcribe-row { align-items:stretch; flex-direction:column; }
  .logos-block, .agreements-head, .editor-footer { align-items:stretch; flex-direction:column; }
  .logo-slots { width:100%; }
  .logo-slot { flex:1; }
}

@media print {
  body > *:not(#pdfMount) { display:none !important; }
  #pdfMount { position:static; width:auto; }
  .pdf-document { box-shadow:none; }
}
