/* ========================================
   CSS VARIABLES - TECHNICAL DATA-FIRST DESIGN
   Optimized for data density and clarity
   ======================================== */

:root {
  /* Neutral Palette - 90% of UI */
  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;
  
  /* Accent Colors - 10% of UI (minimal, purposeful) */
  --accent-primary: #2563eb;
  --accent-primary-hover: #1d4ed8;
  --accent-primary-light: rgba(37, 99, 235, 0.1);
  --accent-danger: #dc2626;
  --accent-danger-hover: #b91c1c;
  --accent-success: #16a34a;
  --accent-success-hover: #15803d;
  --accent-warning: #f59e0b;
  
  /* Semantic Mappings */
  --text-primary: var(--neutral-900);
  --text-secondary: var(--neutral-600);
  --text-muted: var(--neutral-400);
  --bg-primary: #ffffff;
  --bg-secondary: var(--neutral-50);
  --bg-tertiary: var(--neutral-100);
  --border-color: var(--neutral-200);
  --border-strong: var(--neutral-300);
  
  /* Shadows - Minimal, functional only */
  --shadow-border: 0 0 0 1px var(--neutral-200);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.06);
  
  /* Spacing - Compact for data density */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 0.75rem;
  --spacing-lg: 1rem;
  --spacing-xl: 1.5rem;
  
  /* Border Radius - Minimal */
  --radius-sm: 2px;
  --radius-md: 4px;
  --radius-lg: 6px;
  
  /* Transitions - Fast, unobtrusive */
  --transition-fast: 0.1s ease;
  --transition-base: 0.15s ease;
  
  /* Typography - Optimized for readability */
  --font-size-xs: 0.6875rem;
  --font-size-sm: 0.8125rem;
  --font-size-base: 0.875rem;
  --font-size-lg: 1rem;
  --font-size-xl: 1.125rem;
  
  /* Z-index layers */
  --z-base: 1;
  --z-dropdown: 1000;
  --z-header: 1030;
  --z-modal: 1060;
  --z-tooltip: 1070;
}

/* Typography - Technical, readable */
body, span {
  font-size: var(--font-size-base);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
  line-height: 1.5;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  padding-bottom: 0;
  overflow-x: hidden;
  background-color: var(--bg-secondary);
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: var(--spacing-md);
}

.font-monospace {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Layout - Compact, data-focused */
#mainContent {
  margin-bottom: var(--spacing-sm);
  margin-top: var(--spacing-sm);
  padding: 0;
}

/* Header - Minimal, functional */
#header {
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  transition: max-height var(--transition-base), opacity var(--transition-base);
}

#header.header-collapsed {
  max-height: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ========================================
   LOGIN FORM - TECHNICAL, MINIMAL
   ======================================== */

#loginForm {
  background-color: var(--bg-secondary);
}

#loginForm .card {
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
  transition: none;
}

/* Login Form Inputs - No animations */
#loginForm .form-control,
#loginForm .form-select {
  border-color: var(--border-color);
  font-size: var(--font-size-base);
}

#loginForm .form-control:focus,
#loginForm .form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-light);
}

/* Login Button - Simple, clear */
#loginButton {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  padding: 0.625rem 1.25rem;
}

#loginButton:hover {
  background-color: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

/* Login Error Alert - No animation */
#loginError {
  font-size: var(--font-size-sm);
}

/* ========================================
   HEADER TOGGLE BUTTON - MINIMAL
   ======================================== */

#headerToggle {
  cursor: pointer;
  user-select: none;
  transition: background-color var(--transition-fast);
}

/* Application shell layout - Optimized for data */
#workspace {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  width: 100%;
  background-color: var(--bg-secondary);
  transition: grid-template-columns var(--transition-base);
}

body.sidebar-collapsed #workspace {
  grid-template-columns: 60px 1fr;
}

.workspace-main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  grid-column: 2;
  grid-row: 1 / span 3;
}

.workspace-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}

.workspace-content {
  min-height: 0;
  background-color: var(--bg-primary);
  overflow: hidden;
}

.workspace-footer {
  position: sticky;
  bottom: 0;
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-color);
  z-index: var(--z-header);
  padding: var(--spacing-sm) 0;
}

/* Main content - Compact */
#mainContent {
  padding: var(--spacing-md);
  min-height: 50vh;
}

