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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 40px;
  background: rgba(0,0,0,0.3);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  gap: 30px;
}

.logo {
  font-size: 24px;
  font-weight: 700;
  color: #e94560;
}

.logo span {
  color: #fff;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #e94560;
}

.user-name {
  font-weight: 500;
}

.user-tag {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
}

.tabs {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
}

.tab {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.6);
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tab-icon {
  font-size: 16px;
  display: inline-block;
}

.tab:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.tab.active {
  background: linear-gradient(135deg, #e94560, #ff6b6b);
  color: #fff;
  border-color: transparent;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  padding: 40px 20px;
  margin-bottom: 40px;
}

header h1 {
  font-size: 3em;
  margin-bottom: 10px;
  color: #fff;
}

header p {
  font-size: 1.2em;
  color: rgba(255,255,255,0.7);
}

/* Cards */
.card {
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 30px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
}

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

.card-header h2 {
  font-size: 1.8em;
  color: #fff;
}

.card-body {
  margin-top: 20px;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: #e94560;
  color: white;
}

.btn-primary:hover {
  background: #d63651;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.5);
}

.btn-secondary {
  background: rgba(255,255,255,0.1);
  color: white;
}

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

.btn-danger {
  background: #ef4444;
  color: white;
}

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

.btn-small {
  padding: 8px 16px;
  font-size: 0.9em;
}

.btn-discord {
  background: #7289da;
  color: white;
  padding: 14px 28px;
  font-size: 1.1em;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.btn-discord svg {
  width: 24px;
  height: 24px;
}

.btn-discord:hover {
  background: #5b6eae;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(114, 137, 218, 0.4);
}

.btn-logout {
  background: rgba(233,69,96,0.2);
  border: 1px solid #e94560;
  color: #e94560;
  font-size: 14px;
  text-decoration: none;
}

.btn-logout:hover {
  background: #e94560;
  color: #fff;
}

/* Forms */
.form-group {
  margin-bottom: 22px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: rgba(255,255,255,0.95);
  font-weight: 600;
  font-size: 0.95em;
}

.form-input,
select.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: white;
  font-size: 1em;
  transition: all 0.3s ease;
}

.form-input:hover,
select.form-input:hover {
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.1);
}

.form-input:focus,
select.form-input:focus {
  outline: none;
  border-color: #e94560;
  background: rgba(255,255,255,0.12);
  box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.form-input::placeholder {
  color: rgba(255,255,255,0.5);
}

select.form-input option {
  background: #16213e;
  color: white;
  padding: 10px;
}

.price-display {
  font-size: 2em;
  font-weight: 700;
  color: #2ecc71;
  padding: 16px;
  background: rgba(46, 204, 113, 0.1);
  border-radius: 10px;
  border: 2px solid rgba(46, 204, 113, 0.3);
  text-align: center;
  transition: all 0.3s ease;
}

.price-display:hover {
  border-color: rgba(46, 204, 113, 0.5);
  background: rgba(46, 204, 113, 0.15);
}

.sale-message {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: 10px;
  display: none;
  border: 2px solid;
  font-weight: 500;
  animation: slideDown 0.3s ease;
}

.sale-message.success {
  background: rgba(46, 204, 113, 0.15);
  color: #2ecc71;
  border-color: rgba(46, 204, 113, 0.4);
}

.sale-message.error {
  background: rgba(233, 69, 96, 0.15);
  color: #ff8a9b;
  border-color: rgba(233, 69, 96, 0.4);
}

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

/* Form-specific button styles */
#sale-form .btn-primary {
  width: 100%;
  padding: 14px 24px;
  font-size: 1.05em;
  margin-top: 10px;
}

/* Search bar */
.search-bar {
  margin-bottom: 20px;
}

.search-bar .form-input {
  max-width: 400px;
}

/* Employees Grid */
.employees-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.employee-card {
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  transition: all 0.3s ease;
}

.employee-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 24px rgba(233, 69, 96, 0.2);
  border-color: rgba(233, 69, 96, 0.5);
}

.employee-info h3 {
  font-size: 1.4em;
  margin-bottom: 8px;
  color: #fff;
}

.employee-role {
  color: #e94560;
  font-weight: 600;
  margin-bottom: 10px;
}

.employee-discord {
  color: #7289da;
  font-size: 0.85em;
  margin-bottom: 8px;
  font-weight: 500;
}

.employee-sales {
  color: rgba(255,255,255,0.7);
  font-size: 0.9em;
  margin-bottom: 5px;
}

.employee-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.article-image {
  width: 100%;
  max-width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 15px;
  border: 2px solid rgba(233, 69, 96, 0.3);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: linear-gradient(135deg, #16213e 0%, #0f3460 100%);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.1);
}

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

.modal-header h3 {
  font-size: 1.5em;
  color: #fff;
}

.modal-close {
  background: none;
  border: none;
  color: white;
  font-size: 2em;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
}

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

.modal-body {
  padding: 30px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 30px;
}

.modal-actions .btn {
  flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
  header h1 {
    font-size: 2em;
  }

  .card {
    padding: 20px;
  }

  .card-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }

  .employees-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
  }
}

/* Login pages styles */
.main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 40px;
}

