:root {
  /* Palette Supabase Dark */
  --colors-scale1: #161616;
  --colors-scale2: #1c1c1c;
  --colors-scale3: #232323;
  --colors-scale4: #282828;
  --colors-scale5: #2e2e2e;
  --colors-scale6: #343434;
  --colors-scale7: #3e3e3e;
  --colors-scale8: #505050;
  --colors-scale9: #707070;
  --colors-scale10: #878787;
  --colors-scale11: #a0a0a0;
  --colors-scale12: #ededed;

  --colors-brand: #3ecf8e;
  --colors-brand-hover: #34b27b;
  --danger: #ef4444;
  --good: #22c55e;

  --sidebar-width: 260px;
  --header-height: 60px;
}

* { box-sizing: border-box; }

body {
  margin: 0; padding: 0;
  background-color: var(--colors-scale2);
  color: var(--colors-scale12);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  overflow: hidden;
}

a { text-decoration: none; color: inherit; }

/* Loader (overlay inside content only) */
.page-loader {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(22, 22, 22, 0.7);
  color: #3ecf8e;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.page-loader.visible { display: grid; opacity: 1; }
.page-loader.hidden { opacity: 0; }
.loader { width: 64px; height: 64px; }
.loader-svg { width: 100%; height: 100%; display: block; }
.loader-stroke {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-miterlimit: 10;
  stroke-dasharray: 230;
  stroke-dashoffset: 0;
  animation: w-elastic 2s ease-in-out infinite;
}
@keyframes w-elastic {
  0% { stroke-dasharray: 0, 230; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 230, 230; stroke-dashoffset: 0; }
  100% { stroke-dasharray: 0, 230; stroke-dashoffset: -230; }
}

/* --- LAYOUT GLOBAL --- */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* SIDEBAR (Navigation) */








.user-role { color: var(--colors-scale9); }





/* MAIN CONTENT */
.main-content {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  background-color: var(--colors-scale2);
  position: relative;
}

.top-header {
  height: var(--header-height);
  border-bottom: 1px solid var(--colors-scale4);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; background-color: var(--colors-scale2);
}

.page-title { font-size: 16px; font-weight: 600; color: var(--colors-scale12); }

/* FILTRES */
.filters-bar {
  display: flex; gap: 12px; align-items: center;
}

.filter-select {
  background: var(--colors-scale3);
  border: 1px solid var(--colors-scale5);
  color: var(--colors-scale11);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.filter-select:hover { border-color: var(--colors-scale7); color: var(--colors-scale12); }
.filter-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.date-input {
  background: var(--colors-scale3);
  border: 1px solid var(--colors-scale5);
  color: var(--colors-scale11);
  padding: 5px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
}

/* LISTE HISTORIQUE */
.content-scroll {
  flex: 1; overflow-y: auto; padding: 32px;
  display: flex; flex-direction: column; gap: 16px;
}

/* Scrollbar (fine + dark) */
.content-scroll {
  scrollbar-width: thin;
  scrollbar-color: var(--colors-scale6) transparent;
}
.content-scroll::-webkit-scrollbar { width: 6px; }
.content-scroll::-webkit-scrollbar-track { background: transparent; }
.content-scroll::-webkit-scrollbar-thumb {
  background-color: var(--colors-scale6);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.content-scroll::-webkit-scrollbar-corner { background: transparent; }

#historyList {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.history-item {
  background-color: var(--colors-scale3);
  border: 1px solid var(--colors-scale5);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}
.history-item:hover { border-color: var(--colors-scale7); }
.history-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(62, 207, 142, 0.9), rgba(62, 207, 142, 0.15));
}

.item-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0;
  font-size: 12px; color: var(--colors-scale10);
  gap: 10px;
  flex-wrap: wrap;
}

.qa-container {
  display: flex; flex-direction: column; gap: 16px;
}

.qa-box {
  padding: 16px 20px;
  border-radius: 6px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.q-box {
  background-color: var(--colors-scale4);
  color: var(--colors-scale12);
  border-left: 3px solid var(--colors-brand);
}

.a-box {
  background-color: var(--colors-scale2);
  color: var(--colors-scale11);
  border: 1px solid var(--colors-scale5);
}

.qa-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 700; margin-bottom: 8px; display: block;
}
.q-box .qa-label { color: var(--colors-brand); }
.a-box .qa-label { color: var(--colors-scale9); }

/* BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 99px;
  font-size: 11px; font-weight: 600;
  border: 1px solid transparent;
}
.badge.pos { background: rgba(34, 197, 94, 0.1); color: var(--good); border-color: rgba(34, 197, 94, 0.2); }
.badge.neg { background: rgba(239, 68, 68, 0.1); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.badge.neu { background: var(--colors-scale4); color: var(--colors-scale10); border-color: var(--colors-scale5); }

.btn-load-more {
  align-self: center;
  background: var(--colors-scale4);
  color: var(--colors-scale11);
  border: 1px solid var(--colors-scale5);
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  margin-top: 20px;
}
.btn-load-more:hover { background: var(--colors-scale5); color: var(--colors-scale12); }
.btn-load-more:disabled { opacity: 0.5; cursor: not-allowed; }

/* Mobile */
@media (max-width: 1000px) {
  .app-container { flex-direction: column; }
  

/* Sidebar collapsed */
body
body
body
body
body
body
body
body
