:root{color-scheme:light;--navy:#101d3c;--muted:#4c5c73;--line:#dce3ed;--blue:#1843a5;--yellow:#ffc531;font-family:Inter,system-ui,sans-serif;color:var(--navy);background:#f3f6fb}
*{box-sizing:border-box}
body{margin:0}
.site-header{background:#fff;border-bottom:1px solid var(--line)}
.bar,main{max-width:1320px;margin:auto;padding-inline:32px}
.bar{display:flex;gap:22px;align-items:center;height:74px;font-weight:700}
.bar img{width:142px;height:auto}
.bar span{border-left:1px solid var(--line);padding-left:22px}
main{padding-bottom:45px}
.intro{margin:34px 0 27px}
h1{font-size:clamp(2rem,4vw,2.8rem);letter-spacing:-.05em;margin:0 0 5px}
p{margin:0;color:var(--muted)}
.workspace{display:grid;grid-template-columns:minmax(305px,390px) minmax(0,1fr);gap:24px;align-items:start}
form{display:grid;gap:15px}
.card{background:white;border:1px solid var(--line);border-radius:14px;padding:20px;display:grid;gap:13px}
h2{font-size:1.06rem;margin:0}
.pair{display:grid;grid-template-columns:1fr 1fr;gap:12px}
label{display:grid;gap:6px;font-size:.875rem;font-weight:650;min-width:0}
input,textarea,select{font:inherit;font-weight:450;color:inherit;border:1px solid #c9d3e1;border-radius:8px;padding:9px 10px;width:100%;min-width:0;background:#fbfcfe}
textarea{resize:vertical}
input:focus,textarea:focus,select:focus,button:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.amount,.filename{display:flex;align-items:center;border:1px solid #c9d3e1;border-radius:8px;background:#edf2f9}
.amount input,.filename input{border:0}
.amount>span,.filename>span{padding:0 10px;color:var(--muted)}
button{border:0;border-radius:8px;background:var(--yellow);color:#172039;font:inherit;font-weight:750;padding:12px;cursor:pointer}
button:hover{background:#ffb914}
button:disabled{cursor:wait;opacity:.65}
#status{font-size:.875rem}
#status:empty{display:none}
.preview{background:#e7edf6;border:1px solid #d6e0ed;border-radius:16px;padding:19px}
.preview-heading{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:0 1px 16px}
.preview-heading span{font-size:.82rem;color:var(--muted)}
.paper{background:#fff;border-radius:3px;box-shadow:0 4px 18px #10234817;padding:clamp(16px,4vw,46px);color:#111;font-family:Arial,sans-serif;font-size:.875rem;overflow-wrap:anywhere}
.paper p{color:inherit;margin:0 0 13px;line-height:1.43}
.letterhead{display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:2px solid #17275a;padding-bottom:12px;margin-bottom:21px}
.letterhead img{width:45%;max-width:220px}
.letterhead address{font-size:.72rem;line-height:1.35;text-align:right;font-style:normal}
.metadata{display:grid;grid-template-columns:auto 1fr;column-gap:12px;row-gap:7px;margin:0 0 19px}
.metadata dt,.paper h3{font-weight:700}
.metadata dd{margin:0;white-space:pre-wrap}
.description{font-weight:700;white-space:pre-wrap}
.product{display:flex;justify-content:center;align-items:center;gap:8px;margin:12px 0}
.product>div{min-width:0}
.product img{width:34%;max-width:175px;flex:none}
.paper table{border-collapse:collapse;width:auto;max-width:100%;font-size:.81rem}
.paper th,.paper td{padding:2px 5px;text-align:left;vertical-align:top;border:1px solid #dce0e9}
.paper .total{text-align:right;font-weight:700;border-top:1px solid #cad3e3;padding-top:12px;margin-bottom:24px}
.paper h3{font-size:.88rem;margin:16px 0 6px}
.paper ul{padding-left:19px;margin:0;line-height:1.4}
.terms{white-space:pre-wrap;line-height:1.45;margin-bottom:15px}
.signature{display:flex;justify-content:space-between;gap:12px;margin-top:20px}
.paper footer{text-align:center;font-weight:700;color:#17275a;border-top:1px solid #cad3e3;padding-top:12px;margin-top:19px;font-size:.72rem}
@media(max-width:830px){.workspace{grid-template-columns:1fr}.bar,main{padding-inline:18px}.intro{margin-top:25px}}
@media(max-width:400px){.bar{gap:10px}.bar span{padding-left:10px}.preview{padding:10px}.paper{font-size:.8rem}.letterhead address{font-size:.62rem}.pair{grid-template-columns:1fr}}
.spec-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
@media(max-width:400px){.spec-fields{grid-template-columns:1fr}}
#generator-photo::file-selector-button,[data-product-photo]::file-selector-button{font:inherit;font-weight:650;color:var(--navy);background:#e7edf6;border:0;border-radius:5px;padding:6px 9px;margin-right:8px;cursor:pointer}
#photo-status{font-size:.875rem}
#reset-photo{justify-self:start;background:#e7edf6;font-size:.875rem;padding:8px 11px}
#reset-photo:hover{background:#d8e3f2}
.product img{max-height:175px;object-fit:contain}
select{appearance:none;padding-right:28px;background:#fbfcfe url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%234c5c73' stroke-width='1.5'/%3E%3C/svg%3E") right 10px center no-repeat}

#additional-products:empty{display:none}
#additional-products,.additional-product{display:grid;gap:12px}
.additional-product{border:1px solid #dce3ec;border-radius:8px;margin:0;padding:12px;min-width:0}
.additional-product legend{font-weight:650;padding:0 5px}
.product-action{justify-self:start;background:#e7edf6}
.product-action:hover{background:#d8e3f2}
.paper .unit-price{text-align:right;font-weight:700;margin-bottom:12px}
.additional-product h3{margin:0;font-size:.95rem}
.product-photo-status{font-size:.875rem}
.spec-fields input[readonly]{background:#eef2f7;color:#4c5c73}
.add-item-controls{display:flex;align-items:end;gap:12px}
.add-item-controls label{flex:1}
.product-detail-fields{display:grid;gap:12px}
.additional-product .clear-product-photo{justify-self:start}
