@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --bg:         #D8D4D8;
  --bg-2:       #FFFFFF;
  --bg-3:       #EAE6EA;
  --border:     #E0DCE0;
  --border-2:   #C8C4C8;
  --text:       #111111;
  --text-2:     #555555;
  --text-3:     #707070;
  --accent:     #55D8A6;
  --accent-2:   #35B885;
  --accent-bg:  rgba(85, 216, 166, 0.12);
  --compl:      #D85587;
  --blue:       #2060C0;
  --blue-bg:    #EDF3FF;
  --green:      #1A7A45;
  --green-bg:   #EDFAF4;
  --yellow:     #8A6800;
  --yellow-bg:  #FFFBEA;
  --orange:     #9A4210;
  --orange-bg:  #FFF4ED;
  --red:        #B03030;
  --danger:     #B03030;
  --red-bg:     #FEECEC;
  --purple:     #5030B0;
  --purple-bg:  #F0EEFF;
  --sidebar-w:  200px;
  --radius:     8px;
  --radius-sm:  4px;
  --shadow:     none;
  --shadow-sm:  none;
}

[data-theme="dark"] {
  --bg:         #0f1117;
  --bg-2:       #171b26;
  --bg-3:       #1e2435;
  --border:     #2a3147;
  --border-2:   #3a4560;
  --text:       #e8ecf5;
  --text-2:     #8b96b5;
  --text-3:     #7e8aaa;
}

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

input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; cursor: pointer; flex-shrink: 0; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  line-height: 1.2;
}

a { color: var(--accent-2); text-decoration: none; transition: color .15s; }
a:hover { color: var(--text); }

/* ---- LAYOUT ---- */
.app-wrapper { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sidebar-w);
  background: #2A9E7A;
  border-right: none;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 16px 16px;
}

.sidebar-logo .logo-mark {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.logo-text {
  font-family: 'Barlow', sans-serif;
  font-size: 14px;
  color: #FFFFFF;
  letter-spacing: .2px;
}

.logo-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  font-weight: 400;
  letter-spacing: .5px;
  text-transform: uppercase;
  margin-top: 1px;
}

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

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.5);
  padding: 8px 16px 4px;
  margin-top: 8px;
}

.nav-sep {
  height: 16px;
  display: flex;
  align-items: center;
  padding: 0 20px;
}
.nav-sep::after {
  content: '';
  display: block;
  width: 100%;
  height: 1px;
  background: rgba(255,255,255,0.25);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 12px;
  margin: 0 8px;
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 500;
  font-family: 'Barlow', sans-serif;
  letter-spacing: .3px;
  border-radius: var(--radius);
  transition: all .15s;
  cursor: pointer;
  opacity: 0.75;
}

.nav-link:hover {
  opacity: 1;
  font-weight: 600;
  color: #FFFFFF;
}

.nav-link.active {
  opacity: 1;
  background: #D85587;
  font-weight: 600;
}

