/* Sika Business — v0.1.5.
   Téléphone : EXACTEMENT le style de SIKA (son app.css v0.4 → v0.11, mêmes tailles, mêmes couleurs, clair seulement).
   Identité : bordeaux, cartes blanc cassé, rouge seulement pour les alertes, vert seulement pour l'argent qui entre.
   Ordinateur (900 px et plus) : menu à gauche, tableau de bord en grille, clair ou sombre comme le tableau de bord SIKA. */

@font-face {
  font-family: 'Figtree';
  src: url('../fonts/figtree.woff2') format('woff2');
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bordeaux: #800020;
  --bordeaux-dark: #5c0017;
  --bordeaux-soft: rgba(128, 0, 32, 0.08);
  --bg: #efebe7;
  --card: #faf8f5;
  --text: #1c1a1a;
  --muted: #6b6461;
  --line: #ddd6d0;
  --input: #fff;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --ok: #1e7f4f;
  --ok-bg: #e5f4ec;
  --warn-bg: #fff4d6;
  --warn-text: #6b4e00;
  --hover: rgba(0, 0, 0, 0.04);
  --radius: 8px;       /* blocs : peu arrondis */
  --pill: 999px;       /* boutons et champs : entièrement ronds */
  /* graphiques (palette vérifiée du tableau de bord SIKA) */
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --track: #cde2fb;
}
/* Sombre : seulement sur ordinateur, comme le tableau de bord SIKA. Le téléphone reste clair, comme SIKA. */
@media (prefers-color-scheme: dark) and (min-width: 900px) {
  :root {
    color-scheme: dark;
    --bordeaux: #d9506f;
    --bordeaux-dark: #b23a57;
    --bordeaux-soft: rgba(217, 80, 111, 0.14);
    --bg: #0f0e0e;
    --card: #1b1a19;
    --text: #f3f1ef;
    --muted: #a9a39f;
    --line: #34312f;
    --input: #141313;
    --danger: #ef7b74;
    --danger-bg: #3a1716;
    --ok: #4cc58a;
    --ok-bg: #13301f;
    --warn-bg: #3a2f10;
    --warn-text: #f1d48a;
    --hover: rgba(255, 255, 255, 0.05);
    --grid: #2c2c2a;
    --axis: #3f3e3a;
    --series-1: #3987e5;
    --series-2: #d95926;
    --track: #184f95;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Figtree', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}
body { overflow-x: hidden; }
a { color: inherit; text-decoration: none; }

/* La colonne de l'appli : 460 px au plus, comme SIKA. */
.main-col {
  max-width: 460px;
  margin: 0 auto;
  padding: 12px 14px calc(20px + env(safe-area-inset-bottom));
}
.view, .stack, form.stack { display: flex; flex-direction: column; gap: 10px; }

h1 { font-size: 1.15rem; margin: 4px 0 0; color: var(--bordeaux); font-weight: 800; }
h2 { font-size: 0.9rem; margin: 0 0 4px; font-weight: 700; }
h3 { margin: 0; }
p { margin: 0; }

/* Nom de l'app : grand, au centre. */
.brand {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--bordeaux);
  margin: 10px 0 4px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.brand-sub { text-align: center; font-weight: 600; letter-spacing: 0.3em; text-transform: uppercase; font-size: 0.68rem; color: var(--muted); margin-top: -4px; }
.brandbar { position: relative; }
.brandbar .brand { margin: 4px 0; }
.brand-icon { display: block; width: 72px; height: 72px; margin: 0 auto 4px; border-radius: 18px; }
.icon-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  min-height: 0;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--bordeaux);
}
.icon-btn.left { right: auto; left: 0; }
.icon-btn.plain { position: static; transform: none; width: 38px; flex: 0 0 auto; }
.ic, .icon-btn svg, .tabbar svg, .eye svg, .eye-btn svg, .fab svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.ic.small { width: 16px; height: 16px; }
.ic.tiny { width: 13px; height: 13px; color: var(--muted); }
.ic.big { width: 40px; height: 40px; }
.ic.ok { color: var(--ok); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  position: relative;
}
.card.archived { opacity: 0.7; }

