/* ============================================================
   BrickPro — Fly Ash Brick Management System
   style.css — Premium Black & White Theme
   ============================================================ */

/* ── Fonts & Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── CSS Variables — Dark Theme (default) ── */
:root,
[data-theme="dark"] {
  --bg:           #0e0f11;
  --bg2:          #141518;
  --bg3:          #1a1b1f;
  --surface:      #1e2025;
  --surface2:     #252830;
  --border:       #2a2d35;
  --border2:      #343740;
  --text:         #f0f1f3;
  --text2:        #a8aab4;
  --text3:        #6b6f7d;
  --accent:       #e8e9ec;
  --accent2:      #c8cad0;
  --success:      #22c55e;
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --info:         #3b82f6;
  --sidebar-w:    260px;
  --topbar-h:     64px;
  --radius:       14px;
  --radius-sm:    8px;
  --radius-lg:    18px;
  --shadow:       0 4px 24px rgba(0,0,0,.45);
  --shadow-sm:    0 2px 8px rgba(0,0,0,.35);
  --trans:        .22s cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] {
  --bg:           #f4f5f7;
  --bg2:          #e9eaed;
  --bg3:          #f9f9fb;
  --surface:      #ffffff;
  --surface2:     #f2f3f5;
  --border:       #dde0e8;
  --border2:      #c8ccd8;
  --text:         #111214;
  --text2:        #4a4d58;
  --text3:        #8b8fa0;
  --accent:       #111214;
  --accent2:      #2a2d35;
  --shadow:       0 4px 24px rgba(0,0,0,.09);
  --shadow-sm:    0 2px 8px rgba(0,0,0,.07);
}

/* ── Base ── */
body {
  font-family: 'Ranade', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  transition: background var(--trans), color var(--trans);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 99px; }

/* ================================================================
   SIDEBAR
================================================================ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--trans);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px 20px;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}

.brand-icon {
  width: 40px; height: 40px;
  background: linear-gradient(145deg, var(--text) 0%, var(--accent2) 100%);
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.brand-icon svg.lucide { width: 22px; height: 22px; stroke-width: 1.85; color: var(--bg); }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -.3px; color: var(--text); }
.brand-sub  { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: .8px; }

.sidebar-nav { padding: 12px 10px 24px; flex: 1; }

.nav-section-label {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text3);
  padding: 16px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 11px;
  cursor: pointer;
  transition: background var(--trans), color var(--trans);
  color: var(--text2);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  margin-bottom: 2px;
  white-space: nowrap;
  user-select: none;
}
.nav-item svg.lucide { width: 19px; height: 19px; flex-shrink: 0; opacity: .88; }
.nav-item:hover  { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--text); color: var(--bg); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.nav-item.active svg.lucide { color: var(--bg); opacity: 1; }

/* ================================================================
   TOPBAR
================================================================ */
.topbar {
  position: fixed;
  top: 0; left: var(--sidebar-w); right: 0;
  height: var(--topbar-h);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  z-index: 150;
  transition: left var(--trans);
  gap: 16px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 16px; font-weight: 700; color: var(--text); }

.topbar-right { display: flex; align-items: center; gap: 10px; }

.search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
}
.search-wrap svg.lucide { width: 16px; height: 16px; color: var(--text3); flex-shrink: 0; }
.search-wrap input {
  background: none; border: none; outline: none;
  color: var(--text); font-size: 13px; width: 200px;
  font-family: inherit;
}
.search-wrap input::placeholder { color: var(--text3); }

.topbar-date { font-size: 12px; color: var(--text3); white-space: nowrap; }

/* ================================================================
   MAIN CONTENT
================================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  margin-top: var(--topbar-h);
  padding: 28px;
  min-height: calc(100vh - var(--topbar-h));
  transition: margin-left var(--trans);
}

/* ================================================================
   PAGES
================================================================ */
.page { display: none; }
.page.active { display: block; animation: fadeIn .3s ease; }

