/* ══════════════════════════════════════════════════════════
   DiamondFlow — luxury-upgrade.css
   Premium Diamond & Colour Stone Trading ERP
   Deep Navy · Gold · Luxury Refinement
   Load LAST, after all other CSS files
══════════════════════════════════════════════════════════ */

/* ── Extended CSS Variables ─────────────────────────────── */
:root {
  --gold:          #C89A3A;
  --gold-light:    #F0D080;
  --gold-pale:     #FDF8EC;
  --gold-border:   rgba(200, 154, 58, 0.3);
  --navy:          #1C3557;
  --navy-deep:     #0F1F33;
  --navy-light:    #2A4D7A;
  --profit-green:  #15803d;
  --profit-bg:     #f0fdf4;
  --loss-red:      #b91c1c;
  --loss-bg:       #fef2f2;
}

/* ── Brand Refresh ───────────────────────────────────────── */
.brand-name {
  background: linear-gradient(135deg, #fff 40%, var(--gold-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ══════════════════════════════════════════════════════════
   DASHBOARD TAB
══════════════════════════════════════════════════════════ */

#tab-dashboard {
  max-width: 100%;
  padding: 32px 48px 60px;
}

/* ── KPI Cards Row ───────────────────────────────────────── */
.dash-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.dash-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.dash-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gold);
}

.dash-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.dash-kpi-card--profit::before { background: linear-gradient(90deg, #15803d, #4ade80); }
.dash-kpi-card--purchase::before { background: linear-gradient(90deg, #2563eb, #60a5fa); }
.dash-kpi-card--sales::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.dash-kpi-card--stock::before { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }

.kpi-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  margin-bottom: 4px;
}

.kpi-icon--gold    { background: var(--gold-pale); }
.kpi-icon--green   { background: #f0fdf4; }
.kpi-icon--blue    { background: #eff6ff; }
.kpi-icon--purple  { background: #faf5ff; }

.kpi-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-light);
}

.kpi-value {
  font-family: 'DM Mono', monospace;
  font-size: 26px;
  font-weight: 500;
  color: var(--accent);
  line-height: 1;
}

.kpi-sub {
  font-size: 12px;
  color: var(--ink-light);
}

/* ── Dashboard Filters ───────────────────────────────────── */
.dash-filter-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  flex-wrap: wrap;
}

.dash-filter-bar label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-light);
  white-space: nowrap;
}

.dash-filter-select {
  padding: 7px 28px 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  transition: border-color 0.18s;
}

.dash-filter-select:focus {
  border-color: var(--accent);
}

.dash-filter-input {
  padding: 7px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  outline: none;
  transition: border-color 0.18s;
}

.dash-filter-input:focus { border-color: var(--accent); }

/* ── Dashboard Tables ────────────────────────────────────── */
.dash-section-title {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  color: var(--accent);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.dash-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gold-border);
}

.dash-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
}

.dash-profit-row td:last-child {
  font-family: 'DM Mono', monospace;
  font-weight: 600;
}

.dash-profit-pos { color: var(--profit-green) !important; }
.dash-profit-neg { color: var(--loss-red) !important; }

/* ── Export buttons ──────────────────────────────────────── */
.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #15803d;
  background: #dcfce7;
  border: 1.5px solid #86efac;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s;
}

.btn-export:hover {
  background: #bbf7d0;
  border-color: #4ade80;
  transform: translateY(-1px);
}


/* ══════════════════════════════════════════════════════════
   PURCHASE REPORT TAB
══════════════════════════════════════════════════════════ */

#tab-purchase {
  max-width: 100%;
  padding: 32px 48px 60px;
}

/* ── Purchase Form Card ──────────────────────────────────── */
.purchase-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 28px;
  align-items: start;
}

.purchase-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: 88px;
}

.purchase-form-header {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid var(--gold);
}

.purchase-form-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: #fff;
  font-weight: 600;
}

