/* styles.css - eVolva ISM HQ Modern Premium Design System */

:root {
  /* Color Palette - Light Theme */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #2563eb;
  --border-color: #e2e8f0;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-white: #ffffff;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;
  --gold: #d97706;
  --gold-bg: #fffbeb;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08), 0 2px 6px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 12px 24px -4px rgba(0, 0, 0, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.06);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 70px;
}

body.theme-dark {
  --bg-main: #0b0f19;
  --bg-card: #151d2a;
  --bg-sidebar: #070a12;
  --bg-sidebar-hover: #1b2433;
  --bg-sidebar-active: #3b82f6;
  --border-color: #243042;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-white: #ffffff;

  --primary-light: rgba(37, 99, 235, 0.18);
  --gold-bg: rgba(217, 119, 6, 0.18);
}

/* ── Accent Theme Overrides ─────────────────────────────────────────────── */
/* Ocean Teal */
body.accent-teal {
  --primary: #0891b2;
  --primary-hover: #0e7490;
  --primary-light: #ecfeff;
  --bg-sidebar-active: #0891b2;
}
body.accent-teal.theme-dark {
  --primary-light: rgba(8, 145, 178, 0.18);
  --bg-sidebar-active: #06b6d4;
}

/* Forest Green */
body.accent-green {
  --primary: #059669;
  --primary-hover: #047857;
  --primary-light: #ecfdf5;
  --bg-sidebar-active: #059669;
}
body.accent-green.theme-dark {
  --primary-light: rgba(5, 150, 105, 0.18);
  --bg-sidebar-active: #10b981;
}

/* Royal Purple */
body.accent-purple {
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-light: #f5f3ff;
  --bg-sidebar-active: #7c3aed;
}
body.accent-purple.theme-dark {
  --primary-light: rgba(124, 58, 237, 0.18);
  --bg-sidebar-active: #8b5cf6;
}

/* Sunset Orange */
body.accent-orange {
  --primary: #d97706;
  --primary-hover: #b45309;
  --primary-light: #fffbeb;
  --bg-sidebar-active: #d97706;
}
body.accent-orange.theme-dark {
  --primary-light: rgba(217, 119, 6, 0.18);
  --bg-sidebar-active: #f59e0b;
}

/* Rose Red */
body.accent-rose {
  --primary: #e11d48;
  --primary-hover: #be123c;
  --primary-light: #fff1f2;
  --bg-sidebar-active: #e11d48;
}
body.accent-rose.theme-dark {
  --primary-light: rgba(225, 29, 72, 0.18);
  --bg-sidebar-active: #f43f5e;
}

/* ── Theme Picker Panel ──────────────────────────────────────────────────── */
.theme-picker-wrap {
  position: relative;
}

.theme-picker-panel {
  position: fixed;
  top: 68px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  min-width: 220px;
  box-shadow: var(--shadow-lg);
  z-index: 99999;
  display: none;
  animation: themePickerIn 0.18s ease;
}
.theme-picker-panel.open {
  display: block;
}
@keyframes themePickerIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.theme-picker-panel h6 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.theme-mode-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.theme-mode-btn {
  flex: 1;
  padding: 7px 0;
  border-radius: 8px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-main);
  color: var(--text-main);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s;
}
.theme-mode-btn:hover { border-color: var(--primary); color: var(--primary); }
.theme-mode-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.accent-swatches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.accent-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 8px;
  border: 1.5px solid transparent;
  transition: all 0.15s;
}
.accent-swatch:hover { background: var(--bg-main); border-color: var(--border-color); }
.accent-swatch.active { border-color: var(--primary); background: var(--primary-light); }

.accent-swatch-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid rgba(0,0,0,0.1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
}
.accent-swatch-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow: hidden;
  height: 100dvh;
}

