:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --error: #dc2626;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }

/* --- Connexion --- */
.login-screen { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #2563eb, #1e40af); }
.login-box { background: var(--card); padding: 2.5rem; border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.2); width: 340px; text-align: center; }
.login-box h1 { font-size: 1.5rem; margin-bottom: .5rem; }
.login-box p { color: var(--muted); margin-bottom: 1.5rem; }
.login-box input { width: 100%; padding: .8rem; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 1rem; font-size: 1rem; }
.login-box button { width: 100%; padding: .8rem; background: var(--primary); color: #fff; border: none; border-radius: 8px; font-size: 1rem; cursor: pointer; }
.login-box button:hover { background: var(--primary-dark); }
.error { color: var(--error); font-size: .9rem; margin-top: .5rem; }

/* --- Layout --- */
header { background: var(--card); padding: 1rem 2rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
header h1 { font-size: 1.25rem; }
.header-info { display: flex; gap: .75rem; align-items: center; }
.badge { background: var(--bg); padding: .35rem .75rem; border-radius: 999px; font-size: .85rem; color: var(--muted); }

.tabs { display: flex; gap: .5rem; padding: 1rem 2rem 0; }
.tab { background: none; border: none; padding: .75rem 1.25rem; font-size: 1rem; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-panel { display: none; padding: 1.5rem 2rem; max-width: 1000px; margin: 0 auto; }
.tab-panel.active { display: block; }

.card { background: var(--card); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.card h2 { font-size: 1.1rem; margin-bottom: 1rem; }

/* --- Recherche --- */
.search-row { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.search-row label { display: flex; flex-direction: column; font-size: .85rem; color: var(--muted); gap: .3rem; }
.search-row input { padding: .6rem; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; }
.status { margin-top: 1rem; color: var(--muted); font-size: .9rem; }
.results-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.table-wrap { overflow-x: auto; max-height: 400px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { position: sticky; top: 0; background: var(--card); color: var(--muted); }

/* --- Boutons --- */
.btn-primary { background: var(--primary); color: #fff; border: none; padding: .7rem 1.3rem; border-radius: 8px; font-size: 1rem; cursor: pointer; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary.big { width: 100%; padding: 1rem; font-size: 1.1rem; margin-top: 1rem; }
.btn-secondary { background: #eef2ff; color: var(--primary); border: 1px solid #c7d2fe; padding: .65rem 1.2rem; border-radius: 8px; cursor: pointer; }
.btn-ghost { background: none; border: 1px solid var(--border); padding: .5rem 1rem; border-radius: 8px; cursor: pointer; color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--bg); }
.btn-ghost:disabled { opacity: .5; cursor: not-allowed; }

/* --- Assistant email --- */
.wizard { display: flex; flex-direction: column; gap: 1.25rem; }
.step { background: var(--card); border-radius: var(--radius); padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.step-header { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.step-num { width: 32px; height: 32px; background: var(--primary); color: #fff; border-radius: 50%; display: grid; place-items: center; font-weight: 700; }
.step-header h2 { font-size: 1.15rem; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.choice { display: flex; gap: .75rem; align-items: center; border: 2px solid var(--border); border-radius: 10px; padding: 1rem; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--primary); background: #eff6ff; }
.choice small { display: block; color: var(--muted); }

.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; font-weight: 600; }
.field input, .field textarea { padding: .75rem; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; font-family: inherit; font-weight: normal; }
.field textarea { resize: vertical; }

.hint-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: .75rem 1rem; }
.hint-box summary { cursor: pointer; font-weight: 600; }
.tags { list-style: none; margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.tags code { background: #fef3c7; padding: .15rem .4rem; border-radius: 4px; }

.test-zone { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 1.25rem; margin-bottom: 1.25rem; }
.test-row { display: flex; gap: .75rem; margin-top: .75rem; }
.test-row input { flex: 1; padding: .7rem; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; }

.preview { margin-top: 1rem; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 1rem; }
.preview-label { font-size: .85rem; color: var(--muted); }
.preview-subject { font-weight: 700; margin: .5rem 0; }
.preview-body { white-space: pre-wrap; font-family: inherit; font-size: .9rem; }

.optin { display: flex; gap: .6rem; align-items: flex-start; background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 1rem; cursor: pointer; }

.progress-zone, #progress-zone { margin-top: 1.5rem; }
.progress-bar { height: 12px; background: var(--border); border-radius: 999px; overflow: hidden; }
#progress-fill { height: 100%; width: 0; background: var(--success); transition: width .3s; }
#progress-text { margin: .75rem 0; font-weight: 600; }
.log-details { margin-top: 1rem; }
.log-details summary { cursor: pointer; color: var(--muted); }
#log-output { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: 8px; font-size: .8rem; max-height: 250px; overflow-y: auto; margin-top: .5rem; white-space: pre-wrap; }