.purchase-form-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Auto-calc display ───────────────────────────────────── */
.purch-total-display {
  background: linear-gradient(135deg, var(--gold-pale), #fff9e8);
  border: 1.5px solid var(--gold-border);
  border-radius: 10px;
  padding: 14px 18px;
  text-align: center;
}

.purch-total-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #92400e;
  margin-bottom: 4px;
}

.purch-total-value {
  font-family: 'DM Mono', monospace;
  font-size: 28px;
  font-weight: 500;
  color: var(--navy);
}

/* ── Purchase Table Card ─────────────────────────────────── */
.purchase-table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.purchase-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  gap: 14px;
  flex-wrap: wrap;
}

.purchase-table-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: var(--accent);
}

/* ── Vendor filter row ───────────────────────────────────── */
.purch-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}

/* ── Luxury data table shared ────────────────────────────── */
.luxury-table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
}

.luxury-table thead th {
  background: linear-gradient(135deg, var(--navy) 0%, #1a3252 100%);
  color: #fff;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 14px 18px;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.luxury-table thead th:first-child { border-radius: 0; }

/* Numeric column headers align right — matches td.tc-num */
.luxury-table thead th:nth-child(2),
.luxury-table thead th:nth-child(3),
.luxury-table thead th:nth-child(4),
.luxury-table thead th:nth-child(5) {
  text-align: right;
}

/* tc-num on th (for explicit usage) */
.luxury-table thead th.tc-num { text-align: right; }

.luxury-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.luxury-table tbody tr:last-child { border-bottom: none; }

.luxury-table tbody tr:hover {
  background: rgba(28, 53, 87, 0.04) !important;
}

.luxury-table tbody tr:nth-child(even) {
  background: rgba(28, 53, 87, 0.02);
}

.luxury-table td {
  padding: 13px 18px;
  font-size: 13.5px;
  color: var(--ink-mid);
  vertical-align: middle;
}

.luxury-table td.tc-num {
  font-family: 'DM Mono', monospace;
  text-align: right;
}

.luxury-table td.tc-bold {
  font-weight: 600;
  color: var(--ink);
}

/* ── Sortable TH ─────────────────────────────────────────── */
.lux-th-sort {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.lux-th-sort:hover { background: rgba(255,255,255,0.08) !important; }
.lux-th-sort.asc, .lux-th-sort.desc { background: rgba(255,255,255,0.12) !important; }

.lux-sort-icon {
  display: inline-block;
  font-size: 10px;
  color: var(--gold-light);
  font-weight: 700;
  min-width: 12px;
  margin-left: 3px;
}

/* ── Icon action buttons (luxury style) ─────────────────── */
.lux-action-btns {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.lux-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
  flex-shrink: 0;
}

.lux-icon-btn svg { width: 14px; height: 14px; pointer-events: none; }

.lux-icon-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }

.lux-icon-btn--edit   { background: #fffbeb; color: #d97706; border-color: #fde68a; }
.lux-icon-btn--edit:hover { background: #fef3c7; color: #b45309; border-color: #fcd34d; }

.lux-icon-btn--delete { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.lux-icon-btn--delete:hover { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }

/* ── Empty state ─────────────────────────────────────────── */
.lux-empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--ink-light);
}

.lux-empty-state .empty-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 10px;
}

.lux-empty-state p {
  font-size: 14px;
}


/* ══════════════════════════════════════════════════════════
   SALES REPORT TAB
══════════════════════════════════════════════════════════ */

#tab-sales {
  max-width: 100%;
  padding: 32px 48px 60px;
}

.sales-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 28px;
  align-items: start;
}

.sales-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: sticky;
  top: 88px;
}