/* App Layout Structure */
.app-layout {
  display: flex;
  height: 100dvh;
  width: 100vw;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 100;
  border-right: 1px solid var(--border-color);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar-header {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
  white-space: nowrap;
}

.brand-icon {
  font-size: 22px;
  color: #60a5fa;
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.4px;
}

.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .arrow,
.sidebar.collapsed .db-status-badge span {
  display: none;
}

.btn-icon {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 15px;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Navigation List */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.18s ease-in-out;
  white-space: nowrap;
}

.nav-item i {
  font-size: 15px;
  width: 20px;
  text-align: center;
}

.nav-item:hover {
  background-color: var(--bg-sidebar-hover);
  color: #f8fafc;
}

.nav-item.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.nav-gold {
  color: #f59e0b;
  border: 1px dashed rgba(245, 158, 11, 0.4);
}

.nav-gold:hover,
.nav-gold.active {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #ffffff;
}

/* Nav Accordion Groups */
.nav-group {
  margin-top: 4px;
}

.nav-group-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}

.nav-group-header:hover {
  color: #cbd5e1;
}

.nav-group-header .arrow {
  transition: transform 0.2s;
}

.nav-group.open .nav-group-header .arrow {
  transform: rotate(180deg);
}

.nav-group-items {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding-left: 10px;
}

.nav-group.open .nav-group-items {
  display: flex;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.db-status-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #10b981;
  font-weight: 600;
  white-space: nowrap;
}

/* Main Workspace */
.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Topbar Header - Locked 1-Line Row */
.topbar {
  height: 60px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  overflow: visible;
  position: relative;
  z-index: 200;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

.page-title {
  font-size: 18px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  letter-spacing: -0.4px;
  white-space: nowrap;
}

.company-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(99, 102, 241, 0.12));
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.2);
  border-radius: 20px;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.search-box {
  position: relative;
}

.search-box i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 12px;
}

.search-box input {
  height: 36px;
  padding-left: 34px;
  width: 200px;
  border-radius: 18px;
  transition: width 0.25s ease, border-color 0.2s;
}

.search-box input:focus {
  width: 250px;
}

/* Sub-Toolbar Filters Bar (Single Aligned Row) */
.sub-toolbar {
  height: 52px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  overflow-x: auto;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.sub-toolbar::-webkit-scrollbar {
  height: 3px;
}

.sub-toolbar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  white-space: nowrap;
}

.filter-item label {
  font-weight: 600;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
}

