@import "tailwindcss";

@custom-variant dark (&:where(.dark, .dark *));

@source "../../Views/**/*.cshtml";
@source "../../Views";
@source "../../wwwroot/js/**/*.js";
@source "../../**/*.cshtml";
@source "../..";

@theme {
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --shadow-soft: 0 18px 55px rgba(15, 23, 42, 0.08);
  --shadow-glow: 0 20px 80px rgba(37, 99, 235, 0.24);
}

/* ──────────────────────────────────────────────────────────────────────────
   FBR DIGITAL INVOICING ERP — MODERN ENTERPRISE DESIGN SYSTEM
   Visual Benchmark: LedgerLite Workspace (Index.html)
   ────────────────────────────────────────────────────────────────────────── */

:root {
  --sidebar-width: 288px;
  --sidebar-collapsed-width: 78px;
  --topbar-height: 76px;

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

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

html,
body {
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, .7) transparent;
}

*::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, .5);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(100, 116, 139, .8);
}

.nav-scroll,
.sidebar,
.no-scrollbar {
  scrollbar-width: none !important;
  -ms-overflow-style: none !important;
}

.nav-scroll::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.no-scrollbar::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ──────────────────────────────────────────────────────────────────────────
   GLASS SURFACES & APP SHELL
   ────────────────────────────────────────────────────────────────────────── */
.glass-panel {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(226, 232, 240, 0.9);
  backdrop-filter: blur(22px);
}

.dark .glass-panel {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(51, 65, 85, 0.85);
}

.app-shell {
  min-height: 100vh;
  max-width: 100vw;
  width: 100%;
  overflow-x: clip;
  background:
    radial-gradient(circle at top left, rgba(59, 130, 246, .16), transparent 36rem),
    radial-gradient(circle at top right, rgba(20, 184, 166, .14), transparent 32rem),
    linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

.dark .app-shell {
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .22), transparent 36rem),
    radial-gradient(circle at top right, rgba(14, 165, 233, .13), transparent 32rem),
    linear-gradient(135deg, #020617 0%, #0f172a 100%);
}

.shadow-soft {
  box-shadow: 0 18px 55px rgba(15, 23, 42, 0.08);
}

.shadow-glow {
  box-shadow: 0 20px 80px rgba(37, 99, 235, 0.24);
}

/* ──────────────────────────────────────────────────────────────────────────
   SIDEBAR & TOPBAR RESPONSIVE LAYOUT
   ────────────────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-width);
  transition: width .25s ease, transform .25s ease, box-shadow .25s ease;
}

.app-topbar {
  left: var(--sidebar-width);
  transition: left .25s ease;
}

.main-content {
  margin-left: var(--sidebar-width);
  padding-top: var(--topbar-height);
  transition: margin-left .25s ease;
  max-width: 100%;
  overflow-x: clip;
}

.sidebar-brand-header {
  height: var(--topbar-height);
}

.sidebar-logo-trigger {
  min-width: 0;
  transition: width .25s ease, padding .25s ease, background .2s ease;
}

.sidebar-brand-text,
.sidebar-section-title,
.sidebar-text,
.sidebar-arrow,
.sidebar-footer-text {
  transition: width .22s ease, opacity .18s ease;
}

.nav-group,
.nav-single {
  position: relative;
}

.nav-link,
.nav-toggle {
  min-height: 46px;
  transition: background .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.nav-link:hover,
.nav-toggle:hover {
  transform: translateX(2px);
  background-color: rgba(241, 245, 249, 0.9);
  color: #0f172a;
}

.dark .nav-link:hover,
.dark .nav-toggle:hover {
  background-color: rgba(30, 41, 59, 0.7);
  color: #ffffff;
}

.nav-link.active,
.nav-toggle.active {
  color: #ffffff !important;
  background: linear-gradient(135deg, #2563eb 0%, #0f766e 100%);
  box-shadow: 0 14px 32px rgba(37, 99, 235, .28);
}

.nav-link.active .nav-icon,
.nav-toggle.active .nav-icon {
  color: #ffffff !important;
  background: rgba(255, 255, 255, .18) !important;
}

.nav-link.active i,
.nav-toggle.active i,
.collapsed-flyout a.active i {
  color: #ffffff !important;
}

.collapsed-flyout a.active {
  color: #ffffff !important;
  background: linear-gradient(135deg, #2563eb 0%, #0f766e 100%);
  box-shadow: 0 12px 28px rgba(37, 99, 235, .24);
}

.nav-icon,
.sidebar-logo-mark,
.sidebar-logo-mark-text,
.sidebar-logo-expand-icon {
  transition: transform .28s cubic-bezier(.2,.8,.2,1), opacity .22s ease, background .22s ease, color .22s ease;
}

.sidebar-logo-mark,
.sidebar-logo-mark-text,
.sidebar-logo-expand-icon {
  transform-origin: center center;
}

.sidebar-logo-expand-icon {
  inset: 0;
  display: grid;
  place-items: center;
  line-height: 1;
}

.submenu {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .26s ease, opacity .22s ease, margin .22s ease;
  opacity: 0;
  margin-top: 0;
}

.submenu.open {
  grid-template-rows: 1fr;
  opacity: 1;
  margin-top: .35rem;
}

.submenu > div {
  overflow: hidden;
}

.submenu-arrow {
  transition: transform .22s ease;
}

.nav-toggle[aria-expanded="true"] .submenu-arrow {
  transform: rotate(90deg);
}

.collapsed-flyout {
  display: none;
}

/* ──────────────────────────────────────────────────────────────────────────
   COLLAPSED SIDEBAR (DESKTOP)
   ────────────────────────────────────────────────────────────────────────── */
