/* Thème « ++ » : presque-noir neutre, un seul accent (le vert du profit),
   atmosphère discrète. Le halo lumineux est RÉSERVÉ à la carte Profit —
   l'effet ne se dépense que sur le chiffre qui compte. */

:root {
  --bg: #07080b;
  --panel-top: #11141a;
  --panel-bottom: #0c0e13;
  --border: #1e232c;
  --text: #e8eaee;
  --text-strong: #f2f4f7;
  --muted: #6d7583;
  --accent: #3ddc84;
  --accent-bright: #4ef79a;
  --danger: #f87171;
  --danger-border: #7f1d1d;
  --radius: 11px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(90% 60% at 50% -10%, #3ddc840e, transparent 70%);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1;   /* chiffres tabulaires : les colonnes s'alignent */
  min-height: 100vh;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(#ffffff0a 1px, transparent 1px);
  background-size: 22px 22px;
  z-index: 0;
}

header, main { position: relative; z-index: 1; }

/* ---------- barre d'onglets ---------- */

header {
  background: linear-gradient(180deg, #0e1116, #0a0c10);
  border-bottom: 1px solid var(--border);
  padding: 14px 18px 0;
  position: sticky;
  top: 0;
}

header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #3ddc8477, transparent);
}

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }

.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .08em; }
.brand .mark {
  width: 18px; height: 18px; border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), #0d9488);
  box-shadow: 0 0 14px #3ddc8477;
}

/* Sur mobile la barre défile : six onglets ne tiennent pas sur un écran de
   téléphone, et les compresser les rendrait intouchables au pouce. */
nav { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; }
nav::-webkit-scrollbar { display: none; }

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding-bottom: 10px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  display: flex; align-items: center; gap: 6px;
}
nav a.on {
  color: var(--text-strong);
  border-bottom-color: var(--accent);
  text-shadow: 0 0 14px #3ddc8455;
}
nav .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: .5 } 50% { opacity: 1 } }

