/* Greffier · l'agent administratif de Maoni. Un outil qu'on lit d'un coup d'œil au téléphone (390 px d'abord) : une colonne,
   une carte par échéance, le chiffre à saisir en grand, l'action à portée du pouce. Habillé selon la charte « Chrome liquide »
   de Vixya (fond nuit, texte blanc et argent, le chrome réservé aux chiffres et aux filets, la couleur seulement en points et
   en traits). Un seul thème, nuit. Tout texte à 16 px au moins. */
@font-face { font-family: "Syncopate"; src: url("/polices/syncopate.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Onest"; src: url("/polices/onest.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --nuit: #0B0B0E; --carte: #121216; --carte-haute: #22232A; --creux: #0B0B0E; --filet: #22232A; --graphite: #2A2C31;
  --blanc: #EDEDF0; --argent: #A6A9B1;
  --turquoise: #4FD1C5; --bleu: #8AB4FF; --rose: #F29BC4; --or: #FFD27A;
  --chrome: linear-gradient(100deg, #B9BCC6 0%, #FFFFFF 22%, #9EA2AD 40%, #FFFFFF 58%, #C9CCD3 75%, #FFFFFF 90%, #AEB2BC 100%);
  --filet-chrome: linear-gradient(90deg, rgba(255, 255, 255, .42), rgba(226, 232, 255, .2) 45%, rgba(255, 255, 255, .03));
  --f: "Onest", "Segoe UI", system-ui, sans-serif;
  --f-titre: "Syncopate", "Onest", system-ui, sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--nuit); scroll-behavior: smooth; }
body { margin: 0; isolation: isolate; min-height: 100svh; background: var(--nuit); color: var(--blanc); font: 400 16px/1.5 var(--f); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--turquoise); outline-offset: 3px; }
[hidden] { display: none !important; }

/* Le fond : deux halos qui changent avec l'écran, jamais un aplat. */
.fond { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: linear-gradient(180deg, #08090C 0%, #0B0D11 100%); }
.fond .halo { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .55; transition: transform 1.2s cubic-bezier(.45, .05, .25, 1), background 1.2s ease; }
.fond .h1 { width: 70vmax; height: 70vmax; left: 50%; top: -20vmax; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(79, 209, 197, .22), rgba(138, 180, 255, .08) 55%, transparent 100%); }
.fond .h2 { width: 50vmax; height: 50vmax; right: -20vmax; bottom: -15vmax; background: radial-gradient(closest-side, rgba(242, 155, 196, .14), transparent 100%); }
body[data-ecran="porte"] .fond .h1 { transform: translate(-50%, 55svh) scale(.8); background: radial-gradient(closest-side, rgba(170, 190, 255, .25), rgba(242, 155, 196, .08) 55%, transparent 100%); }
body[data-ecran="recettes"] .fond .h1 { background: radial-gradient(closest-side, rgba(255, 210, 122, .16), rgba(79, 209, 197, .06) 55%, transparent 100%); }
body[data-ecran="tva"] .fond .h1 { background: radial-gradient(closest-side, rgba(242, 155, 196, .18), rgba(138, 180, 255, .08) 55%, transparent 100%); }

/* La barre du haut et les onglets */
.barre { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 16px 10px; background: rgba(11, 11, 14, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.marque { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.marque img { display: block; height: 22px; width: auto; }
.marque span { padding-left: 10px; border-left: 1px solid var(--graphite); font-weight: 500; font-size: 16px; color: var(--argent); line-height: 1; }
.moi { display: flex; align-items: center; gap: 12px; font-size: 16px; color: var(--argent); }
.lien { padding: 6px 0; border: 0; background: none; color: var(--argent); text-decoration: underline; text-decoration-color: var(--graphite); text-underline-offset: 4px; cursor: pointer; font-size: 16px; }
.onglets { position: sticky; top: calc(44px + max(12px, env(safe-area-inset-top))); z-index: 4; display: flex; gap: 6px; padding: 6px 16px 10px; overflow-x: auto; scrollbar-width: none; background: rgba(11, 11, 14, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.onglets::-webkit-scrollbar { display: none; }
.onglets::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--filet-chrome); opacity: .6; }
.onglets a { flex: none; min-height: 40px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 20px; background: var(--carte-haute); box-shadow: inset 0 0 0 1px var(--graphite); color: var(--blanc); font-weight: 600; font-size: 16px; text-decoration: none; white-space: nowrap; }
.onglets a.actif { background: var(--blanc); color: var(--nuit); box-shadow: none; }

.ecran { width: 100%; max-width: 640px; margin: 0 auto; padding: 18px 16px 80px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-content: start; }
.attente { color: var(--argent); text-align: center; padding: 48px 0; }

/* Connexion */
.porte { display: grid; gap: 16px; padding-top: 9vh; }
.porte h1 { margin: 0; font-size: 30px; font-weight: 600; line-height: 1.12; letter-spacing: -.025em; text-wrap: balance; }
.porte p { margin: 0; color: var(--argent); }
.champ { display: grid; gap: 8px; }
.champ > span { font-weight: 600; font-size: 16px; color: var(--argent); }
.champ input, .champ textarea, .champ select { width: 100%; min-height: 52px; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--graphite); background: var(--creux); color: var(--blanc); font-size: 16px; transition: border-color .2s, box-shadow .2s; }
.champ textarea { min-height: 116px; resize: vertical; }
.champ input::placeholder, .champ textarea::placeholder { color: var(--argent); opacity: .6; }
.champ input:focus, .champ textarea:focus, .champ select:focus { outline: none; box-shadow: inset 0 -2px 0 var(--turquoise); }
.champ input[type="date"], .champ input[type="month"] { color-scheme: dark; }
.champ small { color: var(--argent); }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.case { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--graphite); background: var(--creux); cursor: pointer; font-weight: 600; }
.case input { width: 22px; height: 22px; margin: 0; accent-color: var(--turquoise); flex: none; }

/* Les boutons : blanc pour l'action principale, sombre pour les autres. */
.bouton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--blanc); color: var(--nuit); font-weight: 600; font-size: 16px; text-align: center; text-decoration: none; cursor: pointer; transition: transform .15s, background-color .2s, opacity .2s; }
.bouton:active { transform: scale(.97); }
.bouton[disabled] { opacity: .45; }
.bouton.second { background: var(--carte); color: var(--blanc); box-shadow: inset 0 0 0 1px var(--graphite); }
.bouton.second:active { background: var(--carte-haute); }
.bouton.plein { width: 100%; }
.bouton.fait { box-shadow: inset 0 0 0 1.5px var(--turquoise); background: var(--carte); color: var(--turquoise); }
.bouton.petit { min-height: 40px; padding: 0 14px; font-size: 15px; }
.bouton.danger { background: var(--carte); color: var(--rose); box-shadow: inset 0 0 0 1px var(--graphite); }
label.bouton { position: relative; cursor: pointer; }
label.bouton input { position: absolute; width: 1px; height: 1px; opacity: 0; }
label.bouton:focus-within { outline: 2px solid var(--turquoise); outline-offset: 3px; }

/* Les sections et les cartes */
.section { display: grid; gap: 10px; }
.section > h2 { margin: 0; display: flex; align-items: center; gap: 10px; font: 700 12px/1.3 var(--f-titre); letter-spacing: .06em; text-transform: uppercase; color: var(--argent); }
.section > h2::after { content: ""; flex: 1; height: 1px; background: var(--filet-chrome); opacity: .55; }
.section > h2 small { font: 600 16px/1 var(--f); letter-spacing: 0; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.vide { margin: 0; padding: 15px 16px; border-radius: 16px; border: 1px dashed var(--graphite); color: var(--argent); }
.carte { position: relative; display: grid; gap: 12px; padding: 18px 16px; border-radius: 20px; background: color-mix(in srgb, var(--carte) 86%, transparent); border: 1px solid var(--filet); }
.carte h3 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.2; letter-spacing: -.02em; text-wrap: balance; }
.carte p { margin: 0; }
.carte .sous { color: var(--argent); }
.haut { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.haut .limite { color: var(--argent); font-size: 16px; }
.pastille { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 3px 12px; border-radius: 18px; font-size: 16px; font-weight: 600; line-height: 1.3; background: var(--carte-haute); color: var(--blanc); box-shadow: inset 0 0 0 1px var(--graphite); --point: var(--argent); --halo: 0 0 0 transparent; }
.pastille::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--point); box-shadow: var(--halo); }
.pastille.en_retard { --point: var(--rose); --halo: 0 0 10px var(--rose); }
.pastille.a_faire { --point: var(--or); --halo: 0 0 10px var(--or); }
.pastille.fait, .pastille.sans_objet { --point: var(--turquoise); --halo: 0 0 10px var(--turquoise); }
.pastille.a_venir { --point: var(--bleu); }
.chiffre { display: grid; gap: 4px; padding: 14px 16px; border-radius: 16px; background: var(--creux); box-shadow: inset 0 0 0 1px var(--filet); }
.chiffre .etiquette { color: var(--argent); font-size: 16px; }
.chiffre .grand { font-size: 34px; font-weight: 700; line-height: 1.1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chiffre .grand.manque { background: none; color: var(--or); -webkit-text-fill-color: var(--or); font-size: 22px; }
.source { color: var(--argent); font-size: 16px; line-height: 1.45; }
.source b { color: var(--blanc); font-weight: 600; }
.lignes { margin: 0; display: grid; gap: 10px; }
.lignes > div { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--filet); }
.lignes dt { font-weight: 600; }
.lignes dd { margin: 0; }
.lignes dd b { font-weight: 700; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lignes dd small { display: block; color: var(--argent); }
.alerte { margin: 0; padding: 13px 14px; border-radius: 14px; background: var(--carte); box-shadow: inset 0 0 0 1px var(--or); color: var(--blanc); line-height: 1.45; }
.alerte b { color: var(--or); }
.alerte.rose { box-shadow: inset 0 0 0 1px var(--rose); }
.alerte.rose b { color: var(--rose); }
.aide { margin: 0; padding-left: 20px; color: var(--argent); display: grid; gap: 6px; }
.sources { color: var(--argent); font-size: 16px; }
.sources a { color: var(--blanc); text-decoration-color: var(--turquoise); text-underline-offset: 4px; }
.actions { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: stretch; }
.actions .bouton.second { padding: 10px 14px; line-height: 1.25; }
.actions .bouton.fait { padding: 0 24px; }
.fait-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--argent); }
.fait-info b { color: var(--turquoise); font-weight: 600; }
details.repli > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 40px; }
details.repli > summary::-webkit-details-marker { display: none; }
details.repli > summary::after { content: "+"; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--graphite); color: var(--argent); font-weight: 400; font-size: 18px; line-height: 1; flex: none; }
details.repli[open] > summary::after { content: "−"; }
details.repli > .corps { display: grid; gap: 12px; padding-top: 10px; }