.sales-form-header {
  background: linear-gradient(135deg, #4c1d95 0%, #6d28d9 100%);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 2px solid #a78bfa;
}

.sales-form-header h3 {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  color: #fff;
  font-weight: 600;
}

.sales-form-body {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Sales auto-calc panel ───────────────────────────────── */
.sales-calc-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.sales-calc-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

.sales-calc-row:last-child { border-bottom: none; }

.sales-calc-row.grand {
  background: var(--accent);
  padding: 12px 14px;
}

.sales-calc-row.grand span { color: rgba(255,255,255,0.75); font-weight: 600; }
.sales-calc-row.grand strong {
  font-family: 'DM Mono', monospace;
  color: var(--gold-light);
  font-size: 18px;
}

.sales-calc-row span { color: var(--ink-mid); }
.sales-calc-row strong {
  font-family: 'DM Mono', monospace;
  color: var(--ink);
  font-size: 14px;
}

/* ── Profit / Loss indicator ─────────────────────────────── */
.profit-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  white-space: nowrap;
}

.profit-badge--profit {
  background: var(--profit-bg);
  color: var(--profit-green);
  border: 1px solid #bbf7d0;
}

.profit-badge--loss {
  background: var(--loss-bg);
  color: var(--loss-red);
  border: 1px solid #fecaca;
}

/* ── VAT Mode compact toggle in sales form ───────────────── */
.sales-vat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
}

.sales-vat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-mid);
}

/* ── Stock warning ───────────────────────────────────────── */
.stock-warning {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  font-size: 12.5px;
  color: #92400e;
  font-weight: 500;
}

.stock-warning.critical {
  background: var(--loss-bg);
  border-color: #fca5a5;
  color: var(--loss-red);
}


/* ══════════════════════════════════════════════════════════
   SHARED FORM UTILITIES
══════════════════════════════════════════════════════════ */

/* Compact 2-col grid for forms */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Input with unit label */
.input-unit-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.input-unit-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28,53,87,0.09);
}

.input-unit-wrap .form-input {
  border: none !important;
  box-shadow: none !important;
  flex: 1;
  border-radius: 0 !important;
}

.input-unit-wrap .form-input:focus {
  box-shadow: none !important;
}

.input-unit-label {
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-light);
  background: var(--bg);
  border-left: 1.5px solid var(--border);
  height: 100%;
  display: flex;
  align-items: center;
  white-space: nowrap;
  min-height: 40px;
}

.input-unit-prefix {
  padding: 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold);
  background: var(--gold-pale);
  border-right: 1.5px solid var(--gold-border);
  min-height: 40px;
  display: flex;
  align-items: center;
}

/* Section dividers in forms */
.form-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-light);
  padding: 6px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}

/* ── Tooltip hints ───────────────────────────────────────── */
[title] { cursor: help; }

/* ── Gold section accent bar ─────────────────────────────── */
.gold-accent-bar {
  height: 2px;
  background: linear-gradient(90deg, var(--gold), transparent);
  border-radius: 2px;
  margin: 2px 0 12px;
}


/* ══════════════════════════════════════════════════════════
   PAGE TITLE ROWS — UPGRADE
══════════════════════════════════════════════════════════ */

.page-title-row {
  align-items: center;
}

.page-title-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Tab nav extra tabs ──────────────────────────────────── */
.tab-nav .tab-btn[data-tab="purchase"],
.tab-nav .tab-btn[data-tab="sales"],
.tab-nav .tab-btn[data-tab="dashboard"] {
  /* Same style as other tabs — inherited */
}


/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
  #tab-dashboard,
  #tab-purchase,
  #tab-sales {
    padding: 28px 32px 60px;
  }

  .dash-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .purchase-layout,
  .sales-layout {
    grid-template-columns: 340px 1fr;
  }
}

@media (max-width: 992px) {
  #tab-dashboard,
  #tab-purchase,
  #tab-sales {
    padding: 24px 20px 48px;
  }

  .dash-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .purchase-layout,
  .sales-layout {
    grid-template-columns: 1fr;
  }

  .purchase-form-card,
  .sales-form-card {
    position: static;
  }
}

@media (max-width: 640px) {
  #tab-dashboard,
  #tab-purchase,
  #tab-sales {
    padding: 16px 14px 40px;
  }

  .dash-kpi-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .kpi-value { font-size: 20px; }

  .form-grid-2 { grid-template-columns: 1fr; }

  .purchase-form-header,
  .sales-form-header {
    padding: 14px 16px;
  }

  .purchase-form-body,
  .sales-form-body {
    padding: 14px 16px;
  }
}