.date-range-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-sep {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.form-select,
.form-control {
  height: 34px;
  padding: 4px 10px;
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background-color: var(--bg-main);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.form-select:focus,
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Buttons */
.btn {
  height: 34px;
  padding: 0 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #1e40af);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: var(--text-muted);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-main);
  border-color: #cbd5e1;
}

.btn-gold {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.25);
}

.btn-gold:hover {
  background: linear-gradient(135deg, #b45309, #92400e);
  transform: translateY(-1px);
}

.btn-sm {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.btn-loading {
  opacity: 0.7;
  pointer-events: none;
}

/* Content Area */
.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Loading Overlay & Spinner Animation */
.view-loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  gap: 16px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.spinner-ring {
  width: 44px;
  height: 44px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.loading-pulse-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  animation: pulseText 1.5s infinite ease-in-out;
}

@keyframes pulseText {

  0%,
  100% {
    opacity: 0.6;
  }

  50% {
    opacity: 1;
  }
}

/* Statusbar Footer */
.statusbar {
  height: 28px;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Dashboard Cards & Layout */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.22s ease-in-out;
  min-width: 0;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.kpi-info h4 {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.kpi-info .value {
  font-size: 23px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.4px;
}

.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* KPI Card Content - used by Conso Dashboard */
.kpi-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
  margin-left: 14px;
}

.kpi-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-sub {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-blue {
  background: var(--primary-light);
  color: var(--primary);
}

.kpi-green {
  background: #ecfdf5;
  color: #10b981;
}

.kpi-purple {
  background: #f3e8ff;
  color: #9333ea;
}

.kpi-orange {
  background: #fff7ed;
  color: #ea580c;
}

/* Grid Layouts for Charts & Tables */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
}

.card-body {
  padding: 20px;
}

.card-body.p-0 {
  padding: 0;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  background-color: var(--bg-main);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
}

/* Alternating Row Colors for Tables */
.data-table tbody tr:nth-child(even),
.data-table tbody tr.row-alt {
  background-color: rgba(0, 0, 0, 0.025);
}

body.theme-dark .data-table tbody tr:nth-child(even),
body.theme-dark .data-table tbody tr.row-alt {
  background-color: rgba(255, 255, 255, 0.035);
}

.data-table tbody tr:hover {
  background-color: var(--primary-light);
}

.clickable-row {
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.clickable-row:hover {
  background-color: var(--primary-light) !important;
  color: var(--primary);
}

.row-selected,
.selected-row {
  background-color: rgba(37, 99, 235, 0.14) !important;
  border-left: 4px solid var(--primary) !important;
}

.row-selected td,
.selected-row td {
  color: var(--primary) !important;
  font-weight: 700;
}

.dash-tab-btn {
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.dash-tab-btn.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}


.text-right {
  text-align: right;
}

.text-center {
  text-align: center;
}

.text-primary {
  color: var(--primary);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.text-danger {
  color: var(--danger);
}

.text-gold {
  color: var(--gold);
}

.text-purple {
  color: #9333ea;
}

.text-muted {
  color: var(--text-muted);
}

/* Badges */
.badge {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 6px;
  display: inline-block;
}

.badge-success {
  background: #dcfce7;
  color: #15803d;
}

.badge-warning {
  background: #fef3c7;
  color: #b45309;
}

.badge-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-primary {
  background: var(--primary-light);
  color: var(--primary);
}

.badge-info {
  background: #e0f2fe;
  color: #0369a1;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: all 0.25s ease;
}

.modal-overlay.hidden {
  display: none;
}

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  width: 480px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-card.modal-lg {
  width: 840px;
  /* Allow flex children to scroll (chart view large modal) */
  overflow: visible;
}

/* Chart panel card - same as .card but without overflow:hidden so canvas grows freely */
.chart-panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: visible;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background-color: var(--bg-main);
}

/* Report Split-Grid & Expand / Collapse Controls */
.report-split-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  align-items: start;
  transition: grid-template-columns 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Split View Toolbar / Switcher Bar */
.split-view-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 10px;
}

.split-view-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-main);
}

.split-view-label span {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 11px;
}

.split-view-switcher {
  display: inline-flex;
  align-items: center;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}

.split-opt {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.split-opt:hover {
  color: var(--primary);
  background: rgba(37, 99, 235, 0.08);
}

body.theme-dark .split-opt:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.split-opt.active {
  background: var(--primary);
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.35);
}

/* Quick Card Header Expand Button */
.btn-card-expand {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  font-size: 11px !important;
  padding: 3px 8px !important;
  height: 26px;
  line-height: 1;
  transition: all 0.2s ease;
}

/* Expand Table Full Width - Hides Chart */
.report-split-grid.expand-table,
.conso-grid-layout.expand-table,
.grid-2col.expand-table {
  grid-template-columns: 1fr !important;
}

.report-split-grid.expand-table > .split-side-chart,
.conso-grid-layout.expand-table > .split-side-chart,
.grid-2col.expand-table > .split-side-chart {
  display: none !important;
}

/* Expand Chart Full Width - Hides Table */
.report-split-grid.expand-chart,
.conso-grid-layout.expand-chart,
.grid-2col.expand-chart {
  grid-template-columns: 1fr !important;
}

.report-split-grid.expand-chart > .split-side-table,
.conso-grid-layout.expand-chart > .split-side-table,
.grid-2col.expand-chart > .split-side-table {
  display: none !important;
}

/* Conso Side-by-Side Responsive Grid Layout */
.conso-grid-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
  align-items: start;
}

/* Full-Screen & Responsive Scroll Optimizations */
@media (max-width: 1024px) {
  .conso-grid-layout,
  .report-split-grid,
  .grid-2col,
  .grid-3col {
    grid-template-columns: 1fr !important;
    width: 100% !important;
  }

  .conso-grid-layout > section,
  .conso-grid-layout > div,
  .report-split-grid > section,
  .report-split-grid > div,
  .grid-2col > section,
  .grid-3col > section {
    width: 100% !important;
    box-sizing: border-box;
  }
}

.content-area::-webkit-scrollbar {
  width: 6px;
}

.content-area::-webkit-scrollbar-thumb {
  background: rgba(37, 99, 235, 0.25);
  border-radius: 4px;
}

.content-area::-webkit-scrollbar-thumb:hover {
  background: rgba(37, 99, 235, 0.4);
}

/* ── Login Screen Overlay & Components ────────────────────────────────────── */
.login-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100dvh;
  background: linear-gradient(135deg, #070a12 0%, #151d2a 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
}

.login-card {
  width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  display: flex;
  flex-direction: column;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  font-size: 3.2rem;
  color: var(--primary);
  margin-bottom: 12px;
}

.login-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.login-header p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.login-form .form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

.login-form .form-group label i {
  color: var(--primary);
  margin-right: 4px;
}

.login-form .form-control {
  width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-main);
  color: var(--text-main);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form .form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.login-footer {
  text-align: center;
  margin-top: 24px;
}

.login-footer p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════
   AI SALES ASSISTANT — Chat Panel Styles
   ═══════════════════════════════════════════════════════════════════════════ */

/* Sidebar AI nav item — cyan/teal accent */
.nav-item.nav-ai {
  color: #06b6d4;
}
.nav-item.nav-ai:hover,
.nav-item.nav-ai.active {
  background: rgba(6, 182, 212, 0.15);
  color: #22d3ee;
}
.nav-item.nav-ai.active {
  background: rgba(6, 182, 212, 0.22);
}

/* ── Chat Panel Layout ───────────────────────────────────────────────────── */
/* ── Chat Panel Layout & Mode Override ───────────────────────────────────── */
.content-area.ai-chat-mode {
  padding: 10px 16px;
  overflow: hidden;
  height: calc(100vh - 120px);
}

.ai-chat-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ── Compact Top Control Toolbar ────────────────────────────────────────── */
.ai-chat-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
  gap: 12px;
  min-height: 44px;
}

