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

/* Reset nav element margins */
nav {
  margin: 0;
  padding: 0;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 1);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.3s ease;
}

.loading-overlay[style*="display: none"] {
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid #f3f3f3;
  border-top: 5px solid #091c3a;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

.loading-text {
  color: #091c3a;
  font-size: 18px;
  font-weight: 500;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Main content container */
.main-content {
  display: block;
  width: 100%;
  transition: opacity 0.3s ease;
  overflow-x: hidden;
}

.main-content.loading {
  opacity: 0.5;
  pointer-events: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
    "Ubuntu", "Cantarell", sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #e9ecef 100%);
  color: #091c3a;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 20px 20px 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  padding-bottom: 80px; /* Space for footer */
}

.header {
  /* position: sticky; */
  top: 0;
  background-color: #091c3a;
  color: white;
  z-index: 1000;
  padding: 1rem 2rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: bold;
}

.header-logo {
  height: 70px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  filter: brightness(0) invert(1); /* Aceasta face logo-ul alb */
  transition: all 0.3s ease;
}

.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.content > * {
  width: 100%;
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  z-index: 1000;
  padding: 1rem;
  box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.1);
}

.super-nav {
  display: flex;
  gap: 12px;
  margin: 0 0 24px 0;
  background: #091c3a;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(9, 28, 58, 0.2);
}

/* Admin View Styles */
.admin-nav {
  display: flex;
  gap: 12px;
  margin: 0 0 24px 0;
  background: #091c3a;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(9, 28, 58, 0.2);
}



.admin-main-container #org-chart-container {
  flex: 1;
  width: 100%;
  min-height: 800px;
  border: 1px solid #ddd;
  background-color: #fdfdfd;
  overflow: hidden;
  border-radius: 5px;
}

/* SVG Org Chart Styling */
#org-chart-container svg {
  width: 100%;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#org-chart-container path.link {
  fill: none;
  stroke: #999;
  stroke-width: 2px;
}

#org-chart-container g.node rect {
  fill: #ecf0f1;
  stroke: #bdc3c7;
  stroke-width: 1px;
  border-radius: 5px;
}

#org-chart-container g.node text {
  font-size: 14px;
  fill: #333;
}

#org-chart-container g.node-indicator circle {
  fill: #2ecc71;
}

#org-chart-container g.node-indicator text {
  font-size: 12px;
  fill: white;
  text-anchor: middle;
  dominant-baseline: central;
}

/* Elevated View Styles */
.elevated-nav {
  display: flex;
  gap: 12px;
  margin: 0 0 24px 0;
  background: #091c3a;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(9, 28, 58, 0.2);
}

/* Admin View Styles */
.admin-nav {
  display: flex;
  gap: 12px;
  margin: 0 0 24px 0;
  background: #091c3a;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(9, 28, 58, 0.2);
}

.admin-main-container {
  width: 100%;
  min-height: 800px;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Admin Sections (dynamically loaded from admin folder) */
.admin-main-container .content-section {
  display: none !important;
  padding: 20px;
  border-radius: 8px;
  background-color: #fff;
  width: 100%;
}

.admin-main-container .content-section.active {
  display: block !important;
  flex: 1;
  animation: fadeIn 0.4s ease;
}

.metrics-section {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
  width: 100%;
  overflow-x: hidden;
}

.metric-card {
  background: white;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  text-align: center;
  min-width: 0; /* Permite cardurilor să se micșoreze */
}

.metric-label {
  font-size: 1.1em;
  color: #666;
  margin-bottom: 10px;
}

.metric-value {
  /* font-size: 2.5em; */
  font-weight: bold;
  color: #091c3a;
  margin-bottom: 5px;
}

.metric-target {
  font-size: 0.9em;
  color: #666;
}

.user-details-section {
  margin-top: 30px;
  background: white;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.user-selector {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-selector label {
  margin-right: 0;
  margin-bottom: 8px;
  font-weight: 500;
  color: #091c3a;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
}

.user-selector select {
  padding: 12px 16px;
  border-radius: 8px;
  border: 2px solid #e9ecef;
  font-size: 15px;
  min-width: 250px;
  color: #091c3a;
  background-color: white;
  transition: all 0.3s ease;
}

.user-selector select:focus {
  outline: none;
  border-color: #091c3a;
  box-shadow: 0 0 0 3px rgba(9, 28, 58, 0.1);
}

.user-kpi-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background: white;
}

.user-kpi-table th,
.user-kpi-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid #f1f3f5;
  font-size: 15px;
  color: #495057;
}

.user-kpi-table th {
  background: #f8f9fa;
  font-weight: 700;
  font-size: 14px;
  color: #091c3a;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e9ecef;
}

.user-kpi-table td:first-child {
  font-weight: 700;
  color: #091c3a;
  font-size: 16px;
}

.user-kpi-table tbody tr {
  transition: background 0.2s ease;
}

.user-kpi-table tbody tr:hover {
  background: #f8f9fb;
}

.user-kpi-table tbody tr:last-child {
  border-bottom: none;
}

.chat-widget {
  position: fixed;
  bottom: 100px;
  right: calc(50% - 650px);
  z-index: 1001;
}

@media (max-width: 768px) {
  body {
    overflow-y: auto;
    height: auto;
  }

  .container {
    padding: 10px;
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
  }

  .header {
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    margin-bottom: 20px;
  }

  .header-logo {
    height: 60px;
    max-width: 160px;
  }

  .logo-text {
    font-size: 1.2rem;
    font-weight: bold;
  }

  /* Footer responsive - 768px */
  .footer {
    padding: 16px 12px;
  }

  .daily-report {
    max-width: 100%;
  }

  .report-date {
    font-size: 12px;
    margin-bottom: 6px;
  }

  .report-message {
    font-size: 14px;
    max-width: 100%;
    padding: 0 15px;
  }

  .report-message::before,
  .report-message::after {
    font-size: 36px;
  }

  .report-message::before {
    left: -5px;
    top: -15px;
  }

  .report-message::after {
    right: -5px;
    bottom: -30px;
  }

  /* All nav responsive - 768px */
  .super-nav,
  .admin-nav,
  .elevated-nav,
  .nav-buttons {
    gap: 8px;
    padding: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
  }

  .super-nav .nav-btn,
  .admin-nav .nav-btn,
  .elevated-nav .nav-btn,
  .nav-buttons .nav-btn {
    padding: 10px 16px;
    font-size: 13px;
    flex: 1 1 auto;
    min-width: 100px;
  }

  .metrics-section {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 5px;
    margin: 10px 5px;
  }

  .metric-card {
    padding: 12px;
    margin: 0;
    width: 100%;
  }

  .metric-label {
    font-size: 0.85em;
    margin-bottom: 5px;
  }

  .metric-value {
    font-size: 1.5em;
    margin: 5px 0;
  }

  .metric-target {
    font-size: 0.75em;
  }

  /* Total section responsive - 768px */
  .total-section {
    padding: 24px;
    margin-bottom: 20px;
    border-radius: 16px;
  }

  #manager-tt-view .total-section,
  #user-content .total-section,
  #manager-view .total-section {
    gap: 16px;
    margin-bottom: 20px;
  }

  #manager-tt-view .total-section .metrics-card,
  #user-content .total-section .metrics-card,
  #manager-view .total-section .metrics-card {
    min-width: 250px;
    padding: 24px;
    border-radius: 16px;
  }

  .total-label {
    font-size: clamp(9px, 2.5vw, 18px);
    letter-spacing: 1px;
    margin-bottom: 8px;
  }

  .total-value {
    font-size: clamp(9px, 3.5vw, 20px);
  }

  .label-subtext {
    font-size: clamp(6px, 1.8vw, 12px);
  }
}

