:root {
  --bg: #f7f8fb;
  --card: #fff;
  --text: #172033;
  --muted: #687083;
  --border: #e1e5ee;
  --accent: #0d6efd;
  --warn: #fff8e1;
  --danger: #b42318;
  --ok: #027a48;
  --tap: 44px; /* taille tactile minimum */
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  /* eviter le pull-to-refresh sur mobile dans le dashboard */
  overscroll-behavior-y: contain;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 32px clamp(18px, 5vw, 72px);
  background: var(--hero-bg, #101828);
  color: #fff;
}
.hero h1 { margin: 0; font-size: clamp(24px, 5vw, 48px); line-height: 1.15; }
.hero p { max-width: 760px; color: #d0d5dd; margin: 6px 0 0; font-size: clamp(13px, 2.5vw, 16px); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; color: var(--eyebrow, #7da7ff); font-weight: 700; margin: 0 0 4px; }

.container { width: min(1180px, calc(100% - 24px)); margin: 24px auto 80px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .04);
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 8px; }
.card h3 { margin: 0 0 8px; }

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; margin: 8px 0; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px; /* >= 16px sur iOS pour eviter le zoom auto sur focus */
  color: var(--text);
  background: #fff;
  min-height: var(--tap);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, .15);
}
.checkbox { display: flex; align-items: center; flex-direction: row; gap: 10px; }
.checkbox input { width: 22px; height: 22px; min-height: 0; flex-shrink: 0; }

button, .button {
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  font-size: 15px;
  -webkit-tap-highlight-color: rgba(0,0,0,.05);
  transition: filter .15s, background .15s;
}
button:hover, .button:hover { filter: brightness(.95); }
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
.secondary { background: #edf2ff; color: #1e3a8a; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.status { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.status h2 { font-size: clamp(18px, 4vw, 26px); }

/* Onglets : scroll horizontal smooth + indicateur visible */
.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 16px -12px;
  padding: 4px 12px 12px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tabs::-webkit-scrollbar { height: 6px; }
.tabs::-webkit-scrollbar-thumb { background: #d0d5dd; border-radius: 3px; }
.tabs button {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
  scroll-snap-align: start;
  padding: 10px 16px;
  font-size: 14px;
  min-height: var(--tap);
  flex-shrink: 0;
}
.tabs button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(13, 110, 253, .25);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.warning { background: var(--warn); }
.message { color: var(--muted); margin: 8px 0 0; font-size: 14px; }
.message.ok { color: var(--ok); }
.message.error { color: var(--danger); }

.documents { list-style: none; padding: 0; }
.documents li { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); padding: 12px 0; }
.badge { border-radius: 999px; padding: 4px 10px; background: #eef2ff; color: #1e3a8a; font-size: 12px; font-weight: 600; }
.badge.missing { background: #fef0c7; color: #b54708; }
.badge.pending { background: #eef2ff; color: #1e3a8a; }
.badge.approved { background: #d1fadf; color: #027a48; }
.badge.rejected { background: #fee4e2; color: #b42318; }

.docs-required { list-style: none; padding: 0; margin: 0; }
.doc-row { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; background: #fff; }
.doc-row-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.doc-label { font-weight: 600; }
.doc-files { list-style: none; padding: 0; margin: 10px 0 6px; font-size: 14px; color: var(--muted); }
.doc-files li { padding: 6px 0; word-break: break-all; }
.file-icon { margin-right: 4px; }
.rejection { color: var(--danger); font-style: normal; }
.doc-row-actions { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.doc-row-actions button { padding: 10px 16px; font-size: 14px; }

input[readonly], input:disabled, select:disabled { background: #f3f4f6; color: #4b5563; cursor: not-allowed; }

.frontier-group {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  background: #fafbfd;
  margin: 8px 0;
}
.frontier-group legend { font-weight: 600; padding: 0 8px; color: var(--text); }
.frontier-group label { margin: 6px 0; }
.frontier-group textarea { min-height: 60px; }

.declaration-text {
  background: #f7f8fb;
  border-left: 4px solid var(--accent);
  padding: 14px 18px;
  border-radius: 8px;
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.55;
}
.declaration-text ul { margin: 8px 0 0; padding-left: 20px; }
.declaration-text li { margin-bottom: 6px; }
.danger-zone { border: 1px solid #fecaca; background: #fff5f5; }
.danger-zone h3 { color: var(--danger); }
button.danger { background: var(--danger); color: #fff; }
button.danger:hover { background: #912018; }

.children-control { margin-bottom: 12px; }
.child-block {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 12px;
  background: #fafbfd;
}
.child-block legend { font-weight: 600; padding: 0 8px; color: var(--text); }
#saveChildrenBtn { margin-top: 8px; }

.phone-grid { display: grid; grid-template-columns: 140px 1fr; gap: 8px; align-items: stretch; }
.phone-grid select { width: 100%; }
.phone-grid input { width: 100%; }

.google-btn {
  width: 100%;
  background: #fff;
  color: #1f1f1f;
  border: 1px solid var(--border);
  gap: 10px;
  padding: 14px 18px;
  font-weight: 600;
}
.google-btn:hover { background: #f7f8fb; }
.google-btn svg { flex-shrink: 0; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; color: var(--muted); font-size: 13px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* === MEDIA QUERIES MOBILE === */

@media (max-width: 900px) {
  .hero { padding: 24px clamp(16px, 5vw, 32px); gap: 16px; }
}

@media (max-width: 720px) {
  .hero { flex-direction: column; align-items: flex-start; padding: 20px 18px 22px; gap: 12px; }
  .hero h1 { font-size: clamp(22px, 6vw, 32px); }
  .hero #logoutBtn { width: auto; align-self: flex-end; }
  .status { flex-direction: column; align-items: flex-start; gap: 12px; }
  .status button { width: 100%; }
  .container { width: calc(100% - 20px); margin: 16px auto 100px; }
  .card { padding: 16px; border-radius: 14px; margin-bottom: 14px; }
  .grid { grid-template-columns: 1fr; gap: 10px; }
  label { margin: 6px 0; }
  .declaration-text { padding: 12px 14px; font-size: 13px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 22px; }
  .hero p { display: none; } /* sous-titre pas critique sur tres petit ecran */
  .card { padding: 14px; }
  .doc-row { padding: 12px 14px; }
  .doc-row-actions { flex-direction: column; }
  .doc-row-actions button { width: 100%; }
  .phone-grid { grid-template-columns: 110px 1fr; }
  .actions button { flex: 1 1 calc(50% - 4px); }
  .tabs { margin: 12px -10px; padding: 4px 10px 12px; }
  .tabs button { padding: 9px 12px; font-size: 13px; }
}

/* iOS safe-area pour eviter le notch */
@supports (padding: max(0px)) {
  .hero { padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); }
  .container { padding-left: max(0px, env(safe-area-inset-left)); padding-right: max(0px, env(safe-area-inset-right)); }
}