#app {
  height: 100%;
  overflow: auto;
  padding: var(--spacing-md);
  margin-left: 0;
  width: 100%;
  min-height: 0;
}

.workspace-footer .row {
  margin: 0;
}

.workspace-footer .row > * {
  padding-left: var(--spacing-md);
  padding-right: var(--spacing-md);
}

#footer .btn-group {
  border-radius: var(--radius-sm);
}

#footer .btn-group label {
  border-radius: 0;
  margin: 0;
  font-size: var(--font-size-xs);
  padding: 0.25rem 0.5rem;
}

#footer .btn-group .btn {
  box-shadow: none;
  border-radius: 0;
  font-size: var(--font-size-xs);
}

#footer .btn-group .btn:first-child {
  border-top-left-radius: var(--radius-sm);
  border-bottom-left-radius: var(--radius-sm);
}

#footer .btn-group .btn:last-child {
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

/* Footer buttons visibility */
#footer .btn,
.workspace-footer .btn {
  border: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

#footer .btn:hover,
.workspace-footer .btn:hover {
  background-color: var(--bg-secondary);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

#footer .btn-primary,
.workspace-footer .btn-primary {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

#footer .btn-primary:hover,
.workspace-footer .btn-primary:hover {
  background-color: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

/* ========================================
   SIDEBAR NAVIGATION - MINIMAL, FUNCTIONAL
   ======================================== */

.app-sidebar {
  width: 200px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: var(--z-header);
  transition: width var(--transition-base);
  border-right: 1px solid var(--border-color);
  background-color: var(--bg-primary);
  grid-row: 1 / span 3;
}

.app-sidebar.collapsed {
  width: 60px;
}

.app-sidebar.collapsed .sidebar-module-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.app-sidebar.collapsed .sidebar-module {
  justify-content: center;
  padding: 0.875rem;
}

.app-sidebar.collapsed .sidebar-module i {
  margin-right: 0;
}

.app-sidebar.collapsed .sidebar-logo img {
  max-width: 40px;
}

/* Sidebar Logo */
.sidebar-logo {
  padding: var(--spacing-lg);
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.app-sidebar.collapsed .sidebar-logo {
  padding: var(--spacing-md) var(--spacing-sm);
}

.sidebar-logo img {
  max-width: 100%;
  height: auto;
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--spacing-sm) 0;
}

.sidebar-footer {
  padding: var(--spacing-sm) 0;
  border-top: 1px solid var(--border-color);
}

.sidebar-logout {
  color: var(--accent-danger);
}

.sidebar-logout i {
  color: var(--accent-danger);
}

.sidebar-logout:hover {
  background-color: rgba(220, 38, 38, 0.05);
}

/* Sidebar Module Buttons - Minimal design */
.sidebar-module {
  width: 100%;
  padding: var(--spacing-md) var(--spacing-lg);
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-weight: 400;
  font-size: var(--font-size-base);
  text-align: left;
  color: var(--text-secondary);
}

.sidebar-module i {
  width: 18px;
  text-align: center;
  font-size: 1.125rem;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.sidebar-module-text {
  white-space: nowrap;
  transition: opacity var(--transition-base);
  flex: 1;
}

.sidebar-module:hover {
  background-color: var(--bg-secondary);
}

.sidebar-module.active {
  background-color: var(--accent-primary-light);
  border-left-color: var(--accent-primary);
  color: var(--accent-primary);
}

.sidebar-module.active i {
  color: var(--accent-primary);
}

.sidebar-module:focus {
  outline: 2px solid var(--accent-primary-light);
  outline-offset: -2px;
}

/* Top Bar - Compact, functional */
.top-bar {
  display: flex;
  gap: var(--spacing-md);
  align-items: center;
  flex-wrap: wrap;
  padding: var(--spacing-sm) var(--spacing-lg);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border-color);
}

body.sidebar-collapsed .top-bar {
  padding-left: var(--spacing-md);
  padding-right: var(--spacing-md);
}

.top-bar > .nav {
  margin-bottom: 0;
}

#contextualControls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Mobile Menu Toggle - Structural styles only */
.mobile-menu-toggle {
  border: none;
  padding: 0.5rem;
  cursor: pointer;
  margin-right: 1rem;
  border-radius: 50%;
  transition: all 0.2s ease;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu-toggle .menu-bar {
  display: block;
  width: 22px;
  height: 2px;
  background-color: currentColor;
  position: relative;
  transition: transform 0.2s ease;
}

.mobile-menu-toggle .menu-bar::before,
.mobile-menu-toggle .menu-bar::after {
  content: '';
  position: absolute;
  left: 0;
  width: 22px;
  height: 2px;
  background-color: currentColor;
  transition: transform 0.2s ease;
}

.mobile-menu-toggle .menu-bar::before {
  top: -6px;
}

.mobile-menu-toggle .menu-bar::after {
  top: 6px;
}

.mobile-menu-toggle.open .menu-bar {
  background-color: transparent;
}

.mobile-menu-toggle.open .menu-bar::before {
  transform: translateY(6px) rotate(45deg);
}

.mobile-menu-toggle.open .menu-bar::after {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Responsiveness */
@media (max-width: 767px) {
  #workspace {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    transform: translateX(-100%);
    width: 260px;
    max-width: 85vw;
    height: 100vh;
    transition: transform 0.3s ease;
    grid-row: auto;
  }
  
  .app-sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .workspace-main {
    min-height: 100vh;
    grid-column: 1;
    grid-row: 1 / span 3;
  }
  
  /* Backdrop for mobile */
  .sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1020;
    pointer-events: none;
  }
  
  .sidebar-backdrop.show {
    display: block;
    pointer-events: auto;
  }
}

/* ========================================
   ENHANCED BUTTON STYLING
   Modern gradients with smooth animations
   ======================================== */
.btn {
  font-weight: 500;
  letter-spacing: 0.3px;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-color) 0%, #2d9e17 100%);
  border: none;
  color: white;
}

.btn-success:hover {
  background: linear-gradient(135deg, #2d9e17 0%, #247a12 100%);
  border: none;
  color: white;
}

.btn-primary {
  background-color: var(--accent-primary);
  border: 1px solid var(--accent-primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--accent-primary-hover);
  border-color: var(--accent-primary-hover);
}

.btn-primary:focus {
  box-shadow: 0 0 0 2px var(--accent-primary-light);
}

/* Outline buttons */
.btn-outline-primary {
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  background: transparent;
}

.btn-outline-primary:hover {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

.btn-outline-danger {
  border: 1px solid var(--accent-danger);
  color: var(--accent-danger);
  background: transparent;
}

.btn-outline-danger:hover {
  background-color: var(--accent-danger);
  border-color: var(--accent-danger);
  color: white;
}

/* Button sizing */
.btn-sm {
  padding: 0.25rem 0.625rem;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

.btn {
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

/* ========================================
   FORM CONTROLS - CLEAN, FUNCTIONAL
   ======================================== */
.form-control, .form-select {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  background: var(--bg-primary);
  font-size: var(--font-size-sm);
  padding: 0.375rem 0.625rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-light);
  outline: none;
  outline: none;
  background: white;
}

.form-control::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
  font-style: italic;
}

.form-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
  font-size: var(--font-size-sm);
  letter-spacing: 0.3px;
}

/* Enhanced search input */
#searchItems {
  border-radius: var(--radius-full);
  padding-left: 2.5rem;
  background: white url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%23446e9b" class="bi bi-search" viewBox="0 0 16 16"><path d="M11.742 10.344a6.5 6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 5.5 0 1 1-11 0 5.5 5.5 5.5 0 0 1-11 0z"/></svg>') no-repeat;
  background-position: 0.875rem center;
  padding-right: 1rem;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

#searchItems:focus {
  padding-left: 2.5rem;
  box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-md);
}

/* ========================================
   MODERN CARD SYSTEM
   Cards with elevation and depth
   ======================================== */
.card {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
  background: var(--bg-primary);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  border-bottom: 1px solid var(--border-color);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: var(--spacing-lg);
}

/* Content sections */
#itemsContent, #mappingsContent, #errorsContent, 
#convAutoContent, #stockChangesContent {
  background-color: var(--bg-primary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--spacing-md);
}

/* Table styling - Clean, data-focused */
.table {
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  border: 1px solid var(--border-color);
}

.table thead th {
  color: var(--text-primary);
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
  padding: var(--spacing-sm) var(--spacing-md);
  background-color: var(--bg-secondary);
}

.table tbody td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--border-color);
}

