/* tools.css - shared styles for the free tool pages (loaded only on tool pages, after styles.css and b2b.css).
   Does not change styles.css or b2b.css. */

/* ---------- page frame ---------- */
.tool-page .page-hero{padding:clamp(40px,5vw,72px) 0 clamp(28px,3.5vw,44px)}
.tool-page .page-hero h1{max-width:24ch;font-size:clamp(2rem,4.2vw,3.4rem);margin-bottom:18px}
.tool-page .ai-overview{max-width:74ch;font-size:1.08rem;line-height:1.7;color:#c3cad5;margin:0}
.tool-page .hero-fine{margin-top:14px}
.tool-section{padding:clamp(36px,5vw,64px) 0}
.tool-page .section .container>h2,.tool-page .section-heading h2{font-size:clamp(1.6rem,3vw,2.3rem);line-height:1.15}
.tool-page .prose p{max-width:72ch}
.tool-page .prose h3{margin:28px 0 8px;font-size:1.2rem}
.tool-page .prose h3:first-child{margin-top:0}
.tool-page .prose ul,.tool-page .prose ol{margin:0 0 18px;padding-left:22px;color:var(--muted);line-height:1.75;font-size:1.05rem;max-width:70ch}
.tool-page .prose li+li{margin-top:6px}
.tool-page .prose a,.tool-page .faq-answer a,.t-note a,.t-after a{text-decoration:underline;text-underline-offset:3px}
.tool-page .prose a{color:var(--orange2)}
.tool-page .alt .prose a{color:#c93d00}
.tool-page .prose strong{color:var(--ink)}
.tool-wide{max-width:none!important}

/* ---------- tool layout ---------- */
.tool-layout{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:24px;align-items:start}
.tool-layout>*{min-width:0}
.tool-main{display:grid;gap:18px}
.tool-side{position:sticky;top:calc(var(--header-h) + 16px);display:grid;gap:16px}
@media(max-width:1020px){.tool-layout{grid-template-columns:minmax(0,1fr)}.tool-side{position:static}}

.t-card{background:#fff;border:1px solid #d6dce5;border-radius:12px;padding:clamp(16px,2.4vw,26px);color:#0d1117}
.t-card h2,.t-card h3{margin:0 0 4px;font-size:1.15rem;color:#0d1117}
.t-card .t-sub{margin:0 0 16px;font-size:14px;color:#4a5565}
.t-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px 16px}
.t-grid>*{min-width:0}
.t-grid .t-wide{grid-column:1/-1}
@media(max-width:620px){.t-grid{grid-template-columns:minmax(0,1fr)}}

.t-field{display:flex;flex-direction:column;gap:6px;min-width:0}
.t-lab{font:600 14px/1.3 var(--sans);color:#1c2433}
.t-lab small{font-weight:400;color:#5b6472}
.t-input,.t-field input,.t-field select,.t-field textarea{width:100%;min-height:44px;padding:10px 12px;border:1px solid #b9c2d0;border-radius:8px;background:#fff;color:#0d1117;font:400 16px/1.4 var(--sans);letter-spacing:0}
.t-field textarea{min-height:84px;resize:vertical}
.t-field input::placeholder,.t-field textarea::placeholder{color:#7a8494}
.t-field input:focus-visible,.t-field select:focus-visible,.t-field textarea:focus-visible,.t-card button:focus-visible,.t-card input:focus-visible{outline:3px solid #c93d00;outline-offset:1px;border-color:#c93d00}
.t-field input[aria-invalid="true"]{border-color:#b42318;background:#fff6f5}
.t-hint{font-size:13px;color:#5b6472;margin:0}
.t-err{margin:0;font:600 13px/1.4 var(--sans);color:#b42318}
.t-err[hidden]{display:none}
.t-check{display:flex;gap:10px;align-items:flex-start;font-size:14px;color:#1c2433;line-height:1.4;min-height:44px;padding-top:8px}
.t-check input{width:20px;height:20px;min-height:0;margin:1px 0 0;flex:none;accent-color:#c93d00}
.t-inline{display:flex;gap:8px;align-items:stretch}
.t-inline>input{flex:1;min-width:0}

/* buttons used inside tools (visual style follows .btn) */
.t-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:10px 18px;border-radius:8px;border:1px solid transparent;font:700 15px/1.2 var(--display);cursor:pointer;text-align:center}
.t-btn-primary{background:var(--orange);color:#fff}
.t-btn-primary:hover{background:var(--orange2)}
.t-btn-line{background:transparent;color:#0d1117;border-color:#b9c2d0}
.t-btn-line:hover{border-color:#0d1117}
.t-btn:disabled{opacity:.45;cursor:not-allowed}
.t-btn:focus-visible,.t-icon-btn:focus-visible{outline:3px solid #ffb27d;outline-offset:2px}
.t-sum .t-btn-line{color:#f2f4f7;border-color:#4a5870}
.t-sum .t-btn-line:hover{border-color:#fff}
.t-icon-btn{width:44px;height:44px;border-radius:8px;border:1px solid #b9c2d0;background:#fff;color:#4a5565;font:400 24px/1 var(--sans);cursor:pointer;display:inline-grid;place-items:center}
.t-icon-btn:hover{border-color:#b42318;color:#b42318}

/* logo */
.t-logo-row{display:flex;gap:14px;align-items:center;flex-wrap:wrap}
.t-logo-box{width:140px;height:64px;border:1px dashed #b9c2d0;border-radius:8px;display:grid;place-items:center;background:#f6f8fb;overflow:hidden;font-size:12px;color:#5b6472;padding:4px}
.t-logo-box img{max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain}
.t-logo-row input[type=file]{min-height:0;padding:8px;font-size:14px;max-width:100%}

/* ---------- line items ---------- */
.li-head{display:none}
.li-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 12px;padding:14px;border:1px solid #d6dce5;border-radius:10px;background:#f8fafc;margin-bottom:12px}
.li-row>*{min-width:0}
.li-cell{display:flex;flex-direction:column;gap:5px}
.li-cell input{width:100%;min-height:44px;padding:10px 12px;border:1px solid #b9c2d0;border-radius:8px;background:#fff;color:#0d1117;font:400 16px/1.4 var(--sans)}
.li-cell input[aria-invalid="true"]{border-color:#b42318;background:#fff6f5}
.li-lab{font:600 13px/1.3 var(--sans);color:#1c2433}
.li-lab small{font-weight:400;color:#5b6472}
.li-desc,.li-err{grid-column:1/-1}
.li-amount output{display:flex;align-items:center;min-height:44px;font:700 16px var(--display);color:#0d1117;overflow-wrap:anywhere}
.li-remove{align-items:flex-end;justify-content:flex-end;grid-column:2;grid-row:3}
.li-remove .t-icon-btn{align-self:flex-end}
.li-err{margin-top:-2px}
@media(min-width:900px){
  .li-head,.li-row{display:grid;grid-template-columns:minmax(0,3fr) 84px 118px 96px 118px 44px;gap:10px;align-items:start}
  .li-head{padding:0 14px 8px;font:700 12px/1.2 var(--display);color:#4a5565;text-transform:uppercase;letter-spacing:.04em}
  .li-head span:nth-child(2),.li-head span:nth-child(3),.li-head span:nth-child(4),.li-head span:nth-child(5){text-align:left}
  .li-row{padding:10px 14px}
  .li-lab{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
  .li-desc,.li-err{grid-column:auto}
  .li-err{grid-column:1/-1}
  .li-remove{grid-column:auto;grid-row:auto;align-items:flex-start}
  .li-amount output{min-height:44px}
}

/* ---------- summary panel ---------- */
.t-sum{background:#0d1117;color:#f2f4f7;border-radius:12px;padding:clamp(18px,2.4vw,26px);border:1px solid #243040}
.tool-section .t-sum h3{color:#fff;margin:0 0 14px;font-size:1.1rem}
.t-sum dl{margin:0;display:grid;gap:0}
.t-row{display:flex;justify-content:space-between;gap:14px;padding:8px 0;border-bottom:1px solid #243040;font-size:15px}
.t-row dt{color:#c3cad5;min-width:0;overflow-wrap:anywhere}
.t-row dd{margin:0;font-weight:700;color:#fff;text-align:right;white-space:nowrap}
.t-row.t-total{border-bottom:0;padding-top:12px}
.t-row.t-total dt,.t-row.t-total dd{font-size:1.05rem;color:#fff}
.t-bal{margin:12px 0 0;padding:14px;border-radius:10px;background:#1a2230;border:1px solid #33415a}
.t-bal small{display:block;font:600 13px var(--sans);color:#c3cad5}
.t-bal strong{display:block;font:800 clamp(1.7rem,4vw,2.2rem)/1.15 var(--display);color:var(--orange2);overflow-wrap:anywhere}
.t-blocked{margin:0 0 6px;color:#ffd7c2;font-size:15px}
.tool-section .t-sum p.t-warn{margin:12px 0 0;padding:10px 12px;border-radius:8px;background:#3a2a12;color:#ffe2a8;font-size:14px}
.t-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:16px}
.t-actions .t-btn{width:100%}
.t-actions .t-full{grid-column:1/-1}
.tool-section .t-status{min-height:22px;margin:10px 0 0;font:600 14px/1.4 var(--sans);color:#9fe3b9}
.tool-section .t-save-note{margin:0;font-size:13px;color:#a3adbb}
.t-mini{display:flex;gap:10px;flex-wrap:wrap;margin-top:12px}
.t-link-btn{background:none;border:0;padding:6px 0;color:#c93d00;text-decoration:underline;font:600 14px var(--sans);cursor:pointer;min-height:44px}
.t-sum .t-link-btn{color:#ffb27d}
.t-help{font-size:13px;color:#a3adbb;margin:12px 0 0}
.tool-section .t-sum p.t-help{color:#a3adbb}

.t-note{margin:0;padding:14px 16px;border-left:4px solid #c93d00;background:#fff;border-radius:8px;font-size:14px;line-height:1.6;color:#2b3545}
.tool-section .t-note{color:#2b3545}
.tool-section .t-after{margin:22px 0 0;padding:16px 18px;border-radius:10px;background:#0d1117;color:#e8ecf2;font-size:1rem;line-height:1.55;text-align:center}
.tool-section .t-after a{color:#ffb27d;font-weight:700}

/* ---------- content blocks ---------- */
.formula{margin:0 0 16px;padding:16px 18px;border-radius:10px;background:#0b0f15;border:1px solid #243040;color:#e8ecf2;font:500 14.5px/1.7 var(--mono);overflow-x:auto;white-space:pre-wrap;overflow-wrap:anywhere}
.alt .formula{background:#fff;border-color:#c0c8d4;color:#0d1117}
.formula b{color:var(--orange2)}
.alt .formula b{color:#c93d00}
.t-table-wrap{overflow-x:auto;border:1px solid var(--line2);border-radius:10px;background:var(--card)}
.t-table{width:100%;border-collapse:collapse;font-size:15px;min-width:520px}
.t-table th,.t-table td{padding:11px 14px;text-align:left;border-bottom:1px solid var(--line);vertical-align:top}
.t-table th{font:700 13px var(--display);text-transform:uppercase;letter-spacing:.03em;color:var(--muted)}
.t-table td.n,.t-table th.n{text-align:right;white-space:nowrap}
.t-table tr:last-child td{border-bottom:0}
.t-table tr.em td{font-weight:800;color:var(--ink)}
.ts-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.ts-grid article{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:22px}
.ts-grid h3{font-size:1.08rem;margin:0 0 8px}
.ts-grid p{margin:0;font-size:15.5px;line-height:1.7}
@media(max-width:760px){.ts-grid{grid-template-columns:minmax(0,1fr)}}
.t-checklist{list-style:none;margin:0 0 18px;padding:0;display:grid;gap:8px;max-width:70ch}
.t-checklist li{position:relative;padding:12px 14px 12px 44px;background:var(--card);border:1px solid var(--line);border-radius:10px;color:var(--muted);font-size:15.5px;line-height:1.6}
.t-checklist li::before{content:"\2713";position:absolute;left:14px;top:11px;width:22px;height:22px;border-radius:50%;background:var(--orange);color:#fff;font:700 13px/22px var(--sans);text-align:center}

/* estimate: acceptance block + validity highlight */
.inv-sign{display:grid;grid-template-columns:1fr 1fr;gap:18px 28px;margin-top:26px;break-inside:avoid}
.inv-sign p{margin:0;padding-top:26px;border-top:1px solid #111827;font-size:.85em;color:#4b5563!important}
.inv-valid{margin-top:14px;padding:8px 10px;background:#f3f4f6;border-radius:6px;font-size:.92em;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.inv-totals .r-dep th,.inv-totals .r-dep td{border-top:1px dashed #9ca3af;padding-top:8px}
.inv-totals .r-rem th,.inv-totals .r-rem td{font-weight:700;color:#111827}
@media(max-width:560px){.inv-sign{grid-template-columns:minmax(0,1fr)}}
.t-bal.t-est strong{color:#9fe3b9}

/* four related cards */
.rel-grid.rel-4{grid-template-columns:repeat(4,minmax(0,1fr))}
@media(max-width:1000px){.rel-grid.rel-4{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.rel-grid.rel-4{grid-template-columns:minmax(0,1fr)}}

/* ---------- invoice paper (preview + print) ---------- */
.inv-preview-wrap{background:#fff;border:1px solid #d6dce5;border-radius:12px;padding:clamp(12px,2vw,24px)}
.inv-paper{background:#fff;color:#111827;font:400 13.5px/1.5 Arial,Helvetica,sans-serif;letter-spacing:0;padding:clamp(12px,2.4vw,28px);border:1px solid #e5e7eb;border-radius:8px;max-width:860px;margin:0 auto;overflow-wrap:anywhere}
.inv-paper p{margin:0 0 2px;color:#111827}
.inv-paper a{color:#374151;text-decoration:underline}
.inv-head{display:flex;justify-content:space-between;gap:20px;flex-wrap:wrap;padding-bottom:16px;border-bottom:2px solid #111827;margin-bottom:16px}
.inv-from{min-width:0;flex:1 1 220px}
.inv-logo{max-width:180px;max-height:80px;width:auto;height:auto;margin:0 0 8px;object-fit:contain;display:block}
.inv-biz-name{font-weight:700;font-size:1.1em}
.inv-meta{flex:0 1 250px;min-width:0}
.inv-meta p{display:flex;justify-content:space-between;gap:12px}
.inv-meta span{color:#4b5563}
.inv-title{font:800 1.9em/1.1 Arial,Helvetica,sans-serif!important;letter-spacing:.04em;justify-content:flex-end!important;margin-bottom:8px!important}
.inv-label{font-weight:700;font-size:.82em;text-transform:uppercase;letter-spacing:.06em;color:#4b5563!important;margin-bottom:4px!important}
.inv-bill{margin-bottom:18px}
.inv-scroll{overflow-x:auto}
.inv-lines,.inv-totals{width:100%;border-collapse:collapse}
.inv-lines th{background:#f3f4f6;font-size:.84em;text-transform:uppercase;letter-spacing:.04em;color:#374151;padding:8px 8px;text-align:left;border-bottom:1px solid #d1d5db;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.inv-lines td{padding:9px 8px;border-bottom:1px solid #e5e7eb;vertical-align:top}
.inv-lines .n{text-align:right;white-space:nowrap}
.inv-lines th.n{text-align:right}
.inv-lines td.d{overflow-wrap:anywhere;min-width:90px}
.inv-dim{color:#6b7280}
.inv-totals{width:min(100%,330px);margin:14px 0 0 auto}
.inv-totals th{font-weight:400;text-align:left;padding:5px 8px;color:#374151}
.inv-totals td{text-align:right;padding:5px 8px;white-space:nowrap}
.inv-totals .r-total th,.inv-totals .r-total td{font-weight:700;border-top:1px solid #111827;color:#111827;padding-top:8px}
.inv-totals .r-bal th,.inv-totals .r-bal td{font-weight:800;font-size:1.15em;background:#f3f4f6;color:#111827;-webkit-print-color-adjust:exact;print-color-adjust:exact}
.inv-notes{margin-top:22px;display:grid;gap:12px}
.inv-note p:not(.inv-label){white-space:normal}
.inv-empty{padding:24px;text-align:center;color:#6b7280!important}
.inv-frame{width:100%;border-collapse:collapse;border-spacing:0}
.inv-frame>tbody>tr>td,.inv-frame>tfoot>tr>td{padding:0;border:0;vertical-align:top;background:transparent}
.inv-paper .pdf-gen{margin:26px 0 0;padding-top:10px;border-top:1px solid #e5e7eb;text-align:center;font-size:11px;color:#6b7280}
.inv-paper .pdf-gen a{color:#4b5563}
@media(max-width:560px){
  .inv-paper{font-size:12px;padding:12px}
  .inv-lines th,.inv-lines td{padding:7px 4px}
  .inv-meta{flex-basis:100%}
  .inv-title{justify-content:flex-start!important}
}
.print-root{display:none}

/* ---------- print: only the invoice, no site chrome ---------- */
@media print{
  @page{margin:12mm}
  html,body{background:#fff!important;color:#111827!important}
  body>*:not(.print-root){display:none!important}
  .print-root{display:block!important}
  .print-root .inv-paper{border:0;border-radius:0;padding:0;max-width:none;font-size:10.5pt;line-height:1.45}
  .print-root .inv-frame>tfoot{display:table-footer-group}
  .print-root .inv-frame>tbody{display:table-row-group}
  .print-root .inv-scroll{overflow:visible}
  .print-root .inv-lines tr,.print-root .inv-totals,.print-root .inv-note,.print-root .inv-head{break-inside:avoid}
  .print-root .inv-lines thead{display:table-header-group}
  .print-root .pdf-gen{margin:6mm 0 0;padding-top:2mm;font-size:8.5pt;color:#6b7280}
  .print-root a{color:#374151}
}

/* ---------- profit margin calculator ---------- */
.pm-modes{border:0;margin:0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.pm-mode{position:relative;display:block;min-width:0}
.pm-mode input{position:absolute;opacity:0;width:1px;height:1px;margin:0;pointer-events:none}
.pm-mode span{display:flex;align-items:center;min-height:56px;padding:12px 14px;border:1px solid #b9c2d0;border-radius:10px;background:#fff;color:#0d1117;font:700 15px/1.3 var(--display);cursor:pointer}
.pm-mode span small{display:block;font:400 13px/1.4 var(--sans);color:#4a5565;margin-top:2px}
.pm-mode input:checked+span{border-color:#c93d00;background:#fff4ec;box-shadow:inset 0 0 0 1px #c93d00}
.pm-mode input:focus-visible+span{outline:3px solid #c93d00;outline-offset:2px}
@media(max-width:560px){.pm-modes{grid-template-columns:minmax(0,1fr)}}
.t-bal.t-pm small{margin-bottom:2px}
.pm-explain{margin:14px 0 0;font-size:14.5px;line-height:1.6;color:#e1e6ee;overflow-wrap:anywhere}
.tool-section .t-sum p.pm-row-note{margin:4px 0 6px;font-size:13px}
.pm-lines th[scope="row"]{background:transparent;text-transform:none;letter-spacing:0;font-size:1em;font-weight:600;color:#111827;border-bottom:1px solid #e5e7eb;padding:9px 8px}
.pm-lines tr.em th,.pm-lines tr.em td{font-weight:800}
.pm-note{display:block;margin-top:2px;font-weight:400;font-size:.88em;color:#6b7280}
.inv-paper .pm-title{font-size:1.35em!important}
.pm-ref td.n,.pm-ref th.n{text-align:right}
.t-table.pm-ref{min-width:0}
@media(max-width:560px){.t-table.pm-ref th,.t-table.pm-ref td{padding:10px 8px;font-size:14px}.t-table.pm-ref th{font-size:11px}}
.t-table.pm-ref th.n,.t-table.pm-ref td.n{white-space:normal}
.tool-section .t-sum p.pm-explain{color:#e1e6ee}
