/* systeme de design Metallux V4.3 - Ultra Premium */

:root {
  /* Colors - Metallux Dark Cosmos */
  --bg-primary: #05060e;      /* Noir espace */
  --bg-secondary: #09091a;    /* Bleu nuit obsidian */
  --bg-tertiary: #10122e;     /* Bleu royal profond */
  --bg-card: rgba(10, 11, 28, 0.7);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --border-color: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.16);
  --glass-blur: blur(24px);
  
  --text-primary: #f0f1ff;
  --text-secondary: #8890c4;
  --text-muted: #545aa0;
  
  --accent-color: #E3000F;
  --accent-primary: var(--accent-color);
  --accent-hover: #ff2235;
  --accent-blue: #30338D;
  --accent-gold: #f59e0b;
  --accent-purple: #8b5cf6;
  
  --accent-gradient-primary: linear-gradient(135deg, #e3000f 0%, #ff4d4d 100%);
  --accent-gradient-blue: linear-gradient(135deg, #30338d 0%, #5558d6 100%);
  --accent-gradient-glow: linear-gradient(135deg, #8b5cf6 0%, #d946ef 100%);
  
  /* Status Colors */
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.1);
  --color-info: #3b82f6;
  --color-info-bg: rgba(59, 130, 246, 0.1);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.1);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.1);
  
  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  
  /* Typography */
  --font-main: 'Geist', 'Plus Jakarta Sans', -apple-system, sans-serif;
  --font-title: 'Space Grotesk', 'Geist', sans-serif;
  --font-mono: 'Geist Mono', 'JetBrains Mono', monospace;
  
  --sidebar-width: 280px;
  --header-height: 68px;
}

/* Background gradient orb elements for high quality visual wow */
body::before {
  content: '';
  position: fixed;
  top: -20%; left: -20%; width: 140%; height: 140%;
  background: radial-gradient(circle at 20% 20%, rgba(48, 51, 141, 0.18) 0%, transparent 40%),
              radial-gradient(circle at 80% 80%, rgba(227, 0, 15, 0.08) 0%, transparent 45%);
  z-index: -1;
  pointer-events: none;
  filter: blur(120px);
  animation: floatBackground 20s ease-in-out infinite alternate;
}

@keyframes floatBackground {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(4%, 4%) scale(1.05); }
}

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

body {
  font-family: var(--font-main);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  height: 100vh;
}

/* App Container Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
}

.sidebar-brand h1 {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.sidebar-menu {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 500;
  transition: var(--transition-fast);
}

.menu-item i {
  width: 20px;
  height: 20px;
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
  border-radius: 10px;
  box-sizing: content-box;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
  transition: all var(--transition-normal);
}

.menu-item:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.menu-item:hover i {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05) rotate(-5deg);
  color: var(--accent-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.menu-item.active {
  background: linear-gradient(90deg, rgba(227, 0, 15, 0.1) 0%, rgba(227, 0, 15, 0.02) 100%);
  color: #ffffff;
  border-left: 3px solid var(--accent-color);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.05);
  transform: translateX(2px);
}

.menu-item.active i {
  background: var(--accent-gradient-primary);
  color: #fff;
  box-shadow: 0 4px 10px rgba(227, 0, 15, 0.3);
  transform: scale(1.1);
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-muted);
}

/* Phosphor + Lucide icon sizes for nav */
.nav-icon {
  font-size: 18px !important;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sub-nav-icon {
  font-size: 20px !important;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.85;
}

/* Main Content Styling */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}




.header-search {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 30px;
  padding: 6px 16px;
  width: 320px;
  transition: var(--transition-fast);
}

.header-search:focus-within {
  border-color: #8b5cf6;
  box-shadow: 0 0 18px rgba(139, 92, 246, 0.3);
}

.header-search i {
  color: var(--text-muted);
  width: 18px;
  height: 18px;
}

.header-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  width: 100%;
  font-size: 14px;
}

