/* Suivi PEA — styles. Thème clair par défaut, sombre selon le système ou le bouton. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --border-strong: rgba(11, 11, 11, 0.2);
  --accent: #2a78d6;
  --accent-strong: #256abf;
  --accent-soft: #e6f0fc;
  --meter-track: #cde2fb;
  --good: #0ca30c;
  --good-text: #006300;
  --bad: #d03b3b;
  --bad-text: #b42828;
  --warn-bg: #fdf3d8;
  --warn-ink: #6b4a00;
  --neutral-1: #898781;
  --neutral-2: #c3c2b7;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --series-8: #e34948;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 8px 24px rgba(11, 11, 11, 0.06);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #232321;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.22);
    --accent: #3987e5;
    --accent-strong: #256abf;
    --accent-soft: #14283f;
    --meter-track: #104281;
    --good: #0ca30c;
    --good-text: #0ca30c;
    --bad: #d03b3b;
    --bad-text: #e66767;
    --warn-bg: #3a2c05;
    --warn-ink: #fab219;
    --neutral-1: #898781;
    --neutral-2: #52514e;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #0ca30c;
    --series-7: #9085e9;
    --series-8: #e66767;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #232321;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.22);
  --accent: #3987e5;
  --accent-strong: #256abf;
  --accent-soft: #14283f;
  --meter-track: #104281;
  --good: #0ca30c;
  --good-text: #0ca30c;
  --bad: #d03b3b;
  --bad-text: #e66767;
  --warn-bg: #3a2c05;
  --warn-ink: #fab219;
  --neutral-1: #898781;
  --neutral-2: #52514e;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #0ca30c;
  --series-7: #9085e9;
  --series-8: #e66767;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }

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

.boot { padding: 48px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.secondary { color: var(--ink-2); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- structure ---------- */

.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100dvh;
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px 14px 16px;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }

.profile-switch { display: grid; gap: 6px; padding: 0 4px; }
.profile-switch label { font-size: 12px; color: var(--muted); padding: 0 4px; }

.nav { display: grid; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 9px;
  color: var(--ink-2); text-decoration: none; font-weight: 550;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--ink); }
.nav a svg { width: 18px; height: 18px; flex: none; }

.sidebar-foot { margin-top: auto; display: grid; gap: 4px; }

.main { min-width: 0; padding: 28px clamp(16px, 3.5vw, 40px) 72px; }
.main-inner { max-width: 1180px; margin: 0 auto; display: grid; gap: 20px; }

.topbar, .tabbar { display: none; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-sub { color: var(--ink-2); margin-top: 2px; font-size: 14px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 10px;
    position: sticky; top: 0; z-index: 20;
    padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
    background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .topbar .brand { padding: 0; font-size: 15px; }
  .topbar select { margin-left: auto; max-width: 52vw; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    padding: 6px 4px max(6px, env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .tabbar a {
    display: grid; justify-items: center; gap: 2px;
    padding: 5px 2px; border-radius: 9px;
    font-size: 11px; font-weight: 550; color: var(--muted); text-decoration: none;
  }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .main { padding: 18px 14px 110px; }
  h1 { font-size: 21px; }
  .btn.fab {
    position: fixed; right: 16px; bottom: calc(74px + env(safe-area-inset-bottom)); z-index: 21;
    width: 54px; height: 54px; border-radius: 50%; padding: 0; justify-content: center;
    box-shadow: var(--shadow);
  }
  .btn.fab svg { width: 22px; height: 22px; }
  .fab span { display: none; }
  .seg button { padding: 6px 10px; }
  .hide-mobile { display: none !important; }
}
@media (min-width: 901px) {
  .fab { display: none !important; }
}

/* ---------- éléments ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head p { color: var(--ink-2); font-size: 13px; margin-top: 2px; max-width: 62ch; }
.card-tools { display: flex; align-items: center; gap: 6px; flex: none; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1040px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 38px; padding: 8px 14px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn-primary:hover { background: #1c5cab; border-color: #1c5cab; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { color: var(--bad-text); }
.btn-small { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn-icon { width: 34px; min-height: 34px; padding: 0; justify-content: center; }
.btn-block { width: 100%; justify-content: center; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px;
  border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink);
}
select { padding-right: 28px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent-strong); flex: none; }

.field { display: grid; gap: 5px; min-width: 0; align-content: start; }
.field > span, .field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: minmax(0, 1fr); } }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; }
.check small { display: block; color: var(--muted); font-size: 12.5px; }
.form { display: grid; gap: 14px; }
.form-error { color: var(--bad-text); font-size: 13.5px; font-weight: 550; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 600; font-size: 13px; cursor: pointer; text-align: left; }
.link-btn:hover { text-decoration: underline; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button {
  border: 0; background: transparent; cursor: pointer;
  padding: 6px 12px; min-height: 32px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--border-strong); }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); white-space: nowrap; }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--neutral-1); }
.badge.t-deposit i { background: var(--series-1); }
.badge.t-buy i { background: var(--series-7); }
.badge.t-sell i { background: var(--series-2); }
.badge.t-dividend i { background: var(--series-3); }
.badge.t-fee i, .badge.t-withdrawal i { background: var(--neutral-1); }

.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.delta svg { width: 10px; height: 10px; }
.delta.up { color: var(--good-text); }
.delta.down { color: var(--bad-text); }
.delta.flat { color: var(--ink-2); }

.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 11px; background: var(--warn-bg); color: var(--warn-ink); font-size: 13.5px; }
.notice svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.notice ul { margin: 0; padding-left: 16px; }
.notice.info { background: var(--accent-soft); color: var(--ink); }

.empty { display: grid; justify-items: center; gap: 10px; padding: 36px 16px; text-align: center; color: var(--ink-2); }
.empty h2 { color: var(--ink); }
.empty p { max-width: 46ch; }

/* ---------- tableau de bord ---------- */

.live { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--neutral-1); }
.live.open i { background: var(--good); box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.5); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(12, 163, 12, 0); } 100% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); } }
@media (prefers-reduced-motion: reduce) { .live.open i { animation: none; } }

.hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.4fr); gap: 24px; align-items: center; }
@media (max-width: 1040px) { .hero { grid-template-columns: minmax(0, 1fr); gap: 18px; } }
.hero-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.hero-value { font-size: clamp(38px, 10.5vw, 54px); font-weight: 650; letter-spacing: -0.025em; line-height: 1.08; margin: 4px 0 10px; }
.hero-value.flash { animation: flash 0.9s ease-out; }
@keyframes flash { from { color: var(--accent); } }
.hero-deltas { display: grid; gap: 4px; font-size: 14px; }
.hero-deltas span.what { color: var(--ink-2); margin-left: 6px; font-weight: 400; }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
@media (max-width: 560px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi { background: var(--surface); padding: 12px 14px; min-width: 0; }
.kpi .label { font-size: 12.5px; color: var(--ink-2); }
.kpi .value { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; margin-top: 2px; overflow-wrap: anywhere; }
.kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.filters .field-inline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.filters select { width: auto; min-height: 36px; }

/* ---------- graphiques ---------- */

.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i.line { width: 16px; height: 0; border-top: 2px solid; border-radius: 2px; }
.legend i.box { width: 10px; height: 10px; border-radius: 3px; }

.chart { position: relative; width: 100%; }
.chart svg { width: 100%; touch-action: pan-y; outline-offset: 4px; }
.chart text { font: 12px var(--font); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart text.end-label { fill: var(--ink); font-weight: 600; }
.chart .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart .axis-line { stroke: var(--axis); stroke-width: 1; }
.chart .crosshair { stroke: var(--axis); stroke-width: 1; }
.chart .band-hover { fill: var(--ink); opacity: 0.05; }

.tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  min-width: 150px; max-width: 280px; padding: 9px 11px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow); font-size: 13px;
}
.tooltip .t-title { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.tooltip .t-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tooltip .t-row i { width: 12px; height: 0; border-top: 2px solid; flex: none; }
.tooltip .t-row b { font-weight: 650; font-variant-numeric: tabular-nums; }
.tooltip .t-row span { color: var(--ink-2); }
.tooltip .t-foot { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--border); color: var(--ink-2); font-size: 12.5px; }

.chart-foot { margin-top: 10px; font-size: 13px; color: var(--ink-2); }

.segbar { display: flex; gap: 2px; height: 8px; margin-bottom: 14px; }
.segbar i { display: block; min-width: 3px; border-radius: 999px; }