@keyframes fadeIn {
  from { opacity:0; transform: translateY(8px); }
  to   { opacity:1; transform: translateY(0); }
}

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; gap: 12px; flex-wrap: wrap;
}
.page-header h1 {
  font-size: 24px; font-weight: 800;
  letter-spacing: -.5px; color: var(--text);
}
.page-sub { color: var(--text2); font-size: 14px; margin-top: 2px; }

/* ================================================================
   KPI CARDS
================================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow var(--trans), border-color var(--trans);
  position: relative;
  overflow: hidden;
}
.kpi-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border2); }
.kpi-card::before {
  content: '';
  position: absolute; top:0; left:0; right:0; height:2px;
  background: var(--kpi-color, var(--accent));
}

.kpi-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.kpi-icon svg.lucide { width: 18px; height: 18px; color: var(--kpi-color, var(--text2)); }
.kpi-label { font-size: 11.5px; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: .6px; }
.kpi-value { font-size: 22px; font-weight: 800; color: var(--text); margin: 4px 0 2px; letter-spacing: -.5px; }
.kpi-value .prod-split-line { display: block; line-height: 1.35; }
.kpi-value .prod-split-line + .prod-split-line { margin-top: 4px; }
.kpi-sub   { font-size: 11px; color: var(--text3); }

/* ================================================================
   CARDS
================================================================ */
.card-pro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow var(--trans);
}
.card-pro:hover { box-shadow: var(--shadow-sm); }

.card-pro-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.card-pro-title { font-size: 14px; font-weight: 700; color: var(--text); }

/* ================================================================
   CHARTS
================================================================ */
.chart-wrap {
  position: relative;
  height: 240px;
  width: 100%;
}
.chart-legend {
  display: flex; align-items: center; gap: 12px;
  font-size: 12px; color: var(--text2);
}
.legend-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 99px;
  margin-right: 4px;
}

/* ================================================================
   TABLE
================================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
}

.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl thead { background: var(--surface2); }
.tbl th {
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text2);
  font-size: 11.5px;
  letter-spacing: .3px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.tbl tbody tr:hover { background: var(--surface2); }
.tbl tbody tr:last-child td { border-bottom: none; }

/* ================================================================
   FORMS
================================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
  letter-spacing: .2px;
}
.form-ctrl {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans);
}
.form-ctrl:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(200,202,208,.15);
}
.form-ctrl::placeholder { color: var(--text3); }
select.form-ctrl option { background: var(--surface); color: var(--text); }
textarea.form-ctrl { resize: vertical; min-height: 70px; }

/* ================================================================
   BUTTONS
================================================================ */
.btn-pro {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--trans), transform var(--trans);
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
}
.btn-pro:hover { opacity: .88; }
.btn-pro:active { transform: scale(.97); }
.btn-pro svg.lucide { width: 17px; height: 17px; }
.btn-pro.danger { background: var(--danger); color: #fff; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--trans), border-color var(--trans);
  font-family: inherit;
  white-space: nowrap;
}
.btn-outline:hover { background: var(--surface2); border-color: var(--text2); }
.btn-outline.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-outline svg.lucide { width: 16px; height: 16px; }

.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text2);
  cursor: pointer;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
  font-family: inherit;
  flex-shrink: 0;
}
.btn-icon:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-icon svg.lucide { width: 17px; height: 17px; }
.btn-icon.danger { color: var(--danger); border-color: transparent; }
.btn-icon.danger:hover { background: rgba(239,68,68,.12); }