.ai-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.ai-suggestions-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-chips-scroll {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  padding-bottom: 2px;
  flex: 1;
}

.ai-chips-scroll::-webkit-scrollbar {
  height: 3px;
}

.ai-chips-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 3px;
}

.ai-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 16px;
  border: 1px solid rgba(6, 182, 212, 0.35);
  background: rgba(6, 182, 212, 0.07);
  color: #06b6d4;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.ai-chip:hover {
  background: rgba(6, 182, 212, 0.18);
  border-color: #06b6d4;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(6,182,212,0.2);
}

body.theme-dark .ai-chip {
  border-color: rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.1);
}

.ai-chat-header-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.ai-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-main);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.ai-header-btn:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-main);
  border-color: var(--primary);
}

.ai-header-btn-danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Messages Scroll Area ────────────────────────────────────────────────── */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  scroll-behavior: smooth;
}

.ai-messages::-webkit-scrollbar {
  width: 5px;
}
.ai-messages::-webkit-scrollbar-track {
  background: transparent;
}
.ai-messages::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 10px;
}

/* ── Welcome State ───────────────────────────────────────────────────────── */
.ai-welcome {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
  max-width: 500px;
  margin: auto;
}

.ai-welcome-icon {
  font-size: 48px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.ai-welcome h4 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 10px;
}

.ai-welcome p {
  font-size: 13.5px;
  line-height: 1.65;
}

/* ── Message Bubbles ─────────────────────────────────────────────────────── */
.ai-msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: 100%;
  animation: ai-msg-in 0.22s ease;
}

