/* Identité PPT Control : bleu nuit pour la structure, turquoise pour l'action. */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --navy: #142238;
  --navy-2: #1e3049;
  --teal: #19b7a5;
  --teal-hover: #15a091;
  --teal-ink: #0b7a6e;
  --teal-soft: #e6f7f5;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #142238;
  --muted: #5b6b82;
  --line: #e3e8f0;
  --field: #ffffff;
  --danger: #c0303a;
  --danger-soft: #fdecee;
  --focus: #0b7a6e;
  --shadow: 0 1px 2px rgb(20 34 56 / 0.04), 0 8px 24px rgb(20 34 56 / 0.05);
  --radius: 14px;
  --radius-s: 10px;
  --sidebar: 272px;
  --gutter: clamp(16px, 3vw, 36px);
  --notes-size: 20px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0f1b2d;
  --card: #18283f;
  --text: #eef2f7;
  --muted: #a9b6c9;
  --line: #2a3c57;
  --field: #122136;
  --teal-ink: #3fd6c4;
  --teal-soft: #12353b;
  --danger-soft: #41202a;
  --focus: #3fd6c4;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Inter", "Segoe UI", system-ui, sans-serif; font-size: 1rem; line-height: 1.55; font-feature-settings: "cv11", "ss03"; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-weight: 700; line-height: 1.2; margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