.header-search input::placeholder {
  color: var(--text-muted);
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-info {
  text-align: right;
}

.profile-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.profile-role {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
}

.profile-avatar {
  width: 38px;
  height: 38px;
  background-color: var(--bg-tertiary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

/* Sections Wrapper */
.sections-wrapper {
  flex-grow: 1;
  overflow-y: auto;
  padding: 32px;
}

.app-section {
  display: none;
  animation: fadeIn 0.4s ease;
}

.app-section.active {
  display: block;
}

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

.section-header {
  margin-bottom: 24px;
}

.section-header h2 {
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.section-header-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-header-actions h2 {
  font-family: var(--font-title);
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
}

.section-header-actions p {
  color: var(--text-secondary);
  font-size: 14px;
}

.card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 
    0 1px 0 0 rgba(255, 255, 255, 0.04) inset,
    0 8px 32px 0 rgba(0, 0, 0, 0.35),
    0 1px 2px 0 rgba(0, 0, 0, 0.2);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.08) 50%, transparent 100%);
  pointer-events: none;
}

.card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 16px 48px 0 rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* Button UI */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition-fast);
}

.btn-primary {
  background: var(--accent-gradient-primary);
  color: #fff;
  box-shadow: 0 4px 15px rgba(227, 0, 15, 0.3);
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0; left: -100%; width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: all 0.6s ease;
}

.btn-primary:hover::before {
  left: 100%;
}

.btn-primary:hover {
  background: var(--accent-gradient-primary);
  box-shadow: 0 8px 25px rgba(227, 0, 15, 0.5);
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

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

.btn-danger {
  background-color: var(--color-danger);
  color: white;
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-xs {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}



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

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tables design */
.table-container {
  overflow-x: auto;
}

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




.actions-col {
  text-align: right;
}

.actions-cell-wrapper {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Badges for status */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border: 1px solid transparent;
}

.badge-success {
  background-color: var(--color-success-bg);
  color: var(--color-success);
  border-color: rgba(16, 185, 129, 0.2);
}
.badge-warning {
  background-color: var(--color-warning-bg);
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.2);
}
.badge-danger {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: rgba(239, 68, 68, 0.2);
}
.badge-info {
  background-color: var(--color-info-bg);
  color: var(--color-info);
  border-color: rgba(59, 130, 246, 0.2);
}

/* --- 1. DASHBOARD STYLING --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}




/* Modernized Card Icons */
.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: inset 0 2px 4px rgba(255,255,255,0.1), 0 4px 12px rgba(0,0,0,0.15);
  transition: transform var(--transition-normal);
}

.metric-card:hover .card-icon {
  transform: scale(1.1) rotate(5deg);
}

.card-icon.blue { background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.05)); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.2); }
.card-icon.green { background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.05)); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }
.card-icon.orange { background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(245, 158, 11, 0.05)); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.2); }
.card-icon.red { background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(239, 68, 68, 0.05)); color: #f87171; border: 1px solid rgba(239, 68, 68, 0.2); }

.card-data {
  display: flex;
  flex-direction: column;
}

.card-label {
  font-size: 12px;
  color: var(--text-secondary);
}

.card-value {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-title);
  color: var(--text-primary);
}

.dashboard-details-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}

.dash-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.dash-panel h3 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 10px;
}

.actions-panel {
  grid-column: 1 / -1;
}

.quick-actions-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.alert-panel {
  display: flex;
  flex-direction: column;
}

.alert-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 350px;
  overflow-y: auto;
}

.alert-item {
  background-color: rgba(239, 68, 68, 0.08);
  border-left: 3px solid var(--color-danger);
  padding: 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.alert-item.warning {
  background-color: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--color-warning);
}

.alert-item-name {
  font-weight: 600;
}

.alert-item-detail {
  font-size: 11px;
  color: var(--text-secondary);
}

.alert-item-qty {
  font-weight: bold;
  color: var(--color-danger);
}

.alert-item.warning .alert-item-qty {
  color: var(--color-warning);
}

/* --- 2. CHIFFRAGE / CONFIGURATOR STYLING --- */
.configurator-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

.config-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

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