@keyframes ai-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* User message — right aligned */
.ai-msg-user {
  flex-direction: row-reverse;
  align-self: flex-end;
  max-width: 75%;
}

.ai-msg-user .ai-msg-bubble {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-radius: 18px 18px 4px 18px;
  padding: 11px 16px;
  font-size: 13.5px;
  line-height: 1.55;
  box-shadow: 0 3px 12px rgba(37,99,235,0.3);
  word-break: break-word;
}

/* AI message — left aligned */
.ai-msg-ai {
  align-self: flex-start;
  max-width: 90%;
}

.ai-msg-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.ai-bubble-ai {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px 18px 18px 18px;
  padding: 14px 18px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  word-break: break-word;
}

body.theme-dark .ai-bubble-ai {
  background: var(--bg-card);
  border-color: var(--border-color);
}

/* ── Avatars ─────────────────────────────────────────────────────────────── */
.ai-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}

.ai-avatar-user {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
}

.ai-avatar-ai {
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  color: #fff;
  box-shadow: 0 2px 8px rgba(6,182,212,0.3);
}

/* ── Typing Indicator ────────────────────────────────────────────────────── */
.ai-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 14px 18px;
  min-width: 70px;
}

.ai-typing span {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #06b6d4;
  animation: ai-bounce 1.2s infinite ease-in-out;
}

.ai-typing span:nth-child(1) { animation-delay: 0s; }
.ai-typing span:nth-child(2) { animation-delay: 0.18s; }
.ai-typing span:nth-child(3) { animation-delay: 0.36s; }

@keyframes ai-bounce {
  0%, 80%, 100% { transform: scale(0.75); opacity: 0.5; }
  40%            { transform: scale(1.1);  opacity: 1; }
}

/* ── Message Action Row ──────────────────────────────────────────────────── */
.ai-msg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.ai-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.16s ease;
}

.ai-action-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

.ai-msg-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-left: auto;
  opacity: 0.7;
}

/* ── SQL Block ───────────────────────────────────────────────────────────── */
.ai-sql-block {
  background: #0f172a;
  border-radius: 8px;
  padding: 12px 16px;
  overflow-x: auto;
  border: 1px solid #1e293b;
}

body.theme-dark .ai-sql-block {
  background: #070a12;
  border-color: #1b2433;
}

.ai-sql-block pre {
  margin: 0;
}

.ai-sql-block code {
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
  font-size: 12px;
  color: #7dd3fc;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ── KPI Widget Cards ────────────────────────────────────────────────────── */
.ai-widget-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ai-widget-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 160px;
  max-width: 240px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ai-widget-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.ai-widget-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.ai-widget-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.ai-widget-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
  margin: 2px 0;
}

.ai-widget-sublabel {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* ── Chart Container ─────────────────────────────────────────────────────── */
.ai-chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  height: 240px;
  position: relative;
  box-shadow: var(--shadow-sm);
}

/* ── Data Table Preview ──────────────────────────────────────────────────── */
.ai-table-wrap {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  max-height: 280px;
  overflow-y: auto;
}

.ai-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.ai-table thead th {
  background: var(--bg-main);
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1;
}

.ai-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: background 0.12s ease;
}

.ai-table tbody tr:hover {
  background: var(--primary-light);
}

.ai-table tbody td {
  padding: 7px 12px;
  color: var(--text-main);
  white-space: nowrap;
}

.ai-table tbody td.ai-tbl-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--primary);
}

.ai-tbl-more {
  text-align: center;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-main);
}

/* ── Markdown Styles within AI bubbles ───────────────────────────────────── */
.ai-bubble-ai strong { font-weight: 700; }
.ai-bubble-ai em     { font-style: italic; }

.ai-md-code {
  background: rgba(99,102,241,0.12);
  color: #6366f1;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'Consolas', monospace;
  font-size: 12px;
}

.ai-md-list {
  list-style: none;
  padding: 4px 0 4px 4px;
  margin: 4px 0;
}

