/* Budget de Nathan — thème sombre */
:root {
  --bg: #0a0c12;
  --surface: #12151e;
  --surface-2: #181c27;
  --surface-3: #1f2431;
  --line: #242a38;
  --text: #eceef5;
  --text-2: #b4b9c9;
  --muted: #7d8399;
  --in: #3ddc97;
  --in-bg: rgba(61, 220, 151, .1);
  --out: #ff6b81;
  --out-bg: rgba(255, 107, 129, .1);
  --warn: #f5b642;
  --warn-bg: rgba(245, 182, 66, .1);
  --accent: #8b8cff;
  --accent-bg: rgba(139, 140, 255, .14);
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.in { color: var(--in); }
.out { color: var(--out); }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* ---------------------------------------------------------------- en-tête */
.top { border-bottom: 1px solid var(--line); background: var(--bg); position: sticky; top: 0; z-index: 20; }
.top .wrap { display: flex; align-items: center; gap: 12px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand h1 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: -.01em; }
.logo { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; color: #0a0c12; background: var(--accent); }
.search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); width: 240px; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--text); }
.search:focus-within { border-color: var(--accent); }
.icon-btn, .btn {
  height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.icon-btn { width: 36px; color: var(--text-2); }
.btn { padding: 0 14px; font-weight: 600; }
.btn.primary { background: var(--accent); border-color: transparent; color: #0a0c12; }
.btn.ghost { background: transparent; }
.btn.small { height: 30px; font-size: 12px; padding: 0 10px; }
.btn:hover, .icon-btn:hover { border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.1); }

/* ---------------------------------------------------------------- navigation */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 20px; flex-wrap: wrap; }
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-nav .arrow { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 18px; color: var(--text-2); }
.month-nav .arrow:disabled { opacity: .3; cursor: default; }
.month-nav .arrow:not(:disabled):hover { border-color: var(--accent); color: var(--text); }
.month-select { position: relative; }
.month-select select {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-size: 26px; font-weight: 750; letter-spacing: -.02em; padding: 0 28px 0 10px; color: var(--text);
}
.month-select::after { content: '▾'; position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; font-size: 14px; }
.month-select select option { font-size: 14px; background: var(--surface); }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; height: 32px; padding: 0 14px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button.on { background: var(--surface-3); color: var(--text); }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); vertical-align: middle; margin-left: 6px; }

/* ---------------------------------------------------------------- résumé */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.summary > div { padding: 20px 22px; }
.summary > div + div { border-left: 1px solid var(--line); }
.summary .lab { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.summary .val { font-size: 30px; font-weight: 800; letter-spacing: -.03em; margin: 4px 0 2px; }
.summary .cmp { font-size: 12.5px; color: var(--muted); }
.summary .cmp b { font-weight: 600; }
.ratio { padding: 0 22px 20px !important; grid-column: 1 / -1; border-left: 0 !important; }
.ratio .bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; position: relative; }
.ratio .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.ratio .txt { font-size: 12.5px; color: var(--text-2); margin-top: 8px; }

/* ---------------------------------------------------------------- alertes */
.alerts { margin-top: 14px; padding: 6px 0 10px; }
.alerts h3 { margin: 10px 20px 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.alert { display: flex; gap: 12px; align-items: baseline; padding: 6px 20px; color: var(--text-2); font-size: 13.5px; }
.alert .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; transform: translateY(-1px); }
.alert b { color: var(--text); font-weight: 600; }
.alert.bad .dot { background: var(--out); }
.alert.warn .dot { background: var(--warn); }
.alert.good .dot { background: var(--in); }
.alert.info .dot { background: var(--muted); }

