:root {
  --blue: #0b3858;
  --blue-d: #082844;
  --blue-lt: #eaf1f6;
  --blue-mid: #16577f;
  --gold: #d1a52f;
  --gold-lt: #f8f1dc;
  --gold-d: #745812;
  --bg: #f4f6f7;
  --white: #ffffff;
  --text: #202830;
  --text2: #68737c;
  --border: #dfe5e9;
  --r: 8px;
  --nav: 64px;
  --bot: 64px;
  --sh-sm: 0 1px 3px rgba(8, 40, 68, .07);
  --sh: 0 10px 28px rgba(8, 40, 68, .10);
  --green: #2b805d;
  --red: #a63e4f;
  --orange: #b77b27;
}

html, body { letter-spacing: 0; }
body { background: var(--bg); }
body.sheet-open { overflow: hidden; }

.top-bar {
  height: calc(var(--nav) + env(safe-area-inset-top, 0px));
  padding-inline: 16px;
  padding-top: env(safe-area-inset-top, 0px);
  background: #082844;
  box-shadow: 0 2px 12px rgba(8, 40, 68, .20);
}
.brand { gap: 11px; font-size: 1rem; letter-spacing: 0; }
.brand span { max-width: min(62vw, 420px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand .logo { width: 40px; height: 40px; border-radius: 7px; background: #fff; }
.brand .logo img { border-radius: 7px; object-fit: contain; }
.top-btn { width: 44px; height: 44px; border-radius: 6px; background: rgba(255,255,255,.13); }
.top-btn:hover { background: rgba(255,255,255,.22); }

.page-wrap { max-width: 1180px; padding-top: calc(var(--nav) + env(safe-area-inset-top, 0px) + 14px); }
.card, .scard { border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--sh-sm); }
a.card:hover, button.card:hover, .card[role="button"]:hover { box-shadow: 0 4px 14px rgba(8,40,68,.08); }
.card-pad { padding: 18px; }

.ptbar {
  position: sticky;
  top: calc(var(--nav) + env(safe-area-inset-top, 0px));
  z-index: 80;
  min-height: 60px;
  padding: 11px 16px;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
}
.ptbar h1, .ptbar > div:first-child { letter-spacing: 0; }
.ptbar .back { width: 44px; height: 44px; border-radius: 6px; }

.sec-hdr { padding: 20px 16px 9px; }
.sec-title { font-size: .92rem; }
.sec-link { color: var(--blue); }

.stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; margin-top: 14px; padding: 0 12px; }
.scard { min-height: 142px; padding: 16px; }
.scard .icon { border-radius: 7px; }
.scard .num { font-size: 1.7rem; }

.btn { min-height: 44px; border-radius: 6px; }
.btn-p { box-shadow: 0 4px 12px rgba(11,56,88,.20); }
.btn-gold { color: #2b281f; }
.fab { border-radius: 8px; background: var(--gold); color: #17202a; box-shadow: 0 8px 20px rgba(209,165,47,.28); }

.fc, .fsel { min-height: 46px; border-radius: 6px; }
.fc:focus, .fsel:focus { box-shadow: 0 0 0 3px rgba(11,56,88,.12); }
.lbl { letter-spacing: 0; }

.li { min-height: 62px; }
.li:focus-visible, .nav-item:focus-visible, .btn:focus-visible, .top-btn:focus-visible,
.fab:focus-visible, .ptbar .back:focus-visible, .fc:focus-visible, .fsel:focus-visible {
  outline: 3px solid rgba(198,154,57,.45);
  outline-offset: 2px;
}
.li-chevron { color: var(--text2); }

.menu-group-title {
  padding: 18px 16px 7px;
  color: var(--text2);
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
}
.menu-icon { background: var(--blue-lt) !important; color: var(--blue) !important; border-radius: 7px; }
.sheet { border-radius: 12px 12px 0 0; }
.sheet-title { text-align: left; font-size: 1.05rem; }
.sheet:focus { outline: none; }
.sheet .li[aria-current="page"] { background: var(--blue-lt); color: var(--blue); }

.bottom-nav { padding-inline: 4px; }
.nav-item {
  min-width: 0;
  min-height: 52px;
  padding: 4px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: .68rem;
  justify-content: center;
}
.nav-item.active { color: var(--blue); }
.nav-item.active::before {
  content: "";
  position: absolute;
  top: -6px;
  width: 30px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--blue);
}

.search-bar input { border-radius: 6px; }
.pill { border-radius: 6px; }
.badge { border-radius: 4px; }
.progress { height: 7px; }

.flash { border-radius: 6px; }
.flash-ok { border-inline-start: 4px solid var(--green); }
.flash-err { border-inline-start: 4px solid var(--red); }

.dashboard-shell { padding: 12px 12px 0; }
.dashboard-hero {
  position: relative;
  overflow: hidden;
  min-height: 190px;
  padding: 22px;
  border-radius: 8px;
  background: #082844;
  color: #fff;
  box-shadow: 0 10px 28px rgba(8,40,68,.22);
}
.dashboard-hero__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dashboard-hero__eyebrow {
  display: block;
  color: #f5d58d !important;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
}
.dashboard-hero__title { margin-top: 4px; color: #fff; font-size: 1.5rem; line-height: 1.2; }
.dashboard-hero__scope { margin-top: 4px; color: rgba(255,255,255,.72); font-size: .82rem; }
.dashboard-hero__date {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  color: rgba(255,255,255,.82);
  font-size: .72rem;
}
.dashboard-hero__summary { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-top: 26px; }
.dashboard-hero__value { margin-right: 8px; font-size: 2.4rem !important; line-height: 1; }
.dashboard-hero__label { color: rgba(255,255,255,.76) !important; font-size: .82rem; }
.dashboard-hero__meta { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 16px; color: #f7dfaa !important; font-size: .75rem; }
.quick-actions { display: flex !important; gap: 10px; margin-top: 14px; }
.quick-action {
  display: flex;
  flex: 1 1 0;
  min-width: 58px;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 4px;
  color: var(--text);
  text-align: center;
  text-decoration: none;
}
.quick-action span { font-size: .72rem; font-weight: 600; }
.quick-action__icon {
  display: flex;
  width: 48px !important;
  height: 48px !important;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 7px !important;
  background: var(--white);
  color: var(--blue) !important;
  box-shadow: var(--sh-sm);
  font-size: 1.3rem;
}
.dashboard-scope-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 12px 2px;
  scrollbar-width: none;
}
.dashboard-scope-tabs::-webkit-scrollbar { display: none; }
.dashboard-scope-tab {
  display: inline-flex;
  min-height: 38px;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  color: var(--text2);
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
}
.dashboard-scope-tab__dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--scope-color, var(--blue)); }
.dashboard-scope-tab.is-active { border-color: var(--scope-color, var(--blue)); background: var(--scope-color, var(--blue)); color: #fff; }
.dashboard-scope-tab.is-active .dashboard-scope-tab__dot { background: rgba(255,255,255,.8); }
.dashboard-scope-tab.is-global-active { border-color: var(--blue); background: var(--blue); color: #fff; }
.dashboard-chart { margin: 14px 12px 0; padding: 17px 16px 14px; }
.dashboard-chart__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dashboard-chart__header h2 { font-size: .95rem; }
.dashboard-chart__header p { margin-top: 2px; color: var(--text2); font-size: .74rem; }
.dashboard-chart__plot { display: grid; height: 172px; grid-template-columns: repeat(6,minmax(34px,1fr)); gap: 8px; margin-top: 16px; }
.dashboard-chart__column { display: grid; min-width: 0; grid-template-rows: 18px minmax(0,1fr) 20px; gap: 4px; text-align: center; }
.dashboard-chart__value { color: var(--text2); font-size: .68rem; font-weight: 700; }
.dashboard-chart__track { position: relative; overflow: hidden; border-radius: 4px 4px 2px 2px; background: var(--blue-lt); }
.dashboard-chart__bar { position: absolute; right: 0; bottom: 0; left: 0; display: block; min-height: 4px; border-radius: 4px 4px 2px 2px; background: var(--blue-mid); }
.dashboard-chart__label { overflow: hidden; color: var(--text2); font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }

@media (min-width: 760px) {
  .stats-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .scard { min-height: 150px; }
}

@media (min-width: 1024px) {
  :root { --sidebar: 232px; --bot: 0px; }
  .top-bar { left: 0; padding-inline: 18px; }
  .brand { width: 215px; }
  .bottom-nav {
    top: var(--nav);
    bottom: 0;
    width: var(--sidebar);
    height: auto;
    padding: 18px 12px;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 5px;
    border-top: 0;
    border-inline-end: 1px solid var(--border);
    box-shadow: 4px 0 18px rgba(25,52,40,.05);
  }
  .nav-item {
    flex: 0 0 46px;
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 0 13px;
    border-radius: 6px;
    font-size: .84rem;
  }
  .nav-item i { width: 22px; font-size: 1.12rem; text-align: center; }
  .nav-item.active { background: var(--blue-lt); }
  .nav-item.active::before { display: none; }
  .page-wrap { width: calc(100% - var(--sidebar)); max-width: none; margin: 0 0 0 var(--sidebar); padding: calc(var(--nav) + 20px) clamp(24px, 4vw, 64px) 40px; }
  .dashboard-shell { padding-inline: 0; }
  .dashboard-hero { min-height: 190px; padding: 28px; }
  .dashboard-hero__title { font-size: 1.75rem; }
  .dashboard-scope-tabs { padding-inline: 0; }
  .dashboard-chart { margin-inline: 0; }
  .card[style*="margin:0 12px"], .card[style*="margin: 0 12px"] { margin-inline: 0 !important; }
  .sec-hdr, .stats-grid { padding-inline: 0; }
  .sheet-overlay { justify-content: flex-end; align-items: stretch; }
  .sheet { width: 420px; max-height: 100vh; border-radius: 0; padding-top: 10px; }
}

@media (max-width: 540px) {
  .dashboard-hero__top { display: block; }
  .dashboard-hero__date { margin-top: 12px; }
  .dashboard-hero__summary { display: block; margin-top: 22px; }
  .dashboard-hero__meta { justify-content: flex-start; margin-top: 10px; }
  .quick-actions { overflow-x: auto; }
  .quick-action { font-size: .7rem; }
  .dashboard-chart__plot { gap: 5px; }
  .f-row { grid-template-columns: 1fr; }
  .ptbar { flex-wrap: wrap; }
  .ptbar .btn { min-height: 44px; padding-inline: 10px; }
}

/* Pages specialisees : meme langage visuel, sans anciens fonds marketing. */
body .spi-hero,
body .parole-hero,
body .exp-hero,
body .dbg-hero {
  background: var(--blue-d);
  background-image: none;
  color: #fff;
}
body .exp-hero::before { display: none; }
body .exp-hero h1,
body .dbg-hero h1,
body .exp-sec-title,
body .annuel-title { color: #f2cf78; }
body .exp-card,
body .period-box,
body .verset-card { border-radius: 8px; border-color: var(--border); box-shadow: var(--sh-sm); }
body .annuel-box { background: var(--blue-d); background-image: none; border-radius: 8px; }
body .modal-sheet { border-radius: 8px 8px 0 0; }
body .slot-tab,
body .ftab { border-radius: 6px; min-height: 40px; }
body .jeune-header-mardi { background: #72508d; background-image: none; }
body .jeune-header-mercredi { background: #a63e4f; background-image: none; }
[style*="linear-gradient(135deg,var(--blue)"] { background: var(--blue-d) !important; background-image: none !important; }
.card[style*="linear-gradient(135deg,#181818"] { background: var(--blue-d) !important; background-image: none !important; }
.card[style*="linear-gradient(135deg,#25D366"] { background: #24795b !important; background-image: none !important; }

.attendance-save-bar {
  position: sticky;
  bottom: calc(var(--bot) + env(safe-area-inset-bottom, 0px));
  z-index: 120;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.96);
  box-shadow: 0 -6px 18px rgba(8,40,68,.08);
}
@media (min-width: 1024px) {
  .attendance-save-bar { bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Authentification */
body.auth-page {
  min-height: 100vh;
  padding: 24px;
  background: #eef2f5 !important;
  background-image: none !important;
}
body.auth-page::before { display: none !important; }
.auth-page .login-wrap { max-width: 440px; }
.auth-page .login-card {
  padding: 34px 32px 30px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--blue);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(8,40,68,.13);
}
.auth-page .logo-img {
  width: 82px;
  height: 82px;
  padding: 4px;
  border: 2px solid var(--blue);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  box-shadow: none;
}
.auth-page .logo-title { color: var(--text); letter-spacing: 0; }
.auth-page .logo-sub { color: var(--text2); }
.auth-page .saas-pill { border-radius: 4px; background: var(--blue-lt); color: var(--blue); }
.auth-page .lbl { color: var(--text); letter-spacing: 0; }
.auth-page .lbl i { color: var(--blue); }
.auth-page .input-wrap { border-color: var(--border); border-radius: 6px; }
.auth-page .input-wrap:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(11,56,88,.12); }
.auth-page .input-icon { background: var(--blue-lt); color: var(--blue); }
.auth-page .show-pw:hover { color: var(--blue); }
.auth-page .remember-wrap input { accent-color: var(--blue); }
.auth-page .btn-login {
  min-height: 48px;
  border-radius: 6px;
  background: var(--blue);
  box-shadow: 0 7px 18px rgba(11,56,88,.20);
}
.auth-page .btn-login:hover { background: var(--blue-d); }
.auth-page .signup-link a { color: var(--blue); }
.auth-page .login-footer, .auth-page .shield-icon { color: var(--text2); }

/* Création d'organisation */
body.signup-page {
  min-height: 100vh;
  padding: 24px;
  background: #eef2f5 !important;
  background-image: none !important;
}
.signup-page .wrap { max-width: 520px; }
.signup-page .card {
  padding: 32px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--blue);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(8,40,68,.13);
}
.signup-page .hdr .badge { border-radius: 4px; background: var(--gold-lt); color: var(--gold-d); }
.signup-page .hdr-logo {
  display: block;
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  padding: 4px;
  border: 2px solid var(--blue);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}
.signup-page .hdr h1 { color: var(--text); }
.signup-page .hdr p, .signup-page .plan-note, .signup-page .login-link { color: var(--text2); }
.signup-page .lbl { color: var(--text); letter-spacing: 0; }
.signup-page .fc { min-height: 46px; border-color: var(--border); border-radius: 6px; }
.signup-page .fc:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(11,56,88,.12); }
.signup-page .btn { min-height: 48px; border-radius: 6px; background: var(--blue); box-shadow: 0 7px 18px rgba(11,56,88,.20); }
.signup-page .btn:hover { background: var(--blue-d); }
.signup-page .login-link a { color: var(--blue); }
@media (max-width: 540px) {
  .signup-page .row2 { grid-template-columns: 1fr; }
  .signup-page .card { padding: 26px 20px; }
}
