@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Montserrat:wght@400;500;700;800;900&family=Outfit:wght@400;700;900&display=swap');

:root {
  --bg-primary: #090d16;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  
  --panel-bg: rgba(17, 24, 39, 0.7);
  --panel-border: rgba(245, 158, 11, 0.15);
  --panel-glow: rgba(245, 158, 11, 0.03);
  
  --color-accent: #f59e0b;
  --color-accent-hover: #d97706;
  --color-accent-light: rgba(245, 158, 11, 0.1);
  
  --color-success: #10b981;
  --color-success-light: rgba(16, 185, 129, 0.1);
  --color-danger: #f43f5e;
  --color-danger-light: rgba(244, 63, 94, 0.1);
  --color-info: #3b82f6;
  --color-info-light: rgba(59, 130, 246, 0.1);
  
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --sidebar-width: 260px;
  --header-height: 70px;
  --border-radius: 12px;
  --border-radius-lg: 20px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.15), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
  --shadow-glow: 0 0 20px rgba(245, 158, 11, 0.08);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

/* Layout */
.app-container {
  display: flex;
  width: 100%;
  position: relative;
}

/* Sidebar Styling */
aside.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header i {
  font-size: 28px;
  color: var(--color-accent);
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.sidebar-brand h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #fff 30%, var(--color-accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-brand span {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
  margin-top: 2px;
}

.sidebar-nav {
  list-style: none;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
  overflow-y: auto;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 500;
  transition: var(--transition);
}

.sidebar-nav li a i {
  font-size: 18px;
  width: 20px;
  text-align: center;
  transition: var(--transition);
}

.sidebar-nav li a:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
}

.sidebar-nav li.active a {
  color: var(--bg-primary);
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.25);
}

.sidebar-nav li.active a i {
  color: var(--bg-primary);
}

.sidebar-footer {
  padding: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
}

/* Main Content Area */
main.main-content {
  margin-left: var(--sidebar-width);
  flex-grow: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 30px;
  transition: var(--transition);
}

header.content-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  position: relative;
}

.header-title h2 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
}

.header-title p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  transition: var(--transition);
}

.sync-badge.online {
  color: var(--color-success);
  background-color: var(--color-success-light);
  border-color: rgba(16, 185, 129, 0.2);
}

.sync-badge.offline {
  color: var(--color-accent);
  background-color: var(--color-accent-light);
  border-color: rgba(245, 158, 11, 0.2);
}

/* UI Elements & Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--border-radius);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
  color: var(--bg-primary);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-success {
  background-color: var(--color-success);
  color: var(--bg-primary);
}

.btn-success:hover {
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
}

/* Dashboard Cards Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.card {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-md), var(--shadow-glow);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 100% 0%, var(--panel-glow) 0%, transparent 70%);
  pointer-events: none;
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 158, 11, 0.3);
  box-shadow: var(--shadow-lg), 0 0 25px rgba(245, 158, 11, 0.12);
}

.card-header-icon {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.card-icon.amber {
  background-color: var(--color-accent-light);
  color: var(--color-accent);
}

.card-icon.emerald {
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.card-icon.rose {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

.card-icon.info {
  background-color: var(--color-info-light);
  color: var(--color-info);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 8px;
  margin-bottom: 6px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-subtitle span.positive {
  color: var(--color-success);
  font-weight: 600;
}

.card-subtitle span.negative {
  color: var(--color-danger);
  font-weight: 600;
}

/* Visualization Panel */
.visuals-container {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  margin-bottom: 30px;
}

@media (max-width: 1024px) {
  .visuals-container {
    grid-template-columns: 1fr;
  }
}

.chart-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  min-height: 350px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-title i {
  color: var(--color-accent);
}

.chart-wrapper {
  position: relative;
  height: 280px;
  width: 100%;
}

/* Alert Boxes & Notifications */
.alerts-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--border-radius);
  font-size: 13px;
  border-left: 4px solid transparent;
}

.alert-item.warning {
  background-color: var(--color-danger-light);
  border-left-color: var(--color-danger);
  color: #fda4af;
}

.alert-item.info {
  background-color: var(--color-info-light);
  border-left-color: var(--color-info);
  color: #93c5fd;
}

.alert-icon {
  font-size: 16px;
  margin-top: 1px;
}

.alert-text {
  flex-grow: 1;
}

.alert-text strong {
  display: block;
  font-weight: 600;
  margin-bottom: 2px;
}

/* Forms & Inputs */
.form-panel {
  max-width: 700px;
  margin: 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input, .form-select, .form-textarea {
  background-color: rgba(9, 13, 22, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius);
  padding: 12px 16px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text-primary);
  outline: none;
  transition: var(--transition);
  width: 100%;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.form-input::placeholder, .form-textarea::placeholder {
  color: var(--text-muted);
}

.form-select option {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

.input-addon-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-addon-group .form-input {
  padding-left: 36px;
}

.input-addon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  font-size: 14px;
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}

.custom-table th {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-table td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  color: var(--text-primary);
  vertical-align: middle;
}

.custom-table tbody tr {
  transition: var(--transition);
}

.custom-table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.01);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-success {
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.badge-danger {
  background-color: var(--color-danger-light);
  color: var(--color-danger);
}

.badge-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--color-accent);
}

.badge-info {
  background-color: var(--color-info-light);
  color: var(--color-info);
}