/* ---------- champs (comme SIKA) ---------- */
label, .field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 0.85rem; min-width: 0; }
.field-label { font-weight: 600; font-size: 0.85rem; }
p.field-label { margin-bottom: 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: 0.72rem; }
label.check, .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 0.85rem; }
label.check input, .check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--bordeaux); flex: 0 0 auto; }

input[type="text"], input[type="password"], input[type="tel"], input[type="number"], input[type="search"], input[type="date"], select, textarea {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--input);
  color: var(--text);
  min-height: 40px;
}
textarea { border-radius: 18px; resize: vertical; }
input:focus, textarea:focus, select:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid rgba(128, 0, 32, 0.4);
  outline-offset: 1px;
}
/* Flèche des listes et des dates : la même, bien à l'intérieur du champ. */
select, input[type="date"] {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6461' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 16px;
}
input[type="date"] { position: relative; }
input[type="date"]::-webkit-calendar-picker-indicator { position: absolute; top: 0; right: 0; width: 52px; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: pointer; }
input[type="date"]::-webkit-inner-spin-button, input[type="date"]::-webkit-clear-button { display: none; }

/* ---------- boutons (comme SIKA) ---------- */
button, a.button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--pill);
  border: 1.5px solid var(--bordeaux);
  background: transparent;
  color: var(--bordeaux);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  width: 100%;
}
button.primary { background: var(--bordeaux); color: #fff; }
button.primary:active { background: var(--bordeaux-dark); }
button.secondary, a.button.secondary { background: transparent; color: var(--bordeaux); }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
button.link, a.link { background: none; border: 0; color: var(--bordeaux); text-decoration: underline; font-weight: 500; min-height: 36px; padding: 6px 8px; }
button.small { width: auto; min-height: 34px; padding: 6px 14px; font-size: 0.85rem; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1 1 0; }
.row.between { justify-content: space-between; align-items: center; flex-wrap: nowrap; }
.row.between > * { flex: 0 1 auto; }
.row.links { justify-content: center; flex-wrap: nowrap; }
.row.links > * { flex: 0 1 auto; width: auto; font-size: 0.85rem; }

.chip { border: 1px solid var(--line); background: var(--input); color: var(--text); font-weight: 500; }
.chip.active { border-color: var(--bordeaux); background: var(--bordeaux); color: #fff; }
.chips { display: flex; gap: 6px; }
.chips .chip { flex: 0 0 auto; width: auto; min-height: 32px; padding: 5px 12px; font-size: 0.85rem; }
.chips.wrap { flex-wrap: wrap; }
/* Filtres de l'historique : tous sur une ligne. */
.chips.line { flex-wrap: nowrap; }
.chips.line .chip { flex: 1 1 0; padding: 5px 4px; font-size: 0.8rem; }

.muted { color: var(--muted); font-size: 0.85rem; }
.small { font-size: 0.8rem; }
.small-note { font-size: 0.72rem; }
.block { display: block; }
.center { text-align: center; }
.center-text { text-align: center; }
.right { text-align: right; }
.grow { flex: 1 1 auto; min-width: 0; }
.pos { color: var(--ok); }
.neg, .negtxt { color: var(--danger); }
.error { color: var(--danger); font-weight: 600; font-size: 0.85rem; }
.ok { color: var(--ok); font-weight: 600; font-size: 0.85rem; }
.error:empty, .ok:empty, .banner:empty, .muted:empty { display: none; }
.lead { font-size: 1rem; font-weight: 600; color: var(--text); }

.banner { border-radius: var(--radius); padding: 8px 12px; font-weight: 600; font-size: 0.85rem; display: flex; gap: 8px; align-items: center; }
.banner.warn { background: var(--warn-bg); color: var(--warn-text); }
.banner.danger { background: var(--danger-bg); color: var(--danger); }
.banner.info { background: var(--input); border: 1px solid var(--line); color: var(--text); }
a.banner .ic { margin-left: auto; }

.danger-zone { border-color: #e7b4ae; background: var(--danger-bg); }

/* ---------- fenêtres (comme SIKA) ---------- */
.modal, .busy {
  position: fixed;
  inset: 0;
  background: rgba(20, 10, 12, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 30;
}
.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-box h2 { font-size: 1rem; }
.toast { position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 40; opacity: 0; pointer-events: none;
  background: #222; color: #fff; padding: 9px 16px; border-radius: var(--pill); font-weight: 600; font-size: 0.85rem; transition: opacity 0.2s, transform 0.2s; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }

/* ---------- barre du bas (comme SIKA) ---------- */
body.has-tabs .main-col { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }
body.has-fab .main-col { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: center;
  gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--card);
  border-top: 1px solid var(--line);
  z-index: 5;
}
.tabbar a {
  flex: 1 1 0;
  max-width: 110px;
  min-height: 48px;
  padding: 4px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.tabbar a.active { color: var(--bordeaux); font-weight: 700; }

/* Bouton + flottant, au-dessus de la barre du bas. */
.fab {
  position: fixed;
  right: max(16px, calc(50% - 214px));
  bottom: calc(76px + env(safe-area-inset-bottom));
  width: 54px;
  height: 54px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: var(--bordeaux);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 16px rgba(92, 0, 23, 0.35);
  z-index: 7;
  transition: transform 0.15s ease;
}
.fab svg { width: 24px; height: 24px; stroke-width: 2.2; }
.fab.open { transform: rotate(45deg); }
.fab-backdrop { position: fixed; inset: 0; background: rgba(20, 10, 12, 0.35); z-index: 6; }
.fab-menu {
  position: fixed;
  right: max(16px, calc(50% - 214px));
  bottom: calc(140px + env(safe-area-inset-bottom));
  width: min(428px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  z-index: 7;
}
.fab-menu button { width: 100%; min-height: 46px; font-weight: 700; border: 0; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18); }
/* Dépense rouge, Revenu vert, Transfert neutre au-dessus de Revenu. */
.fab-menu .fab-expense { grid-column: 1; grid-row: 2; background: var(--danger); color: #fff; }
.fab-menu .fab-income { grid-column: 2; grid-row: 2; background: var(--ok); color: #fff; }
.fab-menu .fab-transfer { grid-column: 2; grid-row: 1; background: #fff; color: var(--text); border: 1px solid var(--line); }
/* Membre : pas de barre du bas, le + descend. */
body.member .fab { bottom: calc(24px + env(safe-area-inset-bottom)); }
body.member .fab-menu { bottom: calc(88px + env(safe-area-inset-bottom)); }

/* ---------- Dashboard, comptes, historique (comme SIKA) ---------- */
.card.total { position: relative; gap: 2px; text-align: center; }
.card.total > button:not(.eye-btn) { margin-top: 8px; }
.big { font-size: 2.1rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fx { font-weight: 600; color: var(--text); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.eye-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 34px;
  height: 34px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.worth-row { display: flex; justify-content: space-between; gap: 12px; font-size: 0.85rem; }
.worth-row.total { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; font-weight: 800; }
.version-line { text-align: center; }

.list { display: flex; flex-direction: column; }
.tx-row, .acc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 400;
}
.list > .tx-row:last-child, .list > .acc-row:last-child, .card > .acc-row:last-child, .card > .tx-row:last-child { border-bottom: 0; }
.tx-row:active, .acc-row:active { background: var(--bordeaux-soft); }
.acc-row { justify-content: space-between; }
.acc-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tx-icon { font-size: 1.1rem; width: 24px; text-align: center; flex: 0 0 auto; color: var(--muted); }
.tx-mid { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.tx-title { font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.tx-title > span { overflow: hidden; text-overflow: ellipsis; }
.tx-meta { color: var(--muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nogo-note { color: var(--danger); }
.fee-row .tx-icon { font-weight: 800; }
.amt { font-weight: 700; font-size: 0.9rem; font-variant-numeric: tabular-nums; white-space: nowrap; flex: 0 0 auto; }
.amt.in { color: var(--ok); }
.tx-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: 0 0 auto; }
/* Statut d'une saisie de l'équipe. */
.status { font-size: 0.68rem; font-weight: 700; padding: 1px 7px; border-radius: var(--pill); white-space: nowrap; }
.status.pending { background: var(--warn-bg); color: var(--warn-text); }
.status.approved { background: var(--ok-bg); color: var(--ok); }
.status.rejected { background: var(--danger-bg); color: var(--danger); }
.list-head { font-size: 0.78rem; color: var(--muted); text-transform: capitalize; padding: 10px 6px 2px; font-weight: 700; }

.pool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pool-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pool-card.neg { border-color: #e7b4ae; background: var(--danger-bg); }
.pool-card.neg .pool-amt { color: var(--danger); }
.pool-name { color: var(--muted); font-size: 0.78rem; }
.pool-amt { font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.split-grid { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; font-size: 0.85rem; }
.split-grid > :nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }

/* Pastilles (lettre), couleurs de SIKA. */
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: #fff;
  background: var(--muted);
}
.avatar.cat-mobile { background: #2f6f9f; }
.avatar.cat-cash { background: #4f7f3a; }
.avatar.cat-bank { background: var(--bordeaux); }
.avatar.cat-asset-land { background: #8d6e63; }
.avatar.cat-asset-stocks { background: #1565c0; }
.avatar.cat-asset-crypto { background: #ef6c00; }
.avatar.cat-asset-savings { background: #2e7d32; }
.avatar.cat-asset-equipment { background: #546e7a; }

/* Échéancier d'une dette. */
.sched-row { display: grid; grid-template-columns: 1fr auto 72px; gap: 8px; align-items: center; font-size: 0.82rem; padding: 6px 0; border-bottom: 1px solid var(--line); }
.sched-row:last-child { border-bottom: 0; }
.sched-status { text-align: right; font-size: 0.72rem; color: var(--muted); }
.sched-row.paid { color: var(--muted); }
.sched-row.paid .sched-status { color: var(--ok); }
.sched-row.late, .sched-row.late .sched-status { color: var(--danger); font-weight: 700; }

/* Valeur d'un investissement. */
.spark { display: block; width: 100%; height: 60px; }
.spark path { fill: none; stroke: var(--bordeaux); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: var(--bordeaux); }

/* Mes envies. */
.wish-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.wish-row:last-child { border-bottom: 0; }
.wish-tick { width: 26px; height: 26px; min-height: 0; padding: 0; margin-top: 1px; border-radius: 50%; border: 2px solid var(--bordeaux); background: #fff; color: #fff; font-weight: 800; font-size: 0.8rem; display: grid; place-items: center; }
.wish-row.done .wish-tick { background: var(--ok); border-color: var(--ok); }
.wish-body { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 0; padding: 0; border: 0; background: none; color: var(--text); text-align: left; width: 100%; font-weight: 400; }
.wish-note { font-size: 0.78rem; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.wish-price { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.wish-row.done .tx-title { text-decoration: line-through; color: var(--muted); }
.quiet-link { align-self: center; font-size: 0.8rem; color: var(--muted); width: auto; }

/* Montant et frais sur la même ligne. */
.amount-row { display: grid; grid-template-columns: 1fr; gap: 8px; }
.amount-row.two { grid-template-columns: 2fr 1fr; }
.amount-row > * { min-width: 0; }

/* Œil DANS les champs secrets. */
.secret { position: relative; display: block; }
.secret input { padding-right: 46px; }
.eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
}

/* Code PIN : une case ronde par chiffre. Le vrai champ est posé dessus, invisible. */
.pin-box { position: relative; display: flex; justify-content: center; }
.pin-slots { display: flex; gap: 10px; justify-content: center; }
.pin-slots .slot {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
}
.pin-slots .slot.current { border-color: var(--bordeaux); box-shadow: 0 0 0 3px rgba(128, 0, 32, 0.12); }
.pin-slots .slot.filled::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--text); }
input.pin-hidden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  padding: 0;
  min-height: 0;
  caret-color: transparent;
  color: transparent;
  background: transparent;
  font-size: 16px; /* évite le zoom automatique */
}
@media (max-width: 380px) { .pin-slots { gap: 6px; } .pin-slots .slot { width: 34px; height: 34px; } }

/* Écran d'entrée : centré, comme l'écran verrouillé de SIKA. */
.auth { max-width: 460px; margin: 0 auto; padding: 12px 14px; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; }
.auth-card { display: flex; flex-direction: column; gap: 10px; }
.pin-show { font-size: 2rem; font-weight: 800; letter-spacing: 0.08em; text-align: center; padding: 14px; border-radius: var(--radius); background: var(--bordeaux-soft); color: var(--bordeaux); }

/* ---------- ce qui n'existe que dans Sika Business ---------- */
.badge { background: var(--danger); color: #fff; border-radius: var(--pill); font-size: 0.7rem; font-weight: 700; padding: 1px 7px; min-width: 20px; text-align: center; }
.row-link { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 2px; border-bottom: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 0.9rem; }
.row-link:last-child { border-bottom: 0; }
.row-link .ic { color: var(--bordeaux); }
.row-link .ic.small { color: var(--muted); }
.row-link:active { background: var(--bordeaux-soft); }

/* Petites cases de chiffres (rapports, récurrentes) : même dessin que les pools. */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 420px) { .tiles.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tiles.three > :last-child:nth-child(odd) { grid-column: span 2; } }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile-label { font-size: 0.78rem; color: var(--muted); }
.tile-value { font-size: 1rem; font-weight: 800; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 0.72rem; color: var(--muted); }
.tile.pos .tile-value { color: var(--ok); }
.tile.neg .tile-value { color: var(--danger); }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 0.85rem; padding: 2px 0; }
.kv > span:last-child { text-align: right; overflow-wrap: anywhere; }
.kv.strong { font-weight: 800; }
.more-link { color: var(--bordeaux); font-weight: 500; font-size: 0.85rem; text-decoration: underline; padding-top: 4px; align-self: center; }

.due-row, .journal-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); min-width: 0; font-size: 0.85rem; }
.due-row:last-child, .journal-row:last-child { border-bottom: 0; }
.due-row strong { font-size: 0.9rem; }
.due-row .chip { width: auto; min-height: 32px; padding: 5px 12px; font-size: 0.8rem; }
.due-row.late strong { color: var(--danger); }
.due-row.off { opacity: 0.6; }
@media (max-width: 560px) { .due-row { flex-wrap: wrap; } .due-row > .row { width: 100%; justify-content: flex-end; } .due-row > .row > * { flex: 0 0 auto; } }
.journal-row { flex-direction: column; align-items: stretch; gap: 2px; }
.month-nav { display: flex; align-items: center; gap: 4px; }
.month-nav .icon-btn { position: static; transform: none; flex: 0 0 auto; }
.month-label { font-weight: 700; flex: 1 1 auto; text-align: center; text-transform: capitalize; }
.month-nav .chip { width: auto; flex: 0 0 auto; min-height: 32px; padding: 5px 12px; font-size: 0.8rem; }

.pool-edit { display: grid; grid-template-columns: 1fr 86px auto; gap: 8px; align-items: center; }
.need-edit { display: grid; grid-template-columns: 1fr minmax(100px, 160px) 40px 40px; gap: 6px; align-items: center; }
.need-edit.add { grid-template-columns: 1fr minmax(100px, 160px) auto; }
.need-edit .icon-btn { position: static; transform: none; width: 40px; height: 40px; }
.need-edit input, .need-edit select { padding-left: 12px; padding-right: 28px; }
.need-edit.add button { width: auto; }
.need-edit.off { opacity: 0.6; }
@media (max-width: 560px) {
  .need-edit { grid-template-columns: 1fr 40px 40px; row-gap: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .need-edit input { grid-column: 1 / -1; }
  .need-edit.add { grid-template-columns: 1fr; border-bottom: 0; }
  .need-edit.add button { width: 100%; }
}

/* Fiche d'une opération. */
.type-tag { font-size: 0.75rem; font-weight: 700; padding: 2px 10px; border-radius: var(--pill); background: var(--hover); color: var(--muted); align-self: center; }
.type-tag.income { background: var(--ok-bg); color: var(--ok); }
.detail-head { display: flex; justify-content: center; gap: 6px; align-items: center; }

/* Factures. */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thumbs.small { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.thumbs:empty { display: none; }
.thumb-wrap { position: relative; }
.thumb { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--input); aspect-ratio: 3 / 4; }
.thumb img { width: 100%; flex: 1; object-fit: cover; min-height: 0; }
.thumb .pdf { flex: 1; display: grid; place-items: center; align-content: center; gap: 4px; color: var(--danger); font-weight: 800; }
.thumb .pdf .ic { width: 30px; height: 30px; }
.thumb-name { font-size: 0.66rem; padding: 3px 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.thumb-del { position: absolute; top: 4px; right: 4px; min-height: 28px; width: 28px; height: 28px; padding: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.6); color: #fff; border: 0; }
.thumb-del .ic { width: 14px; height: 14px; }
.file-btn { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 10px; white-space: nowrap; border-radius: var(--pill); border: 1.5px solid var(--bordeaux); color: var(--bordeaux); font-weight: 600; font-size: 0.85rem; flex-direction: row; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-btn:focus-within { outline: 2px solid rgba(128, 0, 32, 0.4); outline-offset: 1px; }
.empty { padding: 12px 4px; display: flex; flex-direction: column; gap: 8px; }

/* Glisser entre les onglets : l'écran suit le doigt. */
.view.slide-l { animation: slideL 220ms ease-out; }
.view.slide-r { animation: slideR 220ms ease-out; }
@keyframes slideL { from { transform: translateX(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes slideR { from { transform: translateX(-40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .view.slide-l, .view.slide-r { animation: none; } }
.view { touch-action: pan-y; }

/* ---------- graphiques (repris du tableau de bord SIKA) ---------- */
.viz { width: 100%; min-width: 0; position: relative; }
.viz-svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz-grid { stroke: var(--grid); stroke-width: 1; }
.viz-base { stroke: var(--axis); stroke-width: 1; }
.viz-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz-band { fill: transparent; }
.viz-band.on { fill: var(--hover); }
.viz-hit { fill: transparent; cursor: crosshair; outline: none; }
.viz-mark.series-1, .viz-swatch.series-1, .viz-key.series-1, .hbar.series-1 { fill: var(--series-1); background: var(--series-1); }
.viz-mark.series-2, .viz-swatch.series-2, .viz-key.series-2, .hbar.series-2 { fill: var(--series-2); background: var(--series-2); }
.viz-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); }
.viz-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.viz-swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.viz-tip { position: absolute; z-index: 5; pointer-events: none; background: var(--card); color: var(--text); border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14); border-radius: var(--radius); padding: 8px 10px; font-size: 0.78rem; min-width: 150px; }
.viz-tip-title { color: var(--muted); margin-bottom: 4px; }
.viz-tip-row { display: flex; align-items: center; gap: 8px; }
.viz-tip-label { color: var(--muted); }
.viz-key { width: 12px; height: 2px; border-radius: 1px; display: inline-block; }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar-row { display: grid; grid-template-columns: minmax(90px, 36%) 1fr auto; gap: 10px; align-items: center; font-size: 0.82rem; border-radius: 6px; padding: 2px 4px; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.hbar-track { position: relative; height: 14px; }
.hbar { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 0 4px 4px 0; }
.hbar-value { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.meter { display: inline-block; width: 100%; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.meter-fill { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.viz-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.viz-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.75rem; border-bottom: 1px solid var(--grid); padding: 6px 8px; }
.viz-table td { border-bottom: 1px solid var(--grid); padding: 7px 8px; vertical-align: top; }
.viz-table tr:last-child td { border-bottom: 0; }
.viz-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-wrap { width: 100%; overflow-x: auto; }
h3.sub { font-size: 0.85rem; margin-top: 8px; }

/* ---------- cadre : téléphone d'abord ---------- */
.side, .top, .desk-only { display: none; }
.dash { display: flex; flex-direction: column; gap: 10px; }
.cols { display: flex; flex-direction: column; gap: 10px; }

/* Tablette et ordinateur (admin) : menu à gauche, en-tête en haut, tableau de bord en grille. */
@media (min-width: 900px) {
  html, body { font-size: 15px; }
  body.admin .phone-only { display: none !important; }
  body.admin .shell { display: grid; grid-template-columns: 236px 1fr; }
  body.admin .side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; height: 100vh; padding: 18px 12px; border-right: 1px solid var(--line); background: var(--card); overflow-y: auto; }
  .side-brand { display: flex; flex-direction: column; padding: 4px 10px 10px; }
  .side-brand .brand { font-size: 1.3rem; margin: 0; text-align: left; }
  .side-brand .brand-sub { text-align: left; margin: 0; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-link { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 0.92rem; }
  .side-link:hover { background: var(--hover); }
  .side-link.active { background: var(--bordeaux-soft); color: var(--bordeaux); }
  .side-link .badge { margin-left: auto; }
  .side-foot { margin-top: auto; padding: 8px 12px; }
  body.admin .main-col { max-width: 1400px; width: 100%; padding: 0 clamp(16px, 3vw, 36px) 36px; }
  body.admin .tabbar, body.admin .fab, body.admin .fab-menu, body.admin .fab-backdrop { display: none !important; }
  body.admin.has-tabs .main-col { padding-bottom: 36px; }
  body.admin .top { display: flex; position: sticky; top: 0; z-index: 10; align-items: center; justify-content: space-between; gap: 8px; padding: 16px 0 10px; background: var(--bg); }
  .top h1 { font-size: 1.35rem; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-actions { display: flex; align-items: center; gap: 6px; }
  .top-actions button { width: auto; min-height: 38px; padding: 6px 14px; }
  .top-actions .icon-btn { position: static; transform: none; width: 38px; padding: 0; }
  .act.expense { background: var(--danger); border-color: var(--danger); color: #fff; }
  .act.income { background: var(--ok); border-color: var(--ok); color: #fff; }
  .desk-only { display: block; }
  .row.desk-only, .chips.desk-only, .month-nav.desk-only { display: flex; }
  .tiles.desk-only { display: grid; }
  .view { gap: 12px; }
  .card { padding: 14px; gap: 10px; }
  .pool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dash .pool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .hero-value { font-size: clamp(1.9rem, 3vw, 2.6rem); font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
  .hero-cats { display: flex; gap: 6px; flex-wrap: wrap; }
  .pill { font-size: 0.78rem; background: var(--hover); border-radius: var(--pill); padding: 3px 10px; color: var(--muted); }
  .hero-worth { border-top: 1px solid var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 3px; }
  .tx-row:hover, .acc-row:hover, .row-link:hover { background: var(--hover); }
  .toast { bottom: 32px; }
  /* Sur ordinateur, les boutons ne prennent pas toute la largeur. */
  .view > form.stack, .view > .stack > form.stack { max-width: 560px; }
  .card.total { text-align: left; }
  .card.total > button:not(.eye-btn) { width: auto; align-self: flex-start; }
}
@media (min-width: 1100px) {
  .dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; align-items: start; }
  .span-4 { grid-column: span 4; }
  .span-8 { grid-column: span 8; }
  .cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
}
@media print {
  .side, .tabbar, .fab, .top-actions, .month-nav button, .chips { display: none !important; }
  .card { break-inside: avoid; }
}
