/* ===========================
   BL MANAGER — FEUILLE DE STYLE
   =========================== */

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

:root {
  --blue:       #185FA5;
  --blue-dk:    #0C447C;
  --blue-lt:    #E6F1FB;
  --green:      #3B6D11;
  --green-lt:   #EAF3DE;
  --orange:     #BA7517;
  --orange-lt:  #FAEEDA;
  --red:        #A32D2D;
  --red-lt:     #FCEBEB;
  --gray-100:   #F4F4F2;
  --gray-200:   #E5E5E2;
  --gray-400:   #9B9A95;
  --gray-700:   #444441;
  --border:     rgba(0,0,0,0.1);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.07);
  --radius:     8px;
  --radius-lg:  12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: var(--gray-700);
  background: var(--gray-100);
}

body { min-height: 100vh; }

/* ---- HEADER ---- */
.header {
  background: #fff;
  border-bottom: 0.5px solid var(--border);
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-left { display: flex; align-items: center; gap: 2rem; }
.header-right { display: flex; align-items: center; gap: 12px; }

.logo { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 600; color: var(--gray-700); white-space: nowrap; }
.logo-icon { width: 30px; height: 30px; background: var(--blue); border-radius: 7px; display: flex; align-items: center; justify-content: center; }

.nav { display: flex; gap: 2px; }
.nav-btn { padding: 6px 14px; font-size: 13px; border: none; background: none; color: var(--gray-400); cursor: pointer; border-radius: var(--radius); transition: all 0.15s; font-family: inherit; }
.nav-btn:hover { background: var(--gray-100); color: var(--gray-700); }
.nav-btn.active { background: var(--blue-lt); color: var(--blue); font-weight: 500; }

.user-info { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray-400); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--blue); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: #fff; flex-shrink: 0; }

/* ---- MAIN ---- */
.main-content { padding: 1.5rem; max-width: 1280px; margin: 0 auto; }
.page { display: none; }
.page.active { display: block; }

/* ---- LOGIN ---- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--gray-100); }
.login-wrap { width: 100%; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card { background: #fff; border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 2rem; width: 100%; max-width: 360px; box-shadow: var(--shadow-sm); }
.login-logo { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; margin-bottom: 1.5rem; }
.login-card h1 { font-size: 20px; font-weight: 600; margin-bottom: 0.25rem; }
.subtitle { font-size: 13px; color: var(--gray-400); margin-bottom: 1.5rem; }
.login-footer { text-align: center; font-size: 12px; color: var(--gray-400); margin-top: 1.5rem; padding-top: 1.5rem; border-top: 0.5px solid var(--border); }

/* ---- CARDS ---- */
.card { background: #fff; border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1rem; }
.card-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gray-400); margin-bottom: 1rem; }
.sticky-card { position: sticky; top: 70px; }

/* ---- GRIDS ---- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.metrics-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin-bottom: 1.5rem; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .metrics-grid { grid-template-columns: repeat(2,1fr); } }

/* ---- METRICS ---- */
.metric { background: var(--gray-100); border-radius: var(--radius); padding: 1rem; }
.metric-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-400); margin-bottom: 4px; }
.metric-value { font-size: 28px; font-weight: 600; color: var(--gray-700); }
.metric-value.warn { color: var(--orange); }