@media (min-width: 1024px) {
  .sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
  }

  .sidebar-collapsed .app-topbar {
    left: var(--sidebar-collapsed-width);
  }

  .sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
  }

  .sidebar-collapsed .sidebar-brand-text,
  .sidebar-collapsed .sidebar-section-header,
  .sidebar-collapsed .sidebar-section-title,
  .sidebar-collapsed .sidebar-text,
  .sidebar-collapsed .sidebar-arrow,
  .sidebar-collapsed .sidebar-footer-text {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }

  .sidebar-collapsed .sidebar-collapse-button {
    display: none;
  }

  .sidebar-collapsed .sidebar-brand-header {
    justify-content: center;
    padding-inline: 0.5rem;
    height: var(--topbar-height);
  }

  .sidebar-collapsed .sidebar-logo-trigger {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: grid;
    place-items: center;
    padding: 0;
    margin-inline: auto;
    cursor: pointer;
    border-radius: 1rem;
  }

  .sidebar-collapsed .sidebar-logo-mark {
    height: 44px;
    width: 44px;
    border-radius: 0.875rem;
    transform: translateZ(0);
  }

  .sidebar-collapsed .sidebar-logo-trigger:hover .sidebar-logo-mark {
    transform: scale(1.04);
  }

  .sidebar-collapsed .sidebar-logo-trigger:hover .sidebar-logo-mark-text {
    opacity: 0;
    transform: scale(.72);
  }

  .sidebar-collapsed .sidebar-logo-trigger:hover .sidebar-logo-expand-icon {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }

  .sidebar-collapsed .sidebar-logo-trigger:hover {
    background: rgba(241, 245, 249, .95);
  }

  .dark .sidebar-collapsed .sidebar-logo-trigger:hover {
    background: rgba(15, 23, 42, .95);
  }

  .sidebar-collapsed .nav-scroll {
    padding: 0.75rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    overflow-x: hidden;
  }

  .sidebar-collapsed .nav-scroll > * {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .sidebar-collapsed .nav-single,
  .sidebar-collapsed .nav-group {
    width: 100%;
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0;
  }

  .sidebar-collapsed .nav-link,
  .sidebar-collapsed .nav-toggle {
    width: 48px;
    height: 48px;
    min-height: 48px;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 0;
    margin-inline: auto;
    border-radius: 1rem;
    display: grid;
    place-items: center;
    transition: transform .24s cubic-bezier(.2,.8,.2,1), background .22s ease, box-shadow .22s ease;
  }

  .sidebar-collapsed .nav-link:hover,
  .sidebar-collapsed .nav-toggle:hover {
    transform: translateY(-1px) scale(1.04);
  }

  .sidebar-collapsed .nav-icon {
    height: 48px;
    width: 48px;
    display: grid;
    place-items: center;
    border-radius: 1rem;
    margin: 0;
    font-size: 1.15rem;
  }

  .sidebar-collapsed .submenu {
    display: none !important;
  }

  .sidebar-collapsed .sidebar-footer-wrapper {
    padding: 0.75rem 0.5rem;
    display: flex;
    justify-content: center;
  }

  .sidebar-collapsed .sidebar-footer-badge {
    width: 48px;
    height: 48px;
    padding: 0;
    margin: 0 auto;
    border-radius: 1rem;
    display: grid;
    place-items: center;
  }

  .sidebar-collapsed .collapsed-flyout {
    position: fixed;
    left: calc(var(--sidebar-collapsed-width) - 2px);
    top: var(--flyout-top, 100px);
    z-index: 70;
    display: block;
    min-width: 238px;
    max-width: 280px;
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, .98);
    padding: .55rem;
    color: #0f172a;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .18);
    opacity: 0;
    pointer-events: none;
    transform: translateX(-6px) scale(.96);
    transform-origin: left center;
    transition: opacity .2s ease, transform .24s cubic-bezier(.2,.8,.2,1);
  }

  .sidebar-collapsed .collapsed-flyout::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: -22px;
    width: 24px;
  }

  .dark .sidebar-collapsed .collapsed-flyout {
    border-color: rgba(51, 65, 85, .95);
    background: rgba(15, 23, 42, .98);
    color: #f8fafc;
  }

  .sidebar-collapsed .nav-group:hover > .collapsed-flyout,
  .sidebar-collapsed .nav-group:focus-within > .collapsed-flyout,
  .sidebar-collapsed .nav-single:hover > .collapsed-flyout,
  .sidebar-collapsed .nav-single:focus-within > .collapsed-flyout,
  .sidebar-collapsed .sidebar-footer-wrapper:hover > .collapsed-flyout {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0) scale(1);
  }

  .sidebar-collapsed .collapsed-flyout-small {
    min-width: 142px;
    width: max-content;
    padding: .75rem .95rem;
  }
}