.price-summary-panel {
  background-color: rgba(255, 255, 255, 0.03);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.price-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text-secondary);
}

.price-row.total {
  border-top: 1px solid var(--border-color);
  padding-top: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-primary);
}

.price-row.total-ttc {
  font-weight: 800;
  font-size: 18px;
  color: var(--accent-gold);
}

.config-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.preview-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-btn:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.04);
}

.tab-btn.active {
  color: var(--accent-color);
  background-color: rgba(59, 130, 246, 0.1);
}

.preview-viewport {
  height: 480px;
  position: relative;
  overflow: hidden;
  padding: 0;
  transition: box-shadow 0.4s ease;
  box-shadow: 0 20px 40px -15px var(--ral-glow-color, rgba(48, 51, 141, 0.15));
}

.viewport-canvas {
  width: 100%;
  height: 100%;
  display: none;
}

.viewport-canvas.active {
  display: block;
}

#canvas-3d-container canvas {
  width: 100% !important;
  height: 100% !important;
}

#three-ar-button-hidden,
#three-ar-button-container {
  display: none !important;
}

.viewport-controls {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(15, 23, 42, 0.7);
  padding: 6px 14px;
  border-radius: 30px;
  font-size: 11px;
  color: var(--text-secondary);
  pointer-events: none;
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-color);
}

.breakdown-panel h3 {
  font-family: var(--font-title);
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* Grid controls inside dynamic panel */
.grid-controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-option-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
}

.color-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}

/* --- 3. FILTER & SEARCH BARS --- */
.filter-bar {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 24px;
  flex-wrap: wrap;
}

.search-input-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 14px;
  flex-grow: 1;
}

.search-input-wrapper i {
  color: var(--text-muted);
}

.search-input-wrapper input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  width: 100%;
  font-size: 14px;
}

.filter-select-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-select-wrapper label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.filter-select-wrapper select {
  width: auto;
}

.filter-check-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

.filter-check-wrapper input {
  cursor: pointer;
}

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

/* --- 4. DOCUMENTS VIEW SPECIALS --- */
.tab-filters-wrapper {
  display: flex;
  gap: 4px;
  background-color: var(--bg-tertiary);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.filter-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.filter-tab-btn:hover {
  color: var(--text-primary);
}

.filter-tab-btn.active {
  background-color: var(--accent-color);
  color: white;
}

/* --- 5. CONTACTS DIRECTORY STYLING --- */
.contacts-tabs-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}

.contact-tab {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: var(--transition-fast);
}

.contact-tab:hover {
  color: var(--text-primary);
  background-color: rgba(255, 255, 255, 0.03);
}

.contact-tab.active {
  background-color: var(--accent-color);
  color: white;
  border-color: var(--accent-color);
}

.contacts-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: start;
}

.contact-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 16px;
}

.contact-search-bar input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  width: 100%;
}

.contacts-main tr {
  cursor: pointer;
}

.contacts-main tr.selected td {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--accent-color);
}

.contact-detail-pane {
  min-height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.detail-placeholder {
  text-align: center;
  color: var(--text-muted);
  padding: 40px;
}

.placeholder-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
}

.detail-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.3s ease;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.detail-title h3 {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 700;
}

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

.detail-info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.info-item i {
  color: var(--text-muted);
  width: 16px;
  height: 16px;
}

.detail-docs-history h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.doc-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-history-item {
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  color: var(--text-primary);
  transition: var(--transition-fast);
}

.doc-history-item:hover {
  border-color: var(--accent-color);
  background-color: rgba(59, 130, 246, 0.05);
}

.doc-hist-id {
  font-weight: 600;
  font-size: 13px;
}

.doc-hist-date {
  font-size: 11px;
  color: var(--text-muted);
}

.doc-hist-total {
  font-weight: 700;
}

.hidden {
  display: none !important;
}

/* --- MODALS & DIALOGS --- */
/* Main modal styles defined at bottom of file for clean overrides */

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


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

.modal-header h3 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  display: flex;
}

.btn-close-modal:hover {
  color: var(--text-primary);
}

