:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --border: #e3e6ef;
  --text: #1c2030;
  --muted: #6b7185;
  /* Couleurs du logo GraBills (mêmes que lib/ui/brand.dart dans l'app) */
  --navy: #070b14;
  --navy-soft: #111a2e;
  --accent: #1f6bff;
  --accent-2: #2fb5ff;
  --accent-soft: #e8efff;
  --danger: #c62828;
  --warning-bg: #fff4e5;
  --warning: #8a4b00;
  --ok: #2e7d32;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b101c;
    --surface: #131a2a;
    --border: #243049;
    --text: #e6e8ef;
    --muted: #9aa0b4;
    --navy: #070b14;
    --navy-soft: #111a2e;
    --accent: #4d8dff;
    --accent-2: #2fb5ff;
    --accent-soft: #16244a;
    --danger: #ef7070;
    --warning-bg: #3a2c12;
    --warning: #ffcc80;
    --ok: #81c784;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
h1 { font-size: 20px; margin: 0; }
h2 { font-size: 17px; margin: 0; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); margin: 8px 0; }
.warning { background: var(--warning-bg); color: var(--warning); padding: 8px 12px; border-radius: 8px; }

button {
  font: inherit;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
button.danger { color: var(--danger); }
button.ghost { border-color: transparent; background: transparent; }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
label > input, label > select, label > textarea { margin-top: 3px; }
label.check { display: flex; gap: 8px; align-items: flex-start; color: var(--text); font-size: 13px; }
label.check input { width: auto; margin-top: 3px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }

/* Connexion */
.login { background: radial-gradient(circle at 50% 20%, var(--navy-soft), var(--navy) 70%); min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); padding: 24px; }
.login-card { text-align: center; }
.login-logo { display: block; margin: 0 auto 12px; width: 180px; height: 180px; }
.google-button { display: flex; justify-content: center; min-height: 44px; margin-top: 16px; }
.setting { padding: 12px 0; border-top: 1px solid var(--border); }
.setting:first-of-type { border-top: none; padding-top: 0; }
.setting h3 { font-size: 14px; margin: 0 0 4px; }
.setting p { margin: 0 0 8px; font-size: 13px; }
.setting-row { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.setting-row > span { flex: 1; }
.setting .list { margin: 0 0 8px; }
.setting .list li { padding: 6px 0; }
.ok { color: var(--ok); }

/* Barre du haut */
/* Toute la page (barre, zone de dépôt, en-tête, tableau) sur les 3/4 de la largeur, centrée. */
#app { width: 75%; margin: 0 auto; padding: 0 0 40px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand { margin: 0; line-height: 0; }
.brand img { height: 48px; width: auto; display: block; }
@media (max-width: 760px) { .brand img { height: 40px; } }
.topbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
  background: var(--navy); color: #fff;
  margin: 12px 0 16px; padding: 12px 16px; border-radius: 14px;
}
.topbar button { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #fff; }
.topbar button:hover { border-color: var(--accent-2); background: rgba(47,181,255,.14); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* Zone de dépôt */
.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 22px 16px; text-align: center;
  border: 2px dashed var(--border); border-radius: 12px;
  background: var(--surface); cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop-status { color: var(--accent); font-weight: 600; }

/* Filtres */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 10px; }
.filters select { width: auto; }
.filters input[type=search] { flex: 1 1 220px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 11px; border-radius: 999px; font-size: 13px; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }

/* Tableau : colonnes de largeur fixe, séparées par un trait */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
/* Colonnes à la largeur du contenu : rien n'est coupé. Le texte long passe à
   la ligne ; dates et montants restent sur une ligne. */
#invoices { table-layout: auto; font-size: 12.5px; }
/* Le cadre du tableau suit sa largeur (pas d'espace vide à droite). */
/* Page d'un type : en-tête, filtres et tableau sur les 3/4 de la largeur, centrés et alignés. */

#list-view .table-wrap { width: 100%; }
#list-view #invoices { width: 100%; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
#invoices th, #invoices td { border-right: 1px solid var(--border); padding: 7px 10px; }
#invoices td.wrap { white-space: normal; overflow-wrap: anywhere; max-width: 320px; }
#invoices th:last-child, #invoices td:last-child { border-right: none; }
#invoices thead th {
  background: var(--bg); color: var(--muted);
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  border-bottom: 2px solid var(--border);
  position: sticky; top: 0; z-index: 1;
}
#invoices thead th[data-sort] { cursor: pointer; user-select: none; }
#invoices thead th[data-sort]:hover { color: var(--text); }
#invoices thead th.sorted { color: var(--accent); }
#invoices thead th[data-sort]::after { content: attr(data-arrow); margin-left: 5px; font-size: 9px; }
#invoices tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg) 55%, transparent); }
th { font-size: 12px; color: var(--muted); font-weight: 600; }
td.desc { white-space: normal; max-width: 260px; }
.vendor { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vlogo { flex: none; width: 18px; height: 18px; border-radius: 5px; object-fit: contain; background: #fff; }
.vbadge { display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
tbody tr { cursor: pointer; }
#invoices tbody tr:hover { background: var(--accent-soft); }
#invoices tfoot td { background: var(--bg); border-top: 2px solid var(--border); }
tfoot td { font-weight: 700; border-bottom: none; }
.empty { padding: 24px; text-align: center; }

/* Dialogues */
dialog {
  border: 1px solid var(--border); border-radius: 14px; padding: 18px;
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 32px);
  background: var(--surface); color: var(--text);
}
dialog.wide { width: min(1080px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 12, 20, .45); }
.dialog-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.dialog-actions { display: flex; gap: 8px; margin-top: 14px; }
.spacer { flex: 1; }
.row { display: flex; gap: 10px; }
.row > label { flex: 1; min-width: 0; }

.review { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; }
.preview { min-height: 320px; max-height: 70vh; border: 1px solid var(--border); border-radius: 10px; overflow: auto; background: var(--bg); }
.preview img { width: 100%; display: block; }
.preview iframe { width: 100%; height: 70vh; border: 0; }
.preview .none { display: grid; place-items: center; height: 320px; color: var(--muted); }

.list { list-style: none; padding: 0; margin: 0 0 12px; }
.list li { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.list li span { flex: 1; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.inline { display: flex; gap: 8px; }

/* Sommaire */
#report h3 { margin: 18px 0 6px; font-size: 15px; }
#report table { margin-bottom: 8px; }

@media (max-width: 760px) {
  .review { grid-template-columns: 1fr; }
  .preview { min-height: 200px; max-height: 40vh; }
  .hide-sm { display: none; }
  #invoices th, #invoices td { padding: 7px 8px; }
  #app { width: auto; padding: 0 16px 40px; }
  .row { flex-wrap: wrap; }
}

@media print {
  body { background: #fff; color: #000; }
  #app, .no-print { display: none !important; }
  dialog#report-dialog { position: static; border: 0; width: auto; max-height: none; padding: 0; }
  dialog::backdrop { display: none; }
}

/* ---------- Accueil : cartes des types de dépense ---------- */
.view-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 18px 0 12px; }
.view-head h2 { font-size: 18px; }
.view-head .year-select { width: auto; }
.back { color: var(--accent); text-decoration: none; font-weight: 600; }
.type-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.type-card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.type-card h3 { margin: 0; font-size: 15px; flex: 1; }
.type-card-head { display: flex; align-items: flex-start; gap: 6px; }
.type-card .badge { align-self: flex-start; }
.type-card p { margin: 0; }
.type-total { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 4px !important; }
.type-card .button { margin-top: auto; align-self: flex-start; }
.type-card-all { background: linear-gradient(160deg, var(--surface), var(--accent-soft)); }
.type-card-new { border-style: dashed; justify-content: center; }
.icon-btn { padding: 2px 8px; font-size: 16px; line-height: 1; }
a.button {
  display: inline-block; padding: 7px 16px; border-radius: 8px; text-decoration: none; font-weight: 600;
  background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #fff;
}

/* ---------- En-tête : profil connecté ---------- */
.brand a { display: block; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; }
.avatar {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 12px; font-weight: 700;
}

/* ---------- Inscription ---------- */
.signup { text-align: left; margin-top: 8px; }
.signup h2 { text-align: center; margin-bottom: 4px; }
.signup > p { text-align: center; margin: 0 0 12px; }
.signup button { width: 100%; margin-top: 6px; }

.review.no-preview { grid-template-columns: 1fr; }
.review.no-preview .preview { display: none; }
dialog#invoice-dialog:has(.no-preview) { width: min(620px, calc(100vw - 32px)); }

/* Montant d'origine (devise étrangère) sous le montant en dollars canadiens */
.orig { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.fx-info { margin: -4px 0 10px; font-size: 12.5px; color: var(--accent); min-height: 1em; }

/* Choix des pages d'un PDF */
.page-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; max-height: 60vh; overflow: auto; padding: 4px; }
.page-thumb { position: relative; padding: 6px; border: 2px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; }
.page-thumb canvas { width: 100%; display: block; background: #fff; }
.page-thumb span { display: block; text-align: center; font-size: 12px; margin-top: 4px; color: var(--muted); }
.page-thumb.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.page-thumb.on::after {
  content: '✓'; position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700;
}
.page-thumb:not(.on) canvas { opacity: .45; }

#invoices.one-type .col-type { display: none; }

/* Cartes des types : mêmes rangées pour toutes les cartes (titre, badge,
   montant, nombre, bouton), alignées même si un titre tient sur 2 lignes. */
.type-cards { grid-auto-rows: auto; row-gap: 14px; }
.type-card { display: grid; grid-row: span 5; grid-template-rows: subgrid; row-gap: 6px; align-content: start; }
.type-card-head { align-self: start; }
.type-badge { min-height: 0; }
.type-badge:empty { display: block; }
.type-card .button { margin-top: 4px; align-self: end; justify-self: start; }
.type-card-new { display: flex; grid-row: span 5; }

.inline-label { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 13px; margin: 0; }
.inline-label select { width: auto; margin: 0; }

.topbar .signout { border-color: transparent; background: transparent; }
.topbar .signout:hover { border-color: rgba(255,255,255,.3); }
@media (max-width: 760px) { .topbar .signout span { display: none; } }

.discover-link { margin: 14px 0 0; font-size: 13px; }
.discover-link a { color: var(--accent); text-decoration: none; }

/* ---------- Publicité (page d'accueil sans connexion) ---------- */
.landing {
      --navy: #070b14;
      --navy-2: #0e1628;
      --blue: #1f6bff;
      --sky: #2fb5ff;
      --text: #eef2ff;
      --muted: #9aa6c4;
      --card: rgba(255, 255, 255, .05);
      --line: rgba(255, 255, 255, .10);
    }
.landing {
      margin: 0; background: var(--navy); color: var(--text);
      font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; line-height: 1.5;
      overflow-x: hidden;
    }
.landing a { color: inherit; }
.landing .wrap { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.landing .grad { background: linear-gradient(90deg, var(--blue), var(--sky)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.landing /* En-tête */
    header { position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); background: rgba(7, 11, 20, .7); border-bottom: 1px solid var(--line); }
.landing header .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.landing header img { height: 40px; display: block; }
.landing .btn {
      display: inline-flex; align-items: center; gap: 10px; padding: 14px 26px; border-radius: 999px;
      font-weight: 700; text-decoration: none; font-size: 16px; transition: transform .15s, box-shadow .15s;
    }
.landing .btn-primary { background: linear-gradient(90deg, var(--blue), var(--sky)); color: #fff; box-shadow: 0 10px 40px -10px rgba(47, 181, 255, .6); }
.landing .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 50px -12px rgba(47, 181, 255, .8); }
.landing .btn-ghost { border: 1px solid var(--line); color: var(--text); }
.landing .btn-ghost:hover { border-color: var(--sky); }
.landing header .btn { padding: 10px 20px; font-size: 14px; }
.landing /* Accroche */
    .hero { position: relative; padding: 110px 0 90px; text-align: center; }
.landing .hero::before {
      content: ''; position: absolute; inset: -200px 0 auto; height: 700px; z-index: -1;
      background: radial-gradient(ellipse at 50% 30%, rgba(31, 107, 255, .35), transparent 60%),
                  radial-gradient(ellipse at 80% 10%, rgba(47, 181, 255, .18), transparent 50%);
    }
.landing .pill { display: inline-block; padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 14px; margin-bottom: 28px; }
.landing h1 { font-size: clamp(44px, 8vw, 96px); line-height: 1.02; letter-spacing: -.035em; font-weight: 900; margin: 0 0 28px; }
.landing .lead { font-size: clamp(18px, 2.2vw, 24px); color: var(--muted); max-width: 760px; margin: 0 auto 40px; }
.landing .cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.landing .hero-logo { width: 150px; border-radius: 34px; margin: 0 auto 30px; display: block; box-shadow: 0 30px 80px -20px rgba(31, 107, 255, .7); }
.landing /* Grands messages */
    .statement { padding: 80px 0; border-top: 1px solid var(--line); }
.landing .statement h2 { font-size: clamp(36px, 6vw, 72px); line-height: 1.05; letter-spacing: -.03em; font-weight: 900; margin: 0 0 20px; }
.landing .statement p { font-size: clamp(17px, 2vw, 22px); color: var(--muted); max-width: 720px; margin: 0; }
.landing .split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 60px; align-items: center; }
.landing /* Cartes */
    .features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 48px; }
.landing .feature { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 28px; }
.landing .feature .icon { font-size: 34px; margin-bottom: 14px; }
.landing .feature h3 { font-size: 21px; margin: 0 0 8px; letter-spacing: -.01em; }
.landing .feature p { margin: 0; color: var(--muted); font-size: 16px; }
.landing /* Aperçu (téléphone dessiné en CSS) */
    .phone {
      width: 300px; margin: 0 auto; padding: 14px; border-radius: 44px; background: #0b1120;
      border: 1px solid var(--line); box-shadow: 0 40px 100px -30px rgba(31, 107, 255, .6);
    }
.landing .screen { border-radius: 32px; background: #f6f7fb; color: #1c2030; overflow: hidden; }
.landing .screen .bar { background: var(--navy); padding: 16px; }
.landing .screen .bar img { height: 26px; display: block; }
.landing .screen .body { padding: 14px; display: grid; gap: 10px; }
.landing .mini { background: #fff; border: 1px solid #e3e6ef; border-radius: 14px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; }
.landing .mini b { display: block; font-size: 14px; }
.landing .mini span { font-size: 12px; color: #6b7185; }
.landing .mini .amt { font-weight: 800; font-size: 17px; }
.landing .mini .open { background: linear-gradient(90deg, var(--blue), var(--sky)); color: #fff; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 8px; }
.landing .mini.all { background: #e8efff; }
.landing /* Bientôt : dépenses partagées */
    .soon { position: relative; overflow: hidden; background: linear-gradient(140deg, #0f1c3d, #0a1226); border: 1px solid var(--line); border-radius: 32px; padding: 60px; }
.landing .soon .tag { display: inline-block; background: linear-gradient(90deg, var(--blue), var(--sky)); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; padding: 6px 14px; border-radius: 999px; margin-bottom: 20px; }
.landing .balances { display: grid; gap: 10px; margin-top: 8px; }
.landing .balance { display: flex; justify-content: space-between; align-items: center; background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; font-size: 17px; }
.landing .balance .who { display: flex; align-items: center; gap: 12px; }
.landing .avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: linear-gradient(135deg, var(--blue), var(--sky)); }
.landing .plus { color: #6ee7a8; font-weight: 800; }
.landing .minus { color: #ff8f8f; font-weight: 800; }
.landing /* Appel final */
    .final { text-align: center; padding: 110px 0; }
.landing .final h2 { font-size: clamp(40px, 7vw, 84px); line-height: 1.02; letter-spacing: -.035em; font-weight: 900; margin: 0 0 24px; }
.landing footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: 14px; }
.landing footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
@media (max-width: 900px) {
  .landing .split { grid-template-columns: 1fr; gap: 40px; }
  .landing .features { grid-template-columns: 1fr; }
  .landing .soon { padding: 36px 24px; }
  .landing .hero { padding: 70px 0 60px; }
}
@media (prefers-reduced-motion: reduce) {
  .landing html { scroll-behavior: auto; }
  .landing .btn { transition: none; }
}
.landing { min-height: 100vh; }
.landing .login-card { margin: 0 auto; color: #1c2030; background: #fff; text-align: center; box-shadow: 0 40px 100px -30px rgba(31,107,255,.55); }
.landing .login-card .muted { color: #6b7185; }
.landing .hero .login-card { margin-top: 10px; }
.landing .more { margin-top: 26px; }
.landing .more a { color: var(--muted); text-decoration: none; }
.landing .more a:hover { color: var(--text); }
.landing #connexion { scroll-margin-top: 90px; }
/* Publicité : titres en majuscules (paragraphes en casse normale, plus lisibles) */
.landing h1, .landing h2 { text-transform: uppercase; letter-spacing: -.01em; }
.landing h1 { font-size: clamp(38px, 7vw, 86px); }
.landing .statement h2 { font-size: clamp(32px, 5.2vw, 64px); }
.landing .final h2 { font-size: clamp(34px, 6vw, 76px); }
.landing .feature h3, .landing .pill, .landing .btn { text-transform: uppercase; letter-spacing: .04em; }
.landing .feature h3 { font-size: 17px; }
.landing .nowrap { white-space: nowrap; }

/* ---------- Projets de groupe ---------- */
.project-balance { font-size: 15px; font-weight: 700; }
.pos { color: var(--ok); }
.neg { color: var(--danger); }
.balances-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.member-balance { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.member-balance .avatar { flex: none; }
.member-balance strong { display: block; font-size: 14px; }
.member-balance span { font-size: 13px; }
.suggestions { background: var(--accent-soft); border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; }
.suggestions h3 { margin: 0 0 8px; font-size: 14px; }
.suggestion { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 14px; }
.suggestion span { flex: 1; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tab { border-radius: 999px; }
.tab.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.split-mode { display: flex; gap: 18px; margin: 4px 0 8px; }
.shares { display: grid; gap: 6px; margin-bottom: 6px; }
.share-row { display: flex; align-items: center; gap: 10px; }
.share-row label.check { flex: 1; margin: 0; }
.share-row input[type=number] { width: 120px; margin: 0; }
.gtable td.who { white-space: nowrap; }
.gtable .shares-cell { color: var(--muted); font-size: 12px; white-space: normal; }

/* Facture par items (dépense de groupe) */
.itemize-btn { width: 100%; margin: 4px 0 10px; padding: 10px; font-weight: 700; background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.items-editor { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.items-editor > p { margin: 0 0 8px; font-size: 12.5px; }
.item-row { display: grid; grid-template-columns: 1fr 90px auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.item-row input { margin: 0; }
.item-row .item-members { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }
.member-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 12.5px; cursor: pointer; user-select: none; }
.member-chip input { display: none; }
.member-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.item-row.orphan .item-members::after { content: attr(data-warn); color: var(--danger); font-size: 12px; font-weight: 700; }
.tip-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-top: 10px; }
.tip-row label:first-child { width: 120px; margin: 0; }
.tip-row label.check { margin: 0 0 8px; }
.items-totals { display: grid; gap: 4px; margin-top: 6px; }
.items-totals div { display: flex; justify-content: space-between; font-size: 13.5px; }
.items-totals strong { font-variant-numeric: tabular-nums; }
.items-total-warn { color: var(--danger); font-weight: 700; }

/* Doublon probable : impossible à manquer */
#duplicate-warning { background: #fdecec; color: #b3261e; border: 2px solid #d93025; font-weight: 800; font-size: 14.5px; }
@media (prefers-color-scheme: dark) { #duplicate-warning { background: #3b1414; color: #ff8a80; border-color: #ff5252; } }

/* Invitations */
.invite-banner { background: linear-gradient(90deg, #1f6bff, #2fb5ff); color: #fff; border-radius: 12px; padding: 12px 14px; text-align: center; margin: 0 0 12px; }
.signup .row { display: flex; gap: 8px; }
.signup .row label { flex: 1; }
.small { font-size: 13px; }
#password-login { margin-top: 10px; }
.invite-qr { display: flex; justify-content: center; margin: 12px 0; }
.invite-qr img, .invite-qr canvas { background: #fff; padding: 10px; border-radius: 12px; }
#invite-result .inline input { flex: 1; min-width: 0; }
#invite-dialog label { display: block; }

/* Lien d'installation de l'app */
.install-link { text-align: center; margin: 14px 0 0; font-size: 14px; }
.install-link a { font-weight: 600; }
.install-banner { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 12px 16px; margin: 0 0 16px;
  border-radius: 14px; background: linear-gradient(90deg, rgba(31,107,255,.18), rgba(47,181,255,.12)); border: 1px solid rgba(47,181,255,.35); }
.install-banner[hidden] { display: none; }
.landing .head-actions { display: flex; gap: 10px; align-items: center; }
.landing header .btn { white-space: nowrap; }
@media (max-width: 600px) { .landing .head-actions .btn-ghost { display: none; } }

.password-form { margin-top: 12px; }
.password-form .row { display: flex; flex-wrap: wrap; gap: 8px; }
.password-form input { flex: 1 1 140px; min-width: 0; }
.password-form input[hidden] { display: none; }

.signup .or { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; color: var(--muted, #6b7185); font-size: 13px; }
.signup .or::before, .signup .or::after, #login-step .or::before, #login-step .or::after { content: ''; flex: 1; height: 1px; background: currentColor; opacity: .3; }
#login-step .or { display: flex; align-items: center; gap: 10px; margin: 14px 0 6px; color: #6b7185; font-size: 13px; }

.ios-steps { padding-left: 22px; line-height: 1.6; margin: 8px 0; }
.ios-steps li { margin: 6px 0; }
.ios-share { vertical-align: -4px; color: var(--sky, #2fb5ff); }

/* Événements d'un groupe */
.event-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 0 10px; margin-bottom: 6px; align-items: stretch; }
.event-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 150px; text-align: left;
  padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line, #2a3550); background: var(--card, #111a2e); color: inherit; cursor: pointer; }
.event-chip.on { border-color: var(--sky, #2fb5ff); box-shadow: 0 0 0 2px rgba(47,181,255,.25); }
.event-chip .event-total { font-weight: 800; font-size: 17px; }
.event-chip span { font-size: 12.5px; }
.event-hint { align-self: center; font-size: 13px; }
.balance-title { margin: 6px 0 8px; font-size: 15px; }
.event-tag { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: rgba(47,181,255,.15); color: var(--sky, #2fb5ff); }

.small-title { font-size: 13.5px; margin: 14px 0 6px; color: var(--muted); font-weight: 700; }
.known-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.known-chip { border-radius: 99px; padding: 6px 14px; border: 1px solid var(--accent-2, #2fb5ff); background: transparent; color: var(--accent-2, #2fb5ff); font-weight: 600; cursor: pointer; }
.known-chip:hover { background: rgba(47,181,255,.12); }

.convert-box { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 12px; }
.convert-box select { flex: 1; }

/* Définitions, statut d'événement, notifications */
.definition { color: var(--muted); font-size: 13.5px; line-height: 1.5; margin: -4px 0 12px; max-width: 900px; }
.definition.small { font-size: 12.5px; margin: 0 0 10px; }
.field-title { font-size: 13px; color: var(--muted); margin: 10px 0 6px; }
.status { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; margin: 2px 0; }
.status-preparation { background: rgba(154,160,180,.18); color: var(--muted); }
.status-en_cours { background: rgba(47,181,255,.18); color: #2fb5ff; }
.status-termine { background: rgba(255,204,128,.18); color: #ffcc80; }
.status-regle { background: rgba(129,199,132,.18); color: #81c784; }
.bell { position: relative; font-size: 18px; padding: 6px 10px; }
.notif-count { position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px;
  background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }
.notif-count[hidden] { display: none; }
.notifs li { cursor: pointer; }
.notifs li.unread { border-left: 3px solid var(--accent-2, #2fb5ff); padding-left: 10px; }

/* Accueil : gros dicton à gauche (trois lignes réparties sur la hauteur du logo), logo à droite */
.landing .hero-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 48px; align-items: stretch; text-align: left; margin-bottom: 34px; }
.landing .hero-motto { display: flex; flex-direction: column; justify-content: space-between; font-weight: 900; text-transform: uppercase;
  font-size: clamp(50px, 8.2vw, 114px); line-height: 1.12; letter-spacing: -.02em; }
/* Lettres plus hautes et un peu plus étroites : texte agrandi puis resserré. */
.landing .hero-motto span { display: block; width: max-content; white-space: nowrap; transform: scaleX(.8); transform-origin: left center; }
.landing .hero-top .hero-logo { width: clamp(170px, 24vw, 330px); margin: 0; border-radius: 56px; align-self: center; justify-self: center; }
.landing .hero-small { font-size: clamp(20px, 2.4vw, 32px); line-height: 1.2; margin: 0 0 14px; text-align: left; letter-spacing: 0; }
.landing .hero-lead { text-align: left; margin: 0 0 40px; max-width: 760px; }
@media (max-width: 760px) {
  .landing .hero-top { grid-template-columns: 1fr; gap: 24px; }
  .landing .hero-top .hero-logo { order: -1; width: 150px; border-radius: 32px; justify-self: center; }
  .landing .hero-motto { gap: 6px; font-size: clamp(34px, 13vw, 80px); }
}

/* Connexion : section à part, sous le haut de la page */
.landing .login-section { padding: 90px 0 100px; background: linear-gradient(180deg, rgba(31,107,255,.10), rgba(47,181,255,.04)); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; scroll-margin-top: 68px; }
.landing .login-section h2 { font-size: clamp(32px, 4.5vw, 56px); margin: 0 0 30px; }
.landing .login-section .lead { margin: 0 auto 34px; }
.landing .login-section .login-card { margin: 0 auto; }

.ok-msg { color: #2e7d32; font-weight: 600; font-size: 14px; margin: 10px 0 0; }

.mail-form { display: grid; gap: 8px; margin-top: 8px; }
.mail-form .row { display: flex; gap: 8px; flex-wrap: wrap; }
.mail-form .row label { flex: 1 1 180px; }
.mail-form button { justify-self: end; }
.landing .login-card h2 { font-size: 22px; line-height: 1.2; letter-spacing: 0; margin: 0 0 14px; }

.usage-table td, .usage-table th { padding: 6px 10px; font-size: 13px; }
#ai-usage-body .table-wrap { margin-bottom: 10px; overflow-x: auto; }

/* Paramètres en page entière : barre de titre fixe, sections en cartes sur plusieurs colonnes */
dialog.fullpage { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: var(--bg); color: var(--text); overflow: hidden; }
dialog.fullpage[open] { display: flex; flex-direction: column; }
dialog.fullpage::backdrop { background: var(--bg); }
.fullpage-head { display: flex; align-items: center; gap: 12px; padding: 14px max(16px, calc((100vw - 1400px) / 2)); background: var(--navy, #070b14);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2; }
.fullpage-head h2 { margin: 0; font-size: 20px; color: #fff; }
.fullpage-body { flex: 1; overflow-y: auto; padding: 22px max(16px, calc((100vw - 1400px) / 2)) 40px; }
/* Colonnes « journal » : les cartes s'empilent sans trous sous les plus courtes. */
.settings-grid { column-width: 400px; column-gap: 16px; }
.settings-grid .setting { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; break-inside: avoid; margin: 0 0 16px; display: block; }
.settings-grid .setting[hidden] { display: none; }
.settings-grid .setting:first-of-type { padding-top: 16px; }
.settings-grid .setting h3 { font-size: 15px; margin: 0 0 8px; }
.settings-grid .setting p { font-size: 13px; line-height: 1.45; }
.settings-grid .setting .inline, .settings-grid .setting form.inline { display: flex; flex-wrap: wrap; gap: 8px; }
.settings-grid .setting .inline input { flex: 1 1 180px; min-width: 0; }
.settings-grid .setting .setting-row { flex-wrap: wrap; }
.settings-grid .setting .list { max-height: 360px; overflow-y: auto; }
.settings-grid .setting .row { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-grid .setting .row > label { flex: 1 1 160px; }

/* Bouton FR / EN */
.lang-btn { font-weight: 800; letter-spacing: .04em; min-width: 46px; }
.landing .lang-btn { background: transparent; border: 1px solid var(--line); color: var(--text); padding: 10px 14px; }
.landing .lang-btn:hover { border-color: var(--sky); }
@media (max-width: 480px) { .landing header .lang-btn { padding: 8px 10px; } }

/* Cloche comme dans l'app : icône en contour, pastille rouge du nombre */
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; padding: 6px 9px; color: var(--text); }
.bell .bell-icon { display: block; }
.bell .notif-count { top: -2px; right: -2px; min-width: 18px; height: 18px; line-height: 18px; font-size: 11px; border: 2px solid var(--navy, #070b14); }

/* « Voir comme » */
.viewas-banner { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center;
  padding: 10px 16px; background: linear-gradient(90deg, #b45309, #d97706); color: #fff; font-size: 14px; }
.viewas-banner[hidden] { display: none; }
.viewas-banner .primary { background: #fff; color: #7c2d12; border: 0; }

/* Paramètres : sous-menu à gauche */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.settings-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 6px; }
.settings-nav button { display: flex; align-items: center; gap: 10px; text-align: left; padding: 12px 14px; border-radius: 12px;
  background: transparent; border: 1px solid transparent; color: var(--text); font-weight: 600; font-size: 14.5px; cursor: pointer; }
.settings-nav button:hover { background: var(--surface); }
.settings-nav button.on { background: var(--surface); border-color: var(--accent-2, #2fb5ff); color: #fff; }
.settings-nav button[hidden] { display: none; }
.settings-grid.single { column-width: auto; column-count: 1; }
.members-table { width: 100%; }
.settings-grid .setting .table-wrap { overflow-x: auto; }
.members-table th, .members-table td { padding: 8px 10px; font-size: 13px; white-space: nowrap; vertical-align: middle; line-height: 1.35; }
.members-table td.row-actions { text-align: right; }
.members-table td.row-actions button { margin-left: 6px; padding: 6px 10px; }
@media (max-width: 800px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; overflow-x: auto; position: static; }
  .settings-nav button { flex: 0 0 auto; }
}
.members-table td.row-actions { white-space: nowrap; } .members-table td.row-actions button { display: inline-flex; width: auto; vertical-align: middle; }

/* Courriel à confirmer, petits messages */
.verify-banner { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px;
  background: rgba(47,181,255,.14); border-bottom: 1px solid rgba(47,181,255,.35); font-size: 14px; }
.verify-banner[hidden] { display: none; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 1000; max-width: min(92vw, 560px);
  padding: 12px 18px; border-radius: 12px; background: #16244a; color: #fff; border: 1px solid #2fb5ff; box-shadow: 0 10px 40px rgba(0,0,0,.4); font-size: 14px; }
.toast.error-toast { background: #3a1518; border-color: #ef7070; }
.toast[hidden] { display: none; }

/* Carte de connexion : palette claire et actions distinctes, même en mode sombre. */
.landing .login-card {
  --bg: #f8fafc;
  --surface: #fff;
  --text: #1c2030;
  --muted: #60697c;
  --border: #d8deea;
  --accent: #2563eb;
  color-scheme: light;
  width: min(420px, 100%);
  padding: clamp(18px, 5vw, 32px);
  border-color: var(--border);
  border-radius: 18px;
}
.login-card .login-intro { margin: 0 0 24px; font-size: 16px; font-weight: 500; }
.login-card .google-button { margin-top: 0; }
#login-step .or { margin: 22px 0; gap: 14px; }
.login-card .signup label { color: #475569; font-size: 13px; font-weight: 500; margin-bottom: 16px; }
.login-card .signup .row label { min-width: 0; }
.login-card .signup input { min-height: 44px; margin-top: 6px; padding: 10px 12px; font-size: 16px; }
.login-card .signup button { min-height: 44px; margin-top: 4px; font-weight: 600; }
.login-card a { color: #2457b8; text-underline-offset: 3px; }
.login-card #password-login .login-forgot { margin: 14px 0 0; text-align: right; }
.login-card .login-register { display: grid; justify-items: center; gap: 8px; margin-top: 24px; }
.login-card .login-register p { margin: 0; }
.login-card .login-register a { font-weight: 600; }
.login-card .install-link { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 24px; }
.login-card .login-intro,
.login-card .login-register a,
.login-card .login-forgot a,
.login-card [data-install] { white-space: nowrap; }

/* Téléchargement Android : panneau bleu clair détaché de la page. */
#android-download-dialog {
  color-scheme: light;
  width: min(420px, calc(100vw - 32px));
  padding: clamp(18px, 5vw, 32px);
  background: #edf5ff;
  color: #172b4d;
  border: 1px solid #afcef5;
  border-top: 4px solid #2563eb;
  border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
  text-align: center;
}
#android-download-dialog::backdrop { background: rgba(4, 12, 28, .72); backdrop-filter: blur(5px); }
#android-download-dialog .dialog-head { justify-content: center; margin-bottom: 16px; }
#android-download-dialog h2 { font-size: clamp(18px, 4.5vw, 22px); white-space: nowrap; }
#android-download-dialog p { margin: 0; line-height: 1.6; }
#android-download-dialog .muted { color: #526580; }
#android-download-qr { margin: 24px 0 18px; }
#android-download-qr:empty { display: none; }
#android-download-qr img, #android-download-qr canvas {
  box-sizing: content-box;
  max-width: calc(100% - 20px);
  height: auto;
  border: 1px solid #d8e5f5;
  box-shadow: 0 6px 20px rgba(23, 43, 77, .08);
}
#android-download-dialog .dialog-actions { flex-direction: column; gap: 10px; margin-top: 24px; }
#android-download-dialog .dialog-actions > * { min-height: 44px; padding: 11px 16px; white-space: nowrap; }
#android-download-dialog .button { background: #2563eb; color: #fff; }
#android-download-dialog .button:hover { background: #1d4ed8; }
#android-download-dialog button.ghost { color: #365578; }
#android-download-dialog button.ghost:hover { background: #dfeeff; }

/* Accueil : panneaux sobres, accents propres à chaque section. */
.home-panel {
  --panel-accent: #4263eb;
  --panel-tint: #eef2ff;
  margin: 18px 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 4px 20px rgba(20, 35, 65, .035);
}
.home-panel[data-home-panel="events"] { --panel-accent: #8750c4; --panel-tint: #f5effc; }
.home-panel[data-home-panel="friends"] { --panel-accent: #168173; --panel-tint: #eaf7f3; }
.home-panel[data-home-panel="groups"] { --panel-accent: #31789e; --panel-tint: #edf6fb; }
.home-panel[data-home-panel="archives"] { --panel-accent: #a46a23; --panel-tint: #fcf4e7; }
.home-panel > summary {
  display: flex; align-items: center; gap: 14px; padding: 20px 24px;
  cursor: pointer; list-style: none; font-size: 17px; font-weight: 600;
  letter-spacing: -.025em; border-radius: 20px;
}
.home-panel > summary::-webkit-details-marker { display: none; }
.home-panel > summary:hover { background: var(--bg); }
.home-panel > summary::after {
  content: ''; width: 7px; height: 7px; margin-left: auto; flex-shrink: 0;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted);
  transform: rotate(-45deg); transition: transform .18s ease;
}
.home-panel[open] > summary::after { transform: rotate(45deg); }
.home-panel > summary:focus-visible { outline: 2px solid var(--panel-accent); outline-offset: 3px; }
.panel-icon { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 13px; color: var(--panel-accent); background: var(--panel-tint); }
.panel-icon svg { width: 21px; height: 21px; }
.home-panel-body { padding: 0 24px 24px; }
.home-panel-body > .view-head { margin: 0 0 18px; padding-top: 4px; }
.home-panel-body > p { margin: 0 0 18px; }
.home-panel-body .type-cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 14px; margin-bottom: 0; }
.home-panel .type-card {
  display: flex; grid-row: auto; flex-direction: column; gap: 12px;
  padding: 20px; border-radius: 15px; background: var(--bg); min-width: 0;
  border-color: transparent;
}
.home-panel .type-card h3 { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.home-panel .type-total { font-size: 28px; font-weight: 700; letter-spacing: -.04em; }
.home-panel .type-card .muted { font-size: 12px; }
.home-panel .type-card .button {
  margin-top: auto; padding: 8px 13px; background: var(--surface);
  color: var(--panel-accent); border: 1px solid var(--border);
  border-radius: 9px; font-size: 13px; box-shadow: none;
}
.home-panel .type-card .button:hover { border-color: var(--panel-accent); }
.home-panel .type-card-all { background: var(--panel-tint); }
.home-panel .type-card-new { background: transparent; border: 1px dashed var(--border); }
.home-panel .type-card-new .definition { font-size: 12px; line-height: 1.6; }
.home-panel button.primary { background: var(--panel-accent); }
.home-panel .view-head button { font-size: 13px; border-radius: 10px; padding: 9px 13px; }
.friend-groups { display: flex; flex-direction: column; gap: 10px; }
.friend-groups a { color: var(--panel-accent); text-underline-offset: 3px; overflow-wrap: anywhere; font-size: 13px; }
.lang-btn, .landing header .lang-btn {
  min-width: 32px; min-height: 32px; padding: 5px 7px; font-size: 11px;
  font-weight: 500; letter-spacing: .02em; border-color: transparent;
  background: transparent; color: var(--muted); box-shadow: none;
}
.lang-btn:hover, .landing header .lang-btn:hover { color: var(--text); border-color: var(--border); }
@media (prefers-color-scheme: dark) {
  .home-panel { --panel-accent: #99adff; --panel-tint: #202b49; box-shadow: none; }
  .home-panel[data-home-panel="events"] { --panel-accent: #c5a1f0; --panel-tint: #302540; }
  .home-panel[data-home-panel="friends"] { --panel-accent: #7bd7bf; --panel-tint: #19372f; }
  .home-panel[data-home-panel="groups"] { --panel-accent: #8bc9ea; --panel-tint: #1c3040; }
  .home-panel[data-home-panel="archives"] { --panel-accent: #e7bc79; --panel-tint: #372e20; }
  .home-panel button.primary { background: var(--panel-tint); color: var(--panel-accent); border-color: var(--panel-accent); }
}
@media (max-width: 480px) {
  .home-panel { border-radius: 16px; margin: 12px 0; }
  .home-panel > summary { padding: 16px; gap: 10px; font-size: 16px; }
  .panel-icon { width: 34px; height: 34px; border-radius: 11px; }
  .home-panel-body { padding: 0 14px 16px; }
  .home-panel .type-card { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .home-panel > summary::after { transition: none; }
}

/* Barre de compte : commandes légères, icônes au même trait. */
.topbar .actions { align-items: center; gap: 8px; }
.topbar .actions button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 11px; border: 1px solid transparent;
  border-radius: 11px; background: transparent; color: #b7c3d6;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.topbar .actions button:hover { color: #fff; background: #ffffff0d; border-color: transparent; }
.topbar .actions button:focus-visible { outline: 2px solid #93baff; outline-offset: 3px; }
.topbar .toolbar-icon { display: block; flex-shrink: 0; }
.topbar .actions .lang-btn { min-width: 32px; padding: 6px; font-size: 10px; letter-spacing: .06em; color: #9aaac1; }
.topbar .actions .bell { width: 38px; padding: 8px; }
.topbar .actions .user-chip { padding: 4px 12px 4px 5px; border-radius: 999px; background: #ffffff09; color: #edf2fa; gap: 9px; }
.topbar .user-chip .avatar { width: 28px; height: 28px; flex-shrink: 0; background: #253953; color: #b8d9ff; font-size: 10px; font-weight: 600; }
.topbar .actions .signout { color: #a0adc0; margin-left: 4px; }
.topbar .actions .signout:hover { color: #ffc1bd; background: #ff8b800d; }
@media (max-width: 760px) {
  .topbar .actions { gap: 4px; }
  .topbar .actions .signout { width: 38px; margin-left: 0; }
  .topbar #btn-view-as span { display: none; }
}
@media (max-width: 480px) {
  .topbar .actions { flex: 1 1 100%; justify-content: flex-end; }
  .topbar .actions button { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .topbar .actions button { transition: none; }
}

/* Facture par items : carrés de couleur par personne */
.items-legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 10px; font-size: 13px; }
.items-legend .legend { display: inline-flex; align-items: center; gap: 6px; }
.sq { --c: #1f6bff; width: 30px; height: 30px; min-width: 30px; padding: 0; border-radius: 7px; border: 2px solid var(--c);
  background: transparent; color: var(--c); font-size: 11px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; opacity: .45; }
.sq.on { background: var(--c); color: #fff; opacity: 1; }
.items-legend .sq { width: 22px; height: 22px; min-width: 22px; font-size: 9.5px; cursor: default; }
.item-members { display: flex; flex-wrap: wrap; gap: 6px; }
/* Menu « + Ajouter » du groupe */
.add-menu { position: relative; display: inline-block; }
.add-menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; display: flex; flex-direction: column; min-width: 280px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(0,0,0,.4); }
.add-menu-list[hidden] { display: none; }
.add-menu-list button { text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 8px; }
.add-menu-list button:hover { background: var(--accent-soft); }

/* ---------- Nouveau look, comme l'app (lib/ui/widgets/ui_kit.dart) ----------
   Texte plus fin, listes groupées dont chaque ligne tient sur une ligne,
   montants alignés à droite, sommaires en dégradé, bouton Grab. */
:root { --surface-2: #f1f3f9; --hero-text: #8fb8ff; }
@media (prefers-color-scheme: dark) { :root { --surface-2: #0f1524; } }

h1, h2, h3 { font-weight: 600; }
button { font-weight: 500; padding: 6px 13px; }
#app { padding-bottom: 96px; }
.drop { flex-direction: row; justify-content: center; flex-wrap: wrap; gap: 4px 10px; padding: 10px 14px; font-size: 12.5px; border-width: 1.5px; }
.drop strong { font-weight: 500; }

/* Onglets de l'accueil : en haut sur ordinateur, barre fixe en bas sur téléphone. */
.home-tabs {
  display: flex; gap: 4px; padding: 4px; margin: 14px 0 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
}
.home-tabs button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; background: transparent; color: var(--muted); border-radius: 10px; padding: 8px 6px; font-size: 13.5px;
}
.home-tabs button:hover { color: var(--text); }
.home-tabs button.on { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.home-tabs button.on .ico { color: var(--accent); }
@media (max-width: 760px) {
  .home-tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; margin: 0; border-radius: 0;
    border-width: 1px 0 0; background: var(--navy); padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .home-tabs button { flex-direction: column; gap: 3px; font-size: 11px; color: #9aa0b4; }
  .home-tabs button.on { background: transparent; color: #fff; }
  .home-tabs button.on .ico { color: #8fb8ff; background: #16244a; border-radius: 99px; padding: 3px 14px; box-sizing: content-box; }
  .fab-zone { bottom: calc(78px + env(safe-area-inset-bottom)) !important; right: 16px !important; }
}

/* Sommaire en dégradé (dépenses, groupe, événement). */
.hero-card {
  margin-top: 12px; padding: 14px 18px 14px; border-radius: 20px; color: #fff;
  background: linear-gradient(135deg, #16306b, #0f1d3d); border: 1px solid rgba(31, 107, 255, .35);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero-eyebrow { font-size: 12.5px; color: var(--hero-text); }
.hero-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.hero-title h2 { color: #fff; font-size: 18px; }
.hero-amount { margin: 6px 0 0; font-size: 30px; font-weight: 600; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.hero-amount:empty { display: none; }
.hero-meta { margin: 2px 0 0; font-size: 12.5px; color: var(--hero-text); }
.hero-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: 13px; color: var(--hero-text);
}
.hero-card .pos { color: #81c784; }
.hero-card .neg { color: #ef7070; }
.hero-card .amount.muted b, .hero-card .amount.muted small { color: var(--hero-text); }
.year-pill {
  width: auto; padding: 3px 6px 3px 10px; border: 0; border-radius: 99px; font-size: 12px;
  background: rgba(255, 255, 255, .08); color: var(--hero-text); cursor: pointer;
}
.year-pill option { color: var(--text); background: var(--surface); }

/* Titres de section et petits boutons-liens. */
.section-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 20px 4px 7px; font-size: 11px; font-weight: 500; letter-spacing: .9px; text-transform: uppercase; color: var(--muted);
}
.link-btn {
  border: 0; background: none; padding: 4px 6px; color: var(--accent-2); font-size: 13px; font-weight: 500;
  text-transform: none; letter-spacing: 0; cursor: pointer; white-space: nowrap;
}
.link-btn:hover { text-decoration: underline; }
.gap { height: 12px; }
.center { text-align: center; }

/* Listes groupées : une carte, des lignes séparées d'un trait fin. */
.grouped { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.line {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px 10px 14px;
  border: 0; border-radius: 0; background: transparent; color: inherit; text-decoration: none; text-align: left; font: inherit;
}
.line + .line { border-top: 1px solid var(--border); }
a.line:hover, button.line:hover { background: var(--surface-2); }
.line.compact { padding-top: 8px; padding-bottom: 8px; }
.line-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.line-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-title.wrap2 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; line-height: 1.25; }
.line-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-chevron { display: flex; color: var(--muted); flex-shrink: 0; }
.line-more { color: var(--muted); padding: 2px 7px; border-radius: 6px; flex-shrink: 0; }
.line-more:hover { background: var(--surface-2); color: var(--text); }
.line .vlogo { flex-shrink: 0; }
.line .arrow { color: var(--muted); }
.bar { display: block; height: 4px; margin-top: 7px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.bar span { display: block; height: 100%; border-radius: 99px; }

/* Montants et soldes. */
.amount { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.amount b { font-size: 14px; font-weight: 600; }
.amount small { font-size: 11px; color: var(--muted); }
.pos, .amount.pos b, .amount.pos small, .amount small.pos { color: var(--ok); }
.neg, .amount.neg b, .amount.neg small, .amount small.neg { color: var(--danger); }
.amount.muted b { color: var(--muted); font-weight: 500; }

/* Pastilles : icône de couleur, initiales. */
.icon-tile, .avatar-tile {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  border-radius: 30%; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c);
}
.avatar-tile { font-weight: 600; color: color-mix(in srgb, var(--c) 70%, var(--text)); }

/* Écran vide. */
.empty-state { text-align: center; padding: 40px 20px 24px; }
.empty-state .icon-tile { margin: 0 auto 14px; }
.empty-state h3 { margin: 0 0 6px; font-size: 17px; }
.empty-state p { margin: 0 auto 16px; max-width: 420px; }

/* Cartes des groupes : grand en-tête, membres en petit dessous. */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.group-card {
  display: block; color: inherit; text-decoration: none; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
}
.group-card:hover { border-color: var(--accent); }
.gc-head { display: flex; align-items: center; gap: 12px; padding: 16px 12px 0 16px; }
.gc-name { font-size: 18px; font-weight: 600; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.group-card hr { border: 0; border-top: 1px solid var(--border); margin: 12px 16px 10px; }
.gc-figures { display: flex; justify-content: space-between; gap: 10px; padding: 0 16px 14px; }
.gc-figures span { display: flex; flex-direction: column; }
.gc-figures .end { align-items: flex-end; }
.gc-figures small { font-size: 11px; color: var(--muted); }
.gc-figures b { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gc-figures .pos b { color: var(--ok); }
.gc-figures .neg b { color: var(--danger); }
.gc-figures .muted b { color: var(--muted); }
.gc-members { background: var(--surface-2); border-top: 1px solid var(--border); padding: 7px 16px; }
.gc-member { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 12.5px; }
.gc-mname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gc-member > span:last-child { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gc-members + .line { border-top: 1px solid var(--border); }
.gc-more { display: block; padding: 4px 0 2px; font-size: 11.5px; color: var(--accent-2); }

/* Amis : deux cases en haut, détail d'un ami. */
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.stat { display: flex; flex-direction: column; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; }
.stat small { font-size: 11.5px; color: var(--muted); }
.stat b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
#friend-dialog, #pick-dialog { width: min(440px, 92vw); }
#pick-dialog h2 { margin-bottom: 12px; }
.friend-head { display: flex; align-items: center; gap: 14px; }
.friend-head h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Page d'un groupe ou d'un événement. */
#group-view .view-head .back { font-weight: 500; }
#group-view .tabs { margin: 20px 0 10px; }

/* Bouton Grab (marque) et bouton d'action de l'onglet. */
.fab-zone { position: fixed; right: 28px; bottom: 28px; z-index: 60; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.grab, .fab-alt {
  border: 0; border-radius: 16px; color: #fff; cursor: pointer;
  background: linear-gradient(90deg, #1f6bff, #2fb5ff); box-shadow: 0 6px 14px rgba(31, 107, 255, .4);
}
.grab { display: flex; padding: 7px 16px; }
.grab img { display: block; height: 30px; width: auto; }
.fab-alt { padding: 11px 18px; font-size: 14px; font-weight: 500; }
.grab:hover, .fab-alt:hover { filter: brightness(1.08); }
.grab-menu {
  display: flex; flex-direction: column; min-width: 290px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
}
.grab-menu button { border: 0; border-radius: 0; background: transparent; padding: 11px 14px; text-align: left; }
.grab-menu button + button { border-top: 1px solid var(--border); }
.grab-menu button:hover { background: var(--surface-2); }
.year-pill { width: auto !important; min-width: 0; max-width: 92px; flex: 0 0 auto; }
@media (max-width: 760px) { .drop { display: none; } }
.hero-card .amount.pos b, .hero-card .amount.pos small { color: #81c784; }
.hero-card .amount.neg b, .hero-card .amount.neg small { color: #ef7070; }

/* Articles d'une facture : une ligne nette par article (comme l'app). */
#items-list { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
#items-list:empty { display: none; }
.item-row { grid-template-columns: 1fr 96px auto; gap: 6px; padding: 2px 4px 8px 12px; }
.item-row:last-child { border-bottom: 0; }
.item-row input { border: 0; background: transparent; padding: 8px 0; border-radius: 0; }
.item-row input:focus { outline: 0; box-shadow: inset 0 -1.5px 0 var(--accent); }
.item-row input[data-field="price"] { text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.item-row input[data-field="price"]::-webkit-inner-spin-button { display: none; }
.item-row.orphan { box-shadow: inset 3px 0 0 var(--danger); }
.item-row .sq { width: 28px; height: 28px; min-width: 28px; }

/* Bouton Grab bien reconnaissable : pilule, « + » dans une pastille blanche,
   liseré clair, relief, et enfoncement au clic. */
.grab {
  align-items: center; gap: 10px; padding: 7px 18px 7px 7px; border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, .35);
  box-shadow: 0 6px 16px rgba(31, 107, 255, .5), 0 2px 4px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.grab img { height: 28px; }
.grab-plus {
  display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
  background: #fff; color: #1f6bff; font-size: 24px; font-weight: 500; line-height: 1;
}
.grab:hover { transform: translateY(-1px); box-shadow: 0 9px 20px rgba(31, 107, 255, .55), 0 2px 4px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .25); }
.grab:active { transform: translateY(1px) scale(.98); box-shadow: 0 3px 8px rgba(31, 107, 255, .45), inset 0 2px 4px rgba(0, 0, 0, .2); }
.fab-alt { border-radius: 99px; border: 1px solid rgba(255, 255, 255, .35); }

/* Rapport TPS/TVQ */
.tax-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 10px; }
.tax-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.tax-types { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 10px 0; }
#tax-types { display: flex; flex-wrap: wrap; gap: 4px 16px; }
#tax-dialog details { margin: 10px 0; }
#tax-dialog summary { cursor: pointer; font-size: 13px; }
@media (max-width: 560px) { .tax-grid { grid-template-columns: 1fr; } .tax-grid > span { display: none; } }

/* Applications connectées : clés de l'API publique */
.api-key-row { border-bottom: 1px solid var(--border); padding: 6px 0; }
.api-key-new { margin-top: 10px; padding: 10px; border-radius: 8px; background: rgba(34, 197, 94, .08); }
.api-key-new .row { display: flex; gap: 8px; }
.api-key-new input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; }