.table-striped tbody tr:nth-of-type(odd) {
  background-color: var(--bg-secondary);
}

.table-hover tbody tr:hover {
  background-color: var(--accent-primary-light);
}

/* Pagination styling */
[id^="pagination"] {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Pagination status */
#paginationStatus {
  font-size: var(--font-size-sm);
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  color: var(--text-secondary);
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
}

/* Batch processing UI */
#batchApp {
  height: auto;
  max-height: 85vh;
  overflow: auto;
  padding: 15px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

#batchControlPanel {
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 15px;
}

#fileContent, #batchMessagesContent {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 10px;
  height: 500px;
}

#batchApp .table-responsive {
  max-height: calc(85vh - 200px);
  overflow-y: auto;
}

#batchTable {
  margin-bottom: 0;
  width: 100%;
}

#batchTable thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: #009879;
}

/* Messages */
#messages, #batchMessages, #batchStatus {
  font-size: 14px;
  line-height: 1.5;
}

/* Code */
pre {
  white-space: pre-wrap !important;
  background-color: #f8f9fa;
  border-radius: 6px;
  padding: 12px;
  border: 1px solid #e9ecef;
  max-width: 48vw;
}

/* Modern Table Styling */
.modern-table {
  border-collapse: collapse;
  min-width: 400px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
  width: 100%;
}