/* Header */
.header {
  background: #091c3a;
  border-radius: 16px;
  padding: 24px 32px;
  margin-bottom: 32px;
  box-shadow: 0 8px 24px rgba(9, 28, 58, 0.2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  width: 100%;
}

.logo {
  color: white;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.nav-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 2px solid transparent;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
}

.nav-btn.active {
  background: white;
  color: #091c3a;
  border-color: white;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.3);
}

/* Content sections */
.content {
  flex: 1;
  animation: fadeIn 0.4s ease;
}

.content.active {
  display: block;
}

.manager-content,
.developer-content {
  display: none;
  overflow: hidden;
}

.manager-content.active,
.developer-content.active {
  display: block;
  animation: fadeIn 0.4s ease;
  flex-direction: column;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Table Title */
.table-title,
.kpi-table-container h2,
.kpi-table-container h3 {
  font-size: 1.5em;
  color: #091c3a;
  margin-bottom: 1em;
  font-weight: 600;
  position: sticky;
  left: 0;
  top: 0;
  z-index: 10;
  background: white;
  width: 100%;
  padding: 0;
  margin-top: 0;
}

/* IKA Table Titles (h3 inside kpi-table-container) */

/* Expandable Rows */
.trasee-row {
  background-color: rgba(9, 28, 58, 0.02);
}

.clienti-row {
  background-color: rgba(9, 28, 58, 0.05);
  font-size: 0.95em;
}

.facturi-row {
  background-color: rgba(9, 28, 58, 0.08);
  font-size: 0.9em;
}

.facturi-header {
  background-color: rgba(9, 28, 58, 0.12) !important;
  font-size: 0.9em;
}

.facturi-header td {
  color: #091c3a !important;
  border-bottom: 1px solid rgba(9, 28, 58, 0.2) !important;
}

.expandable-row,
.expandable-row-2,
.trasee-row,
.clienti-row,
.expandable-kpi-row {
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.expandable-row:hover,
.expandable-row-2:hover,
.trasee-row:hover,
.expandable-kpi-row:hover {
  background-color: rgba(9, 28, 58, 0.05);
}

.expandable-row::after,
.expandable-row-2::after,
.trasee-row::after,
.expandable-kpi-row::after {
  content: "▼";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #091c3a;
  opacity: 0.3;
  pointer-events: none;
  transition: all 0.2s ease;
}

.expandable-row.expanded::after,
.expandable-row-2.expanded::after,
.trasee-row.expanded::after,
.expandable-kpi-row.expanded::after {
  transform: translateY(-50%) rotate(180deg);
  opacity: 0.6;
}

/* Stiluri pentru detail rows (routes, clients, bills) */
.detail-row {
  transition: background-color 0.2s ease;
  display: table-row;
}

.detail-row.route-row {
  background-color: #fafafa;
}

.detail-row.route-row td:first-child {
  padding-left: 2em;
}

.detail-row.client-row {
  background-color: #f5f5f5;
}

.detail-row.client-row td:first-child {
  padding-left: 4em;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  max-width: 200px;
}

.detail-row.bill-row {
  background-color: #f0f0f0;
}

.detail-row.bill-row td:first-child {
  padding-left: 6em;
}

.detail-row.product-row {
  background-color: #eeeeee;
}

.detail-row.product-row td:first-child {
  padding-left: 6em;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  max-width: 180px;
}

.detail-row.expandable-detail-row {
  cursor: pointer;
}

.detail-row.expandable-detail-row:hover {
  background-color: rgba(9, 28, 58, 0.05);
}

/* Efecte de tranziție pentru expandare/colapsare */
.trasee-row,
.clienti-row {
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Total Section */
.total-section {
  background: linear-gradient(135deg, #091c3a 0%, #0a2851 100%);
  border-radius: 20px;
  padding: 40px;
  margin-bottom: 32px;
  box-shadow: 0 12px 32px rgba(9, 28, 58, 0.3);
  text-align: center;
  position: relative;
  overflow: hidden;
  width: 100%;
  float: none; /* Elimină orice float anterior */
  display: block; /* Asigură că ocupă întreaga lățime */
}

/* Manager TT View - Override pentru 2 cards */
#manager-tt-view .total-section {
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0 0 32px 0;
  box-shadow: none;
  text-align: center;
  position: relative;
  overflow: visible;
  width: 100%;
  float: none;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: stretch;
  flex-wrap: wrap;
}

#manager-tt-view .total-section .metrics-card {
  flex: 1;
  min-width: 300px;
  background: linear-gradient(135deg, #091c3a 0%, #0a2851 100%);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 12px 32px rgba(9, 28, 58, 0.3);
  position: relative;
  overflow: hidden;
}

/* User View (role_level 1) - 2 cards layout */
#user-content .total-section {
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0 0 32px 0;
  box-shadow: none;
  text-align: center;
  position: relative;
  overflow: visible;
  width: 100%;
  float: none;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: stretch;
  flex-wrap: wrap;
}

#user-content .total-section .metrics-card {
  flex: 1;
  min-width: 300px;
  background: linear-gradient(135deg, #091c3a 0%, #0a2851 100%);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 12px 32px rgba(9, 28, 58, 0.3);
  position: relative;
  overflow: hidden;
}

/* Manager View (role_level 2) - 2 cards layout */
#manager-view .total-section {
  background: transparent;
  border-radius: 0;
  padding: 0;
  margin: 0 0 32px 0;
  box-shadow: none;
  text-align: center;
  position: relative;
  overflow: visible;
  width: 100%;
  float: none;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: stretch;
  flex-wrap: wrap;
}

#manager-view .total-section .metrics-card {
  flex: 1;
  min-width: 300px;
  background: linear-gradient(135deg, #091c3a 0%, #0a2851 100%);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 12px 32px rgba(9, 28, 58, 0.3);
  position: relative;
  overflow: hidden;
}

/* Add ::before and styling for user and manager views */
#user-content .total-section .metrics-card::before,
#manager-view .total-section .metrics-card::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 70%
  );
  pointer-events: none;
}

#user-content .total-section .metric-card,
#manager-view .total-section .metric-card {
  position: relative;
  z-index: 1;
  text-align: center;
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

/* Responsive: Stack on smaller screens */
@media (max-width: 1024px) {
  #manager-tt-view .total-section .metrics-card {
    flex: 1 1 calc(50% - 12px);
    min-width: unset;
  }
}

@media (max-width: 768px) {
  #manager-tt-view .total-section {
    gap: 16px;
  }
  
  #manager-tt-view .total-section .metrics-card {
    flex: 1 1 100%;
    padding: 30px;
  }
}

@media (max-width: 480px) {
  #manager-tt-view .total-section .metrics-card {
    padding: 20px;
  }
  
  #manager-tt-view .total-section .metric-value {
    font-size: 24px;
  }
  
  #manager-tt-view .total-section .metric-label {
    font-size: 14px;
  }
}

/* Responsive styles for user and manager views */
@media (max-width: 1024px) {
  #user-content .total-section .metrics-card,
  #manager-view .total-section .metrics-card {
    flex: 1 1 calc(50% - 12px);
    min-width: unset;
  }
}

@media (max-width: 768px) {
  #user-content .total-section,
  #manager-view .total-section {
    gap: 16px;
  }
  
  #user-content .total-section .metrics-card,
  #manager-view .total-section .metrics-card {
    flex: 1 1 100%;
    padding: 30px;
  }
}

@media (max-width: 480px) {
  #user-content .total-section .metrics-card,
  #manager-view .total-section .metrics-card {
    padding: 20px;
  }
  
  #user-content .total-section .metric-value,
  #manager-view .total-section .metric-value {
    font-size: 24px;
  }
  
  #user-content .total-section .metric-label,
  #manager-view .total-section .metric-label {
    font-size: 14px;
  }
}

#manager-tt-view .total-section .metric-card {
  position: relative;
  z-index: 1;
  text-align: center;
  background: transparent;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}

