/* Charte : bleu marine + or, Manrope / IBM Plex Mono */
@font-face { font-family: "Manrope"; font-weight: 400; font-display: swap; src: url(fonts/manrope-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 600; font-display: swap; src: url(fonts/manrope-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 700; font-display: swap; src: url(fonts/manrope-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Manrope"; font-weight: 800; font-display: swap; src: url(fonts/manrope-latin-800-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url(fonts/ibm-plex-mono-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 600; font-display: swap; src: url(fonts/ibm-plex-mono-latin-600-normal.woff2) format("woff2"); }

@font-face { font-family: "Inter"; font-weight: 400; font-display: swap; src: url(fonts/inter-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 500; font-display: swap; src: url(fonts/inter-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 600; font-display: swap; src: url(fonts/inter-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Inter"; font-weight: 700; font-display: swap; src: url(fonts/inter-latin-700-normal.woff2) format("woff2"); }

:root {
  --paper: #F7F8FA; --surface: #fff; --ink: #172033; --ink-soft: #718096; --line: #E8EBEF; --accent-soft: #F3EEE8;
  --in: #35B779; --in-text: #23A064; --out: #EF6673; --out-text: #E04A59; --warn: #B7791F;
  --radius: 16px; --shadow: 0 1px 2px rgb(16 24 40 / .04), 0 4px 16px rgb(16 24 40 / .03);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif; --mono: "IBM Plex Mono", ui-monospace, monospace;
  --side-w: 300px; --top-h: 4.5rem;
}
* { box-sizing: border-box; }
html { font-size: clamp(17px, .25vw + 15px, 19.5px); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2 { margin: 0; letter-spacing: -.02em; }
.muted { color: var(--ink-soft); font-size: .98rem; }
.in { color: var(--in-text); } .out { color: var(--out-text); } .warn { color: var(--warn); }
.num { font-family: var(--font); font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; text-align: right; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .86rem; }
.i { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Cadre ---------- */
.app { display: block; }
.sidebar { position: fixed; z-index: 80; top: 0; bottom: 0; left: 0; width: min(84vw, var(--side-w)); display: flex; flex-direction: column; padding: 1.25rem 1rem 1.25rem; background: #fff; border-right: 1px solid var(--line); transform: translateX(-102%); transition: transform .22s ease; box-shadow: 8px 0 30px rgb(16 24 40 / .12); }
.nav-open .sidebar { transform: none; }
.backdrop { display: none; position: fixed; inset: 0; z-index: 70; background: rgb(23 32 51 / .35); }
.nav-open .backdrop { display: block; }
.brand { display: flex; align-items: center; gap: .8rem; padding: .25rem .5rem; }
.brand-mark { display: grid; place-items: center; width: 3rem; height: 3rem; border-radius: 14px; background: linear-gradient(180deg, #F4F1EC, #E9E5DE); box-shadow: inset 0 0 0 1px rgb(23 32 51 / .05); }
.brand-mark img { width: 2.1rem; height: 2.1rem; border-radius: 8px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.4rem; font-weight: 600; letter-spacing: -.02em; }
.brand-text small { margin-top: .15rem; font-size: .85rem; color: var(--ink-soft); }
.side-sep { height: 1px; background: var(--line); margin: 1.1rem .5rem 1rem; }
.side-links { display: flex; flex-direction: column; gap: .3rem; }
.nav-link { display: flex; align-items: center; gap: .9rem; height: 3.25rem; padding: 0 1.1rem; border-radius: 14px; color: #3b4658; font-weight: 500; font-size: 1.05rem; transition: background .15s, color .15s; }
.nav-link .i { color: #5b6678; }
.nav-link:hover { background: #F4F5F7; }
.nav-link.is-active { background: var(--accent-soft); color: var(--ink); font-weight: 600; } .nav-link.is-active .i { color: var(--ink); }
.nav-link:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid rgb(23 32 51 / .45); outline-offset: 2px; }
.side-card { margin-top: auto; padding: 1.1rem; border-radius: 16px; background: #FAF8F5; border: 1px solid #F0EBE4; }
.side-card-ico { display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 12px; background: #EEF3EC; color: #3F6B4D; margin-bottom: .8rem; }
.side-card strong { display: block; font-size: 1.02rem; font-weight: 600; line-height: 1.3; }
.side-card p { margin: .5rem 0 0; font-size: .88rem; color: var(--ink-soft); line-height: 1.45; }
.content { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: .75rem; height: var(--top-h); padding: 0 1rem; background: #fff; border-bottom: 1px solid var(--line); }
.nav-toggle { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; padding: 0; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); cursor: pointer; }
.topbar-title { font-weight: 600; letter-spacing: -.02em; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .9rem; }
.topbar-date { display: none; align-items: center; gap: .55rem; color: #4a5568; font-size: .95rem; }
.clock { font-variant-numeric: tabular-nums; white-space: pre; }
.bell { position: relative; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 12px; color: #3b4658; } .bell:hover { background: #F4F5F7; }
.bell-dot { position: absolute; top: .45rem; right: .5rem; width: .55rem; height: .55rem; border-radius: 50%; background: #E5484D; box-shadow: 0 0 0 2px #fff; }
.user { position: relative; }
.user-btn { display: flex; align-items: center; gap: .65rem; padding: .25rem .4rem .25rem .25rem; border: 0; background: transparent; border-radius: 999px; cursor: pointer; color: var(--ink); }
.user-btn:hover { background: #F4F5F7; }
.avatar { display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: #5B6B58; color: #fff; font-size: .82rem; font-weight: 600; flex: none; }
.user-meta { display: none; flex-direction: column; text-align: left; line-height: 1.2; } .user-meta strong { font-size: 1rem; font-weight: 600; } .user-meta small { font-size: .85rem; color: var(--ink-soft); }
.user-menu { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 11rem; padding: .35rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgb(16 24 40 / .12); }
.user-menu button { display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 2.5rem; padding: 0 .75rem; border: 0; background: transparent; border-radius: 8px; font-weight: 500; color: var(--out-text); cursor: pointer; text-align: left; }
.user-menu button:hover { background: #FDF1F2; }
.main { padding-bottom: 2rem; }
.page { width: 100%; max-width: none; margin: 0; padding: 1.25rem 1rem 2rem; display: flex; flex-direction: column; gap: 1.25rem; }
.page-head h1, .dash-head h1 { font-size: clamp(1.8rem, 1.3rem + 1.4vw, 2.7rem); font-weight: 600; }
.page-head p, .dash-head p { margin: .4rem 0 0; color: var(--ink-soft); font-size: 1.08rem; }
@media (min-width: 981px) {
  .app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; height: 100dvh; width: auto; transform: none; transition: none; box-shadow: none; padding: 1.5rem 1.1rem; }
  .backdrop, .nav-open .backdrop, .nav-toggle, .topbar-title { display: none; }
  .topbar { padding: 0 2.25rem; } .topbar-date, .user-meta { display: flex; }
  .page { padding: 2.25rem 3rem 3.5rem; gap: 2rem; }
}

/* ---------- Tableau de bord ---------- */
.own-head { display: flex; flex-direction: column; gap: 1.75rem; }
.dash-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.period { display: flex; flex-direction: column; align-items: flex-end; gap: .6rem; }
.period-select { position: relative; display: flex; align-items: center; min-width: 12.5rem; background: #fff; border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow); }
.period-select .i { position: absolute; left: 1rem; width: 1.1rem; height: 1.1rem; pointer-events: none; color: #4a5568; } .period-select .i:last-child { left: auto; right: 1rem; width: 1rem; height: 1rem; }
.period-select select { appearance: none; -webkit-appearance: none; width: 100%; height: 3.3rem; padding: 0 2.8rem 0 3rem; border: 0; background: transparent; font: 500 1.02rem var(--font); color: var(--ink); cursor: pointer; border-radius: 999px; }
.custom-range { display: flex; align-items: center; gap: .5rem; } .custom-range input { width: auto; min-height: 2.5rem; }
.dash-body { display: flex; flex-direction: column; gap: 1.75rem; }
.grid.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem 1.4rem; box-shadow: var(--shadow); min-width: 0; }
.kpi .l { font-size: .9rem; font-weight: 500; color: var(--ink-soft); }
.kpi .v { margin-top: .35rem; font-size: 1.75rem; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi.strong { background: var(--accent-soft); border-color: #EBE3D9; } .kpi.strong .v { font-size: 2rem; }
.pill-warn { margin: 0; align-self: flex-start; padding: .65rem 1.1rem; border-radius: 999px; background: #FFF8E8; border: 1px solid #F3E3B8; color: #8a5a00; font-size: 1rem; font-weight: 500; } .pill-warn a { text-decoration: underline; font-weight: 600; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem 1.85rem; box-shadow: var(--shadow); }
.card h2, h2 { font-size: 1.3rem; font-weight: 600; color: var(--ink); margin: 0 0 .7rem; }
.chart-card { padding: 1.5rem 1.75rem 1.25rem; }
.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem; margin-bottom: 1.25rem; } .chart-head h2 { margin: 0; font-size: 1.3rem; } .chart-head p { margin: .2rem 0 0; }
.legend { display: flex; gap: 1.4rem; font-size: 1rem; color: #4a5568; } .legend span { display: inline-flex; align-items: center; gap: .5rem; }
.dot { width: .65rem; height: .65rem; border-radius: 50%; display: inline-block; } .dot.in { background: var(--in); } .dot.out { background: var(--out); }
.chart { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); grid-template-rows: clamp(12.5rem, 26vh, 20rem) auto; column-gap: .5rem; }
.chart-y { position: relative; } .chart-y span { position: absolute; right: 0; transform: translateY(50%); font-size: .85rem; color: #8a94a6; }
.chart-plot { position: relative; }
.chart-grid i { position: absolute; left: 0; right: 0; height: 1px; background: #EEF0F3; }
.chart-bars { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 2px; }
.chart-day { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 1px; }
.chart-day i { flex: 1 1 0; max-width: 14px; display: block; border-radius: 4px 4px 0 0; transition: opacity .15s; }
.chart-day i.in { background: var(--in); } .chart-day i.out { background: var(--out); } .chart-day:hover i { opacity: .75; }
.chart-x { display: flex; gap: 2px; padding-top: .55rem; } .chart-x span { flex: 1 1 0; min-width: 0; font-size: .82rem; color: #8a94a6; white-space: nowrap; overflow: visible; text-align: center; position: relative; }
.note { margin: .9rem 0 0; font-size: .78rem; }
.cols2 { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 900px) { .cols2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; } }
.sec-title { display: flex; align-items: center; gap: .6rem; margin: 0 0 1rem; font-size: 1.3rem; } .sec-title .i { width: 1.1rem; height: 1.1rem; color: #5b6678; }
.rc-list { display: flex; flex-direction: column; gap: .75rem; }
.rowcard { display: flex; align-items: flex-start; gap: 1.1rem; padding: 1.3rem 1.5rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.rc-avatar { display: grid; place-items: center; width: 3.1rem; height: 3.1rem; border-radius: 50%; font-weight: 600; font-size: .95rem; flex: none; } .rc-avatar .i { width: 1.2rem; height: 1.2rem; }
.rc-body { flex: 1; min-width: 0; }
.rc-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem 1rem; } .rc-top strong { font-weight: 600; font-size: 1.1rem; }
.rc-amts { display: flex; gap: 1.5rem; font-size: 1rem; }
.track { display: flex; height: 8px; margin-top: .7rem; background: #EEF0F3; border-radius: 999px; overflow: hidden; }
.track i { display: block; height: 100%; } .track i.in { background: linear-gradient(90deg, #6cc9a0, var(--in)); } .track i.out { background: linear-gradient(90deg, #f28b94, var(--out)); }

/* ---------- Formulaires & boutons ---------- */
label { display: block; font-size: .92rem; font-weight: 600; color: #3b4658; margin: 1rem 0 .4rem; }
input, select, textarea, button { font: inherit; }
input, select, textarea { width: 100%; padding: .7rem .95rem; min-height: 3.15rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
input[type="number"] { font-variant-numeric: tabular-nums; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: #9aa5b8; box-shadow: 0 0 0 3px rgb(23 32 51 / .08); }
button { min-height: 3.15rem; padding: .55rem 1.25rem; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 500; cursor: pointer; transition: background .15s, border-color .15s; }
button:hover:not(:disabled) { background: #F4F5F7; }
button.primary { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; } button.primary:hover:not(:disabled) { background: #263248; }
button.danger { color: var(--out-text); } button.small { min-height: 2.4rem; padding: .25rem .9rem; font-size: .9rem; border-radius: 8px; }
button:disabled { opacity: .5; cursor: default; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.grid2 { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: end; } .row > * { flex: 1 1 9rem; }
.seg { display: flex; gap: .35rem; padding: .3rem; background: #F1F2F5; border-radius: 999px; }
.seg button { flex: 1; border: 0; border-radius: 999px; background: transparent; color: var(--ink-soft); }
.seg button.on.in { background: var(--in); color: #fff; } .seg button.on.out { background: var(--out); color: #fff; }
.error { color: var(--out-text); font-weight: 500; margin-top: .5rem; min-height: 1.2em; }
.banner { background: #FFF8E8; color: #8a5a00; border: 1px solid #F3E3B8; border-radius: 12px; padding: .6rem .9rem; font-size: .88rem; font-weight: 500; }
.scroll { overflow-x: auto; overflow-y: hidden; } /* ne capte jamais le défilement vertical de la page */
table { width: 100%; border-collapse: collapse; font-size: 1rem; min-width: 40rem; }
th { text-align: left; padding: .85rem .9rem; background: #F7F8FA; color: var(--ink-soft); font-size: .8rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--line); }
td { padding: .85rem .9rem; border-bottom: 1px solid #F0F1F4; vertical-align: top; }
tbody tr:hover td { background: #FAFAFB; } tr:last-child td { border-bottom: 0; }
tr.void td { opacity: .5; text-decoration: line-through; } tr.void td:last-child { text-decoration: none; }
.tag { display: inline-block; padding: .12rem .65rem; border-radius: 999px; background: #F3EEE8; color: #6b5640; font-size: .76rem; font-weight: 500; }
td.nowrap { white-space: nowrap; } td.obj { min-width: 14rem; white-space: pre-wrap; overflow-wrap: anywhere; } td.act { text-align: right; }
.inline-sel { min-height: 2.1rem; padding: .2rem .55rem; font-size: .82rem; border-radius: 999px; background: #F3EEE8; color: #6b5640; font-weight: 500; border-color: transparent; min-width: 8.5rem; }
.inline-sel.is-empty { background: #FFF8E8; color: #8a5a00; border-color: #F3E3B8; }
ul { margin: .4rem 0 0; padding-left: 1.2rem; font-size: .88rem; }
@media (max-width: 1360px) {
  .card.scroll:has(table) { padding: .6rem; }
  table, thead, tbody, tr, td { display: block; min-width: 0; width: 100%; }
  thead { position: absolute; left: -9999px; }
  tbody tr { border: 1px solid var(--line); border-radius: 14px; padding: .55rem .9rem; margin-bottom: .6rem; background: #fff; }
  td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .25rem 0; text-align: right; }
  td::before { content: attr(data-label); color: var(--ink-soft); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; text-align: left; flex: none; }
  td[data-label=""]::before, td:empty { display: none; }
  td.obj { white-space: pre-wrap; text-align: right; min-width: 0; } td.act { justify-content: flex-end; }
}
@media (max-width: 640px) { .card { padding: 1.1rem 1.15rem; } .rowcard { padding: .95rem 1rem; } .rc-amts { gap: 1rem; } .chart { grid-template-columns: 2.2rem minmax(0, 1fr); } }

#toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--ink); color: #fff; font-weight: 500; padding: .65rem 1.1rem; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 100; box-shadow: 0 12px 32px rgb(16 24 40 / .2); }
#toast.show { opacity: 1; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
[hidden] { display: none !important; }
@media (max-width: 640px) {
  .grid.kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .kpi.strong { grid-column: 1 / -1; } .kpi .v { font-size: 1.1rem; } .kpi.strong .v { font-size: 1.35rem; }
}

.admin-grid { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
.admin-users { grid-column: 1 / -1; }
@media (min-width: 900px) { .admin-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); } }
.role-item + .role-item { margin-top: .9rem; padding-top: .9rem; border-top: 1px solid var(--line); } .role-item p { margin: .2rem 0 0; }

/* ---------- Pages à deux zones (saisie, virement, rapprochement, paramètres) ---------- */
.split { display: grid; gap: 1.75rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .split { grid-template-columns: minmax(0, 1.7fr) minmax(20rem, 1fr); } }
.side-stack { display: flex; flex-direction: column; gap: 1.5rem; }
@media (min-width: 1100px) { .side-stack { position: sticky; top: calc(var(--top-h) + 1.5rem); } }
.fgrid { display: grid; gap: 0 1.5rem; grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr)); }
.fgrid .span-all { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.5rem; } .form-actions button { min-width: 12rem; }
.form-actions button.primary, .card button.primary[type="submit"] { font-size: 1.05rem; }
.form-intro { margin: 0 0 1rem; max-width: 60rem; }
.bal-list { display: flex; flex-direction: column; }
.bal-item { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); } .bal-item:last-child { border-bottom: 0; }
.bal-item span { color: var(--ink-soft); } .bal-item strong { font-size: 1.3rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bal-item.total strong { font-size: 1.6rem; }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); font-size: 1rem; } .recent li:last-child { border-bottom: 0; }
.recent .r-obj { min-width: 0; } .recent .r-obj b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 20rem; } .recent .r-obj small { color: var(--ink-soft); font-size: .85rem; }
.settings-grid { display: grid; gap: 1.75rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .settings-grid .span-all { grid-column: 1 / -1; } }
.item-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--line); } .item-row:last-of-type { border-bottom: 0; }
.add-row { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; } .add-row input { flex: 2 1 12rem; } .add-row select { flex: 1 1 8rem; width: auto; }
.filters { display: grid; gap: .9rem 1.1rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); align-items: end; }
.filters > * { margin: 0; }
.own-stack { display: flex; flex-direction: column; gap: 1.75rem; }
.settings-grid .item-row span { font-size: 1.05rem; }
.filters button { width: 100%; }
.page > div:where(:not(.page-head)) { display: flex; flex-direction: column; gap: 1.5rem; }
.page > .split { display: grid; gap: 1.75rem; } .page > .settings-grid { display: grid; gap: 1.75rem; } .page > .admin-grid { display: grid; gap: 1.5rem; }
.page > .own-head { gap: 1.75rem; }

/* Les montants s'adaptent à la largeur de leur carte (jamais de débordement) */
.kpi { container-type: inline-size; overflow: hidden; }
.kpi .v { font-size: clamp(1.05rem, 11cqi, 1.8rem); overflow: hidden; text-overflow: ellipsis; }
.kpi.strong .v { font-size: clamp(1.15rem, 12cqi, 2.05rem); }
.bal-item strong { font-size: clamp(1.05rem, 1.3vw + .4rem, 1.4rem); } .bal-item.total strong { font-size: clamp(1.15rem, 1.5vw + .4rem, 1.65rem); }
.card, .rowcard, .kpi { min-width: 0; } .rc-body { min-width: 0; } .rc-top strong { overflow-wrap: anywhere; }
.recent .r-obj b { max-width: 100%; }
.recent .r-obj b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rc-amts { flex-wrap: wrap; justify-content: flex-end; gap: .15rem 1.25rem; min-width: 0; } .rc-top { min-width: 0; }

/* ---------- Mobilité : tout appareil (téléphone, tablette, ordinateur, écran tactile ou souris) ---------- */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { overflow-x: clip; max-width: 100%; } /* clip : n'empêche pas le défilement vertical */
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
a, button, select, summary, label, input[type="checkbox"] { touch-action: manipulation; }
body.nav-open { overflow: hidden; }
img, svg, canvas { max-width: 100%; }
input, select, textarea { font-size: max(1rem, 16px); } /* évite le zoom automatique sur iPhone */
.topbar { padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top)); padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
.sidebar { padding-top: max(1.25rem, env(safe-area-inset-top)); padding-bottom: max(1.25rem, env(safe-area-inset-bottom)); padding-left: max(1rem, env(safe-area-inset-left)); overflow-y: auto; overscroll-behavior: contain; }
.page { padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); padding-bottom: max(2rem, env(safe-area-inset-bottom)); }
#toast { bottom: max(1.5rem, calc(env(safe-area-inset-bottom) + 1rem)); }
@media (min-width: 981px) { .topbar { padding-left: 2.25rem; padding-right: 2.25rem; } .page { padding-left: 3rem; padding-right: 3rem; } .sidebar { padding-left: 1.1rem; } }
/* Écrans tactiles : cibles larges, pas d'effets de survol bloqués */
@media (pointer: coarse) {
  .nav-link { height: 3.5rem; } button.small { min-height: 2.75rem; } .user-btn { min-height: 3rem; } .bell { width: 2.9rem; height: 2.9rem; }
  .chart-day:hover i { opacity: 1; } tbody tr:hover td { background: transparent; }
}
@media (hover: none) { button:hover:not(:disabled) { background: #fff; } button.primary:hover:not(:disabled) { background: var(--ink); } }
/* Téléphones étroits */
@media (max-width: 480px) {
  html { font-size: 17px; }
  .page { gap: 1.1rem; padding-top: 1rem; }
  .card { padding: 1.15rem 1.1rem; border-radius: 14px; }
  .dash-head { flex-direction: column; align-items: stretch; } .period { align-items: stretch; } .period-select { min-width: 0; width: 100%; }
  .custom-range { flex-wrap: wrap; } .custom-range input { flex: 1 1 8rem; }
  .form-actions { justify-content: stretch; } .form-actions button { width: 100%; min-width: 0; }
  .fgrid { grid-template-columns: minmax(0, 1fr); }
  .chart-card { padding: 1.1rem 1rem .9rem; } .chart-head { flex-direction: column; }
  .topbar-right { gap: .4rem; } .user-btn .i { display: none; }
  .row > * { flex: 1 1 100%; } .filters { grid-template-columns: minmax(0, 1fr); }
  .rowcard { gap: .8rem; } .rc-avatar { width: 2.6rem; height: 2.6rem; }
  .side-card { display: none; }
}
@media (max-width: 360px) { html { font-size: 16px; } .kpi { padding: .9rem .9rem; } .legend { gap: .9rem; } }
/* Téléphone en mode paysage : peu de hauteur */
@media (max-height: 480px) and (orientation: landscape) {
  :root { --top-h: 3.5rem; } .page { padding-top: .75rem; gap: 1rem; } .page-head h1, .dash-head h1 { font-size: 1.5rem; }
  .sidebar .side-card { display: none; } .nav-link { height: 2.8rem; } .login { align-content: start; padding-top: 1rem; }
}
/* Très grands écrans */
@media (min-width: 2200px) { html { font-size: 21px; } }
@media print { .sidebar, .topbar, .backdrop, #toast { display: none !important; } .app { display: block; } .page { padding: 0; } }

@media (max-width: 1360px) { .card.scroll { overflow: visible; } }

/* ---------- Guide comptable ---------- */
.guide { display: grid; gap: 1.75rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .guide { grid-template-columns: minmax(0, 1fr) 20rem; } .guide-side { position: sticky; top: calc(var(--top-h) + 1.5rem); order: 2; } }
.guide-side { display: flex; flex-direction: column; gap: 1rem; } .guide-side > button { align-self: flex-start; }
.guide-main { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.guide-toc ol { margin: 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: .5rem; font-size: 1rem; } .guide-toc li::marker { color: var(--ink-soft); }
.linklike { min-height: 0; padding: 0; border: 0; background: none; color: var(--ink); font-weight: 500; text-align: left; text-decoration: underline; text-decoration-color: #cfd5de; text-underline-offset: 3px; cursor: pointer; } .linklike:hover:not(:disabled) { background: none; text-decoration-color: var(--ink); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; } .row-between h2 { margin: 0; }
.check-list { display: flex; flex-direction: column; gap: .35rem; margin-top: .5rem; }
.check { display: flex; align-items: flex-start; gap: .85rem; margin: 0; padding: .7rem .85rem; border-radius: 12px; font-size: 1.02rem; font-weight: 500; color: var(--ink); cursor: pointer; } .check:hover { background: #F7F8FA; }
.check input { width: 1.4rem; height: 1.4rem; min-height: 0; margin: .1rem 0 0; flex: none; accent-color: #35B779; }
.guide-sec { scroll-margin-top: calc(var(--top-h) + 1rem); }
.steps { list-style: none; counter-reset: s; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; font-size: 1rem; }
.steps li { counter-increment: s; position: relative; display: flex; flex-direction: column; gap: .15rem; padding-left: 3rem; min-height: 2.2rem; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--accent-soft); color: #6b5640; font-weight: 600; font-size: .95rem; }
.steps li strong { font-weight: 600; } .steps li span { color: #4a5568; }
.tip { margin: 1.25rem 0 0; padding: .9rem 1.1rem; border-radius: 12px; background: #FFF8E8; border: 1px solid #F3E3B8; color: #6b4a00; }
.btn-link { display: inline-block; margin-top: 1.25rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
@media print { .guide { display: block; } .guide-side { display: none; } .card { box-shadow: none; break-inside: avoid; } }

.page > .guide { display: grid; gap: 1.75rem; }

/* ---------- Fenêtres modales ---------- */
dialog.modal { width: min(94vw, 36rem); max-height: 90dvh; padding: 0; border: 0; border-radius: 20px; box-shadow: 0 30px 80px rgb(16 24 40 / .35); color: var(--ink); overflow: hidden; }
dialog.modal.wide { width: min(94vw, 46rem); }
dialog.modal::backdrop { background: rgb(23 32 51 / .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; }
.modal-body { padding: 1.3rem 1.4rem 1.5rem; overflow-y: auto; max-height: calc(90dvh - 4.5rem); }
.icon-btn { min-height: 2.5rem; width: 2.5rem; padding: 0; border-radius: 50%; border: 0; background: #F4F5F7; color: var(--ink); font-size: 1rem; }
@media (max-width: 480px) { dialog.modal, dialog.modal.wide { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; margin: 0; } .modal-body { max-height: calc(100dvh - 4.5rem); } }

/* ---------- Cloche d'alertes ---------- */
.alerts { position: relative; }
button.bell { border: 0; background: transparent; padding: 0; min-height: 0; border-radius: 12px; cursor: pointer; color: #3b4658; }
button.bell:hover:not(:disabled) { background: #F4F5F7; }
.alerts-panel { position: absolute; right: -3.5rem; top: calc(100% + .5rem); width: min(92vw, 25rem); max-height: 70dvh; overflow-y: auto; padding: 1rem 1.1rem; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 44px rgb(16 24 40 / .16); z-index: 90; }
.alerts-panel h3 { margin: 0 0 .6rem; font-size: 1.05rem; }
.alerts-panel ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; }
.alerts-panel li { border-radius: 10px; border: 1px solid var(--line); }
.alerts-panel li a { display: block; padding: .65rem .8rem; font-size: .95rem; }
.alerts-panel li.danger { background: #FDF1F2; border-color: #F6C9CE; color: #9b1c2c; } .alerts-panel li.warn { background: #FFF8E8; border-color: #F3E3B8; color: #6b4a00; } .alerts-panel li.info { background: #F4F7FB; }
@media (max-width: 640px) { .alerts-panel { position: fixed; left: 1rem; right: 1rem; top: calc(var(--top-h) + .5rem); width: auto; } }
.menu-link { display: flex; align-items: center; gap: .6rem; min-height: 2.5rem; padding: 0 .75rem; border-radius: 8px; font-weight: 500; } .menu-link:hover { background: #F4F5F7; }

/* ---------- Journal : actions, pièces jointes, historique ---------- */
.row-actions { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: flex-end; align-items: center; }
button.icon-text { display: inline-flex; align-items: center; gap: .3rem; } button.icon-text .i { width: 1rem; height: 1rem; }
.tag-btn { border: 0; cursor: pointer; margin-left: .4rem; min-height: 0; padding: .1rem .6rem; background: #EEF0F3; color: #4a5568; }
.history { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 1rem; } .history ul { margin: .3rem 0 0; }
.att-list { display: flex; flex-direction: column; gap: .75rem; margin: 1rem 0; }
.att { display: flex; align-items: center; gap: .9rem; padding: .6rem; border: 1px solid var(--line); border-radius: 14px; }
.att-open { min-height: 0; padding: 0; border: 0; background: none; flex: none; }
.att-thumb { width: 4.5rem; height: 4.5rem; border-radius: 12px; overflow: hidden; background: #F4F5F7; display: grid; place-items: center; } .att-thumb img { width: 100%; height: 100%; object-fit: cover; }
.att-pdf { font-weight: 700; color: #C2415D; } .att-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; overflow-wrap: anywhere; }

/* ---------- Saisie : SMS ---------- */
.left-stack { display: flex; flex-direction: column; gap: 1.5rem; min-width: 0; }
.inbox { display: flex; flex-direction: column; gap: 1rem; }
.inbox-item { padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 14px; background: #FBFBFC; }
.inbox-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .4rem 1rem; align-items: baseline; } .inbox-head strong { font-size: 1.25rem; }
.sms-raw { margin: .6rem 0; padding: .6rem .8rem; border-radius: 10px; background: #fff; border: 1px dashed #d9dee6; font-size: .9rem; color: #4a5568; white-space: pre-wrap; overflow-wrap: anywhere; }
.inbox-form { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); }
.form-actions.left { justify-content: flex-start; } .form-actions.left button { min-width: 0; }

/* ---------- Mon compte, conseils ---------- */
.tips { margin: 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: .5rem; } .tips li.warn { color: var(--warn); } .tips li.in { color: var(--in-text); } .tips li.out { color: var(--out-text); }
.bal-item strong.plain { font-size: 1.05rem; font-weight: 600; white-space: normal; text-align: right; }

/* ---------- Rapports ---------- */
.report { display: flex; flex-direction: column; gap: 1.5rem; } .report-body { display: flex; flex-direction: column; gap: 1.5rem; }
.report-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: 1rem 1.25rem; } .report-bar input[type="month"] { width: auto; min-width: 11rem; } .report-bar .spacer { flex: 1; }
.report-title { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; } .report-title h2 { margin: 0; font-size: 1.6rem; }
.warn-tag { background: #FFF3D6; color: #8a5a00; }
.kpi .sub { margin-top: .35rem; font-size: .8rem; line-height: 1.35; white-space: normal; }
table.plain { min-width: 0; } table.plain td.strong { font-weight: 700; }
td.chk { width: 2.6rem; } td.chk input { width: 1.3rem; height: 1.3rem; min-height: 0; accent-color: #35B779; }
.batch-table td input[type="number"], .batch-table td input:not([type]) { min-height: 2.6rem; }
.batch-total { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem 1.25rem; margin: 1.25rem 0 .25rem; padding: 1rem 1.25rem; border-radius: 14px; background: var(--accent-soft); } .batch-total strong { font-size: 1.6rem; }

/* ---------- Paramètres : comptes, sauvegardes, SMS ---------- */
.acc-list { display: flex; flex-direction: column; gap: 1.1rem; } .acc-row { padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 14px; } .acc-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.card h3 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; }
.inline-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; } .inline-actions input { width: 9rem; min-height: 2.4rem; }
.snap-list { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; } .snap-list li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.keycode { display: block; margin: .6rem 0; padding: .7rem .9rem; border-radius: 10px; background: #fff; border: 1px solid #F3E3B8; font-family: var(--mono); font-size: .95rem; word-break: break-all; user-select: all; }
code { font-family: var(--mono); font-size: .88em; background: #F1F2F5; padding: .1rem .35rem; border-radius: 6px; word-break: break-all; }

/* ---------- Impression du rapport ---------- */
@media print {
  .no-print, .report-bar, .banner { display: none !important; }
  body { background: #fff; } .main, .page { padding: 0 !important; } .card, .kpi { box-shadow: none !important; border-color: #ccc !important; break-inside: avoid; }
  .cols2 { grid-template-columns: 1fr 1fr; } .report-title h2 { font-size: 1.4rem; } html { font-size: 12px; }
}
.page > .banner { display: block; }
.banner a { text-decoration: underline; font-weight: 700; }
