/* ==========================================================================
   Quali — feuille de style unique (site public, espace client, administration)
   Approche mobile-first : la valeur par défaut est une colonne, le
   multi-colonnes vit dans des media queries min-width.
   ========================================================================== */

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eff3f9;
  --ink: #0f1c33;
  --ink-2: #3f4d66;
  --muted: #7b879c;
  --line: #e2e8f2;
  --primary: #1f6feb;
  --primary-dark: #14539c;
  --primary-soft: #e8f0fe;
  --accent: #00a99d;
  --accent-soft: #e1f5f3;
  --success: #17845a;
  --success-soft: #e5f5ee;
  --warning: #b4780d;
  --warning-soft: #fdf3e0;
  --danger: #bb2635;
  --danger-soft: #fdecee;
  --navy: #0b1b33;
  --navy-2: #142a4a;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 28, 51, .05), 0 1px 3px rgba(15, 28, 51, .05);
  --shadow: 0 8px 24px -12px rgba(15, 28, 51, .22);
  --shadow-lg: 0 30px 70px -30px rgba(15, 28, 51, .38);
  --maxw: 1180px;
  --tabbar-h: 60px;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.22; letter-spacing: -.018em; font-weight: 700; }
h1 { font-size: 1.85rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.12rem; }
h4 { font-size: .98rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul, ol { margin: 0 0 1em; padding-left: 1.15em; }
small { font-size: .83rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 18px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.w-100 { width: 100%; }
.hidden { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------- Boutons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: .93rem; line-height: 1.1;
  cursor: pointer; text-decoration: none; transition: .18s ease;
  background: var(--surface-2); color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn svg { flex: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 22px -12px rgba(31, 111, 235, .85); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-dark { background: var(--navy); color: #fff; }
.btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 8px 13px; font-size: .84rem; }
.btn-lg { padding: 14px 26px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; border-radius: 12px; }
.btn-icon svg { display: block; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* --------------------------------------------------------------- Cartes */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.card-title { font-weight: 700; font-size: 1rem; }
.card-sub { color: var(--muted); font-size: .85rem; }

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1.02rem; }
.panel-body { padding: 20px; }
.panel-body.tight { padding: 8px 20px 20px; }
.panel-foot { padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }

.grid { display: grid; gap: 16px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: 16px; grid-template-columns: 1fr; }

/* --------------------------------------------------------------- Badges */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: .76rem; font-weight: 600; letter-spacing: .01em;
  background: var(--surface-2); color: var(--ink-2); white-space: nowrap;
}
.badge-primary { background: var(--primary-soft); color: var(--primary-dark); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-accent { background: var(--accent-soft); color: #07786f; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------- Progression */

.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress-sm { height: 5px; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 999px; transition: width .5s ease; }
.progress-bar.is-success { background: var(--success); }
.progress-bar.is-warning { background: #e0a02a; }
.progress-bar.is-danger { background: var(--danger); }

.gauge { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.gauge-ring {
  --pct: 0; --ring: var(--primary);
  width: 116px; height: 116px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--ring) calc(var(--pct) * 1%), var(--surface-2) 0);
  display: grid; place-items: center; position: relative;
}
.gauge-ring::after {
  content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--surface);
}
.gauge-value { position: relative; font-weight: 800; font-size: 1.6rem; letter-spacing: -.03em; }

/* --------------------------------------------------------------- Chiffres */

.kpi-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow-sm);
}
.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.6rem; font-weight: 800; letter-spacing: -.03em; margin-top: 4px; }
.kpi-note { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.kpi-icon {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary-dark);
}
.kpi-icon.is-success { background: var(--success-soft); color: var(--success); }
.kpi-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.kpi-icon.is-accent { background: var(--accent-soft); color: #07786f; }

/* ---------------------------------------------------------------- Formulaires */

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; font-size: .87rem; margin-bottom: 6px; }
.form-row .hint { color: var(--muted); font-size: .8rem; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font: inherit; font-size: .95rem; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, .13);
}
select { appearance: none; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b879c' stroke-width='2' stroke-linecap='round'><path d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }
.form-grid { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 6px; }
.checkbox-line { display: flex; align-items: flex-start; gap: 10px; font-size: .9rem; }
.checkbox-line input { width: auto; margin-top: 3px; }

.alert {
  border-radius: var(--radius-sm); padding: 13px 15px; font-size: .9rem;
  display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert svg { flex: none; margin-top: 2px; }
.alert-info { background: var(--primary-soft); color: var(--primary-dark); border-color: #cfe0fc; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: #c6e9d8; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #f3e0b6; }
.alert-danger { background: var(--danger-soft); color: var(--danger); border-color: #f6ccd1; }

/* ---------------------------------------------------------------- Tableaux */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 560px; }
table.table th {
  text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap;
}
table.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.table tr:last-child td { border-bottom: 0; }
table.table tr:hover td { background: #fafbfe; }
table.table td.right, table.table th.right { text-align: right; }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: .81rem; }

/* -------------------------------------------------------------- Site public */

.site-header {
  position: sticky; top: 0; z-index: 40;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(140deg, var(--primary), #4c8ff5); color: #fff; flex: none;
  box-shadow: 0 10px 22px -14px rgba(31, 111, 235, .9);
}
.brand-mark.admin-mark { background: linear-gradient(140deg, var(--navy), #2b4a7d); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.05rem; letter-spacing: -.02em; }
.brand-text small { color: var(--muted); font-size: .74rem; }
.brand-light .brand-text strong { color: #fff; }
.brand-light .brand-text small { color: rgba(255, 255, 255, .6); }

.site-nav { display: none; gap: 4px; }
.site-nav a {
  padding: 9px 14px; border-radius: 999px; color: var(--ink-2);
  font-weight: 500; font-size: .92rem;
}
.site-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.site-nav a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.only-mobile { display: inline-flex; }

.mobile-drawer {
  border-top: 1px solid var(--line); background: var(--surface);
  padding: 10px 18px 18px; display: flex; flex-direction: column;
}
.mobile-drawer a { display: flex; align-items: center; gap: 10px; padding: 12px 4px; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.mobile-drawer a:last-child { border-bottom: 0; }
.mobile-drawer a:hover { text-decoration: none; color: var(--primary); }

.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 460px at 12% -10%, rgba(31, 111, 235, .16), transparent 60%),
    radial-gradient(760px 420px at 96% 6%, rgba(0, 169, 157, .14), transparent 62%),
    linear-gradient(180deg, #ffffff 0%, #f4f6fb 100%);
  padding: 52px 0 44px;
  border-bottom: 1px solid var(--line);
}
.hero-grid { display: grid; gap: 34px; grid-template-columns: 1fr; align-items: center; }
.hero h1 { font-size: 2.05rem; letter-spacing: -.03em; }
.hero .lead { font-size: 1.03rem; color: var(--ink-2); max-width: 42em; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--primary-dark);
  font-size: .8rem; font-weight: 600; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.hero-trust { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 22px; color: var(--muted); font-size: .84rem; }
.hero-trust span { display: inline-flex; align-items: center; gap: 7px; }

.mock {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 18px;
}
.mock-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.mock-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .87rem; }
.mock-row:last-child { border-bottom: 0; }
.mock-row .muted { font-size: .8rem; }

.section { padding: 54px 0; }
.section.tint { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-dark { background: var(--navy); color: #fff; }
.section-dark .muted, .section-dark .section-lead { color: rgba(255, 255, 255, .72); }
.section-head { max-width: 44em; margin: 0 auto 34px; text-align: center; }
.section-lead { color: var(--ink-2); font-size: 1rem; }

.feature {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.feature-icon {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  background: var(--primary-soft); color: var(--primary-dark); margin-bottom: 14px;
}
.feature h3 { font-size: 1.03rem; }
.feature p { color: var(--ink-2); font-size: .92rem; margin-bottom: 0; }

.steps { display: grid; gap: 16px; grid-template-columns: 1fr; counter-reset: step; }
.step { position: relative; padding-left: 54px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 700;
  background: var(--navy); color: #fff;
}
.step h3 { font-size: 1rem; margin-bottom: 4px; }
.step p { color: var(--ink-2); font-size: .91rem; margin: 0; }

.referential-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px;
}
.referential-top { display: flex; align-items: center; gap: 12px; }
.referential-logo {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  color: #fff; flex: none;
}
.referential-card h3 { font-size: 1rem; margin: 0; }
.referential-card p { font-size: .88rem; color: var(--ink-2); margin: 0; }
.referential-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }

.testimonial {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.testimonial quote { display: block; font-size: .95rem; color: var(--ink-2); }
.testimonial .author { display: flex; align-items: center; gap: 11px; margin-top: 16px; }
.author-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover;
  background: var(--surface-2);
}

.pricing-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
.price-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 24px; display: flex; flex-direction: column; box-shadow: var(--shadow-sm);
}
.price-card.featured { border-color: var(--primary); box-shadow: 0 24px 60px -34px rgba(31, 111, 235, .7); }
.price-tag { font-size: 2rem; font-weight: 800; letter-spacing: -.035em; }
.price-tag small { font-size: .85rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.price-list { list-style: none; padding: 0; margin: 16px 0 22px; display: grid; gap: 9px; }
.price-list li { display: flex; gap: 9px; align-items: flex-start; font-size: .9rem; color: var(--ink-2); }
.price-list li svg { flex: none; margin-top: 3px; color: var(--success); }
.price-list li.off { color: var(--muted); }
.price-list li.off svg { color: var(--muted); }
.price-card .btn { margin-top: auto; }

.cta-band {
  background: linear-gradient(135deg, var(--navy) 0%, #1c3a68 100%);
  color: #fff; border-radius: var(--radius-lg); padding: 34px 24px; text-align: center;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .76); }
.cta-band .btn-row { justify-content: center; }

.faq details {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  padding: 14px 16px; margin-bottom: 10px;
}
.faq summary { cursor: pointer; font-weight: 600; font-size: .95rem; }
.faq summary::marker { color: var(--primary); }
.faq details[open] summary { margin-bottom: 8px; }
.faq p { margin: 0; color: var(--ink-2); font-size: .91rem; }

.contact-grid { display: grid; gap: 20px; grid-template-columns: 1fr; }

.site-footer {
  background: var(--navy); color: rgba(255, 255, 255, .78);
  padding: 44px 0 calc(24px + var(--tabbar-h));
}
.footer-grid { display: grid; gap: 26px; grid-template-columns: 1fr; }
.footer-grid h4 { color: #fff; font-size: .84rem; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 12px; }
.footer-grid a { display: block; color: rgba(255, 255, 255, .72); padding: 4px 0; font-size: .9rem; }
.footer-grid a:hover { color: #fff; text-decoration: none; }
.footer-about { font-size: .88rem; margin-top: 14px; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .12); margin-top: 30px; padding-top: 18px;
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; font-size: .82rem;
}
.footer-legal a { display: inline; color: rgba(255, 255, 255, .72); }

/* ------------------------------------------------------ Barre d'onglets */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: stretch;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar .tab {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 8px 2px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: .68rem; font-weight: 600;
  font-family: inherit; text-decoration: none;
}
.tabbar .tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tabbar .tab.active { color: var(--primary); }
.tabbar .tab:hover { text-decoration: none; color: var(--primary); }
body.mode-public { padding-bottom: 0; }
body.mode-public .section:last-of-type { padding-bottom: 30px; }

/* ----------------------------------------------------------- Espace client */

.app-shell { min-height: 100vh; display: flex; }
.sidebar {
  position: fixed; z-index: 60; inset: 0 auto 0 0; width: 268px;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 14px;
  transform: translateX(-100%); transition: transform .22s ease;
  padding-top: calc(18px + env(safe-area-inset-top, 0px));
}
body.sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
.sidebar .brand { padding: 4px 6px 18px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 11px; padding: 11px 12px;
  border-radius: var(--radius-sm); color: var(--ink-2); font-weight: 500; font-size: .92rem;
}
.sidebar-nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.sidebar-nav a.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--navy); color: #fff; font-weight: 700; font-size: .82rem;
}
.user-chip-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-chip-text strong { font-size: .9rem; }
.user-chip-text small { color: var(--muted); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 1.08rem; margin: 0; }
.topbar-title p { margin: 0; color: var(--muted); font-size: .8rem; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.projet-switch select { max-width: 210px; padding: 8px 34px 8px 12px; font-size: .85rem; }

.page { padding: 20px 16px calc(96px + env(safe-area-inset-bottom, 0px)); flex: 1; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.page-head h2 { margin: 0; font-size: 1.25rem; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: .88rem; }

.sheet {
  position: fixed; inset: 0; z-index: 70; background: rgba(11, 27, 51, .45);
  display: flex; align-items: flex-end;
}
.sheet-panel {
  width: 100%; background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(18px + env(safe-area-inset-bottom, 0px));
  max-height: 76vh; overflow-y: auto;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 4px 12px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.sheet-panel a { display: flex; align-items: center; gap: 12px; padding: 13px 6px; color: var(--ink-2); border-bottom: 1px solid var(--line); font-size: .94rem; }
.sheet-panel a:last-child { border-bottom: 0; }
.sheet-panel a:hover { text-decoration: none; color: var(--primary); }

/* --------------------------------------------------------------- Exigences */

.chapter { margin-bottom: 18px; }
.chapter-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; font-size: .93rem;
  flex-wrap: wrap;
}
.chapter-head .chapter-meta { display: flex; align-items: center; gap: 10px; }
.chapter-body { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.exigence { padding: 15px 16px; border-bottom: 1px solid var(--line); }
.exigence:last-child { border-bottom: 0; }
.exigence-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.exigence-code { font-weight: 700; font-size: .8rem; color: var(--primary-dark); background: var(--primary-soft); padding: 2px 8px; border-radius: 6px; }
.exigence-title { font-weight: 600; font-size: .94rem; margin: 8px 0 4px; }
.exigence-desc { color: var(--ink-2); font-size: .88rem; margin: 0 0 8px; }
.exigence-proof { font-size: .84rem; color: var(--muted); }
.exigence-proof strong { color: var(--ink-2); }
.exigence-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.status-select { max-width: 190px; padding: 7px 32px 7px 10px; font-size: .84rem; }

.timeline { display: grid; gap: 0; }
.timeline-item { display: flex; gap: 14px; padding-bottom: 20px; position: relative; }
.timeline-item:not(:last-child)::before {
  content: ""; position: absolute; left: 15px; top: 34px; bottom: 0; width: 2px; background: var(--line);
}
.timeline-dot {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2); z-index: 1;
}
.timeline-dot.done { background: var(--success-soft); color: var(--success); }
.timeline-dot.current { background: var(--primary); color: #fff; }
.timeline-body { min-width: 0; }
.timeline-body strong { display: block; font-size: .93rem; }
.timeline-body p { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }

.list-row {
  display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-row-main { min-width: 0; flex: 1; }
.list-row-main strong { display: block; font-size: .92rem; }
.list-row-main small { color: var(--muted); }
.list-icon {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink-2);
}
.list-icon.is-success { background: var(--success-soft); color: var(--success); }
.list-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.list-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.list-icon.is-primary { background: var(--primary-soft); color: var(--primary-dark); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty svg { color: var(--line); margin-bottom: 10px; }
.empty h3 { color: var(--ink-2); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 170px; }
.search-input { position: relative; }
.search-input svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input input { padding-left: 38px; }

.segmented { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: none; font: inherit; font-size: .84rem; font-weight: 600;
  padding: 7px 14px; border-radius: 999px; cursor: pointer; color: var(--ink-2);
}
.segmented button.active { background: var(--surface); color: var(--primary-dark); box-shadow: var(--shadow-sm); }

.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }

/* ---------------------------------------------------------------- Modales */

.modal {
  position: fixed; inset: 0; z-index: 90; background: rgba(11, 27, 51, .5);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
  overflow-y: auto;
}
.modal-card {
  background: var(--surface); width: 100%; max-width: 560px;
  border-radius: 20px 20px 0 0; padding: 24px 20px calc(24px + env(safe-area-inset-bottom, 0px));
  position: relative; margin-top: auto;
}
.modal-close { position: absolute; top: 12px; right: 12px; }
.install-platforms { display: grid; gap: 14px; margin: 18px 0; }
.install-platform { display: flex; gap: 12px; align-items: flex-start; }
.platform-icon {
  width: 44px; height: 44px; border-radius: 13px; flex: none; display: grid; place-items: center;
  background: var(--surface-2); color: var(--ink);
}
.install-platform ol { margin: 6px 0 0; padding-left: 18px; font-size: .87rem; color: var(--ink-2); }

.toast-stack {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px);
  z-index: 120; display: flex; flex-direction: column; gap: 8px; width: min(94vw, 460px);
}
.toast {
  background: var(--navy); color: #fff; border-radius: 12px; padding: 12px 16px;
  font-size: .89rem; box-shadow: var(--shadow-lg); display: flex; gap: 10px; align-items: flex-start;
}
.toast.is-success { background: #10694a; }
.toast.is-error { background: #8f1d2a; }
.toast button { background: none; border: 0; color: rgba(255, 255, 255, .7); cursor: pointer; padding: 0 2px; font: inherit; }

/* ------------------------------------------------------------ Admin */

.admin-shell .sidebar { background: var(--navy); border-right-color: rgba(255, 255, 255, .08); }
.admin-shell .sidebar .brand-text strong { color: #fff; }
.admin-shell .sidebar .brand-text small { color: rgba(255, 255, 255, .55); }
.admin-shell .sidebar-nav a { color: rgba(255, 255, 255, .74); }
.admin-shell .sidebar-nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.admin-shell .sidebar-nav a.active { background: rgba(255, 255, 255, .14); color: #fff; }
.admin-shell .sidebar-foot { border-top-color: rgba(255, 255, 255, .1); }
.admin-shell .btn-ghost { color: rgba(255, 255, 255, .8); }
.admin-shell .btn-ghost:hover { background: rgba(255, 255, 255, .1); }
.admin-shell .btn-outline { border-color: rgba(255, 255, 255, .22); color: #fff; }
.admin-shell .btn-outline:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.admin-shell .topbar { background: var(--navy); border-bottom-color: rgba(255, 255, 255, .1); }
.admin-shell .topbar-title h1 { color: #fff; }
.admin-shell .topbar-title p { color: rgba(255, 255, 255, .6); }
.admin-shell .page { background: var(--bg); }
.admin-shell .tabbar { background: rgba(11, 27, 51, .96); border-top-color: rgba(255, 255, 255, .1); }
.admin-shell .tabbar .tab { color: rgba(255, 255, 255, .6); }
.admin-shell .tabbar .tab.active { color: #7db0ff; }

.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px 18px calc(28px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(700px 380px at 20% 0%, rgba(31, 111, 235, .14), transparent 60%),
    radial-gradient(700px 380px at 90% 100%, rgba(0, 169, 157, .12), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 28px 22px; box-shadow: var(--shadow-lg);
}
.auth-card .brand { justify-content: center; margin-bottom: 18px; }
.auth-card h1 { font-size: 1.4rem; text-align: center; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: .9rem; margin-bottom: 22px; }
.auth-foot { text-align: center; font-size: .88rem; color: var(--muted); margin-top: 18px; }

/* ------------------------------------------------------- Responsive ≥ 480 */

@media (min-width: 480px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .modal { align-items: center; padding: 20px; }
  .modal-card { border-radius: var(--radius-lg); margin: auto; }
}

/* ------------------------------------------------------- Responsive ≥ 700 */

@media (min-width: 700px) {
  h1 { font-size: 2.1rem; }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid .span-2 { grid-column: 1 / -1; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
  .referential-grid { grid-template-columns: repeat(2, 1fr); }
  .site-nav { display: flex; }
  .only-mobile { display: none; }
}

/* ------------------------------------------------------ Responsive ≥ 1024 */

@media (min-width: 1024px) {
  body.mode-app, body.mode-admin { background: var(--bg); }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .hero { padding: 76px 0 68px; }
  .hero h1 { font-size: 2.9rem; }
  .hero-grid { grid-template-columns: 1.05fr .95fr; gap: 48px; }
  .section { padding: 76px 0; }
  .steps { grid-template-columns: repeat(4, 1fr); }
  .step { padding-left: 0; padding-top: 54px; }
  .step::before { top: 0; }
  .pricing-grid { grid-template-columns: repeat(3, 1fr); }
  .referential-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1fr; }
  .contact-grid { grid-template-columns: 1.15fr .85fr; }

  .sidebar { transform: translateX(0); position: sticky; top: 0; height: 100vh; }
  .app-main { min-height: 100vh; }
  .tabbar.app-tabbar { display: none; }
  .page { padding: 26px 28px 40px; }
  .topbar { padding: 14px 28px; }
  .site-footer { padding-bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