.ai-md-list li {
  position: relative;
  padding-left: 18px;
  margin-bottom: 4px;
  line-height: 1.55;
}

.ai-md-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: #06b6d4;
  font-size: 10px;
  top: 3px;
}

.ai-md-hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 10px 0;
}

.ai-md-h2 { font-size: 15px; font-weight: 700; margin: 8px 0 4px; }
.ai-md-h3 { font-size: 14px; font-weight: 700; margin: 6px 0 3px; }
.ai-md-h4 { font-size: 13px; font-weight: 700; margin: 4px 0 2px; color: var(--primary); }

/* ── Input Bar ───────────────────────────────────────────────────────────── */
.ai-input-bar {
  flex-shrink: 0;
  padding: 14px 24px 16px;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
}

.ai-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--bg-main);
  border: 1.5px solid var(--border-color);
  border-radius: 14px;
  padding: 10px 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ai-input-wrap:focus-within {
  border-color: #06b6d4;
  box-shadow: 0 0 0 3px rgba(6,182,212,0.12);
}

.ai-textarea {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text-main);
  font-size: 13.5px;
  font-family: 'Inter', system-ui, sans-serif;
  resize: none;
  line-height: 1.55;
  max-height: 150px;
  overflow-y: auto;
}

.ai-textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}

.ai-input-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.ai-char-count {
  font-size: 10.5px;
  color: var(--text-muted);
  opacity: 0.7;
}

.ai-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #06b6d4, #2563eb);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  box-shadow: 0 2px 8px rgba(6,182,212,0.35);
  flex-shrink: 0;
}

.ai-send-btn:hover {
  transform: scale(1.07);
  box-shadow: 0 4px 14px rgba(6,182,212,0.45);
}

.ai-send-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.ai-input-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 7px;
  opacity: 0.7;
}

.ai-input-hint kbd {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: monospace;
}

/* ── Dark Mode Overrides ─────────────────────────────────────────────────── */
body.theme-dark .ai-chat-toolbar,
body.theme-dark .ai-input-bar {
  background: var(--bg-card);
  border-color: var(--border-color);
}

body.theme-dark .ai-input-wrap {
  background: #0b0f19;
  border-color: var(--border-color);
}

body.theme-dark .ai-widget-card {
  background: var(--bg-card);
}

body.theme-dark .ai-chart-container {
  background: var(--bg-card);
}

body.theme-dark .ai-table-wrap {
  border-color: var(--border-color);
}

body.theme-dark .ai-table thead th {
  background: var(--bg-sidebar);
}

body.theme-dark .ai-table tbody tr:hover {
  background: rgba(37,99,235,0.12);
}

