/* ==========================================================
   Notre Maison : direction « plaque émaillée & mur chaulé »
   Le seul élément appuyé de l'interface est la plaque émaillée bleue qui porte
   le nom de la maison, comme les numéros des maisons françaises. Tout le reste
   reste calme : murs chaulés, encre, vert volet, ocre pour aujourd'hui.
   ========================================================== */


:root {
  /* Palette */
  --wall: #eceee8;        /* mur chaulé */
  --plaster: #fafbf8;     /* enduit, surfaces */
  --ink: #1b2321;         /* encre */
  --muted: #5b6863;
  --line: #d3d9d1;
  --line-soft: #e3e7e0;
  --email: #1f3d8a;       /* bleu émail */
  --email-ink: #1f3d8a;   /* bleu pour le texte */
  --email-soft: #dde4f2;
  --volet: #3f6b5a;       /* vert volet */
  --volet-soft: #dbe8e1;
  --ocre: #b97a10;        /* aujourd'hui, attention */
  --ocre-bright: #e2a43a;
  --ocre-soft: #f5e7c8;
  --brique: #a3402c;      /* erreurs, dettes */
  --brique-soft: #f3ddd6;
  --lavande: #6f5a92;
  --on-email: #ffffff;
  --scrim: rgba(17, 24, 22, .5);

  /* Typographie */
  --display: "Bricolage", "Bricolage Grotesque", "Avenir Next Condensed", "Arial Narrow", sans-serif;
  --text: "Atkinson", "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --fs-xs: 13px; --fs-s: 14.5px; --fs-m: 16px; --fs-l: 20px; --fs-xl: 26px; --fs-2xl: 36px; --fs-3xl: 48px;

  /* Formes : la plaque est la plus arrondie, puis les panneaux, puis les puces */
  --r-plaque: 12px; --r-panel: 8px; --r-ctl: 7px; --r-chip: 4px;
  --sidebar: 252px;
  --tabbar: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --wall: #121715;
    --plaster: #1a201e;
    --ink: #e5e9e4;
    --muted: #95a29c;
    --line: #2e3734;
    --line-soft: #252d2a;
    --email: #2c51b0;
    --email-ink: #93acee;
    --email-soft: #1d2843;
    --volet: #7fb39d;
    --volet-soft: #1c2e27;
    --ocre: #e4ae4c;
    --ocre-bright: #e4ae4c;
    --ocre-soft: #352a14;
    --brique: #e7836c;
    --brique-soft: #3a211b;
    --lavande: #b39ddb;
    --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--text);
  font-size: var(--fs-m);
  line-height: 1.5;
  color: var(--ink);
  background: var(--wall);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
.amount, .bal-amt, .code-val, .solde .v, .code-box .code { font-variant-numeric: tabular-nums; }
a { color: var(--email-ink); text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
h1, h2, h3 { margin: 0; font-family: var(--display); line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: var(--fs-2xl); font-weight: 700; font-stretch: 82%; }
h2 { font-size: var(--fs-l); font-weight: 650; font-stretch: 90%; }
h3 { font-size: 17px; font-weight: 650; font-stretch: 92%; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-s); }
.mono, .code-val { font-family: var(--text); font-weight: 700; letter-spacing: .04em; }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- La plaque émaillée ---------- */
.plaque {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  padding: .42em .95em .38em; border-radius: var(--r-plaque);
  background:
    radial-gradient(120% 90% at 30% 0%, rgba(255,255,255,.22), transparent 55%),
    linear-gradient(180deg, color-mix(in srgb, var(--email) 92%, white), var(--email) 40%, color-mix(in srgb, var(--email) 82%, black));
  color: var(--on-email);
  font-family: var(--display); font-weight: 700; font-stretch: 75%;
  text-transform: uppercase; letter-spacing: .06em; line-height: 1;
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 -1px 0 rgba(0,0,0,.25) inset, 0 2px 0 rgba(0,0,0,.08), 0 10px 18px -10px rgba(16, 32, 80, .55);
  text-shadow: 0 1px 0 rgba(0,0,0,.18);
  max-width: 100%;
}
.plaque::before {
  content: ""; position: absolute; inset: .2em; border: .09em solid rgba(255,255,255,.92); border-radius: calc(var(--r-plaque) - 4px); pointer-events: none;
}
.plaque > span { position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: .08em .1em 0; }
.plaque.sm { font-size: 17px; }
.plaque.lg { font-size: clamp(30px, 6vw, 56px); }
.plaque.xl { font-size: clamp(34px, 7vw, 72px); }
button.plaque { border: none; cursor: pointer; }
button.plaque:focus-visible { outline: 3px solid var(--ocre-bright); outline-offset: 3px; }