#manager-tt-view .total-section .metric-label {
  color: white;
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: none;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#manager-tt-view .total-section .metric-value {
  color: white;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 8px 0;
}

#manager-tt-view .total-section .metric-target {
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.5px;
}

/* Hide the ::before for regular total-section */
.total-section::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 70%
  );
  pointer-events: none;
}

.total-label {
  color: white;
  font-size: clamp(10px, 3vw, 22px);
  font-weight: 800;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 2px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.label-subtext {
  font-size: clamp(6px, 2vw, 14px);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
}

.total-value {
  color: white;
  font-size: clamp(10px, 4vw, 22px);
  font-weight: 600;
  /* letter-spacing: -1px; */
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.total-value .label-subtext {
  font-size: clamp(6px, 2.5vw, 14px);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
}

/* Table */
.table-container {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 30px; /* Spațiu normal pentru desktop */
  width: 100% !important;
  position: relative;
  z-index: 1;
  clear: both;
  scroll-behavior: smooth;
  touch-action: manipulation;
  display: block !important;
  box-sizing: border-box;
}

/* Ensure .kpi-table inside .table-container behaves correctly */
.table-container > .kpi-table {
  width: 100%;
  display: table;
  table-layout: auto;
  min-width: max-content;
}

/* IKA Table Container - same styling as table-container */
.kpi-table-container {
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 30px;
  width: 100% !important;
  position: relative;
  z-index: 1;
  clear: both;
  scroll-behavior: smooth;
  touch-action: manipulation;
  display: block !important;
  box-sizing: border-box;
}

/* Ensure .kpi-table inside .kpi-table-container behaves like in .table-container */
.kpi-table-container > .kpi-table {
  width: 100%;
  display: table;
  table-layout: auto;
  min-width: max-content;
}

/* Adaugă spațiu suplimentar pentru ultimul tabel înainte de footer */
.table-container:last-child,
.kpi-table-container:last-child {
  margin-bottom: 120px; /* Spațiu mărit pentru ultimul tabel */
}

.kpi-table {
  width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  background: white;
  display: table;
  min-width: max-content;
}

.kpi-table th,
.kpi-table td {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  white-space: normal;
  word-wrap: break-word;
  word-break: break-word;
  border-bottom: 1px solid #f1f3f5;
}

.kpi-table th {
  background: #f8f9fa;
  font-weight: 700;
  color: #091c3a;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  border-bottom: 2px solid #e9ecef;
  padding: 12px 16px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 13 !important;
}

.kpi-table thead th:first-child {
  min-width: 110px !important;
  position: sticky !important;
  left: 0 !important;
  top: 0 !important;
  z-index: 15 !important;
  background: #f8f9fa !important;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.kpi-table tbody td:first-child {
  min-width: 110px !important;
  position: sticky !important;
  left: 0 !important;
  z-index: 11 !important;
  background: white !important;
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1) !important;
  font-weight: 700 !important;
  color: #091c3a !important;
  font-size: 13px !important;
}

.kpi-table tbody td:not(:first-child) {
  font-weight: 600;
}

.percent-green {
  color: #28a745;
  font-weight: 600;
  text-align: right;
}

.percent-yellow {
  color: #ffc107;
  font-weight: 600;
  text-align: right;
}

.percent-red {
  color: #dc3545;
  font-weight: 600;
  text-align: right;
}

.detail-btn {
  background: #f8f9fa;
  border: 2px solid #e9ecef;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #091c3a;
  transition: all 0.3s ease;
}

.detail-btn:hover {
  background: #091c3a;
  color: white;
  border-color: #091c3a;
  transform: scale(1.1);
}

/* Placeholder content */
.placeholder-content {
  background: white;
  border-radius: 16px;
  padding: 60px 40px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.placeholder-content h2 {
  color: #091c3a;
  font-size: 32px;
  margin-bottom: 16px;
  font-weight: 700;
}

.placeholder-content p {
  color: #6c757d;
  font-size: 18px;
  line-height: 1.6;
}

/* Footer with daily report */
.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #091c3a 0%, #0a2851 100%);
  padding: 20px;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  z-index: 1000;
}

.daily-report {
  max-width: 1400px;
  margin: 0 auto;
  color: white;
  text-align: center;
  position: relative;
}

.report-date {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 8px;
  font-weight: 500;
}

.report-message {
  font-size: 16px;
  line-height: 1.6;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  padding: 0 20px;
}

.report-message::before,
.report-message::after {
  content: '"';
  position: absolute;
  font-size: 48px;
  opacity: 0.2;
  font-family: Georgia, serif;
}

.report-message::before {
  left: -10px;
  top: -20px;
}

.report-message::after {
  right: -10px;
  bottom: -40px;
}

/* Chat Widget */
.chat-widget {
  position: fixed;
  bottom: 140px;
  right: calc(50% - 680px);
  z-index: 1000;
}

.chat-toggle {
  background: #091c3a;
  color: white;
  border: none;
  width: 60px;
  height: 60px;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(9, 28, 58, 0.3);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-toggle:hover {
  transform: scale(1.1);
  background: #0a2851;
}

/* Prevent body scroll when chat is open */
body.chat-open {
  overflow: hidden !important;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* For tablets and mobile - more aggressive scroll lock */
@media (max-width: 1024px) {
  body.chat-open {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden !important;
    touch-action: none;
  }

  body.chat-open .container,
  body.chat-open .content {
    overflow: hidden !important;
  }
}

.chat-window {
  position: fixed;
  bottom: 140px;
  right: calc(50% - 680px); /* Aliniază cu butonul de chat */
  width: 350px;
  height: calc(
    100vh - 300px
  ); /* Înălțime dinamică bazată pe înălțimea viewport-ului */
  max-height: 600px;
  min-height: 400px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  display: none;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateY(20px);
  opacity: 0;
}

.chat-window.active {
  display: flex;
  transform: translateY(0);
  opacity: 1;
}

.chat-header {
  background: linear-gradient(135deg, #091c3a 0%, #0a2851 100%);
  color: white;
  padding: 20px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-close {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  font-size: 24px;
  width: 32px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.chat-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: #f8f9fa;
}

.message {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  animation: messageSlide 0.3s ease forwards;
}

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

.message.user {
  background: #091c3a;
  color: white;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.message.ai {
  background: white;
  color: #091c3a;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.chat-input-container {
  padding: 16px;
  background: white;
  border-top: 1px solid #e9ecef;
  display: flex;
  gap: 12px;
  align-items: center;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid #e9ecef;
  border-radius: 20px;
  font-size: 14px;
  transition: all 0.3s ease;
  background: #f8f9fa;
}

.chat-input:focus {
  outline: none;
  border-color: #091c3a;
  background: white;
  box-shadow: 0 0 0 3px rgba(9, 28, 58, 0.1);
}

.chat-btn {
  background: #091c3a;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(9, 28, 58, 0.2);
}

.chat-btn:hover {
  transform: scale(1.1);
  background: #0a2851;
}

/* Responsive */
@media (max-width: 1400px) {
  .chat-widget {
    right: 20px;
  }

  .chat-window {
    right: 20px;
  }
}

/* Tablet - chat fullscreen */
@media (max-width: 1024px) {
  .chat-widget {
    right: 15px;
    bottom: 100px;
  }

  .chat-toggle {
    width: 50px;
    height: 50px;
  }

  .chat-window {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 80px;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    min-height: unset;
    border-radius: 16px;
  }

  .chat-header {
    padding: 16px;
    font-size: 16px;
  }

  .chat-close {
    width: 36px;
    height: 36px;
    font-size: 28px;
  }

  .chat-messages {
    padding: 16px;
  }

  .chat-input-container {
    padding: 12px 16px;
  }

  .chat-input {
    font-size: 16px;
    padding: 12px 16px;
  }

  .chat-btn {
    width: 44px;
    height: 44px;
  }
}

@media (max-width: 768px) {
  body {
    overflow-y: auto;
    height: auto;
  }

  .container {
    padding: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
  }

  /* CRITICAL FIX: Table container with proper scroll */
  .table-container,
  .kpi-table-container {
    width: 100% !important;
    margin: 8px 0;
    padding: 12px;
    margin-bottom: 15px;
    border-radius: 10px;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: block !important;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    clear: both;
    scroll-behavior: smooth;
    touch-action: manipulation;
  }

  .table-container:last-child,
  .kpi-table-container:last-child {
    margin-bottom: 100px;
  }

  /* Ensure table spans full width but allows scroll */
  .kpi-table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    display: table;
    min-width: max-content;
  }

  .table-container .kpi-table,
  .kpi-table-container .kpi-table {
    width: 100% !important;
    table-layout: auto !important;
    display: table !important;
    min-width: max-content !important;
    overflow: visible !important;
  }

  .kpi-table th,
  .kpi-table td {
    padding: 10px 8px;
    font-size: 12px;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    min-width: 80px;
  }

  .kpi-table th:first-child,
  .kpi-table td:first-child {
    min-width: 90px !important;
    position: sticky !important;
    left: 0 !important;
    z-index: 12 !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
  }

  .kpi-table th:first-child {
    background: #f8f9fa !important;
    z-index: 14 !important;
  }

  .kpi-table td:first-child {
    background: white !important;
  }

  /* Detail rows mobile styling */
  .detail-row {
    display: table-row;
  }

  .detail-row td,
  .detail-row td:first-child {
    font-size: 12px;
    font-weight: 400;
  }

  .detail-row.route-row td:first-child {
    padding-left: 1.5em !important;
  }

  .detail-row.client-row td:first-child {
    padding-left: 3em !important;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    max-width: 150px;
  }

  .detail-row.product-row td:first-child {
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    max-width: 130px;
  }

  .detail-row.bill-row td:first-child {
    padding-left: 4.5em !important;
  }

  .content {
    height: auto;
    min-height: calc(100vh - 160px);
    overflow-y: auto;
    padding-bottom: 80px;
    -webkit-overflow-scrolling: touch;
  }

  .logo {
    font-size: 20px;
  }

  .nav-buttons {
    width: 100%;
  }

  .nav-btn {
    flex: 1;
    min-width: 0;
    padding: 8px;
    font-size: 12px;
  }

  .total-section {
    padding: 16px;
    margin-bottom: 15px;
  }

  .total-value {
    font-size: 28px;
  }

  .user-details-section {
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
  }

  .user-details-section .table-container,
  .user-details-section .kpi-table-container {
    margin: 15px 0;
    border-radius: 0;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 12px !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
  }

  .kpi-table-container .kpi-table,
  .table-container .kpi-table {
    width: 100%;
    table-layout: auto;
    display: table;
    min-width: max-content;
  }

  .user-selector {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 12px;
  }

  .user-selector label {
    margin-right: 0;
    margin-bottom: 0;
    display: block;
  }

  .user-selector select {
    width: 100%;
    min-width: unset;
  }

  .detail-btn,
  .detail-btn-2 {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }

  .placeholder-content {
    padding: 20px 12px;
    margin: 8px;
  }

  .placeholder-content h2 {
    font-size: 18px;
  }

  .placeholder-content p {
    font-size: 13px;
  }

  .footer {
    padding: 10px 8px;
  }

  .daily-report {
    max-width: 100%;
  }

  .report-date {
    font-size: 10px;
    margin-bottom: 4px;
  }

  .report-message {
    font-size: 11px;
    padding: 0 8px;
    line-height: 1.4;
  }

  .report-message::before,
  .report-message::after {
    display: none;
  }
}

/* Phone landscape mode - better readability */
@media (max-height: 500px) and (orientation: landscape) {
  .footer {
    padding: 8px 16px;
  }

  .daily-report {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }

  .report-date {
    font-size: 12px;
    margin-bottom: 0;
    white-space: nowrap;
  }

  .report-message {
    font-size: 13px;
    padding: 0;
    line-height: 1.3;
  }

  .report-message::before,
  .report-message::after {
    display: none;
  }

  /* All nav landscape mode */
  .super-nav,
  .admin-nav,
  .elevated-nav,
  .nav-buttons {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 8px;
    margin-bottom: 10px;
  }

  .super-nav .nav-btn,
  .admin-nav .nav-btn,
  .elevated-nav .nav-btn,
  .nav-buttons .nav-btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 11px;
    min-width: 0;
    white-space: nowrap;
  }

  /* Total section landscape mode */
  .total-section {
    padding: 12px 16px;
    margin-bottom: 12px;
    border-radius: 10px;
  }

  #manager-tt-view .total-section,
  #user-content .total-section,
  #manager-view .total-section {
    flex-direction: row;
    gap: 10px;
    margin-bottom: 12px;
  }

  #manager-tt-view .total-section .metrics-card,
  #user-content .total-section .metrics-card,
  #manager-view .total-section .metrics-card {
    min-width: 0;
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
  }

  .total-label {
    font-size: 10px;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
  }

  .total-value {
    font-size: 14px;
  }

  .label-subtext {
    font-size: 8px;
  }

  .total-value .label-subtext {
    font-size: 9px;
  }

  .metric-card {
    padding: 8px !important;
  }

  .metric-card .total-label[style*="margin-top"] {
    margin-top: 8px !important;
  }

  /* Chat landscape mode - optimized for horizontal space */
  .chat-widget {
    right: 10px;
    bottom: 10px;
  }

  .chat-toggle {
    width: 44px;
    height: 44px;
  }

  .chat-window {
    position: fixed;
    top: 5px;
    left: 50%;
    right: 5px;
    bottom: 5px;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
    min-height: unset;
    border-radius: 12px;
  }

  .chat-header {
    padding: 10px 14px;
  }

  .chat-close {
    width: 32px;
    height: 32px;
    font-size: 24px;
  }

  .chat-messages {
    padding: 10px;
  }

  .chat-input-container {
    padding: 8px 10px;
  }

  .chat-input {
    font-size: 14px;
    padding: 10px 12px;
  }

  .message {
    font-size: 13px;
    padding: 8px 10px;
  }
}

@media (max-width: 480px) {
  .table-container:last-child,
  .kpi-table-container:last-child {
    margin-bottom: 100px;
  }

  /* Chat fullscreen on mobile */
  .chat-widget {
    right: 10px;
    bottom: 80px;
  }

  .chat-toggle {
    width: 48px;
    height: 48px;
    border-radius: 24px;
  }

  .chat-toggle svg {
    width: 20px;
    height: 20px;
  }

  .chat-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    min-height: unset;
    border-radius: 0;
    z-index: 10001;
  }

  .chat-header {
    padding: 16px;
    border-radius: 0;
  }

  .chat-close {
    width: 40px;
    height: 40px;
    font-size: 32px;
  }

  .chat-input-container {
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .chat-messages {
    padding: 12px;
  }

  .message {
    max-width: 85%;
    padding: 10px 12px;
    font-size: 14px;
  }

  .chat-input {
    font-size: 16px;
    padding: 12px;
  }
}
/* Tablet landscape and desktop below 1400px */
@media (min-width: 768px) and (max-width: 1024px) {
  .container {
    max-width: 100%;
    padding: 12px;
  }

  .header {
    gap: 12px;
    padding: 16px 12px;
    margin-bottom: 20px;
  }

  .header-logo {
    height: 60px;
    max-width: 160px;
  }

  .logo-text {
    font-size: 1.3rem;
  }

  .table-container,
  .kpi-table-container {
    padding: 16px;
    margin-bottom: 20px;
  }

  .kpi-table th,
  .kpi-table td {
    padding: 12px 10px;
    font-size: 13px;
    min-width: 100px;
  }

  .kpi-table th:first-child,
  .kpi-table td:first-child {
    min-width: 110px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
  }
}

/* Phablet and small phones */
@media (max-width: 480px) {
  html,
  body {
    overflow-x: hidden;
    position: relative;
    width: 100%;
  }

  .container {
    max-width: 100%;
    padding: 4px;
    min-height: 100vh;
  }

  .header {
    flex-direction: column !important;
    align-items: center !important;
    padding: 12px 8px;
    gap: 8px;
    margin-bottom: 10px;
  }

  .logo {
    font-size: 16px;
  }

  .logo-text {
    font-size: 1rem;
    text-align: center;
    order: 2;
  }

  .header-logo {
    height: 50px;
    max-width: 120px;
    order: 1;
  }

  /* All nav responsive - 480px */
  .super-nav,
  .admin-nav,
  .elevated-nav,
  .nav-buttons {
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    margin-bottom: 12px;
    border-radius: 10px;
  }

  .super-nav .nav-btn,
  .admin-nav .nav-btn,
  .elevated-nav .nav-btn,
  .nav-buttons .nav-btn {
    width: 100%;
    padding: 10px 12px;
    font-size: 12px;
    text-align: center;
    border-radius: 8px;
  }

  /* Total section responsive - 480px */
  .total-section {
    padding: 16px;
    margin-bottom: 16px;
    border-radius: 12px;
  }

  #manager-tt-view .total-section,
  #user-content .total-section,
  #manager-view .total-section {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }

  #manager-tt-view .total-section .metrics-card,
  #user-content .total-section .metrics-card,
  #manager-view .total-section .metrics-card {
    min-width: unset;
    width: 100%;
    padding: 16px;
    border-radius: 12px;
  }

  .total-label {
    font-size: 11px;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    flex-direction: column;
    gap: 4px;
  }

  .total-value {
    font-size: 16px;
    flex-direction: column;
    gap: 4px;
  }

  .label-subtext {
    font-size: 9px;
  }

  .total-value .label-subtext {
    font-size: 10px;
  }

  /* CRITICAL: Ensure scroll works on all rows */
  .table-container,
  .kpi-table-container {
    padding: 4px;
    margin: 4px 0;
    border-radius: 8px;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    background: white;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    clear: both;
    scroll-behavior: smooth;
    touch-action: manipulation;
  }

  .table-container:last-child,
  .kpi-table-container:last-child {
    margin-bottom: 80px;
  }

  /* Mobile table styling */
  .kpi-table {
    width: 100%;
    table-layout: auto;
    display: table;
    min-width: max-content;
  }

  .table-container .kpi-table,
  .kpi-table-container .kpi-table {
    width: 100% !important;
    table-layout: auto !important;
    display: table !important;
    min-width: max-content !important;
    overflow: visible !important;
  }

  .kpi-table th,
  .kpi-table td {
    padding: 6px 4px !important;
    font-size: 11px;
    min-width: 70px !important;
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
  }

  .kpi-table th:first-child,
  .kpi-table td:first-child {
    min-width: 70px !important;
    position: sticky;
    left: 0;
    z-index: 2;
    padding: 6px 4px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
  }

  .kpi-table th:first-child {
    background: #f8f9fa;
    z-index: 3;
  }

  .kpi-table td:first-child {
    background: white;
    font-size: 10px;
    font-weight: 700;
  }

  /* Detail rows on small screens */
  .detail-row td,
  .detail-row td:first-child {
    font-size: 10px !important;
    font-weight: 400;
  }

  .detail-row.route-row td:first-child {
    padding-left: 1.2em !important;
  }

  .detail-row.client-row td:first-child {
    padding-left: 2.2em !important;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    max-width: 120px;
  }

  .detail-row.product-row td:first-child {
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    max-width: 100px;
  }

  .detail-row.bill-row td:first-child {
    padding-left: 3.2em !important;
    font-size: 10px !important;
  }

  .metrics-section {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 4px;
    margin: 4px;
  }

  .user-details-section {
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
  }

  .user-details-section .table-container,
  .user-details-section .kpi-table-container {
    margin: 12px 0;
    border-radius: 0;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 4px;
  }

  .user-selector {
    margin-bottom: 15px;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
  }

  .user-selector label {
    margin-right: 0;
    margin-bottom: 0;
    display: block;
  }

  .user-selector select {
    width: 100%;
    min-width: unset;
  }

  .metric-card {
    padding: 8px;
    margin: 0;
    width: 100%;
  }

  .metric-label {
    font-size: 0.75em;
    margin-bottom: 3px;
  }

  .metric-value {
    font-size: 1.2em;
    margin: 3px 0;
  }

  .metric-target {
    font-size: 0.65em;
  }

  .total-section {
    padding: 12px 4px;
    margin-bottom: 10px;
  }

  .total-value {
    font-size: 22px;
  }

  .content {
    min-height: calc(100vh - 140px);
    padding-bottom: 60px;
  }

  .detail-btn,
  .detail-btn-2 {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }

  .placeholder-content {
    padding: 12px 8px;
    margin: 4px;
  }

  .placeholder-content h2 {
    font-size: 14px;
  }

  .placeholder-content p {
    font-size: 11px;
  }

  .footer {
    padding: 6px 4px;
  }

  .report-date {
    font-size: 8px;
    margin-bottom: 2px;
  }

  .report-message {
    font-size: 9px;
    padding: 0 2px;
    line-height: 1.3;
  }

  .nav-buttons {
    width: 100%;
    gap: 4px;
  }

  .nav-btn {
    flex: 1;
    min-width: 0;
    padding: 6px;
    font-size: 10px;
  }
}

/* Very small phones - extra adjustments */
@media (max-width: 400px) {
  html,
  body {
    overflow-x: hidden;
    position: relative;
    width: 100%;
  }

  .header {
    padding: 8px 6px;
    gap: 6px;
  }

  .header-logo {
    height: 40px;
    max-width: 100px;
  }

  .logo-text {
    font-size: 0.85rem;
    text-align: center;
  }

  /* Total section responsive - 400px */
  .total-section {
    padding: 12px;
    margin-bottom: 12px;
    border-radius: 10px;
  }

  #manager-tt-view .total-section,
  #user-content .total-section,
  #manager-view .total-section {
    gap: 8px;
    margin-bottom: 12px;
  }

  #manager-tt-view .total-section .metrics-card,
  #user-content .total-section .metrics-card,
  #manager-view .total-section .metrics-card {
    padding: 12px;
    border-radius: 10px;
  }

  .total-label {
    font-size: 9px;
    letter-spacing: 0;
    margin-bottom: 4px;
  }

  .total-value {
    font-size: 14px;
  }

  .label-subtext {
    font-size: 7px;
  }

  .total-value .label-subtext {
    font-size: 8px;
  }

  .user-details-section {
    margin: 0;
    padding: 0;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
  }

  .user-details-section .table-container,
  .user-details-section .kpi-table-container {
    margin: 8px 0;
    border-radius: 0;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    padding: 2px;
  }

  .user-selector {
    margin-bottom: 12px;
    padding: 0 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .user-selector label {
    margin-right: 0;
    margin-bottom: 0;
    display: block;
  }

  .user-selector select {
    width: 100%;
    min-width: unset;
  }

  .table-container,
  .kpi-table-container {
    padding: 2px;
    margin: 2px 0;
    border-radius: 6px;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    display: block !important;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    clear: both;
    scroll-behavior: smooth;
    touch-action: manipulation;
    background: white;
  }

  .table-container .kpi-table,
  .kpi-table-container .kpi-table {
    width: 100% !important;
    table-layout: auto !important;
    display: table !important;
    min-width: max-content !important;
    overflow: visible !important;
  }

  .kpi-table th,
  .kpi-table td {
    padding: 4px 2px !important;
    font-size: 10px;
    min-width: 60px !important;
  }

  .kpi-table th:first-child,
  .kpi2-table td:first-child,
  .user-kpi-table th:first-child,
  .user-kpi-table td:first-child {
    padding-left: 4px !important;
    min-width: 50px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
  }

  .detail-row.route-row td:first-child {
    padding-left: 0.8em !important;
  }

  .detail-row.client-row td:first-child {
    padding-left: 1.6em !important;
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    max-width: 100px;
  }

  .detail-row.product-row td:first-child {
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
    max-width: 80px;
  }

  .detail-row.bill-row td:first-child {
    padding-left: 2.4em !important;
  }

  .detail-row td,
  .detail-row td:first-child {
    font-size: 9px !important;
    font-weight: 400;
  }

  /* Ajustare pentru rândurile expandabile */
  .trasee-row td:first-child {
    padding-left: 8px !important;
  }

  .clienti-row td:first-child {
    padding-left: 12px !important;
  }

  .facturi-row td:first-child {
    padding-left: 16px !important;
  }
/* 
  .total-section {
    padding: 15px;
  }

  .total-label {
    font-size: 34px !important;
  }

  .total-value {
    font-size: 28px;
  } */

  .nav-btn {
    padding: 8px;
    font-size: 12px;
  }

  .table-title {
    font-size: 1.2em;
    margin-bottom: 0.5em;
  }
}