.badge-farmer {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.badge-buyer {
  background-color: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.badge-broker {
  background-color: rgba(139, 92, 246, 0.1);
  color: #8b5cf6;
}

.badge-general {
  background-color: rgba(107, 114, 128, 0.1);
  color: #9ca3af;
}

/* Search and Filters Bar */
.search-filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 768px) {
  .search-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

.search-input-wrapper {
  position: relative;
  flex-grow: 1;
  max-width: 400px;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.search-input-wrapper .form-input {
  padding-left: 40px;
}

.filter-group {
  display: flex;
  gap: 12px;
}

@media (max-width: 480px) {
  .filter-group {
    flex-direction: column;
  }
}

/* Storage Location Cards */
.location-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.location-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  height: 100%;
  cursor: pointer;
  transition: var(--transition);
}

.location-card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: var(--shadow-lg), 0 0 25px rgba(245, 158, 11, 0.15);
}

.location-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.location-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.location-capacity {
  font-size: 13px;
  color: var(--text-muted);
}

.location-item-list {
  list-style: none;
  margin-top: 10px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.location-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 8px 12px;
  background-color: rgba(255, 255, 255, 0.02);
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.location-item-grain {
  font-weight: 600;
}

.location-item-qty {
  color: var(--color-accent);
  font-weight: 700;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(9, 13, 22, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none; /* Controlled by JS */
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-backdrop.show {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--panel-border);
  border-radius: var(--border-radius-lg);
  width: 100%;
  max-width: 500px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), var(--shadow-glow);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-content.modal-lg {
  max-width: 800px;
}

.modal-backdrop.show .modal-content {
  transform: translateY(0);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  transition: var(--transition);
}

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

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* App Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 350px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--border-radius);
  padding: 16px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast.show {
  transform: translateX(0);
}

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
}

.toast.success {
  border-left: 4px solid var(--color-success);
}
.toast.success .toast-icon {
  color: var(--color-success);
}

.toast.error {
  border-left: 4px solid var(--color-danger);
}
.toast.error .toast-icon {
  color: var(--color-danger);
}

.toast.warning {
  border-left: 4px solid var(--color-accent);
}
.toast.warning .toast-icon {
  color: var(--color-accent);
}

.toast-message {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

/* Responsive Hide/Show tabs */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustment for Sidebar */
@media (max-width: 900px) {
  aside.sidebar {
    transform: translateX(-100%);
  }
  
  aside.sidebar.open {
    transform: translateX(0);
  }
  
  main.main-content {
    margin-left: 0;
    padding: 20px;
  }
  
  .hamburger {
    display: block;
  }
  
  .sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(9, 13, 22, 0.6);
    z-index: 99;
    display: none;
  }
  
  .sidebar-backdrop.show {
    display: block;
  }
}

/* Empty State Styling */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
}

.empty-state i {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.empty-state h4 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.empty-state p {
  font-size: 13px;
}

/* --- INVOICE & REPORT PRINT & MEDIA QUERY STYLES --- */
@media print {
  body {
    background-color: #ffffff !important;
    color: #1f2937 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  
  /* If printing an invoice modal, hide the app container */
  body:has(#officialInvoiceModal.show) .app-container,
  body:has(#invoiceModal.show) .app-container {
    display: none !important;
  }
  
  /* If printing the reports tab (no modal open) */
  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) aside.sidebar,
  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) header.content-header,
  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) .search-filter-bar,
  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) .no-print,
  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) .toast-container {
    display: none !important;
  }

  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) main.main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) .tab-content:not(.active) {
    display: none !important;
  }

  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) .tab-content.active {
    display: block !important;
    width: 100% !important;
  }

  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) .card,
  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) .chart-panel {
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    color: #111827 !important;
    box-shadow: none !important;
  }

  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) .card-value {
    color: #111827 !important;
  }

  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) .card-subtitle {
    color: #4b5563 !important;
  }

  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) .custom-table {
    color: #111827 !important;
    border-collapse: collapse !important;
    width: 100% !important;
  }

  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) .custom-table th {
    background-color: #f3f4f6 !important;
    color: #111827 !important;
    border: 1px solid #d1d5db !important;
  }

  body:not(:has(#officialInvoiceModal.show)):not(:has(#invoiceModal.show)) .custom-table td {
    color: #111827 !important;
    border: 1px solid #e5e7eb !important;
  }

  /* Modal print adjustments */
  .modal-backdrop:not(#invoiceModal):not(#officialInvoiceModal) {
    display: none !important;
  }
  
  #invoiceModal, #officialInvoiceModal {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 100% !important;
    height: auto !important;
    background: #ffffff !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
    z-index: auto !important;
  }
  
  #invoiceModal .modal-content, #officialInvoiceModal .modal-content {
    box-shadow: none !important;
    border: none !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow: visible !important;
  }
  
  #invoiceModal .modal-body, #officialInvoiceModal .modal-body {
    overflow: visible !important;
    max-height: none !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }
  
  #invoiceModalContent, #offInvoiceModalContent {
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    min-height: 0 !important;
    border: none !important;
  }
}

/* Screen vs print layout for reports print-only block */
.print-only-block {
  display: none;
}

@media print {
  .print-only-block {
    display: block !important;
    color: #111827 !important;
  }
}
