.ad-slot,.ad-leaderboard,.ad-in-article,.ad-anchor,.ad-placeholder,[class*='ad-slot']{display:none!important;width:0!important;height:0!important;margin:0!important;padding:0!important;}

.tool-hero {
  background: linear-gradient(135deg, #0f172a 0%, #4338ca 100%);
  padding: 3rem 1.5rem 2.5rem; text-align: center; color: #fff;
}
.tool-hero h1 { font-size: 2rem; font-weight: 800; color: #fff !important; line-height: 1.25; margin: 0 auto 0.5rem; max-width: 720px; }
.tool-hero p { color: rgba(255,255,255,0.9); font-size: 1rem; max-width: 600px; margin: 0 auto; }
.tool-badge {
  display: inline-flex; align-items: center; gap: 0.4rem; background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.28); border-radius: 50px; padding: 0.3rem 0.9rem; font-size: 0.8rem; color: #fff; margin-bottom: 1rem;
}

.tool-page { max-width: 1220px; margin: 0 auto; padding: 2rem 1.25rem; }
.is-hidden { display: none !important; }
.calc-card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 18px;
  padding: 1.35rem; box-shadow: var(--shadow); margin-bottom: 1.35rem;
}

.toolbar-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.toolbar-left { display: flex; flex-wrap: wrap; gap: 0.85rem; }
.tb-field label { display: block; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-bottom: 0.25rem; }
.tb-field select {
  background: var(--bg); color: var(--text); border: 1.5px solid #cbd5e1; border-radius: 9px;
  padding: 0.45rem 0.7rem; font-size: 0.84rem; font-weight: 600; outline: none;
}
html[data-theme="dark"] .tb-field select { border-color: var(--border); }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.mini-btn {
  background: var(--bg); color: var(--text); border: 1.5px solid #cbd5e1; border-radius: 9px;
  padding: 0.48rem 0.82rem; font-size: 0.82rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 0.35rem;
}
html[data-theme="dark"] .mini-btn { border-color: var(--border); }
.mini-btn:hover { border-color: #4f46e5; color: #4f46e5; }
.btn-primary {
  background: #4f46e5; color: #fff; border: none; border-radius: 9px; padding: 0.5rem 1rem;
  font-size: 0.84rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem;
}
.btn-primary:hover { background: #4338ca; }

.invoice-workspace { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 1.35rem; align-items: start; }
@media (max-width: 980px) { .invoice-workspace { grid-template-columns: minmax(0, 1fr); } }

.inv-meta-grid, .party-grid, .charges-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.85rem; }
.charges-grid { grid-template-columns: repeat(4, 1fr); margin-top: 1rem; }
@media (max-width: 680px) { .inv-meta-grid, .party-grid, .charges-grid { grid-template-columns: 1fr; } }

.party-grid { margin-top: 1rem; }
.party-box { border: 1px solid #e2e8f0; border-radius: 12px; padding: 0.9rem; background: var(--bg); }
html[data-theme="dark"] .party-box { border-color: var(--border); }
.party-box h3 { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--primary); margin: 0 0 0.65rem; }

.form-field { margin-bottom: 0.55rem; }
.form-field label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text); margin-bottom: 0.25rem; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; background: var(--bg); color: var(--text); border: 1.5px solid #cbd5e1;
  border-radius: 9px; padding: 0.5rem 0.7rem; font-size: 0.86rem; outline: none; box-sizing: border-box; font-family: inherit;
}
html[data-theme="dark"] .form-field input,
html[data-theme="dark"] .form-field select,
html[data-theme="dark"] .form-field textarea { border-color: var(--border); }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: #4f46e5; }
.disc-wrap { display: grid; grid-template-columns: 1fr 72px; gap: 0.35rem; }