@media (max-width: 480px) {
  .dash-kpi-row { grid-template-columns: 1fr; }
}


/* ══════════════════════════════════════════════════════════
   TOAST UPGRADE
══════════════════════════════════════════════════════════ */

.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  min-width: 260px;
  max-width: 360px;
  padding: 14px 20px;
  border-radius: 12px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast--success {
  background: #1a3252;
  color: #fff;
  border-left: 4px solid var(--gold);
}

.toast.toast--error {
  background: #7f1d1d;
  color: #fff;
  border-left: 4px solid #ef4444;
}

.toast.toast--info {
  background: #1e293b;
  color: #fff;
  border-left: 4px solid #60a5fa;
}

.toast.toast--warning {
  background: #78350f;
  color: #fff;
  border-left: 4px solid var(--gold);
}

/* ══════════════════════════════════════════════════════════
   DASHBOARD ANALYTICS — dashboard.js styles
   Charts, Alerts, Top Stones, Recent Invoices
══════════════════════════════════════════════════════════ */

/* ── Charts Row ─────────────────────────────────────────── */
.dash-charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

/* Wide card (Trend) spans full width */
.dash-chart-card--wide {
  grid-column: 1 / -1;
}

/* When trend is absent, profit + revenue sit side by side */
.dash-charts-row:not(:has(.dash-chart-card--wide)) {
  grid-template-columns: 1fr 1fr;
}

.dash-chart-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e4e8ef);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.dash-chart-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 20px 10px;
  border-bottom: 1px solid var(--border, #e4e8ef);
}

.dash-chart-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink, #1e293b);
  letter-spacing: 0.01em;
}

.dash-chart-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: var(--ink-light, #94a3b8);
  font-weight: 400;
}

.dash-chart-body {
  padding: 16px 16px 12px;
  position: relative;
  height: 220px;
}

.dash-chart-body--donut {
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Bottom Row (3 panels) ──────────────────────────────── */
.dash-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 20px;
  margin-top: 8px;
  margin-bottom: 40px;
}

.dash-panel {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e4e8ef);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
}

.dash-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border, #e4e8ef);
  background: var(--bg, #fafafa);
}

.dash-panel-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
}

.dash-panel-icon--warn { background: #fef9c3; color: #b45309; }
.dash-panel-icon--gold { background: rgba(200,154,58,0.12); color: #b8882e; }
.dash-panel-icon--blue { background: #eff6ff; color: #2563eb; }

.dash-panel-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink, #1e293b);
  flex: 1;
}

.dash-panel-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: #ef4444;
  color: #fff;
  border-radius: 20px;
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  font-weight: 700;
}

.dash-panel-body {
  flex: 1;
  overflow-y: auto;
  max-height: 260px;
  padding: 8px 0;
}

.dash-panel-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 24px 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--ink-light, #94a3b8);
}

/* ── Inventory Alert Items ───────────────────────────────── */
.dash-alert-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border, #e4e8ef);
  transition: background 0.15s;
}

.dash-alert-item:last-child { border-bottom: none; }
.dash-alert-item:hover { background: rgba(0,0,0,0.02); }

.dash-alert-badge {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.dash-alert-item--low .dash-alert-badge {
  background: #fef9c3;
  color: #854d0e;
  border: 1px solid #fde047;
}

.dash-alert-item--out .dash-alert-badge {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

.dash-alert-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-alert-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #1e293b);
}

.dash-alert-qty {
  font-family: 'DM Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-light, #94a3b8);
}

.dash-alert-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  flex-shrink: 0;
  animation: dash-pulse 2s infinite;
}

.dash-alert-indicator--out {
  background: #ef4444;
}

@keyframes dash-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ── Top Stones ──────────────────────────────────────────── */
.dash-stone-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border, #e4e8ef);
  transition: background 0.15s;
}

