@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&family=Plus+Jakarta+Sans:wght@400;500;700;800&display=swap');

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

:root {
  --gold: #F4B400;
  --gold-dark: #C99300;
  --green: #1E5631;
  --green-light: #2D8C4E;
  --alert: #D62828;
  --bg: #F4F2EC;
  --surface: #FFFFFF;
  --border: #E5E1D8;
  --text: #1A1A1A;
  --muted: #888;
  --sidebar-w: 220px;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.hidden { display: none !important; }

/* ── AUTH ── */
.admin-auth {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1a0c02 0%, #2e1a05 100%);
  padding: 24px;
}
.admin-auth-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(201,162,39,0.25);
  border-radius: 24px;
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.admin-auth-logo { font-size: 48px; margin-bottom: 10px; }
.admin-auth-card h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: #F4B400;
  margin-bottom: 4px;
}
.admin-auth-card h1 span {
  background: rgba(244,180,0,0.15);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 14px;
  vertical-align: middle;
}
.admin-auth-card > p {
  font-size: 12px;
  color: rgba(244,180,0,0.5);
  margin-bottom: 28px;
}
.adm-hint {
  font-size: 11px;
  color: rgba(255,255,255,0.3);
  margin-top: 14px !important;
}
.adm-error { color: #f05050; font-size: 12px; min-height: 16px; margin: 8px 0; }

/* ── LAYOUT ── */
#admin-app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.admin-sidebar {
  width: var(--sidebar-w);
  background: #1a0c02;
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.admin-brand-icon { font-size: 28px; }
.admin-brand-name {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: #F4B400;
  letter-spacing: 1px;
}
.admin-brand-role { font-size: 10px; color: rgba(255,255,255,0.4); }

.admin-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.admin-nav-item:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.85); }
.admin-nav-item.active { background: rgba(244,180,0,0.15); color: #F4B400; }
.admin-nav-item span { font-size: 16px; }

.admin-sidebar-footer {
  padding: 16px 16px 0;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.admin-link-op {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  text-align: center;
}
.admin-link-op:hover { color: rgba(255,255,255,0.7); }
.adm-logout-btn {
  background: rgba(214,40,40,0.15);
  border: 1px solid rgba(214,40,40,0.3);
  color: #f05050;
  border-radius: 8px;
  padding: 8px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 700;
}
.adm-logout-btn:hover { background: rgba(214,40,40,0.25); }

/* ── MAIN ── */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

.admin-mobile-nav { display: none; }

.admin-tab { display: none; }
.admin-tab.active { display: block; }

/* ── PAGE HEADER ── */
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.admin-page-header h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}
.adm-live-badge {
  background: rgba(30,86,49,0.12);
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 1px;
}
.adm-subtitle { font-size: 13px; color: var(--muted); }

/* ── KPI GRID ── */
.adm-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.adm-kpi-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 18px 20px;
  border-top: 4px solid var(--green);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.adm-kpi-card.gold  { border-top-color: var(--gold); }
.adm-kpi-card.red   { border-top-color: var(--alert); }
.adm-kpi-card.blue  { border-top-color: #3b82f6; }
.adm-kpi-card.purple{ border-top-color: #7c3aed; }
.adm-kpi-lbl {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}
.adm-kpi-val {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  display: block;
  margin-bottom: 4px;
}
.adm-kpi-sub { font-size: 11px; color: var(--muted); }

/* ── CARD ── */
.adm-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  margin-bottom: 20px;
}
.adm-card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 14px;
  color: var(--text);
}

/* ── ROW 2 ── */
.adm-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── FORM ── */
.admin-form-group { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.admin-form-group label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.admin-form-group input,
.admin-form-group select {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fafaf8;
  transition: border-color 0.15s;
}
.admin-form-group input:focus,
.admin-form-group select:focus {
  outline: none;
  border-color: var(--gold);
}
.admin-form-group small { font-size: 10px; color: var(--muted); }
.adm-optional { color: var(--muted); font-weight: 400; font-size: 10px; }

/* Auth card inputs override */
.admin-auth-card .admin-form-group {
  text-align: left;
  margin-bottom: 14px;
}
.admin-auth-card .admin-form-group label { color: rgba(244,180,0,0.7); }
.admin-auth-card .admin-form-group input {
  background: rgba(255,255,255,0.9);
  color: #1a0c02;
  font-weight: 700;
}
.admin-auth-card button {
  width: 100%;
  padding: 13px;
  background: var(--gold);
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  color: #1a0c02;
  margin-top: 8px;
}

/* ── BUTTONS ── */
.adm-btn-primary {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.adm-btn-primary:hover { background: var(--green-light); }
.adm-btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.adm-btn-sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-weight: 700;
}
.adm-btn-edit { background: #eff6ff; color: #2563eb; }
.adm-btn-delete { background: #fef2f2; color: var(--alert); }

/* ── TABLE ── */
.adm-table-wrapper { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th {
  text-align: left;
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.adm-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.adm-table tbody tr:hover { background: #fafaf6; }
.adm-table tbody tr:last-child td { border-bottom: none; }

.adm-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
}
.adm-badge-green { background: #e8f5ed; color: var(--green); }
.adm-badge-red   { background: #fdeaea; color: var(--alert); }
.adm-badge-gold  { background: #fef9e7; color: var(--gold-dark); }
.adm-badge-gray  { background: #f3f4f6; color: var(--muted); }
.adm-badge-blue  { background: #e8f0fe; color: #1a73e8; }

/* ── FILTERS ── */
.adm-filters { margin-bottom: 14px; }
.adm-filters-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.adm-filters select {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  background: #fafaf8;
  color: var(--text);
}
.adm-journal-meta { margin-bottom: 10px; }

/* Opérateur pill dans le journal */
.adm-op-pill {
  display: inline-block;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

/* ── GOLD CARD ── */
.adm-gold-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.adm-gold-kpi { text-align: center; }
.adm-gold-kpi .val {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--gold-dark);
}
.adm-gold-kpi .lbl { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.adm-arb-bar-bg { background: #f3f4f6; border-radius: 99px; height: 8px; overflow: hidden; }
.adm-arb-bar { background: linear-gradient(90deg, var(--gold), var(--gold-dark)); height: 8px; border-radius: 99px; transition: width 0.5s; }

/* ── LIVE GOLD PRICE TABLE (admin dashboard) ── */
.adm-gold-live-header,
.adm-gold-live-row {
  display: grid;
  grid-template-columns: 70px 1fr 1fr;
  gap: 4px;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.adm-gold-live-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-color: rgba(0,0,0,0.1);
  margin-bottom: 2px;
}
.adm-gold-live-row:last-of-type { border-bottom: none; }
.adm-gold-live-row span:first-child { font-weight: 700; font-size: 12px; }
.adm-gold-live-row span:nth-child(2) { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 15px; }
.adm-gold-live-row span:nth-child(3) { font-family: 'Outfit', sans-serif; font-size: 13px; color: var(--muted); }
.adm-gold-live-row-xaf span { color: var(--gold-dark) !important; font-weight: 800 !important; }

/* ── TOP PRODUCTS ── */
.adm-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.adm-top-row:last-child { border-bottom: none; }
.adm-top-rank { font-size: 18px; width: 28px; }
.adm-top-name { flex: 1; font-weight: 700; font-size: 13px; }
.adm-top-val { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 14px; color: var(--green); }

/* ── PAYMENT SPLIT ── */
.adm-split-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.adm-split-label { font-size: 12px; font-weight: 700; width: 80px; }
.adm-split-bar-bg { flex: 1; background: #f3f4f6; border-radius: 99px; height: 10px; overflow: hidden; }
.adm-split-bar { height: 10px; border-radius: 99px; }
.adm-split-pct { font-size: 11px; font-weight: 800; width: 36px; text-align: right; }

/* ── PRODUCT FORM GRID ── */
.adm-product-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

/* ── MARGE PILL ── */
.marge-pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 800;
}
.marge-high { background: #e8f5ed; color: var(--green); }
.marge-mid  { background: #fef9e7; color: var(--gold-dark); }
.marge-low  { background: #f3f4f6; color: var(--muted); }
.marge-neg  { background: #fde8e8; color: var(--alert); }

/* ── PRODUCT FORM INTRO ── */
.pf-intro {
  font-size: 12px;
  color: var(--muted);
  background: #fef9e7;
  border-left: 3px solid var(--gold);
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.pf-intro strong { color: var(--text); }

/* ── MARGE PREVIEW ── */
.pf-marge-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-top: 4px;
  margin-bottom: 8px;
  transition: all 0.2s;
}
.pf-marge-ok  { background: #e8f5ed; color: var(--green); }
.pf-marge-bad { background: #fde8e8; color: var(--alert); }
.pf-marge-preview strong { font-size: 15px; font-weight: 800; }

/* ── INFO TOOLTIP ── */
.adm-info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: var(--muted);
  color: #fff;
  border-radius: 50%;
  font-size: 9px;
  font-style: normal;
  font-weight: 700;
  cursor: help;
  position: relative;
  margin-left: 3px;
  vertical-align: middle;
  flex-shrink: 0;
}
.adm-info-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 400;
  white-space: normal;
  width: 260px;
  text-align: left;
  line-height: 1.5;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.adm-info-tip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1a1a2e;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.adm-info-tip:hover::after,
.adm-info-tip:hover::before { opacity: 1; }

/* ── CAMP CARDS ── */
.adm-camp-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 14px;
}
.adm-camp-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}
.adm-camp-card-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
  display: block;
}
.adm-camp-card-loc {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-top: 2px;
}
.adm-camp-card-ops {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  min-height: 24px;
}
.adm-camp-op-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e8f5ed;
  color: var(--green);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
}
.adm-camp-op-pill em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}
.adm-camp-card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.adm-btn-ghost2 {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--text);
  transition: background 0.15s;
}
.adm-btn-ghost2:hover { background: var(--border); }
.adm-assign-form {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.adm-assign-select {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  background: #fafaf8;
  color: var(--text);
}
.adm-assign-select:focus { outline: none; border-color: var(--gold); }

/* ── RESPONSIVE MOBILE ── */
@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; padding: 16px 16px 80px; }

  .admin-mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #1a0c02;
    justify-content: space-around;
    padding: 10px 0;
    z-index: 100;
  }
  .admin-mobile-nav button {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
  }

  .adm-row-2 { grid-template-columns: 1fr; }
  .adm-product-form-grid { grid-template-columns: 1fr; }
  .adm-kpi-grid { grid-template-columns: 1fr 1fr; }
}