.items-head { display: flex; justify-content: space-between; align-items: center; margin: 1.1rem 0 0.6rem; }
.items-head h3 { font-size: 0.92rem; font-weight: 700; color: var(--text); margin: 0; }
.items-wrap { overflow-x: auto; border: 1px solid #e2e8f0; border-radius: 12px; }
html[data-theme="dark"] .items-wrap { border-color: var(--border); }
.items-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; min-width: 470px; }
.items-table th { text-align: left; font-size: 0.75rem; color: var(--text-muted); font-weight: 700; padding: 0.55rem 0.65rem; border-bottom: 1px solid #e2e8f0; background: var(--bg); }
html[data-theme="dark"] .items-table th { border-color: var(--border); }
.items-table td { padding: 0.45rem 0.5rem; border-bottom: 1px solid #f1f5f9; }
html[data-theme="dark"] .items-table td { border-color: var(--border); }
.items-table input {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid #cbd5e1;
  border-radius: 7px; padding: 0.4rem 0.5rem; font-size: 0.84rem; box-sizing: border-box;
}
html[data-theme="dark"] .items-table input { border-color: var(--border); }
.item-total-cell { font-weight: 700; color: var(--text); white-space: nowrap; }
.del-row-btn { background: none; border: none; color: #ef4444; cursor: pointer; padding: 0.3rem; font-size: 0.9rem; }
.save-hint { font-size: 0.76rem; color: var(--text-muted); margin: 0.75rem 0 0; }

/* Live Paper Preview — always white paper for accurate PDF preview */
.preview-col { position: sticky; top: 82px; }
.invoice-sheet {
  background: #ffffff; color: #0f172a; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 1.75rem; box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08); font-size: 0.84rem; line-height: 1.5;
}
.sheet-top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
  border-top: 5px solid #4f46e5; padding-top: 1rem; margin-bottom: 1.35rem;
}
.sheet-type { font-size: 1.45rem; font-weight: 800; letter-spacing: 0.04em; color: #4f46e5; }
.sheet-num { font-size: 0.85rem; color: #475569; font-weight: 600; }
.sheet-from { text-align: right; color: #475569; font-size: 0.8rem; }
.sheet-from strong { display: block; color: #0f172a; font-size: 0.95rem; }
.pre-line { white-space: pre-wrap; }

.sheet-meta-bar {
  display: flex; justify-content: space-between; gap: 1rem; background: #f8fafc;
  border-radius: 10px; padding: 0.85rem 1rem; margin-bottom: 1.2rem;
}
.m-lbl { display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.07em; color: #64748b; font-weight: 700; }
.m-sub { font-size: 0.79rem; color: #475569; }
.sheet-dates { text-align: right; font-size: 0.79rem; color: #334155; }
.sheet-dates .m-lbl { display: inline; margin-right: 0.25rem; }

.sheet-table { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; }
.sheet-table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; color: #475569; padding: 0.5rem 0.4rem; border-bottom: 2px solid #e2e8f0; }
.sheet-table td { padding: 0.55rem 0.4rem; border-bottom: 1px solid #f1f5f9; color: #0f172a; }
.sheet-table th.r, .sheet-table td.r { text-align: right; white-space: nowrap; }

.sheet-bottom { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 1.2rem; align-items: start; }
@media (max-width: 560px) { .sheet-bottom, .sheet-meta-bar { grid-template-columns: 1fr; flex-direction: column; text-align: left; } .sheet-dates { text-align: left; } }
.sheet-notes p { margin: 0.25rem 0 0; font-size: 0.78rem; color: #475569; }
.sheet-totals { font-size: 0.82rem; }
.tot-row { display: flex; justify-content: space-between; padding: 0.28rem 0.5rem; color: #475569; }
.tot-row strong { color: #0f172a; }
.tot-grand {
  margin-top: 0.4rem; padding: 0.55rem 0.65rem; border-radius: 8px;
  background: #4f46e5; color: #ffffff !important; font-size: 0.94rem; font-weight: 800;
}
.tot-grand strong { color: #ffffff !important; }

@media print {
  body * { visibility: hidden; }
  #invoiceSheet, #invoiceSheet * { visibility: visible; }
  #invoiceSheet { position: absolute; left: 0; top: 0; width: 100%; box-shadow: none; border: none; }
}