body.theme-dark .ai-md-code {
  background: rgba(99,102,241,0.2);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ai-chat-panel {
    max-height: calc(100vh - 120px);
  }

  .ai-msg-user {
    max-width: 90%;
  }

  .ai-msg-ai {
    max-width: 100%;
  }

  .ai-chips-scroll {
    max-height: 60px;
  }

  .ai-widget-card {
    min-width: 130px;
    max-width: 100%;
  }

  .ai-chat-header {
    padding: 12px 16px;
  }

  .ai-messages {
    padding: 14px 16px;
  }

  .ai-input-bar {
    padding: 10px 14px 12px;
  }
}
/* Print Modifiers for Invoice Modal */
@media print {
  body.print-invoice-mode * {
    visibility: hidden;
  }
  body.print-invoice-mode #invoiceModal,
  body.print-invoice-mode #invoiceModal * {
    visibility: visible;
  }
  body.print-invoice-mode #invoiceModal {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    background: transparent;
  }
  body.print-invoice-mode #invoiceModal .modal-card {
    box-shadow: none;
    border: none;
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: none;
  }
  body.print-invoice-mode .modal-footer,
  body.print-invoice-mode .modal-close {
    display: none !important;
  }
  
  /* A4 Format */
  @page { margin: 0; }
  body.print-a4 {
    margin: 1cm;
  }
  body.print-a4 #invoiceModal {
    width: 210mm;
  }

  /* A5 Format */
  body.print-a5 {
    margin: 1cm;
  }
  body.print-a5 #invoiceModal {
    width: 148mm;
  }
  body.print-a5 .data-table th, 
  body.print-a5 .data-table td {
    font-size: 11px;
    padding: 4px;
  }
  body.print-a5 h3 {
    font-size: 14px !important;
  }

  /* Slip Format (80mm POS receipt) */
  body.print-slip {
    margin: 0;
  }
  body.print-slip #invoiceModal {
    width: 78mm;
    font-size: 10px;
    font-family: 'Courier New', Courier, monospace;
    padding: 2mm;
  }
  body.print-slip #invoiceModalBody > div {
    display: block !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 5px !important;
  }
  body.print-slip .data-table th, 
  body.print-slip .data-table td {
    font-size: 9px;
    padding: 2px 1px;
  }
  body.print-slip h3 {
    font-size: 12px !important;
  }
  body.print-slip h4 {
    font-size: 11px !important;
  }
  body.print-slip .badge {
    border: 1px solid #000;
    color: #000 !important;
    background: none !important;
    display: inline-block;
  }
  body.print-slip .text-primary, 
  body.print-slip .text-success, 
  body.print-slip .text-danger, 
  body.print-slip .text-info {
    color: #000 !important;
  }
  body.print-slip .table-responsive {
    overflow: visible !important;
    max-height: none !important;
    border: none !important;
  }
  body.print-slip table {
    border-collapse: collapse;
    width: 100%;
  }
  body.print-slip table th, body.print-slip table td {
    border-bottom: 1px dashed #000;
  }
}

/* --- Mobile Responsiveness --- */
@media screen and (max-width: 768px) {
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  
  .sidebar {
    position: fixed;
    height: 100dvh;
    z-index: 1000;
    left: 0;
    top: 0;
    transform: translateX(0);
    transition: transform 0.3s ease;
    width: var(--sidebar-width) !important;
  }
  
  .sidebar.collapsed {
    transform: translateX(-100%);
  }

  .sidebar.collapsed .brand-name,
  .sidebar.collapsed .nav-text,
  .sidebar.collapsed .arrow,
  .sidebar.collapsed .db-status-badge span {
    display: block !important; 
  }

  .app-layout {
    flex-direction: column;
  }

  .main-wrapper {
    width: 100vw;
  }
  
  .topbar {
    height: auto;
    padding: 10px;
    gap: 10px;
  }
  
  .topbar-left {
    flex-wrap: wrap;
  }
  
  .sub-toolbar {
    height: auto;
    padding: 10px;
    flex-wrap: wrap;
  }
  
  .filter-item {
    width: 100%;
  }

  .date-range-picker {
    flex-wrap: wrap;
  }
  
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  
  .split-grid-wrapper, .report-split-grid, .conso-grid-layout, .grid-2col {
    grid-template-columns: 1fr !important;
  }
  
  .split-view-bar {
    display: flex !important;
  }
  
  .split-side-table, .split-side-chart {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  .statusbar {
    height: auto;
    flex-direction: column;
    padding: 10px;
    gap: 5px;
    text-align: center;
  }
}

/* --- Tablet Responsiveness --- */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .sidebar {
    width: var(--sidebar-collapsed-width);
  }
  .sidebar .brand-name,
  .sidebar .nav-text,
  .sidebar .arrow,
  .sidebar .db-status-badge span {
    display: none;
  }
}

/* --- Compact Table Mode --- */
body.compact-table-mode .data-table th,
body.compact-table-mode .data-table td {
  padding: 6px 10px;
  font-size: 11px;
}

/* --- Dropdown Menu Fixes --- */
.dropdown-menu {
  display: none !important;
}
.dropdown-menu.show {
  display: block !important;
}
.dropdown-item:hover {
  background-color: var(--primary-light, #eff6ff);
  color: var(--primary, #2563eb) !important;
}
