:root {
  --navy:       #1a2e4a;
  --navy-light: #24405f;
  --amber:      #f59e0b;
  --amber-dark: #d97706;
  --bg:         #f1f5f9;
  --card:       #ffffff;
  --text:       #1e293b;
  --muted:      #64748b;
  --border:     #e2e8f0;
  --success:    #10b981;
  --warning:    #f59e0b;
  --danger:     #ef4444;
  --info:       #3b82f6;
  --radius:     12px;
  --shadow:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:  0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

/* ── TOPBAR ── */
.topbar {
  background: var(--navy);
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand-logo {
  width: 32px; height: 32px;
  background: var(--amber);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px; color: var(--navy);
}
.brand-name { color: #fff; font-weight: 700; font-size: 16px; }
.main-nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.main-nav a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
  white-space: nowrap;
}
.main-nav a:hover, .main-nav a.active {
  background: var(--navy-light);
  color: #fff;
}
.main-nav a.active { color: var(--amber); }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--amber);
  color: var(--navy);
  font-weight: 700; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.user-name { color: rgba(255,255,255,.85); font-size: 13px; }
.btn-logout {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.75);
  border: none; border-radius: 6px;
  padding: 5px 10px; font-size: 12px;
  cursor: pointer; text-decoration: none;
  transition: all .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.2); color: #fff; }

/* ── LAYOUT ── */
.content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}
.page-title { font-size: 22px; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: 13px; color: var(--muted); margin-top: 2px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ── CARDS ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px; font-weight: 700;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}

/* ── KPIs ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border-left: 4px solid var(--navy);
}
.kpi.amber  { border-left-color: var(--amber); }
.kpi.green  { border-left-color: var(--success); }
.kpi.red    { border-left-color: var(--danger); }
.kpi.blue   { border-left-color: var(--info); }
.kpi-value  { font-size: 24px; font-weight: 700; line-height: 1.2; }
.kpi-label  { font-size: 11px; font-weight: 600; text-transform: uppercase;
              letter-spacing: .05em; color: var(--muted); margin-top: 4px; }
.kpi-delta  { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600;
  border: none; cursor: pointer;
  text-decoration: none; transition: all .15s;
  white-space: nowrap;
}
.btn-primary  { background: var(--amber); color: #fff; }
.btn-primary:hover { background: var(--amber-dark); }
.btn-navy     { background: var(--navy); color: #fff; }
.btn-navy:hover { background: var(--navy-light); }
.btn-light    { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-light:hover { background: var(--border); }
.btn-success  { background: var(--success); color: #fff; }
.btn-danger   { background: #fee2e2; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-ghost    { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--text); }
.btn-sm       { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-block    { width: 100%; justify-content: center; }
.btn-icon     { padding: 7px; border-radius: 8px; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge-green  { background: #d1fae5; color: #065f46; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-gray   { background: #e2e8f0; color: #475569; }
.badge-navy   { background: var(--navy); color: #fff; }

/* ── FORMS ── */
.form-group   { margin-bottom: 16px; }
.form-label   { display: block; font-size: 12px; font-weight: 600;
                color: var(--muted); margin-bottom: 6px; text-transform: uppercase;
                letter-spacing: .04em; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 14px;
  color: var(--text); background: #fff;
  transition: border-color .15s;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--navy); }
.form-control::placeholder { color: #b0bec5; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.form-hint { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  text-align: left; white-space: nowrap;
}
td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: #f8fafc; }

/* ── PROGRESS ── */
.progress { height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: var(--amber); transition: width .3s; }
.progress-fill.green { background: var(--success); }
.progress-fill.red   { background: var(--danger); }
.progress-fill.blue  { background: var(--info); }