/* Stiluri pentru aliniere tabel KPI și KPI2 */
.kpi-table th,
.kpi2-table th,
.kpi-table td,
.kpi2-table td {
  padding: 16px;
}

/* Prima coloană (denumiri) aliniată la stânga */
.kpi-table th:first-child,
.kpi2-table th:first-child,
.kpi-table td:first-child,
.kpi2-table td:first-child {
  text-align: left;
  padding-left: 24px;
}

/* Toate celulele numerice aliniate la dreapta */
.kpi-table td:not(:first-child),
.kpi2-table td:not(:first-child),
.kpi-table th:not(:first-child),
.kpi2-table th:not(:first-child) {
  text-align: right;
  padding-right: 24px;
}

/* Stiluri pentru procentaje */
.percent-green,
.percent-yellow,
.percent-red {
  text-align: right;
  padding-right: 24px;
}

/* Păstrează indentarea pentru rândurile expandabile */
.trasee-row td:first-child {
  padding-left: 48px !important;
}

.clienti-row td:first-child {
  padding-left: 72px !important;
}

/* ========== ADMIN FORM & TABLE STYLING ========== */

/* Collapsible Form Container */
.collapsible-form {
  margin-bottom: 30px;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  background-color: #f8f9fa;
  overflow: visible;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Form Toggle Header */
.form-toggle {
  padding: 18px 24px;
  margin: 0;
  cursor: pointer;
  border-bottom: 1px solid #e9ecef;
  background-color: #f1f3f5;
  user-select: none;
  font-weight: 600;
  font-size: 16px;
  color: #091c3a;
  transition: all 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.form-toggle:hover {
  background-color: #e9ecef;
}

.form-toggle::after {
  content: '▼';
  display: inline-block;
  transition: transform 0.3s ease;
  margin-left: 12px;
}

.form-toggle.collapsed::after {
  transform: rotate(180deg);
}

/* Collapsible Form Content */
.collapsible-content {
  padding: 0;
  margin: 0;
  max-height: 0;
  transition: max-height 0.4s ease-out, padding 0.4s ease-out, opacity 0.3s ease-in-out;
  overflow: hidden;
  background-color: white;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  align-items: start;
  align-content: start;
  row-gap: 16px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
}

.collapsible-content.expanded {
  max-height: 30000px;
  padding: 24px;
  opacity: 1;
  visibility: visible;
}

/* Ensure all children are visible when expanded, even if display:none */
.collapsible-content.expanded > div[style*="display: none"] {
  display: block !important;
}

/* Form Labels and Inputs */
.collapsible-content label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #091c3a;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.collapsible-content input[type="text"],
.collapsible-content input[type="email"],
.collapsible-content input[type="number"],
.collapsible-content input[type="password"],
.collapsible-content input[type="file"],
.collapsible-content select,
.collapsible-content textarea {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 24px;
  border: 1.5px solid #dee2e6;
  border-radius: 6px;
  box-sizing: border-box;
  background-color: #fff;
  font-size: 15px;
  color: #495057;
  transition: all 0.3s ease;
  font-family: inherit;
}

.collapsible-content input[type="text"]:focus,
.collapsible-content input[type="email"]:focus,
.collapsible-content input[type="number"]:focus,
.collapsible-content input[type="password"]:focus,
.collapsible-content select:focus,
.collapsible-content textarea:focus {
  outline: none;
  border-color: #091c3a;
  box-shadow: 0 0 0 3px rgba(9, 28, 58, 0.1);
  background-color: #f8f9fa;
}

.collapsible-content select {
  appearance: none;
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23091c3a%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 0.65em;
  padding-right: 36px;
}

/* Form Button Group */
.form-button-group {
  grid-column: 1 / -1;
  display: flex;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.collapsible-content button[type="submit"],
.collapsible-content button[type="button"] {
  background-color: #091c3a;
  color: white;
  padding: 12px 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s ease;
  flex: 1;
  min-width: 150px;
}

.collapsible-content button[type="submit"]:hover,
.collapsible-content button[type="button"]:hover {
  background-color: #0a2851;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(9, 28, 58, 0.2);
}

.collapsible-content button[type="submit"]:active,
.collapsible-content button[type="button"]:active {
  transform: translateY(0);
}

/* CSV Upload Section */
.csv-upload-label {
  grid-column: 1 / -1;
  margin-top: 12px;
  padding-top: 20px;
  border-top: 2px solid #e9ecef;
  color: #091c3a;
  font-weight: 600;
  font-size: 14px;
}

.csv-upload-input {
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  position: absolute;
  z-index: -1;
}

.file-upload-btn {
  display: inline-block;
  padding: 12px 20px;
  cursor: pointer;
  background-color: #e9ecef;
  color: #091c3a;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
  text-align: center;
}

.file-upload-btn:hover {
  background-color: #dee2e6;
  border-color: #091c3a;
}

.csv-btn {
  background-color: #28a745;
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  margin-right: 10px;
  margin-bottom: 0;
  transition: all 0.3s ease;
}

.csv-btn:hover {
  background-color: #218838;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.2);
}

/* Bulk actions bar */
.bulk-actions-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  border-radius: 8px 8px 0 0;
  margin-top: 10px;
}

/* CSV Schema button in bulk-actions-bar - CRM dark blue style */
.bulk-actions-bar .csv-btn {
  background-color: #091c3a;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.bulk-actions-bar .csv-btn:hover {
  background-color: #0a2851;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(9, 28, 58, 0.3);
}

/* Delete button in bulk-actions-bar */
.bulk-actions-bar .delete-btn {
  background-color: #c0392b;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.bulk-actions-bar .delete-btn:hover:not(:disabled) {
  background-color: #a93226;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(192, 57, 43, 0.3);
}

.bulk-actions-bar .delete-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Checkbox column in tables */
.checkbox-col {
  width: 50px;
  min-width: 50px;
  max-width: 50px;
  text-align: center;
  padding: 12px 8px !important;
  background-color: #f8f9fa;
}

/* Header checkbox - select all */
.checkbox-col input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #091c3a;
  border: 2px solid #c5cdd8;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.checkbox-col input[type="checkbox"]:hover {
  border-color: #091c3a;
}

/* Row checkbox cells */
td.row-checkbox {
  text-align: center;
  padding: 12px 8px !important;
  vertical-align: middle;
}

/* Custom checkbox styling - CRM design */
td.row-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #091c3a;
  border: 2px solid #c5cdd8;
  border-radius: 4px;
  transition: all 0.2s ease;
}