/* La page du mois */
.entete-mois { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.entete-mois h1 { margin: 0; text-align: center; font-size: 26px; font-weight: 600; letter-spacing: -.02em; text-transform: capitalize; }
.entete-mois button { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--carte-haute); box-shadow: inset 0 0 0 1px var(--graphite); color: var(--blanc); font-size: 20px; cursor: pointer; }
.meta { margin: 0; color: var(--argent); text-align: center; }
.meta a { color: var(--blanc); text-decoration-color: var(--turquoise); text-underline-offset: 4px; }
.liste { display: grid; gap: 8px; }
.ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 14px; border-radius: 16px; background: color-mix(in srgb, var(--carte) 86%, transparent); border: 1px solid var(--filet); text-align: left; cursor: pointer; }
.ligne .quand { grid-column: 1; color: var(--argent); font-size: 16px; }
.ligne .quoi { grid-column: 1; font-weight: 600; }
.ligne .combien { grid-column: 2; grid-row: 1 / 3; align-self: center; font-weight: 700; font-variant-numeric: tabular-nums; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }

/* Les recettes */
.resume { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tuile { display: grid; gap: 2px; padding: 14px 16px; border-radius: 16px; background: color-mix(in srgb, var(--carte) 86%, transparent); border: 1px solid var(--filet); }
.tuile span { color: var(--argent); font-size: 16px; }
.tuile b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.boutons { display: flex; flex-wrap: wrap; gap: 10px; }
.boutons .bouton { flex: 1 1 auto; }
.recette { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 14px 16px; border-radius: 16px; background: color-mix(in srgb, var(--carte) 86%, transparent); border: 1px solid var(--filet); }
.recette .nom { font-weight: 600; }
.recette .detail { grid-column: 1; color: var(--argent); font-size: 16px; }
.recette .montant { grid-column: 2; grid-row: 1; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; white-space: nowrap; }
.recette .facture { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; color: var(--argent); }
.recette .facture input { flex: 1; min-width: 0; min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--graphite); background: var(--creux); color: var(--blanc); }
.recette .facture input:focus { outline: none; box-shadow: inset 0 -2px 0 var(--turquoise); }
.recette .retirer { grid-column: 1 / -1; justify-self: start; }
.mois-recettes { display: grid; gap: 6px; }
.mois-recettes div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--filet); }
.mois-recettes b { font-variant-numeric: tabular-nums; }

