/* ============================================================
   GESTION SAV — STYLESHEET
   Design: Industrial Minimal — Navy + Amber accent
   ============================================================ */

:root {
  --sidebar-w: 260px;
  --bg:        #f0f2f7;
  --surface:   #ffffff;
  --navy:      #0d1b2a;
  --navy-2:    #162032;
  --navy-3:    #1e2d40;
  --accent:    #f59e0b;
  --accent-2:  #d97706;
  --blue:      #2563eb;
  --blue-l:    #dbeafe;
  --green:     #16a34a;
  --green-l:   #dcfce7;
  --red:       #dc2626;
  --red-l:     #fee2e2;
  --orange:    #ea580c;
  --orange-l:  #ffedd5;
  --gray:      #6b7280;
  --gray-l:    #f3f4f6;
  --border:    #e5e7eb;
  --text:      #111827;
  --text-2:    #6b7280;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --radius:    10px;
  --radius-sm: 6px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: transform .25s ease;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 20px;
  border-bottom: 1px solid var(--navy-3);
}
.brand-icon {
  width: 42px; height: 42px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: var(--navy);
  flex-shrink: 0;
}
.brand-name  { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: .3px; }
.brand-sub   { font-size: 11px; color: #6b849e; margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 16px 12px; }

.nav-section {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #4a6080;
  padding: 16px 8px 6px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #94a8be;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all .15s;
}
.nav-item:hover { background: var(--navy-3); color: #fff; }
.nav-item.active { background: var(--accent); color: var(--navy); font-weight: 600; }
.nav-item.active .nav-icon { stroke: var(--navy); }
.nav-icon { width: 18px; height: 18px; stroke: currentColor; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--navy-3);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.user-avatar {
  width: 36px; height: 36px;
  background: var(--navy-3);
  border: 2px solid var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--accent);
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: #6b849e; }
.logout-btn { color: #4a6080; text-decoration: none; transition: color .15s; padding: 4px; border-radius: 6px; }
.logout-btn:hover { color: var(--red); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--gray);
  padding: 4px;
}
.page-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.content-body { padding: 28px; flex: 1; }

/* ============================================================
   FLASH MESSAGES
   ============================================================ */
.flash {
  margin: 0 28px 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 4px solid;
}
.flash button { background: none; border: none; cursor: pointer; opacity: .6; font-size: 16px; }
.flash-success { background: var(--green-l); color: var(--green); border-color: var(--green); }
.flash-error   { background: var(--red-l);   color: var(--red);   border-color: var(--red); }
.flash-warning { background: var(--orange-l); color: var(--orange); border-color: var(--orange); }
.flash-info    { background: var(--blue-l);  color: var(--blue);  border-color: var(--blue); }

/* ============================================================
   CARDS & STATS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
}
.stat-icon {
  width: 50px; height: 50px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}
.stat-icon.blue   { background: var(--blue-l);   color: var(--blue); }
.stat-icon.green  { background: var(--green-l);  color: var(--green); }
.stat-icon.orange { background: var(--orange-l); color: var(--orange); }
.stat-icon.red    { background: var(--red-l);    color: var(--red); }
.stat-icon.amber  { background: #fef3c7; color: var(--accent-2); }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1; color: var(--text); font-family: 'JetBrains Mono', monospace; }
.stat-label { font-size: 12px; color: var(--text-2); margin-top: 4px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-title { font-size: 15px; font-weight: 700; }
.card-body  { padding: 22px; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  background: #f8fafc;
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-2);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
}
.badge-info    { background: var(--blue-l);   color: var(--blue); }
.badge-primary { background: #ede9fe;         color: #7c3aed; }
.badge-success { background: var(--green-l);  color: var(--green); }
.badge-warning { background: #fef3c7;         color: #b45309; }
.badge-orange  { background: var(--orange-l); color: var(--orange); }
.badge-danger  { background: var(--red-l);    color: var(--red); }
.badge-dark    { background: #d1d5db;         color: #374151; }
.badge-muted   { background: var(--gray-l);   color: var(--gray); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary   { background: var(--blue);    color: #fff; }
.btn-primary:hover   { background: #1d4ed8; }
.btn-success   { background: var(--green);   color: #fff; }
.btn-success:hover   { background: #15803d; }
.btn-danger    { background: var(--red);     color: #fff; }
.btn-danger:hover    { background: #b91c1c; }
.btn-warning   { background: var(--accent);  color: var(--navy); }
.btn-warning:hover   { background: var(--accent-2); }
.btn-outline   { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover   { background: var(--gray-l); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid { display: grid; gap: 18px; }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label { font-size: 12.5px; font-weight: 600; color: var(--text-2); letter-spacing: .3px; }
input, select, textarea {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
textarea { resize: vertical; min-height: 80px; }
.input-mono { font-family: 'JetBrains Mono', monospace; font-size: 13px; }
.form-hint { font-size: 11.5px; color: var(--text-2); margin-top: 2px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 20px;
}
.page-link {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
}
.page-link:hover  { background: var(--gray-l); }
.page-link.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-link.disabled { opacity: .4; pointer-events: none; }

/* ============================================================
   TICKET NUMBER
   ============================================================ */
.ticket-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  background: var(--blue-l);
  padding: 2px 8px;
  border-radius: 4px;
}

/* ============================================================
   TIMELINE (historique)
   ============================================================ */
.timeline { list-style: none; position: relative; padding-left: 28px; }
.timeline::before { content:''; position: absolute; left: 10px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; margin-bottom: 20px; }
.timeline-dot {
  position: absolute; left: -23px; top: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--blue);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 2px var(--blue);
}
.timeline-dot.green  { background: var(--green);  box-shadow: 0 0 0 2px var(--green); }
.timeline-dot.orange { background: var(--orange); box-shadow: 0 0 0 2px var(--orange); }
.timeline-dot.red    { background: var(--red);    box-shadow: 0 0 0 2px var(--red); }
.timeline-date { font-size: 11px; color: var(--text-2); margin-bottom: 4px; }
.timeline-content {
  background: var(--gray-l);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13.5px;
}
.timeline-author { font-weight: 600; color: var(--text); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
  min-height: 100vh;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background-image: radial-gradient(circle at 20% 50%, #1e3a5f 0%, transparent 50%),
                    radial-gradient(circle at 80% 20%, #1a2f4a 0%, transparent 40%);
}
.login-box {
  background: var(--surface);
  border-radius: 16px;
  padding: 44px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,.4);
}
.login-logo {
  width: 60px; height: 60px;
  background: var(--accent);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
}
.login-title { text-align: center; font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.login-sub   { text-align: center; font-size: 13px; color: var(--text-2); margin-bottom: 28px; }
.login-form .form-group { margin-bottom: 16px; }
.login-btn { width: 100%; justify-content: center; padding: 11px; font-size: 15px; margin-top: 8px; }

/* ============================================================
   DETAIL VIEW
   ============================================================ */
.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.detail-section { margin-bottom: 20px; }
.detail-section h3 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-2);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.detail-row { display: flex; gap: 8px; margin-bottom: 10px; font-size: 13.5px; }
.detail-label { min-width: 130px; color: var(--text-2); font-weight: 500; }
.detail-value { color: var(--text); font-weight: 500; }

/* ============================================================
   STOCK ALERT
   ============================================================ */
.alert-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  background: var(--red-l);
  color: var(--red);
  border: 1px solid #fca5a5;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .form-grid-3 { grid-template-columns: 1fr 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .content-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-box { padding: 28px 24px; }
}

/* ============================================================
   MISC
   ============================================================ */
.text-muted { color: var(--text-2); }
.text-right { text-align: right; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-2);
}
.empty-state svg { opacity: .3; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; margin-bottom: 6px; color: var(--text); }