td.row-checkbox input[type="checkbox"]:hover {
  border-color: #091c3a;
}

td.row-checkbox input[type="checkbox"]:checked {
  background-color: #091c3a;
  border-color: #091c3a;
}

/* Selected row highlight */
tr.selected {
  background-color: rgba(9, 28, 58, 0.06) !important;
}

tr.selected:hover {
  background-color: rgba(9, 28, 58, 0.10) !important;
}

/* Collapsible Table Container */
.collapsible-table {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  background-color: #f8f9fa;
  overflow: hidden;
  margin-bottom: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* Table Toggle Header */
.table-toggle {
  padding: 18px 24px;
  margin: 0;
  cursor: pointer;
  border-bottom: 1px solid #e9ecef;
  background-color: #f1f3f5;
  user-select: none;
  font-weight: 600;
  font-size: 16px;
  color: #091c3a;
  transition: all 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.table-toggle:hover {
  background-color: #e9ecef;
}

.table-toggle::after {
  content: '▼';
  display: inline-block;
  transition: transform 0.3s ease;
  margin-left: 12px;
}

.table-toggle.collapsed::after {
  transform: rotate(180deg);
}

/* Table Wrapper */
.table-wrapper {
  padding: 0;
  max-height: 0;
  transition: max-height 0.4s ease-out, padding 0.4s ease-out, opacity 0.3s ease-in-out;
  overflow: hidden;
  opacity: 0;
  background-color: white;
  box-sizing: border-box;
  visibility: hidden;
}

.table-wrapper.expanded {
  padding: 20px 0 30px;
  max-height: 10000px;
  opacity: 1;
  visibility: visible;
}

/* Make admin tables horizontally scrollable on their own */
.table-wrapper > table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Admin Table Styling */
.admin-main-container table {
  width: 100%;
  border-collapse: collapse;
  background-color: white;
  font-size: 15px;
}

.admin-main-container table thead {
  background-color: #f8f9fa;
  border-bottom: 2px solid #e9ecef;
}

.admin-main-container table th,
.admin-main-container table td {
  padding: 16px 14px;
  text-align: left;
  color: #495057;
  border-bottom: 1px solid #e9ecef;
}

.admin-main-container table th {
  background-color: #f8f9fa;
  font-weight: 700;
  color: #091c3a;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-main-container table tbody tr {
  transition: background-color 0.2s ease;
}

.admin-main-container table tbody tr:hover {
  background-color: #f8f9fb;
}

.admin-main-container table tbody tr:nth-child(even) {
  background-color: #fafbfc;
}

/* Filter Row Styling */
.filter-row {
  background-color: #ecf0f1;
  border-bottom: 1px solid #e9ecef;
}

.filter-row td {
  padding: 12px 14px;
}

.filter-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #dee2e6;
  border-radius: 6px;
  box-sizing: border-box;
  font-size: 14px;
  color: #495057;
  transition: all 0.3s ease;
  background-color: white;
}

.filter-input:focus {
  outline: none;
  border-color: #091c3a;
  box-shadow: 0 0 0 3px rgba(9, 28, 58, 0.1);
}

/* ==================== Global Action Buttons ==================== */
/* These button styles work across all contexts in the CRM */

/* Base action button styles */
.delete-btn,
.save-btn,
.cancel-btn {
  padding: 8px 16px;
  margin-right: 8px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  vertical-align: middle;
}

.delete-btn:last-child,
.save-btn:last-child,
.cancel-btn:last-child {
  margin-right: 0;
}

/* Save Button - CRM Primary Blue */
.save-btn {
  background-color: #091c3a;
  color: white;
}

.save-btn:hover {
  background-color: #0d2a52;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(9, 28, 58, 0.4);
}

.save-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(9, 28, 58, 0.3);
}

