:root {
  --bg: #071a12; --bg2: #0d2a1d; --bg3: #123825;
  --accent: #22b14c; --accent2: #5fd97a;
  --text: #e8f5ee; --muted: #82a894; --border: #1f4433;
  --danger: #e0616b; --warn: #d9a441;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: radial-gradient(ellipse at top, #0f3d2e 0%, var(--bg) 60%);
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif; min-height: 100vh;
}

.ecg-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  width: 100%; height: 100%;
}
@media (prefers-reduced-motion: reduce) {
  .ecg-dot animateMotion { display: none; }
}
a { color: var(--accent2); text-decoration: none; }

nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 2rem; height: 60px; background: var(--bg2);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100;
}
.nav-logo { font-size: 1.05rem; font-weight: 700; display: flex; align-items: center; gap: 0.4rem; }
.nav-logo span { color: var(--muted); font-weight: 300; }
.nav-links { display: flex; gap: 1rem; align-items: center; font-size: 0.88rem; }
.btn { padding: 0.5rem 1.1rem; border-radius: 6px; font-weight: 600; border: none; cursor: pointer; font-size: 0.88rem; }
.btn-primary { background: var(--accent); color: #06140f; }
.btn-primary:hover { background: var(--accent2); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--accent2); color: #06140f; }
.btn-success:hover { background: var(--accent); }

.page-container { max-width: 980px; margin: 0 auto; padding: 0 2rem; box-sizing: border-box; }

.process-section { margin: 3.5rem auto 1rem; text-align: center; }
.process-section h2 { font-size: 1.5rem; margin-bottom: 0.4rem; }
.process-section .subtitle { color: var(--muted); font-size: 0.92rem; margin-bottom: 2rem; }
.process-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.process-step { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem 1rem; text-align: left; position: relative; }
.process-step .step-num { position: absolute; top: 0.7rem; right: 0.9rem; font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.process-step .step-icon { font-size: 1.6rem; margin-bottom: 0.5rem; }
.process-step h3 { font-size: 0.92rem; margin-bottom: 0.35rem; color: var(--accent2); }
.process-step p { font-size: 0.82rem; color: var(--muted); line-height: 1.4; }
@media (min-width: 900px) {
  .process-steps { grid-template-columns: repeat(5, 1fr); }
}

.security-section { margin: 2.5rem auto 3.5rem; text-align: center; }
.security-section h2 { font-size: 1.3rem; margin-bottom: 0.4rem; }
.security-section .subtitle { color: var(--muted); font-size: 0.88rem; margin-bottom: 1.8rem; }
.security-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.security-item { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 1.1rem 1rem; text-align: left; }
.security-item .sec-icon { font-size: 1.4rem; margin-bottom: 0.4rem; }
.security-item h3 { font-size: 0.88rem; margin-bottom: 0.3rem; color: var(--accent2); display: flex; align-items: center; gap: 0.35rem; }
.security-item h3 .check { color: var(--accent2); font-size: 0.8rem; }
.security-item p { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
@media (min-width: 900px) {
  .security-grid { grid-template-columns: repeat(4, 1fr); }
}

.auth-wrap { margin: 3.5rem auto 2rem; padding: 2rem; background: var(--bg2); border-radius: 12px; border: 1px solid var(--border); display: flex; gap: 2.5rem; align-items: center; }
.auth-visual { flex: 1; display: flex; justify-content: center; align-items: center; }
.auth-visual img { max-width: 100%; width: 260px; border-radius: 16px; }
.auth-form-col { flex: 1; min-width: 280px; max-width: 420px; }
@media (max-width: 780px) {
  .auth-wrap { flex-direction: column; }
  .auth-visual img { width: 200px; }
}
.auth-wrap h1 { font-size: 1.4rem; margin-bottom: 0.3rem; }
.auth-wrap p.subtitle { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.3rem; }
.form-group input { width: 100%; padding: 0.6rem 0.8rem; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 0.92rem; }
.form-group input:focus { outline: none; border-color: var(--accent); }
.auth-switch { text-align: center; margin-top: 1rem; font-size: 0.85rem; color: var(--muted); }
.error-msg { background: rgba(224,97,107,0.12); color: var(--danger); padding: 0.6rem 0.8rem; border-radius: 6px; font-size: 0.85rem; margin-bottom: 1rem; display: none; }

.container { max-width: 1100px; margin: 0 auto; padding: 2rem; }

.upload-zone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 3rem 2rem;
  text-align: center; margin-bottom: 2rem; transition: border-color 0.2s; cursor: pointer;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); }
.upload-zone .icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.upload-zone p { color: var(--muted); font-size: 0.9rem; }
.upload-zone input[type=file] { display: none; }

.quota-bar { font-size: 0.82rem; color: var(--muted); margin-bottom: 1.5rem; display: flex; align-items: center; gap: 0.6rem; }
.quota-bar .badge-plan { padding: 0.15rem 0.6rem; border-radius: 10px; font-size: 0.75rem; font-weight: 700; }
.badge-free { background: rgba(133,147,173,0.15); color: var(--muted); }
.badge-pro { background: rgba(34,177,76,0.18); color: var(--accent2); }

.analyses-list { display: flex; flex-direction: column; gap: 0.75rem; }
.analyse-card {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 1rem 1.2rem; cursor: pointer; transition: border-color 0.15s;
}
.analyse-card:hover { border-color: var(--accent); }
.analyse-header { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
.analyse-nom { font-weight: 600; font-size: 0.95rem; }
.analyse-meta { display: flex; gap: 0.8rem; font-size: 0.8rem; color: var(--muted); margin-top: 0.35rem; }
.score-pill { padding: 0.2rem 0.6rem; border-radius: 8px; font-size: 0.78rem; font-weight: 700; }
.score-haut { background: rgba(34,177,76,0.18); color: var(--accent2); }
.score-moyen { background: rgba(217,164,65,0.18); color: var(--warn); }
.score-bas { background: rgba(224,97,107,0.18); color: var(--danger); }
.statut-badge { font-size: 0.75rem; padding: 0.15rem 0.5rem; border-radius: 8px; }
.statut-en_attente, .statut-analyse_en_cours { background: rgba(217,164,65,0.15); color: var(--warn); }
.statut-terminee { background: rgba(34,177,76,0.15); color: var(--accent2); }
.statut-erreur { background: rgba(224,97,107,0.15); color: var(--danger); }

.empty-state { text-align: center; padding: 3rem; color: var(--muted); }

/* Detail analyse (modal / panel) */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(5,10,20,0.7);
  z-index: 200; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 3vh 1rem;
}
.modal-overlay.open { display: flex; }
.modal { background: var(--bg2); border-radius: 12px; border: 1px solid var(--border); max-width: 780px; width: 100%; padding: 2rem; margin-bottom: 3vh; }
.modal-close { float: right; background: none; border: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; }

.score-global-hero { text-align: center; padding: 1rem 0 1.5rem; }
.score-global-hero .value { font-size: 3rem; font-weight: 800; }
.score-global-hero .label { color: var(--muted); font-size: 0.85rem; }

.section-block { margin-bottom: 1.4rem; }
.section-block h3 { font-size: 0.95rem; margin-bottom: 0.5rem; color: var(--accent2); }
.section-block ul { list-style: none; }
.section-block li { padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.section-block li:last-child { border-bottom: none; }

.chat-box { border-top: 1px solid var(--border); margin-top: 1.5rem; padding-top: 1.2rem; }
.chat-messages { max-height: 260px; overflow-y: auto; margin-bottom: 0.8rem; display: flex; flex-direction: column; gap: 0.6rem; }
.chat-msg { padding: 0.5rem 0.8rem; border-radius: 8px; font-size: 0.85rem; max-width: 85%; }
.chat-msg.user { background: var(--bg3); align-self: flex-end; }
.chat-msg.assistant { background: rgba(34,177,76,0.1); align-self: flex-start; }
.chat-input-row { display: flex; gap: 0.5rem; }
.chat-input-row input { flex: 1; padding: 0.55rem 0.8rem; background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; color: var(--text); }

.loading { text-align: center; padding: 2rem; color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 0.8rem; }
@keyframes spin { to { transform: rotate(360deg); } }

footer { text-align: center; padding: 2rem; color: var(--muted); font-size: 0.8rem; }