/* ──────────────────────────────────────────────────────────────────────────
   MOBILE DRAWER
   ────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1023px) {
  .app-topbar {
    left: 0;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 55;
    width: min(var(--sidebar-width), 88vw) !important;
    transform: translateX(-110%);
    background: #ffffff !important;
    color: #0f172a !important;
  }

  .dark .sidebar {
    background: #020617 !important;
    color: #f8fafc !important;
  }

  .mobile-nav-open .sidebar {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(15, 23, 42, .18);
  }

  .main-content,
  .sidebar-collapsed .main-content {
    margin-left: 0;
  }

  .sidebar .nav-toggle,
  .sidebar .nav-link {
    color: #334155;
  }

  .dark .sidebar .nav-toggle,
  .dark .sidebar .nav-link {
    color: #cbd5e1;
  }

  .sidebar .nav-toggle.active,
  .sidebar .nav-link.active,
  .dark .sidebar .nav-toggle.active,
  .dark .sidebar .nav-link.active {
    color: #ffffff !important;
  }

  .sidebar .nav-toggle.active .nav-icon,
  .sidebar .nav-link.active .nav-icon,
  .dark .sidebar .nav-toggle.active .nav-icon,
  .dark .sidebar .nav-link.active .nav-icon {
    color: #ffffff !important;
    background: rgba(255, 255, 255, .16) !important;
  }

  .sidebar .nav-toggle.active i,
  .sidebar .nav-link.active i,
  .dark .sidebar .nav-toggle.active i,
  .dark .sidebar .nav-link.active i {
    color: #ffffff !important;
  }

  .sidebar-collapsed .sidebar-brand-text,
  .sidebar-collapsed .sidebar-section-title,
  .sidebar-collapsed .sidebar-text,
  .sidebar-collapsed .sidebar-arrow,
  .sidebar-collapsed .sidebar-footer-text {
    width: auto;
    opacity: 1;
    overflow: visible;
    pointer-events: auto;
  }

  .sidebar-collapsed .sidebar-collapse-button {
    display: grid;
  }

  .collapsed-flyout {
    display: none !important;
  }
}

/* ──────────────────────────────────────────────────────────────────────────
   MODERN UI COMPONENTS (HERO, CARDS, BUTTONS, TABLES, FORMS)
   ────────────────────────────────────────────────────────────────────────── */

/* Glass Hero Card */
.page-hero {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(226, 232, 240, 0.9);
  backdrop-filter: blur(22px);
  border-radius: 2rem;
  padding: 1.75rem 2rem;
  box-shadow: 0 18px 55px rgba(15, 23, 42, 0.08);
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}

.dark .page-hero {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(51, 65, 85, 0.85);
}

.page-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  background-color: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: #2563eb;
}

.dark .page-hero-badge {
  background-color: rgba(37, 99, 235, 0.2);
  border-color: rgba(59, 130, 246, 0.35);
  color: #93c5fd;
}

.page-hero-title {
  font-size: 1.875rem;
  font-weight: 900;
  letter-spacing: -0.025em;
  color: #0f172a;
  line-height: 1.2;
}

.dark .page-hero-title {
  color: #ffffff;
}

