/* Mon Aquarium — même palette et mêmes polices que Pellicule et Mes Musiques. */
:root {
  --bg: #0b1526; --card: #11203a; --card-2: #152843; --ink: #eef1f7; --ink-soft: #8a97ae; --line: #213254;
  --accent: #c9a44c; --accent-blue: #5b9bf5; --on-accent: #171310; --tab-active: #2a2313;
  --ok: #5fb58a; --warn: #e0a23a; --danger: #d9695a;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  --disp: 'Newsreader', Georgia, 'Times New Roman', serif;
  --body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #070e1a; }
body { color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-blue); }

/* #app ancré aux vrais bords (leçon Pellicule : 100dvh ne couvre pas toujours la zone du home indicator). */
#app { position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; }
@media (min-width: 641px) {
  #app { inset: 24px auto 24px 50%; transform: translateX(-50%); width: 430px; border: 1px solid var(--line); border-radius: 34px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
}
.boot { margin: auto; color: var(--ink-soft); }

/* Barre du haut */
.topbar { flex: none; display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + 16px) 10px calc(var(--safe-l) + 16px); border-bottom: 1px solid var(--line); }
.topbar img { width: 30px; height: 30px; flex: none; }
.topbar select { flex: 1; min-width: 0; border: 0; font-family: var(--disp); font-size: 19px; padding: 2px 22px 2px 0; appearance: none; -webkit-appearance: none; text-overflow: ellipsis;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a97ae' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 2px center / 16px; }
.topbar select option { background: var(--card); color: var(--ink); }
.topbar select:focus-visible { outline: 2px solid var(--accent); border-radius: 6px; }
.sync { flex: none; display: flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 12px; color: var(--ink-soft); cursor: pointer; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-soft); }
.sync[data-etat="ok"] i { background: var(--ok); }
.sync[data-etat="attente"] i, .sync[data-etat="hors-ligne"] i { background: var(--warn); }
.sync[data-etat="erreur"] i, .sync[data-etat="deconnecte"] i { background: var(--danger); }
.sync[data-etat="synchro"] i { background: var(--accent-blue); animation: pulse 1s infinite alternate; }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sync[data-etat="synchro"] i { animation: none; } }

/* Contenu */
main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px calc(var(--safe-r) + 16px) 28px calc(var(--safe-l) + 16px); display: flex; flex-direction: column; gap: 18px; }
h1, h2, h3 { font-family: var(--disp); font-weight: 500; margin: 0; text-wrap: balance; }
h1 { font-size: 28px; line-height: 1.15; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
p { margin: 0; }
.soft { color: var(--ink-soft); }
.danger-texte { color: var(--danger); }
.small { font-size: 13px; }
.eyebrow { font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row > .grow { flex: 1; min-width: 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
a.card { text-decoration: none; color: inherit; }
.ecran { display: flex; flex-direction: column; gap: 18px; }
.banner { background: var(--tab-active); border: 1px solid #4a3d1c; border-radius: 14px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }

/* Listes (Réglages, Plus) */
.list { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.list > a, .list > button, .list > div { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; border: 0; background: none; text-align: left; text-decoration: none; color: var(--ink); }
.list > * + * { border-top: 1px solid var(--line); }
.list > a:active, .list > button:active { background: var(--card-2); }
.list .grow { flex: 1; min-width: 0; }
.list .grow small { display: block; color: var(--ink-soft); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--ink-soft); flex: none; }
.pill { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-soft); flex: none; }
.pill.bientot { color: var(--accent); border-color: #4a3d1c; }

/* Problèmes */
.pb { border-left: 3px solid var(--ink-soft); }
.pb[data-niveau="erreur"] { border-left-color: var(--danger); }
.pb[data-niveau="attention"] { border-left-color: var(--warn); }
.pb[data-niveau="info"] { border-left-color: var(--accent-blue); }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); color: var(--ink); font-weight: 500; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .list > a:focus-visible, .list > button:focus-visible, .tabbar a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Formulaires : saisie au pouce, champs larges */
form.fiche { display: flex; flex-direction: column; gap: 14px; }
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ label { font-size: 13px; color: var(--ink-soft); }
.champ .saisie { display: flex; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.champ .saisie:focus-within { border-color: var(--accent); }
.champ input, .champ select, .champ textarea { flex: 1; min-width: 0; background: transparent; border: 0; padding: 12px 14px; font-size: 16px; outline: none; }
.champ textarea { min-height: 90px; resize: vertical; }
.champ select { appearance: none; -webkit-appearance: none; }
.champ .unite { padding: 0 14px 0 4px; color: var(--ink-soft); }
.champ .aide { font-size: 12.5px; color: var(--ink-soft); }
.champ .err { font-size: 12.5px; color: var(--danger); }
.champ[data-verrouille] .saisie { opacity: .7; }

/* Barre d'onglets */
.tabbar { flex: none; display: flex; border-top: 1px solid var(--line); padding: 6px calc(var(--safe-r) + 4px) calc(var(--safe-b) + 6px) calc(var(--safe-l) + 4px); background: var(--bg); }
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: 12px; color: var(--ink-soft); text-decoration: none; font-size: 11px; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--accent); background: var(--tab-active); }

/* Écran de connexion */
.accueil-connexion { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; padding: 24px; max-width: 360px; }
.accueil-connexion img { width: 120px; height: 120px; border-radius: 27px; box-shadow: 0 12px 30px rgba(0,0,0,.4); }

/* Bandeau de mise à jour */
.maj { position: absolute; left: 12px; right: 12px; bottom: calc(var(--safe-b) + 76px); z-index: 5; }