/* ---------------------------------------------------------------- sections */
.section { margin-top: 30px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px 10px; }
.section-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.section-head h2 .bullet { width: 10px; height: 10px; border-radius: 3px; }
.section-head .tot { font-size: 20px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.section-head .note { font-size: 12px; color: var(--muted); font-weight: 400; }
.section.sec-internal .card { opacity: .85; }
.empty { padding: 20px; color: var(--muted); }

.cat + .cat { border-top: 1px solid var(--line); }
.cat-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto auto 16px; gap: 14px; align-items: center; padding: 14px 18px; cursor: pointer; }
.cat-row:hover, .cat.open > .cat-row { background: var(--surface-2); }
.cat:first-child .cat-row { border-radius: var(--radius) var(--radius) 0 0; }
.cat:last-child:not(.open) .cat-row { border-radius: 0 0 var(--radius) var(--radius); }
.cat:only-child:not(.open) .cat-row { border-radius: var(--radius); }
.cat-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; }
.cat-main { min-width: 0; }
.cat-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-bar { height: 4px; border-radius: 2px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.cat-bar i { display: block; height: 100%; border-radius: 2px; }
.cat-amt { text-align: right; font-weight: 700; font-size: 16px; min-width: 100px; }
.cat-amt small { display: block; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.chev { color: var(--muted); transition: transform .2s; font-size: 18px; }
.cat.open .chev { transform: rotate(90deg); }
.trend { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.trend.up { background: var(--out-bg); color: var(--out); }
.trend.down { background: var(--in-bg); color: var(--in); }
.trend.new { background: var(--warn-bg); color: var(--warn); }
.cat.unclassified .cat-name::after { content: 'à classer'; margin-left: 8px; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); }

/* transactions */
.tx-list { display: none; background: var(--bg); border-top: 1px solid var(--line); }
.cat.open .tx-list { display: block; }
.cat:last-child .tx-list { border-radius: 0 0 var(--radius) var(--radius); }
.tx { display: grid; grid-template-columns: 52px minmax(0, 1fr) 100px 200px; gap: 14px; align-items: center; padding: 9px 18px 9px 68px; font-size: 13px; }
.tx + .tx { border-top: 1px solid var(--surface-2); }
.tx:hover { background: var(--surface); }
.tx .d { color: var(--muted); font-size: 12.5px; }
.tx .l { min-width: 0; }
.tx .l div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .l .det { font-size: 11.5px; color: var(--muted); }
.acc { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.acc.ING { background: #ff8a3d; }
.acc.Revolut { background: #5aa9ff; }
.tx .a { text-align: right; font-weight: 600; }
.tx select { width: 100%; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 8px; font-size: 12px; cursor: pointer; color: var(--text-2); }
.tx select:hover { border-color: var(--accent); }
.tx select.manual { border-color: var(--accent); color: var(--text); }
.tx.hl { background: var(--accent-bg); }
.more-tx { padding: 10px 18px 12px 68px; }
.legend-acc { font-size: 11.5px; color: var(--muted); padding: 8px 18px 10px 68px; border-top: 1px solid var(--surface-2); }

/* ---------------------------------------------------------------- vue d'ensemble */
.panel { padding: 20px 22px; margin-top: 14px; }
.panel h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.panel h3 small { font-size: 12px; font-weight: 400; color: var(--muted); }
.chart-wrap { overflow-x: auto; }
.chart-wrap svg { display: block; width: 100%; min-width: 560px; height: auto; }
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.heat-scroll { overflow-x: auto; }
.heat { width: 100%; border-collapse: separate; border-spacing: 2px; font-size: 12px; }
.heat th { font-weight: 500; color: var(--muted); padding: 4px 6px; white-space: nowrap; }
.heat th.c { text-align: left; color: var(--text-2); font-weight: 500; white-space: normal; min-width: 150px; }
.heat td { text-align: right; padding: 7px 8px; border-radius: 6px; cursor: pointer; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-2); }
.heat td:hover { outline: 1px solid var(--accent); }
.heat td.tot { font-weight: 700; color: var(--text); background: var(--surface-2); cursor: default; }
.heat td.tot:hover { outline: 0; }
.heat tr.sep th { padding-top: 16px; color: var(--text); font-weight: 700; }
.tm { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.tm .bar { height: 4px; border-radius: 2px; background: var(--surface-3); margin-top: 5px; overflow: hidden; }
.tm .bar i { display: block; height: 100%; }
.tm-click { cursor: pointer; border-radius: 8px; }
.tm-click:hover { background: var(--surface); }
.tm-click .chev { display: inline-block; color: var(--muted); margin-left: 4px; transition: transform .15s; }
.tm-click.open .chev { transform: rotate(90deg); }
.tm-txs { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; margin: 4px 0 10px; max-height: 420px; overflow-y: auto; }
.tm-txs .tx { padding-left: 14px; }

/* ---------------------------------------------------------------- modales */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: min(540px, 100%); max-height: 90vh; overflow: auto; padding: 24px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: 0 30px 80px -20px #000; animation: pop .18s; }
.modal h3 { margin: 0 0 6px; font-size: 18px; }
.modal p { color: var(--text-2); }
.modal .row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.modal label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; flex: 1; min-width: 120px; }
.modal input[type=text], .modal select { height: 38px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 10px; color: var(--text); }
.modal input[type=text]:focus { outline: 0; border-color: var(--accent); }
.modal input[type=color] { height: 38px; width: 56px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); padding: 3px; }
.modal .foot-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.emojis { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.emojis button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: 16px; }
.emojis button.sel { border-color: var(--accent); background: var(--accent-bg); }
.dropzone { margin-top: 16px; border: 2px dashed var(--line); border-radius: 14px; padding: 32px 16px; text-align: center; cursor: pointer; color: var(--text-2); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-bg); }
.dropzone .big { font-size: 30px; }
.result { margin-top: 10px; padding: 10px 12px; border-radius: 10px; font-size: 13px; background: var(--surface-2); }
.result.ok { background: var(--in-bg); }
.result.err { background: var(--out-bg); }
.list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.list .it { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; background: var(--surface-2); border-radius: 9px; font-size: 13px; }
.list .it code { font-size: 12px; background: var(--surface-3); padding: 1px 6px; border-radius: 5px; }
.x { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 15px; }
.x:hover { color: var(--out); }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; margin-top: 14px; }
.tabs button { flex: 1; border: 0; background: transparent; height: 32px; border-radius: 7px; cursor: pointer; font-weight: 600; color: var(--muted); font-size: 13px; }
.tabs button.on { background: var(--surface-3); color: var(--text); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--surface-3); border: 1px solid var(--line); color: var(--text); padding: 12px 14px 12px 16px; border-radius: 12px;
  box-shadow: 0 20px 50px -10px #000; display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); font-size: 13px;
  transition: transform .2s, opacity .2s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast .btn { height: 30px; font-size: 12px; white-space: nowrap; }
.toast .btn:not(.ghost) { background: var(--accent); color: #0a0c12; border: 0; }

.drop-overlay { position: fixed; inset: 0; z-index: 70; display: none; place-items: center; background: rgba(10, 12, 18, .8); font-size: 20px; font-weight: 700; }
.drop-overlay > div { padding: 30px 40px; border-radius: 18px; border: 2px dashed var(--accent); background: var(--surface); }
.drop-overlay.show { display: grid; }

.foot { font-size: 12px; color: var(--muted); padding: 40px 16px; text-align: center; }
.loading { padding: 80px 0; text-align: center; color: var(--muted); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }

/* ---------------------------------------------------------------- mobile */
.search.mobile { display: none; }
@media (max-width: 760px) {
  .top .search { display: none; }
  .search.mobile { display: flex; width: 100%; margin-top: 16px; }
  .btn.primary .t { display: none; }
  .summary, .summary.four { grid-template-columns: 1fr; }
  .summary > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .ratio { border-top: 0 !important; }
  .summary > div { padding: 14px 18px; }
  .summary .val { font-size: 24px; }
  .month-select select { font-size: 20px; }
  .nav { margin-top: 18px; }
  .cat-row { grid-template-columns: 32px minmax(0, 1fr) auto 12px; gap: 10px; padding: 12px 14px; }
  .cat-row .trend { display: none; }
  .cat-ic { width: 32px; height: 32px; }
  .tx { grid-template-columns: 44px minmax(0, 1fr) auto; padding: 9px 14px; gap: 10px; }
  .tx select { grid-column: 2 / -1; }
  .more-tx, .legend-acc { padding-left: 14px; }
}

/* ---------------------------------------------------------------- simulation « Et si… » */
.sim { margin-top: 14px; padding: 18px 20px; border-color: rgba(139, 140, 255, .35); background: linear-gradient(180deg, rgba(139, 140, 255, .07), var(--surface) 60%); }
.sim-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.sim-head h3 { margin: 0 0 2px; font-size: 16px; }
.sim-head#simToggle { cursor: pointer; user-select: none; }
.sim-head#simToggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
.sim-chev { display: inline-block; color: var(--muted); transition: transform .15s; }
.sim.open .sim-chev { transform: rotate(90deg); }
.sim-body { display: none; }
.sim.open .sim-body { display: block; }
.sim-result { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.sim-result .sr .lab { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.sim-result .sr .v { font-size: 17px; font-weight: 700; }
.sim-result .sr .v.big { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.sim-result .arrow-r { color: var(--muted); font-size: 18px; padding-top: 12px; }
.sim-result .gain, .sim-result .cum { padding-left: 18px; border-left: 1px solid var(--line); }
.sim-rows { margin-top: 16px; display: flex; flex-direction: column; }
.sim-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(120px, 1.6fr) 56px 100px 24px; gap: 14px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.sim-cat { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 600; }
.sim-cat span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-ic.sm { width: 28px; height: 28px; border-radius: 8px; font-size: 14px; flex: none; }
.sim-pct { font-weight: 700; text-align: right; color: var(--text-2); }
.sim-saved { text-align: right; font-weight: 700; color: var(--in); }
.sim input[type=range] { width: 100%; accent-color: var(--c, var(--accent)); cursor: pointer; }
.sim-foot { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.sim-foot select { height: 32px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 10px; font-size: 12.5px; color: var(--text-2); cursor: pointer; max-width: 100%; }
.sim-chart { margin-top: 20px; }
.sim-table-wrap { overflow-x: auto; margin-top: 14px; }
.sim-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sim-table th { text-align: right; font-weight: 500; color: var(--muted); font-size: 12px; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.sim-table th:first-child, .sim-table td:first-child { text-align: left; }
.sim-table td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--surface-2); white-space: nowrap; }
.sim-table td.strong { font-weight: 700; }
.sim-table tbody tr { cursor: pointer; }
.sim-table tbody tr:hover { background: var(--surface-2); }
@media (max-width: 760px) {
  .sim-row { grid-template-columns: minmax(0, 1fr) 52px 84px 20px; }
  .sim-row input[type=range] { grid-column: 1 / -1; grid-row: 2; }
  .sim-result .gain, .sim-result .cum { padding-left: 0; border-left: 0; }
}

/* sélecteur de compte */
.nav-right { display: flex; gap: 8px; flex-wrap: wrap; }
.acc-seg button { display: inline-flex; align-items: center; }
.acc-seg .acc { margin-right: 6px; }
.acc-note { margin-top: 6px; color: var(--muted); }

/* abonnements dans la simulation */
.sim-subs-title { margin-top: 14px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.sim-subs-title + .sim-rows { margin-top: 6px; }
.sim-desc { font-size: 12.5px; color: var(--muted); }
@media (max-width: 760px) { .sim-row.sub .sim-desc { grid-column: 1 / -1; grid-row: 2; } }

/* page « Indispensables » */
.page-tag { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); background: var(--accent-bg); padding: 4px 10px; border-radius: 8px; margin-right: 6px; }
.ess-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) 150px auto 48px; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.ess-row.missing { background: var(--warn-bg); }
.ess-status { white-space: normal; }
.ess-ok { color: var(--in); font-weight: 600; margin-right: 4px; }
.ess-miss { color: var(--warn); font-weight: 600; }
.ess-spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; }
.ess-spark i { flex: 1; background: var(--accent); border-radius: 2px; opacity: .8; min-height: 2px; }
.ess-add { display: flex; gap: 10px; align-items: center; padding: 12px 18px; flex-wrap: wrap; }
.ess-add select { height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 10px; font-size: 13px; color: var(--text-2); cursor: pointer; max-width: 100%; }
.ess-table tr.cur td { background: var(--accent-bg); }
.ess-table td.warnc { color: var(--warn); }
.ess-table tfoot td { border-top: 1px solid var(--line); font-weight: 600; color: var(--text-2); padding-top: 10px; }
.ess-table th:not(:first-child) { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) {
  .ess-row { grid-template-columns: 32px minmax(0, 1fr) auto 44px; gap: 10px; padding: 12px 14px; }
  .ess-spark { display: none; }
}
.seg[hidden] { display: none; }
.ess-type { font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 6px; margin-left: 6px; vertical-align: 1px; background: var(--surface-3); color: var(--text-2); }
.ess-type.t-domiciliation { background: rgba(90, 169, 255, .14); color: #7ab8ff; }
.ess-type.t-abonnement { background: rgba(168, 85, 247, .16); color: #c99bff; }
.ess-type.t-ordre { background: rgba(61, 220, 151, .12); color: var(--in); }
.ess-plan { color: var(--accent); font-weight: 600; margin-right: 4px; }
.ess-btns { display: flex; gap: 2px; }

/* historique d'une personne */
.tx-person { cursor: pointer; }
.tx-person .l > div:first-child { text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.modal.wide { width: min(680px, 100%); }
.pm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pm-stats > div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.pm-stats .lab { font-size: 11.5px; color: var(--muted); }
.pm-stats .val { font-size: 18px; font-weight: 700; margin-top: 2px; }
.pm-list { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; max-height: 50vh; overflow-y: auto; }
.pm-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 12px; font-size: 13px; }
.pm-row + .pm-row { border-top: 1px solid var(--surface-2); }
.pm-row.hl { background: var(--accent-bg); }
.pm-l { min-width: 0; }
.pm-l div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-l .det { font-size: 11.5px; color: var(--muted); }
@media (max-width: 560px) { .pm-stats { grid-template-columns: 1fr 1fr; } .pm-row { grid-template-columns: 70px minmax(0, 1fr) auto; } }

/* ---------------------------------------------------------------- connexion */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-wrap { width: min(400px, 100%); }
.login-card { padding: 28px 26px; }
.login-card .brand { margin-bottom: 18px; }
.login-step { display: flex; flex-direction: column; gap: 14px; }
.login-step[hidden] { display: none; }
.login-step p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.login-step label.f { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.login-step input { height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); padding: 0 12px; color: var(--text); font: inherit; font-size: 15px; }
.login-step input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.login-step .code-input { font-size: 24px; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.btn.block { width: 100%; height: 42px; justify-content: center; font-weight: 700; }
.btn:disabled { opacity: .6; cursor: wait; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-size: 13px; padding: 4px 0; align-self: center; }
.link:hover { text-decoration: underline; }
.login-err { color: var(--out); font-size: 13px; margin-top: 12px; min-height: 1em; text-align: center; }

/* ---------------------------------------------------------------- historique des connexions */
.modal.wide { width: min(720px, 100%); }
.hist-body .loading { padding: 30px 0; }
.hist-sub { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 18px 0 8px; }
.hist-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.hist-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; font-size: 13px; }
.hist-row + .hist-row { border-top: 1px solid var(--line); }
.hist-row.bad { background: var(--out-bg); }
.hist-row .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-ic { text-align: center; }
.hist-when { text-align: right; font-size: 12px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.hist-sub .seg button { height: 28px; padding: 0 10px; font-size: 12px; }
@media (max-width: 560px) {
  .hist-row { grid-template-columns: 22px minmax(0, 1fr); }
  .hist-when { grid-column: 2; text-align: left; }
}