.page-hero-subtitle {
  font-size: 0.9375rem;
  font-weight: 500;
  color: #64748b;
  margin-top: 0.5rem;
  max-width: 42rem;
  line-height: 1.5;
}

.dark .page-hero-subtitle {
  color: #cbd5e1;
}

/* Modern Enterprise Cards */
.card {
  background-color: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 1.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
  overflow: hidden;
}

.dark .card {
  background-color: #0f172a;
  border-color: #1e293b;
  color: #f8fafc;
}

/* Modern Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 800;
  font-size: 0.875rem;
  line-height: 1.25rem;
  padding: 0.625rem 1.125rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 180ms ease;
  user-select: none;
  white-space: nowrap;
  outline: none;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background-color: #ffffff;
  color: #334155;
  border-color: #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.dark .btn-secondary {
  background-color: #1e293b;
  color: #e2e8f0;
  border-color: #334155;
}

.btn-secondary:hover {
  background-color: #f8fafc;
  border-color: #cbd5e1;
  color: #0f172a;
}

.dark .btn-secondary:hover {
  background-color: #334155;
  border-color: #475569;
  color: #ffffff;
}

.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.25);
}

.btn-ghost {
  background: transparent;
  color: #475569;
}

.dark .btn-ghost {
  color: #94a3b8;
}

.btn-ghost:hover {
  background: rgba(241, 245, 249, 0.8);
  color: #0f172a;
}

.dark .btn-ghost:hover {
  background: rgba(30, 41, 59, 0.8);
  color: #ffffff;
}

/* Modern Form Inputs */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  color: #0f172a;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 1rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
  transition: all 150ms ease;
  outline: none;
}

.dark .form-input,
.dark .form-select,
.dark .form-textarea {
  background-color: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}

/* Leading Icon Input Group & Form Controls */
.input-icon-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-icon-group input,
.input-icon-group .form-input,
.input-icon-group select,
.input-icon-group .form-select,
.input-with-icon,
.pl-10-forced {
  padding-left: 2.75rem !important;
}

.input-icon-group > i,
.input-icon-group > svg,
.input-icon-left {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.dark .input-icon-group > i,
.dark .input-icon-group > svg,
.dark .input-icon-left {
  color: #64748b;
}

.input-icon-group:focus-within > i,
.input-icon-group:focus-within > svg {
  color: #2563eb;
}

.dark .input-icon-group:focus-within > i,
.dark .input-icon-group:focus-within > svg {
  color: #60a5fa;
}

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

/* Remove default browser number spinner arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Modern Input Group Addon */
.input-addon-group {
  display: flex;
  align-items: stretch;
  border-radius: 1rem;
  border: 1px solid #cbd5e1;
  background-color: #ffffff;
  overflow: hidden;
  transition: all 150ms ease;
  width: 100%;
}

.dark .input-addon-group {
  border-color: #334155;
  background-color: #0f172a;
}

.input-addon-group:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.input-addon {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.875rem;
  background-color: #f1f5f9;
  color: #475569;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  user-select: none;
  border-right: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.dark .input-addon {
  background-color: #1e293b;
  color: #94a3b8;
  border-color: #334155;
}

.input-addon-right {
  border-right: 0;
  border-left: 1px solid #e2e8f0;
}

.dark .input-addon-right {
  border-left-color: #334155;
}

.input-addon-group input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0 !important;
  background: transparent !important;
  padding: 0.625rem 0.875rem !important;
  outline: none !important;
  box-shadow: none !important;
  color: #0f172a;
}

.dark .input-addon-group input {
  color: #f8fafc;
}

/* ERP In-Table Compact Input Controls */
.table-input {
  width: 100%;
  padding: 0.375rem 0.5rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  line-height: 1.25 !important;
  color: #0f172a !important;
  background-color: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 0.5rem !important;
  outline: none !important;
  box-shadow: none !important;
  transition: all 120ms ease;
}

.dark .table-input {
  color: #f8fafc !important;
  background-color: #0b1329 !important;
  border-color: #334155 !important;
}

.table-input:focus {
  background-color: #ffffff !important;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2) !important;
}

.dark .table-input:focus {
  background-color: #020617 !important;
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25) !important;
}

/* KPI Summary Cards */
.kpi-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.75rem;
  padding: 1.25rem 1.5rem;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 0.2s ease;
}

.dark .kpi-card {
  background: #0f172a;
  border-color: #1e293b;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

/* Status Dots */
.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  display: inline-block;
  flex-shrink: 0;
}