.modern-table thead tr {
  background-color: #009879;
  color: #ffffff;
  text-align: left;
}

.modern-table th,
.modern-table td {
  padding-top: 5px;
  padding-bottom: 5px;
}

.modern-table tbody tr {
  border-bottom: 1px solid #dddddd;
}

.modern-table tbody tr:nth-of-type(even) {
  background-color: #f3f3f3;
}

.modern-table tbody tr:last-of-type {
  border-bottom: 2px solid #009879;
}

.modern-table tbody tr.active-row {
  font-weight: bold;
  color: #009879;
}

/* Hover effect */
.modern-table tbody tr:hover {
  background-color: #f1fff9;
}

/* Responsive table */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y pan-x;
}

/* Pagination styling */
.pagination-modern {
  margin-top: 10px;
  display: flex;
  gap: 5px;
}

.pagination-modern .btn {
  background-color: #009879;
  border-color: #009879;
}

.pagination-modern .btn:hover {
  background-color: #007c63;
  border-color: #007c63;
}

/* Tab Navigation Styling */
.nav-tabs {
  border-bottom: 2px solid #dee2e6;
}

.nav-tabs .nav-link {
  border: none;
  color: var(--text-secondary);
  padding: var(--spacing-sm) var(--spacing-lg);
  font-weight: 400;
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
  background: transparent;
}

.nav-tabs .nav-link:hover {
  border: none;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
}

.nav-tabs .nav-link.active {
  border: none;
  border-bottom: 2px solid var(--accent-primary);
  color: var(--accent-primary);
  font-weight: 500;
  background: transparent;
}

.nav-tabs .nav-link i {
  margin-left: var(--spacing-sm);
  font-size: var(--font-size-xs);
}

/* Form controls in header */
#header .form-control,
#header .form-select {
  height: 35px;
  font-size: 0.875rem;
}

#header .form-check {
  margin-bottom: 0;
}

/* Reload button styling */
.reload-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: var(--spacing-xs);
  cursor: pointer;
  opacity: 0.6;
  transition: opacity var(--transition-fast);
}

.reload-icon:hover {
  opacity: 1;
  color: var(--accent-primary);
}

/* DataTable Component Styles */
data-table {
  display: table;
  font-size: 0.75rem;
  width: max-content;
  min-width: 100%;
  max-width: none;
  margin-bottom: 1rem;
  border-collapse: separate;
  border-spacing: 0;
}

data-table thead,
data-table tbody,
data-table tr,
data-table th,
data-table td {
  display: revert; /* Reset display to browser default */
}

data-table.table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

data-table.modern-table thead tr {
  background-color: #009879;
  color: #ffffff;
  text-align: left;
}

data-table.modern-table tbody tr {
  border-bottom: 1px solid #dddddd;
}

data-table.modern-table tbody tr:nth-of-type(even) {
  background-color: #f3f3f3;
}

data-table.modern-table tbody tr:last-of-type {
  border-bottom: 2px solid #009879;
}

data-table.modern-table tbody tr:hover {
  background-color: #f1fff9;
}

data-table.modern-table .text-danger {
  color: #dc3545 !important;
}

