:root{--ink:#283e32;--cream:#f7f4eb;--line:#dcded3;--muted:#60665e;--white:#fffefa;--accent:#e9ede3}*{box-sizing:border-box}body{margin:0;background:var(--cream);color:var(--ink);font:16px/1.5 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}header{padding:22px max(20px,calc((100vw - 1080px)/2));display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--line)}.brand{font-family:Georgia,serif;font-size:25px;letter-spacing:2px;color:var(--ink);text-decoration:none}.brand span{display:block;font:12px system-ui;letter-spacing:.3px;margin-top:2px}.tag,.badge{font-size:12px;border-radius:20px;background:var(--accent);padding:6px 12px}.badge{display:inline-block;margin:3px}.intro{padding:25px 0 15px}.eyebrow{font-size:11px;letter-spacing:2px}h1,h2,h3{font-family:Georgia,serif;font-weight:400;line-height:1.15}h1{font-size:clamp(32px,5vw,50px);margin:12px 0}h1 em{font-weight:400;color:#77806b}h2{font-size:28px;margin:8px 0 18px}h3{font-size:23px;margin:0 0 12px}p{margin:10px 0 18px}main{max-width:1120px;margin:auto;padding:0 20px 40px}.narrow{max-width:620px;padding-top:50px}.toolbar{display:flex;gap:14px;align-items:end;padding:20px 0}label{display:block;font-size:13px;font-weight:600;min-width:0}input,select,textarea{width:100%;font:16px system-ui;color:var(--ink);border:1px solid #bec5b7;background:var(--white);border-radius:12px;padding:12px;min-height:48px;margin:6px 0 12px}textarea{min-height:85px;resize:vertical}input:disabled{background:#eaede4;color:#45513f}button,.button{font:600 15px system-ui;display:inline-block;cursor:pointer;border:1px solid transparent;border-radius:13px;padding:13px 19px;min-height:48px;background:var(--ink);color:white;text-decoration:none;touch-action:manipulation}button:disabled{opacity:.6;cursor:wait}.secondary{background:transparent;border-color:#b7c0b0;color:var(--ink)}.text-button{background:transparent;color:var(--ink);padding:8px;text-decoration:underline}.toolbar button{margin-bottom:12px}nav{display:flex;gap:6px;border-bottom:1px solid var(--line);padding:10px 0 17px;flex-wrap:wrap}nav button{background:transparent;color:var(--ink);padding:12px 16px}nav .selected{background:var(--ink);color:white}.card{border:1px solid var(--line);border-radius:20px;padding:20px;background:var(--white);margin:14px 0;overflow-wrap:anywhere}.cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.cards .card{margin:0}.section-heading{display:flex;justify-content:space-between;gap:15px;align-items:center;margin:24px 0 12px}.section-heading h2{margin:0}.muted,small{color:var(--muted);font-size:13px}.totals{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:14px 0}.amount{font-size:24px;font-weight:600}.details{border-top:1px solid var(--line);padding-top:12px;font-size:14px}.actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}.empty{text-align:center;padding:45px 20px;color:var(--muted)}.notice{padding:14px;background:#edf0e6;border-radius:12px;margin:12px 0}#message:not(:empty),#formError:not(:empty){padding:14px;border-radius:12px;background:#fff0d7;color:#6c4010;margin:16px 0}dialog{border:1px solid var(--line);border-radius:22px;background:var(--cream);color:var(--ink);width:min(94vw,620px);max-height:90dvh;padding:24px}dialog::backdrop{background:#14261ac0}.dialog-heading{display:flex;justify-content:space-between;gap:15px;align-items:center;margin-bottom:18px}.dialog-heading h2{margin:0;font-size:27px}.grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}footer{font-size:12px;color:var(--muted);padding-top:40px}summary{cursor:pointer;min-height:40px}a{color:var(--ink)}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #b08444;outline-offset:3px}@media(max-width:620px){header{padding:16px 20px}.tag{display:none}.toolbar{display:grid;grid-template-columns:1fr 1fr;gap:8px}.toolbar button{grid-column:1/-1}.intro{padding-top:18px}.cards{grid-template-columns:1fr}nav{gap:4px}nav button{flex:1 1 auto;padding:11px 10px;font-size:14px}.section-heading{align-items:start;flex-direction:column}.card{padding:18px}.grid{gap:10px}dialog{padding:19px}#save{width:100%;position:sticky;bottom:0}.actions button{flex:1}h2{font-size:26px}}@media print{header,nav,.toolbar,.intro,footer,button,#message{display:none}.cards{display:block}.card{break-inside:avoid}body{background:white}}
@media(max-width:620px){.intro{padding:12px 0 0}.intro h1{font-size:28px;margin:8px 0}.intro h1 br{display:none}.intro h1 em{display:none}.intro .eyebrow{display:none}.intro p{font-size:14px;margin:8px 0}.toolbar{padding:10px 0;gap:4px 10px}.toolbar button{min-height:40px;padding:8px;margin:0}.toolbar input,.toolbar select{margin-bottom:4px}nav{padding:8px 0;gap:2px}nav button{padding:9px;font-size:13px;min-height:44px}.section-heading{margin-top:18px}}

/* Responsive layout: prevent native iOS date controls from stretching grid tracks. */
html{-webkit-text-size-adjust:100%}header .brand{display:flex;align-items:center;gap:16px}header .brand img{width:112px;height:62px;object-fit:contain}header .brand span{font:13px system-ui;letter-spacing:0}.toolbar{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto;gap:16px}.toolbar>*{min-width:0}.toolbar input,.toolbar select{display:block;max-width:100%;min-width:0;width:100%;margin:8px 0 0}.toolbar button{margin:0}input[type=date]{appearance:none;-webkit-appearance:none;min-width:0}input::-webkit-date-and-time-value{text-align:left}nav{flex-wrap:nowrap;overflow-x:auto;gap:6px;scrollbar-width:thin}nav button{white-space:nowrap;flex:0 0 auto}.section-heading{align-items:center;flex-direction:row}.badge{margin:3px 4px 3px 0}.empty{border:1px dashed var(--line);border-radius:16px;background:var(--white);margin:0;width:100%;grid-column:1/-1}.print-panel{background:var(--white);border:1px solid var(--line);border-radius:16px;padding:16px;margin:18px 0}.print-panel summary{font-weight:600}.supplier-options{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;margin:12px 0}.supplier-option{display:flex;align-items:center;gap:10px;border:1px solid var(--line);padding:10px;border-radius:10px;font-weight:400}.supplier-option input{width:20px;min-height:20px;height:20px;flex:0 0 20px;margin:0;accent-color:var(--ink)}.print-panel .actions{margin:8px 0}.print-panel p{margin:8px 0}.toolbar label{font-size:13px}footer{padding-bottom:env(safe-area-inset-bottom)}
@media(max-width:620px){main{padding:0 16px 28px}header{padding:12px 16px}.intro{padding-top:16px}.intro h1{font-size:27px}.intro p{line-height:1.5;margin:8px 0 12px}.toolbar{grid-template-columns:minmax(0,1fr);gap:12px;padding:12px 0 16px}.toolbar button{grid-column:auto;min-height:44px}.toolbar input,.toolbar select{margin:6px 0 0;min-height:48px}nav{margin:0 -16px;padding:10px 16px;position:sticky;top:0;background:var(--cream);z-index:2}nav button{flex:0 0 auto;padding:10px 14px}.section-heading{gap:10px;margin:22px 0 14px}.section-heading h2{font-size:25px}.section-heading>span{white-space:nowrap}.badge{font-size:11px;padding:6px 9px}.card{padding:16px;border-radius:16px}.supplier-options{grid-template-columns:1fr}.print-panel .actions button{flex:1 1 140px}.grid{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}dialog{padding:18px;width:calc(100% - 24px)}.dialog-heading h2{font-size:23px}header .brand img{width:96px;height:52px}}

.product-results{max-height:240px;overflow-y:auto;border:1px solid var(--line);border-radius:12px;background:var(--white);margin:-4px 0 18px;overscroll-behavior:contain}.product-results[hidden]{display:none}.product-option{display:block;width:100%;text-align:left;background:transparent;color:var(--ink);border:0;border-bottom:1px solid var(--line);border-radius:0;padding:13px 16px;font-weight:400;min-height:48px}.product-option:last-child{border-bottom:0}.product-option:hover,.product-option:focus-visible{background:var(--accent);outline-offset:-3px}.product-no-results{padding:16px;margin:0;color:var(--muted)}#productHint{margin:0 0 12px}

@media(max-width:620px){dialog#editor{position:fixed;top:calc(var(--capture-top,0px) + 8px);bottom:auto;margin:0 auto;max-height:calc(var(--capture-height,100dvh) - 16px);padding:14px 16px;overflow-y:auto;border-radius:18px}.dialog-heading{margin-bottom:12px;gap:8px}.dialog-heading h2{font-size:21px}.dialog-heading button{min-height:40px;padding:8px 12px}#productSearch{margin:6px 0 8px}#productHint{font-size:12px;margin-bottom:8px}.product-results{max-height:min(192px,calc(var(--capture-height,100dvh) - 205px));margin-bottom:12px}.product-option{padding:10px 12px;min-height:44px}#editor:has(#productResults:not([hidden])) #save,#editor:has(#productResults:not([hidden])) #save+p{display:none}}