/* ---- FORMS ---- */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-400); margin-bottom: 5px; }
.required { color: var(--red); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=month], input[type=tel], select, textarea {
  width: 100%; padding: 8px 12px; border: 0.5px solid var(--border); border-radius: var(--radius);
  font-size: 14px; font-family: inherit; background: #fff; color: var(--gray-700); outline: none; transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(24,95,165,0.08); }
textarea { resize: vertical; line-height: 1.5; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.inline-form input, .inline-form select { flex: 1; min-width: 150px; width: auto; }

/* ---- BUTTONS ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; font-size: 13px; font-family: inherit; border: 0.5px solid var(--border); border-radius: var(--radius); background: #fff; color: var(--gray-700); cursor: pointer; transition: all 0.15s; text-decoration: none; }
.btn:hover { background: var(--gray-100); }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dk); border-color: var(--blue-dk); }
.btn-danger { color: var(--red); border-color: rgba(163,45,45,0.3); }
.btn-danger:hover { background: var(--red-lt); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-lg { padding: 10px 16px; font-size: 14px; }
.btn-row { display: flex; gap: 8px; }

/* ---- SECTION HEADER ---- */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; flex-wrap: wrap; gap: 8px; }
.section-header h2 { font-size: 20px; font-weight: 600; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters select, .filters input { width: auto; min-width: 140px; }

/* ---- STEP BAR ---- */
.step-bar { display: flex; align-items: center; margin-bottom: 1.5rem; }
.step { display: flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.step-num { width: 22px; height: 22px; border-radius: 50%; background: var(--gray-200); border: 0.5px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--gray-400); }
.step.active .step-num { background: var(--blue); color: #fff; border-color: var(--blue); }
.step.done .step-num { background: var(--green-lt); color: var(--green); border-color: var(--green); }
.step.active span { color: var(--gray-700); font-weight: 500; }
.step-line { flex: 1; height: 0.5px; background: var(--border); margin: 0 8px; min-width: 20px; }

/* ---- UPLOAD ZONE ---- */
.upload-zone { border: 1.5px dashed var(--gray-200); border-radius: var(--radius-lg); padding: 1.5rem; text-align: center; cursor: pointer; background: var(--gray-100); transition: all 0.15s; }
.upload-zone:hover { border-color: var(--blue); background: var(--blue-lt); }
.upload-icon { width: 44px; height: 44px; background: #fff; border: 0.5px solid var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; margin: 0 auto 0.75rem; color: var(--gray-400); }
.upload-zone p { font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.upload-zone span { font-size: 12px; color: var(--gray-400); }

.thumb-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1rem; }
.thumb { width: 72px; height: 90px; border-radius: 6px; border: 0.5px solid var(--border); overflow: hidden; position: relative; flex-shrink: 0; cursor: pointer; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-del { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: rgba(163,45,45,0.85); color: #fff; font-size: 12px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 2; }

/* ---- NOTE PILLS ---- */
.note-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 1rem; }
.pill { padding: 5px 14px; border-radius: 20px; font-size: 13px; border: 0.5px solid var(--border); background: #fff; cursor: pointer; font-family: inherit; color: var(--gray-700); transition: all 0.15s; }
.pill:hover { border-color: var(--blue); color: var(--blue); }
.pill.active { background: var(--blue-lt); color: var(--blue); border-color: var(--blue); font-weight: 500; }

/* ---- TABLE ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--gray-400); border-bottom: 0.5px solid var(--border); background: var(--gray-100); }
.data-table td { padding: 11px 14px; border-bottom: 0.5px solid var(--border); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-100); }
.data-table .loading { text-align: center; color: var(--gray-400); padding: 2rem; }

/* ---- BADGES ---- */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-ok { background: var(--green-lt); color: var(--green); }
.badge-warn { background: var(--orange-lt); color: var(--orange); }
.badge-danger { background: var(--red-lt); color: var(--red); }
.badge-blue { background: var(--blue-lt); color: var(--blue); }

/* ---- ALERTS ---- */
.alert { padding: 0.85rem 1rem; border-radius: var(--radius); font-size: 13px; margin-bottom: 1rem; display: flex; align-items: center; gap: 8px; }
.alert-success { background: var(--green-lt); color: var(--green); border: 0.5px solid rgba(59,109,17,0.2); }
.alert-danger  { background: var(--red-lt); color: var(--red); border: 0.5px solid rgba(163,45,45,0.2); }

/* ---- MAIL PREVIEW ---- */
.mail-preview { background: var(--gray-100); border-radius: var(--radius); padding: 1rem; font-size: 13px; }
.mail-row { display: flex; gap: 8px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 0.5px solid var(--border); }
.mail-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--gray-400); white-space: nowrap; padding-top: 1px; min-width: 40px; }
.mail-body { white-space: pre-wrap; line-height: 1.6; border-top: 0.5px solid var(--border); padding-top: 12px; margin-top: 4px; }
.attach-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--blue-lt); color: var(--blue); border-radius: 6px; padding: 4px 10px; font-size: 12px; margin: 4px 4px 0 0; }

/* ---- TABS ---- */
.tab-nav { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 0.5px solid var(--border); }
.tab-btn { padding: 10px 18px; font-size: 13px; border: none; background: none; color: var(--gray-400); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: inherit; transition: all 0.15s; }
.tab-btn:hover { color: var(--gray-700); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 500; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---- ACTIVITY BAR ---- */
.emp-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 0.5px solid var(--border); font-size: 13px; }
.emp-row:last-child { border-bottom: none; }
.bar { height: 6px; background: var(--blue); border-radius: 3px; min-width: 4px; }

/* ---- MODAL ---- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.65); z-index: 999; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-inner { position: relative; background: #fff; border-radius: var(--radius-lg); overflow: hidden; max-width: 90vw; max-height: 90vh; }
.modal-inner img { display: block; max-width: 85vw; max-height: 80vh; object-fit: contain; }
.modal-close { position: absolute; top: 8px; right: 10px; background: rgba(0,0,0,0.5); color: #fff; border: none; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 18px; display: flex; align-items: center; justify-content: center; z-index: 10; }
