/* ZeroFee Tools family theme - InvoiceFree */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --blue: #1d4ed8; --purple: #7c3aed; --ink: #1e293b; --muted: #64748b;
  --line: #e2e8f0; --bg: #f8fafc; --card: #ffffff; --ok: #16a34a; --bad: #dc2626;
}
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.6; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; }

#siteHeader { background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; padding: 26px 0 0; }
.header-inner { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.brand { display: flex; gap: 14px; align-items: center; }
.hub-link { color: #fff; text-decoration: none; font-size: .85rem; opacity: .85; display: block; margin-bottom: 2px; }
.hub-link:hover { opacity: 1; text-decoration: underline; }
.brand-name { font-size: 1.7rem; line-height: 1.1; }
.brand-tag { opacity: .9; font-size: .9rem; }
.tabs { display: flex; gap: 8px; }
.tab { border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.12); color: #fff; border-radius: 999px; padding: 8px 16px; font-size: .88rem; cursor: pointer; }
.tab.active { background: #fff; color: var(--blue); font-weight: 700; }
.free-banner { text-align: center; font-size: .82rem; padding: 10px 16px 14px; opacity: .95; }

#main { padding: 26px 0 10px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.builder-head h2 { font-size: 1.45rem; margin-bottom: 4px; }
.builder-head { margin-bottom: 18px; }
.builder-actions { margin-top: 10px; display: flex; gap: 8px; }

.builder-layout { display: grid; grid-template-columns: 430px 1fr; gap: 26px; align-items: start; }
@media (max-width: 980px) { .builder-layout { grid-template-columns: 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.card legend { font-weight: 700; padding: 0 8px; }
label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: 12px; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], input[type="date"], textarea, select {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font-size: .93rem;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 400;
}
textarea { resize: vertical; font-family: inherit; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--blue); border-color: var(--blue); }
input[type="file"] { font-weight: 400; font-size: .85rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

.item-row { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: #fbfdff; }
.item-row .item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.item-row .item-head strong { font-size: .85rem; }
.item-remove { background: none; border: none; color: var(--bad); cursor: pointer; font-size: .82rem; }
.item-grid { display: grid; grid-template-columns: 1fr 70px 90px 90px; gap: 8px; }
.item-grid label { margin-bottom: 0; font-size: .78rem; }
.item-amt { align-self: end; font-weight: 700; font-size: .9rem; text-align: right; padding-bottom: 8px; }
@media (max-width: 520px) { .item-grid { grid-template-columns: 1fr 70px; } .item-amt { grid-column: 1 / -1; text-align: left; } }

.logo-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
#logoPreview { max-height: 48px; max-width: 160px; border: 1px solid var(--line); border-radius: 8px; }
.small-btn { padding: 6px 12px; font-size: .8rem; }

.btn { border: none; border-radius: 10px; padding: 10px 20px; font-size: .93rem; font-weight: 700; cursor: pointer; }
.btn-primary { background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: #eef2ff; color: var(--blue); }
.btn-ghost:hover { background: #e0e7ff; }

/* preview */
.preview-col { min-width: 0; }
.preview-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.preview-label { font-weight: 700; }
.sheet { background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 6px 28px rgba(15,23,42,.08); padding: 44px 46px; min-height: 800px; font-size: 14px; color: #1e293b; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.inv-logo { max-height: 64px; max-width: 220px; margin-bottom: 8px; }
.inv-biz-name { font-size: 1.35rem; font-weight: 800; }
.inv-biz-meta { color: #64748b; font-size: .85rem; white-space: pre-line; }
.inv-title-block { text-align: right; }
.inv-title { font-size: 2rem; font-weight: 800; color: var(--blue); letter-spacing: 2px; }
.inv-num { font-weight: 700; margin-top: 4px; }
.inv-dates { color: #64748b; font-size: .85rem; margin-top: 4px; }
.inv-billto { margin-bottom: 22px; }
.inv-billto h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; color: #64748b; margin-bottom: 4px; }
.inv-billto .cname { font-weight: 700; }
.inv-billto .cmeta { color: #475569; font-size: .88rem; white-space: pre-line; }
.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.inv-table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .6px; color: #64748b; border-bottom: 2px solid var(--ink); padding: 8px 6px; }
.inv-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.inv-table .r { text-align: right; }
.inv-table .c { text-align: center; }
.inv-totals { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.inv-totals table { min-width: 260px; }
.inv-totals td { padding: 5px 6px; font-size: .92rem; }
.inv-totals .t-label { color: #64748b; }
.inv-totals .t-val { text-align: right; font-weight: 600; }
.inv-totals tr.grand td { font-size: 1.15rem; font-weight: 800; border-top: 2px solid var(--ink); padding-top: 10px; color: var(--blue); }
.inv-notes h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: 1px; color: #64748b; margin-bottom: 4px; }
.inv-notes p { white-space: pre-line; color: #475569; font-size: .88rem; }
.inv-empty { color: #94a3b8; font-style: italic; }

/* faq */
.faq-sec, #panel-faq h2 { font-size: 1.3rem; margin: 26px 0 14px; }
.faq { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; }
.faq summary { padding: 14px 18px; font-weight: 600; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+ "; color: var(--blue); font-weight: 700; }
.faq[open] summary::before { content: "− "; }
.faq p { padding: 0 18px 16px; color: #475569; }

#siteFooter { border-top: 1px solid var(--line); padding: 24px 0 34px; color: var(--muted); font-size: .88rem; text-align: center; background: #fff; margin-top: 40px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: #1e293b; color: #fff; padding: 12px 20px; border-radius: 12px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.print-only { display: none; }

/* ---------- print ---------- */
@page { size: A4; margin: 12mm; }
@media print {
  body { background: #fff; }
  #siteHeader, #siteFooter, .builder-head, .form-col, .preview-toolbar, .toast,
  #panel-faq, .center.muted.small, .preview-label { display: none !important; }
  #main { padding: 0; }
  .wrap { max-width: none; padding: 0; }
  .builder-layout { display: block; }
  .preview-col { min-width: 0; }
  .sheet { box-shadow: none; border: none; border-radius: 0; padding: 0; min-height: 0; }
  .inv-table th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