.form-grid {
  padding: 24px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  overflow-y: auto;
  flex-grow: 1;
}

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

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

/* Document specific modal */
dialog.doc-modal {
  max-width: 850px;
  width: 95%;
  height: 90vh;
}

.doc-actions-top {
  display: flex;
  gap: 8px;
  align-items: center;
}

.printable-document-container {
  padding: 32px;
  background-color: white;
  color: #1e293b;
  overflow-y: auto;
  flex-grow: 1;
  font-family: var(--font-main);
  line-height: 1.5;
}

/* --- PRINT / INVOICE PREVIEW STYLING --- */
.invoice-preview {
  color: #1e293b;
}

.inv-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 40px;
}

.inv-brand h1 {
  font-family: var(--font-title);
  font-size: 26px;
  font-weight: 800;
  color: #0f172a;
}

.inv-brand p {
  font-size: 11px;
  color: #64748b;
}

.card-value {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-title);
  color: var(--text-primary);
}

.pulse-alert {
  animation: pulse-red 2s infinite;
  border-color: rgba(239, 68, 68, 0.5) !important;
}

@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}

.inv-details {
  text-align: right;
}

.inv-details h2 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 6px;
}

.inv-details p {
  font-size: 13px;
  color: #64748b;
}

.inv-parties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
  font-size: 13px;
}

.inv-party h4 {
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  font-size: 11px;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 4px;
  margin-bottom: 8px;
}

.inv-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
}

.inv-table th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  border-bottom: 2px solid #cbd5e1;
  border-top: 1px solid #e2e8f0;
  padding: 10px 12px;
}

.inv-table td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  color: #334155;
  white-space: pre-line;
}

.inv-totals-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}

.inv-notes {
  font-size: 11px;
  color: #64748b;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  padding: 12px;
  height: fit-content;
}

.inv-totals-table {
  width: 100%;
}

.inv-totals-table td {
  padding: 8px 12px;
  border-bottom: none;
  font-size: 13px;
}

.inv-totals-table tr.grand-total td {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  border-top: 2px solid #cbd5e1;
}

/* Printing styles */
@media print {
  /* Page A4 avec marges — supprimer aussi les en-têtes/pieds ajoutés par le navigateur */
  @page {
    size: A4 portrait;
    margin: 10mm;
    /* Vider les 6 zones d'en-tête/pied du navigateur (date, titre, URL, n° page) */
    @top-left      { content: ""; }
    @top-center    { content: ""; }
    @top-right     { content: ""; }
    @bottom-left   { content: ""; }
    @bottom-center { content: ""; }
    @bottom-right  { content: ""; }
  }

  /* CRITIQUE : forcer la préservation des couleurs de fond/images
     (sans ça, navigateurs suppriment les fonds colorés à l'impression) */
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  /* Forcer body + html en BLANC + reset padding/margin/border pour
     supprimer toute bande sombre/bordure visible en print preview. */
  html, body {
    background: white !important;
    background-color: white !important;
    background-image: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    color: #0f172a !important;
  }
  body::before, body::after { display: none !important; content: none !important; }

  /* Backdrop du <dialog> (zone semi-transparente derrière la modal) */
  #modal-document-preview::backdrop { display: none !important; background: white !important; }

  /* Couper toute bordure/outline résiduelle sur la modal et son contenu direct */
  #modal-document-preview,
  #modal-document-preview > div,
  #modal-document-preview .modal-body-layout,
  #modal-document-preview .printable-document-container {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }

  /* Mapper la syntaxe legacy `page-break-inside:avoid` (inline) vers
     la syntaxe moderne `break-inside:avoid` pour Chrome/Edge/Safari */
  [style*="page-break-inside:avoid"],
  [style*="page-break-inside: avoid"] {
    break-inside: avoid !important;
  }
  [style*="page-break-before:always"],
  [style*="page-break-before: always"] {
    break-before: page !important;
  }

  /* Filets de sécurité : ne pas couper les blocs principaux du document */
  .metallux-doc .mx-banner,
  .metallux-doc table thead,
  .metallux-doc table tr,
  .metallux-annexe > div {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body * { visibility: hidden; }
  #modal-document-preview,
  #modal-document-preview * { visibility: visible; }

  #modal-document-preview {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: none !important;
    height: auto;
    max-height: none !important;
    min-height: 0 !important;
    border: none;
    box-shadow: none;
    transform: none;
    background: white;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
  }

  /* Reset des contraintes flex/overflow internes qui clippent le contenu */
  #modal-document-preview .modal-body-layout {
    display: block !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 0 !important;
    gap: 0 !important;
  }

  .printable-document-container {
    padding: 0 !important;
    overflow: visible !important;
    max-height: none !important;
    flex: none !important;
    width: 100% !important;
  }

  /* Cacher les fonds sombres et bordures de la modal qui ne sont pas du document */
  #modal-document-preview.app-modal,
  #modal-document-preview.doc-modal,
  #modal-document-preview.card {
    background: white !important;
    border: none !important;
    border-radius: 0 !important;
  }

  .no-print { display: none !important; }
}




