/* Invoice PDF Creator landing page (/tools/invoice-pdf-creator): the working form sits in the hero.
   Layers on market-tools.css + browser-tool.css; used by this page only. */

.tp-inv .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}

/* Head */
.tp-inv-top{max-width:860px;margin:0 0 22px}
.tp-inv-top h1{margin:6px 0 12px}
.tp-inv-lead{margin:0 0 16px;font-size:1.06rem;line-height:1.6;color:var(--muted,#52647b);max-width:720px}
.tp-inv-meta{display:flex;flex-wrap:wrap;align-items:center;gap:10px 22px}
.tp-inv-badge{margin:0;display:inline-flex;align-items:center;min-height:34px;padding:4px 14px;border-radius:999px;background:#e7f5ee;color:#075c3a;font-weight:700;font-size:.88rem;border:1px solid #b9e2cd}
.tp-inv-sublinks{margin:0;display:flex;flex-wrap:wrap;gap:4px 18px}
.tp-inv-sublinks a{display:inline-flex;align-items:center;min-height:40px;color:var(--blue,#1f5cf0);font-weight:700;text-decoration:underline;text-underline-offset:3px}
@media (min-width:1080px){.tp-inv-sublinks a.tp-inv-jump{display:none}}
.tp-inv-sublinks a:focus-visible{outline:2px solid #1769ff;outline-offset:2px;border-radius:4px}

/* Tool grid */
.tp-inv-tool{display:grid;grid-template-columns:minmax(0,1fr);gap:20px;align-items:start;margin:0 0 40px}
@media (min-width:1080px){
  .tp-inv-tool{grid-template-columns:minmax(0,1.05fr) minmax(0,.95fr)}
}
.tp-inv .bt-panel{min-width:0;box-shadow:0 10px 30px rgba(7,27,53,.06)}
.tp-inv-h2{margin:30px 0 10px;font-size:1.02rem}
.tp-inv-form>.tp-inv-h2:first-child{margin-top:0}
.tp-inv-form label{margin-top:10px}
.tp-inv-form textarea{min-height:128px;font-family:inherit;font-size:.93rem}
.tp-inv-form input[type=text],.tp-inv-form input[type=number],.tp-inv-form input[type=date],.tp-inv-form select{min-height:44px}
.tp-inv-pair{display:grid;grid-template-columns:minmax(0,1fr);gap:0 16px}
.tp-inv-fields{display:grid;grid-template-columns:minmax(0,1fr);gap:0 14px}
@media (min-width:560px){
  .tp-inv-pair{grid-template-columns:repeat(2,minmax(0,1fr))}
  .tp-inv-fields{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (min-width:1080px){
  .tp-inv-fields{grid-template-columns:repeat(3,minmax(0,1fr))}
}
.tp-inv .bt-note{font-size:.84rem;line-height:1.5}
.tp-inv .bt-panel .bt-radio{display:flex;align-items:center;gap:10px;min-height:36px;margin:0 0 4px;font-size:.92rem;font-weight:500}
.tp-inv .bt-radio input{width:18px;height:18px}
#d-val{max-width:220px}

/* Editable line items */
.tp-inv-items{margin-top:4px;table-layout:fixed}
.tp-inv-items td{font-family:inherit;word-break:normal;padding:6px 4px;vertical-align:middle}
.tp-inv-items th{padding:6px 4px}
.tp-inv-items th:nth-child(1){width:auto}
.tp-inv-items th:nth-child(2),.tp-inv-items th:nth-child(4){width:64px}
.tp-inv-items th:nth-child(3){width:96px}
.tp-inv-items th:nth-child(5){width:92px;text-align:right}
.tp-inv-items th:nth-child(6){width:78px}
.tp-inv-items td[data-total]{text-align:right;font-variant-numeric:tabular-nums;font-size:.84rem;overflow-wrap:anywhere}
.tp-inv-items input{padding:8px 8px !important;font-size:.9rem !important}
.tp-inv .bt-copy{min-height:40px;padding:6px 10px}
.tp-inv .bt-copy:focus-visible{outline:2px solid #1769ff;outline-offset:2px}

@media (max-width:759px){
  .tp-inv-items thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
  .tp-inv-items,.tp-inv-items tbody{display:block;width:100%}
  .tp-inv-items tr{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;padding:12px 0;border-bottom:1px solid var(--line,#d7e1ee)}
  .tp-inv-items td{display:block;padding:0;border:0}
  .tp-inv-items td:nth-child(1){grid-column:1/-1}
  .tp-inv-items td:nth-child(5){grid-column:1/3;align-self:center;text-align:left;font-weight:700}
  .tp-inv-items td:nth-child(6){justify-self:end}
  .tp-inv-items td:nth-child(-n+4)::before{display:block;margin:0 0 4px;font-size:.72rem;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--muted,#52647b)}
  .tp-inv-items td:nth-child(1)::before{content:"Description"}
  .tp-inv-items td:nth-child(2)::before{content:"Qty"}
  .tp-inv-items td:nth-child(3)::before{content:"Unit price"}
  .tp-inv-items td:nth-child(4)::before{content:"Tax %"}
  .tp-inv-items td:nth-child(5)::before{content:"Line total ";font-weight:600;color:var(--muted,#52647b)}
}

/* Preview */
.tp-inv-preview{background:#eef3fa}
.tp-inv-preview-head .tp-inv-h2{margin:0 0 12px}
.tp-inv-actions{display:flex;flex-wrap:wrap;gap:10px}
.tp-inv-actions .mt-primary,.tp-inv-actions .mt-secondary{flex:0 1 auto;min-height:44px;padding:10px 16px}
.tp-inv-actions #btn-print{min-width:160px}
.tp-inv-hint{margin:10px 0 14px !important;font-size:.84rem;line-height:1.5;color:var(--muted,#52647b)}
.tp-inv-sheet{background:#fff;color:#101828;border:1px solid var(--line,#d7e1ee);border-radius:6px;padding:26px 24px;box-shadow:0 6px 18px rgba(7,27,53,.08);font-size:.88rem;line-height:1.5}
.tp-inv-sheet h3{margin:0 0 4px;font-size:1.02rem}
.tp-inv-sheet p{margin:0 0 14px}
.tp-inv-sheet>div:first-child h3{font-size:1.2rem}
.tp-inv-sheet .bt-copy{display:none}
.tp-inv-sheet .bt-out{background:none;border:0;border-radius:0;gap:0;grid-template-columns:minmax(0,1fr) auto;margin:0 0 16px}
.tp-inv-sheet .bt-out dt,.tp-inv-sheet .bt-out dd{background:none;padding:4px 0;border-bottom:1px solid #edf1f6}
.tp-inv-sheet .bt-out dt{text-transform:none;letter-spacing:0;font-size:.84rem;font-weight:600;color:#475467}
.tp-inv-sheet .bt-out dd{justify-content:flex-end;text-align:right;padding-left:12px}
.tp-inv-sheet .bt-out dd>span{font-family:inherit;font-size:.86rem;word-break:normal;font-variant-numeric:tabular-nums}
.tp-inv-sheet .bt-out:last-of-type{max-width:340px;margin-left:auto}
.tp-inv-sheet .bt-out:last-of-type dt:last-of-type,.tp-inv-sheet .bt-out:last-of-type dd:last-of-type{border-bottom:0;border-top:2px solid #101828;padding-top:8px;font-weight:800;color:#101828}
.tp-inv-sheet .bt-out:last-of-type dd:last-of-type>span{font-size:1rem;font-weight:800}
.tp-inv-sheet .bt-table{margin:4px 0 16px;font-size:.78rem}
.tp-inv-sheet .bt-table th,.tp-inv-sheet .bt-table td{padding:6px 5px}
.tp-inv-sheet .bt-table th{font-size:.66rem;color:#475467}
.tp-inv-sheet .bt-table td{font-family:inherit;word-break:normal;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.tp-inv-sheet .bt-table th:nth-child(n+2),.tp-inv-sheet .bt-table td:nth-child(n+2){text-align:right;white-space:nowrap;overflow-wrap:normal}
@media (max-width:520px){
  .tp-inv-sheet{padding:18px 12px}
  .tp-inv-sheet .bt-table th:nth-child(5),.tp-inv-sheet .bt-table td:nth-child(5){display:none}
  .tp-inv-sheet .bt-table th,.tp-inv-sheet .bt-table td{padding:5px 3px;font-size:.72rem}
  .tp-inv-sheet .bt-table th{white-space:normal;font-size:.6rem}
  .tp-inv-preview.bt-panel{padding:16px 12px}
}
@media (max-width:400px){
  .tp-inv-sheet{padding:14px 8px}
  .tp-inv-sheet .bt-table th:nth-child(3),.tp-inv-sheet .bt-table td:nth-child(3){display:none}
  .tp-inv-actions .mt-primary,.tp-inv-actions .mt-secondary{flex:1 1 100%}
}

/* Import */
.tp-inv-import{margin-top:40px}
.tp-inv-import>p{max-width:720px;color:var(--muted,#52647b);line-height:1.6}
.tp-inv-import-grid{display:grid;grid-template-columns:minmax(0,1fr);gap:20px;align-items:start}
@media (min-width:900px){.tp-inv-import-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
.tp-inv-import label{display:block;font-size:.86rem;font-weight:700;margin:0 0 6px}
.tp-inv-import textarea{width:100%;box-sizing:border-box;min-height:120px;padding:10px 12px;border:1px solid var(--line,#d7e1ee);border-radius:9px;font:.86rem/1.5 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;background:#fff;color:inherit;resize:vertical}
.tp-inv-import textarea:focus-visible{outline:2px solid #1769ff;outline-offset:2px}
.tp-inv-import .wt-drop{margin:0;max-width:none}

/* What you get */
.tp-inv-facts{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:minmax(0,1fr);gap:14px}
@media (min-width:700px){.tp-inv-facts{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (min-width:1080px){.tp-inv-facts{grid-template-columns:repeat(3,minmax(0,1fr))}}
.tp-inv-facts li{display:grid;gap:6px;align-content:start;padding:18px;border:1px solid var(--line,#d7e1ee);border-radius:14px;background:#fff}
.tp-inv-facts b{font-size:1rem;color:var(--ink,#071b35)}
.tp-inv-facts span{color:var(--muted,#52647b);line-height:1.55;font-size:.93rem}

@media (prefers-reduced-motion:reduce){
  .tp-inv *{transition:none !important;scroll-behavior:auto !important}
}

/* Print: only the invoice sheet */
@media print{
  @page{size:A4;margin:16mm 14mm 18mm}
  html,body{background:#fff !important}
  body{font-size:11pt}
  body>*:not(main){display:none !important}
  main.tp-inv{max-width:none;margin:0;padding:0}
  main.tp-inv>*:not(.tp-inv-tool){display:none !important}
  .tp-inv-tool{display:block;margin:0}
  .tp-inv-tool>*:not(#invoice-sheet){display:none !important}
  #invoice-sheet{position:static;max-height:none;overflow:visible;border:0;border-radius:0;padding:0;margin:0;background:#fff;box-shadow:none}
  .tp-inv-preview-head{display:none !important}
  .tp-inv-sheet{border:0;box-shadow:none;padding:0;font-size:10pt;color:#000}
  .tp-inv-sheet .bt-table th:nth-child(5),.tp-inv-sheet .bt-table td:nth-child(5){display:table-cell}
  .tp-inv-sheet .bt-table th,.tp-inv-sheet .bt-table td{font-size:9.5pt;color:#000;border-bottom:1px solid #999}
  .tp-inv-sheet tr,.tp-inv-sheet .bt-out{break-inside:avoid;page-break-inside:avoid}
}
