/* assets/css/style.css */

/* Fonts Import - Plus Jakarta Sans & Inter for lively modern UI */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Colorful, Nature & Collaboration Inspired Palette (Inspired by Artwork) */
  --emerald-primary: #059669;
  --emerald-hover: #047857;
  --emerald-vibrant: #10b981;
  --emerald-soft: #ecfdf5;
  --emerald-border: #a7f3d0;
  --emerald-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);

  --amber-sun: #f59e0b;
  --amber-hover: #d97706;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;
  --amber-gradient: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);

  --coral-energy: #f97316;
  --coral-hover: #ea580c;
  --coral-soft: #fff7ed;
  --coral-border: #fed7aa;
  --coral-gradient: linear-gradient(135deg, #fb923c 0%, #f97316 100%);

  --cyan-sky: #0284c7;
  --cyan-hover: #0369a1;
  --cyan-soft: #f0f9ff;
  --cyan-border: #bae6fd;
  --cyan-gradient: linear-gradient(135deg, #38bdf8 0%, #0284c7 100%);

  --purple-royal: #7c3aed;
  --purple-hover: #6d28d9;
  --purple-soft: #faf5ff;
  --purple-border: #ddd6fe;
  --purple-gradient: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%);

  --mint-fresh: #34d399;
  --mint-soft: #d1fae5;

  /* App Surfaces */
  --bg-primary: #f6f8fa;
  --bg-sidebar: linear-gradient(180deg, #072a22 0%, #0c3e32 60%, #06231c 100%);
  --bg-sidebar-item-hover: rgba(52, 211, 153, 0.12);
  --bg-sidebar-active: linear-gradient(135deg, #10b981 0%, #059669 100%);
  --bg-card: #ffffff;
  --bg-card-hover: #fafafa;
  --border-color: #e2e8f0;
  
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-light: #ffffff;
  --text-muted: #94a3b8;
  
  --accent-color: #059669;
  --accent-hover: #047857;
  --accent-light: #ecfdf5;
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --success-color: #10b981;
  --success-hover: #059669;
  --warning-color: #f59e0b;
  
  --sidebar-width: 260px;
  --header-height: 72px;
  --glass-blur: 16px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 12px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px -5px rgba(5, 150, 105, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-colorful: 0 10px 20px -3px rgba(16, 185, 129, 0.25);
}

/* Base resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App Layout Grid */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Vibrant Sidebar Navigation */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 99;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
  transition: all 0.3s ease;
}

.sidebar-header {
  padding: 20px 20px 18px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-brand-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  gap: 6px;
  width: 100%;
  transition: opacity 0.2s ease;
}

.sidebar-brand-link:hover {
  opacity: 0.9;
}

.sidebar-main-logo {
  height: 33px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  background: var(--emerald-gradient);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 12px;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-logo svg {
  width: 24px;
  height: 24px;
  fill: #fff;
}

.logo-text {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 0.5px;
  display: block;
  color: #ffffff;
}

.logo-subtext {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #34d399;
  display: block;
}

.sidebar-menu {
  padding: 16px 12px;
  overflow-y: auto;
  flex: 1;
}

.sidebar-menu::-webkit-scrollbar {
  width: 5px;
}
.sidebar-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Safety sizing for ALL SVGs across the application */
svg {
  max-width: 100%;
  vertical-align: middle;
}

.menu-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  color: #a7f3d0;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 12px;
  margin-bottom: 4px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

/* Sidebar Colorful Menu Icons (Matching User Reference Artwork) */
.menu-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-icon svg {
  margin-right: 0 !important;
  width: 17px !important;
  height: 17px !important;
  stroke-width: 2.3px;
}

.menu-icon.icon-emerald { background: rgba(16, 185, 129, 0.22); color: #34d399; }
.menu-icon.icon-amber { background: rgba(245, 158, 11, 0.22); color: #fbbf24; }
.menu-icon.icon-cyan { background: rgba(6, 182, 212, 0.22); color: #38bdf8; }
.menu-icon.icon-purple { background: rgba(139, 92, 246, 0.22); color: #c084fc; }
.menu-icon.icon-teal { background: rgba(20, 184, 166, 0.22); color: #2dd4bf; }
.menu-icon.icon-coral { background: rgba(249, 115, 22, 0.22); color: #fb923c; }
.menu-icon.icon-gold { background: rgba(234, 179, 8, 0.22); color: #facc15; }

.menu-item:hover .menu-icon {
  transform: scale(1.14);
}

.menu-item.active .menu-icon {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.menu-item svg {
  width: 19px;
  height: 19px;
  margin-right: 12px;
  flex-shrink: 0;
  stroke-width: 2.2px;
  transition: transform 0.2s ease;
}

.menu-item:hover {
  background: var(--bg-sidebar-item-hover);
  color: #ffffff;
  transform: translateX(3px);
}

.menu-item:hover svg {
  transform: scale(1.1);
}

.menu-item.active {
  background: var(--bg-sidebar-active);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
  font-weight: 700;
}

.menu-item.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 20px;
  border-radius: 4px;
  background: #fbbf24;
}

.menu-item.active svg {
  color: #ffffff;
}

.menu-divider {
  font-size: 10px;
  font-weight: 800;
  color: #6ee7b7;
  letter-spacing: 1.2px;
  padding: 18px 14px 6px 14px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.85;
}

.menu-divider span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  background: #fbbf24;
}

.menu-item.text-danger {
  color: #fca5a5;
}
.menu-item.text-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ffffff;
}

/* Main Content Panel */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
  background: var(--bg-primary);
}

/* Top Header */
.top-header {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
}

.mobile-toggle svg {
  width: 24px;
  height: 24px;
}

.top-header h2 {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Quick Action Shortcuts in Header */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-header-action {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 6px 14px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  border-radius: 9999px !important;
  text-decoration: none !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  white-space: nowrap;
}

.btn-header-action svg {
  width: 15px !important;
  height: 15px !important;
  min-width: 15px !important;
  max-width: 15px !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

.btn-header-sale {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border: 1.5px solid #a7f3d0 !important;
}
.btn-header-sale:hover {
  background: #10b981 !important;
  color: #ffffff !important;
  border-color: #10b981 !important;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.btn-header-purchase {
  background: #fffbeb !important;
  color: #b45309 !important;
  border: 1.5px solid #fde68a !important;
}
.btn-header-purchase:hover {
  background: #f59e0b !important;
  color: #ffffff !important;
  border-color: #f59e0b !important;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

.btn-header-product {
  background: #f0f9ff !important;
  color: #0369a1 !important;
  border: 1.5px solid #bae6fd !important;
}
.btn-header-product:hover {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #0284c7 !important;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.btn-header-expense {
  background: #fff7ed !important;
  color: #c2410c !important;
  border: 1.5px solid #fed7aa !important;
}
.btn-header-expense:hover {
  background: #f97316 !important;
  color: #ffffff !important;
  border-color: #f97316 !important;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
}

/* DB Connection Indicator */
.db-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
}

.db-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.db-indicator.db-online {
  background: var(--emerald-soft);
  color: var(--emerald-primary);
  border: 1px solid var(--emerald-border);
}
.db-indicator.db-online .dot {
  background: var(--emerald-vibrant);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.db-indicator.db-offline {
  background: var(--amber-soft);
  color: var(--amber-sun);
  border: 1px solid var(--amber-border);
}
.db-indicator.db-offline .dot {
  background: var(--amber-sun);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.4; }
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--emerald-gradient);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

.user-name {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

/* Cheerful Welcome Banner on Dashboard */
.welcome-banner {
  background: linear-gradient(135deg, #064e3b 0%, #047857 50%, #059669 100%);
  border-radius: var(--radius-lg);
  padding: 26px 30px;
  margin-bottom: 26px;
  color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 30px -5px rgba(5, 150, 105, 0.3);
  position: relative;
  overflow: hidden;
}

.welcome-banner::before {
  content: '';
  position: absolute;
  top: -50px;
  right: -50px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(251, 191, 36, 0.15);
  pointer-events: none;
}

.welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: 20%;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.15);
  pointer-events: none;
}

.welcome-info h3 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.welcome-info p {
  font-size: 13.5px;
  color: #d1fae5;
  font-weight: 500;
}

.welcome-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.welcome-chip {
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(8px);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.welcome-actions {
  display: flex;
  gap: 10px;
  z-index: 2;
}

/* Dashboard Content Area */
.dashboard-body {
  padding: 28px 32px;
  flex: 1;
  overflow-y: auto;
}

/* Card layout - Soft rounded corners, subtle colorful borders, warm ambient glow */
.card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  transition: all 0.25s ease;
  position: relative;
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* Grid Layouts */
.grid-columns {
  display: grid;
  gap: 20px;
}

.grid-col-4 { grid-template-columns: repeat(4, 1fr); }
.grid-col-3 { grid-template-columns: repeat(3, 1fr); }
.grid-col-2 { grid-template-columns: repeat(2, 1fr); }

/* Colorful Dashboard Widgets (Inspired by User's Art Palette) */
.widget-card {
  display: flex;
  align-items: center;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.widget-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.08);
}

.widget-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

/* Widget Color Variants */
.widget-sales::before { background: var(--emerald-gradient); }
.widget-sales .widget-icon {
  background: var(--emerald-soft);
  color: var(--emerald-primary);
  border: 1px solid var(--emerald-border);
}

.widget-purchases::before { background: var(--amber-gradient); }
.widget-purchases .widget-icon {
  background: var(--amber-soft);
  color: var(--amber-sun);
  border: 1px solid var(--amber-border);
}

.widget-profit::before { background: linear-gradient(135deg, #10b981 0%, #06b6d4 100%); }
.widget-profit .widget-icon {
  background: #ecfeff;
  color: #0891b2;
  border: 1px solid #a5f3fc;
}

.widget-inventory::before { background: var(--cyan-gradient); }
.widget-inventory .widget-icon {
  background: var(--cyan-soft);
  color: var(--cyan-sky);
  border: 1px solid var(--cyan-border);
}

.widget-receivables::before { background: var(--purple-gradient); }
.widget-receivables .widget-icon {
  background: var(--purple-soft);
  color: var(--purple-royal);
  border: 1px solid var(--purple-border);
}

.widget-payables::before { background: var(--coral-gradient); }
.widget-payables .widget-icon {
  background: var(--coral-soft);
  color: var(--coral-energy);
  border: 1px solid var(--coral-border);
}

.widget-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 16px;
  flex-shrink: 0;
}

.widget-icon svg {
  width: 26px;
  height: 26px;
  stroke-width: 2.2px;
}

.widget-info {
  flex: 1;
}

.widget-info h4 {
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 4px;
}

.widget-value {
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.5px;
}

.widget-subtext {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 2px;
}

/* Card titles */
.card-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: #f1f5f9;
  color: #475569;
}

/* Tables styling */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  padding: 13px 16px;
  font-size: 12.5px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  background: #f8fafc;
}

.table td {
  padding: 14px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid #f1f5f9;
  color: #0f172a !important;
  vertical-align: middle;
}

.table td strong {
  color: #0f172a !important;
}

.table td a {
  color: #059669;
  text-decoration: none;
  font-weight: 600;
}
.table td a:hover {
  text-decoration: underline;
}

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

.table tbody tr:hover {
  background: #f0fdf4 !important;
}
}

.table tr:last-child td {
  border-bottom: none;
}

/* Form Styling */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group-flex-1 {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.form-group {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.form-group label, .form-group-flex-1 label {
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-color);
  background: #ffffff;
  border-radius: 12px;
  color: #0f172a;
  font-size: 13.5px;
  font-family: inherit;
  font-weight: 500;
  outline: none;
  transition: all 0.2s ease;
}

.form-control:focus {
  border-color: var(--emerald-vibrant);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

/* Buttons - Colorful with Soft Gradient Lift */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn:hover {
  transform: translateY(-1.5px);
}

.btn-primary, .btn-emerald {
  background: var(--emerald-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}
.btn-primary:hover, .btn-emerald:hover {
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.45);
}

.btn-amber {
  background: var(--amber-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}
.btn-amber:hover {
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.45);
}

.btn-coral {
  background: var(--coral-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.35);
}
.btn-coral:hover {
  box-shadow: 0 6px 16px rgba(249, 115, 22, 0.45);
}

.btn-cyan {
  background: var(--cyan-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}
.btn-cyan:hover {
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.45);
}

.btn-purple {
  background: var(--purple-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
}
.btn-purple:hover {
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.45);
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-danger {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 10px;
}

.btn-large {
  padding: 12px 24px;
  font-size: 15px;
}

.form-actions-bar {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border-color);
}

/* Status Badges - Pill-shaped, colourful & crisp */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.2px;
  border: 1px solid transparent;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.badge-paid, .badge-accepted, .badge-received, .badge-instock {
  background: var(--emerald-soft);
  color: var(--emerald-primary);
  border-color: var(--emerald-border);
}
.badge-paid::before, .badge-accepted::before, .badge-received::before, .badge-instock::before {
  background: var(--emerald-vibrant);
}

.badge-unpaid, .badge-pending, .badge-lowstock, .badge-partial {
  background: var(--amber-soft);
  color: var(--amber-sun);
  border-color: var(--amber-border);
}
.badge-unpaid::before, .badge-pending::before, .badge-lowstock::before, .badge-partial::before {
  background: var(--amber-sun);
}

.badge-draft, .badge-rejected, .badge-cancelled, .badge-outofstock, .badge-overdue {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fecaca;
}
.badge-draft::before, .badge-rejected::before, .badge-cancelled::before, .badge-outofstock::before, .badge-overdue::before {
  background: #ef4444;
}

.badge-converted, .badge-proforma {
  background: var(--cyan-soft);
  color: var(--cyan-sky);
  border-color: var(--cyan-border);
}
.badge-converted::before, .badge-proforma::before {
  background: var(--cyan-sky);
}

.badge-invoice {
  background: var(--emerald-soft);
  color: var(--emerald-primary);
  border-color: var(--emerald-border);
}
.badge-invoice::before { background: var(--emerald-vibrant); }

.badge-purchase {
  background: var(--amber-soft);
  color: var(--amber-sun);
  border-color: var(--amber-border);
}
.badge-purchase::before { background: var(--amber-sun); }

.badge-estimate {
  background: var(--purple-soft);
  color: var(--purple-royal);
  border-color: var(--purple-border);
}
.badge-estimate::before { background: var(--purple-royal); }

.badge-expense {
  background: var(--coral-soft);
  color: var(--coral-energy);
  border-color: var(--coral-border);
}
.badge-expense::before { background: var(--coral-energy); }

/* Filter Tabs */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-tab-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  background: #ffffff;
  color: var(--text-secondary);
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.filter-tab-btn:hover {
  background: #f8fafc;
  color: #0f172a;
}

.filter-tab-btn.active {
  background: var(--emerald-primary);
  color: #ffffff;
  border-color: var(--emerald-primary);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.25);
}

/* Autocomplete Dropdown for Products */
.autocomplete-wrapper {
  position: relative;
  width: 100%;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #ffffff;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  max-height: 250px;
  overflow-y: auto;
  display: none;
  margin-top: 4px;
}

.autocomplete-item {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover, .autocomplete-item.selected {
  background: var(--emerald-soft);
  color: var(--emerald-primary);
}

.autocomplete-item-name {
  font-weight: 700;
  color: #0f172a;
}

.autocomplete-item-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  border: 1px solid var(--border-color);
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(15px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
}

.modal-title {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 4px;
  border-radius: 6px;
}

.modal-close:hover {
  color: var(--danger-color);
  background: #fee2e2;
}

.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #f8fafc;
}

/* Alerts */
.alert {
  padding: 14px 20px;
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.25);
  color: #15803d;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.25);
  color: #b91c1c;
}

.alert-info {
  background: rgba(37, 99, 235, 0.1);
  border-color: rgba(37, 99, 235, 0.2);
  color: #1d4ed8;
}

/* Utilities margin spacing */
.mt-15 { margin-top: 15px; }
.mt-25 { margin-top: 25px; }
.mr-10 { margin-right: 10px; }

/* Responsive adjustments */
@media (max-width: 1024px) {
  .grid-col-4 { grid-template-columns: repeat(2, 1fr); }
  .file-uploads-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: calc(-1 * var(--sidebar-width));
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .sidebar.active {
    left: 0;
  }
  .mobile-toggle {
    display: block;
  }
  .top-header {
    padding: 0 15px;
  }
  .dashboard-body {
    padding: 15px;
  }
  .grid-col-4, .grid-col-3, .grid-col-2 {
    grid-template-columns: 1fr;
  }
  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* ==========================================
   A4 Print Preview Canvas styling (On-Screen)
   ========================================== */
.print-container {
  background: #ffffff !important;
  color: #000000 !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 11px !important;
  line-height: 1.4 !important;
  border: 1px solid #000000 !important;
  padding: 30px !important;
  margin: 30px auto !important;
  width: 100% !important;
  max-width: 820px !important;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2) !important;
  border-radius: 0 !important;
  box-sizing: border-box !important;
}

.print-container {
  color: #000000;
}
.print-container strong {
  color: #000000;
  text-shadow: none !important;
}

.print-container .print-header-grid {
  display: table !important;
  width: 100% !important;
  border-bottom: 1px solid #000000 !important;
}

.print-container .print-header-left {
  display: table-cell !important;
  width: 55% !important;
  padding: 10px !important;
  vertical-align: top !important;
  border: none !important;
  text-align: left !important;
}

.print-container .print-header-right {
  display: table-cell !important;
  width: 45% !important;
  padding: 0 !important;
  vertical-align: top !important;
  border-left: 1px solid #000000 !important;
  border-top: none !important;
  border-bottom: none !important;
  border-right: none !important;
}

.print-container .doc-title-bar {
  text-align: center !important;
  border-bottom: 1px solid #000000 !important;
  padding: 6px !important;
  background: #ffffff !important;
}

.print-container .doc-title-bar h1 {
  font-size: 16px !important;
  font-weight: bold !important;
  margin: 0 !important;
  text-transform: uppercase !important;
  letter-spacing: 1px !important;
}

.print-container .doc-title-bar p {
  font-size: 9px !important;
  margin: 2px 0 0 0 !important;
  color: #333333 !important;
}

.print-container .print-billing-grid {
  display: table !important;
  width: 100% !important;
  border-bottom: 1px solid #000000 !important;
}

.print-container .billing-col {
  display: table-cell !important;
  width: 50% !important;
  padding: 8px !important;
  vertical-align: top !important;
  border: none !important;
}

.print-container .billing-col:first-child {
  border-right: 1px solid #000000 !important;
}

.print-container .billing-col h4 {
  font-size: 10px !important;
  font-weight: bold !important;
  margin: 0 0 6px 0 !important;
  text-transform: uppercase !important;
  border-bottom: 1px solid #dddddd !important;
  padding-bottom: 3px !important;
}

.print-container .details-table {
  width: 100% !important;
  border-collapse: collapse !important;
  border: none !important;
}

.print-container .details-table td {
  border-bottom: 1px solid #000000 !important;
  border-right: 1px solid #000000 !important;
  padding: 5px 8px !important;
  font-size: 10px !important;
  vertical-align: middle !important;
  background: #ffffff !important;
}

.print-container .details-table tr:last-child td {
  border-bottom: none !important;
}

.print-container .details-table td:last-child {
  border-right: none !important;
}

.print-container .details-table td:first-child {
  font-weight: bold !important;
  width: 45% !important;
}

.print-container .print-items-table {
  width: 100% !important;
  border-collapse: collapse !important;
}

.print-container .print-items-table th {
  border: 1px solid #000000 !important;
  padding: 6px 6px !important;
  font-size: 10px !important;
  text-align: center !important;
  vertical-align: middle !important;
  background: #cca06a !important;
  color: #ffffff !important;
  font-weight: bold !important;
}

.print-container .print-items-table td {
  border: 1px solid #000000 !important;
  padding: 6px 6px !important;
  font-size: 10px !important;
  text-align: center !important;
  vertical-align: top !important;
  background: #ffffff !important;
  color: #000000 !important;
}

.print-container .print-items-table td.align-left {
  text-align: left !important;
}

.print-container .print-items-table td.align-right {
  text-align: right !important;
}

.print-container .print-totals-row td {
  font-weight: bold !important;
  background: #f9fafb !important;
}

.print-container .print-tax-table {
  width: 100% !important;
  border-collapse: collapse !important;
  margin-top: 0 !important;
  border-top: 1px solid #000000 !important;
}

.print-container .print-tax-table th {
  border: 1px solid #000000 !important;
  padding: 5px 5px !important;
  font-size: 9px !important;
  text-align: center !important;
  background: #cca06a !important;
  color: #ffffff !important;
  font-weight: bold !important;
}

.print-container .print-tax-table td {
  border: 1px solid #000000 !important;
  padding: 5px 5px !important;
  font-size: 9px !important;
  text-align: center !important;
  background: #ffffff !important;
  color: #000000 !important;
}

.print-container .word-amount-banner {
  padding: 6px 8px !important;
  border-top: 1px solid #000000 !important;
  font-size: 10px !important;
  background: #ffffff !important;
  text-align: left !important;
}

.print-container .word-amount-banner span {
  font-weight: bold !important;
}

.print-container .print-bottom-block {
  display: table !important;
  width: 100% !important;
  border-top: 1px solid #000000 !important;
}

.print-container .bottom-left-col {
  display: table-cell !important;
  width: 60% !important;
  padding: 10px !important;
  vertical-align: top !important;
  border-right: 1px solid #000000 !important;
  border-left: none !important;
  border-top: none !important;
  border-bottom: none !important;
  background: #ffffff !important;
  text-align: left !important;
}

.print-container .bottom-right-col {
  display: table-cell !important;
  width: 40% !important;
  padding: 10px !important;
  vertical-align: top !important;
  text-align: right !important;
  border: none !important;
  background: #ffffff !important;
}

.print-container .bank-details-title {
  font-weight: bold !important;
  text-decoration: underline !important;
  margin-bottom: 5px !important;
  font-size: 10px !important;
}

.print-container .bank-details-grid {
  display: grid !important;
  grid-template-columns: 120px 1fr !important;
  gap: 2px !important;
  font-size: 9px !important;
}

.print-container .bank-details-grid div:nth-child(odd) {
  font-weight: bold !important;
}

.print-container .bottom-qr-section {
  display: flex !important;
  align-items: center !important;
  gap: 15px !important;
  margin-top: 10px !important;
}

.print-container .bottom-qr-section img {
  width: 65px !important;
  height: 65px !important;
}

.print-container .bottom-qr-text {
  font-size: 9px !important;
  line-height: 1.3 !important;
  text-align: left !important;
}

.print-container .signature-area {
  margin-top: 30px !important;
  text-align: right !important;
}

.print-container .signature-image {
  max-height: 40px !important;
  max-width: 150px !important;
  margin-bottom: 4px !important;
}

.print-container .print-footer-text {
  text-align: center !important;
  font-size: 8px !important;
  color: #555555 !important;
  border-top: 1px solid #000000 !important;
  padding: 4px !important;
  background: #f9fafb !important;
}

@media (max-width: 768px) {
  .print-container {
    padding: 10px !important;
    overflow-x: auto !important;
  }
}

/* Purchase & Data Table Field Sizing Fixes */
.purchase-items-table {
  min-width: 1240px !important;
  width: 100% !important;
  border-collapse: collapse !important;
  margin-bottom: 0 !important;
}

.purchase-items-table th {
  background: #f8fafc !important;
  color: #334155 !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  padding: 12px 8px !important;
  border-bottom: 2px solid #e2e8f0 !important;
  white-space: nowrap !important;
}

.purchase-items-table td {
  padding: 8px 6px !important;
  vertical-align: middle !important;
  border-bottom: 1px solid #f1f5f9 !important;
  background: #ffffff !important;
}

.purchase-items-table .form-control {
  height: 38px !important;
  padding: 6px 10px !important;
  font-size: 13.5px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  border-radius: 8px !important;
  border: 1.5px solid #cbd5e1 !important;
  background-color: #ffffff !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

.purchase-items-table .form-control:focus {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

.purchase-items-table select.form-control {
  padding-left: 8px !important;
  padding-right: 22px !important;
  cursor: pointer !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  appearance: auto !important;
  -webkit-appearance: auto !important;
}

/* ========================================================
   ACTION BUTTONS & CELLS (Global Fix for Edit, Delete, View)
   ======================================================== */
.action-cell {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  flex-wrap: nowrap !important;
  white-space: nowrap !important;
  min-height: 38px !important;
}

.action-icon-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  min-height: 36px !important;
  max-width: 36px !important;
  max-height: 36px !important;
  border-radius: 9px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1.5px solid #e2e8f0 !important;
  background-color: #ffffff !important;
  color: #475569 !important;
  cursor: pointer !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  text-decoration: none !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  box-sizing: border-box !important;
}

.action-icon-btn svg {
  width: 17px !important;
  height: 17px !important;
  min-width: 17px !important;
  max-width: 17px !important;
  min-height: 17px !important;
  max-height: 17px !important;
  stroke-width: 2.2px !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
}

/* Edit Button (Sky Blue) */
.action-icon-btn.btn-action-edit,
.action-icon-btn[title*="Edit"] {
  background-color: #eff6ff !important;
  border-color: #bfdbfe !important;
  color: #2563eb !important;
}
.action-icon-btn.btn-action-edit:hover,
.action-icon-btn[title*="Edit"]:hover {
  background-color: #2563eb !important;
  border-color: #1d4ed8 !important;
  color: #ffffff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35) !important;
}

/* Delete Button (Coral / Crimson) */
.action-icon-btn.btn-action-delete,
.action-icon-btn.btn-del-record,
.action-icon-btn[title*="Delete"],
.action-icon-btn[title*="Remove"] {
  background-color: #fef2f2 !important;
  border-color: #fecaca !important;
  color: #dc2626 !important;
}
.action-icon-btn.btn-action-delete:hover,
.action-icon-btn.btn-del-record:hover,
.action-icon-btn[title*="Delete"]:hover,
.action-icon-btn[title*="Remove"]:hover {
  background-color: #ef4444 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.35) !important;
}

/* History / Log Button (Emerald / Green) */
.action-icon-btn.btn-action-history,
.action-icon-btn[title*="History"],
.action-icon-btn[title*="Log"],
.action-icon-btn[title*="Movement"] {
  background-color: #f0fdf4 !important;
  border-color: #bbf7d0 !important;
  color: #15803d !important;
}
.action-icon-btn.btn-action-history:hover,
.action-icon-btn[title*="History"]:hover,
.action-icon-btn[title*="Log"]:hover,
.action-icon-btn[title*="Movement"]:hover {
  background-color: #16a34a !important;
  border-color: #15803d !important;
  color: #ffffff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 10px rgba(22, 163, 74, 0.35) !important;
}

/* Duplicate / Copy Button (Purple / Violet) */
.action-icon-btn.btn-action-duplicate,
.action-icon-btn[title*="Duplicate"],
.action-icon-btn[title*="Copy"] {
  background-color: #faf5ff !important;
  border-color: #e9d5ff !important;
  color: #7c3aed !important;
}
.action-icon-btn.btn-action-duplicate:hover,
.action-icon-btn[title*="Duplicate"]:hover,
.action-icon-btn[title*="Copy"]:hover {
  background-color: #7c3aed !important;
  border-color: #6d28d9 !important;
  color: #ffffff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 10px rgba(124, 58, 237, 0.35) !important;
}

/* View / Eye Button (Cyan / Teal) */
.action-icon-btn.btn-action-view,
.action-icon-btn[title*="View"],
.action-icon-btn[title*="Details"] {
  background-color: #ecfeff !important;
  border-color: #a5f3fc !important;
  color: #0891b2 !important;
}
.action-icon-btn.btn-action-view:hover,
.action-icon-btn[title*="View"]:hover,
.action-icon-btn[title*="Details"]:hover {
  background-color: #0891b2 !important;
  border-color: #0e7490 !important;
  color: #ffffff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 10px rgba(8, 145, 178, 0.35) !important;
}

/* Stock Adjust Button in Products Table */
.btn-stock-quick {
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 12px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  border-radius: 9px !important;
  background-color: #ecfdf5 !important;
  border: 1.5px solid #a7f3d0 !important;
  color: #047857 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  box-sizing: border-box !important;
}

.btn-stock-quick:hover {
  background-color: #10b981 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 4px 10px rgba(16, 185, 129, 0.35) !important;
}

.btn-stock-quick svg {
  width: 14px !important;
  height: 14px !important;
  flex-shrink: 0 !important;
}

/* ==========================================================================
   ULTRA-MODERN MOBILE APP EXPERIENCE (Vyapar / Zoho Books / Khatabook PWA)
   Only active on screens <= 768px. Desktop view remains 100% untouched.
   ========================================================================== */

/* 1. Desktop rules (hide mobile-only app elements) */
@media (min-width: 769px) {
  .no-desktop,
  .mobile-title,
  .mobile-table-hint,
  .mobile-bottom-nav,
  .mobile-action-sheet,
  .sidebar-backdrop,
  .sidebar-close-btn {
    display: none !important;
  }
}

/* 2. Mobile Native Application Styles */
@media (max-width: 768px) {
  /* Prevent horizontal bounce / overflow on mobile body */
  html, body {
    overflow-x: hidden !important;
    width: 100% !important;
    -webkit-tap-highlight-color: transparent;
  }

  /* Leave comfortable room above bottom navigation bar */
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .app-container {
    display: block !important;
    width: 100% !important;
    overflow-x: hidden !important;
  }

  .main-content {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Top App Bar Header */
  .top-header {
    height: 56px !important;
    padding: 0 12px !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06) !important;
  }

  .top-header .header-left {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    flex: 1 !important;
    min-width: 0 !important;
  }

  .top-header h2 {
    font-size: 16px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin: 0 !important;
  }
  .desktop-title {
    display: none !important;
  }
  .mobile-title {
    display: inline-block !important;
  }

  .mobile-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    border-radius: 10px !important;
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    color: #0f172a !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
  }

  .top-header .header-right {
    gap: 8px !important;
    flex-shrink: 0 !important;
  }

  /* Desktop quick action pills are hidden in mobile header (now in bottom nav & create sheet) */
  .top-header .header-actions {
    display: none !important;
  }

  /* User Avatar: Clean round icon on mobile */
  .user-profile {
    padding: 2px !important;
    gap: 0 !important;
    border: none !important;
    background: transparent !important;
  }

  .user-profile .user-name {
    display: none !important;
  }

  .user-avatar {
    width: 34px !important;
    height: 34px !important;
    font-size: 13px !important;
    border-radius: 50% !important;
  }

  /* Compact Database Indicator */
  .db-indicator {
    padding: 5px 8px !important;
    border-radius: 99px !important;
  }
  .db-indicator .label {
    display: none !important;
  }
  .db-indicator .dot {
    margin: 0 !important;
  }

  /* Sidebar Drawer Mobile App Feel */
  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 285px !important;
    max-width: 82vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1050 !important;
    transform: translateX(-105%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-shadow: none !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .sidebar.active {
    transform: translateX(0) !important;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45) !important;
  }

  .sidebar-backdrop {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 1040 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.3s ease !important;
  }

  .sidebar-backdrop.active {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .sidebar-close-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: 16px !important;
    right: 14px !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: none !important;
    color: #ffffff !important;
    cursor: pointer !important;
  }

  /* Native Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 60px !important;
    background: rgba(255, 255, 255, 0.98) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-top: 1px solid #e2e8f0 !important;
    justify-content: space-around !important;
    align-items: center !important;
    padding: 0 4px calc(env(safe-area-inset-bottom, 0px)) !important;
    z-index: 900 !important;
    box-shadow: 0 -3px 15px rgba(0, 0, 0, 0.05) !important;
  }

  .mobile-nav-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 1 !important;
    height: 100% !important;
    color: #64748b !important;
    text-decoration: none !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    transition: color 0.15s ease !important;
    -webkit-tap-highlight-color: transparent !important;
    cursor: pointer !important;
  }

  .mobile-nav-item.active {
    color: var(--emerald-primary, #059669) !important;
  }

  .mobile-nav-item.active svg {
    stroke: var(--emerald-primary, #059669) !important;
    stroke-width: 2.4 !important;
  }

  .mobile-nav-icon {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 22px !important;
  }

  .mobile-nav-label {
    margin-top: 2px !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 0.2px !important;
  }

  /* Center Floating Create Action Button */
  .mobile-nav-center-item {
    position: relative !important;
    top: -12px !important;
  }

  .mobile-nav-fab {
    width: 48px !important;
    height: 48px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    color: #ffffff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45) !important;
    border: 3px solid #ffffff !important;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  }

  .mobile-nav-fab:active {
    transform: scale(0.92) !important;
  }

  /* Quick Actions Bottom Sheet */
  .mobile-action-sheet {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    z-index: 950 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.25s ease !important;
  }

  .mobile-action-sheet.active {
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  .mobile-action-sheet-backdrop {
    position: absolute !important;
    inset: 0 !important;
    background: rgba(15, 23, 42, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }

  .mobile-action-sheet-content {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    background: #ffffff !important;
    border-radius: 24px 24px 0 0 !important;
    padding: 14px 16px calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    transform: translateY(100%) !important;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    max-height: 85vh !important;
    overflow-y: auto !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15) !important;
  }

  .mobile-action-sheet.active .mobile-action-sheet-content {
    transform: translateY(0) !important;
  }

  .mobile-sheet-handle {
    width: 44px !important;
    height: 4px !important;
    border-radius: 99px !important;
    background: #cbd5e1 !important;
    margin: 0 auto 12px !important;
  }

  .mobile-sheet-title {
    font-size: 16px !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    margin-bottom: 14px !important;
    text-align: center !important;
  }

  .mobile-actions-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }

  .mobile-action-card {
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 12px 10px !important;
    border-radius: 12px !important;
    border: 1px solid #e2e8f0 !important;
    background: #f8fafc !important;
    text-decoration: none !important;
    color: #0f172a !important;
    font-size: 13px !important;
    font-weight: 700 !important;
  }

  .mobile-action-card:active {
    background: #e2e8f0 !important;
    transform: scale(0.97) !important;
  }

  .action-card-sale { border-color: #a7f3d0 !important; background: #ecfdf5 !important; color: #065f46 !important; }
  .action-card-purchase { border-color: #fde68a !important; background: #fffbeb !important; color: #92400e !important; }
  .action-card-estimate { border-color: #fed7aa !important; background: #fff7ed !important; color: #9a3412 !important; }
  .action-card-proforma { border-color: #bae6fd !important; background: #f0f9ff !important; color: #075985 !important; }
  .action-card-stock { border-color: #c7d2fe !important; background: #eef2ff !important; color: #3730a3 !important; }
  .action-card-expense { border-color: #fecdd3 !important; background: #fff1f2 !important; color: #9f1239 !important; }
  .action-card-party { border-color: #ddd6fe !important; background: #faf5ff !important; color: #5b21b6 !important; }

  .mobile-sheet-close-btn {
    width: 100% !important;
    padding: 10px !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
    color: #475569 !important;
    cursor: pointer !important;
  }

  /* Body & Container Padding */
  .dashboard-body {
    padding: 12px !important;
  }

  /* Welcome Banner */
  .welcome-banner {
    padding: 16px 14px !important;
    border-radius: 18px !important;
    margin-bottom: 14px !important;
  }
  .welcome-banner h3 {
    font-size: 17px !important;
    margin-bottom: 4px !important;
  }
  .welcome-banner p {
    font-size: 12.5px !important;
    margin-bottom: 8px !important;
  }
  .welcome-chips {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .welcome-chip {
    font-size: 11px !important;
    padding: 4px 8px !important;
  }
  .welcome-actions {
    display: none !important;
  }

  /* General grid columns collapse to 1 column on mobile */
  .grid-columns,
  .grid-col-2,
  .grid-col-3,
  .grid-col-4 {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    margin-bottom: 14px !important;
  }

  /* Specifically KPI widgets on Dashboard are displayed in a clean 2x3 app grid */
  .dashboard-kpis,
  .dashboard-body > .grid-columns:first-of-type,
  .grid-columns:has(> .widget-card) {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    margin-bottom: 14px !important;
  }

  .widget-card {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    padding: 12px 10px !important;
    border-radius: 14px !important;
    gap: 4px !important;
    min-height: 110px !important;
    box-sizing: border-box !important;
  }
  .widget-card .widget-icon {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 8px !important;
    margin-bottom: 4px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .widget-card .widget-icon svg {
    width: 17px !important;
    height: 17px !important;
  }
  .widget-card .widget-info {
    width: 100% !important;
    min-width: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  .widget-card .widget-info h4 {
    font-size: 11px !important;
    font-weight: 700 !important;
    text-transform: capitalize !important;
    letter-spacing: normal !important;
    margin: 0 0 3px 0 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.25 !important;
    color: #64748b !important;
  }
  .widget-card .widget-value {
    font-size: 16px !important;
    font-weight: 800 !important;
    line-height: 1.2 !important;
    margin-bottom: 2px !important;
    letter-spacing: -0.2px !important;
  }
  .widget-card .widget-subtext {
    font-size: 10px !important;
    line-height: 1.2 !important;
    color: #94a3b8 !important;
  }

  /* Card Title & Buttons on Mobile */
  .card-title {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
    width: 100% !important;
    margin-bottom: 12px !important;
  }
  .card-title > span {
    font-size: 15px !important;
    font-weight: 800 !important;
    display: block !important;
    width: 100% !important;
    line-height: 1.3 !important;
  }
  .card-title > div {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
  }
  .card-title > div .btn {
    flex: 1 1 calc(33.333% - 6px) !important;
    min-width: 85px !important;
    padding: 7px 6px !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    text-align: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
  }

  /* Page Action Headers on Subpages (Parties, Stock, Purchases, etc.) */
  .page-action-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
  }
  .page-action-header > div:last-child {
    width: 100% !important;
    display: flex !important;
  }
  .page-action-header > div:last-child .btn {
    width: 100% !important;
    justify-content: center !important;
    padding: 10px 14px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
  }
  .page-action-header h1 {
    font-size: 19px !important;
    margin-bottom: 2px !important;
  }
  .page-action-header p {
    font-size: 12px !important;
    line-height: 1.35 !important;
  }

  /* Forms & Inputs Optimization */
  .form-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
    margin-bottom: 0 !important;
  }
  .form-group-flex-1, .form-group {
    margin-bottom: 12px !important;
    width: 100% !important;
  }
  .form-group label {
    font-size: 12px !important;
    margin-bottom: 4px !important;
  }

  /* Prevent Safari Auto-Zoom on form inputs */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="date"], select, textarea, .form-control {
    font-size: 16px !important;
    min-height: 42px !important;
    border-radius: 10px !important;
  }

  /* Product Row Card in Document Editor */
  .product-row {
    padding: 12px !important;
    border-radius: 14px !important;
    margin-bottom: 12px !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03) !important;
  }

  /* Mobile Swipe Hint Banner */
  .mobile-table-hint {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    color: #64748b !important;
    margin-bottom: 8px !important;
    padding: 5px 10px !important;
    background: #f8fafc !important;
    border-radius: 8px !important;
    border: 1px dashed #cbd5e1 !important;
  }
  .mobile-table-hint svg {
    color: var(--emerald-primary, #059669) !important;
    animation: swipeArrow 1.5s infinite ease-in-out;
  }
  @keyframes swipeArrow {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
  }

  /* Responsive Horizontal Scroll for Tables */
  .table-responsive {
    border-radius: 12px !important;
    border: 1px solid #e2e8f0 !important;
    background: #ffffff !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-shadow: inset -6px 0 8px -4px rgba(0, 0, 0, 0.08) !important;
    margin-bottom: 12px !important;
  }
  .table {
    min-width: 620px !important;
  }
  .table th {
    font-size: 11px !important;
    padding: 9px 8px !important;
    white-space: nowrap !important;
  }
  .table td {
    font-size: 12px !important;
    padding: 8px 8px !important;
  }
  .table td:nth-child(3) {
    max-width: 135px !important;
    white-space: normal !important;
    line-height: 1.25 !important;
  }
  .table td:nth-child(3) strong {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .action-cell {
    display: flex !important;
    gap: 4px !important;
  }
  .action-icon-btn {
    width: 28px !important;
    height: 28px !important;
    border-radius: 6px !important;
  }
  .action-icon-btn svg {
    width: 14px !important;
    height: 14px !important;
  }

  /* Filter Tabs Bar (Horizontal swipeable pills) */
  .filter-tabs, .tabs-nav {
    display: flex !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    padding: 4px 0 10px !important;
    gap: 6px !important;
  }
  .filter-tabs::-webkit-scrollbar,
  .tabs-nav::-webkit-scrollbar {
    display: none !important;
  }
  .filter-tab-btn, .tab-btn {
    padding: 8px 14px !important;
    font-size: 12px !important;
    border-radius: 99px !important;
    flex-shrink: 0 !important;
  }

  /* Sticky Action Buttons Bar on Invoices / Purchases */
  .form-actions-bar {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    padding: 8px 0 !important;
    position: sticky !important;
    top: 56px !important;
    background: rgba(246, 248, 250, 0.95) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 80 !important;
    margin-bottom: 12px !important;
  }
  .form-actions-bar .btn {
    flex: 1 !important;
    min-width: 110px !important;
    padding: 9px 12px !important;
    font-size: 12.5px !important;
    border-radius: 10px !important;
    justify-content: center !important;
  }

  /* Modals as App Bottom Sheets */
  .modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 24px 24px 0 0 !important;
    max-height: 92vh !important;
    margin: 0 !important;
    animation: sheetSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  @keyframes sheetSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .modal-header {
    padding: 16px 18px 12px !important;
  }
  .modal-title {
    font-size: 16px !important;
  }
  .modal-body {
    padding: 14px 16px !important;
    max-height: calc(85vh - 120px) !important;
    overflow-y: auto !important;
  }
  .modal-footer {
    padding: 12px 16px !important;
  }

  /* Search Input Bars */
  .search-input-wrapper {
    width: 100% !important;
    margin-top: 8px !important;
  }
  .search-input-wrapper input {
    width: 100% !important;
    font-size: 14px !important;
    height: 42px !important;
    border-radius: 12px !important;
  }
}