/* Cancel Button - Outline style for visibility */
.cancel-btn {
  background-color: white;
  color: #091c3a;
  border: 2px solid #c5cdd8;
}

.cancel-btn:hover {
  background-color: #f5f7fa;
  border-color: #091c3a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(9, 28, 58, 0.12);
}

.cancel-btn:active {
  transform: translateY(0);
  background-color: #e9ecef;
}

/* Delete Button - Muted red that fits CRM aesthetic */
.delete-btn {
  background-color: #c0392b;
  color: white;
}

.delete-btn:hover {
  background-color: #a93226;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(192, 57, 43, 0.35);
}

.delete-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(192, 57, 43, 0.25);
}

/* Primary Action Button - Blue (CRM primary color) */
.primary-btn {
  padding: 8px 16px;
  margin-right: 8px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: #091c3a;
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.primary-btn:hover {
  background-color: #0a2851;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(9, 28, 58, 0.3);
}

.primary-btn:active {
  transform: translateY(0);
}

/* Button group container for consistent spacing */
.action-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Smaller buttons variant for tables - stacked vertically */
table .delete-btn,
table .save-btn,
table .cancel-btn {
  padding: 6px 14px;
  font-size: 12px;
  margin: 3px 0;
  width: 100%;
  display: block;
}

/* Action column styling in tables - vertical stack */
table td:last-child:has(.delete-btn),
table td:last-child:has(.save-btn),
table td:last-child:has(.cancel-btn) {
  text-align: center;
  min-width: 120px;
  max-width: 140px;
}

/* Disabled state for all action buttons */
.delete-btn:disabled,
.save-btn:disabled,
.cancel-btn:disabled,
.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Contenteditable Cell Styling */
.admin-main-container table [contenteditable="true"] {
  background-color: #fff3cd;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: text;
}

.admin-main-container table [contenteditable="true"]:focus {
  outline: 2px solid #ffc107;
  background-color: #fffacd;
}

/* Pagination Styling */
#user-table-pagination,
#role-table-pagination,
#action-plan-targets-pagination,
#weight-targets-pagination,
#target-params-pagination {
  margin-top: 20px;
  padding: 16px;
  background-color: #f8f9fa;
  border-top: 1px solid #e9ecef;
  border-radius: 0 0 8px 8px;
  text-align: center;
}