p { margin: 0; }
a { color: var(--teal-ink); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 40; padding: 10px 14px; background: var(--teal); color: var(--navy); font-weight: 600; border-radius: var(--radius-s); }
.skip:focus { top: 12px; }
.ico { width: 22px; height: 22px; flex: none; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 10px 20px; border: 1.5px solid transparent; border-radius: var(--radius-s); background: var(--teal); color: var(--navy); font-weight: 600; font-size: 1rem; line-height: 1.2; text-decoration: none; text-align: center; }
.btn:hover { background: var(--teal-hover); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--teal-soft); border-color: var(--teal); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a22630; }
.btn-small { min-height: 40px; padding: 7px 12px; font-size: 0.9375rem; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: var(--radius-s); background: transparent; color: var(--muted); text-decoration: none; }
.icon-btn:hover { background: var(--teal-soft); color: var(--text); }
.icon-btn[aria-pressed="true"] { background: var(--navy); color: #fff; }
.icon-btn:disabled { opacity: 0.4; cursor: not-allowed; background: none; }

/* Formulaires */
.field { display: grid; gap: 6px; }
.field > label, .field-label { font-weight: 600; }
.field input, .field select { width: 100%; min-height: 48px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-s); background: var(--field); color: var(--text); }
.field input[type="range"] { padding: 0; border: 0; background: none; min-height: 44px; accent-color: var(--teal); }
.field-hint { font-size: 0.9rem; color: var(--muted); }
.field-error { font-size: 0.9rem; color: var(--danger); font-weight: 600; }
:root[data-theme="dark"] .field-error { color: #ff9aa2; }
.code-input { font-size: 1.75rem !important; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; }
.check input { width: 22px; height: 22px; accent-color: var(--teal); flex: none; }

/* Cartes */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(16px, 2vw, 22px); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.card-head h2, .card-title { display: flex; align-items: center; gap: 10px; font-size: 1.0625rem; font-weight: 700; }
.card-title .ico { color: var(--teal-ink); }

/* Écrans vides, erreurs, chargement */
.empty { display: grid; justify-items: center; gap: 10px; padding: clamp(24px, 5vw, 48px) 16px; text-align: center; }
.empty .ico { width: 40px; height: 40px; color: var(--teal-ink); }
.empty h2, .empty h3 { font-size: 1.1875rem; }
.empty p { max-width: 34rem; color: var(--muted); }
.empty-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }
.notice { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; border-radius: var(--radius-s); background: var(--teal-soft); border: 1px solid var(--teal); }
.notice-danger { background: var(--danger-soft); border-color: var(--danger); }
.loader { width: 40px; height: 40px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--teal); animation: spin 0.9s linear infinite; }
.skeleton { background: linear-gradient(100deg, var(--line) 30%, var(--bg) 50%, var(--line) 70%); background-size: 300% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--radius-s); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* Gabarit avec menu latéral */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 8px; padding: 26px 16px 18px; background: var(--navy); color: #d7deea; overflow: hidden auto; --focus: #5fe0d0; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.3125rem; letter-spacing: -0.02em; text-decoration: none; }
.logo svg { width: 36px; height: 36px; flex: none; }
.sidebar .logo { padding: 0 10px 22px; }
.side-nav { display: grid; gap: 6px; }
.side-nav a { position: relative; display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 10px 14px; border-radius: var(--radius-s); color: inherit; text-decoration: none; font-weight: 500; }
.side-nav a:hover { background: var(--navy-2); color: #fff; }
.side-nav a[aria-current="page"] { background: var(--navy-2); color: #fff; font-weight: 600; box-shadow: inset 4px 0 0 var(--teal); }
.side-nav a[aria-current="page"] .ico { color: var(--teal); }
.side-nav-secondary { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--navy-2); }
.side-nav-secondary a { min-height: 44px; font-size: 0.9375rem; }
.side-legal { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 12px 14px 0; font-size: 0.8125rem; }
.side-legal a { color: #a9b6c9; }
.workspace { min-width: 0; padding: clamp(18px, 3vw, 34px) var(--gutter) 48px; }
.workspace-inner { max-width: 1240px; margin-inline: auto; }

.topbar { display: none; align-items: center; justify-content: space-between; gap: 10px; min-height: 60px; padding: 8px 16px; background: var(--navy); --focus: #5fe0d0; }
.topbar .logo { font-size: 1.125rem; }
.topbar .logo svg { width: 30px; height: 30px; }
.tabbar { display: none; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: clamp(18px, 2.4vw, 28px); }
.page-head h1 { font-size: clamp(1.625rem, 3.2vw, 2.375rem); }
.page-head p { margin-top: 6px; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.1875rem); max-width: 46rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Rail d'icônes sur tablette */
@media (max-width: 1100px) {
  :root { --sidebar: 76px; }
  .sidebar { padding: 18px 10px; align-items: center; }
  .sidebar .logo { padding: 0 0 14px; }
  .sidebar .logo span, .side-nav a span, .side-legal { display: none; }
  .side-nav a { justify-content: center; width: 52px; padding: 0; gap: 0; }
}

/* Barre d'onglets sur téléphone */
@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { display: none; }
  .topbar { display: flex; }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--navy); padding-bottom: env(safe-area-inset-bottom); --focus: #5fe0d0; }
  .tabbar a { display: grid; justify-items: center; gap: 2px; min-height: 60px; padding: 8px 2px 6px; color: #c7d2e0; font-size: 0.6875rem; font-weight: 500; text-decoration: none; line-height: 1.2; text-align: center; }
  .tabbar a[aria-current="page"] { color: #fff; font-weight: 600; }
  .tabbar a[aria-current="page"] .ico { color: var(--teal); }
  .workspace { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .page-actions, .page-actions .btn { width: 100%; }
}

/* Fenêtres */
.sheet { width: min(30rem, calc(100vw - 24px)); max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--text); box-shadow: 0 24px 60px rgb(20 34 56 / 0.25); }
.sheet::backdrop { background: rgb(20 34 56 / 0.55); }
.sheet-small { width: min(25rem, calc(100vw - 24px)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px 10px 20px; position: sticky; top: 0; z-index: 1; background: var(--card); border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 1.1875rem; }
.sheet-body { display: grid; gap: 14px; padding: 20px; }
.sheet-body > h2 { font-size: 1.25rem; }
.sheet-body > p { color: var(--muted); }
.sheet-body ol { margin: 0; padding-left: 20px; }
.sheet-body li + li { margin-top: 6px; }
.sheet-actions { display: grid; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toasts { position: fixed; left: 12px; right: 12px; top: calc(14px + env(safe-area-inset-top)); z-index: 60; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { padding: 10px 16px; max-width: 28rem; border-radius: var(--radius-s); background: var(--navy); color: #fff; font-weight: 500; font-size: 0.9375rem; box-shadow: 0 8px 28px rgb(20 34 56 / 0.3); }

/* Texte long */
.prose { max-width: 46rem; }
.prose h2 { font-size: 1.375rem; margin-top: 32px; margin-bottom: 10px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.125rem; margin-top: 22px; margin-bottom: 8px; }
.prose p + p { margin-top: 12px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li + li { margin-top: 6px; }
.faq details { border-top: 1px solid var(--line); padding-block: 4px; }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary { padding-block: 12px; font-weight: 600; cursor: pointer; }
.faq details > *:not(summary) { margin-bottom: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Signature de l'agence */
.side-credit { padding: 12px 14px 0; font-size: 0.8125rem; color: #d7deea; }
.side-credit a { color: inherit; }
.workspace-credit { display: none; margin-top: 24px; font-size: 0.8125rem; color: var(--muted); text-align: center; }
@media (max-width: 1100px) {
  .side-credit { display: none; }
  .workspace-credit { display: block; }
}