data-table.modern-table .text-success {
  color: #28a745 !important;
}

/* Branch Replenishment Styling */
branch-replenishment {
  display: block;
  padding: 1rem;
}

/* Ensure Query Panel card has a high stacking context */
.query-panel-card {
  position: relative; /* Needed for z-index */
  z-index: 10000 !important; /* Higher than table header and dropdown */
}

branch-replenishment button {
  margin: 0.5rem;
  padding: 0.5rem 1rem;
  background: #446e9b;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

branch-replenishment button:hover {
  background: #385a7f;
}

#branchReplenishContent {
  display: none; /* Hidden by default */
}

#branchReplenishContent.active {
  display: block;
}

.compact-input {
  height: 16px !important;
  padding: 1px 3px !important;
  width: 50px !important;
  margin: 0 !important;
  min-height: unset !important;
  line-height: 1 !important;
  border: 0 !important;
  color: var(--text-primary) !important;
}

/* Ultra compact table styling */
.modern-table.compact-table {
  border-collapse: collapse !important;
  margin-bottom: 0 !important;
}

.modern-table.compact-table th,
.modern-table.compact-table td {
  padding: 2px 4px !important;
  line-height: 1.2 !important;
  vertical-align: middle !important;
}

.modern-table.compact-table tr {
  height: 22px !important;
}

.modern-table.compact-table tbody tr:hover {
  background-color: rgba(0, 152, 121, 0.1) !important;
}

/* Enhanced compact table styling for branch-replenishment */
branch-replenishment .table.compact-table {
  font-size: 0.7rem !important;
  margin-bottom: 0 !important;
}

branch-replenishment .table.compact-table th,
branch-replenishment .table.compact-table td {
  padding: 1px 2px !important;
  line-height: 1.1 !important;
  vertical-align: middle !important;
  white-space: nowrap;
}

branch-replenishment .table.compact-table th {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 4px !important;
  height: 24px !important;
}

branch-replenishment .table.compact-table tr {
  height: 20px !important;
}

branch-replenishment .compact-input {
  height: 18px !important;
  padding: 0px 2px !important;
  font-size: 0.7rem !important;
  width: 40px !important;
  min-height: unset !important;
  border-radius: 2px !important;
}

/* Improved visual grouping for column types */
/* REMOVED duplicate group styles - these are now in replenishment-data-table.css */

branch-replenishment .vertical-divider {
  border-left: 1px solid #dee2e6 !important;
}

/* Improved sticky header for branch-replenishment */
branch-replenishment .table thead.sticky-top {
  top: 0;
  position: sticky;
  z-index: 5;
}

branch-replenishment .table thead.sticky-top th {
  position: sticky;
  top: 0;
  background-color: #f8f9fa !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* Improved hovering effect */
branch-replenishment .table tbody tr:hover {
  background-color: rgba(68, 110, 155, 0.08) !important;
}

/* Better distinction for alternating rows */
branch-replenishment .table-striped > tbody > tr:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.02) !important;
}

/* Improved status indicators */
branch-replenishment .stock-critical, 
branch-replenishment .stock-optimal, 
branch-replenishment .stock-high {
  position: relative;
  padding-right: 12px !important;
}

branch-replenishment .stock-critical::before {
  font-size: 8px !important;
}

branch-replenishment .stock-optimal::after {
  font-size: 8px !important;
}

branch-replenishment .stock-high::before {
  font-size: 8px !important;
}

/* Custom Tooltip Styling */
.tooltip {
  --bs-tooltip-bg: #446e9b;
  --bs-tooltip-opacity: 1;
  --bs-tooltip-border-radius: 6px;
  --bs-tooltip-padding-x: 12px;
  --bs-tooltip-padding-y: 8px;
  --bs-tooltip-font-size: 0.85rem;
  --bs-tooltip-color: #fff;
  --bs-tooltip-max-width: 300px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}

.tooltip .tooltip-inner {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  line-height: 1.4;
  font-weight: 400;
  font-family: 'Inter', sans-serif;
  letter-spacing: 0.2px;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
  border-top-color: #446e9b;
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
  border-bottom-color: #446e9b;
}

.tooltip.bs-tooltip-start .tooltip-arrow::before {
  border-left-color: #446e9b;
}

.tooltip.bs-tooltip-end .tooltip-arrow::before {
  border-right-color: #446e9b;
}

