/* GEO Benchmark — design system AudienceLab (tokens et composants partagés) */
:root {
  --bg:   #f0f2f5;
  --bg2:  #e8eaef;
  --bg3:  #dde1ea;
  --bg4:  #d0d4de;

  --border:  rgba(0,0,0,0.09);
  --border2: rgba(0,0,0,0.16);

  --text:  #1a1d2a;
  --text2: #4a4f68;
  --text3: #8a8fa8;

  --accent:  #6c63ff;
  --accent2: #9b8cff;
  --teal:    #00c9a7;
  --coral:   #ff6b6b;
  --amber:   #ffa952;
  --blue:    #4f9cf9;
  --green:   #52d68a;

  --accent-bg: rgba(108,99,255,0.10);
  --teal-bg:   rgba(0,201,167,0.10);
  --coral-bg:  rgba(255,107,107,0.10);
  --amber-bg:  rgba(255,169,82,0.10);
  --blue-bg:   rgba(79,156,249,0.10);
  --green-bg:  rgba(82,214,138,0.10);

  --font: 'DM Sans', sans-serif;
  --mono: 'DM Mono', monospace;

  --radius:    10px;
  --radius-lg: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }
h1 { font-size: 20px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
.mono { font-family: var(--mono); }
.muted { color: var(--text3); }
.small { font-size: 12px; }

/* Layout app */
.app  { display: grid; grid-template-rows: 56px 1fr; height: 100vh; overflow: hidden; }
.main { display: grid; grid-template-columns: 216px 1fr; overflow: hidden; }
.sidebar { background: var(--bg2); border-right: 1px solid var(--border); padding: 14px 10px; display: flex; flex-direction: column; justify-content: space-between; overflow-y: auto; }
.content { overflow-y: auto; padding: 24px 28px 48px; }
.content > .wrap { max-width: 1280px; margin: 0 auto; }

/* Topbar */
.topbar { display: flex; align-items: center; gap: 16px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--border); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; min-width: 260px; }
.logo .crumb { font-size: 10px; color: var(--text3); font-weight: 400; margin-left: 8px; }
.topbar-center { flex: 1; display: flex; align-items: center; gap: 8px; max-width: 520px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 12px; height: 34px; }
.topbar-center input { flex: 1; border: 0; background: transparent; font: inherit; color: var(--text); outline: none; }
.search-icon { color: var(--text3); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }

/* Sidebar */
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius); color: var(--text2); font-weight: 500; }
.nav-item:hover { background: var(--bg3); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); }
.nav-ico { width: 18px; text-align: center; color: var(--text3); }
.nav-item.active .nav-ico { color: var(--accent); }

/* Boutons */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius); border: 1px solid var(--border2); background: #fff; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { background: var(--bg3); color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.btn-danger { color: var(--coral); border-color: rgba(255,107,107,0.4); }
.btn-danger:hover { background: var(--coral-bg); color: var(--coral); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { border: 0; background: transparent; cursor: pointer; font-size: 16px; padding: 4px 8px; border-radius: var(--radius); }

/* Cartes et grilles */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 20px; margin-bottom: 18px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-21 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-2, .grid-21 { grid-template-columns: 1fr; } }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.kpi .label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); }
.kpi .value { font-family: var(--mono); font-size: 26px; font-weight: 500; margin-top: 4px; }
.kpi .sub { font-size: 12px; color: var(--text3); margin-top: 2px; }

