/* Fortuna — feuille de style unique. Les couleurs passent toutes par les variables. */
:root {
  color-scheme: light;
  --bg: #f4f3ef; --surface: #ffffff; --surface-2: #faf9f6; --sidebar: #fbfaf7;
  --text: #17181a; --text-2: #4a4b4f; --muted: #7c7d80; --border: #e7e5df; --border-strong: #d6d3cb;
  --accent: #1f5c4a; --accent-strong: #164536; --accent-soft: #e6efe9; --on-accent: #ffffff;
  --debit: #b4382e; --credit: #1d7a45;
  --warn-bg: #fdf3dc; --warn: #7d5a00; --warn-border: #f1dca6;
  --err-bg: #fce9e6; --err: #9b2c22; --ok-bg: #e4f2e8; --ok: #1d6a3d; --info-bg: #e8eef8; --info: #264f86;
  --series-in: #2a78d6; --series-out: #eb6834; --grid: #ecebe6;
  --shadow: 0 1px 2px rgba(20, 20, 15, .04), 0 1px 1px rgba(20, 20, 15, .03);
  --shadow-lg: 0 10px 30px -12px rgba(20, 20, 15, .18);
  --radius: 14px; --radius-sm: 9px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121312; --surface: #1b1c1b; --surface-2: #202120; --sidebar: #161716;
    --text: #eceae4; --text-2: #c3c2bb; --muted: #8e8d87; --border: #2c2d2b; --border-strong: #3a3b38;
    --accent: #7cc2a6; --accent-strong: #a3d8c2; --accent-soft: #1f3129; --on-accent: #0e1a15;
    --debit: #f08a7f; --credit: #7fd39b;
    --warn-bg: #33290f; --warn: #f0d38a; --warn-border: #4a3c15;
    --err-bg: #3a1d19; --err: #f4a79d; --ok-bg: #19301f; --ok: #9fdcb1; --info-bg: #1b2638; --info: #a9c4ee;
    --series-in: #3987e5; --series-out: #d95926; --grid: #2a2b29;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 10px 30px -12px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14.5px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1 { font-size: 1.65rem; font-weight: 650; letter-spacing: -.02em; margin: 0 0 20px; }
h2 { font-size: 1.02rem; font-weight: 620; letter-spacing: -.01em; margin: 32px 0 12px; }
h3 { font-size: .95rem; margin: 0 0 8px; }
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
        stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Mise en page ---------- */
body.with-sidebar { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  background: var(--sidebar); border-right: 1px solid var(--border); padding: 20px 14px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--text);
         font-weight: 700; font-size: 1.08rem; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
              background: linear-gradient(145deg, var(--accent), var(--accent-strong)); color: var(--on-accent);
              font-weight: 800; font-size: .95rem; box-shadow: var(--shadow); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-sm);
                 color: var(--text-2); font-weight: 500; }
.sidebar nav a:hover { background: var(--border); color: var(--text); text-decoration: none; }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.sidebar nav a.active .icon { stroke: var(--accent); }
.nav-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
             color: var(--muted); padding: 18px 10px 6px; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px; border-top: 1px solid var(--border); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
          background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
main { width: 100%; min-width: 0; max-width: 1320px; margin: 0 auto; padding: 32px 40px 64px; }
body.bare main { max-width: 980px; padding: 0 16px 48px; }