.status-dot-active {
  background-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.status-dot-warning {
  background-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.status-dot-danger {
  background-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.status-dot-neutral {
  background-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(148, 163, 184, 0.2);
}

/* Table ERP */
.table-erp-wrapper {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #e2e8f0;
  border-radius: 1.25rem;
  background-color: #ffffff;
}

.dark .table-erp-wrapper {
  border-color: #1e293b;
  background-color: #0f172a;
}

.table-erp,
.table-modern {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.th-erp,
.table-modern thead th,
.table-modern th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 800;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.dark .th-erp,
.dark .table-modern thead th,
.dark .table-modern th {
  background-color: #0b1329;
  color: #94a3b8;
  border-bottom-color: #1e293b;
}

.td-erp,
.table-modern tbody td,
.table-modern td {
  padding: 0.875rem 1.25rem;
  color: #1e293b;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}

.dark .td-erp,
.dark .table-modern tbody td,
.dark .table-modern td {
  color: #e2e8f0;
  border-bottom-color: #1e293b;
}

/* ========================================================================= */
/* INVOICE CART TABLE (High-density, tight cell padding, zero wasted space) */
/* ========================================================================= */
.table-cart-container {
  overflow-x: auto !important;
  overflow-y: visible !important;
  position: relative;
  max-width: 100%;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.table-cart {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.table-cart th {
  background-color: #f8fafc;
  color: #64748b;
  font-weight: 800;
  font-size: 0.65rem !important;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.45rem 0.25rem !important;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}

.dark .table-cart th {
  background-color: #0b1329;
  color: #94a3b8;
  border-bottom-color: #1e293b;
}

.table-cart td {
  padding: 0.25rem 0.2rem !important;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
  position: relative;
}

.dark .table-cart td {
  border-bottom-color: #1e293b;
}

.table-cart input.table-input,
.table-cart select.table-input {
  width: 100%;
  padding: 0.25rem 0.35rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  border-radius: 0.375rem !important;
  border: 1px solid #cbd5e1 !important;
  background-color: #ffffff !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) !important;
  transition: all 120ms ease;
  height: 1.85rem !important;
  min-height: 1.85rem !important;
}

.dark .table-cart input.table-input,
.dark .table-cart select.table-input {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

.table-cart input.table-input:focus,
.table-cart select.table-input:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15) !important;
  background-color: #ffffff !important;
}

.dark .table-cart input.table-input:focus,
.dark .table-cart select.table-input:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25) !important;
  background-color: #020617 !important;
}

.product-dropdown {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  min-width: 320px;
  max-width: 440px;
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 1rem !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15), 0 10px 10px -5px rgba(0, 0, 0, 0.08) !important;
  z-index: 100 !important;
}

.dark .product-dropdown {
  background-color: #0f172a !important;
  border-color: #334155 !important;
}

.table-erp tbody tr:last-child .td-erp,
.table-modern tbody tr:last-child td {
  border-bottom: none;
}

.table-erp tbody tr,
.table-modern tbody tr {
  transition: background-color 0.15s ease;
}

.table-erp tbody tr:hover,
.table-modern tbody tr:hover {
  background-color: rgba(241, 245, 249, 0.7);
}

.dark .table-erp tbody tr:hover,
.dark .table-modern tbody tr:hover {
  background-color: rgba(30, 41, 59, 0.45);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge-primary {
  background-color: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.dark .badge-primary {
  background-color: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
  border-color: rgba(59, 130, 246, 0.3);
}

.badge-success {
  background-color: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.dark .badge-success {
  background-color: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background-color: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.dark .badge-warning {
  background-color: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
  border-color: rgba(245, 158, 11, 0.3);
}

.badge-danger {
  background-color: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.dark .badge-danger {
  background-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.badge-neutral {
  background-color: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}

.dark .badge-neutral {
  background-color: #1e293b;
  color: #cbd5e1;
  border-color: #334155;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.modal-backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
}

.modal-dialog {
  background-color: #ffffff;
  border-radius: 2rem;
  box-shadow: 0 25px 70px rgba(15, 23, 42, 0.25);
  width: 100%;
  max-width: 36rem;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.dark .modal-dialog {
  background-color: #0f172a;
  border-color: #334155;
  color: #f8fafc;
}

.modal-backdrop.is-active .modal-dialog {
  transform: scale(1) translateY(0);
}

/* Spinner & Overlay */
.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: erp-spin 600ms linear infinite;
  display: inline-block;
}

@keyframes erp-spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.loading-overlay.is-active {
  opacity: 1;
  pointer-events: auto;
}