/* Invoice Generator - per-tool styles (form pane + live invoice preview +
 * the print stylesheet that turns the preview into the PDF page). */

.inv-layout { display: grid; grid-template-columns: minmax(320px, 5fr) minmax(380px, 6fr); gap: 20px; align-items: start; }
.inv-intro { margin: 0 0 14px; color: #475569; font-size: 0.95rem; line-height: 1.5; }

/* ---- Form pane ---- */
.inv-form-card { background: #fff; border: 1px solid #e6e8eb; border-radius: 14px; padding: 18px 20px; }
.inv-section-title { font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; color: #962F2E; margin: 18px 0 8px; }
.inv-section-title:first-child { margin-top: 0; }
.inv-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.inv-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.inv-field-label { font-weight: 600; font-size: 0.8rem; color: #334155; }
.inv-input, .inv-select, .inv-textarea {
    width: 100%; box-sizing: border-box; font: inherit; font-size: 0.9rem; padding: 8px 10px;
    border: 1px solid #d7dbe0; border-radius: 8px; background: #fff; color: #1f2937;
    flex: 0 0 auto;
}
.inv-textarea { min-height: 56px; resize: vertical; }
.inv-input:focus, .inv-select:focus, .inv-textarea:focus { outline: 2px solid #962F2E; border-color: #962F2E; }

.inv-item-row {
    display: grid; grid-template-columns: 1fr 64px 88px 84px 28px;
    gap: 8px; align-items: center; margin-bottom: 8px;
}
.inv-item-amount { font-size: 0.85rem; color: #475569; text-align: right; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.inv-item-remove {
    border: 0; background: none; color: #94a3b8; font-size: 1.2rem; cursor: pointer;
    line-height: 1; padding: 4px; border-radius: 6px;
}
.inv-item-remove:hover { color: #b91c1c; background: #fef2f2; }
.inv-add-btn { margin-top: 2px; }

.inv-logo-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.inv-logo-row input[type="file"] { font-size: 0.85rem; }
.inv-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ---- Invoice preview ---- */
.inv-preview-wrap { position: sticky; top: 16px; }
.inv-paper {
    background: #fff; border: 1px solid #e2e6ea; border-radius: 10px;
    box-shadow: 0 8px 26px rgba(15, 23, 42, 0.08);
    padding: 34px 38px; min-height: 540px;
    font-size: 0.9rem; color: #1f2937; line-height: 1.5;
}
.inv-p-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 26px; }
.inv-p-title { font-size: 1.7rem; font-weight: 800; letter-spacing: 0.06em; color: #0f172a; margin: 0 0 4px; }
.inv-p-meta { color: #475569; font-size: 0.85rem; }
.inv-p-meta strong { color: #1f2937; }
#inv-p-logo { max-width: 160px; max-height: 72px; object-fit: contain; }
#inv-p-logo[hidden] { display: none; }

.inv-p-parties { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.inv-p-party { min-width: 0; max-width: 46%; }
.inv-p-party-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; margin-bottom: 4px; }
.inv-p-party-name { font-weight: 700; color: #0f172a; }
.inv-p-party-sub { color: #475569; font-size: 0.85rem; overflow-wrap: break-word; }

.inv-p-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.inv-p-table th {
    text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em;
    color: #64748b; border-bottom: 2px solid #e2e8f0; padding: 6px 8px;
}
.inv-p-table th.inv-num, .inv-p-table td.inv-num { text-align: right; font-variant-numeric: tabular-nums; }
.inv-p-table td { padding: 8px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.inv-empty-row { color: #94a3b8; font-style: italic; }

.inv-p-totals { margin-left: auto; width: 240px; max-width: 100%; }
.inv-p-totals .inv-trow { display: flex; justify-content: space-between; gap: 12px; padding: 4px 8px; font-variant-numeric: tabular-nums; }
.inv-p-totals .inv-trow[hidden] { display: none; }
.inv-p-totals .inv-trow--total { border-top: 2px solid #e2e8f0; margin-top: 4px; padding-top: 8px; font-weight: 800; font-size: 1.05rem; color: #0f172a; }

.inv-p-notes-wrap { margin-top: 22px; border-top: 1px solid #f1f5f9; padding-top: 12px; }
.inv-p-notes-wrap[hidden] { display: none; }
.inv-p-notes-label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #94a3b8; margin-bottom: 4px; }
#inv-p-notes { color: #475569; font-size: 0.85rem; }
#inv-p-due-wrap[hidden] { display: none; }

@media (max-width: 900px) {
    .inv-layout { grid-template-columns: 1fr; }
    .inv-preview-wrap { position: static; }
    .inv-paper { padding: 22px 20px; }
}
@media (max-width: 560px) {
    .inv-grid2 { grid-template-columns: 1fr; }
    .inv-item-row { grid-template-columns: 1fr 52px 72px 24px; }
    .inv-item-amount { display: none; }
}

/* ---- Print: the page becomes the invoice, nothing else. ---- */
@media print {
    @page { margin: 0.6in; }
    body * { visibility: hidden; }
    #inv-preview, #inv-preview * { visibility: visible; }
    #inv-preview { position: absolute; left: 0; top: 0; width: 100%; }
    .inv-paper { border: 0; box-shadow: none; border-radius: 0; padding: 0; min-height: 0; }
    /* Belt and braces: kill sticky/fixed chrome that could still paint. */
    .site-header, .page-hero, .site-footer, .toasts, .tool-info, .related-tools { display: none !important; }
}