@media (max-width: 900px) {
  /* minmax(0, …) : sans cela, une barre de navigation large impose sa largeur à toute la page. */
  body.with-sidebar { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; z-index: 10; height: auto; min-width: 0; max-width: 100%;
             flex-direction: row; align-items: center; gap: 4px;
             padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand { padding: 0 6px 0 0; } .brand span:last-child { display: none; }
  .sidebar nav { flex-direction: row; overflow-x: auto; min-width: 0; flex: 1 1 auto;
                 scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .sidebar nav a { white-space: nowrap; padding: 7px 10px; }
  .nav-label, .who, .avatar { display: none; }
  .sidebar-foot { border: 0; padding: 0; flex: none; }
  main { padding: 18px 14px 48px; }
}

/* ---------- Barre de recherche ----------
   Dix champs alignés font un mur : sur un téléphone, dix lignes avant la première
   opération. Ce qu'on utilise tous les jours — le texte, le montant, la période —
   tient sur une ligne ; le reste se replie, et s'ouvre de lui-même quand il filtre
   déjà, sinon on chercherait sans voir pourquoi la liste est courte. */
.search-bar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
              padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 20px; }
.search-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.search-row .grow { flex: 1 1 260px; }
.search-row .grow input { width: 100%; }
.search-bar label { display: flex; flex-direction: column; font-size: .75rem; font-weight: 500;
                    color: var(--muted); gap: 4px; min-width: 0; }
.search-bar .hint { font-size: .68rem; font-weight: 400; line-height: 1.2; }
.refine { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.refine summary { cursor: pointer; font-size: .78rem; font-weight: 600; color: var(--muted);
                  list-style: none; display: flex; align-items: center; gap: 8px; }
.refine summary::-webkit-details-marker { display: none; }
.refine summary::before { content: "▸"; transition: transform .15s; }
.refine[open] summary::before { transform: rotate(90deg); }
.refine-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
               gap: 12px; padding-top: 12px; }
.refine-grid label.tick { flex-direction: row; align-items: center; gap: 8px; }
@media (max-width: 560px) {
  .search-row { gap: 10px; }
  .search-row .grow { flex-basis: 100%; }
  .search-row button, .search-row .btn { flex: 1 1 auto; }
  .refine-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- En-tête de page ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
             margin-bottom: 24px; }
.page-head h1 { margin: 0; }
.eyebrow { font-size: .78rem; color: var(--muted); font-weight: 500; margin-bottom: 4px; text-transform: capitalize; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 36px 0 12px; }
.section-head h2 { margin: 0; }
.section-head a { font-size: .88rem; font-weight: 500; }

/* ---------- Surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 20px; box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border);
              border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Tableaux ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
     background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
thead tr:first-child th:last-child { border-top-right-radius: var(--radius); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td a { font-weight: 500; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.debit { color: var(--debit); } .credit { color: var(--credit); }
.muted { color: var(--muted); font-size: .86rem; }
.desc { max-width: 440px; white-space: pre-line; }

/* ---------- Pastilles ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px;
        font-size: .76rem; font-weight: 500; background: var(--surface-2); border: 1px solid var(--border);
        color: var(--text-2); white-space: nowrap; line-height: 1.5; }
.pill.warn { background: var(--warn-bg); color: var(--warn); border-color: var(--warn-border); }
.pill.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.pill.accent { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; }

/* ---------- Messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 8px; }
.messages li { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface);
               border: 1px solid var(--border); border-left-width: 4px; box-shadow: var(--shadow); }
.messages .success { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.messages .warning { background: var(--warn-bg); border-color: var(--warn-border); border-left-color: var(--warn); color: var(--warn); }
.messages .error { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.messages .info { background: var(--info-bg); border-color: var(--info); color: var(--info); }
.messages a { color: inherit; text-decoration: underline; }

/* ---------- Indicateurs ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.stats .card { padding: 18px 20px; }
.stats .value { font-size: 1.75rem; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums;
                margin-top: 4px; }
.stats .value a { color: var(--text); }
.stat-link { display: block; color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
.stat-link:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-lg);
                   transform: translateY(-1px); }
.stat-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted);
            font-size: .85rem; font-weight: 500; }
.stat-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
             background: var(--surface-2); color: var(--text-2); }
.stat-hint { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.stat-link.attention .stat-icon { background: var(--warn-bg); color: var(--warn); }
.stat-link.done .stat-icon { background: var(--ok-bg); color: var(--ok); }

/* ---------- Formulaires ---------- */
form.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 20px;
               background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
               padding: 14px 16px; box-shadow: var(--shadow); }
form.filters label { display: flex; flex-direction: column; font-size: .75rem; font-weight: 500;
                     color: var(--muted); gap: 4px; }
/* L'aide d'un champ se lit sous lui, sans peser : la syntaxe d'une recherche
   s'oublie entre deux usages, et un exemple vaut mieux qu'une page d'aide. */
form.filters .hint { font-size: .68rem; font-weight: 400; line-height: 1.2; max-width: 220px; }
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  color: var(--text); min-height: 36px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent);
                                            box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
input[type=file] { padding: 10px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm);
                   background: var(--surface-2); width: 100%; max-width: 520px; }
button { background: var(--accent); color: var(--on-accent); border: 1px solid transparent; cursor: pointer;
         padding: 8px 16px; border-radius: 8px; font-weight: 600; min-height: 36px;
         transition: background .15s, transform .05s; }
