:root {
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --bg: #f5f6fa;
}

body { background: var(--bg); }

/* ---------- Auth pages ---------- */
.auth-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}
.auth-card {
  background: #fff;
  padding: 2.5rem;
  border-radius: 12px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}

/* ---------- App nav ---------- */
.app-navbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: .75rem 0;
}
.app-navbar .nav-link { color: #374151; font-weight: 500; }
.app-navbar .nav-link.active { color: var(--brand); }
.app-navbar .navbar-brand { color: var(--brand-dark); }

/* ---------- Dashboard ---------- */
.stat-card { border: none; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.stat-label { font-size: .8rem; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.6rem; font-weight: 700; margin-top: .25rem; }

/* ---------- Cards ---------- */
.card { border: none; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

/* ---------- Autocomplete ---------- */
.autocomplete-list {
  position: absolute;
  z-index: 50;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 260px;
  overflow-y: auto;
  display: none;
}
.autocomplete-list.show { display: block; }
.autocomplete-item { padding: .5rem .75rem; cursor: pointer; }
.autocomplete-item:hover, .autocomplete-item.active { background: #eef2ff; }
.autocomplete-item small { display: block; color: #6b7280; }

/* ---------- Badges ---------- */
.badge-unpaid { background: #f59e0b; color:#fff; }
.badge-partial { background: #3b82f6; color:#fff; }
.badge-paid { background: #10b981; color:#fff; }
.badge-overdue { background: #ef4444; color:#fff; }
.badge { display:inline-block; padding:.25em .6em; border-radius: 999px; font-size:.75rem; }

/* ---------- Settings ---------- */
.settings-preview { max-height: 80px; border-radius: 6px; border: 1px solid #e5e7eb; }

/* ---------- Invoice sheet (shared by browser view / PDF / image export) ---------- */
.invoice-sheet {
  background: #fff;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px;
  font-family: 'Helvetica Neue', Arial, sans-serif;
  color: #1f2937;
  box-shadow: 0 1px 6px rgba(0,0,0,.1);
}
.inv-header { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #1f2937; padding-bottom: 16px; margin-bottom: 16px; }
.inv-logo { max-height: 60px; margin-bottom: 8px; }
.inv-company h1 { font-size: 1.3rem; margin: 0 0 4px; }
.inv-company p { margin: 0; font-size: .85rem; color: #4b5563; }
.inv-meta { text-align: right; min-width: 220px; }
.inv-meta h2 { letter-spacing: .1em; color: var(--brand); margin: 0 0 8px; }
.inv-meta table { margin-left: auto; font-size: .85rem; }
.inv-meta td { padding: 2px 0 2px 12px; }
.inv-meta td:first-child { color: #6b7280; padding-left: 0; }
.inv-bill-to { margin-bottom: 20px; }
.inv-bill-to h3, .inv-notes h3, .inv-terms h3, .inv-bank h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #6b7280; margin-bottom: 6px; }
.inv-bill-to p { margin: 0; font-size: .9rem; }
table.inv-items { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: .88rem; }
table.inv-items th { text-align: left; background: #f3f4f6; padding: 8px; }
table.inv-items td { padding: 8px; border-bottom: 1px solid #e5e7eb; }
table.inv-items th:nth-child(n+3), table.inv-items td:nth-child(n+3) { text-align: right; }
.inv-summary { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.inv-summary table { min-width: 260px; font-size: .9rem; }
.inv-summary td { padding: 4px 0; }
.inv-summary td:first-child { color: #6b7280; }
.inv-summary td:last-child { text-align: right; font-weight: 600; }
.inv-summary tr.grand td { font-size: 1.1rem; border-top: 2px solid #1f2937; padding-top: 8px; }
.inv-notes, .inv-terms { margin-bottom: 16px; font-size: .85rem; }
.inv-footer { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-top: 20px; border-top: 1px solid #e5e7eb; padding-top: 16px; }
.inv-qr img { max-height: 100px; }
.inv-qr p { font-size: .75rem; text-align: center; color: #6b7280; margin: 4px 0 0; }

/* ---------- Print ---------- */
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .invoice-sheet { box-shadow: none; max-width: 100%; }
}
@page { size: A4; margin: 12mm; }

.view-invoice-body { background: #eef0f5; }