/* AUTHENTICATION OVERLAY */
.auth-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background-image: radial-gradient(circle at 50% 50%, rgba(48, 51, 141, 0.4) 0%, transparent 70%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  text-align: center;
  animation: authFadeIn 0.5s ease-out;
}

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

.auth-header h2 {
  font-family: var(--font-title);
  font-size: 24px;
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 30px;
}

.auth-form {
  text-align: left;
}

.auth-form.hidden {
  display: none;
}

.auth-switch {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-switch a {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.btn-block {
  width: 100%;
  padding: 12px;
  font-size: 16px;
}

/* Header Dropdown Menu */
.dropdown-trigger {
  position: relative;
  cursor: pointer;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  display: none;
  flex-direction: column;
  padding: 10px;
  min-width: 180px;
  z-index: 100;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.dropdown-trigger:hover .dropdown-menu {
  display: flex;
}





/* Add drop shadow for header/important icons */
.header-profile svg.lucide,
.card-icon svg.lucide {
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.2));
}



@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.spin {
  animation: spin 1s linear infinite;
}

/* ===================================================
   SIDEBAR BADGE (Alertes Stock)
=================================================== */
.sidebar-badge {
  margin-left: auto;
  background: var(--color-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
  50% { box-shadow: 0 0 16px rgba(239, 68, 68, 0.9); }
}

/* ===================================================
   SYNC INDICATOR (Header)
=================================================== */
.sync-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  cursor: default;
  transition: var(--transition-fast);
}

.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #747bba;
  transition: all 0.4s ease;
  flex-shrink: 0;
}

.sync-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* ===================================================
   ANALYTICS — KPI Mini Cards
=================================================== */
.analytics-section {
  margin-top: 28px;
}

.analytics-kpi-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.kpi-mini-card {
  flex: 1;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: var(--transition-fast);
}

.kpi-mini-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.15);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.kpi-mini-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.kpi-mini-value {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-title);
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.kpi-mini-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===================================================
   ANALYTICS — Charts Grid
=================================================== */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.chart-card {
  padding: 20px;
}

.chart-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
}

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

@media (max-width: 1200px) {
  .charts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .analytics-kpi-row {
    flex-direction: column;
  }
}

/* --- HORIZONTAL MENU UPGRADES (V2.2) --- */
.horizontal-menu {
  display: flex !important;
  flex-direction: row !important;
  gap: 8px !important;
  align-items: center !important;
}

.horizontal-menu .menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px !important;
  font-size: 13px !important;
  color: var(--text-secondary) !important;
  text-decoration: none;
  border-radius: var(--radius-full) !important;
  transition: all 0.2s ease;
  border-left: none !important;
  transform: none !important;
  background: transparent !important;
  white-space: nowrap !important;
}

.horizontal-menu .menu-item i,
.horizontal-menu .menu-item svg {
  width: 16px !important;
  height: 16px !important;
  font-size: 16px !important;
  padding: 4px !important;
  border-radius: 6px !important;
  background: rgba(255, 255, 255, 0.03) !important;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
}