.alloc-list { display: grid; }
.alloc-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 62px; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--grid); font-size: 14px; }
.alloc-row:first-child { border-top: 0; }
.alloc-row i { width: 10px; height: 10px; border-radius: 3px; }
.alloc-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alloc-row .amount { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.alloc-row .share { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }

.perf-list { display: grid; gap: 10px; }
.perf-row { display: grid; grid-template-columns: minmax(0, 34%) minmax(0, 1fr) 76px; align-items: center; gap: 12px; font-size: 13.5px; }
.perf-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perf-track { position: relative; height: 14px; }
.perf-track::before { content: ""; position: absolute; top: -4px; bottom: -4px; left: var(--zero); width: 1px; background: var(--axis); }
.perf-bar { position: absolute; top: 0; bottom: 0; }
.perf-bar.up { background: var(--good); border-radius: 0 4px 4px 0; }
.perf-bar.down { background: var(--bad); border-radius: 4px 0 0 4px; }
.perf-row .val { text-align: right; }
.perf-row:hover .perf-bar { filter: brightness(1.12); }

.meter { height: 10px; border-radius: 999px; background: var(--meter-track); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 999px; background: var(--accent); min-width: 4px; }
.meter-legend { display: flex; justify-content: space-between; gap: 12px; margin-top: 7px; font-size: 13px; color: var(--ink-2); }
.meter-legend b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- tableaux ---------- */

.table-wrap { overflow-x: auto; margin: 0 -20px -8px; padding: 0 20px; container: tablewrap / inline-size; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; }
td.r { font-variant-numeric: tabular-nums; white-space: nowrap; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
table.compact td, table.compact th { padding: 7px 10px; }

/* Tableau trop étroit pour ses colonnes → chaque ligne devient une fiche. */
@container tablewrap (max-width: 760px) {
  table.stack thead { display: none; }
  table.stack, table.stack tbody { display: block; }
  table.stack tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; padding: 13px 0; border-bottom: 1px solid var(--grid); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack td { display: block; padding: 0; border: 0; text-align: left; white-space: normal; }
  table.stack td.r { text-align: left; }
  table.stack td.full { grid-column: 1 / -1; }
  table.stack td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; }
  table.stack td.row-actions-cell { grid-column: 1 / -1; }
  table.stack .row-actions { justify-content: flex-start; }

  /* Fiches sur trois colonnes quand la largeur le permet. */
  table.cols-3 tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  table.cols-3 td.row-actions-cell.inline { grid-column: auto; align-self: end; }
  table.cols-3 td.row-actions-cell.inline .row-actions { justify-content: flex-end; }

  /* Opérations : fiche compacte (date, type, bouton / détail, montant / quantité, frais). */
  table.ops tr {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "date type actions" "detail detail amount" "qty qty fees";
    align-items: center; gap: 4px 12px; padding: 10px 0;
  }
  table.ops td.c-date { grid-area: date; color: var(--ink-2); font-size: 13px; }
  table.ops td.c-type { grid-area: type; }
  table.ops td.c-actions { grid-area: actions; }
  table.ops td.c-detail { grid-area: detail; }
  table.ops td.c-amount { grid-area: amount; text-align: right; align-self: start; white-space: nowrap; }
  table.ops td.c-qty { grid-area: qty; font-size: 13px; color: var(--ink-2); }
  table.ops td.c-fees { grid-area: fees; text-align: right; font-size: 13px; color: var(--ink-2); }
  table.ops td.c-qty::before, table.ops td.c-fees::before { display: inline; content: attr(data-label) " : "; font-size: inherit; }
  table.ops td.is-empty { display: none; }
  table.ops .row-actions { justify-content: flex-end; }
}
@container tablewrap (max-width: 420px) {
  table.cols-3 tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  table.cols-3 td.row-actions-cell.inline { grid-column: 1 / -1; }
  table.cols-3 td.row-actions-cell.inline .row-actions { justify-content: flex-start; }
}

/* ---------- listes de définitions (PEA, réglages) ---------- */

.facts { display: grid; gap: 0; }
.fact { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; padding: 10px 0; border-top: 1px solid var(--grid); font-size: 14px; }
.fact:first-child { border-top: 0; }
.fact dt, .fact .k { color: var(--ink-2); }
.fact .k small { display: block; color: var(--muted); font-size: 12.5px; }
.fact .v { font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.fact.total { border-top: 1px solid var(--axis); }

.stat-big { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; }

.item-list { display: grid; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--grid); }
.item:first-child { border-top: 0; }
.item .info { min-width: 0; }

/* ---------- fenêtres, messages ---------- */

.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 20px;
  background: rgba(11, 11, 11, 0.45);
}
.modal {
  width: min(560px, 100%); max-height: calc(100dvh - 40px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow);
}
.modal.wide { width: min(720px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 12px; }
.modal-body { padding: 4px 20px 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--border); }
@media (max-width: 600px) {
  .modal-overlay { place-items: end center; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 94dvh; border-radius: 18px 18px 0 0; border-bottom: 0; }
  .modal-foot { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; justify-content: center; }
}

.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
@media (max-width: 900px) { .toasts { bottom: calc(84px + env(safe-area-inset-bottom)); } }
.toast { padding: 11px 14px; border-radius: 11px; background: var(--ink); color: var(--page); font-size: 14px; font-weight: 550; box-shadow: var(--shadow); }
.toast.error { background: var(--bad); color: #fff; }

.type-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.type-picker button {
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer;
  padding: 7px 13px; min-height: 36px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.type-picker button[aria-pressed="true"] { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.type-picker button[disabled] { opacity: 0.5; cursor: default; }

.summary-box { display: grid; gap: 6px; padding: 12px 14px; border-radius: 11px; background: var(--surface-2); font-size: 14px; }
.summary-box .line { display: flex; justify-content: space-between; gap: 12px; }
.summary-box .line b { font-variant-numeric: tabular-nums; }
.summary-box .line.strong { font-weight: 650; font-size: 15px; }

.candidates { display: grid; gap: 8px; }
.candidate { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid var(--border-strong); border-radius: 11px; cursor: pointer; }
.candidate:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.candidate input { margin-top: 3px; }
.candidate .price { margin-left: auto; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- connexion ---------- */

.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(400px, 100%); display: grid; gap: 18px; }
.auth-card .brand { padding: 0; font-size: 20px; }
.auth-card .brand img { width: 36px; height: 36px; border-radius: 9px; }

.tier-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) 34px; gap: 8px; align-items: end; }
.tier-row .field > span { font-size: 12px; }
