:root {
  --fond: #f6f4ef; --carte: #ffffff; --texte: #23211d; --doux: #6d685f; --bord: #e3ded4;
  --accent: #c2603e; --accent-texte: #ffffff; --ok: #2f8a4c; --alerte: #b3261e;
  --term: #1c1b19; --barre: #262421; --barre-texte: #ece8e0; --touche: #34312d;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #171614; --carte: #22201d; --texte: #ece8e0; --doux: #a39d92; --bord: #3a3732;
    --accent: #d9774f; --ok: #5cbf7a; --alerte: #f2766b; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #171614; --carte: #22201d; --texte: #ece8e0; --doux: #a39d92; --bord: #3a3732;
  --accent: #d9774f; --ok: #5cbf7a; --alerte: #f2766b; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

/* ---- connexion et accueil ---- */
.page { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.entete { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.entete h1 { font-size: 1.35rem; margin: 0; }
.entete a { color: var(--doux); font-size: .9rem; text-decoration: none; }
.sous { color: var(--doux); font-size: .92rem; margin: 4px 0 0; }
.grille { display: grid; gap: 12px; }
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; padding: 14px 16px; }
.carte h2 { font-size: 1.05rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.meta { color: var(--doux); font-size: .85rem; margin: 6px 0 12px; overflow-wrap: anywhere; }
.pastille { width: 9px; height: 9px; border-radius: 50%; background: var(--bord); flex: none; }
.pastille.on { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn { border: 1px solid var(--bord); background: transparent; border-radius: 10px; padding: 8px 14px;
  cursor: pointer; text-decoration: none; color: var(--texte); font-size: .95rem; }
.btn:hover { border-color: var(--doux); }
.btn.principal { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.btn.discret { color: var(--doux); }
.secondaires { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.ajout { display: flex; gap: 8px; margin-top: 10px; }
.ajout input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--bord); background: var(--fond); }
.message { font-size: .9rem; margin-top: 8px; white-space: pre-wrap; }
.message.erreur { color: var(--alerte); }
.vide { color: var(--doux); }
.connexion { max-width: 360px; margin: 18vh auto 0; padding: 0 16px; }
.connexion input { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--bord); background: var(--carte); margin: 12px 0; }
.connexion .btn { width: 100%; }
@media (max-width: 520px) { .secondaires { grid-template-columns: 1fr; } }

/* ---- terminal ---- */
body.terminal { background: var(--term); overflow: hidden; position: fixed; inset: 0; }
.cadre { display: flex; flex-direction: column; height: 100dvh; }
.barre { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--barre);
  color: var(--barre-texte); flex: none; min-height: 44px; }
.barre .titre { flex: 1; min-width: 0; font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.barre button, .barre a { background: transparent; border: 0; color: var(--barre-texte); padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: .9rem; text-decoration: none; }
.barre button:hover, .barre a:hover { background: var(--touche); }
.barre button.actif { background: var(--touche); }
#etat { width: 9px; height: 9px; border-radius: 50%; background: #888; flex: none; }
#etat.on { background: #5cbf7a; } #etat.off { background: #f2766b; }
#term { flex: 1; min-height: 0; padding: 4px 0 0 6px; position: relative; }
#bandeau { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: #3b2a24; color: #f6d9cc;
  padding: 6px 12px; border-radius: 8px; font-size: .85rem; z-index: 5; display: none; }
.touches { display: none; gap: 6px; padding: 6px 8px; background: var(--barre); overflow-x: auto; flex: none; scrollbar-width: none; }
.touches button { flex: none; background: var(--touche); color: var(--barre-texte); border: 0; border-radius: 8px; padding: 8px 12px; font-size: .9rem; }
.saisie { display: none; gap: 8px; padding: 8px; background: var(--barre); flex: none; align-items: flex-end; }
.saisie textarea { flex: 1; min-width: 0; resize: none; max-height: 40vh; min-height: 42px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid #45413b; background: #1c1b19; color: #ece8e0; font-size: 16px; line-height: 1.35; }
.saisie button { background: #d9774f; color: #fff; border: 0; border-radius: 12px; padding: 0 16px; height: 42px; font-weight: 600; }
.cadre.avec-saisie .saisie, .cadre.avec-saisie .touches { display: flex; }
.menu { position: absolute; right: 8px; top: 48px; background: var(--barre); border: 1px solid #45413b; border-radius: 12px;
  padding: 6px; z-index: 10; display: none; min-width: 230px; box-shadow: 0 8px 24px rgba(0,0,0,.35); }
.menu.ouvert { display: block; }
.menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; }
.depot { position: absolute; inset: 0; border: 3px dashed #d9774f; background: rgba(217,119,79,.12); z-index: 8; display: none;
  align-items: center; justify-content: center; color: #f6d9cc; font-size: 1.1rem; pointer-events: none; }
.depot.visible { display: flex; }

/* ---- navigateur du VPS ---- */
.ecran { flex: 1; min-height: 0; width: 100%; border: 0; background: #000; display: block; }
.statut { color: var(--barre-texte); opacity: .75; font-size: .85rem; white-space: nowrap; }
.bandeau-ok { background: #1f3b28; color: #cdeed6; padding: 8px 12px; font-size: .95rem; flex: none; }
.bandeau-ok a { color: #fff; }
@media (max-width: 520px) { .statut { display: none; } }
