/* styles.css — Charte UMGP, app mobile-first (colonne façon écran de téléphone). */

:root {
  --navy: #2e3a8f; --navy-600: #2b357e; --blue: #2e5bdb; --blue-link: #2f6bff;
  --card: #eaf0fd; --card-border: #d6e0fb; --field: #eef3fd; --page: #e6eef0;
  --ink: #1a1f36; --muted: #6b7280; --ok: #1e9e6a; --err: #d64550; --warn: #c9761a;
  --line: #e6eaf2; --radius: 18px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
/* IMPORTANT : l'attribut [hidden] doit TOUJOURS l'emporter, même sur les éléments
   qui déclarent display:flex (overlay de verrouillage, bannière d'installation…). */
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); line-height: 1.5; }
svg[viewBox] { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.frame { max-width: 460px; margin: 0 auto; min-height: 100vh; background: #fff; position: relative; box-shadow: 0 0 40px rgba(46,58,143,.1); overflow: hidden; }
.screen { padding: 22px 20px 40px; }

/* ============================ LOGIN ============================ */
.login { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 48px; }
.brand-center { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.logo-lg { width: 58px; height: 58px; }
.brand-name { display: flex; flex-direction: column; text-align: left; line-height: 1.1; }
.brand-name strong { color: var(--navy); font-size: 30px; letter-spacing: 1px; }
.brand-name span { color: var(--navy); font-size: 11px; font-weight: 600; opacity: .8; }
.login h1 { color: var(--navy); font-size: 26px; margin: 0 0 6px; }
.welcome { color: var(--muted); margin: 0 0 26px; }
#login-form { width: 100%; text-align: left; }
.field { display: block; margin-bottom: 18px; }
.field > span { display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.field input { width: 100%; border: none; background: var(--field); border-radius: 12px; padding: 15px 16px; font-size: 16px; outline: none; }
.field input:focus { box-shadow: 0 0 0 2px var(--blue) inset; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 18px; cursor: pointer; opacity: .6; }
.link { display: inline-block; color: var(--blue-link); font-weight: 700; font-size: 14px; text-decoration: none; margin: 2px 0 20px; background: none; border: none; cursor: pointer; }
.link.center { display: block; text-align: center; margin: 14px auto 0; }
.login-error { background: #fdecee; color: var(--err); border: 1px solid #f6cfd4; border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600; margin: 0 0 16px; }
.demo-hint { text-align: center; color: var(--muted); font-size: 13px; margin-top: 16px; }
.partners { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 34px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); padding-top: 22px; width: 100%; }

/* ============================ Boutons ============================ */
.btn { border: none; border-radius: 999px; padding: 15px 20px; font-size: 15px; font-weight: 700; cursor: pointer; transition: background .15s, opacity .15s, transform .05s; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { display: block; width: 100%; }
.btn.big { margin-top: 4px; }
.btn.tiny { padding: 8px 14px; font-size: 13px; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--navy-600); }
.btn.dark { background: #1a1f36; color: #fff; }
.btn.ghost { background: var(--card); color: var(--navy); }
.btn.light { background: #fff; color: var(--navy); }
.btn.danger { background: #fdecee; color: var(--err); }
.icon-btn { background: #f2f5fa; border: none; border-radius: 12px; width: 44px; height: 44px; display: grid; place-items: center; color: var(--ink); cursor: pointer; position: relative; }
.icon-btn.tiny { width: 32px; height: 32px; }
.icon-btn:hover { background: #e9eef6; }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 7px; height: 7px; background: var(--err); border-radius: 50%; }

/* ============================ Bannière install ============================ */
.install-banner { display: flex; align-items: center; gap: 10px; background: linear-gradient(135deg, #2e3a8f, #2e5bdb); color: #fff; padding: 10px 14px; font-size: 13px; font-weight: 600; }
.install-banner span { flex: 1; }
.install-actions { display: flex; align-items: center; gap: 6px; }
.install-banner .icon-btn { background: rgba(255,255,255,.2); color: #fff; }

/* ============================ App bar / drawer ============================ */
.appbar { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 5; }
.spacer { flex: 1; }
.net-badge { font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; }
.net-badge.on { background: #e6f6ee; color: var(--ok); }
.net-badge.off { background: #fdecee; color: var(--err); }
.scrim { position: fixed; inset: 0; background: rgba(20,25,50,.45); z-index: 20; }
.drawer { position: fixed; top: 0; left: 0; bottom: 0; width: 300px; max-width: 84vw; background: #fff; z-index: 21; padding: 18px; overflow-y: auto; box-shadow: 4px 0 30px rgba(0,0,0,.15); }
@media (min-width: 520px) { .drawer { left: max(0px, calc(50vw - 230px)); } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.logo-sm { width: 40px; height: 40px; }
.drawer-label { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 1px; margin: 18px 0 8px; }
.drawer-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { text-align: left; background: none; border: none; padding: 13px 14px; border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--ink); cursor: pointer; }
.nav-item:hover:not(:disabled) { background: #f2f5fa; }
.nav-item.active { background: var(--field); color: var(--navy); }
.nav-item:disabled { color: #b6bcca; cursor: not-allowed; }
.drawer-demo { display: flex; flex-direction: column; gap: 10px; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; background: #fdf1e3; color: var(--warn); padding: 12px 14px; border-radius: 12px; }
.switch input { width: 18px; height: 18px; }

/* ============================ Accueil ============================ */
.greet { font-size: 26px; margin: 6px 0 4px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.hero { background: linear-gradient(135deg, #2e3a8f, #2e5bdb); color: #fff; border-radius: var(--radius); padding: 34px 22px; font-weight: 700; font-size: 18px; margin-bottom: 18px; }
.pin-setup { background: var(--field); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px; margin-bottom: 18px; }
.pin-setup b { color: var(--navy); }
.pin-setup p { margin: 6px 0 12px; color: var(--muted); font-size: 14px; }
.pin-setup .row { display: flex; gap: 8px; }
.pin-setup input { flex: 1; border: none; background: #fff; border-radius: 12px; padding: 13px 14px; font-size: 16px; outline: none; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.card { text-align: left; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 18px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.card:disabled { opacity: .6; cursor: not-allowed; }
.card-ic { width: 44px; height: 44px; background: #fff; border-radius: 12px; display: grid; place-items: center; font-size: 20px; color: var(--blue); }
.card b { color: var(--navy); font-size: 16px; }
.card small { color: var(--muted); }
.section-title { font-size: 18px; margin: 26px 0 6px; }
.empty { color: var(--muted); }

/* ============================ Carte TP ============================ */
.view-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.view-head h1 { font-size: 20px; margin: 0; }
.pdf-actions { display: flex; gap: 10px; margin-bottom: 8px; }
.pdf-actions .btn { flex: 1; text-align: center; text-decoration: none; }
.card-version { color: var(--muted); font-size: 12px; margin: 0 0 10px; }
#pdf-frame { width: 100%; height: 60vh; min-height: 360px; border: 1px solid var(--card-border); border-radius: 12px; background: #fff; }

/* ============================ Overlay verrouillage ============================ */
.lock-overlay { position: absolute; inset: 0; z-index: 40; background: rgba(20,25,50,.55); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 22px; }
.lock-card { background: #fff; border-radius: 22px; padding: 26px 22px; width: 100%; max-width: 380px; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.lock-ic { font-size: 34px; }
.lock-card h2 { margin: 8px 0 4px; color: var(--navy); font-size: 20px; }
.lock-sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.lock-card input { width: 100%; border: none; background: var(--field); border-radius: 12px; padding: 14px 16px; font-size: 16px; outline: none; margin-bottom: 10px; text-align: center; }
.lock-card input:focus { box-shadow: 0 0 0 2px var(--blue) inset; }
.lock-card .btn { margin-bottom: 8px; }
.lock-net { font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* ============================ Journal + avertissement ============================ */
.secure-warning { background: #fdecee; color: #8a2530; border-bottom: 2px solid #d64550; padding: 12px 18px; font-size: 13px; }
.secure-warning p { margin: 4px 0 0; }
.logsheet { position: fixed; left: 0; right: 0; bottom: 0; max-width: 460px; margin: 0 auto; background: #0e1330; z-index: 50; border-radius: 18px 18px 0 0; padding: 14px 16px 20px; box-shadow: 0 -10px 40px rgba(0,0,0,.4); }
.log-head { display: flex; align-items: center; justify-content: space-between; }
.log-head h3 { color: #fff; font-size: 15px; margin: 0 0 8px; }
.log-head .icon-btn { background: #1c244f; color: #fff; }
.log { color: #d7deff; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; line-height: 1.7; height: 40vh; overflow-y: auto; }
.log .line { white-space: pre-wrap; word-break: break-word; }
.log .t { color: #6b78b8; }
.log .info { color: #aab6ef; } .log .net { color: #7fd1ff; } .log .crypto { color: #ffd479; }
.log .success { color: #6ee7a8; } .log .error { color: #ff8b96; }
