/* Eclipse Compta : thème clair / sombre par jetons */

:root {
  color-scheme: light;
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f5f4f0;
  --surface-3: #ebeae4;
  --border: rgba(11, 11, 11, 0.09);
  --border-strong: rgba(11, 11, 11, 0.17);
  --text: #141413;
  --text-2: #52514e;
  --text-3: #73716b;
  --accent: #d69a1c;
  --accent-strong: #c08712;
  --accent-ink: #8a5a00;
  --on-accent: #1d1503;
  --neg: #c22f2f;
  --critical: #d03b3b;
  --good: #0ca30c;
  --good-text: #006300;
  --warn: #fab219;
  --warn-text: #7f4d00;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #ebeae4;
  --axis: #c3c2b7;
  --logo-disc: #141413;
  --shadow: 0 1px 2px rgba(20, 20, 19, 0.04), 0 2px 8px rgba(20, 20, 19, 0.03);
  --shadow-lg: 0 10px 30px rgba(20, 20, 19, 0.10);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f0f11;
    --surface: #1a1a1d;
    --surface-2: #212125;
    --surface-3: #2b2b30;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #f4f3ef;
    --text-2: #c3c2b7;
    --text-3: #918f88;
    --accent: #f0b43c;
    --accent-strong: #f5c461;
    --accent-ink: #f3c063;
    --neg: #f07a7a;
    --good-text: #4cc94c;
    --warn-text: #f5c25a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --grid: #2a2a2e;
    --axis: #3d3d42;
    --logo-disc: #0f0f11;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 34px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f11;
  --surface: #1a1a1d;
  --surface-2: #212125;
  --surface-3: #2b2b30;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f3ef;
  --text-2: #c3c2b7;
  --text-3: #918f88;
  --accent: #f0b43c;
  --accent-strong: #f5c461;
  --accent-ink: #f3c063;
  --neg: #f07a7a;
  --good-text: #4cc94c;
  --warn-text: #f5c25a;
  --series-1: #3987e5;
  --series-2: #d95926;
  --grid: #2a2a2e;
  --axis: #3d3d42;
  --logo-disc: #0f0f11;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 34px rgba(0, 0, 0, 0.45);
}

/* ── Base ─────────────────────────────────────────────── */

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.015em; }
h2 { font-size: 16px; font-weight: 600; }

