:root {
  --sb-primary: #0f2b5c;
  --sb-primary-dark: #0b1f42;
  --sb-primary-light: #2563eb;
  --sb-accent: #f59e0b;
  --sb-accent-hover: #d97706;
  --sb-bg: #f8fafc;
  --sb-card-bg: #ffffff;
  --sb-border: #e2e8f0;
  --sb-border-subtle: #f1f5f9;
  --sb-text: #0f172a;
  --sb-muted: #64748b;
  --sb-success: #10b981;
  --sb-danger: #ef4444;
  --sb-info: #0284c7;
  --sb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --sb-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --sb-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

html {
  scroll-behavior: smooth;
}

section[id] {
  scroll-margin-top: 85px;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--sb-bg);
  color: var(--sb-text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.badge-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  margin-right: 6px;
  vertical-align: middle;
}

/* Custom Scrollbar for sleek horizontal tables */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Brand Header & Navbar */
.navbar-star {
  background: linear-gradient(180deg, #0b1f42 0%, #081733 100%);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.15);
  border-bottom: 2px solid var(--sb-accent);
  padding: 0.65rem 1rem;
}

.navbar-star .navbar-brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: -0.01em;
}

.brand-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  box-shadow: 0 2px 4px rgba(217, 119, 6, 0.3);
}

.navbar-star .nav-link {
  color: #cbd5e1 !important;
  font-weight: 500;
  font-size: 0.90rem;
  padding: 0.55rem 0.90rem !important;
  border-radius: 8px;
  transition: all 0.18s ease-in-out;
  display: inline-flex;
  align-items: center;
}

.navbar-star .nav-link:hover {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.navbar-star .nav-link.active {
  color: #ffffff !important;
  background-color: rgba(255, 255, 255, 0.14);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Stat & Metric Cards */
.card-stat {
  border: 1px solid var(--sb-border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: var(--sb-shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  position: relative;
}

.card-stat:hover {
  transform: translateY(-3px);
  box-shadow: var(--sb-shadow-lg);
  border-color: #cbd5e1;
}

.card-stat .stat-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.45rem;
}

.stat-icon.primary { background: #eff6ff; color: #2563eb; }
.stat-icon.success { background: #ecfdf5; color: #059669; }
.stat-icon.warning { background: #fffbeb; color: #d97706; }
.stat-icon.danger { background: #fef2f2; color: #dc2626; }
.stat-icon.info { background: #f0fdfa; color: #0d9488; }

/* Filter & Action Toolbars */
.filters-card {
  border: 1px solid var(--sb-border);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--sb-shadow-sm);
}

.filters-card .form-control,
.filters-card .form-select {
  border-radius: 8px;
  border-color: #cbd5e1;
  font-size: 0.88rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.filters-card .form-control:focus,
.filters-card .form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Modern Ledger Table */
.table-responsive {
  border-radius: 12px;
  overflow-x: auto;
}

.table-custom {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.table-custom thead th {
  background-color: #f8fafc;
  color: #334155;
  font-weight: 700;
  font-size: 0.80rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #cbd5e1;
  border-top: 1px solid var(--sb-border);
  padding: 12px 14px;
  vertical-align: middle;
  white-space: nowrap;
}

.table-custom tbody tr {
  transition: background-color 0.15s ease;
}

.table-custom tbody tr:nth-child(even) {
  background-color: #fbfcfe;
}

.table-custom tbody tr:hover {
  background-color: #f0f7ff !important;
}

.table-custom tbody td {
  padding: 12px 14px;
  vertical-align: middle;
  border-bottom: 1px solid #edf2f7;
  font-size: 0.90rem;
}

/* 10 Cement Formula Columns Styling */
.th-rmc-formula {
  background-color: #dbeafe !important;
  color: #1e3a8a !important;
  font-weight: 700 !important;
  border-left: 1px solid #bfdbfe !important;
  border-right: 1px solid #bfdbfe !important;
  text-align: right !important;
  font-size: 0.78rem;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.td-rmc-formula {
  background-color: #f8fbff;
  border-left: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  text-align: right;
  font-size: 0.86rem;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.table-custom tbody tr:hover .td-rmc-formula {
  background-color: #e0f2fe !important;
}

/* Badges */
.badge-balance-zero {
  background-color: #d1fae5;
  color: #065f46;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #a7f3d0;
  font-size: 0.78rem;
}

.badge-balance-due {
  background-color: #fee2e2;
  color: #991b1b;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #fecaca;
  font-size: 0.78rem;
}

.badge-balance-advance {
  background-color: #e0f2fe;
  color: #075985;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #bae6fd;
  font-size: 0.78rem;
}

/* Action Buttons */
.action-btns .btn {
  padding: 5px 9px;
  font-size: 0.82rem;
  border-radius: 7px;
  transition: all 0.15s ease;
}

.action-btns .btn:hover {
  transform: translateY(-1px);
}

/* Brand Logo Image */
.brand-logo-img {
  max-height: 48px;
  width: auto;
  object-fit: contain;
}

/* Form inputs & controls */
.form-control, .form-select {
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 0.92rem;
}

.form-control:focus, .form-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* Delivery Slip / Printable Voucher Styling */
.receipt-card {
  max-width: 760px;
  margin: 0 auto;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  padding: 36px 40px;
  border-radius: 16px;
  box-shadow: var(--sb-shadow-lg);
}

/* ========================================================
   PRINT STYLES
   Ensures ONLY requested fields (Name, Place, DC Quantity,
   Amount, Recieved Amount, Balance Amount) print with
   Star Buildcon header and zero unnecessary clutter.
   ======================================================== */
@media print {
  @page {
    margin: 10mm;
    size: auto;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
  }

  .no-print,
  .d-print-none,
  nav.navbar,
  footer,
  .filters-card,
  .action-btns,
  .pagination,
  .btn,
  .alert {
    display: none !important;
  }

  /* Printable Slip Card */
  .receipt-card {
    border: 2px solid #000000 !important;
    box-shadow: none !important;
    padding: 24px !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    background: #ffffff !important;
    page-break-inside: avoid;
  }

  .receipt-card img {
    max-height: 60px !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Table styling on print */
  .print-focused-table {
    border: 2px solid #000000 !important;
    width: 100% !important;
    border-collapse: collapse !important;
  }

  .print-focused-table th,
  .print-focused-table td {
    border: 1.5px solid #000000 !important;
    padding: 10px 14px !important;
    color: #000000 !important;
  }

  .print-focused-table th {
    background-color: #f1f5f9 !important;
    font-weight: 700 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Hide formulas and internal balances on print */
  .th-rmc-formula,
  .td-rmc-formula,
  th:has(.bi-calculator),
  td.bg-success.bg-opacity-10,
  td.bg-primary.bg-opacity-10,
  th.bg-success,
  th.bg-primary {
    display: none !important;
  }
}