.switch { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; }
.track {
  width: 34px; height: 18px; border-radius: 999px;
  background: #1a1e26; border: 1px solid #2c3547; position: relative;
  transition: background .15s, border-color .15s;
}
.track i { position: absolute; top: 1px; left: 1px; width: 14px; height: 14px; border-radius: 50%; background: #5f6773; transition: left .15s; }
.track.on { background: #3ddc8433; border-color: #2f6f4f; box-shadow: 0 0 12px #3ddc8433; }
.track.on i { left: 17px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }

/* ---------- contenu ---------- */

main { padding: 18px; max-width: 1180px; margin: 0 auto; }

h2 { font-size: 17px; margin: 0 0 14px; font-weight: 650; color: var(--text-strong); }

.periods { display: flex; gap: 6px; margin-bottom: 14px; overflow-x: auto; }
.periods button {
  border: 1px solid #232833; border-radius: 8px; padding: 5px 12px;
  background: #0c0e13; color: #8a93a2; font: inherit; font-size: 12px; cursor: pointer;
  white-space: nowrap;
}
.periods button.on {
  background: linear-gradient(180deg, #1d2530, #151a22);
  color: var(--text-strong); border-color: #3a4553;
  box-shadow: inset 0 1px 0 #ffffff12;
}

.panel {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: inset 0 1px 0 #ffffff09;
  margin-bottom: 12px;
  position: relative;
  overflow: hidden;
}
.panel::before {
  content: "";
  position: absolute; top: 0; left: 14px; right: 14px; height: 1px;
  background: linear-gradient(90deg, transparent, #ffffff1f, transparent);
}

.cap { font-size: 10px; text-transform: uppercase; letter-spacing: .11em; font-weight: 600; color: var(--muted); }

/* ---------- KPIs ---------- */

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
@media (max-width: 720px) { .kpis { grid-template-columns: repeat(2, 1fr); } }

.kpi {
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: inset 0 1px 0 #ffffff09;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute; top: 0; left: 14px; right: 14px; height: 1px;
  background: linear-gradient(90deg, transparent, #ffffff1f, transparent);
}
.kpi .k { font-size: 10px; text-transform: uppercase; letter-spacing: .11em; color: var(--muted); font-weight: 600; margin-bottom: 7px; }
.kpi .v { font-size: 20px; font-weight: 650; letter-spacing: -.01em; color: var(--text-strong); }
.kpi .delta { font-size: 11px; margin-top: 5px; color: var(--muted); }

/* Le seul endroit de tout le dashboard où l'on dépense du glow. */
.kpi.hero {
  background: radial-gradient(130% 140% at 100% 0%, #3ddc8426, transparent 60%),
              linear-gradient(180deg, #0f1a16, #0b110e);
  border-color: #2f6f4f;
  box-shadow: 0 0 34px #3ddc8426, inset 0 1px 0 #3ddc8433;
}
.kpi.hero::before { background: linear-gradient(90deg, transparent, #3ddc8466, transparent); }
.kpi.hero .k { color: #6ba98c; }
.kpi.hero .v { font-size: 27px; font-weight: 700; color: var(--accent-bright); text-shadow: 0 0 28px #3ddc8499; }
.kpi.hero .delta { color: var(--accent); }

/* ---------- tableaux ---------- */

table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; padding: 0 8px 8px 0; }
td { padding: 9px 8px 9px 0; border-top: 1px solid #1a1e26; color: #c9d0da; }
td.num, th.num { text-align: right; padding-right: 0; }
td.name { color: var(--text-strong); font-weight: 600; }
.pos { color: var(--accent); font-weight: 600; }
.neg { color: var(--danger); font-weight: 600; }

/* Sur mobile, les tableaux deviennent des cartes empilées : cinq colonnes de
   chiffres sur un écran de téléphone sont illisibles. */
@media (max-width: 640px) {
  table, thead, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tr { border: 1px solid var(--border); border-radius: 9px; margin-bottom: 8px; padding: 8px 10px; }
  td { border: 0; display: flex; justify-content: space-between; padding: 4px 0; text-align: right; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
}

/* ---------- champs ---------- */

input[type="text"], input[type="password"], input[type="date"], input[type="month"], select {
  background: #0a0c10;
  border: 1px solid #262c36;
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  width: 100%;
}
input:focus, select:focus { border-color: #2f6f4f; box-shadow: 0 0 0 3px #3ddc8414; }
input.saved { border-color: #2f6f4f; box-shadow: 0 0 10px #3ddc8422; }
input.invalid { border-color: var(--danger-border); box-shadow: 0 0 0 3px #ef444414; }
input.num { text-align: right; }

button.primary {
  border: 1px solid #2f6f4f; border-radius: 9px; padding: 10px 16px;
  font: inherit; font-weight: 600; cursor: pointer; color: #04140c;
  background: linear-gradient(180deg, var(--accent-bright), #22c46f);
  box-shadow: 0 0 26px #3ddc8440, inset 0 1px 0 #ffffff4d;
}
button.ghost {
  border: 1px solid #2c3547; border-radius: 8px; padding: 7px 12px;
  background: #0c0e13; color: #8a93a2; font: inherit; font-size: 12px; cursor: pointer;
}
button.danger { border-color: var(--danger-border); color: #fca5a5; }

.badge { font-size: 10px; border-radius: 5px; padding: 2px 7px; border: 1px solid #26583f; background: #3ddc8414; color: var(--accent); }
.badge.todo { border-color: var(--danger-border); background: #7f1d1d33; color: #fca5a5; }
.tag { font-size: 10px; border-radius: 5px; padding: 2px 7px; border: 1px solid #2c3547; color: #9aa7bd; }
.tag.rec { border-color: #1d4ed855; background: #3b82f61a; color: #93c5fd; }
.tag.pon { border-color: #78350f88; background: #f59e0b1a; color: #fcd34d; }

.saved-flag { font-size: 11px; color: var(--accent); }
.warn { color: #fca5a5; font-size: 12px; margin-top: 10px; }

/* Bandeau d'erreur : le dashboard ne montre JAMAIS des chiffres périmés en
   les faisant passer pour frais. */
#banner {
  display: none;
  background: #7f1d1d33; border: 1px solid var(--danger-border);
  color: #fca5a5; border-radius: 9px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px;
}
#banner.on { display: block; }

/* ---------- page de connexion ---------- */

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 280px; text-align: center; position: relative; z-index: 1; }
.login-box .mark-big {
  width: 52px; height: 52px; border-radius: 15px; margin: 0 auto 20px;
  background: linear-gradient(135deg, var(--accent), #0d9488);
  box-shadow: 0 0 34px #3ddc8455;
  display: flex; align-items: center; justify-content: center;
  color: #04140c; font-weight: 800; font-size: 16px;
}
.login-box h1 { font-size: 18px; margin: 0 0 6px; font-weight: 650; color: var(--text-strong); }
.login-box .sub { font-size: 12px; color: var(--muted); margin-bottom: 22px; }
.login-box input { margin-bottom: 10px; }
.login-box button { width: 100%; }
.login-box .err { font-size: 12px; color: #fca5a5; margin-top: 12px; min-height: 16px; }
.login-box .foot { margin-top: 20px; font-size: 10px; color: #454c58; }