.login-main {
  min-height: calc(100vh - 70px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 30px;
  padding-bottom: 40px;
}

.login-card {
  max-width: 480px;
  width: 100%;
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  border-radius: 16px;
}

.form-header {
  margin-bottom: 30px;
}

.form-header h1 {
  font-size: 2em;
  margin-bottom: 8px;
  font-weight: 700;
}

.subtitle {
  color: rgba(255,255,255,0.7);
  margin-bottom: 0;
  font-size: 0.95em;
}

/* Stocks */
.stocks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.stocks-header h2 {
  margin: 0;
  font-size: 1.8em;
}

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

.stock-zone {
  background: rgba(255,255,255,0.05);
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 12px;
  padding: 20px;
  min-height: 200px;
  max-height: 520px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

.stock-zone.drag-over {
  border-color: #e94560;
  background: rgba(233, 69, 96, 0.1);
  transform: scale(1.02);
}

.stock-zone-title {
  font-size: 1.3em;
  margin-bottom: 20px;
  color: #e94560;
  text-align: center;
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(255,255,255,0.1);
}

.stock-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(233,69,96,0.5) transparent;
}

.stock-items::-webkit-scrollbar {
  width: 6px;
}

.stock-items::-webkit-scrollbar-track {
  background: transparent;
}

.stock-items::-webkit-scrollbar-thumb {
  background: rgba(233,69,96,0.5);
  border-radius: 3px;
}

.stock-items::-webkit-scrollbar-thumb:hover {
  background: rgba(233,69,96,0.8);
}

.stock-item {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 15px;
  cursor: grab;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 15px;
}

.stock-item:active {
  cursor: grabbing;
}

.stock-item.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
}

.stock-item:hover {
  background: rgba(255,255,255,0.12);
  border-color: #e94560;
  transform: translateX(5px);
}

.stock-item-image {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid rgba(233, 69, 96, 0.3);
}

.stock-item-info {
  flex: 1;
}

.stock-item-name {
  font-weight: 600;
  font-size: 1.1em;
  color: #fff;
  margin-bottom: 5px;
}

.stock-item-quantity {
  color: #e94560;
  font-size: 0.95em;
  font-weight: 500;
}

.modal-small {
  max-width: 400px;
}

/* Finance Styles */

.finance-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.finance-init-info {
  padding: 10px 0;
}

.finance-stat {
  text-align: center;
  padding: 20px;
  background: rgba(255,255,255,0.05);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
}

.finance-stat-label {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.finance-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}

.finance-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 15px;
}

.finance-table thead {
  background: rgba(233, 69, 96, 0.1);
}

.finance-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.8);
  border-bottom: 2px solid #e94560;
}

.finance-table td {
  padding: 15px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.9);
}

.finance-table tbody tr {
  transition: background-color 0.2s;
}

.finance-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

.sortie-type-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sortie-type-prime {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
  border: 1px solid rgba(46, 204, 113, 0.4);
}

.sortie-type-achat-de-matériel {
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
  border: 1px solid rgba(52, 152, 219, 0.4);
}

.sortie-type-perte {
  background: rgba(233, 69, 96, 0.2);
  color: #e94560;
  border: 1px solid rgba(233, 69, 96, 0.4);
}

.sortie-type-vente {
  background: rgba(155, 89, 182, 0.2);
  color: #9b59b6;
  border: 1px solid rgba(155, 89, 182, 0.4);
}

.sortie-type-rachat {
  background: rgba(241, 196, 15, 0.2);
  color: #f1c40f;
  border: 1px solid rgba(241, 196, 15, 0.4);
}

.sortie-type-commande {
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
  border: 1px solid rgba(52, 152, 219, 0.4);
}

.sortie-type-fret {
  background: rgba(155, 89, 182, 0.2);
  color: #9b59b6;
  border: 1px solid rgba(155, 89, 182, 0.4);
}

#stock-context-menu {
  background: #16213e;
  border: 1px solid rgba(233, 69, 96, 0.4);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 9000;
  min-width: 180px;
  overflow: hidden;
}

.context-menu-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
  color: rgba(255,255,255,0.9);
}

.context-menu-item:hover {
  background: rgba(233, 69, 96, 0.2);
  color: #fff;
}

.context-menu-item:active {
  background: rgba(233, 69, 96, 0.4);
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 5px;
  transition: transform 0.2s;
}

.btn-icon:hover {
  transform: scale(1.2);
}

.sorties-table {
  overflow-x: auto;
}

/* ============================================
   DASHBOARD
   ============================================ */

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

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

.dash-kpi {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: background 0.2s;
}

.dash-kpi:hover {
  background: rgba(255,255,255,0.11);
}

.dash-kpi-icon {
  font-size: 2rem;
  flex-shrink: 0;
}

.dash-kpi-label {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: 4px;
}

.dash-kpi-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.dash-kpi-sub {
  margin-top: 4px;
  font-size: 12px;
}

.dash-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 0;
}

@media (max-width: 1200px) {
  .dash-row2 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .dash-row2 { grid-template-columns: 1fr; }
}

.dash-stock-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.dash-stock-row:last-child { border-bottom: none; }
.dash-stock-label { flex: 1; color: rgba(255,255,255,0.8); font-size: 14px; }
.dash-stock-qty { color: rgba(255,255,255,0.5); font-size: 13px; min-width: 80px; text-align: right; }
.dash-stock-val { font-weight: 700; font-size: 15px; min-width: 90px; text-align: right; }

.dash-top-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.dash-top-item:last-child { border-bottom: none; }
.dash-top-rank { font-weight: 700; font-size: 14px; min-width: 24px; }
.dash-top-info { flex: 1; min-width: 0; }
.dash-top-name { font-size: 14px; color: rgba(255,255,255,0.85); display: block; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-top-bar { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; }
.dash-top-bar-fill { height: 100%; background: linear-gradient(90deg,#e94560,#f39c12); border-radius: 3px; transition: width .5s ease; }
.dash-top-amount { font-weight: 700; font-size: 14px; min-width: 80px; text-align: right; }