/* La TVA : les abonnements et le message au SIE */
.abonnement { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 14px 16px; border-radius: 16px; background: color-mix(in srgb, var(--carte) 86%, transparent); border: 1px solid var(--filet); }
.abonnement .nom { font-weight: 600; }
.abonnement .detail { grid-column: 1; color: var(--argent); }
.abonnement .montant { grid-column: 2; grid-row: 1; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--chrome); -webkit-background-clip: text; background-clip: text; color: transparent; }
.abonnement .gestes { grid-column: 1 / -1; display: flex; gap: 10px; }
.message { margin: 0; padding: 14px; border-radius: 14px; background: var(--creux); box-shadow: inset 0 0 0 1px var(--filet); font: 400 16px/1.5 var(--f); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--blanc); max-height: 50svh; overflow: auto; }
.manque { color: var(--or); font-weight: 600; }

/* Les preuves et les courriers */
.fichiers { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.fichiers li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fichiers a { color: var(--blanc); text-decoration-color: var(--turquoise); text-underline-offset: 4px; overflow-wrap: anywhere; }
.fichiers small { color: var(--argent); }
.courrier img { display: block; max-width: 100%; max-height: 40svh; object-fit: contain; border-radius: 12px; background: var(--creux); box-shadow: inset 0 0 0 1px var(--filet); }
.courrier .texte { white-space: pre-wrap; color: var(--argent); }
.courrier textarea { width: 100%; min-height: 90px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--graphite); background: var(--creux); color: var(--blanc); resize: vertical; }