/* ── KANBAN ── */
.kanban-wrap { overflow-x: auto; padding-bottom: 16px; }
.kanban-board { display: flex; gap: 16px; min-width: max-content; align-items: flex-start; }
.kanban-col {
  width: 280px; flex-shrink: 0;
  background: #f8fafc;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.kanban-col-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.kanban-col-title {
  font-size: 13px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.stage-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.kanban-col-count {
  font-size: 11px; color: var(--muted);
  background: var(--border); padding: 2px 7px; border-radius: 999px;
}
.kanban-cards { padding: 12px; display: flex; flex-direction: column; gap: 10px; min-height: 100px; }
.kanban-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 14px;
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
  border-left: 3px solid var(--amber);
  text-decoration: none;
  color: var(--text);
  display: block;
}
.kanban-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kanban-card.won  { border-left-color: var(--success); }
.kanban-card.lost { border-left-color: var(--danger); opacity: .6; }
.kanban-card-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; line-height: 1.3; }
.kanban-card-company { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.kanban-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.kanban-card-value { font-size: 13px; font-weight: 700; color: var(--navy); }
.kanban-col-total {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 12px; font-weight: 700;
  color: var(--muted);
}
.kanban-add {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px; margin: 0 12px 12px;
  border-radius: 8px; border: 1.5px dashed var(--border);
  color: var(--muted); font-size: 12px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: all .15s;
}
.kanban-add:hover { border-color: var(--amber); color: var(--amber); background: #fffbf0; }

/* ── MODAL ── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1000;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
}
.modal-lg { max-width: 800px; }
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
  background: none; border: none; font-size: 20px;
  cursor: pointer; color: var(--muted); padding: 4px;
  border-radius: 6px; line-height: 1;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* ── SIDEBAR (fiche opportunité) ── */
.opp-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.opp-sidebar { display: flex; flex-direction: column; gap: 16px; }

/* ── ALERTS ── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin-bottom: 16px; }

/* ── TABS ── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 8px 16px; font-size: 13px; font-weight: 600;
  border: none; background: none; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s;
}
.tab-btn.active { color: var(--navy); border-bottom-color: var(--navy); }
.tab-btn:hover  { color: var(--text); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── ACTIVITY FEED ── */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
  display: flex; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-icon-wrap {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--bg); display: flex;
  align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.activity-content { flex: 1; }
.activity-subject { font-weight: 600; font-size: 13px; }
.activity-meta    { font-size: 11px; color: var(--muted); margin-top: 2px; }
.activity-notes   { font-size: 12px; color: var(--text); margin-top: 4px;
                    background: var(--bg); padding: 6px 10px; border-radius: 6px; }

/* ── SEARCH ── */
.search-bar { position: relative; }
.search-bar input { padding-left: 36px; }
.search-bar::before {
  content: '🔍';
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%); font-size: 14px;
  pointer-events: none;
}

/* ── LOGIN PAGE ── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: var(--navy);
}
.login-card {
  background: #fff; border-radius: 16px;
  padding: 40px; width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo {
  text-align: center; margin-bottom: 28px;
}
.login-logo-icon {
  width: 56px; height: 56px; border-radius: 14px;
  background: var(--amber); margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 800; color: var(--navy);
}
.login-logo h1 { font-size: 20px; font-weight: 700; }
.login-logo p  { font-size: 13px; color: var(--muted); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .topbar-inner { padding: 0 16px; gap: 12px; }
  .main-nav { display: none; }
  .content  { padding: 16px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .opp-layout { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; }
  .kanban-col { width: 250px; }
  .modal { margin: 0; border-radius: 16px 16px 0 0; max-height: 95vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .form-row { grid-template-columns: 1fr; }

  /* Menu mobile hamburger */
  .nav-mobile-toggle { display: flex !important; }
  .mobile-nav {
    position: fixed; inset: 60px 0 0 0;
    background: var(--navy); z-index: 99;
    flex-direction: column; padding: 16px;
    gap: 4px; display: none;
  }
  .mobile-nav.open { display: flex; }
  .mobile-nav a {
    color: rgba(255,255,255,.85); text-decoration: none;
    padding: 12px 16px; border-radius: 8px;
    font-size: 14px; font-weight: 500;
  }
  .mobile-nav a:hover { background: var(--navy-light); }
}
@media (min-width: 769px) {
  .nav-mobile-toggle { display: none !important; }
}

/* ── UTILS ── */
.text-muted   { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-amber   { color: var(--amber); }
.text-navy    { color: var(--navy); }
.fw-bold      { font-weight: 700; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex  { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center  { display: flex; align-items: center; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Fix menu mobile masqué sur desktop */
.mobile-nav { display: none !important; }
@media (max-width: 768px) {
  .mobile-nav.open { display: flex !important; }
}

/* BCE lookup improvements */
.bce-loading { display:inline-block; animation: spin 1s linear infinite; }
@keyframes spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }

/* Recherche globale */
.global-search-input::placeholder { color: rgba(255,255,255,.6) !important; }
.global-search-input:focus {
  background: rgba(255,255,255,.25) !important;
  border-color: rgba(255,255,255,.5) !important;
}