/* ---------- Icônes ---------- */
.ic { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic-sm { width: 16px; height: 16px; }

/* ---------- Boutons ---------- */
button { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--plaster); color: var(--ink);
  font-family: var(--text); font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color .12s, border-color .12s;
}
.btn:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line)); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--email); border-color: var(--email); color: var(--on-email); }
.btn.primary:hover { background: color-mix(in srgb, var(--email) 88%, black); }
.btn.danger { color: var(--brique); }
.btn.danger:hover { background: var(--brique-soft); border-color: var(--brique); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--line-soft); }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 0 12px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--r-ctl);
  border: none; background: transparent; color: var(--muted); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--line-soft); color: var(--ink); }
:is(.btn, .icon-btn, .tab, .nav a, .tabbar a, .tabbar button, .chk):focus-visible,
:is(input, select, textarea):focus-visible { outline: 2px solid var(--email-ink); outline-offset: 2px; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: var(--fs-s); font-weight: 700; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; font-size: 16px;
  color: var(--ink); background: var(--plaster); border: 1px solid var(--line); border-radius: var(--r-ctl);
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line)); }
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
select { appearance: none; padding-right: 36px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 19px) 52%, calc(100% - 14px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.form-grid { display: grid; gap: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--plaster); cursor: pointer; user-select: none; }
.check-pill input { accent-color: var(--email); width: 17px; height: 17px; margin: 0; }
.check-pill:has(input:checked) { border-color: var(--email-ink); background: var(--email-soft); }
.form-error { color: var(--brique); font-size: var(--fs-s); font-weight: 700; }
.form-error:empty { display: none; }
.photo-input { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.photo-input img { width: 76px; height: 76px; object-fit: cover; border-radius: var(--r-chip); }

/* ---------- Charpente ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 20;
  display: flex; flex-direction: column; gap: 6px; padding: 22px 14px 14px;
  background: var(--wall); border-right: 1px solid var(--line);
}
.sidebar .plaque { align-self: flex-start; margin: 0 4px 2px; max-width: calc(100% - 8px); }
.sidebar .app-name { font-family: var(--display); font-stretch: 85%; font-weight: 600; color: var(--muted); font-size: var(--fs-xs); padding: 4px 8px 6px; }
.nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; }
.nav-section { font-family: var(--display); font-stretch: 85%; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); padding: 16px 12px 4px; }
.nav a {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--r-ctl);
  color: var(--ink); text-decoration: none; font-size: 15.5px;
}
.nav a .ic { color: var(--muted); }
.nav a:hover { background: var(--line-soft); }
.nav a.active { color: var(--email-ink); font-weight: 700; background: var(--plaster); }
.nav a.active .ic { color: var(--email-ink); }
.nav a.active::before { content: ""; position: absolute; left: -14px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--email-ink); }
.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 12px 6px 0; border-top: 1px solid var(--line); }
.sidebar-foot .who { flex: 1; min-width: 0; line-height: 1.3; }
.sidebar-foot .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { margin-left: var(--sidebar); padding: 36px clamp(20px, 4vw, 56px) 64px; max-width: calc(1160px + var(--sidebar)); }
.topbar, .tabbar { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head .sub { color: var(--muted); margin-top: 6px; max-width: 60ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 18px 16px calc(var(--tabbar) + 32px + env(safe-area-inset-bottom)); }
  .topbar {
    display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 15;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    background: color-mix(in srgb, var(--wall) 90%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .plaque { flex: 0 1 auto; min-width: 0; }
  .topbar .spacer { flex: 1; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset: auto 0 0 0; z-index: 30;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--plaster) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabbar a, .tabbar button {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 12px; font-weight: 700; color: var(--muted); text-decoration: none; background: none; border: none; cursor: pointer;
  }
  .tabbar a.active { color: var(--email-ink); }
  .tabbar a.active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--email-ink); }
  h1 { font-size: 30px; }
  .page-head { margin-bottom: 18px; align-items: flex-start; }
  .page-head .page-actions { width: 100%; }
  .page-head .page-actions .btn.primary { flex: 1; }
}

/* ---------- Panneaux & grilles ---------- */
.card { background: var(--plaster); border: 1px solid var(--line); border-radius: var(--r-panel); padding: 20px; }
.card.flat { background: transparent; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head a { font-size: var(--fs-s); font-weight: 700; }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); }
@media (max-width: 1100px) { .grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } .grid { gap: 14px; } .card { padding: 16px; } }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.list-item:first-child { border-top: none; padding-top: 4px; }
.list-item:last-child { padding-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; overflow-wrap: anywhere; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; max-width: 46ch; margin: 0 auto; }
.empty .ic { width: 34px; height: 34px; margin: 0 auto 10px; stroke-width: 1.4; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 700; padding: 2px 8px; border-radius: var(--r-chip); background: var(--line-soft); color: var(--muted); white-space: nowrap; }
.badge.accent, .badge.info { background: var(--email-soft); color: var(--email-ink); }
.badge.ok { background: var(--volet-soft); color: var(--volet); }
.badge.warn { background: var(--ocre-soft); color: var(--ocre); }
.badge.danger { background: var(--brique-soft); color: var(--brique); }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; }
.pos { color: var(--volet); }
.neg { color: var(--brique); }
.sep { color: var(--line); margin: 0 2px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 18px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; padding: 10px 12px 12px; border: none; background: none; color: var(--muted); font-weight: 700; font-size: 15px; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--email-ink); }
.tab .count { margin-left: 6px; font-weight: 400; color: var(--muted); }
.item-actions { display: flex; gap: 2px; flex: none; }