button:hover { background: var(--accent-strong); }
button:active { transform: translateY(1px); }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
button.secondary:hover { background: var(--surface-2); }
button.link { background: none; color: var(--accent); padding: 0; min-height: 0; font-size: .82rem;
              font-weight: 500; border: 0; }
button.link:hover { text-decoration: underline; background: none; }
.icon-btn { background: none; color: var(--muted); padding: 6px; min-height: 0; border-radius: 8px; display: grid; }
.icon-btn:hover { background: var(--border); color: var(--text); }
form.inline { display: inline; }
form.stack p { display: flex; flex-direction: column; gap: 5px; max-width: 520px; margin: 0 0 14px; }
form.stack label { font-size: .85rem; font-weight: 500; color: var(--text-2); }
/* Champ dont le libellé est au-dessus : <label>Titre<input></label> */
form.stack > label, .form-grid label { display: flex; flex-direction: column; gap: 5px;
  font-size: .85rem; font-weight: 500; color: var(--text-2); }
form.stack > label.inline, .form-grid label.inline { flex-direction: row; align-items: center; gap: 8px; }
form.stack > label .muted, .form-grid label .muted { font-size: .78rem; font-weight: 400; }
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  align-items: start; }
.form-grid label { justify-content: flex-start; }
.form-grid.wide-first > label:first-child, .form-grid label.wide { grid-column: 1 / -1; }
.form-grid + .form-grid { margin-top: 14px; }
form.stack .actions, .form-grid .actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
.helptext { font-size: .8rem; color: var(--muted); }
.errorlist { color: var(--err); font-size: .85rem; padding-left: 18px; margin: 4px 0; }

/* ---------- Pagination, onglets, actions ---------- */
.pagination { margin-top: 16px; display: flex; gap: 14px; align-items: center; font-size: .9rem; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: var(--surface-2);
        border: 1px solid var(--border); border-radius: 11px; margin-bottom: 20px; width: fit-content; max-width: 100%; }