.horizontal-menu .menu-item:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #fff !important;
}

.horizontal-menu .menu-item:hover i {
  background: rgba(255, 255, 255, 0.12) !important;
  color: var(--accent-primary) !important;
  transform: scale(1.05) !important;
}

.horizontal-menu .menu-item.active {
  background: rgba(227, 0, 15, 0.1) !important;
  color: #fff !important;
  border: 1px solid rgba(227, 0, 15, 0.25) !important;
  box-shadow: 0 0 12px rgba(227, 0, 15, 0.15) !important;
}

.horizontal-menu .menu-item.active i {
  background: var(--accent-gradient-primary) !important;
  color: #fff !important;
  box-shadow: 0 2px 6px rgba(227, 0, 15, 0.25) !important;
  transform: scale(1.05) !important;
}

/* Override sections wrapper and hide vertical sidebar */
.sidebar {
  display: none !important;
}

.sections-wrapper {
  height: calc(100vh - var(--header-height)) !important;
  overflow-y: auto;
  padding: 24px;
}


/* --- KANBAN ATELIER PREMIUM STYLES --- */
.kanban-board {
  display: flex;
  gap: 16px;
  height: calc(100vh - 190px);
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-column {
  flex: 1;
  min-width: 290px;
  background: var(--bg-secondary) !important;
  border-radius: var(--radius-lg) !important;
  padding: 16px !important;
  border: 1px solid var(--border-color) !important;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.kanban-column.drag-over {
  background-color: var(--bg-tertiary) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 4px 30px rgba(0,0,0,0.25);
}

.kanban-cards-container {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 150px;
  padding-right: 4px;
}

/* Scrollbar customization inside columns */
.kanban-cards-container::-webkit-scrollbar {
  width: 6px;
}
.kanban-cards-container::-webkit-scrollbar-track {
  background: transparent;
}
.kanban-cards-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 3px;
}
.kanban-cards-container::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

.kanban-card {
  position: relative;
  background: var(--bg-card) !important;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: var(--radius-md) !important;
  padding: 14px !important;
  border: 1px solid var(--border-color) !important;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
  transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast) !important;
  cursor: grab;
  overflow: hidden;
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.18) !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35) !important;
}

/* Card left status indicators */
.kanban-card.status-new {
  border-left: 4px solid var(--text-muted) !important;
}
.kanban-card.status-cutting {
  border-left: 4px solid #3b82f6 !important;
}
.kanban-card.status-assembling {
  border-left: 4px solid #f59e0b !important;
}
.kanban-card.status-ready {
  border-left: 4px solid #10b981 !important;
}

/* Card Title/ID link */
.kanban-card-id {
  font-family: var(--font-title);
  font-size: 11px;
  font-weight: bold;
  color: var(--accent-primary);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.kanban-card-id:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* Mini Progress Bar inside Card */
.kanban-card-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-top: 4px;
}

.kanban-card-progress-bar {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width var(--transition-normal) ease;
}