p { margin: 0; }
code { font-family: var(--mono); font-size: 12.5px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.icon { flex: none; display: block; }

.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
main.container { padding-top: 26px; padding-bottom: 40px; min-height: calc(100vh - 140px); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.muted { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.neg { color: var(--neg); }

/* ── Barre du haut ────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; gap: 22px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--text); font-size: 15px; font-weight: 500; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand b { font-weight: 700; }

.logo { flex: none; }
.logo-glow { fill: none; stroke: var(--accent); stroke-width: 1.3; opacity: 0.4; }
.logo-sun { fill: var(--accent); }
.logo-disc { fill: var(--logo-disc); }

.mainnav {
  flex: 1; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none;
}
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a {
  padding: 7px 12px; border-radius: 8px; white-space: nowrap;
  color: var(--text-2); font-weight: 500;
}
.mainnav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.mainnav a.active { background: var(--surface-3); color: var(--text); font-weight: 600; }

.topbar-user { display: flex; align-items: center; gap: 4px; }
.topbar-user form { display: contents; }
.user-chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 200px;
  padding: 6px 12px 6px 9px; border: 1px solid var(--border-strong); border-radius: 999px;
  color: var(--text-2); font-weight: 500; margin: 0 4px;
}
.user-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip:hover, .user-chip.active { color: var(--text); background: var(--surface-2); text-decoration: none; }

.theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: block; }

@media (max-width: 860px) {
  .topbar-inner { height: auto; flex-wrap: wrap; gap: 8px 12px; padding: 10px 16px 0; }
  .brand { flex: 1; }
  .mainnav { order: 3; flex-basis: 100%; margin: 0 -16px; padding: 0 12px 8px; }
  .user-chip span { display: none; }
  .user-chip { padding: 7px; margin: 0; }
}

/* ── En-têtes de page ─────────────────────────────────── */

.crumbs {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
  font-size: 13px; color: var(--text-3);
}
.crumbs a { color: var(--text-2); }

.page-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  flex-wrap: wrap; gap: 14px 20px; margin-bottom: 20px;
}
.page-head .sub { margin-top: 5px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sub { color: var(--text-2); }
.with-dot { display: flex; align-items: center; gap: 12px; }
.page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.month-nav { display: flex; gap: 2px; }

.year-nav {
  display: inline-flex; align-items: center; gap: 2px; padding: 2px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
}
.year-nav .year { padding: 0 10px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* ── Cartes ───────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
  min-width: 0;
}
.card.narrow { max-width: 540px; }
.card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.card-head > div:first-child { flex: 1 1 260px; min-width: 0; }
.card-head-side { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.card-head-side form { display: contents; }
.hint { margin-top: 3px; font-size: 13px; color: var(--text-3); max-width: 70ch; }
.card-total { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-foot {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.card-foot form { display: contents; }
.card-danger { border-color: color-mix(in srgb, var(--critical) 30%, var(--border)); }

.empty { color: var(--text-3); text-align: center; padding: 18px 10px; font-size: 13.5px; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center; padding: 48px 20px;
}
.empty-state .sub { max-width: 52ch; }
.status-code { font-size: 56px; font-weight: 700; line-height: 1; color: var(--accent); }

/* ── Indicateurs ──────────────────────────────────────── */

.kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi {
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
  padding: 16px 18px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.kpi-label { font-size: 13px; color: var(--text-2); }
.kpi-value {
  font-size: 22px; font-weight: 650; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kpi-sub { font-size: 12.5px; color: var(--text-3); }
.kpi-hero {
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
}
.kpi-hero .kpi-value { font-size: 26px; }

@media (max-width: 960px) {
  .kpis, .kpis-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .kpi-hero { grid-column: 1 / -1; }
}

/* ── Boutons ──────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; font-weight: 550; white-space: nowrap; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13.5px; border-radius: 8px; }
.btn-block { width: 100%; height: 42px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger {
  background: transparent; color: var(--neg);
  border-color: color-mix(in srgb, var(--critical) 45%, transparent);
}
.btn-danger:hover { background: color-mix(in srgb, var(--critical) 10%, transparent); }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--text-2); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.icon-btn.danger:hover { color: var(--neg); background: color-mix(in srgb, var(--critical) 10%, transparent); }
.icon-btn.save { color: var(--text-3); }
.icon-btn.save.dirty { background: var(--accent); color: var(--on-accent); }

/* ── Formulaires ──────────────────────────────────────── */

input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="hidden"]),
select, textarea {
  width: 100%; min-width: 0; height: 36px; padding: 0 10px;
  font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { height: auto; padding: 8px 10px; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input.num { text-align: right; font-variant-numeric: tabular-nums; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
input[type="color"] {
  width: 52px; height: 36px; padding: 3px; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
}

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; font-size: 13px; font-weight: 500; color: var(--text-2); }
fieldset.field { border: 0; margin: 0; padding: 0; }
fieldset.field legend { padding: 0; margin-bottom: 6px; }
.field small { font-weight: 400; }
.form-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.form-row .field { flex: 0 1 auto; }
.form-row .grow { flex: 1 1 180px; }
.form-row .grow-2 { flex: 2 1 240px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.check { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--text); cursor: pointer; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }

.input-suffix { display: inline-flex; align-items: center; gap: 5px; color: var(--text-3); }
.input-suffix input { width: 78px !important; }

.color-choices { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.color-choice {
  position: relative; width: 28px; height: 28px; border-radius: 50%;
  background: var(--c); cursor: pointer; box-shadow: 0 0 0 1px var(--border-strong);
}
.color-choice input[type="radio"] { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; }
.color-choice:has(input:checked) { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.color-choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }
.color-custom { background: conic-gradient(#e34948, #eda100, #1baf7a, #2a78d6, #4a3aa7, #e87ba4, #e34948); }
.color-custom input[type="color"] {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; padding: 0; border: 0;
}

/* ── Tableaux ─────────────────────────────────────────── */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  padding: 9px 10px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.table thead th {
  font-size: 12px; font-weight: 600; color: var(--text-3); white-space: nowrap;
  border-bottom-color: var(--border-strong);
}
.table tbody tr:hover > * { background: var(--surface-2); }
.table tfoot th, .table tfoot td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table tbody th { font-weight: 500; }
.table .col-actions { width: 1%; text-align: right; white-space: nowrap; }
.table .col-actions form { display: inline; }
.table .col-actions > * { vertical-align: middle; }
.table .empty-row:hover > * { background: none; }
.total-row th, .total-row td { font-weight: 650; border-top: 1px solid var(--border-strong); }
.muted-row th, .muted-row td { color: var(--text-2); font-weight: 500; }
.is-inactive td { color: var(--text-3); }
.add-row td { padding-top: 12px; }

.lines .col-cat { width: 22%; }
.lines .col-amount { width: 170px; }
.lines tbody input, .lines tbody select, .shares tbody input {
  height: 34px; border-color: var(--border); background: transparent;
}
.lines tbody input:hover, .lines tbody select:hover, .shares tbody input:hover { border-color: var(--border-strong); }
.lines tbody input:focus, .lines tbody select:focus, .shares tbody input:focus { background: var(--surface); }
.lines select { padding-right: 6px; text-overflow: ellipsis; }
.lines select option { background: var(--surface); color: var(--text); }
.category-other { margin-top: 6px; }
.computed { display: block; margin-top: 3px; font-size: 12px; color: var(--text-3); font-weight: 400; }
.tag {
  display: inline-block; padding: 1px 8px; border-radius: 6px;
  background: var(--surface-3); color: var(--text-2); font-size: 12px;
}

.shares { min-width: 420px; }
.shares th, .shares td { padding-left: 6px; padding-right: 6px; }
.shares th:first-child, .shares td:first-child { padding-left: 0; }
.shares .input-suffix input { width: 64px !important; }
.shares select { min-width: 130px; }
.col-pay form { display: inline; }

.table a { color: var(--text); font-weight: 500; }
.table a:hover { color: var(--accent-ink); }

@media (max-width: 640px) {
  .lines thead { display: none; }
  .lines tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 6px 8px; padding: 10px 0; border-bottom: 1px solid var(--border);
  }
  .lines tbody tr:hover > * { background: none; }
  .lines td { padding: 0; border: 0; width: auto !important; }
  .lines td.col-label { grid-column: 1 / -1; }
  .lines .empty-row { display: block; }
  .lines .empty-row td { display: block; }
  .lines .add-row { border-bottom: 0; }
}

/* Matrice serveurs × mois */
.matrix { font-size: 13px; min-width: 1080px; }
.matrix th, .matrix td { padding: 7px 6px; }
.matrix .sticky {
  position: sticky; left: 0; z-index: 1; background: var(--surface);
  min-width: 170px; max-width: 230px; padding-left: 0;
}
.matrix tbody tr:hover > .sticky { background: var(--surface-2); }
.matrix .current { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.matrix thead th.current { color: var(--accent-ink); }
.matrix tfoot th, .matrix tfoot td { border-top: 1px solid var(--border); color: var(--text-2); }
.matrix tfoot tr:first-child > * { border-top-color: var(--border-strong); }
.matrix tfoot .strong > * { color: var(--text); font-weight: 650; }
.matrix .total { font-weight: 650; }
.cell {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 6px;
  color: var(--text);
}
.cell.neg { color: var(--neg); }
.cell:hover { background: var(--surface-3); text-decoration: none; }
.cell-lock { color: var(--text-3); }
.cell-lock .icon { width: 12px; height: 12px; }
.cell-create { display: inline; }
.cell-add {
  display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0;
  border: 1px dashed var(--border-strong); border-radius: 6px; background: transparent;
  color: var(--text-3); cursor: pointer; opacity: 0.55; transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.cell-add .icon { width: 13px; height: 13px; }
.matrix tr:hover .cell-add, .cell-add:focus-visible { opacity: 1; }
.cell-add:hover { color: var(--accent-ink); border-color: var(--accent); }
.cell-empty { color: var(--text-3); }

.server-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; color: inherit; }
a.server-name { color: var(--text); font-weight: 600; }
.server-name > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.dot-lg { width: 14px; height: 14px; }

/* ── Badges, notices, messages ────────────────────────── */

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px;
  border: 0; border-radius: 999px; background: var(--surface-3); color: var(--text-2);
  font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; vertical-align: middle;
}
.badge .icon { width: 13px; height: 13px; }
.badge-good { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good-text); }
.badge-warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn-text); }
.badge-btn { cursor: pointer; }
.badge-btn:hover { box-shadow: inset 0 0 0 1px currentColor; }

.notice {
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px;
  padding: 10px 12px; border-radius: 10px; font-size: 13.5px; color: var(--text);
}
.notice .icon { margin-top: 2px; }
.notice-warn {
  background: color-mix(in srgb, var(--warn) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 38%, transparent);
}
.notice-warn .icon { color: var(--warn-text); }
.notice-error {
  background: color-mix(in srgb, var(--critical) 9%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--critical) 38%, transparent);
}
.notice-error .icon { color: var(--neg); }

.flash {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  margin-bottom: 18px; padding: 12px 14px; border-radius: 10px; font-size: 14px;
  border: 1px solid var(--border-strong); background: var(--surface);
}
.flash-success {
  background: color-mix(in srgb, var(--good) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--good) 35%, transparent);
}
.flash-error {
  background: color-mix(in srgb, var(--critical) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--critical) 40%, transparent);
}
.secret {
  padding: 4px 10px; font-size: 15px; letter-spacing: 0.02em;
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 6px;
  user-select: all; cursor: copy;
}
.secret.copied { border-color: var(--good); }

/* ── Feuille mensuelle ────────────────────────────────── */

.sheet-grid {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 16px; align-items: start;
}
@media (max-width: 1180px) {
  .sheet-grid { grid-template-columns: minmax(0, 1fr); }
}
.notes-text { white-space: pre-wrap; }

/* ── Serveurs et mois ─────────────────────────────────── */

.server-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.server-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px; padding: 20px 18px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.server-card:hover { border-color: var(--border-strong); transform: translateY(-1px); text-decoration: none; }
.server-card-bar { position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); }
.server-card-name { font-size: 17px; font-weight: 650; }
.server-card-desc { color: var(--text-2); font-size: 13.5px; }
.server-card-stats { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; font-size: 13px; color: var(--text-3); }
.server-card-stats b { color: var(--text); font-weight: 650; }
.server-card-stats b.neg { color: var(--neg); }
.server-card.is-archived { opacity: 0.7; }

details.archived summary { cursor: pointer; color: var(--text-2); font-weight: 500; margin: 8px 0 12px; }

.month-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.month-card {
  display: flex; flex-direction: column; gap: 6px; min-height: 104px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; color: var(--text);
}
a.month-card:hover { background: var(--surface-2); text-decoration: none; }
.month-card.is-empty { background: transparent; border-style: dashed; border-color: var(--border-strong); }
.month-card.is-empty form { margin-top: auto; }
.month-card.is-empty .btn { padding-left: 8px; margin-left: -8px; }
.month-card.is-current { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.month-card-head { display: flex; justify-content: space-between; align-items: center; }
.month-card-name { font-weight: 600; }
.month-card-status { color: var(--text-3); }
.month-card-net { font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.month-card-detail { font-size: 12px; color: var(--text-3); }

/* ── Graphique ────────────────────────────────────────── */

.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.swatch-1 { background: var(--series-1); }
.swatch-2 { background: var(--series-2); }

.chart { position: relative; height: 260px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--text-3); font-size: 11.5px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .bar-1 { fill: var(--series-1); }
.chart .bar-2 { fill: var(--series-2); }
.chart path, .chart text, .chart line { pointer-events: none; }
.chart .band { fill: transparent; cursor: default; }
.chart .band.active { fill: var(--text); fill-opacity: 0.045; }
.chart-tip {
  position: absolute; z-index: 2; pointer-events: none; min-width: 190px;
  padding: 10px 12px; font-size: 13px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  opacity: 0; transform: translate(-50%, calc(-100% - 10px)); transition: opacity 0.12s;
}
.chart-tip.show { opacity: 1; }
.chart-tip-title { font-weight: 650; margin-bottom: 6px; }
.chart-tip-row { display: flex; align-items: center; gap: 8px; }
.chart-tip-row span:nth-child(2) { flex: 1; color: var(--text-2); }
.chart-tip-row b { font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-tip-row.net { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--border); }

/* ── Divers ───────────────────────────────────────────── */

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
}
.plain-list li:last-child { border-bottom: 0; }
.role-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: var(--text-2); }
.role-list b { color: var(--text); }
.journal td { font-size: 13px; }

.site-foot { padding: 20px 24px 28px; text-align: center; font-size: 12.5px; color: var(--text-3); }

/* ── Connexion ────────────────────────────────────────── */

.auth-page main.container { display: grid; place-items: center; min-height: calc(100vh - 80px); }
.auth-card {
  width: 100%; max-width: 380px; padding: 32px 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; font-size: 16px; }
.auth-brand b { font-weight: 700; }
.auth-card h1 { font-size: 22px; }
.auth-card .sub { margin: 4px 0 20px; font-size: 13.5px; }

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  main.container { padding-top: 18px; }
  h1 { font-size: 22px; }
  .card { padding: 16px; }
  .kpis, .kpis-3 { grid-template-columns: minmax(0, 1fr); }
  .kpi-hero .kpi-value { font-size: 24px; }
  .chart { height: 220px; }
}

/* ── Impression ───────────────────────────────────────── */

@media print {
  :root { color-scheme: light; }
  body { background: #fff; font-size: 12px; }
  .topbar, .page-actions, .year-nav, .col-actions, .add-row, .card-foot, .card-danger,
  .site-foot, .flash, #notes form .btn, .cell-add, .crumbs { display: none !important; }
  .card, .kpi { box-shadow: none; break-inside: avoid; }
  .sheet-grid { grid-template-columns: minmax(0, 1fr); }
  input, textarea, select { border: 0 !important; background: none !important; padding: 0 !important; height: auto !important; }
  main.container { padding: 0; }
}
