/* =====================================================================
   Invoice Generator — app.css
   Extends the shared design system (base.css). The .inv-* invoice
   document styles are print-first: they must read cleanly both in the
   glass-panel preview and on plain white paper via @media print.
   ===================================================================== */

[data-theme="light"] .icon-sun { display: none; }
.icon-moon { display: none; }

.pane-title { margin: 0 0 var(--space-4); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--text-secondary); }

.toolbar-panel { padding: var(--space-4) var(--space-5); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); }
.toolbar-group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.toolbar .spacer { flex: 1; }
.field-inline { display: inline-flex; align-items: center; gap: var(--space-2); }
.field-inline select { width: auto; min-width: 110px; padding-top: 8px; padding-bottom: 8px; }

#statusBadge .status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--info); box-shadow: 0 0 10px var(--info); }

/* ===================== Grid helpers ===================== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); }
.grid-span-2 { grid-column: 1 / -1; }

/* ===================== Layout ===================== */
.layout { display: grid; grid-template-columns: 460px 1fr; gap: var(--space-6); align-items: start; margin-top: var(--space-2); }

/* ===================== Line items form ===================== */
.items-form { display: flex; flex-direction: column; gap: var(--space-3); }
.item-row {
  display: grid;
  grid-template-columns: 1fr 72px 110px 84px 110px 40px;
  gap: var(--space-2);
  align-items: center;
}
.item-row .field { gap: 0; }
.item-amount { text-align: right; font-weight: 600; font-size: 13.5px; padding: 0 4px; }
.item-remove { width: 36px; height: 36px; }
.items-form-empty { color: var(--text-muted); font-size: 13.5px; padding: var(--space-2) 0; }

/* ===================== Invoice document ===================== */
.invoice-wrap { min-width: 0; }
.invoice-doc {
  background: #ffffff;
  color: #111318;
  border-radius: var(--radius-lg);
  padding: 40px;
  min-height: 600px;
  box-shadow: var(--shadow-lg);
}
.inv-head { display: flex; justify-content: space-between; gap: var(--space-6); flex-wrap: wrap; border-bottom: 2px solid #e6e7ef; padding-bottom: 20px; margin-bottom: 24px; }
.inv-biz-name { font-size: 19px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 6px; }
.inv-muted { color: #666a7d; font-size: 13px; white-space: pre-line; line-height: 1.5; }
.inv-meta { text-align: right; }
.inv-title { font-size: 26px; font-weight: 800; letter-spacing: .04em; background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; margin-bottom: 10px; }
.inv-meta-row { display: flex; justify-content: flex-end; gap: 10px; font-size: 13px; color: #333644; }
.inv-meta-row span:first-child { color: #8a8ea3; min-width: 70px; text-align: left; }

.inv-parties { margin-bottom: 24px; }
.inv-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #8a8ea3; margin-bottom: 6px; }
.inv-party-name { font-size: 15px; font-weight: 700; margin-bottom: 4px; }

.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.inv-table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #8a8ea3; padding: 8px 6px; border-bottom: 2px solid #e6e7ef; }
.inv-table td { padding: 10px 6px; border-bottom: 1px solid #eef0f5; font-size: 13.5px; vertical-align: top; }
.inv-table th.num, .inv-table td.num { text-align: right; }
.inv-table tr:last-child td { border-bottom: none; }
.inv-item-desc { font-weight: 600; }
.inv-empty-row td { color: #a3a7ba; font-style: italic; }

.inv-totals { margin-left: auto; width: 280px; display: flex; flex-direction: column; gap: 6px; margin-bottom: 24px; }
.inv-totals-row { display: flex; justify-content: space-between; font-size: 14px; color: #333644; padding: 4px 0; }
.inv-total-grand { border-top: 2px solid #e6e7ef; margin-top: 4px; padding-top: 10px; font-size: 17px; font-weight: 800; color: #111318; }

.inv-notes { border-top: 1px solid #eef0f5; padding-top: 16px; font-size: 13px; color: #4a4d5e; white-space: pre-line; line-height: 1.6; }
.inv-notes:empty, .inv-notes.is-empty { display: none; }

/* ===================== Print ===================== */
@media print {
  .no-print { display: none !important; }
  body { background: #fff !important; }
  body::before, body::after { display: none !important; }
  main.container { max-width: none; padding: 0; margin: 0; }
  .layout { display: block; }
  .invoice-doc { box-shadow: none; border-radius: 0; padding: 0; min-height: 0; color: #111; }
  .invoice-doc .inv-title { -webkit-text-fill-color: initial; background: none; color: #111; }
  @page { margin: 16mm; }
}

/* ===================== Responsive ===================== */
@media (max-width: 1040px) {
  .layout { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .grid-span-2 { grid-column: auto; }
  .item-row { grid-template-columns: 1fr; gap: 6px; padding: var(--space-3); border: 1px solid var(--border); border-radius: var(--radius-md); }
  .item-amount { text-align: left; }
  #statusBadge { display: none; }
  .toolbar .spacer { display: none; }
  .toolbar-group { width: 100%; }
  .toolbar-group .btn { flex: 1; }
}