.nav-link svg { width: 15px; height: 15px; flex-shrink: 0; }
.nav-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: 12px 16px;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-avatar {
  width: 30px; height: 30px;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #FFFFFF;
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 500; color: #FFFFFF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.6); }

.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- TOPBAR ---- */
.topbar {
  height: 60px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 18px; font-weight: 600; font-family: 'Barlow', sans-serif; letter-spacing: .4px; color: #D85587; }
.topbar-title svg { width: 18px; height: 18px; flex-shrink: 0; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.page-content { flex: 1; padding: 12px 24px 24px; }

/* ---- CARDS ---- */
.card {
  background: var(--bg-2);
  border: none;
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 10px 16px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card.is-collapsed .card-header { border-bottom: none; }

.card-title { font-size: 15px; font-weight: 600; font-family: 'Barlow', sans-serif; letter-spacing: .3px; display: inline-flex; align-items: center; gap: 6px; }
.card-title svg { width: 15px; height: 15px; flex-shrink: 0; }
.card-body { padding: 16px; }
.card-collapse-btn { background:none; border:none; cursor:pointer; color:var(--text-3); padding:2px; display:flex; align-items:center; flex-shrink:0; }
.card-collapse-btn:hover { color:var(--text-2); }
.card-collapse-btn svg { width:16px; height:16px; transition:transform .2s; }

.card tr:last-child td,
.card tr:last-child th,
.card > *:last-child,
.card-body > *:last-child { border-bottom: none !important; }
.card::after { content: ''; display: block; height: 1px; }

/* ---- STATS ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent);
}

.stat-card.blue::before   { background: var(--blue); }
.stat-card.green::before  { background: var(--green); }
.stat-card.yellow::before { background: var(--yellow); }
.stat-card.purple::before { background: var(--purple); }

.stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-3); font-weight: 600; margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; font-family: 'Barlow', sans-serif; line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text-2); margin-top: 5px; }

/* ---- BUTTONS ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  font-family: 'Barlow', sans-serif;
  letter-spacing: .2px;
  border: none;
  outline: none;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
  line-height: normal;
  vertical-align: middle;
  box-sizing: border-box;
}

.btn:focus { outline: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary { background: var(--accent); color: #FFFFFF; }
.btn-primary:hover { background: var(--accent-2); color: #FFFFFF; }

.btn-secondary { background: var(--bg-2); color: var(--text-2); }
.btn-secondary:hover { background: var(--bg-3); color: var(--text); }

.btn-danger { background: #E05050; color: #FFFFFF; }
.btn-danger:hover { background: var(--red); color: #FFFFFF; }
.btn-success { background: var(--green); color: #FFFFFF; }
.btn-success:hover { background: #155f36; color: #FFFFFF; }

.btn-outline { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover { background: var(--accent-bg); color: var(--accent); }

.btn-sm { padding: 4px 7px; font-size: 12px; line-height: 1; }
.btn-sm.btn-send { padding: 3px 6px; }

.btn-icon { padding: 6px; }

form.btn-form { display: inline-flex; vertical-align: middle; margin: 0; }

.btn-add-topbar { display:inline-flex;align-items:center;gap:6px;padding:8px 14px;background:var(--bg-2);border:1px solid var(--border);border-radius:8px;font-size:13px;font-weight:700;font-family:inherit;line-height:1;cursor:pointer;text-decoration:none;white-space:nowrap; }
.btn-add-topbar .add-plus  { color:var(--accent-2);font-weight:700;font-size:16px;font-family:'Barlow',sans-serif;line-height:1; }
.btn-add-topbar .add-label { color:var(--text-2); }
.btn-add-topbar:hover .add-label { color:var(--accent-2); }

/* ---- FORMS ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 10px; font-weight: 600; color: var(--text-3); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .6px; }
.form-label span.req { color: var(--accent); }

.form-control {
  width: 100%;
  background: var(--bg-2);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 7px 11px;
  transition: border-color .15s;
  outline: none;
}

.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.form-control::placeholder { color: var(--text-3); }

textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.form-full { grid-column: 1 / -1; }

/* ---- TABLE ---- */
.table-wrapper { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  font-size: 11px;
  font-weight: 600;
  font-family: 'Barlow', sans-serif;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-2);
  padding: 9px 14px;
  text-align: left;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-2);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--accent-bg); color: var(--text); }
td a { color: var(--text); font-weight: 500; }
td a:hover { color: var(--accent-2); }

/* ---- BADGES ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  font-family: 'Barlow', sans-serif;
  white-space: nowrap;
}

.fiche-num {
  display: inline-block;
  background: var(--compl);
  color: #fff;
  font-family: 'Barlow', sans-serif;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .3px;
  border-radius: 5px;
  padding: 2px 8px;
  cursor: pointer;
  user-select: none;
}

.badge-gray   { background: var(--bg-3);        color: var(--text-2); }
.badge-yellow { background: var(--yellow-bg);   color: var(--yellow); }
.badge-orange { background: var(--orange-bg);   color: var(--orange); }
.badge-blue   { background: var(--blue-bg);     color: var(--blue); }
.badge-purple { background: var(--purple-bg);   color: var(--purple); }
.badge-green  { background: var(--green-bg);    color: var(--green); }
.badge-red    { background: var(--red-bg);      color: var(--red); }
.badge-accent { background: var(--accent-bg);   color: var(--accent-2); }
.badge-sky    { background: #ddf4f9;            color: #64C7DE; }
.badge-coral  { background: #fce9e8;            color: #D9443B; }
.badge-brown  { background: rgba(154,66,16,.1); color: #7A3A10; }

/* ---- PILLS (statuts avec dot) ---- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.pill::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pill-green  { background: #EDFAF4; color: #1A7A45; }
.pill-green::before  { background: #2ECC7A; }

.pill-blue   { background: #EDF3FF; color: #2060C0; }
.pill-blue::before   { background: #4A90E2; }

.pill-red    { background: #FEECEC; color: #B03030; }
.pill-red::before    { background: #E05555; }

.pill-gray   { background: #F2F2F2; color: #888888; }
.pill-gray::before   { background: #BBBBBB; }

.pill-purple { background: #F0EEFF; color: #5030B0; }
.pill-purple::before { background: #8B5CF6; }

.pill-yellow { background: #FFFBEA; color: #8A6800; }
.pill-yellow::before { background: #FFD600; }

.pill-orange { background: #FFF4ED; color: #9A4210; }
.pill-orange::before { background: #FB923C; }

/* ---- SEARCH & FILTERS ---- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-2);
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  flex: 1;
  max-width: 340px;
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-family: 'Barlow', sans-serif;
  font-size: 13px;
  width: 100%;
}

.search-bar input::placeholder { color: var(--text-3); }
.search-bar svg { color: var(--text-3); width: 14px; height: 14px; flex-shrink: 0; }

.filters-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  background: var(--bg-2);
  border-radius: var(--radius);
  padding: 14px 20px;
}

/* ---- FLASH MESSAGES ---- */
.alert {
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 3px solid;
}

.alert-success { background: var(--green-bg);  color: var(--green);  border-color: var(--green); }
.alert-error   { background: var(--red-bg);    color: var(--red);    border-color: var(--red); }
.alert-info    { background: var(--blue-bg);   color: var(--blue);   border-color: var(--blue); }
.alert-warning { background: var(--yellow-bg); color: var(--yellow); border-color: var(--yellow); }

/* ---- PAGINATION ---- */
.pagination { display: flex; gap: 4px; align-items: center; margin-top: 16px; }
.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  transition: all .15s;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent-2); }
.pagination span.current { background: var(--accent); border-color: var(--accent); color: #FFFFFF; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  animation: fadeIn .15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.modal {
  background: var(--bg-2);
  border-radius: var(--radius);
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp .2s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 15px; font-weight: 600; font-family: 'Barlow', sans-serif; letter-spacing: .3px; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 14px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { background: none; border: none; color: var(--text-3); cursor: pointer; padding: 4px; border-radius: var(--radius-sm); }
.modal-close:hover { color: var(--text); background: var(--bg-3); }

/* ---- TABS ---- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}
.tab-link svg { width: 14px; height: 14px; flex-shrink: 0; }
.icon-inline { display: inline-flex; align-items: center; gap: 5px; }
.icon-inline svg { width: 15px; height: 15px; flex-shrink: 0; }
.tab-link:hover { color: var(--text); }
.tab-link.active { color: var(--accent-2); font-weight: 600; background: white; border-bottom: 2px solid white; border-radius: var(--radius) var(--radius) 0 0; }

/* ---- TABS SECONDARY (segmented control) ---- */
.tabs-secondary { display: inline-flex; gap: 3px; background: var(--bg-3); padding: 3px; border-radius: var(--radius); border-bottom: none; margin-bottom: 16px; }
.tabs-secondary .tab-link { font-size: 12px; padding: 5px 14px; border-bottom: none; margin-bottom: 0; border-radius: calc(var(--radius) - 2px); color: var(--text-2); font-weight: 500; }
.tabs-secondary .tab-link:hover { color: var(--text); background: rgba(0,0,0,.04); }
.tabs-secondary .tab-link.active { background: var(--bg-2); color: var(--text); font-weight: 600; border-bottom: none; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
}

.empty-state svg { width: 40px; height: 40px; opacity: .25; margin-bottom: 12px; }
.empty-state h3 { font-size: 14px; color: var(--text-2); margin-bottom: 6px; }
.empty-state p { font-size: 12px; }

/* ---- CALENDAR ---- */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.cal-day-header {
  background: var(--bg-3);
  padding: 7px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-3);
}