.dash-stone-row:last-child { border-bottom: none; }
.dash-stone-row:hover { background: rgba(0,0,0,0.02); }

.dash-stone-rank {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 700;
  min-width: 28px;
  text-align: center;
}

.dash-stone-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dash-stone-name {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #1e293b);
}

.dash-stone-bar-wrap {
  height: 4px;
  background: rgba(0,0,0,0.06);
  border-radius: 4px;
  overflow: hidden;
}

.dash-stone-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}

.dash-stone-stats {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.dash-stone-value {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #1e293b);
}

.dash-stone-txn {
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px;
  color: var(--ink-light, #94a3b8);
}

/* ── Recent Invoices ─────────────────────────────────────── */
.dash-inv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border, #e4e8ef);
  transition: background 0.15s;
}

.dash-inv-row:last-child { border-bottom: none; }
.dash-inv-row:hover { background: rgba(0,0,0,0.02); }

.dash-inv-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dash-inv-badge {
  font-family: 'DM Sans', sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}

.dash-inv-badge--sales {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.dash-inv-badge--purchase {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.dash-inv-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.dash-inv-num {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent, #1C3557);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-inv-customer {
  font-family: 'DM Sans', sans-serif;
  font-size: 11.5px;
  color: var(--ink-light, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.dash-inv-right {
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.dash-inv-total {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink, #1e293b);
}

.dash-inv-date {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: var(--ink-light, #94a3b8);
}

/* ── Responsive Charts ───────────────────────────────────── */
@media (max-width: 1200px) {
  .dash-charts-row {
    grid-template-columns: 1fr 1fr;
  }
  .dash-chart-card--wide {
    grid-column: 1 / -1;
  }
  .dash-bottom-row {
    grid-template-columns: 1fr 1fr;
  }
  .dash-panel--recent {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .dash-charts-row {
    grid-template-columns: 1fr;
  }
  .dash-chart-card--wide {
    grid-column: auto;
  }
  .dash-bottom-row {
    grid-template-columns: 1fr;
  }
  .dash-panel--recent {
    grid-column: auto;
  }
  .dash-chart-body {
    height: 180px;
  }
}

/* ══════════════════════════════════════════════════════════
   NAVBAR PREMIUM THEME OVERRIDE
   Replaces navy gradient with deeper #003366 → #002244 tone.
   Elevates active tab with azure-white fill + navy text.
   Load LAST — safe override via specificity + !important.
══════════════════════════════════════════════════════════ */

/* ── 1. Navbar background ────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, #003366 0%, #002244 100%) !important;
  box-shadow:
    0 2px 0 rgba(200, 154, 58, 0.22),
    0 4px 28px rgba(0, 0, 0, 0.32) !important;
  border-bottom: 1px solid rgba(200, 154, 58, 0.15) !important;
}

/* ── 2. Tab container pill ───────────────────────────────── */
.tab-nav {
  background: rgba(255, 255, 255, 0.07) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

/* ── 3. Default tab — faded white ────────────────────────── */
.tab-btn {
  color: rgba(255, 255, 255, 0.55) !important;
  opacity: 1 !important;
}

/* ── 4. Hover — brighter white + subtle highlight ─────────── */
.tab-btn:hover {
  color: rgba(255, 255, 255, 0.95) !important;
  background: rgba(255, 255, 255, 0.12) !important;
}

.tab-btn:active {
  background: rgba(255, 255, 255, 0.08) !important;
}

/* ── 5. Active tab — azure-white bg, deep navy text ─────── */
.tab-btn.active {
  background: #F0FFFF !important;
  color: #003366 !important;
  font-weight: 700 !important;
  box-shadow:
    0 2px 10px rgba(0, 0, 0, 0.22),
    0 1px 4px rgba(0, 51, 102, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
}

/* ── 6. FOUC guard — match faded default until nav is ready */
.tab-nav:not(.tab-nav-ready) .tab-btn {
  opacity: 0.55 !important;
}
.tab-nav.tab-nav-ready .tab-btn {
  opacity: 1 !important;
}