/* Filtres et formulaires */
.filters { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; margin-bottom: 16px; }
.filters label, .form label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); }
input[type=text], input[type=password], input[type=number], input[type=time], input[type=date], select, textarea {
  font: inherit; color: var(--text); background: #fff; border: 1px solid var(--border2); border-radius: var(--radius); padding: 7px 10px; text-transform: none; letter-spacing: 0;
}
textarea { width: 100%; min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-bg); border-color: var(--accent); }
.select-sm { padding: 5px 8px; font-size: 12px; }
.form { display: grid; gap: 12px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.form-row > * { flex: 1 1 160px; }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; text-transform: none !important; font-size: 13px !important; color: var(--text) !important; letter-spacing: 0 !important; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text3); font-weight: 500; padding: 8px 10px; border-bottom: 1px solid var(--border2); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:hover td { background: rgba(0,0,0,0.015); }
td.num, th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
td.actions { white-space: nowrap; text-align: right; }
.clip { max-width: 520px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* Badges et barres */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-teal { background: var(--teal-bg); color: #00806a; }
.badge-coral { background: var(--coral-bg); color: #d64545; }
.badge-amber { background: var(--amber-bg); color: #b86a12; }
.badge-blue { background: var(--blue-bg); color: #2a72cc; }
.badge-accent { background: var(--accent-bg); color: var(--accent); }
.badge-gray { background: var(--bg3); color: var(--text2); }
.bar { height: 8px; border-radius: 999px; background: var(--bg3); overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.teal > span { background: var(--teal); }
.bar.blue > span { background: var(--blue); }
.target-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 6px; }
.rival-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text3); margin-right: 6px; }

/* Réponse et surlignage */
.answer { white-space: pre-wrap; line-height: 1.65; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; max-height: 560px; overflow-y: auto; }
mark.hit-target { background: rgba(108,99,255,0.22); color: inherit; border-radius: 3px; padding: 0 2px; }
mark.hit-rival { background: rgba(255,169,82,0.30); color: inherit; border-radius: 3px; padding: 0 2px; }

/* Graphiques */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text2); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

/* Divers */
.empty { text-align: center; padding: 56px 20px; color: var(--text2); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.toast { position: fixed; right: 20px; bottom: 20px; padding: 10px 16px; border-radius: var(--radius); color: #fff; background: var(--teal); opacity: 0; transform: translateY(8px); transition: opacity .3s, transform .3s; pointer-events: none; z-index: 50; }
.toast.show { opacity: 1; transform: none; }
.toast.amber { background: var(--amber); } .toast.accent { background: var(--accent); } .toast.coral { background: var(--coral); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 28px; }
.note { background: var(--amber-bg); border: 1px solid rgba(255,169,82,0.35); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; color: #8a5210; margin-bottom: 14px; }
code, pre { font-family: var(--mono); font-size: 12px; background: var(--bg3); border-radius: 6px; padding: 2px 6px; }
pre { padding: 12px; overflow-x: auto; }

/* Analyses : heatmap, barres empilées, comparaison moteurs */
.heat-wrap { overflow-x: auto; }
table.heat { border-collapse: separate; border-spacing: 3px; width: 100%; }
table.heat th { border-bottom: 0; text-align: center; }
table.heat th.prompt, table.heat td.prompt { text-align: left; min-width: 280px; max-width: 420px; }
table.heat td { padding: 0; border-bottom: 0; }
table.heat td.prompt { padding: 6px 10px 6px 0; font-size: 13px; }
table.heat tr:hover td { background: transparent; }
.heat-cell { display: block; text-align: center; padding: 8px 4px; border-radius: 6px; font-family: var(--mono); font-size: 12px; min-width: 64px; background: var(--bg3); color: var(--text3); }
.heat-cell small { display: block; font-size: 10px; opacity: .75; }
.heat-cell.none { background: var(--bg); border: 1px dashed var(--border2); }
.heat-cell.zero { background: var(--coral-bg); color: #d64545; }
.stack { display: flex; height: 26px; border-radius: 6px; overflow: hidden; background: var(--bg3); }
.stack > span { display: grid; place-items: center; font-size: 11px; font-family: var(--mono); color: #fff; min-width: 2px; overflow: hidden; }
.eng-row { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; margin-bottom: 12px; }
.eng-row .name { font-weight: 500; }
.ci { position: relative; height: 22px; background: var(--bg3); border-radius: 999px; }
.ci .fill { position: absolute; top: 0; bottom: 0; left: 0; background: var(--accent); border-radius: 999px; opacity: .85; }
.ci .range { position: absolute; top: 9px; height: 4px; background: var(--text); opacity: .55; border-radius: 2px; }
.badge-low { background: var(--amber-bg); color: #b86a12; }
