/* === Reset & Base === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Prevent iOS auto-zoom on input focus (zooms when font-size < 16px) */
input, select, textarea {
  font-size: max(16px, 1em);
}

:root {
  /* Brand palette — Honoraires MG 2026 */
  --primary: #2563EB;        /* ocean */
  --primary-light: #60A5FA;  /* sky */
  --primary-dark: #1B2D4F;   /* navy */
  --accent: #60A5FA;
  --bg: #F0F5FF;             /* cloud */
  --card: #ffffff;
  --text: #0F1A2E;           /* midnight */
  --text-secondary: #64748B;
  --border: #E2E8F0;
  --success: #059669;        /* emerald */
  --amber: #D97706;
  --danger: #DC2626;
  --shadow: 0 1px 3px rgba(15,26,46,0.08);
  --radius: 10px;
  --nav-height: 60px;
  --result-height: 52px;
  --header-height: 64px;
  --periode-height: 46px;
  --mode-height: 46px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'DM Sans', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

body {
  font-family: var(--font-body);
  font-weight: 300;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
}

/* === Header === */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: calc(var(--header-height) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--primary-dark);
  color: white;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-left: 14px;
  padding-right: 14px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.vmt-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: rgba(255,255,255,0.65);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 400;
  padding: 5px 13px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.vmt-btn[data-mode="simple"] { justify-self: start; }
.vmt-btn[data-mode="complet"] { justify-self: end; }

.vmt-btn.active {
  background: white;
  color: var(--primary-dark);
  font-weight: 500;
}

/* Masquage des éléments avancés en mode simple */
body.mode-simple [data-advanced="true"] { display: none !important; }

/* En mode simple, cacher les actes/majos grisés (non disponibles) */
body.mode-simple .acte-btn.disabled,
body.mode-simple .majo-btn.disabled { display: none !important; }
body.mode-simple .pdsa-disabled { display: none !important; }

/* Toggle Simple/Complet inline dans les titres de section */
.complet-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(37,99,235,0.08);
  color: var(--primary);
  border: 1px solid rgba(37,99,235,0.18);
  border-radius: 10px;
  padding: 2px 6px;
  cursor: pointer;
  margin-left: 6px;
  vertical-align: middle;
  line-height: 1;
  transition: background 0.15s;
}

.complet-hint:active {
  background: rgba(37,99,235,0.15);
}

/* En mode Complet, flèche vers le bas (retour Simple) */
body:not(.mode-simple) .complet-hint svg {
  transform: rotate(180deg);
}

/* Icône mode sur "Type d'acte" */
.view-mode-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 5px;
  vertical-align: middle;
  color: var(--primary);
  opacity: 0.5;
}
.view-mode-badge svg { display: block; }
.view-mode-badge .badge-simple { display: none; }
body.mode-simple .view-mode-badge {
  color: var(--amber);
  opacity: 0.75;
}
body.mode-simple .view-mode-badge .badge-complet { display: none; }
body.mode-simple .view-mode-badge .badge-simple { display: block; }

.app-header h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.logo-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 300;
  letter-spacing: -0.01em;
  color: white;
}

.logo-text strong {
  font-weight: 600;
}

/* === Barre période horaire === */
.header-spacer {
  height: calc(var(--header-height) + var(--safe-top));
}

.periode-bar {
  margin-top: 8px;
  margin-left: 12px;
  margin-right: 12px;
}

/* === Saisie heure (pour SHE) === */
.heure-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}
.heure-row label {
  font-size: 13px;
  font-weight: 600;
  color: #5a6070;
  white-space: nowrap;
}
.heure-row select,
.heure-row input[type="time"] {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 16px;
  font-family: inherit;
  color: var(--primary-dark);
  background: #fff;
  cursor: pointer;
}
.heure-row select:focus,
.heure-row input[type="time"]:focus {
  outline: none;
  border-color: var(--primary);
}

/* === Barre mode de garde (sous la barre période) === */
.mode-bar {
  margin-left: 12px;
  margin-right: 12px;
  display: none;
}

.mode-bar.visible {
  display: block;
}