/* ================================================================
   FILTER BAR
================================================================ */
.filter-bar {
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-bar label { font-size: 13px; color: var(--text2); font-weight: 500; white-space: nowrap; }
.filter-bar .form-ctrl { width: auto; min-width: 140px; }

/* ================================================================
   MODALS
================================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(4px);
  z-index: 400;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; animation: fadeIn .2s ease; }

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: slideUp .25s cubic-bezier(.4,0,.2,1);
}
.modal-box.modal-lg { max-width: 680px; }

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-body  { padding: 20px 22px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

/* ================================================================
   CALC PREVIEW
================================================================ */
.calc-preview {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.calc-row {
  display: flex; justify-content: space-between;
  font-size: 13px; color: var(--text2);
  padding: 4px 0;
}
.calc-row.total {
  border-top: 1px solid var(--border);
  margin-top: 6px; padding-top: 10px;
  font-weight: 700; color: var(--text);
}
.calc-val { font-family: 'Ranade', sans-serif; font-weight: 600; color: var(--text); }

/* ================================================================
   BADGES / STATUS
================================================================ */
.badge-pro {
  display: inline-flex; align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge-success { background: rgba(34,197,94,.12); color: #22c55e; }
.badge-danger  { background: rgba(239,68,68,.12);  color: #ef4444; }
.badge-warning { background: rgba(245,158,11,.12); color: #f59e0b; }
.badge-info    { background: rgba(59,130,246,.12); color: #3b82f6; }
.badge-neutral { background: var(--surface2); color: var(--text2); }

/* ================================================================
   ACTION BUTTONS (table row)
================================================================ */
.action-btns { display: flex; gap: 4px; }
.action-btns .btn-icon { width: 30px; height: 30px; }
.action-btns .btn-icon svg.lucide { width: 15px; height: 15px; }

/* ================================================================
   TOAST NOTIFICATIONS
================================================================ */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9000;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast-item {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 18px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  max-width: 340px;
  pointer-events: all;
  animation: slideInRight .3s ease;
}
.toast-item.remove { animation: slideOutRight .3s ease forwards; }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--success); }
.toast-error   .toast-icon { color: var(--danger); }
.toast-info    .toast-icon { color: var(--info); }
.toast-warning .toast-icon { color: var(--warning); }

@keyframes slideInRight {
  from { transform: translateX(60px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes slideOutRight {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(60px); opacity: 0; }
}

/* ================================================================
   RECENT TRANSACTIONS / TOP CUSTOMERS
================================================================ */
.txn-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.txn-item:last-child { border-bottom: none; }
.txn-icon {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.txn-icon svg.lucide { width: 17px; height: 17px; }
.txn-info { flex: 1; min-width: 0; }
.txn-name { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.txn-date { font-size: 11.5px; color: var(--text3); }
.txn-amount { font-size: 14px; font-weight: 700; font-family: 'Ranade', sans-serif; white-space: nowrap; }
.txn-credit { color: var(--success); }
.txn-debit  { color: var(--danger); }

.tbl tbody tr.row-overdue { background: rgba(239,68,68,.12) !important; }
.tbl tbody tr.row-overdue:hover { background: rgba(239,68,68,.18) !important; }
.tbl tbody tr.row-pending { background: rgba(245,158,11,.1) !important; }
.tbl tbody tr.row-pending:hover { background: rgba(245,158,11,.16) !important; }
.outstanding-tag { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; }
.outstanding-tag.overdue { background: rgba(239,68,68,.15); color: #ef4444; }
.outstanding-tag.within { background: rgba(245,158,11,.15); color: #f59e0b; }
.outstanding-tag.paid { background: rgba(34,197,94,.12); color: #22c55e; }
.inv-stock-ok { color: #22c55e; }
.inv-stock-low { color: #ef4444; }

/* ================================================================
   BACKUP PAGE
================================================================ */
.backup-icon {
  width: 72px; height: 72px;
  background: var(--surface2);
  border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
}
.backup-icon svg.lucide { width: 34px; height: 34px; color: var(--text2); }
.backup-icon.restore svg.lucide { color: var(--info); }

.danger-zone-card {
  border: 1px solid rgba(239, 68, 68, .35);
  background: rgba(239, 68, 68, .04);
}

.backup-includes-list {
  margin: 0;
  padding: 0 0 0 20px;
  font-size: 13px;
  line-height: 1.8;
}
.backup-includes-list li { margin-bottom: 2px; }

.backup-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.backup-status-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.backup-status-label {
  display: block;
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 6px;
}
.backup-status-item strong {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}
.backup-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 10px;
  cursor: pointer;
}
.backup-toggle-row input { margin-top: 3px; accent-color: var(--text); }

#confirmMsg { white-space: pre-line; line-height: 1.55; font-size: 13px; }
.text-warning { color: var(--warning) !important; }

/* Invoice Print Styles */
.invoice-print-area {
  font-family: 'Ranade', system-ui, sans-serif;
  background: #fafafa;
  color: #4b5563;
  min-height: 200px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.invoice-preview-card .card-pro-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.invoice-preview-card .invoice-print-area { border: 1px solid #e5e7eb; }
.invoice-modal-body { padding: 0; background: #f3f4f6; }
.invoice-modal-body .invoice-print-area { border-radius: 0; }
.inv-placeholder {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 360px;
  color: var(--text2);
  padding: 40px;
}
.invoice-form-header-left {
  display: flex; align-items: center; gap: 14px;
}
.btn-icon-text {
  display: inline-flex; align-items: center; gap: 6px;
}
.modal-box-xl { max-width: 920px; width: 96%; }

.inv-wrap {
  padding: 28px 32px;
  background: #fafafa;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}
.inv-accent-bar {
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #d1d5db 0%, #9ca3af 50%, #d1d5db 100%);
}
.inv-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid #d1d5db;
  gap: 20px;
}
.inv-brand { flex: 1; min-width: 0; }
.inv-company-name {
  font-size: 22px; font-weight: 700; color: #374151;
  letter-spacing: -0.2px; line-height: 1.25;
}
.inv-company-sub { font-size: 12px; color: #6b7280; margin-top: 4px; }
.inv-meta-box {
  flex-shrink: 0;
  min-width: 200px;
  max-width: 300px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.inv-meta-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  background: #e5e7eb;
  border-bottom: 1px solid #d1d5db;
}
.inv-doc-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #374151;
}
.inv-meta-no {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: #374151;
}
.inv-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 7px 10px;
  font-size: 10px;
  color: #9ca3af;
}
.inv-meta-row strong {
  color: #374151;
  font-weight: 600;
  margin-left: 3px;
}
.inv-meta-head .inv-status { flex-shrink: 0; }
.inv-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.inv-status.paid { background: #e5e7eb; color: #374151; }
.inv-status.partial { background: #f3f4f6; color: #6b7280; }
.inv-status.pending { background: #f9fafb; color: #6b7280; border: 1px solid #e5e7eb; }
.inv-status.overdue { background: #f3f4f6; color: #52525b; border: 1px solid #d1d5db; }

.inv-parties {
  display: grid; grid-template-columns: 1.2fr 1fr;
  gap: 16px; margin-bottom: 20px;
}
.inv-party-box {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}
.inv-party-from { background: #f9fafb; }
.inv-party-label {
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: #9ca3af; margin-bottom: 6px;
}
.inv-party-name { font-size: 14px; font-weight: 600; color: #374151; margin-bottom: 3px; }
.inv-party-sub { font-size: 11.5px; color: #6b7280; line-height: 1.45; }

.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 20px; background: #fff; }
.inv-table th {
  background: #e5e7eb; color: #374151;
  padding: 9px 10px; text-align: left;
  font-size: 10px; font-weight: 600; letter-spacing: 0.3px;
  border-bottom: 1px solid #d1d5db;
}
.inv-table th.text-right, .inv-table td.text-right { text-align: right; }
.inv-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 12px;
  vertical-align: top;
  color: #4b5563;
}
.inv-table tbody tr:nth-child(even) { background: #f9fafb; }
.inv-table .inv-item-desc { font-weight: 600; color: #374151; }
.inv-table .inv-item-sub { font-size: 10px; color: #9ca3af; margin-top: 2px; }

.inv-bottom {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}
.inv-amount-words {
  font-size: 11.5px;
  color: #6b7280;
  padding: 10px 12px;
  background: #fff;
  border-left: 3px solid #d1d5db;
  border-radius: 0 6px 6px 0;
  margin-bottom: 12px;
  line-height: 1.55;
}
.inv-totals-box {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.inv-total-row {
  display: flex; justify-content: space-between;
  padding: 7px 12px;
  font-size: 12px;
  border-bottom: 1px solid #f3f4f6;
  color: #6b7280;
}
.inv-total-row span:last-child { font-weight: 600; color: #374151; }
.inv-total-row.grand {
  background: #e5e7eb;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
  border-bottom: none;
  padding: 10px 12px;
}
.inv-total-row.grand span:last-child { font-weight: 700; color: #1f2937; }
.inv-total-row.pending-row { background: #f9fafb; color: #6b7280; }
.inv-total-row.pending-row span:last-child { color: #52525b; font-weight: 700; }

.inv-bank {
  font-size: 11.5px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 10px;
  color: #6b7280;
}
.inv-bank-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: #9ca3af; margin-bottom: 4px;
}
.inv-notes {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11.5px;
  color: #6b7280;
  line-height: 1.5;
}
.inv-notes-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: #9ca3af; margin-bottom: 4px;
}
.inv-footer {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding-top: 18px;
  border-top: 1px dashed #d1d5db;
  gap: 20px;
}
.inv-terms { font-size: 10.5px; color: #9ca3af; max-width: 55%; line-height: 1.55; }
.inv-sig { text-align: right; min-width: 160px; }
.inv-sig-line { width: 140px; border-top: 1px solid #9ca3af; margin: 36px 0 6px auto; }
.inv-sig-label { font-size: 10px; color: #6b7280; font-weight: 600; }
.inv-sig-company { font-size: 9.5px; color: #9ca3af; margin-top: 2px; }

/* ================================================================
   SIDEBAR OVERLAY (mobile)
================================================================ */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 199;
  background: rgba(0,0,0,.5);
}

/* ================================================================
   RESPONSIVE
================================================================ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity var(--trans); }
  .sidebar-overlay.show { opacity: 1; pointer-events: all; }
  .topbar { left: 0; }
  .main-content { margin-left: 0; padding: 18px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .search-wrap input { width: 140px; }
}

@media (max-width: 560px) {
  .main-content { padding: 12px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-header h1 { font-size: 20px; }
  .topbar-date { display: none; }
  .search-wrap { display: none; }
  .modal-box { border-radius: var(--radius); }
  .inv-parties { grid-template-columns: 1fr; }
  .inv-bottom { grid-template-columns: 1fr; }
  .inv-header { flex-direction: column; gap: 16px; }
  .inv-meta-box { width: 100%; max-width: 280px; }
}

/* ================================================================
   PRINT STYLES
================================================================ */
@page {
  size: A4 portrait;
  margin: 0;
}

@media print {
  .sidebar, .topbar, .modal-overlay, .toast-container,
  .page-header .btn-pro, .page-header .btn-outline,
  .filter-bar, .action-btns, #invoicePreviewCard .card-pro-header { display: none !important; }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fafafa !important;
    color: #4b5563;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .page { display: none !important; }
  #page-invoice { display: block !important; padding: 0; }
  .col-lg-5 { display: none !important; }
  .col-lg-7 { width: 100% !important; max-width: 100% !important; flex: 0 0 100% !important; }
  .card-pro { border: none !important; box-shadow: none !important; padding: 0 !important; background: transparent !important; }
  .invoice-print-area { background: #fafafa !important; margin: 0 !important; padding: 0 !important; border: none !important; }
  .inv-wrap { padding: 12mm 14mm !important; margin: 0 !important; }

  /* Report print */
  .print-report-area { display: block; }
}

/* ================================================================
   MISC UTILITIES
================================================================ */
.text-muted  { color: var(--text3) !important; }
.text-success{ color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning{ color: var(--warning) !important; }
.mono        { font-family: 'Ranade', sans-serif; }
.w-100       { width: 100%; }
.flex-fill   { flex: 1 1 auto; }
.gap-2       { gap: 8px !important; }
.d-flex      { display: flex !important; }
.flex-wrap   { flex-wrap: wrap; }
.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--text3); font-size: 13px;
}
.empty-state svg.lucide { width: 48px; height: 48px; opacity: .3; display: block; margin: 0 auto 12px; }

/* Lucide icon base */
.icon, svg.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 1.65;
  flex-shrink: 0;
  display: block;
}
.toast-icon svg.lucide { width: 18px; height: 18px; }
.inv-placeholder-icon svg.lucide { width: 56px; height: 56px; opacity: .22; }

/* Inv item row delete button fix */
.inv-item-row .btn-icon { width: 36px; height: 36px; margin-top: 0; }