.pagination-controls {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.pagination-controls button {
  padding: 8px 12px;
  border: 1.5px solid #dee2e6;
  background-color: white;
  color: #091c3a;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
}

.pagination-controls button:hover:not(:disabled) {
  border-color: #091c3a;
  background-color: #f8f9fa;
}

.pagination-controls button.active {
  background-color: #091c3a;
  color: white;
  border-color: #091c3a;
}

.pagination-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Admin Content H1, H2 Styling */
.admin-main-container h1,
.admin-main-container h2 {
  color: #091c3a;
  margin-top: 0;
  margin-bottom: 20px;
  font-weight: 700;
  font-size: 28px;
}

.admin-main-container h2 {
  font-size: 20px;
  margin-top: 24px;
  margin-bottom: 16px;
}

/* Responsive Admin Tables */
@media (max-width: 768px) {
  .collapsible-content {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }

  .form-button-group {
    grid-column: 1;
  }

  .admin-main-container table {
    font-size: 13px;
  }

  .admin-main-container table th,
  .admin-main-container table td {
    padding: 12px 8px;
  }

  .admin-main-container table button {
    padding: 6px 10px;
    font-size: 12px;
    margin-right: 4px;
    margin-bottom: 4px;
  }

  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .filter-input {
    padding: 8px 10px;
    font-size: 13px;
  }
}

.facturi-row td:first-child {
  padding-left: 96px !important;
}

.kpi-table-container {
  margin-bottom: 30px;  /* Adds space between containers */
  background: white;
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow-x: auto !important;
  overflow-y: visible !important;
  -webkit-overflow-scrolling: touch;
  width: 100% !important;
  max-width: none;
  position: relative;
  z-index: 1;
  clear: both;
  scroll-behavior: smooth;
  touch-action: manipulation;
  display: block !important;
  box-sizing: border-box;
}

/* Style for the container headings */
.kpi-table-container h2 {
  font-size: 1.5em;
  color: #091c3a;
  margin-bottom: 1em;
  font-weight: 600;
  position: sticky;
  left: 0;
  top: 0;
  z-index: 10;
  background: white;
  padding: 0;
  width: 100%;
}

.kpi-table-container table {
  min-width: 100%;
  width: 100%;
}

/* Add more space before the last container to account for footer */
.kpi-table-container:last-child {
  margin-bottom: 120px;
}

/* IKA KPI Tables Containers - Ensure proper overflow handling */
#developer-ika-kpi-tables-container,
#zonal-ika-kpi-tables-container,
#super-developer-ika-kpi-tables-container {
  width: 100% !important;
  max-width: none !important;
  overflow: visible !important;
  position: relative;
  z-index: 1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .kpi-table-container {
    margin-bottom: 20px;
    padding: 16px;
  }
  
  .kpi-table-container:last-child {
    margin-bottom: 100px;
  }
}