/* Le dossier */
.fiche { margin: 0; display: grid; gap: 8px; }
.fiche div { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--filet); }
.fiche dt { color: var(--argent); font-size: 16px; }
.fiche dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
table.taux { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
table.taux th, table.taux td { padding: 8px 6px; border-top: 1px solid var(--filet); text-align: right; font-size: 16px; }
table.taux th:first-child, table.taux td:first-child { text-align: left; }
table.taux thead th { color: var(--argent); font-weight: 600; border-top: 0; }
table.taux .actuelle { color: var(--turquoise); }
.journal { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; color: var(--argent); }
.journal b { color: var(--blanc); font-weight: 500; }

/* La feuille qui monte du bas */
.feuille { width: 100%; max-width: 640px; max-height: 92svh; margin: auto auto 0; padding: 0; border: 0; border-radius: 26px 26px 0 0; background: var(--carte); color: var(--blanc); box-shadow: 0 -24px 60px -20px rgba(0, 0, 0, .9); }
.feuille::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--filet-chrome); opacity: .7; }
.feuille::backdrop { background: rgba(5, 5, 8, .62); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.feuille[open] { animation: monte .3s cubic-bezier(.2, .8, .2, 1); }
@keyframes monte { from { transform: translateY(40px); opacity: 0; } }
.feuille-corps { display: grid; gap: 14px; padding: 26px 16px max(22px, env(safe-area-inset-bottom)); }
.feuille-corps::before { content: ""; position: absolute; top: 10px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: var(--graphite); }
.feuille h2 { margin: 0; font-size: 23px; font-weight: 600; letter-spacing: -.02em; }
.feuille p { margin: 0; color: var(--argent); }
.feuille .erreur { color: var(--rose); font-weight: 500; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 20; transform: translateX(-50%); margin: 0; padding: 12px 20px; border-radius: 999px; background: var(--blanc); color: var(--nuit); font-weight: 600; box-shadow: 0 14px 40px -12px rgba(0, 0, 0, .9); max-width: calc(100vw - 32px); text-align: center; }
.erreur { margin: 0; color: var(--rose); font-weight: 500; }

@media (prefers-reduced-motion: reduce) { .feuille[open] { animation: none; } .bouton, .fond .halo { transition: none; } }
@media (min-width: 900px) {
  .ecran { max-width: 980px; padding: 28px 24px 100px; }
  .section.deux-colonnes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .section.deux-colonnes > h2, .section.deux-colonnes > .vide, .section.deux-colonnes > .alerte { grid-column: 1 / -1; }
  .carte { padding: 22px 22px; }
  .chiffre .grand { font-size: 40px; }
  .resume { grid-template-columns: repeat(4, 1fr); }
  .onglets { justify-content: center; }
  .entete-mois { max-width: 560px; margin: 0 auto; width: 100%; }
}