.kanban-card-progress-bar.new { width: 15%; background: var(--text-muted); }
.kanban-card-progress-bar.cutting { width: 45%; background: #3b82f6; }
.kanban-card-progress-bar.assembling { width: 75%; background: #f59e0b; }
.kanban-card-progress-bar.ready { width: 100%; background: #10b981; }

/* Sidebar submenu styling */
.menu-dropdown-wrapper {
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Floating Submenu - Premium Glass Dropdown */
.menu-submenu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  background: rgba(9, 9, 26, 0.97);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: 
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 60px rgba(0, 0, 0, 0.7),
    0 4px 16px rgba(0, 0, 0, 0.4);
  padding: 8px;
  z-index: 9999;
  opacity: 0;
  transform-origin: top center;
  animation: none;
  pointer-events: none;
}

.menu-submenu.open {
  display: block;
  opacity: 1;
  pointer-events: auto;
  animation: submenuReveal 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes submenuReveal {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
}

/* Submenu section headers */
.submenu-header {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 12px 4px;
}

.submenu-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 6px 8px;
}

/* Submenu items - rich layout */
.sub-menu-item {
  padding: 10px 12px !important;
  border-radius: var(--radius-sm) !important;
  gap: 12px !important;
  align-items: center !important;
  display: flex !important;
  font-size: 13px !important;
  color: var(--text-secondary) !important;
  text-decoration: none;
  transition: all var(--transition-fast);
  margin-bottom: 2px;
}

.sub-menu-item:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  color: var(--text-primary) !important;
}

.sub-menu-item.active {
  background: rgba(227, 0, 15, 0.1) !important;
  color: #fff !important;
  border-left: none !important;
  transform: none !important;
}

.sub-item-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sub-item-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.sub-item-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.2;
}

.menu-dropdown-trigger .dropdown-chevron {
  transition: transform 0.2s ease;
  opacity: 0.5;
  display: inline-block;
  font-size: 14px !important;
}

.menu-dropdown-wrapper.open .dropdown-chevron {
  transform: rotate(180deg);
  opacity: 1;
}

.menu-dropdown-trigger {
  cursor: pointer;
  user-select: none;
}

/* ===================================================
   INPUT ICON WRAPPERS
=================================================== */
.input-icon-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon-wrapper i,
.input-icon-wrapper svg {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  width: 16px;
  height: 16px;
  pointer-events: none;
  z-index: 1;
}

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

/* ===================================================
   TABLE ROW HOVER ENHANCEMENT
=================================================== */
tr:hover td {
  background-color: rgba(255, 255, 255, 0.025) !important;
}

tbody tr {
  transition: background-color var(--transition-fast);
}

/* ===================================================
   METRIC CARD IMPROVEMENTS
=================================================== */
.metric-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.metric-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}

.metric-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-hover);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

/* ===================================================
   HEADER MODERNIZATION
=================================================== */
.app-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: rgba(5, 6, 14, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  flex-shrink: 0;
  position: relative;
  z-index: 100;
}

.app-header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(227, 0, 15, 0.3) 30%,
    rgba(48, 51, 141, 0.3) 70%,
    transparent 100%
  );
  pointer-events: none;
}

/* ===================================================
   FORM CONTROLS UPGRADED
=================================================== */
.form-control {
  width: 100%;
  padding: 10px 14px;
  background: rgba(16, 18, 46, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 14px;
  outline: none;
  transition: var(--transition-fast);
}

.form-control:focus {
  border-color: rgba(227, 0, 15, 0.5);
  background: rgba(16, 18, 46, 0.9);
  box-shadow: 0 0 0 3px rgba(227, 0, 15, 0.1);
}

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

/* ===================================================
   SELECT ELEMENT FIX
=================================================== */
select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238890c4' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ===================================================
   SCROLLBAR PREMIUM
=================================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  transition: background 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(227, 0, 15, 0.4);
}

/* Adjust table th background for premium look */
th {
  padding: 12px 16px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.015);
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

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

/* MODAL UPGRADES */
dialog.app-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(9, 9, 26, 0.98);
  color: var(--text-primary);
  border-radius: var(--radius-xl);
  padding: 0;
  width: 90%;
  max-width: 580px;
  outline: none;
  box-shadow: 
    0 0 0 1px rgba(255, 255, 255, 0.05) inset,
    0 32px 64px -12px rgba(0, 0, 0, 0.8),
    0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

dialog.app-modal[open] {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

dialog.app-modal::backdrop {
  background: rgba(0, 0, 10, 0.85);
  backdrop-filter: blur(8px);
  animation: backdropFadeIn 0.2s ease forwards;
}

/* Lucide icons global stroke width */
svg.lucide {
  stroke-width: 1.75px !important;
  transition: all var(--transition-fast);
}

/* Code tag styling */
code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.07);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-purple);
  border: 1px solid rgba(139, 92, 246, 0.15);
}

/* --- AMÉLIORATIONS METALLUX V5.0 --- */