.cal-day {
  background: var(--bg-2);
  min-height: 80px;
  padding: 7px;
  cursor: pointer;
  transition: background .1s;
}

.cal-day:hover { background: var(--accent-bg); }
.cal-day.other-month .day-num { color: var(--text-3); }
.cal-day.today { background: var(--accent-bg); }
.cal-day.today .day-num { color: var(--accent-2); font-weight: 700; }

.day-num { font-size: 12px; font-weight: 500; margin-bottom: 4px; }

.cal-event {
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 3px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

/* ---- LOGIN ---- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-box {
  width: 100%;
  max-width: 400px;
  padding: 24px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- UTILITIES ---- */
.flex          { display: flex; }
.flex-1        { flex: 1; }
.flex-center   { display: flex; align-items: center; }
.flex-between  { display: flex; align-items: center; justify-content: space-between; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.text-sm     { font-size: 11px; }
.text-xs     { font-size: 10px; }
.text-muted  { color: var(--text-3); }
.text-accent { color: var(--accent-2); }
.section-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-bottom: 10px;
}
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.font-bold  { font-weight: 700; }
.truncate   { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full     { width: 100%; }
.hidden     { display: none !important; }

/* Suggestions — score hover tooltip */
.sugg-score-wrap { position:relative; display:inline-flex; align-items:center; gap:8px; cursor:default; }
.sugg-signals { display:none; position:fixed; background:var(--bg-2); border:1px solid var(--border); border-radius:6px; padding:6px 10px; min-width:160px; z-index:200; white-space:nowrap; box-shadow:0 2px 8px rgba(0,0,0,.08); }
.sig-item { display:block; font-size:11px; line-height:1.6; }
.sig-pos  { color:var(--compl); }
.sig-neg  { color:var(--compl); }