.tabs a { padding: 6px 14px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
.tabs a:hover { text-decoration: none; background: var(--border); }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.actions { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: .9rem; }

/* ---------- Justificatifs ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.doc-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
            color: var(--text); display: flex; flex-direction: column; box-shadow: var(--shadow);
            transition: transform .15s, box-shadow .15s; }
.doc-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.doc-card img { width: 100%; height: 200px; object-fit: cover; object-position: top; background: var(--surface-2);
                border-bottom: 1px solid var(--border); }
.doc-card .body { padding: 10px 12px 12px; display: grid; gap: 2px; }
.doc-card .amount { font-weight: 650; font-variant-numeric: tabular-nums; }
.pages { display: flex; gap: 12px; flex-wrap: wrap; }
.pages img { max-width: min(440px, 100%); border: 1px solid var(--border); border-radius: var(--radius-sm);
             box-shadow: var(--shadow); }
dl.fields { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
dl.fields dt { color: var(--muted); font-size: .88rem; }
dl.fields dd { margin: 0; }
.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; } }
.card.review { margin-bottom: 16px; display: grid; gap: 14px; }
.doc-summary { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; min-width: 0; }
.doc-summary > div { min-width: 0; flex: 1 1 220px; }
.doc-summary img { width: 90px; height: 120px; object-fit: cover; object-position: top; border-radius: 8px;
                   border: 1px solid var(--border); }
.doc-summary .amount { font-weight: 650; }

/* ---------- Tableau de bord ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 2fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 1100px) { .hero { grid-template-columns: 1fr; } }
.networth { display: flex; flex-direction: column; gap: 18px;
            background: linear-gradient(160deg, var(--accent) 0%, var(--accent-strong) 100%);
            color: var(--on-accent); border: 0; }
.networth .label { font-size: .85rem; opacity: .8; font-weight: 500; }
.networth .amount { font-size: 2.3rem; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
                    line-height: 1.1; }
.networth .amount small { font-size: 1rem; font-weight: 600; opacity: .75; margin-left: 4px; }
.networth .others { display: grid; gap: 4px; font-variant-numeric: tabular-nums; font-size: .95rem; }
.networth .split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: auto;
                   padding-top: 16px; border-top: 1px solid rgba(255, 255, 255, .18); }
.networth .split div { display: grid; gap: 2px; }
.networth .split span { font-size: .78rem; opacity: .75; }
.networth .split strong { font-variant-numeric: tabular-nums; font-size: 1.05rem; }

.chart-card { display: flex; flex-direction: column; gap: 10px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.chart-head h2 { margin: 0; }
.legend { display: flex; gap: 16px; font-size: .82rem; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar-in { fill: var(--series-in); }
.chart .bar-out { fill: var(--series-out); }
.chart .hit { fill: transparent; cursor: default; }
.chart .col:hover .hit { fill: var(--surface-2); }
.chart .col:hover rect.bar-in, .chart .col:hover rect.bar-out { opacity: 1; }
.chart:hover .col rect.bar-in, .chart:hover .col rect.bar-out { opacity: .55; }
.chart .col:hover rect.bar-in, .chart .col:hover rect.bar-out { opacity: 1; }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border);
           border-radius: 10px; box-shadow: var(--shadow-lg); padding: 10px 12px; font-size: .82rem; min-width: 170px;
           transform: translate(-50%, calc(-100% - 10px)); z-index: 5; }
.tooltip strong { display: block; margin-bottom: 6px; text-transform: capitalize; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tooltip .row span { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.tooltip .row.total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; font-weight: 600; }

.setup { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 16px;
         background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: var(--radius); color: var(--warn); }
.setup .icon { width: 20px; height: 20px; }
.setup .text { flex: 1; }
.setup strong { display: block; }
.setup .muted { color: inherit; opacity: .85; }
.setup a.btn { background: var(--warn); color: var(--warn-bg); }

a.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-weight: 600;
        background: var(--accent); color: var(--on-accent); white-space: nowrap; font-size: .9rem; }
a.btn:hover { text-decoration: none; filter: brightness(1.08); }
a.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
a.btn .icon { width: 16px; height: 16px; }

.accounts { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.account { display: flex; flex-direction: column; gap: 14px; color: var(--text); padding: 18px;
           transition: border-color .15s, box-shadow .15s, transform .15s; }
.account:hover { text-decoration: none; border-color: var(--border-strong); box-shadow: var(--shadow-lg);
                 transform: translateY(-1px); }
.account-top { display: flex; align-items: center; gap: 12px; }
.logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none;
        font-weight: 700; font-size: .8rem; color: #fff; letter-spacing: .02em; }
.logo.raiffeisen { background: #d6232a; } .logo.leman { background: #1c4f8c; } .logo.viseca { background: #1a1a1a; }
.logo.other { background: var(--accent); }
.account-name { font-weight: 600; line-height: 1.3; }
.account-sub { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.account-balance { font-size: 1.45rem; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.account-balance small { font-size: .8rem; font-weight: 600; color: var(--muted); margin-left: 3px; }
.account-balance.negative { color: var(--debit); }
.account-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap;
                font-size: .8rem; color: var(--muted); padding-top: 12px; border-top: 1px solid var(--border); }

.feed { padding: 6px 0; }
.feed-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 12px; align-items: center;
             padding: 10px 18px; color: var(--text); }
.feed-item:hover { background: var(--surface-2); text-decoration: none; }
.feed-item + .feed-item { border-top: 1px solid var(--border); }
.feed-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
             background: var(--surface-2); color: var(--text-2); }
.feed-icon.in { background: var(--ok-bg); color: var(--ok); }
.feed-label { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-amount { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
.stack-gap { display: grid; gap: 14px; }
.tooltip i.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.nowrap { white-space: nowrap; }
.pill .icon { width: 13px; height: 13px; }
.summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.summary-item { display: flex; gap: 16px; align-items: baseline; padding: 10px 16px; font-variant-numeric: tabular-nums;
                font-weight: 600; }
.summary-item .sep { color: var(--border-strong); }
.tx-table td { vertical-align: middle; }
.tx-label { color: var(--text); font-weight: 600; }
.label-cell { min-width: 280px; }
.remittance { white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
              overflow: hidden; max-width: 560px; }
td.amount { font-weight: 600; }
td.amount small { font-size: .75rem; font-weight: 500; color: var(--muted); }
.page-head > .muted { padding-bottom: 4px; }
.feed-amount .muted { display: inline; margin-left: 2px; font-size: .75rem; }
.eyebrow { text-transform: none; }
.eyebrow::first-letter { text-transform: uppercase; }

/* ---------- Menu déroulant « Pas besoin » ---------- */
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; cursor: pointer; color: var(--accent); font-size: .82rem; font-weight: 500; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary::after { content: " ▾"; font-size: .7rem; }
details.menu[open] > summary { text-decoration: underline; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 360px; max-width: 86vw;
              display: grid; gap: 8px; padding: 14px; background: var(--surface); border: 1px solid var(--border);
              border-radius: 12px; box-shadow: var(--shadow-lg); white-space: normal; text-align: left;
              font-size: .86rem; color: var(--text); }
.menu-title { font-weight: 600; }
.choice { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; border-radius: 8px; cursor: pointer; line-height: 1.45; }
.choice:hover { background: var(--surface-2); }
.choice input[type=radio] { margin-top: 3px; accent-color: var(--accent); }
.menu-panel input.amount-input:not([type=checkbox]) { width: 60px; min-height: 0; height: 26px; padding: 2px 6px;
                                                     text-align: right; font-size: .85rem; }
.menu-panel .muted { margin: 0; font-size: .78rem; }
.menu-panel button { justify-self: end; }
.receipt-cell { display: flex; gap: 10px; align-items: center; white-space: nowrap; }

/* ---------- Justificatifs venant d'un mail ---------- */
.mail-source { display: grid; gap: 12px; padding: 16px; width: 100%; }
.mail-head { display: flex; gap: 12px; align-items: center; }
.mail-head .muted { word-break: break-word; }
.mail-files { display: flex; gap: 6px; flex-wrap: wrap; }
.mail-files a.pill:hover { text-decoration: none; border-color: var(--border-strong); }
.mail-frame { width: 100%; height: 420px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.mail-frame.tall { height: 720px; }
.mail-source details summary { cursor: pointer; margin-bottom: 8px; }
.doc-mail { height: 200px; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center;
            padding: 16px; text-align: center; background: var(--info-bg); color: var(--info); font-size: .82rem;
            border-bottom: 1px solid var(--border); }
.doc-mail .icon { width: 30px; height: 30px; }
.doc-mail.small { width: 90px; height: 120px; border-radius: 8px; border: 1px solid var(--border); flex: none; }
.doc-mail.small .icon { width: 24px; height: 24px; }
form.filters.upload { background: var(--surface-2); border-style: dashed; }
form.filters.upload label { flex: 1; min-width: 260px; }
.setup.safe { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.pill.reimbursed { background: var(--info-bg); color: var(--info); border-color: transparent; }
.pill.reimbursed:hover { text-decoration: none; filter: brightness(0.97); }
.reimbursement-card h2 { display: flex; align-items: center; gap: 8px; }
.reimburse-bar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 12px;
                 position: sticky; top: 8px; z-index: 5; }
.reimburse-bar button { margin-left: auto; }
.pill.entity { background: var(--accent-soft); color: var(--accent-strong); border-color: transparent; margin-left: 6px; }
.advances { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.card.advance { display: flex; gap: 14px; align-items: center; color: var(--text); padding: 16px 18px;
                border-left: 4px solid var(--warn); }
.card.advance:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.card.advance .muted { display: block; }
.card.advance .stat-icon { background: var(--warn-bg); color: var(--warn); }
.pill.recurring { background: #efe9fb; color: #5b3fa8; border-color: transparent; margin-left: 6px; }
@media (prefers-color-scheme: dark) { .pill.recurring { background: #2b2440; color: #c9b8f5; } }
.suggestions { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 14px; }
.suggestion { display: grid; gap: 10px; padding: 16px; }
.suggestion-head { display: flex; gap: 10px; align-items: center; }
.suggestion-head input { flex: 1; font-weight: 600; }
.suggestion-head .amount { font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.suggestion-fields { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.suggestion-fields select { flex: 1; min-width: 120px; }

form.attach-receipt { margin-top: 14px; padding: 12px; border: 1px dashed var(--border, #d0d5dd); border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 6px; }
form.attach-receipt label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; }
form.attach-receipt input[type=file] { font-weight: 400; }

.justification-card { margin-bottom: 12px; }
.justification-card form.inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-right: 8px; }

/* ---------- Page de connexion ---------- */
.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
  gap: 0; max-width: 940px; margin: 6vh auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 6px);
  box-shadow: var(--shadow-lg); overflow: hidden; }
.auth-brand { background: linear-gradient(160deg, var(--accent-strong), var(--accent));
  color: var(--on-accent); padding: 40px 36px; display: flex; flex-direction: column; gap: 14px; }
.auth-brand h1 { margin: 0; font-size: 2.1rem; letter-spacing: -.02em; }
.auth-brand p { margin: 0; opacity: .9; }
.auth-mark { width: 88px; height: 88px; opacity: .96; filter: brightness(0) invert(1); }
.auth-points { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 8px; opacity: .92; font-size: .95rem; }
.auth-form { padding: 40px 36px; display: flex; flex-direction: column; justify-content: center; }
.auth-form h2 { margin: 0 0 18px; font-size: 1.5rem; }
.auth-form input { width: 100%; }
.auth-form button[type=submit] { width: 100%; margin-top: 6px; padding: 11px; font-weight: 600; }
.auth-error { background: var(--err-bg); color: var(--err); border: 1px solid var(--err);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 14px; font-size: .9rem; }
.auth-error p { margin: 2px 0; }
.auth-foot { margin-top: 18px; font-size: .82rem; }
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; margin: 0; border-radius: 0; border: 0; min-height: 100vh; }
  .auth-brand { padding: 28px 24px; }
  .auth-points { display: none; }
  .auth-form { padding: 28px 24px; }
}

/* ---------- Bulles d'aide ---------- */
.help { display: inline-block; position: relative; vertical-align: middle; margin-left: 6px; }
.help > summary { list-style: none; cursor: help; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: .72rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent-strong); border: 1px solid transparent; }
.help > summary::-webkit-details-marker { display: none; }
.help > summary:hover, .help[open] > summary { border-color: var(--accent); }
.help-bubble { position: absolute; z-index: 40; top: 24px; left: 0; width: min(320px, 78vw);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 12px 14px; font-size: .86rem; font-weight: 400;
  color: var(--text-2); line-height: 1.45; }
.help-bubble strong { display: block; color: var(--text); margin-bottom: 4px; }
.help-bubble p { margin: 0 0 6px; }
.help-bubble p:last-child { margin-bottom: 0; }
@media (max-width: 640px) { .help-bubble { left: auto; right: 0; } }
.brand-mark-img { width: 30px; height: 30px; color: var(--accent); flex: none; }
.page-head > .help, .section-head > .help { margin-right: auto; margin-left: 8px; }

/* ---------- Page de l'agent Mac ---------- */
.pairing-code { font-size: 2rem; font-weight: 700; letter-spacing: .12em; text-align: center;
  background: var(--accent-soft); color: var(--accent-strong); border-radius: var(--radius-sm);
  padding: 14px; margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.bullets { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.device { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 0;
  border-top: 1px solid var(--border); }
.device:first-of-type { border-top: 0; }
.device input[name=name] { min-width: 180px; }
.device .muted { flex-basis: 100%; font-size: .82rem; }


/* ---------- Ajustements responsives ---------- */
/* Un tableau dans une carte défile horizontalement au lieu d'élargir la page. */
.card > table { display: block; width: 100%; max-width: 100%; overflow-x: auto; }
.card > .actions { flex-wrap: wrap; }
.table-wrap { max-width: 100%; overflow-x: auto; }
.card, .stats > *, .accounts > * { min-width: 0; }
form.filters { max-width: 100%; }
@media (max-width: 760px) {
  h1 { font-size: 1.4rem; margin-bottom: 14px; }
  h2 { margin-top: 24px; }
  .page-head { flex-wrap: wrap; gap: 6px; }
  .section-head { flex-wrap: wrap; gap: 6px; }
  form.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
  form.filters label { min-width: 0; }
  form.filters button, form.filters .btn { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .stats, .accounts { grid-template-columns: 1fr; }
  .card { padding: 14px; }
  table { font-size: .9rem; }
  .device { align-items: stretch; }
  .device input[name=name] { width: 100%; }
}
@media (max-width: 480px) {
  form.filters { grid-template-columns: 1fr; }
}
.folder { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-top: 1px solid var(--border); }
.folder:first-of-type { border-top: 0; }
.folder .muted { font-size: .82rem; }
.folder-add { margin-top: 12px; }
.folder-add summary { cursor: pointer; color: var(--accent); font-size: .9rem; }

/* ---------- Factures à payer ---------- */
.bills { display: grid; gap: 12px; }
.bill { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.bill.overdue { border-left: 3px solid var(--warn); }
.bill-head { display: flex; gap: 10px; align-items: flex-start; }
.bill-head > div:first-of-type { flex: 1; min-width: 0; }
.bill-amount { font-size: 1.15rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bill-amount small { font-size: .78rem; font-weight: 600; color: var(--muted); }
.bill-qr { text-align: center; font-size: .75rem; max-width: 170px; }
.bill-qr img { background: #fff; border-radius: 8px; padding: 6px; }
.bill-actions { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  border-top: 1px solid var(--border); padding-top: 10px; }
.pay-details { margin-top: 8px; font-size: .88rem; }
.pay-details td { padding: 2px 10px 2px 0; }
.pay-details code { font-size: .85rem; word-break: break-all; }
.transfer { margin-top: 16px; }
.badge { background: var(--warn-bg); color: var(--warn); border-radius: 999px; padding: 1px 7px;
  font-size: .72rem; font-weight: 700; margin-left: auto; }
@media (max-width: 760px) { .bill { grid-template-columns: 1fr; } .bill-qr { max-width: none; } }
.notice { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; color: var(--text); }
.notice:hover { text-decoration: none; box-shadow: var(--shadow-lg); }
.notice-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--warn-bg); color: var(--warn); flex: none; }

/* ---------- Relier un iPhone (page Agent Mac) ---------- */
.phone-invite { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.phone-invite img { border-radius: 10px; border: 1px solid var(--border); background: #fff; flex: none; }
.phone-invite > div { flex: 1 1 260px; min-width: 0; }
.phone-invite ol { margin: 0 0 10px; padding-left: 20px; }
.phone-invite li { margin-bottom: 5px; }
.phone-invite a { word-break: break-all; }

/* ---------- Panneau « Ignorer » d'une facture ---------- */
/* Ancré à gauche : le bouton se trouve au bord gauche de la carte, un panneau
   aligné à droite déborderait sur la barre latérale. */
.ignore-panel { left: 0; right: auto; width: 340px; }
.ignore-panel label { display: grid; gap: 5px; font-weight: 500; }
.ignore-panel textarea, .ignore-panel select { width: 100%; font: inherit; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface);
  color: var(--text); font-weight: 400; }
.ignore-panel textarea { resize: vertical; min-height: 56px; }
.ignore-panel button { justify-self: stretch; margin-top: 2px; }

/* ---------- Compte à débiter, sur chaque facture ---------- */
.pay-from { margin-right: auto; }
.pay-from label { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--muted); }
.pay-from select { font: inherit; font-size: .84rem; padding: 6px 9px; border: 1px solid var(--border);
  border-radius: 9px; background: var(--surface); color: var(--text); max-width: 230px; }

/* ---------- Entre nous : les dettes ---------- */
.balance { margin-bottom: 16px; }
.balance-head { display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.balance-amount { font-size: 1.15rem; font-weight: 600; }
.balance-amount.credit { color: var(--credit); }
.balance-amount.debit { color: var(--debit); }
.balance-amount small { font-size: .75rem; font-weight: 400; color: var(--muted); margin-left: 3px; }

/* ---------- Quotes-parts d'un compte ---------- */
.shares { min-width: 236px; }
.shares .share { display: flex; align-items: center; gap: 6px; font-size: .84rem;
  margin-bottom: 5px; flex-wrap: wrap; }
.shares .share input[inputmode=decimal] { width: 58px; text-align: right; }
.shares .share select { max-width: 148px; font-size: .84rem; }
.shares .drop { display: inline-flex; align-items: center; gap: 4px; color: var(--muted);
  font-size: .76rem; }
.shares .add { margin-top: 6px; }
.shares .muted { font-size: .78rem; margin-bottom: 6px; }

/* ---------- Apport reconnu, en attente d'un mot ----------
   Nom distinct de « .suggestion », qui appartient déjà aux suggestions de biens et
   les dispose en grille : deux règles pour deux choses différentes. */
.contribution { background: var(--warn-bg); border: 1px solid var(--warn-border);
  color: var(--warn); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px;
  line-height: 1.55; }
.contribution strong { color: var(--text); }
.contribution .row { margin-top: 12px; gap: 12px; align-items: center; }
.contribution .row > * { flex: 0 0 auto; text-align: left; }
