/* ============================================================
   ZALE PROJECTS LTD — CONSTRUCTION MANAGEMENT SYSTEM
   Main Stylesheet
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:       #f59e0b;
  --primary-dark:  #d97706;
  --primary-light: #fef3c7;
  --secondary:     #1e293b;
  --secondary-mid: #334155;
  --secondary-light:#475569;
  --bg:            #f1f5f9;
  --white:         #ffffff;
  --success:       #10b981;
  --success-light: #d1fae5;
  --danger:        #ef4444;
  --danger-light:  #fee2e2;
  --warning:       #f59e0b;
  --warning-light: #fef3c7;
  --info:          #3b82f6;
  --info-light:    #dbeafe;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --border:        #e2e8f0;
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:     0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg:     0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --radius:        10px;
  --sidebar-w:     260px;
  --topbar-h:      64px;
  --transition:    all .2s ease;
}

html, body { height: 100%; font-family: 'Inter', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); overflow-x: hidden; }

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }

/* ── LAYOUT ── */
.sidebar {
  position: fixed; top: 0; left: 0; height: 100vh; width: var(--sidebar-w);
  background: var(--secondary); display: flex; flex-direction: column;
  z-index: 100; transition: var(--transition); overflow-y: auto; overflow-x: hidden;
}
.sidebar.collapsed { width: 68px; }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .sidebar-footer span { display: none; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 16px 0; }

.main-wrapper {
  margin-left: var(--sidebar-w); min-height: 100vh;
  display: flex; flex-direction: column; transition: var(--transition);
}
.main-wrapper.expanded { margin-left: 68px; }

/* ── SIDEBAR LOGO ── */
.sidebar-logo {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.logo-icon {
  width: 40px; height: 40px; background: var(--primary); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--secondary); font-size: 18px; flex-shrink: 0;
}
.logo-title { display: block; font-size: 13px; font-weight: 800; color: #fff; letter-spacing: 1px; }
.logo-sub   { display: block; font-size: 10px; font-weight: 400; color: var(--primary); letter-spacing: 2px; margin-top: -2px; }

/* ── SIDEBAR NAV ── */
.sidebar-nav { flex: 1; padding: 16px 10px; }
.nav-section-label {
  font-size: 10px; font-weight: 700; color: var(--secondary-light);
  letter-spacing: 1.5px; padding: 12px 10px 6px; white-space: nowrap;
}
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 8px; color: #94a3b8; text-decoration: none;
  font-size: 13.5px; font-weight: 500; margin-bottom: 2px;
  transition: var(--transition); white-space: nowrap;
}
.nav-item i { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--primary); color: var(--secondary); font-weight: 700; }
.nav-item.active i { color: var(--secondary); }

.sidebar-footer {
  padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08);
  font-size: 11px; color: #64748b; display: flex; align-items: center; gap: 8px;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-h); background: var(--white); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  position: sticky; top: 0; z-index: 90; box-shadow: var(--shadow);
}
.sidebar-toggle {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  font-size: 18px; padding: 6px; border-radius: 6px; transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--bg); color: var(--text); }
.topbar-title { font-size: 18px; font-weight: 700; color: var(--text); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-date  { font-size: 12px; color: var(--text-muted); }
.topbar-user  { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; }
.user-avatar  {
  width: 32px; height: 32px; background: var(--primary); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--secondary); font-size: 14px;
}

/* ── PAGE CONTENT ── */
.page-content { flex: 1; padding: 28px; }

/* ── CARDS ── */
.card {
  background: var(--white); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.card-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 700; }