/* Espacement entre deux toggle-groups dans la même carte (ex: Patientèle + Âge) */
.section-card .toggle-group + .toggle-group {
  margin-top: 8px;
}

/* Carte coordination numérique : TE2 (acte) + RQD (majoration) côte à côte */
.coord-grid {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.coord-grid .acte-btn {
  flex: 0 0 auto;
  min-width: 68px;
}
.coord-grid .majo-btn {
  flex: 1;
}

/* === Main === */
.app-main {
  padding-top: 8px;
  padding-bottom: calc(var(--result-height) + var(--nav-height) + var(--safe-bottom) + 8px);
  padding-left: 12px;
  padding-right: 12px;
  min-height: 100svh;
  overflow-x: hidden;
}

/* === Tab content === */
.tab-content {
  display: none;
  animation: fadeIn 0.2s ease;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* === Cards === */
.section-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.section-card h3 {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-bottom: 10px;
}

/* === Toggle group (segmented control) === */
.toggle-group {
  display: flex;
  background: var(--bg);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.toggle-btn {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  line-height: 1.3;
  position: relative;
}

.toggle-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 1px 4px rgba(37,99,235,0.3);
}

.toggle-btn:active {
  transform: scale(0.97);
}

.toggle-price {
  display: block;
  font-size: 10px;
  opacity: 0.7;
  margin-top: 1px;
}

/* === Acte grid === */
.acte-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.acte-btn {
  display: flex;
  align-items: stretch;
  padding: 0;
  border: 2px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  overflow: hidden;
}

.acte-main {
  flex: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 4px;
  gap: 2px;
}

.acte-btn.active {
  border-color: var(--primary);
  background: rgba(37,99,235,0.08);
  color: var(--primary);
}

.acte-btn:active {
  transform: scale(0.96);
}

.acte-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.acte-btn .info-icon {
  width: 18px;
  height: 18px;
  min-width: 18px;
  font-size: 10px;
  margin-left: 2px;
  vertical-align: middle;
  position: relative;
  z-index: 1;
}

.acte-price {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 2px;
}

.acte-btn.active .acte-price {
  color: var(--primary-light);
}

/* === Majoration grid === */
.majo-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.majo-btn {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  padding: 0;
  border: 2px solid var(--border);
  background: var(--card);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  min-width: 0;
  overflow: hidden;
}

.majo-body {
  flex: 4;
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  min-width: 0;
}

.majo-btn.active {
  border-color: var(--success);
  background: rgba(5,150,105,0.06);
}

.majo-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* L'icône ⓘ reste cliquable même si le bouton est inhibé */
.majo-btn.disabled .info-icon,
.acte-btn.disabled .info-icon {
  pointer-events: auto;
  cursor: pointer;
}

.majo-btn:active {
  transform: scale(0.97);
}

.majo-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.majo-code {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}

.majo-btn.active .majo-code {
  color: var(--success);
}

.majo-price {
  font-size: 13px;
  font-weight: 500;
  color: var(--success);
  white-space: nowrap;
  margin-left: auto;
}

.majo-label {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.info-icon {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 50%;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  font-style: italic;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: 4px;
  flex-shrink: 0;
}

/* Info icon dans les acte-btn et majo-btn : zone 1/5 avec séparateur */
.acte-btn .info-icon,
.majo-btn .info-icon {
  flex: 1;
  width: auto;
  height: auto;
  min-width: 0;
  margin: 0;
  border-radius: 0;
  border-left: 1px solid var(--border);
  background: rgba(0,0,0,0.02);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
}

.acte-btn.active .info-icon {
  border-left-color: rgba(37,99,235,0.25);
  background: rgba(37,99,235,0.04);
}

.majo-btn.active .info-icon {
  border-left-color: rgba(5,150,105,0.25);
  background: rgba(5,150,105,0.03);
}

/* === IK Section === */
.ik-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ik-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.ik-toggle input {
  display: none;
}

.ik-slider {
  width: 44px;
  height: 24px;
  background: var(--border);
  border-radius: 12px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.ik-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.ik-toggle input:checked + .ik-slider {
  background: var(--success);
}

.ik-toggle input:checked + .ik-slider::after {
  transform: translateX(20px);
}

.ik-label {
  font-size: 14px;
  font-weight: 500;
}

.ik-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ik-km-input {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.ik-btn {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border);
  background: var(--card);
  border-radius: 50%;
  font-size: 20px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.ik-btn:active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.ik-km-input input {
  width: 70px;
  height: 40px;
  text-align: center;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  font-family: inherit;
}

.ik-km-input input:focus {
  outline: none;
  border-color: var(--primary);
}

.ik-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.ik-info {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
  border-radius: 6px;
  padding: 6px 10px;
}

.ik-geo-btn {
  width: 100%;
  padding: 10px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.ik-geo-btn:active { background: var(--primary-dark, #2872D4); }
.ik-geo-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.ik-geo-status {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  min-height: 16px;
}
.ik-geo-status.warn { color: #e07b00; }
.ik-geo-status.ok   { color: var(--success); }

/* === Cabinet médical (Paramètres) === */
.cabinet-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.cabinet-address-wrapper {
  position: relative;
}
.cabinet-address-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
}
.cabinet-address-input:focus {
  outline: none;
  border-color: var(--primary);
}
.address-suggestions {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  list-style: none;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  overflow: hidden;
}
.address-suggestions[hidden] { display: none; }
.address-suggestions li {
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.address-suggestions li:last-child { border-bottom: none; }
.address-suggestions li:hover,
.address-suggestions li.focused {
  background: var(--bg);
  color: var(--primary);
}
.cabinet-saved-status {
  display: block;
  font-size: 12px;
  color: var(--success);
  margin-top: 5px;
  min-height: 16px;
  transition: opacity 0.5s;
}
.cabinet-saved-status.fade {
  opacity: 0;
}

/* === Bannière installation PWA === */
.pwa-install-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--primary);
  color: #fff;
  border-radius: var(--radius);
  padding: 14px 12px;
  margin-bottom: 12px;
}
.pwa-install-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pwa-install-icon svg {
  width: 20px;
  height: 20px;
  color: #fff;
}
.pwa-install-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 13px;
  line-height: 1.4;
}
.pwa-install-text strong {
  font-size: 14px;
}
.pwa-install-text em {
  font-style: normal;
  font-weight: 600;
}
.pwa-share-icon {
  display: inline-block;
  width: 13px;
  height: 13px;
  vertical-align: middle;
  margin: 0 1px;
  color: #fff;
}
.pwa-install-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

/* === CCAM === */
.ccam-search-wrap {
  position: relative;
}

.ccam-search-input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s;
}

.ccam-search-input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.ccam-search-input::placeholder {
  color: #999;
}

.ccam-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ccam-item {
  display: flex;
  align-items: center;
  padding: 10px;
  background: var(--bg);
  border-radius: 8px;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
}

.ccam-item.selected {
  border-color: var(--primary);
  background: rgba(37,99,235,0.06);
}

.ccam-item.dimmed {
  opacity: 0.35;
  pointer-events: none;
}

.ccam-item:active {
  transform: scale(0.99);
}

.ccam-fav-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #ccc;
  padding: 2px;
  transition: color 0.2s;
  flex-shrink: 0;
}

.ccam-fav-btn.favorited {
  color: #f1c40f;
}

.ccam-info {
  flex: 1;
  min-width: 0;
}

.ccam-top-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.ccam-code {
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--primary);
}

.ccam-label {
  font-size: 12px;
  color: var(--text);
  line-height: 1.3;
  display: block;
}

.ccam-tarif {
  font-size: 14px;
  font-weight: 700;
  color: var(--success);
  white-space: nowrap;
  flex-shrink: 0;
}

.ccam-cumul {
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ccam-cumul.yes {
  color: var(--success);
  background: rgba(39,174,96,0.12);
}

.ccam-cumul.half {
  color: #e67e22;
  background: rgba(230,126,34,0.12);
}

.ccam-cumul.no {
  color: var(--text-secondary);
  background: var(--border);
}

.ccam-rank {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
}

.rank-primary {
  color: var(--primary);
  background: rgba(37,99,235,0.12);
}

.rank-secondary {
  color: #e67e22;
  background: rgba(230,126,34,0.12);
}

.ccam-add-btn {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border: 2px solid var(--border);
  background: var(--card);
  border-radius: 50%;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.ccam-add-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  font-size: 14px;
}

/* === CCAM selection banner === */
.ccam-selection-banner {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  border-left: 3px solid var(--primary);
}

.ccam-sel-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.ccam-sel-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 13px;
  flex-wrap: wrap;
}

.ccam-sel-item strong {
  color: var(--primary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.ccam-sel-rule {
  font-size: 11px;
  color: var(--text-secondary);
  flex: 1;
}

.ccam-sel-taux {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 8px;
  white-space: nowrap;
  flex: 0;
}

.ccam-sel-taux.taux-full {
  color: var(--success);
  background: rgba(5,150,105,0.12);
}

.ccam-sel-taux.taux-half {
  color: #e67e22;
  background: rgba(230,126,34,0.12);
}

.ccam-sel-limit {
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 6px;
  text-align: center;
}

.ccam-sel-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 16px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* === Paramètres === */
/* Uses same toggle-group styles */

/* === Crédits === */
.credits-card {
  text-align: center;
  padding: 24px 16px;
}

.credits-card h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--primary);
  margin-bottom: 4px;
}

.credits-version {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.credits-card > p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.credits-authors {
  margin-top: 16px;
  padding: 12px;
  background: var(--surface-alt, #f5f5f5);
  border-radius: 8px;
}

.credits-authors h3 {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.credits-authors p {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
}

.credits-sources {
  margin-top: 20px;
  text-align: left;
}

.credits-sources h3 {
  font-size: 13px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.credits-sources ul {
  list-style: none;
  padding: 0;
}

.credits-sources li {
  font-size: 13px;
  color: var(--text);
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.credits-sources li a {
  color: var(--primary);
  text-decoration: none;
}

.credits-sources li a:hover {
  text-decoration: underline;
}

.credits-sources li:last-child {
  border-bottom: none;
}

.credits-disclaimer {
  margin-top: 20px;
  padding: 12px;
  background: rgba(231,76,60,0.06);
  border-radius: 8px;
}

.credits-disclaimer p {
  font-size: 12px;
  color: var(--danger);
}

.credits-footer {
  margin-top: 16px;
}

.credits-footer p {
  font-size: 12px;
  color: var(--text-secondary);
}

/* === Result bar === */
.result-bar {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  left: 0;
  right: 0;
  height: var(--result-height);
  background: var(--primary-dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.15);
}

.result-main {
  flex: 1;
  min-width: 0;
  margin-right: 12px;
}

.result-codes {
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-mono);
  opacity: 0.9;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-amo-amc {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.7;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.result-total {
  font-size: 22px;
  font-weight: 300;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* === Bottom nav === */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s;
}

.nav-btn.active {
  color: var(--primary);
}

.nav-icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.nav-btn span {
  font-size: 10px;
  font-weight: 500;
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--card);
  border-radius: 16px 16px 0 0;
  padding: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 60vh;
  overflow-y: auto;
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-header h3 {
  font-size: 16px;
  color: var(--primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.modal-body {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
}

.modal-body .majo-detail-tarif {
  font-size: 18px;
  font-weight: 700;
  color: var(--success);
  margin: 8px 0;
}

/* === Paywall abonnement === */
.paywall-overlay {
  position: fixed;
  inset: 0;
  background: var(--primary-dark);
  z-index: 1000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 24px calc(24px + var(--safe-bottom));
  padding-top: calc(24px + var(--safe-top));
}
.paywall-content {
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.paywall-logo { width: 44px; height: 44px; margin: 0 auto 8px; }
.paywall-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 300;
  color: white;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}
.paywall-title strong { font-weight: 700; color: var(--primary-light); }
.paywall-subtitle { font-size: 13px; font-weight: 300; color: rgba(255,255,255,0.5); margin-bottom: 16px; }
.paywall-plans { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.paywall-plan {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  transition: all 0.18s;
}
.paywall-plan.active { background: rgba(255,255,255,0.13); border-color: rgba(255,255,255,0.55); }
.plan-radio {
  width: 18px; height: 18px; min-width: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.18s;
}
.paywall-plan.active .plan-radio { border-color: white; background: white; box-shadow: inset 0 0 0 4px var(--primary-dark); }
.plan-info { flex: 1; text-align: left; }
.plan-name { font-size: 13px; font-weight: 400; color: rgba(255,255,255,0.6); margin-bottom: 2px; display: flex; align-items: center; gap: 8px; }
.paywall-plan.active .plan-name { color: rgba(255,255,255,0.9); }
.plan-badge { background: var(--primary); color: white; font-size: 9px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.plan-price { font-family: var(--font-display); font-size: 22px; font-weight: 300; color: rgba(255,255,255,0.5); letter-spacing: -0.02em; line-height: 1; }
.paywall-plan.active .plan-price { color: white; }
.plan-price span { font-size: 13px; font-weight: 300; }
.plan-detail { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 2px; }
.plan-btn-primary {
  width: 100%;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
  margin-bottom: 2px;
}
.plan-btn-primary:active { opacity: 0.82; }
.plan-btn-primary:disabled { opacity: 0.6; }
.paywall-skip { background: none; border: none; color: rgba(255,255,255,0.3); font-family: var(--font-body); font-size: 13px; font-weight: 300; cursor: pointer; padding: 6px; display: block; margin: 0 auto; }

/* === Compte / Auth === */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.auth-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.18s;
}

.auth-input:focus {
  outline: none;
  border-color: var(--primary);
  background: white;
}

.auth-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 16px;
}

.auth-btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.18s;
}

.auth-btn-primary:active { opacity: 0.82; }

.auth-btn-secondary {
  width: 100%;
  padding: 11px;
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: background 0.18s;
}

.auth-btn-secondary:active { background: var(--bg); }

.auth-switch {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: 4px;
}

.auth-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.account-info {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 4px;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.account-row:last-child { border-bottom: none; }

.account-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.account-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.account-status-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

.account-status-badge.status-active {
  background: rgba(5,150,105,0.1);
  color: var(--success);
}

.account-status-badge.status-trial {
  background: rgba(217,119,6,0.1);
  color: var(--amber);
}

.account-status-badge.status-expired {
  background: rgba(220,38,38,0.1);
  color: var(--danger);
}

/* === Sélecteur de plan abonnement === */
.subscribe-plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.subscribe-plan-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  transition: all 0.18s;
  gap: 4px;
}

.subscribe-plan-btn.active {
  border-color: var(--primary);
  background: rgba(37,99,235,0.06);
}

.subscribe-plan-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 5px;
}

.subscribe-plan-btn.active .subscribe-plan-name {
  color: var(--primary);
}

.subscribe-plan-price {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 300;
  color: var(--text);
  letter-spacing: -0.02em;
}

.subscribe-plan-price small {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-secondary);
}

.subscribe-plan-badge {
  font-size: 9px;
  font-weight: 600;
  background: var(--success);
  color: white;
  padding: 1px 5px;
  border-radius: 10px;
  letter-spacing: 0.02em;
}

/* Bannière compte (succès / erreur) */
.account-banner {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 10px;
  text-align: center;
}

.account-banner.banner-success {
  background: rgba(5,150,105,0.1);
  color: var(--success);
}

.account-banner.banner-error {
  background: rgba(220,38,38,0.08);
  color: var(--danger);
}

/* ================================================================
   TABLETTE (769–1023px) : colonne centrée sur fond brand navy
   ================================================================ */
@media (min-width: 769px) and (max-width: 1023px) {
  body {
    background: var(--primary-dark);
    min-height: 100vh;
  }

  .app-header {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(580px, 100%);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  }

  .app-main {
    max-width: 580px;
    margin: 0 auto;
    background: var(--bg);
    box-shadow: 0 0 0 1px rgba(255,255,255,0.06), 0 12px 40px rgba(0,0,0,0.3);
    min-height: calc(100vh - var(--header-height));
    border-radius: 0 0 16px 16px;
  }

  .result-bar {
    max-width: 580px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 10px 10px 0 0;
  }

  .bottom-nav {
    max-width: 580px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 12px 12px 0 0;
  }

  .modal-content {
    border-radius: 16px;
    margin-bottom: 20px;
    max-width: 540px;
  }

  .modal-overlay {
    align-items: center;
  }
}

/* ================================================================
   DESKTOP (≥ 1024px) : App Shell — sidebar fixe + contenu
   Brand identity : navy sidebar, cloud content, ocean blue active
   Ref : Linear / Notion / Stripe Dashboard pattern
   ================================================================ */
@media (min-width: 1024px) {
  /* Fond brand navy — unifié avec la sidebar */
  body {
    background: var(--primary-dark);
    min-height: 100vh;
  }

  /* ── Header pleine largeur ── */
  .app-header {
    left: 0;
    right: 0;
    width: 100%;
    transform: none;
    border-radius: 0;
    box-shadow: none;
    border-bottom: 1px solid rgba(96, 165, 250, 0.15); /* sky-blue subtil */
  }

  /* ── Sidebar : navigation verticale brand navy ── */
  .bottom-nav {
    position: fixed;
    left: 0;
    top: calc(var(--header-height) + var(--safe-top));
    bottom: 0;
    right: auto;
    width: 240px;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    height: auto;
    gap: 2px;
    padding: 20px 12px;
    border-top: none;
    border-right: 1px solid rgba(255,255,255,0.07);
    border-radius: 0;
    background: var(--primary-dark); /* brand navy exact */
    overflow-y: auto;
  }

  /* Ligne décorative sky-blue en haut de la sidebar */
  .bottom-nav::before {
    content: '';
    display: block;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-light) 0%, transparent 80%);
    margin: -20px -12px 18px;
    opacity: 0.4;
  }

  /* Domaine en bas de la sidebar */
  .bottom-nav::after {
    content: 'honorairesmg.fr';
    display: block;
    margin-top: auto;
    padding: 20px 4px 4px;
    font-size: 10px;
    font-family: var(--font-body);
    color: rgba(255,255,255,0.18);
    letter-spacing: 0.6px;
  }

  /* Boutons nav : icône + label horizontal */
  .nav-btn {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 8px;
    height: auto;
    min-height: 0;
    color: rgba(255,255,255,0.5);
    border-left: 2px solid transparent;
    transition: background 0.15s, color 0.15s;
  }

  .nav-btn:hover {
    color: rgba(255,255,255,0.88);
    background: rgba(255,255,255,0.07);
  }

  /* Active : ocean blue + accent sky-blue sur le bord gauche */
  .nav-btn.active {
    color: #fff;
    background: var(--primary); /* #2563EB ocean */
    border-left-color: var(--primary-light); /* #60A5FA sky */
    font-weight: 500;
  }

  .nav-btn span {
    font-size: 13px;
    display: block;
  }

  .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
  }

  /* ── Zone de contenu : fond cloud, décalée de la sidebar ── */
  .periode-bar,
  .mode-bar {
    margin-left: calc(240px + 12px);
    margin-right: 12px;
  }

  .app-main {
    margin-left: 240px;
    max-width: none;
    background: var(--bg); /* #F0F5FF cloud */
    box-shadow: none;
    border-radius: 0;
    min-height: calc(100vh - var(--header-height) - var(--safe-top));
    padding-bottom: calc(var(--result-height) + 24px);
  }

  /* Contenu interne : max-width pour confort lecture */
  .tab-content {
    max-width: 880px;
    margin-left: auto;
    margin-right: auto;
  }

  /* ── Result bar : band brand au bas de la zone principale ── */
  .result-bar {
    left: 240px;
    right: 0;
    max-width: none;
    width: auto;
    transform: none;
    border-radius: 0;
    border-top: 1px solid rgba(96, 165, 250, 0.2); /* sky-blue */
  }

  /* Grilles 3 colonnes */
  .majo-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Cartes plus aérées */
  .section-card {
    padding: 18px 22px;
    margin-bottom: 12px;
  }

  /* Modal centrée */
  .modal-content {
    border-radius: 16px;
    margin-bottom: 20px;
    max-width: 540px;
  }

  .modal-overlay {
    align-items: center;
  }
}
