/* Tableau de bord Leads jobs.lu — thème clair/sombre automatique. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e0e4ea;
  --text: #16191f;
  --text-muted: #646c7a;
  --accent: #1f5eff;
  --accent-soft: #e8efff;
  --green: #0f7d4f;
  --green-soft: #e2f5ec;
  --amber: #92620a;
  --amber-soft: #fdf0d5;
  --red: #b32431;
  --red-soft: #fde8ea;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1116;
    --surface: #171a21;
    --surface-2: #1e222b;
    --border: #2a2f3a;
    --text: #e8eaee;
    --text-muted: #98a1b2;
    --accent: #6b96ff;
    --accent-soft: #1b2540;
    --green: #4ade9b;
    --green-soft: #12301f;
    --amber: #f0b429;
    --amber-soft: #35290c;
    --red: #f4818e;
    --red-soft: #3a1319;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.05rem; }

.muted { color: var(--text-muted); margin: .25rem 0 0; font-size: .875rem; }
.link { font-size: .875rem; }

/* ---------- En-tête ---------- */
.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: .4rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { font-weight: 700; letter-spacing: -.02em; }
.brand-sub {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted);
}
.nav { display: flex; gap: .25rem; margin-right: auto; flex-wrap: wrap; }
.nav a {
  padding: .4rem .7rem; border-radius: 7px;
  color: var(--text-muted); font-size: .9rem; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.logout { display: flex; align-items: center; gap: .6rem; }
.who { font-size: .85rem; color: var(--text-muted); }

/* ---------- Mise en page ---------- */
.page { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }
.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.head-actions { display: flex; align-items: center; gap: .75rem; }
.breadcrumb { margin: 0 0 .75rem; font-size: .875rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem;
  margin-bottom: 1.25rem;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; }
.panel h2 { margin-bottom: .9rem; }
.panel-head h2 { margin-bottom: .9rem; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Tuiles ---------- */
.tiles {
  display: grid; gap: 1rem; margin-bottom: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem; display: flex; flex-direction: column; gap: .15rem;
}
.tile-label {
  font-size: .75rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 600;
}
.tile-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; }
.tile-value .unit { font-size: 1.1rem; color: var(--text-muted); }
.tile-note { font-size: .8rem; color: var(--text-muted); }

/* ---------- Graphiques ---------- */
.spark {
  display: flex; align-items: flex-end; gap: 2px; height: 90px;
  padding: 0; margin: 0;
}
.spark-bar {
  flex: 1; min-height: 2px; border-radius: 2px 2px 0 0;
  background: var(--accent); opacity: .85;
}
.spark-bar.is-empty { background: var(--border); opacity: 1; }
.spark-axis {
  display: flex; justify-content: space-between;
  font-size: .75rem; color: var(--text-muted); margin-top: .4rem;
}

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.bars li { display: grid; grid-template-columns: 1fr 2fr auto; gap: .75rem; align-items: center; }
.bar-label { font-size: .875rem; }
.bar-track { background: var(--surface-2); border-radius: 99px; height: 8px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-value { font-variant-numeric: tabular-nums; font-size: .875rem; color: var(--text-muted); }

/* ---------- Tableaux ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table thead th {
  text-align: left; padding: .6rem .75rem;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 600;
  border-bottom: 1px solid var(--border); white-space: nowrap;
  position: sticky; top: 0; background: var(--surface);
}
.table tbody td { padding: .65rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.cell-title a { font-weight: 550; }
.cell-meta { display: block; font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }
.cell-mono { font-family: var(--mono); font-size: .82rem; white-space: nowrap; }

.mini-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.mini-table th {
  text-align: left; padding: .35rem .5rem; font-size: .72rem;
  text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.mini-table td { padding: .35rem .5rem; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }

/* ---------- Badges ---------- */
.score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.2rem; padding: .2rem .45rem; border-radius: 6px;
  font-weight: 700; font-size: .82rem; font-variant-numeric: tabular-nums;
}
.score-lg { min-width: 3rem; padding: .4rem .7rem; font-size: 1.1rem; }
.score-high { background: var(--green-soft); color: var(--green); }
.score-mid { background: var(--amber-soft); color: var(--amber); }
.score-low { background: var(--surface-2); color: var(--text-muted); }

.tag {
  display: inline-block; padding: .12rem .45rem; border-radius: 99px;
  font-size: .7rem; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-muted);
}
.tag-new { background: var(--accent-soft); color: var(--accent); }
.tag-republished, .tag-repost { background: var(--amber-soft); color: var(--amber); }
.tag-hr { background: var(--green-soft); color: var(--green); }
.tag-warn { background: var(--red-soft); color: var(--red); }
.tag-expired, .tag-superseded { background: var(--surface-2); color: var(--text-muted); }

/* ---------- Formulaires ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
.filter-field { display: flex; flex-direction: column; gap: .25rem; }
.filter-grow { flex: 1 1 220px; }
.filter-field label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 600;
}
.filter-check { display: flex; align-items: center; gap: .4rem; font-size: .875rem; padding-bottom: .5rem; }
.filter-actions { display: flex; gap: .5rem; margin-left: auto; }

input[type="text"], input[type="search"], input[type="password"], select {
  padding: .45rem .6rem; border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg); color: var(--text); font: inherit; font-size: .9rem;
  min-width: 130px;
}
input:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

.btn-primary, .btn-ghost {
  padding: .45rem .9rem; border-radius: 7px; font: inherit; font-size: .875rem;
  font-weight: 550; cursor: pointer; border: 1px solid transparent;
  display: inline-block; text-align: center;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }

/* ---------- Connexion ---------- */
.login-wrap { min-height: 78vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow);
  padding: 2rem; width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: .4rem;
}
.login-title { font-size: 1.35rem; margin-bottom: .1rem; }
.login-title span { color: var(--accent); }
.login-sub { color: var(--text-muted); font-size: .875rem; margin: 0 0 1rem; }
.login-card label {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 600; margin-top: .5rem;
}
.login-card input { width: 100%; }
.login-card .btn-primary { margin-top: 1.25rem; padding: .6rem; }

/* ---------- Divers ---------- */
.flashes { margin-bottom: 1rem; }
.flash {
  padding: .65rem .9rem; border-radius: 8px; font-size: .9rem; margin: 0 0 .5rem;
  border: 1px solid transparent;
}
.flash-error { background: var(--red-soft); color: var(--red); border-color: currentColor; }
.flash-info { background: var(--accent-soft); color: var(--accent); }

.def { display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: .5rem 1rem; margin: 0; }
.def dt {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); font-weight: 600; padding-top: .15rem;
}
.def dd { margin: 0; }
.person { margin-bottom: .4rem; }

.callout {
  background: var(--amber-soft); color: var(--amber);
  padding: .7rem .9rem; border-radius: 8px; font-size: .875rem; margin: 1rem 0 .5rem;
}
.sources { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.sources li { font-size: .82rem; overflow-wrap: anywhere; }

.description {
  white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: .9rem; line-height: 1.65; color: var(--text);
  max-height: 32rem; overflow-y: auto;
}

.empty {
  text-align: center; color: var(--text-muted); padding: 2.5rem 1rem;
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}

.error-wrap { text-align: center; padding: 4rem 1rem; }
.error-code { font-size: 3.5rem; font-weight: 700; color: var(--text-muted); margin: 0; }
.error-message { color: var(--text-muted); margin: .5rem 0 1.5rem; }