/* ---------- Accueil ---------- */
.home-head { display: grid; gap: 18px; margin-bottom: 34px; }
.home-head .date { color: var(--muted); font-size: var(--fs-s); }
.home-head .status { font-family: var(--display); font-stretch: 88%; font-weight: 500; font-size: clamp(24px, 3.4vw, 36px); line-height: 1.2; max-width: 26ch; letter-spacing: -.015em; }
.home-head .status b { font-weight: 750; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.home-side { display: grid; gap: 22px; }
@media (max-width: 960px) { .home-grid { grid-template-columns: 1fr; } }
.solde { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.solde .v { font-family: var(--display); font-stretch: 80%; font-weight: 700; font-size: 40px; line-height: 1; }
.gb-quote { font-size: 18px; font-style: italic; line-height: 1.55; }

/* ---------- Infos & accès ---------- */
.info-card { display: flex; flex-direction: column; gap: 10px; }
.info-card .top { display: flex; align-items: flex-start; gap: 12px; }
.info-icon { width: 40px; height: 40px; border-radius: var(--r-ctl); display: grid; place-items: center; background: var(--email-soft); color: var(--email-ink); flex: none; }
.secret { display: flex; align-items: center; gap: 4px; padding: 8px 6px 8px 14px; border-radius: var(--r-ctl); background: var(--wall); border: 1px dashed var(--line); }
.secret .code-val, .secret .mono { flex: 1; font-size: 20px; overflow-wrap: anywhere; line-height: 1.3; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- Calendrier ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.cal-head h2 { font-size: var(--fs-xl); font-stretch: 80%; font-weight: 700; }
.cal-head h2::first-letter { text-transform: uppercase; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal .dow { padding: 8px 8px 6px; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--wall); }
.cal .day { min-height: 106px; padding: 6px 0 6px; display: flex; flex-direction: column; gap: 3px; cursor: pointer; min-width: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal .day:hover { background: color-mix(in srgb, var(--email-soft) 45%, transparent); }
.cal .day.out { background: var(--wall); }
.cal .day.out .num { color: var(--muted); opacity: .6; }
.cal .day .num { font-size: 14px; font-weight: 700; margin: 0 6px 2px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal .day.today .num { background: var(--ocre-bright); color: #1b1408; }
.cal .ev { font-size: 12.5px; font-weight: 700; padding: 2px 7px; margin: 0 0 0 4px; border-radius: var(--r-chip) 0 0 var(--r-chip); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.cal .ev.cont { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.cal .ev.ends { margin-right: 4px; border-top-right-radius: var(--r-chip); border-bottom-right-radius: var(--r-chip); }
.cal .dots { display: none; }
@media (max-width: 720px) {
  .cal .dow { text-align: center; padding: 6px 0; }
  .cal .day { min-height: 54px; align-items: center; padding: 5px 2px; }
  .cal .day .num { margin: 0 0 3px; }
  .cal .ev { display: none; }
  .cal .dots { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
  .cal .dots .dot { width: 7px; height: 7px; border-radius: 2px; }
}
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: var(--fs-s); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }

.t-famille { background: var(--email); }
.t-location { background: var(--ocre); }
.t-menage { background: var(--volet); }
.t-amis { background: var(--lavande); }
.t-travaux { background: var(--brique); }
@media (prefers-color-scheme: dark) { .t-location, .t-menage, .t-amis, .t-travaux { color: #11160f !important; } .cal .ev.t-location, .cal .ev.t-menage, .cal .ev.t-amis, .cal .ev.t-travaux { color: #11160f; } }

.stay-row { display: flex; gap: 14px; align-items: center; }
.stay-date { width: 54px; flex: none; text-align: center; line-height: 1.1; padding: 6px 0 5px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--plaster); }
.stay-date b { display: block; font-family: var(--display); font-stretch: 78%; font-size: 24px; font-weight: 700; }
.stay-date span { font-size: 12px; color: var(--muted); }
.stay-row.now .stay-date { border-color: var(--ocre-bright); box-shadow: inset 0 0 0 1px var(--ocre-bright); }

/* ---------- Tâches ---------- */
.task { display: flex; gap: 12px; align-items: flex-start; }
.task .chk { width: 26px; height: 26px; border-radius: 6px; border: 2px solid color-mix(in srgb, var(--ink) 28%, var(--line)); background: var(--plaster); flex: none; cursor: pointer; display: grid; place-items: center; margin-top: 1px; color: transparent; }
.task .chk:hover { border-color: var(--volet); }
.task .chk.doing { border-color: var(--ocre); color: var(--ocre); }
.task .chk.done { background: var(--volet); border-color: var(--volet); color: #fff; }
.task.is-done .title { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; margin-top: 5px; font-size: var(--fs-s); color: var(--muted); }
.meta > span { display: inline-flex; align-items: center; gap: 5px; }
.meta span.avatar { display: grid; gap: 0; }
.thumb { width: 64px; height: 64px; border-radius: var(--r-chip); object-fit: cover; flex: none; cursor: zoom-in; }

/* ---------- Cartes à photo (notes, recettes) ---------- */
.photo-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.photo-card .cover { aspect-ratio: 3 / 2; object-fit: cover; width: 100%; background: var(--line-soft); cursor: zoom-in; }
.photo-card .body { padding: 16px 18px 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.photo-card .foot { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 8px 18px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Livre d'or ---------- */
.gb .quote { font-size: 18px; font-style: italic; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 62ch; }
.gb .photo { margin-top: 14px; border-radius: var(--r-chip); max-height: 380px; object-fit: cover; width: 100%; cursor: zoom-in; }
.gb-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

/* ---------- Dépenses ---------- */
.bal-row { display: grid; grid-template-columns: minmax(0, 140px) 1fr 100px; align-items: center; gap: 12px; padding: 8px 0; }
.bal-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; }
.bal-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bal-bar { position: relative; height: 12px; }
.bal-bar::before { content: ""; position: absolute; left: 50%; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--line); }
.bal-bar i { position: absolute; top: 0; bottom: 0; }
.bal-bar i.p { left: 50%; background: var(--volet); border-radius: 0 3px 3px 0; }
.bal-bar i.n { right: 50%; background: var(--brique); border-radius: 3px 0 0 3px; }
.bal-amt { text-align: right; font-weight: 700; }
@media (max-width: 480px) { .bal-row { grid-template-columns: minmax(0, 1.2fr) minmax(56px, 1fr) auto; gap: 10px; } }
.amount { font-weight: 700; white-space: nowrap; }

/* ---------- Checklists ---------- */
.cl-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.cl-item:first-child { border-top: none; }
.cl-item input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--volet); flex: none; margin: 0; cursor: pointer; }
.cl-item label { flex: 1; cursor: pointer; overflow-wrap: anywhere; }
.cl-item.done label { text-decoration: line-through; color: var(--muted); }
.progress { height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; margin: 6px 0 12px; }
.progress i { display: block; height: 100%; background: var(--volet); transition: width .25s; }
.add-inline { display: flex; gap: 8px; margin-top: 12px; }
.add-inline input { flex: 1; }

/* ---------- Maison ---------- */
.code-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.code-box .code { font-family: var(--text); font-weight: 700; font-size: 30px; letter-spacing: .2em; padding: 6px 8px 6px 16px; border: 1px dashed var(--line); border-radius: var(--r-ctl); background: var(--wall); }

/* ---------- Connexion & premiers pas ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.auth-art { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 30px; padding: 56px clamp(28px, 6vw, 88px); background: var(--wall); border-right: 1px solid var(--line); overflow: hidden; }
.auth-art .wall-lines { position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: repeating-linear-gradient(0deg, transparent 0 46px, color-mix(in srgb, var(--line) 50%, transparent) 46px 47px); }
.auth-art > * { position: relative; }
.auth-art .lead { font-family: var(--display); font-stretch: 88%; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.25; max-width: 24ch; font-weight: 500; }
.auth-art ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; color: var(--muted); max-width: 46ch; }
.auth-art li { padding-left: 18px; position: relative; }
.auth-art li::before { content: ""; position: absolute; left: 0; top: .6em; width: 8px; height: 8px; border-radius: 2px; background: var(--email); }
.auth-panel { display: grid; place-items: center; padding: 32px 20px; background: var(--plaster); }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h2 { font-size: var(--fs-xl); font-stretch: 82%; font-weight: 700; margin-bottom: 6px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 3px; margin: 22px 0; background: var(--wall); }
.seg button { border: none; background: transparent; padding: 9px; border-radius: 5px; font-weight: 700; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--plaster); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art { padding: calc(32px + env(safe-area-inset-top)) 22px 28px; gap: 18px; border-right: none; border-bottom: 1px solid var(--line); }
  .auth-art ul { display: none; }
  .auth-panel { place-items: start center; padding-top: 28px; }
}
.onboard { max-width: 780px; margin: 0 auto; padding: 56px 18px; }
.onboard .plaque { margin-bottom: 30px; }

/* ---------- Modales ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: var(--scrim); animation: fade .14s ease-out; }
.modal { width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--plaster); border-radius: var(--r-panel); box-shadow: 0 24px 60px -12px rgba(0,0,0,.35); animation: rise .18s ease-out; }
.modal.wide { max-width: 780px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 14px 12px 22px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { font-size: var(--fs-l); }
.modal-body { padding: 20px 22px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 22px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-soft); }
.modal-foot .spacer { flex: 1; }
@media (max-width: 600px) {
  .modal-backdrop { place-items: end stretch; padding: 0; }
  .modal { max-width: none; max-height: 92vh; border-radius: 14px 14px 0 0; animation: sheet .22s ease-out; }
  .modal-head::before { content: ""; position: absolute; left: 50%; top: 6px; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--line); }
  .modal-head { position: relative; padding-top: 20px; }
  .modal-foot .btn { flex: 1; }
  .modal-foot .spacer { display: none; }
}
.lightbox { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 16px; background: rgba(8, 12, 10, .9); cursor: zoom-out; }
.lightbox img { max-height: 92vh; max-width: 96vw; border-radius: 4px; object-fit: contain; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes sheet { from { transform: translateY(48px); opacity: .3; } }

.drawer-list a, .drawer-list button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 4px; border: none; border-bottom: 1px solid var(--line-soft); background: none; color: var(--ink); font-size: 16.5px; font-weight: 700; text-decoration: none; text-align: left; cursor: pointer; }
.drawer-list a .ic, .drawer-list button .ic { color: var(--muted); }
.drawer-list a.active, .drawer-list a.active .ic { color: var(--email-ink); }

/* ---------- Toast ---------- */
#toast { position: fixed; left: 50%; bottom: 24px; z-index: 200; transform: translate(-50%, 16px); max-width: calc(100vw - 32px);
  padding: 11px 18px; border-radius: var(--r-ctl); background: var(--ink); color: var(--plaster); font-weight: 700; font-size: 15px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--brique); color: #fff; }
@media (max-width: 860px) { #toast { bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Sur l'accueil, la grande plaque suffit : on masque la petite pour ne pas la répéter */
body[data-route="accueil"] .sidebar .plaque,
body[data-route="accueil"] .topbar .plaque { visibility: hidden; }