.card-body { padding: 22px; }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 20px; margin-bottom: 28px;
}
.stat-card {
  background: var(--white); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 18px;
}
.stat-icon {
  width: 54px; height: 54px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.stat-icon.yellow  { background: var(--primary-light); color: var(--primary-dark); }
.stat-icon.green   { background: var(--success-light); color: var(--success); }
.stat-icon.red     { background: var(--danger-light);  color: var(--danger); }
.stat-icon.blue    { background: var(--info-light);    color: var(--info); }
.stat-icon.purple  { background: #ede9fe; color: #7c3aed; }
.stat-icon.teal    { background: #ccfbf1; color: #0d9488; }
.stat-info .stat-value { font-size: 24px; font-weight: 800; color: var(--text); }
.stat-info .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── GRIDS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 20px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ── TABLES ── */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--bg); }
th { padding: 11px 16px; text-align: left; font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 16px; font-size: 13.5px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ── BADGES ── */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.badge-success  { background: var(--success-light); color: #065f46; }
.badge-danger   { background: var(--danger-light);  color: #991b1b; }
.badge-warning  { background: var(--warning-light); color: #92400e; }
.badge-info     { background: var(--info-light);    color: #1e40af; }
.badge-secondary{ background: #f1f5f9; color: #475569; }
.badge-purple   { background: #ede9fe; color: #5b21b6; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: 8px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; transition: var(--transition); text-decoration: none;
}
.btn-primary   { background: var(--primary); color: var(--secondary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success   { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-info      { background: var(--info); color: #fff; }
.btn-info:hover    { background: #2563eb; }
.btn-warning   { background: var(--warning); color: var(--secondary); }
.btn-warning:hover { background: var(--primary-dark); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-outline   { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--secondary); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-icon { padding: 7px 10px; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media(max-width:600px){ .form-row, .form-row-3 { grid-template-columns: 1fr; } }
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px; }
input[type=text], input[type=number], input[type=email], input[type=date],
input[type=tel], textarea, select {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 13.5px; font-family: inherit;
  color: var(--text); background: var(--white); transition: var(--transition);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea { resize: vertical; min-height: 80px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.required { color: var(--danger); }

/* ── SEARCH / TOOLBAR ── */
.page-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.search-box {
  position: relative; flex: 1; min-width: 220px;
}
.search-box input { padding-left: 38px; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px; backdrop-filter: blur(3px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--white); border-radius: 14px; width: 100%;
  max-width: 600px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); animation: slideUp .25s ease;
}
.modal-box.modal-lg { max-width: 800px; }
@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 24px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--white); z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 18px; color: var(--text-muted); padding: 4px 8px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); color: var(--danger); }
.modal-body { padding: 24px; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 28px; right: 28px; z-index: 999;
  padding: 14px 22px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: slideIn .3s ease; display: flex; align-items: center; gap: 10px;
}
.toast.hidden { display: none; }
.toast.success { background: var(--success); color: #fff; }
.toast.error   { background: var(--danger);  color: #fff; }
.toast.info    { background: var(--info);    color: #fff; }
@keyframes slideIn { from { transform: translateX(100px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-header h2 { font-size: 22px; font-weight: 800; }
.page-header p  { font-size: 13px; color: var(--text-muted); margin-top: 3px; }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: .3; }
.empty-state h4 { font-size: 16px; margin-bottom: 8px; }
.empty-state p  { font-size: 13px; }

/* ── LOADING ── */
.loading { text-align: center; padding: 40px; color: var(--text-muted); font-size: 13px; }
.loading i { animation: spin 1s linear infinite; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SUMMARY BOXES ── */
.summary-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.summary-box {
  flex: 1; min-width: 160px; padding: 16px 20px; border-radius: var(--radius);
  border-left: 4px solid; background: var(--white); box-shadow: var(--shadow);
}
.summary-box.income  { border-color: var(--success); }
.summary-box.expense { border-color: var(--danger); }
.summary-box.balance { border-color: var(--info); }
.summary-box .s-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: .6px; }
.summary-box .s-value { font-size: 22px; font-weight: 800; margin-top: 6px; }
.summary-box.income  .s-value { color: var(--success); }
.summary-box.expense .s-value { color: var(--danger); }
.summary-box.balance .s-value { color: var(--info); }

/* ── DETAIL ROW ── */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.detail-item .d-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); letter-spacing: .5px; margin-bottom: 4px; }
.detail-item .d-value { font-size: 14px; font-weight: 600; }

/* ── TABS ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn { background: none; border: none; cursor: pointer; padding: 10px 18px; font-size: 13px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); }
.tab-btn.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.tab-btn:hover  { color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── CHART CONTAINER ── */
.chart-container { position: relative; }

/* ── PAYEE LEDGER ── */
.ledger-total { font-size: 22px; font-weight: 800; }
.ledger-paid  { color: var(--danger); }
.ledger-bal   { color: var(--success); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-w); transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-wrapper { margin-left: 0 !important; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 16px; }
  .topbar-date { display: none; }
.refresh-label { display: none; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}

/* ── PROJECT STATUS COLORS ── */
.status-active    { color: var(--success);        font-weight: 700; }
.status-completed { color: var(--info);            font-weight: 700; }
.status-on-hold   { color: var(--warning);         font-weight: 700; }
.status-cancelled { color: var(--danger);          font-weight: 700; }

/* ── PROGRESS BAR ── */
.progress-wrap { background: var(--bg); border-radius: 99px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--primary); transition: width .4s ease; }
.progress-fill.over { background: var(--danger); }

/* ── REPORT FILTER TAGS ── */
.filter-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--primary-light); color: var(--primary-dark);
  border: 1px solid var(--primary); border-radius: 20px;
  padding: 4px 12px; font-size: 12px; font-weight: 600;
}
.filter-tag-count {
  background: var(--info-light); color: var(--info);
  border-color: var(--info);
}

/* ── HIDDEN UTILITY ── */
.hidden { display: none !important; }

/* ══════════════════════════════════════════════════════════
   LOGIN SCREEN
══════════════════════════════════════════════════════════ */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--secondary) 0%, #0f172a 100%);
  position: relative; overflow: hidden;
}
.login-card {
  background: var(--white); border-radius: 20px; padding: 44px 40px;
  width: 100%; max-width: 420px; box-shadow: 0 25px 50px rgba(0,0,0,.3);
  position: relative; z-index: 10;
}
.login-logo {
  display: flex; align-items: center; gap: 14px; justify-content: center; margin-bottom: 28px;
}
.login-logo-icon {
  width: 52px; height: 52px; background: var(--primary); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: var(--secondary); flex-shrink: 0;
}
.login-company { display: block; font-size: 16px; font-weight: 800; color: var(--text); letter-spacing: 1px; }
.login-ltd     { display: block; font-size: 11px; font-weight: 600; color: var(--primary); letter-spacing: 2px; }
.login-title   { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 6px; }
.login-sub     { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }
.login-error   { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 20px; margin-bottom: 10px; text-align: center; }
.login-hint {
  margin-top: 20px; background: var(--bg); border-radius: 8px; padding: 12px 16px;
  font-size: 12px; color: var(--text-muted); text-align: center; line-height: 1.6;
}
.login-hint code { background: var(--border); padding: 2px 7px; border-radius: 4px; font-weight: 700; color: var(--text); }

/* Background decoration circles */
.login-bg-decoration { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.login-bg-circle {
  position: absolute; border-radius: 50%;
  background: rgba(245,158,11,.08);
}
.login-bg-circle.c1 { width: 400px; height: 400px; top: -100px; right: -100px; }
.login-bg-circle.c2 { width: 300px; height: 300px; bottom: -80px; left: -80px; background: rgba(59,130,246,.07); }
.login-bg-circle.c3 { width: 200px; height: 200px; top: 40%; left: 20%; background: rgba(245,158,11,.05); }

/* ── VIEWER LOCK INDICATOR ── */
.viewer-lock-bar {
  background: var(--info-light); border: 1px solid var(--info); border-radius: 8px;
  padding: 10px 16px; margin-bottom: 16px; display: flex; align-items: center;
  gap: 10px; font-size: 13px; color: #1e40af;
}

@media (max-width: 480px) {
  .login-card { padding: 32px 24px; margin: 16px; }
}

/* ══════════════════════════════════════════════════════════
   INVOICE / PROFORMA / CREDIT NOTE STYLES
══════════════════════════════════════════════════════════ */

/* ── Line Items Editor ── */
.inv-line-items {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.inv-line-header {
  display: grid;
  grid-template-columns: 1fr 70px 70px 130px 110px 38px;
  gap: 8px; padding: 8px 12px;
  background: var(--bg); font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
}
.inv-line-row {
  display: grid;
  grid-template-columns: 1fr 70px 70px 130px 110px 38px;
  gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border);
  align-items: center;
}
.inv-line-row input { border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 13px; width: 100%; }
.inv-line-row input:focus { outline: none; border-color: var(--primary); }
.li-amount { font-size: 13px; text-align: right; padding-right: 4px; }

/* ── Totals Box ── */
.inv-totals-box {
  min-width: 320px; background: var(--bg); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 16px 20px;
}
.inv-total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 13px; gap: 20px;
}
.inv-total-row + .inv-total-row { border-top: 1px solid var(--border); }
.inv-grand-total {
  background: var(--secondary); color: #fff; margin: 8px -20px -16px;
  padding: 12px 20px; border-radius: 0 0 var(--radius) var(--radius);
  font-size: 15px; font-weight: 800;
}

/* ── Invoice Document Viewer ── */
.inv-print-wrap { font-family: 'Inter', sans-serif; }

.inv-actions-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  padding: 12px 0 16px; border-bottom: 1px solid var(--border); margin-bottom: 20px;
}

.inv-doc {
  max-width: 780px; margin: 0 auto;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.inv-doc-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 32px 36px 24px; background: var(--secondary); gap: 20px;
}

.inv-company-info { display: flex; align-items: center; gap: 14px; }
.inv-company-logo {
  width: 52px; height: 52px; background: var(--primary); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--secondary); flex-shrink: 0;
}
.inv-company-name { font-size: 17px; font-weight: 800; color: #fff; letter-spacing: .5px; }
.inv-company-sub  { font-size: 12px; color: #94a3b8; margin-top: 2px; }

.inv-doc-meta { text-align: right; color: #e2e8f0; min-width: 200px; }
.inv-doc-title {
  font-size: 22px; font-weight: 800; color: var(--primary);
  letter-spacing: 2px; margin-bottom: 10px;
}
.inv-meta-row {
  display: flex; justify-content: flex-end; gap: 10px;
  font-size: 12px; padding: 2px 0;
}
.inv-meta-row span:first-child { color: #94a3b8; }

.inv-bill-section {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 24px 36px; border-bottom: 1px solid var(--border); gap: 20px;
}
.inv-bill-label { font-size: 10px; font-weight: 800; color: var(--primary); letter-spacing: 2px; margin-bottom: 6px; }
.inv-bill-name  { font-size: 17px; font-weight: 700; color: var(--text); }
.inv-bill-addr  { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.inv-paid-stamp {
  border: 3px solid var(--success); color: var(--success);
  border-radius: 50%; width: 80px; height: 80px;
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; font-size: 10px; font-weight: 900;
  letter-spacing: 1px; transform: rotate(-12deg);
  flex-shrink: 0;
}

.inv-items-table { width: 100%; border-collapse: collapse; }
.inv-items-table thead tr { background: var(--bg); }
.inv-items-table th {
  padding: 10px 16px; font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.inv-items-table td {
  padding: 11px 16px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.inv-items-table tbody tr:last-child td { border-bottom: none; }
.inv-items-table tbody tr:hover { background: #f8fafc; }

.inv-totals-section {
  padding: 16px 36px 24px; margin-left: auto; max-width: 380px;
}
.inv-total-line {
  display: flex; justify-content: space-between;
  padding: 6px 0; font-size: 13px; border-bottom: 1px dashed var(--border);
  gap: 20px;
}
.inv-grand {
  background: var(--secondary); color: #fff;
  padding: 12px 16px; border-radius: 8px; margin-top: 8px;
  font-size: 16px; font-weight: 800; border-bottom: none;
}

.inv-footer-notes {
  background: var(--bg); padding: 16px 36px;
  font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--border);
  line-height: 1.6;
}
.inv-doc-footer {
  padding: 16px 36px; background: var(--secondary);
  font-size: 12px; color: #94a3b8; text-align: center;
}

/* ── Summary Box (used in income/expense pages) ── */
.summary-row { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.summary-box {
  flex: 1; min-width: 180px; background: var(--white);
  border-radius: var(--radius); padding: 18px 22px;
  box-shadow: var(--shadow); border-left: 4px solid var(--border);
}
.summary-box.income  { border-color: var(--success); }
.summary-box.expense { border-color: var(--danger); }
.summary-box.balance { border-color: var(--info); }
.s-label { font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.s-value { font-size: 20px; font-weight: 800; color: var(--text); }

@media (max-width: 768px) {
  .inv-doc-header  { flex-direction: column; }
  .inv-doc-meta    { text-align: left; }
  .inv-bill-section{ flex-direction: column; }
  .inv-line-header { display: none; }
  .inv-line-row    { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
  .inv-totals-box  { min-width: unset; width: 100%; }
  .inv-totals-section { max-width: 100%; }
}