/* User Form Layout */
#additional-user-fields {
  display: none !important;
  grid-column: 1 / -1;
}

#additional-user-fields.visible {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

#new-user-select {
  grid-column: 1 / -1;
}

/* CRITICAL FIXES FOR MOBILE RESPONSIVENESS AND SCROLL */

/* Ensure all detail rows inherit table-row display and scroll properly */
.detail-row {
  display: table-row !important;
  transition: background-color 0.2s ease;
}

.kpi-table tbody tr {
  display: table-row !important;
}

/* Ensure table container allows horizontal scroll on ALL rows */
.table-container .kpi-table {
  display: table !important;
  width: 100% !important;
  table-layout: auto !important;
}

/* Override any inline background colors to ensure consistency */
.detail-row.route-row {
  background-color: #fafafa !important;
}

.detail-row.client-row {
  background-color: #f5f5f5 !important;
}

.detail-row.bill-row {
  background-color: #f0f0f0 !important;
}

.detail-row.product-row {
  background-color: #f8f9fa !important;
}

/* Ensure cursor is pointer for expandable rows */
.detail-row.expandable-detail-row {
  cursor: pointer !important;
}

.detail-row.expandable-detail-row:hover {
  background-color: rgba(9, 28, 58, 0.05) !important;
}

/* Fix padding for hierarchical indentation */
.detail-row td:first-child {
  position: relative;
  text-align: left;
}

.detail-row.route-row td:first-child {
  padding-left: 2em !important;
}

.detail-row.client-row td:first-child {
  padding-left: 4em !important;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  max-width: 200px;
}

.detail-row.bill-row td:first-child {
  padding-left: 6em !important;
}

.detail-row.product-row td:first-child {
  padding-left: 6em !important;
  word-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  max-width: 180px;
}

/* Sticky first column for all rows */
.kpi-table td:first-child,
.kpi-table th:first-child {
  position: sticky !important;
  left: 0 !important;
  z-index: 2 !important;
}

.kpi-table th:first-child {
  z-index: 3 !important;
}

/* Ensure proper scroll behavior on touch devices */
.table-container {
  -webkit-overflow-scrolling: touch !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
}

/* Mobile-specific fixes */
@media (max-width: 768px) {
  /* Ensure table rows maintain proper display on mobile */
  .kpi-table tbody tr,
  .detail-row {
    display: table-row !important;
  }

  /* Force minimum width to trigger horizontal scroll */
  .kpi-table {
    min-width: max-content !important;
  }

  .kpi-table th,
  .kpi-table td {
    min-width: 80px !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
  }

  /* Allow text wrapping for client and product names on mobile */
  .detail-row.client-row td:first-child,
  .detail-row.product-row td:first-child {
    white-space: normal !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
    max-width: 150px !important;
  }

  /* Reduce indentation padding on mobile */
  .detail-row.route-row td:first-child {
    padding-left: 1.5em !important;
  }

  .detail-row.client-row td:first-child {
    padding-left: 3em !important;
  }
}

/* ============ RESPONSIVE FONT SIZES ============ */

/* Large screens (>1440px) - Larger text */
@media (min-width: 1441px) {
  .kpi-table th,
  .kpi-table td {
    font-size: 14px;
    padding: 14px 18px;
  }

  .kpi-table th {
    font-size: 12px;
  }

  .metric-value {
    font-size: 1.1em;
  }

  .metric-label {
    font-size: 1.05em;
  }

  .metric-target {
    font-size: 0.95em;
  }
}

/* Medium screens (1024px - 1440px) - Normal text */
@media (min-width: 1024px) and (max-width: 1440px) {
  .kpi-table th,
  .kpi-table td {
    font-size: 13px;
    padding: 12px 16px;
  }

  .kpi-table th {
    font-size: 11px;
  }
}

/* Tablets (768px - 1023px) - Slightly reduced text */
@media (min-width: 768px) and (max-width: 1023px) {
  .kpi-table th,
  .kpi-table td {
    font-size: 12px;
    padding: 10px 14px;
  }

  .kpi-table th {
    font-size: 10px;
  }

  .metric-value {
    font-size: 0.95em;
  }

  .metric-label {
    font-size: 0.9em;
  }

  .metric-target {
    font-size: 0.85em;
  }

  /* Adjust card padding on tablets */
  #manager-tt-view .total-section .metrics-card {
    padding: 30px;
  }

  #manager-tt-view .total-section .metric-value {
    font-size: 26px;
  }

  #manager-tt-view .total-section .metric-label {
    font-size: 16px;
  }
}

/* Small screens (480px - 767px) - Reduced text */
@media (min-width: 480px) and (max-width: 767px) {
  .kpi-table th,
  .kpi-table td {
    font-size: 11px;
    padding: 8px 12px;
  }

  .kpi-table th {
    font-size: 9px;
  }

  .metric-value {
    font-size: 0.85em;
  }

  .metric-label {
    font-size: 0.8em;
  }

  .metric-target {
    font-size: 0.75em;
  }

  #manager-tt-view .total-section .metric-value {
    font-size: 20px;
  }

  #manager-tt-view .total-section .metric-label {
    font-size: 12px;
  }
}

/* Extra small screens (<480px) - Minimal text */
@media (max-width: 479px) {
  .kpi-table th,
  .kpi-table td {
    font-size: 10px;
    padding: 6px 10px;
  }

  .kpi-table th {
    font-size: 8px;
  }

  .metric-value {
    font-size: 0.75em;
  }

  .metric-label {
    font-size: 0.7em;
  }

  .metric-target {
    font-size: 0.65em;
  }

  #manager-tt-view .total-section .metric-value {
    font-size: 18px;
  }

  #manager-tt-view .total-section .metric-label {
    font-size: 11px;
  }

  /* Reduce padding on very small screens */
  .kpi-table thead th:first-child,
  .kpi-table tbody td:first-child {
    min-width: 80px !important;
  }
}

/* ==================== Custom Modal Styles (Admin Panel) ==================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(9, 28, 58, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.visible {
    display: flex;
    opacity: 1;
}

.modal {
    background-color: #ffffff;
    padding: 32px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(9, 28, 58, 0.3);
    width: 90%;
    max-width: 450px;
    text-align: center;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-message {
    margin-bottom: 24px;
    font-size: 16px;
    line-height: 1.6;
    color: #091c3a;
    font-weight: 500;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* Modal Button Styles */
.modal-buttons button {
    padding: 12px 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 120px;
}

/* Primary button (OK/Confirm) */
.modal-buttons button:first-child {
    background-color: #091c3a;
    color: white;
}

.modal-buttons button:first-child:hover {
    background-color: #0a2851;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(9, 28, 58, 0.3);
}

/* Secondary button (Cancel) - when there are 2 buttons */
.modal-buttons button:last-child:not(:first-child) {
    background-color: #6c757d;
    color: white;
}

.modal-buttons button:last-child:not(:first-child):hover {
    background-color: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}