/* Pipeline Commercial */
.pipeline-steps {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}
.pipeline-step {
  transition: all var(--transition-fast);
}
.pipeline-step:hover {
  background: rgba(255, 255, 255, 0.04) !important;
  transform: translateY(-2px);
}
.pipeline-step.active {
  border-color: rgba(59, 130, 246, 0.4) !important;
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.1) !important;
}

/* Palette de commande Cmd+K */
#modal-cmd-k {
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
.cmd-k-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.cmd-k-item:hover, .cmd-k-item.active {
  background: var(--accent-gradient-primary);
  color: #fff;
}
.cmd-k-item:hover span, .cmd-k-item.active span {
  color: #fff !important;
}
.cmd-k-item i, .cmd-k-item svg {
  width: 16px;
  height: 16px;
}
.cmd-k-result-type {
  font-size: 9px;
  text-transform: uppercase;
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text-muted);
}
.cmd-k-item:hover .cmd-k-result-type, .cmd-k-item.active .cmd-k-result-type {
  background: rgba(255,255,255,0.2);
  color: #fff;
}

/* Timeline Historique */
.timeline-item {
  position: relative;
  padding-left: 14px;
  border-left: 1.5px solid var(--border-color);
  padding-bottom: 8px;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-blue);
  border: 1.5px solid var(--bg-secondary);
}
.timeline-item:last-child {
  border-left: none;
  padding-bottom: 0;
}

/* Bulles Commentaires */
.comment-bubble {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  transition: all var(--transition-fast);
}
.comment-bubble:hover {
  border-color: var(--border-hover);
}
.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.comment-author {
  font-weight: 600;
  color: var(--text-secondary);
}
.comment-date {
  color: var(--text-muted);
  font-size: 9px;
}
.comment-text {
  color: var(--text-primary);
  line-height: 1.3;
}

/* Règlements progress and list */
.payment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}
.payment-item:last-child {
  border-bottom: none;
}

/* Alerts system */
.alert-popover-item {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-md);
  background: rgba(239, 68, 68, 0.05);
  border: 1px solid rgba(239, 68, 68, 0.15);
  transition: all var(--transition-fast);
}
.alert-popover-item:hover {
  transform: translateX(2px);
  background: rgba(239, 68, 68, 0.08);
}
.alert-popover-icon {
  color: var(--color-danger);
  flex-shrink: 0;
  margin-top: 2px;
}

/* Responsive utilities for mobile swipe in Kanban */
@media (max-width: 768px) {
  .kanban-board {
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-column {
    scroll-snap-align: start;
  }
}

/* V6.0 Upgrades CSS */

/* Calendar Grid Styles */
.calendar-day-cell {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  min-height: 85px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  transition: background var(--transition-fast);
  cursor: pointer;
}
.calendar-day-cell:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.15);
}
.calendar-day-cell.other-month {
  opacity: 0.35;
  background: transparent;
}
.calendar-day-cell.today {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.4);
}
.calendar-day-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.calendar-day-cell.today .calendar-day-num {
  color: #c084fc;
}

/* Calendar Event tags */
.calendar-event {
  font-size: 9px;
  font-weight: 500;
  padding: 2px 4px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 3px;
}
.calendar-event.team-a {
  background: #8b5cf6;
}
.calendar-event.team-b {
  background: #3b82f6;
}
.calendar-event.team-c {
  background: #f59e0b;
}

/* Planning Backlog item */
.planning-backlog-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xs);
  cursor: grab;
  transition: all var(--transition-fast);
}
.planning-backlog-item:hover {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.15);
}

/* Signature drawing board styles */
#signature-canvas {
  background: rgba(0,0,0,0.1) !important;
  border-radius: 4px;
}

/* Eco Impact Badge Leaf highlight */
#eco-impact-badge i {
  animation: ecoPulse 2s infinite alternate;
}
@keyframes ecoPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 1px rgba(16,185,129,0.3)); }
  100% { transform: scale(1.15); filter: drop-shadow(0 0 5px rgba(16,185,129,0.8)); }
}
