/* /invoices: list, editor and the printable invoice. */
[hidden]{display:none!important}
.inv-page{padding:0 44px 96px;color:#34442f}
.inv-state{max-width:620px;margin:80px auto;padding:40px;border:1px solid #dedfcd;border-radius:16px;background:#fffdf7b3;text-align:center}
.inv-state h1{margin:0 0 12px;font-family:'Instrument Serif',Georgia,serif;font-weight:400;font-size:38px;line-height:1.15;letter-spacing:-.4px;color:#2f362c}
.inv-state p{margin:0 0 22px;font-size:14px;line-height:1.7;color:#6f7562}
.inv-head{display:flex;align-items:flex-end;justify-content:space-between;gap:24px;padding:64px 0 30px}
.inv-head h1{margin:0;font-family:'Instrument Serif',Georgia,serif;font-weight:400;font-size:clamp(44px,5vw,66px);line-height:1.05;letter-spacing:-.8px;color:#2f362c}
.inv-head h1 em{color:#737f4e}
.inv-eyebrow{margin:0 0 12px;font-size:10px;letter-spacing:1.4px;color:#7e876d}
.inv-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:40px;padding:0 18px;border:1px solid #a9b093;border-radius:30px;background:transparent;font:inherit;font-size:12px;font-weight:500;color:#34442f;cursor:pointer;white-space:nowrap;text-decoration:none}
.inv-btn:hover{background:#ecebd7}
.inv-btn.primary{border-color:#2f362c;background:#2f362c;color:#fbf5e9}
.inv-btn.primary:hover{background:#4f6041}
.inv-btn:disabled{opacity:.5;cursor:default}
.inv-link{padding:0;border:0;background:none;font:inherit;font-size:12px;color:#5d6b3f;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.inv-link.danger{color:#8c3933}
.inv-error{margin:0 0 18px;padding:10px 14px;border:1px solid #e6c8ba;border-radius:8px;background:#f6e9df;font-size:12px;color:#8c3933}
.inv-notice{margin:0 0 18px;padding:12px 16px;border:1px solid #e5dcb4;border-radius:10px;background:#f5efda99;font-size:12px;line-height:1.7;color:#6c6a4f}

/* List */
.inv-table{width:100%;border-collapse:collapse;font-size:13px}
.inv-table th{padding:10px 12px;border-bottom:1px solid #dedfcd;font-size:9px;font-weight:500;letter-spacing:1.2px;text-align:start;text-transform:uppercase;color:#7e876d}
.inv-table td{padding:15px 12px;border-bottom:1px solid #e6e6d6}
.inv-table tbody tr{cursor:pointer}
.inv-table tbody tr:hover,.inv-table tbody tr:focus{background:#f6f4e8;outline:none}
.inv-table .num{text-align:end;white-space:nowrap}
.inv-empty{padding:48px 24px;border:1px dashed #c4cbb1;border-radius:14px;text-align:center}
.inv-empty h2{margin:0 0 8px;font-family:'Instrument Serif',Georgia,serif;font-weight:400;font-size:30px;line-height:1.2;letter-spacing:-.3px}
.inv-empty p{margin:0;font-size:13px;color:#6f7562}
.inv-row-actions{width:44px;text-align:end}
.inv-row-delete{display:inline-grid;place-items:center;width:32px;height:32px;padding:0;border:1px solid transparent;border-radius:8px;background:transparent;color:#8a927b;cursor:pointer}
.inv-row-delete svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.inv-row-delete:hover,.inv-row-delete:focus-visible{border-color:#e6c8ba;background:#f6e9df;color:#8c3933}
.inv-toast{position:fixed;left:50%;bottom:24px;z-index:20;display:flex;align-items:center;gap:16px;padding:12px 14px 12px 18px;border-radius:12px;background:#2f362c;font-size:13px;color:#fbf5e9;box-shadow:0 10px 30px -10px #2f362c99;transform:translateX(-50%)}
.inv-toast-undo{padding:6px 12px;border:1px solid #fbf5e955;border-radius:30px;background:transparent;font:inherit;font-size:12px;font-weight:600;color:#f0cf5a;cursor:pointer}
.inv-toast-undo:hover{background:#fbf5e91a}
.visually-hidden{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.inv-badge{display:inline-block;padding:2px 9px;border:1px solid #c4c8b3;border-radius:30px;font-size:10px;font-weight:500}
.inv-badge.is-final{border-color:#bdcba0;background:#e8edcf;color:#5e7443}
.inv-badge.is-draft{border-color:#e5dcb4;background:#f5efda;color:#7d7c60}

/* Editor */
.inv-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:14px 20px;padding:34px 0 22px}
.inv-back{padding:0;border:0;background:none;font:inherit;font-size:12px;color:#5f6a50;cursor:pointer}
.inv-toolbar-title{display:flex;flex:1;flex-wrap:wrap;align-items:center;gap:10px;min-width:0}
.inv-toolbar-title strong{font-size:20px;font-weight:600;color:#2f362c}
.inv-saved{font-size:11px;color:#8a927b}
.inv-actions{display:flex;flex-wrap:wrap;gap:8px}
.inv-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);gap:28px;align-items:start}
.inv-form{display:flex;flex-direction:column;gap:16px;min-width:0}
.inv-fieldset{display:flex;flex-direction:column;gap:16px;min-width:0;margin:0;padding:0;border:0}
.inv-card{padding:22px;border:1px solid #dedfcd;border-radius:14px;background:#fffdf7}
.inv-card h2{margin:0 0 14px;font-family:'DM Sans',sans-serif;font-size:14px;font-weight:600;line-height:1.4;letter-spacing:0;color:#2f362c}
.inv-card-head{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-bottom:14px}
.inv-card-head h2{margin:0}
.inv-ai{border-color:#cfd6b4;background:linear-gradient(180deg,#f6f7ec,#fffdf7)}
.inv-help{margin:-6px 0 12px;font-size:12px;line-height:1.6;color:#6f7562}
.inv-row-actions{display:flex;flex-wrap:wrap;align-items:center;gap:12px;margin-top:10px}
.inv-ai-status{font-size:12px;color:#5f6a50}
.inv-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 14px}
.inv-fields:empty{display:none}
.inv-fields+.inv-fields{margin-top:12px}
.inv-field{display:flex;flex-direction:column;gap:5px;min-width:0;font-size:11px;font-weight:500;color:#4b5243}
.inv-field.wide{grid-column:1/-1}
.inv-field small{font-size:10px;font-weight:400;line-height:1.5;color:#8a927b}
.inv-page input,.inv-page select,.inv-page textarea{width:100%;min-width:0;padding:9px 11px;border:1px solid #d4d9c1;border-radius:8px;background:#fff;font:inherit;font-size:13px;font-weight:400;color:#2f362c}
.inv-page textarea{resize:vertical;line-height:1.5}
.inv-page input:focus,.inv-page select:focus,.inv-page textarea:focus{border-color:#5d7048;outline:3px solid #5d70482e}
.inv-page .is-missing{border-color:#d9a43b;background:#fffaf0}
.req{color:#b5732b;font-weight:600}
.inv-fieldset:disabled{opacity:.75}
.inv-items-head,.inv-item{display:grid;grid-template-columns:minmax(0,1fr) 64px 92px 74px 92px 26px;gap:8px;align-items:center}
.inv-items-head{margin-bottom:6px;font-size:9px;letter-spacing:1px;text-transform:uppercase;color:#7e876d}
.inv-item{margin-bottom:8px}
.inv-item-total{font-size:12px;text-align:end;white-space:nowrap;color:#4b5243}
.inv-item-remove{width:26px;height:26px;padding:0;border:0;border-radius:50%;background:#ecebd7;font-size:15px;line-height:1;color:#5f6a50;cursor:pointer}
.inv-presets{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:10px}
.inv-presets:empty{display:none}
.inv-chip{padding:5px 11px;border:1px solid #cfd6b4;border-radius:30px;background:#f6f7ec;font:inherit;font-size:11px;color:#4d5a3b;cursor:pointer}

/* Side: required fields, checks and the live invoice */
.inv-side{position:sticky;top:20px;display:flex;flex-direction:column;gap:14px;min-width:0}
.inv-required{padding:14px 16px;border-radius:12px;font-size:12px;line-height:1.6}
.inv-required.has-missing{border:1px solid #ecd9a5;background:#fdf6e3;color:#6c5a2b}
.inv-required.is-complete{border:1px solid #c5d1ad;background:#eef2df;color:#526538}
.inv-required ul{display:flex;flex-wrap:wrap;gap:4px 14px;margin:6px 0 0;padding:0;list-style:none}
.inv-required .inv-link{color:#8a5a1d}
.inv-issues{padding:14px 16px;border:1px solid #dedfcd;border-radius:12px;background:#fffdf7;font-size:12px}
.inv-issues .inv-card-head{margin-bottom:8px}
.inv-issues ul{margin:0;padding:0;list-style:none}
.inv-issues li{padding:7px 0;border-top:1px solid #ecebdd;line-height:1.6;color:#4b5243}
.inv-issues li b{margin-right:4px}
.inv-issues li.is-error b{color:#8c3933}
.inv-issues li.is-warning b{color:#a8701f}
.inv-issues li.is-tip b{color:#5e7443}
.inv-disclaimer{margin:0;font-size:11px;line-height:1.6;color:#8a927b}
.inv-side>.inv-link.danger{align-self:flex-start}

/* The invoice itself (also what gets printed). */
.inv-paper-wrap{overflow:auto;border-radius:6px;box-shadow:0 1px 3px #2f362c1f,0 12px 32px -18px #2f362c59}
.inv-paper{min-height:560px;padding:40px 40px 34px;background:#fff;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif;font-size:11px;line-height:1.5;color:#1f241c}
.paper-head{display:flex;justify-content:space-between;gap:24px;margin-bottom:28px}
.paper-head h3{margin:0 0 12px;font-size:26px;font-weight:700;letter-spacing:-.5px}
.paper-meta div{display:flex;gap:10px}
.paper-meta span{min-width:110px;color:#6f7562}
.paper-seller{max-width:48%;text-align:end}
.paper-seller strong,.paper-to strong{display:block;font-size:12px}
.paper-to{margin-bottom:24px}
.paper-to>span,.paper-notes>span{display:block;margin-bottom:3px;font-size:9px;letter-spacing:1px;text-transform:uppercase;color:#6f7562}
.pre{white-space:pre-line}
.paper-lines{width:100%;margin-bottom:16px;border-collapse:collapse}
.paper-lines th{padding:7px 6px;border-bottom:1.5px solid #1f241c;font-size:9px;font-weight:600;letter-spacing:.6px;text-align:start;text-transform:uppercase}
.paper-lines td{padding:8px 6px;border-bottom:1px solid #e3e3dc;vertical-align:top}
.paper-lines .num{text-align:end;white-space:nowrap}
.paper-empty{color:#9a9e93;text-align:center}
.paper-totals{width:260px;margin-inline-start:auto}
.paper-totals div{display:flex;justify-content:space-between;gap:12px;padding:4px 6px}
.paper-total{margin-top:4px;border-top:1.5px solid #1f241c;font-size:13px;font-weight:700}
.paper-notes{margin-top:26px;padding-top:12px;border-top:1px solid #e3e3dc}

@media(max-width:1100px){.inv-page{padding:0 30px 80px}.inv-grid{grid-template-columns:1fr}.inv-side{position:static}}
@media(max-width:760px){
  .inv-page{padding:0 16px 56px}
  .inv-head{flex-direction:column;align-items:flex-start;padding:44px 0 22px}
  .inv-table thead{display:none}
  .inv-table tr{display:grid;grid-template-columns:1fr auto;padding:12px 0;border-bottom:1px solid #e6e6d6}
  .inv-row-actions{grid-column:2;grid-row:1}
  .inv-table td{padding:2px 0;border:0}
  .inv-fields{grid-template-columns:1fr}
  .inv-items-head{display:none}
  .inv-item{grid-template-columns:1fr 1fr 26px;padding-bottom:8px;border-bottom:1px solid #ecebdd}
  .inv-item [data-item="description"]{grid-column:1/-1}
  .inv-item-total{grid-column:1/3;text-align:start}
  .inv-paper{padding:24px 18px;font-size:10px}
  .paper-head{flex-direction:column}
  .paper-seller{max-width:none;text-align:start}
}

/* The copy rendered into the downloaded PDF (page margins come from the PDF itself). */
.inv-paper.is-pdf{min-height:0;padding:0;font-size:11px}

/* Printing (⌘P, or the fallback when the PDF library cannot load): only the invoice, on an A4 page. */
@page{size:A4;margin:14mm}
@media print{
  body{background:#fff}
  .site-shell{overflow:visible!important}
  .site-shell>header,.site-shell>footer,.page-light,body>dialog,#invoicePrint,#inv-loading,#inv-locked,#inv-list,.inv-toolbar,.inv-error,.inv-notice,.inv-form,.inv-required,.inv-issues,.inv-disclaimer,#inv-delete,.inv-toast{display:none!important}
  .inv-page{padding:0}
  .inv-grid{display:block}
  .inv-side{position:static;display:block}
  .inv-paper-wrap{overflow:visible;box-shadow:none}
  .inv-paper{min-height:0;padding:0;font-size:10pt}
  .paper-lines tr,.paper-totals,.paper-notes{break-inside:avoid}
}