/* Hierarchical Navigation Styles */
.app-selector {
  padding: 0.5rem 0;
  border-bottom: 1px solid #dee2e6;
  border-radius: 0.375rem;
  margin-bottom: 0.5rem;
}

.app-btn {
  position: relative;
  font-weight: 500;
  border-radius: 0.375rem !important;
  transition: all 0.3s ease;
  border: 2px solid transparent !important;
}

.app-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.app-btn.active {
  background-color: #009879 !important;
  border-color: #009879 !important;
  color: white !important;
  box-shadow: 0 2px 4px rgba(0, 152, 121, 0.3);
}

.app-btn:not(.active) {
  background-color: var(--bg-primary);
  border-color: var(--border-color) !important;
  color: var(--text-secondary);
}

.app-btn:not(.active):hover {
  background-color: var(--bg-secondary);
  border-color: #009879 !important;
  color: #009879;
}

/* Sub Navigation Styling */
.sub-nav {
  border-bottom: 2px solid #dee2e6;
  background-color: #fff;
  transition: all 0.3s ease;
}

.sub-nav.d-none {
  display: none !important;
}

.sub-nav .nav-link {
  border: none;
  color: var(--text-secondary);
  font-weight: 400;
  font-size: var(--font-size-sm);
  transition: color var(--transition-fast);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.sub-nav .nav-link:hover {
  border: none;
  color: var(--text-primary);
  color: #009879;
  background-color: rgba(0, 152, 121, 0.1);
}

.sub-nav .nav-link.active {
  border: none;
  border-bottom: 3px solid #009879;
  color: #009879;
  font-weight: 600;
  background-color: rgba(0, 152, 121, 0.05);
}

.sub-nav .nav-link i.reload-icon {
  margin-left: 8px;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.sub-nav .nav-link:hover i.reload-icon {
  opacity: 1;
  transform: rotate(90deg);
}

/* App transition animations */
.sub-nav {
  animation: slideIn 0.3s ease-out;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-selector .btn-group {
    flex-direction: column;
    width: 100%;
  }
  
  .app-btn {
    margin-bottom: 0.25rem;
    border-radius: 0.375rem !important;
  }
  
  .sub-nav {
    flex-wrap: wrap;
  }
  
  .sub-nav .nav-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
  }
}

/* Context indicators */
.app-btn::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background-color: #009879;
  transition: width 0.3s ease;
}

.app-btn.active::after {
  width: 80%;
}

/* Styling moved to components/necesar-achizitii.css */

/* Tweak spacing when the navigation rail is collapsed */
#app.header-collapsed {
  padding-top: var(--spacing-md);
}

/* Diagnostic Modal Condensed Layout */
#diagnosticModal .modal-header {
  padding: 0.5rem 1rem;
  color: #fff !important; /* Ensure white text on orange background */
}

#diagnosticModal .modal-header .modal-title {
  color: #fff !important;
  font-size: 1.1rem;
}

#diagnosticModal .modal-body {
  padding: 0.75rem !important;
}

#diagnosticModal .alert {
  padding: 0.5rem 0.75rem !important;
  margin-bottom: 0.5rem !important;
}

#diagnosticModal .table {
  margin-bottom: 0.5rem !important;
}

#diagnosticModal .table td,
#diagnosticModal .table th {
  padding: 0.25rem 0.5rem !important;
  vertical-align: middle;
}

#diagnosticModal .table thead th {
  padding: 0.375rem 0.5rem !important;
  font-size: 11px;
  font-weight: 600;
}

#diagnosticModal .badge {
  font-size: 10px;
  padding: 0.25em 0.5em;
}

/* Ensure orange badges have white text */
#diagnosticModal .bg-warning {
  background-color: #ff9500 !important;
  color: #fff !important;
}

#diagnosticModal .modal-footer {
  padding: 0.5rem 1rem !important;
}

#diagnosticModal .modal-footer .btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
}

/* ========================================
   ENHANCED ACCESSIBILITY
   Better focus states and keyboard navigation
   ======================================== */

/* Focus visible for keyboard navigation */
*:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Keyboard navigation indicators */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  box-shadow: 0 0 0 3px var(--primary-light),
              0 0 0 5px var(--primary-color);
}

/* Disabled state clarity */
button:disabled,
input:disabled,
select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(50%);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}