/* CAMP 30 — polish final
   Sprint 1 : mobile et lisibilité
   Sprint 2 : inscription et jours de présence
   Sprint 3 : carte (complété dans map-v4-2.html)
   Sprint 4 : administration simplifiée
*/

:root{
  --muted:#505d58;
  --rust:#a94e2d;
  --line:rgba(23,58,50,.20);
  --shadow:0 18px 48px rgba(23,58,50,.12);
}

body{font-size:16px;line-height:1.45;overflow-x:hidden}
button,input,textarea,select{font-size:1rem}
button{touch-action:manipulation}
.button{min-height:48px;padding:13px 20px;line-height:1.15}
.button.primary{background:#173a32;color:#fffaf0;box-shadow:0 8px 22px rgba(23,58,50,.16)}
.button.primary:hover{background:#0e2e27}
.button.secondary{background:#fffaf0;color:#173a32;border-color:rgba(23,58,50,.28)}
.button.ghost{background:rgba(13,40,36,.48);border-color:rgba(255,255,255,.62);color:#fffdf5}
.text-button{min-height:42px;color:#984326;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:4px}
.eyebrow{font-size:.76rem;line-height:1.25;color:#984326}
.card{box-shadow:0 7px 24px rgba(23,58,50,.055)}
.page-head p,.section-heading p,.quick-card p,.episode-card p,.camper-card p,.schedule-item p,.notification-card p,.admin-card p{color:#505d58}

/* Le portail est conservé, uniquement sécurisé sur petits écrans. */
.portal{padding:max(28px,env(safe-area-inset-top)) 20px max(72px,calc(32px + env(safe-area-inset-bottom)))}
.portal-content{max-width:760px}
.portal-demo{min-height:40px;padding:8px 12px;color:rgba(255,250,240,.86);font-weight:700}
.portal-content>p:not(.portal-kicker){color:rgba(255,250,240,.86)}
.portal-foot{left:16px;right:16px;text-align:center;color:rgba(255,250,240,.75)}

/* Formulaires : contraste net et aucune police minuscule. */
.auth-form label,.profile-edit-form label,.admin-field{font-size:.88rem}
.auth-form input,.auth-form textarea,.auth-form select,
.profile-edit-form input,.profile-edit-form textarea,.profile-edit-form select,
.admin-field input,.admin-field textarea,.admin-field select,
.search-field,.day-tabs button{
  min-height:48px;
  border-color:rgba(23,58,50,.28);
  background:#fffefb;
  color:#173a32;
}
.auth-form input::placeholder,.profile-edit-form input::placeholder{color:#707975;opacity:1}
.check-row{font-size:.84rem!important;line-height:1.45}
.check-row input{width:22px;height:22px;min-height:auto}
.form-message{color:#173a32;font-weight:700;line-height:1.45}

/* Sprint 2 — calendrier de présence, repris de l'esprit de la V1. */
.presence-picker{margin:3px 0;padding:16px;border:1px solid rgba(23,58,50,.18);border-radius:20px;background:#f7efe1}
.presence-picker legend{display:block;width:100%;padding:0 3px;margin-bottom:12px;color:#173a32}
.presence-picker legend span{display:block;font-family:Georgia,"Times New Roman",serif;font-size:1.14rem;font-weight:700;line-height:1.2}
.presence-picker legend small{display:block;margin-top:4px;color:#59635e;font-size:.78rem;font-weight:600;line-height:1.35}
.presence-day-grid{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:8px!important;margin-top:0!important}
.presence-day{position:relative;display:block!important;margin:0!important;cursor:pointer}
.presence-day input{position:absolute!important;width:1px!important;height:1px!important;min-height:0!important;opacity:0!important;pointer-events:none}
.presence-day>span{
  display:grid!important;
  place-content:center;
  min-height:112px;
  padding:10px 5px!important;
  border:1px solid rgba(23,58,50,.22)!important;
  border-radius:10px 20px 11px 17px!important;
  background:#fffaf0!important;
  color:#173a32!important;
  text-align:center;
  box-shadow:0 7px 17px rgba(64,46,24,.07);
  transition:transform .16s ease,border-color .16s ease,background .16s ease,box-shadow .16s ease
}
.presence-day:nth-child(even)>span{transform:rotate(.35deg)}
.presence-day:nth-child(odd)>span{transform:rotate(-.25deg)}
.presence-day small{display:block;font-size:.68rem!important;font-weight:900!important;letter-spacing:.08em;color:#655d50!important}
.presence-day b{display:block;margin:4px 0;color:#173a32;font-family:Georgia,"Times New Roman",serif;font-size:2.35rem;line-height:.9}
.presence-day em{display:block;font-style:normal;font-size:.66rem;font-weight:900;letter-spacing:.10em;color:#a94e2d}
.presence-day input:focus-visible+span{outline:3px solid rgba(169,78,45,.34);outline-offset:2px}
.presence-day input:checked+span{
  border-color:#173a32!important;
  background:#173a32!important;
  color:#fffaf0!important;
  box-shadow:0 0 0 3px rgba(169,78,45,.20),0 11px 23px rgba(23,58,50,.18);
  transform:translateY(-3px) rotate(0)
}
.presence-day input:checked+span small{color:#f1c56d!important}
.presence-day input:checked+span b{color:white}
.presence-day input:checked+span em{color:#ffab7d}

/* Administration : menu d'actions au lieu d'un cockpit. */
.admin-subheading{margin:4px 0 0;color:#505d58;font-size:.83rem}
.admin-tabs{display:block;overflow:visible;padding:10px 20px;background:#eadcc2}
.admin-tabs.admin-tabs-home{display:none}
.admin-back-button{min-height:42px;border:0;background:transparent;color:#173a32;padding:4px 0;font-weight:850;text-decoration:underline;text-underline-offset:4px}
.admin-welcome{padding:8px 2px 4px}
.admin-welcome h3{margin:7px 0 5px;font-family:Georgia,"Times New Roman",serif;font-size:2rem;font-weight:500}
.admin-welcome p{margin:0;color:#505d58}
.admin-action-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}
.admin-action-card{
  min-height:112px;
  display:grid;
  grid-template-columns:46px minmax(0,1fr) 24px;
  gap:12px;
  align-items:center;
  padding:17px;
  border:1px solid rgba(23,58,50,.18);
  border-radius:20px;
  background:#fffaf0;
  color:#173a32;
  text-align:left;
  box-shadow:0 6px 20px rgba(23,58,50,.05)
}
.admin-action-card>span{display:grid;place-content:center;width:46px;height:46px;border-radius:16px;background:#173a32;color:#fffaf0;font-size:1.3rem}
.admin-action-card b{display:block;font-size:1rem;line-height:1.25}
.admin-action-card small{display:block;margin-top:5px;color:#505d58;font-size:.78rem;line-height:1.35}
.admin-action-card i{font-style:normal;font-size:1.3rem;color:#a94e2d}
.admin-action-card:hover,.admin-action-card:focus-visible{border-color:#a94e2d;transform:translateY(-1px)}
.admin-content{align-content:start}
.admin-card{box-shadow:none}
.admin-card h3{font-size:1.35rem}
.admin-list-row{background:#fffaf0}
.admin-list-row select,.admin-list-row input{min-height:44px;border-color:rgba(23,58,50,.26)!important;background:#fffefb;color:#173a32}
.admin-history summary{min-height:44px;display:flex;align-items:center;font-weight:850;cursor:pointer}
.admin-history[open] summary{margin-bottom:10px}
.switch{min-height:46px;padding:6px 0}
.switch input{width:22px;height:22px}

/* Sécurisation responsive générale. */
img,svg,iframe{max-width:100%}
.home-grid,.quick-grid,.episodes-grid,.camper-grid,.challenge-grid,.practical-sections,.memory-grid,.team-layout,.live-hero,.during-tools{min-width:0}
.home-hero h1,.page-head h1,.section-heading h2,.map-heart-copy h2,.after-hero h1{overflow-wrap:anywhere}
.quick-card,.during-tool,.memory-card,.notification-card,.camper-card,.episode-card{color:#173a32}
.episode-card.current{color:white}
.map-open-overlay span{color:#173a32;border:1px solid rgba(23,58,50,.18)}
.schedule-location{color:#173a32;background:#e4d4b7}

@media(max-width:900px){
  .view{padding-left:22px;padding-right:22px}
  .home-hero h1{font-size:clamp(3rem,10vw,5rem)}
  .admin-action-grid{grid-template-columns:1fr}
}

@media(max-width:760px){
  body{font-size:16px}
  .mobile-header{height:64px;padding:0 12px max(0px,env(safe-area-inset-top));background:rgba(244,237,223,.97)}
  .header-icon,.profile-orb{width:44px;height:44px;flex:0 0 44px}
  .mobile-header-actions{gap:5px}
  .mobile-brand{min-height:44px;padding:0 5px}
  .view{width:100%;padding:16px 13px calc(96px + env(safe-area-inset-bottom));overflow-x:hidden}

  .bottom-nav{
    left:8px;right:8px;
    bottom:calc(7px + env(safe-area-inset-bottom));
    height:70px;
    display:grid;
    grid-template-columns:repeat(5,minmax(0,1fr));
    gap:3px;
    padding:5px;
    overflow:visible;
    border-radius:22px
  }
  .bottom-nav button{min-width:0;width:100%;min-height:58px;padding:5px 2px;border-radius:17px}
  .bottom-nav button span{font-size:1.12rem;line-height:1}
  .bottom-nav button small{font-size:.66rem;line-height:1.05;letter-spacing:0;white-space:normal}

  .page-head{gap:11px;margin:2px 0 18px}
  .page-head h1{font-size:clamp(2.25rem,12vw,3.1rem);line-height:.98}
  .page-head p{font-size:.95rem;line-height:1.48}
  .page-actions{width:100%}.page-actions .button{width:100%}
  .section-heading{align-items:flex-start;gap:9px;margin:27px 0 12px}
  .section-heading h2{font-size:clamp(1.85rem,9vw,2.55rem);line-height:1}

  .home-grid{grid-template-columns:1fr;gap:11px}
  .home-hero{min-height:390px;padding:25px 21px;border-radius:20px}
  .home-hero h1{font-size:clamp(2.85rem,14.5vw,4.2rem);line-height:.91;margin:23px 0 14px}
  .home-hero p{font-size:.96rem;color:rgba(255,250,240,.88);line-height:1.5}
  .home-hero-actions{display:grid;grid-template-columns:1fr;gap:8px}.home-hero-actions .button{width:100%}
  .countdown-card,.signal-card{min-height:0;padding:21px}
  .countdown-card strong{font-size:clamp(2.2rem,12vw,3.5rem)}

  .map-heart{display:flex;flex-direction:column;min-height:0;border-radius:20px}
  .map-heart-copy{padding:25px 21px}
  .map-heart-copy h2{font-size:clamp(2.2rem,12vw,3.3rem);line-height:.96}
  .map-heart-copy p{color:rgba(255,250,240,.86);font-size:.95rem;line-height:1.5}
  .map-heart-copy .button{width:100%}
  .map-heart-frame{min-height:54svh;height:54svh}
  .map-open-overlay span{right:12px;bottom:12px;padding:11px 14px}
  .map-shell{height:calc(100dvh - 64px - 84px)}
  .map-back{left:10px;top:10px;min-height:44px;padding:10px 13px}

  .quick-grid,.during-tools,.challenge-grid,.practical-sections,.profile-links,.my-info-card,.memory-grid{grid-template-columns:1fr;gap:10px}
  .quick-card{min-height:0;padding:19px;display:grid;grid-template-columns:40px 1fr;gap:12px;align-items:start}
  .quick-card>span{font-size:1.45rem}.quick-card h3{font-size:1.18rem}
  .during-tool,.memory-card{min-height:0;padding:20px}

  .episodes-grid{grid-template-columns:1fr;gap:10px}
  .episode-card{min-height:238px;padding:20px}.episode-card h2{font-size:1.75rem}.episode-card footer{left:20px;right:20px}
  .episode-strip{margin-right:-13px;padding-right:13px}.episode-mini{min-width:78vw;max-width:300px;padding:17px}

  .camper-toolbar{gap:10px}.camper-count{font-size:1.65rem}
  .camper-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  .camper-card{min-height:216px;border-radius:18px}.camper-photo{height:105px}.camper-card-content{padding:13px}.camper-card h3{font-size:1.08rem}.camper-card p{font-size:.78rem}.camper-days span{font-size:.67rem;background:#fffaf0;color:#173a32}

  .schedule-item{grid-template-columns:70px minmax(0,1fr);gap:12px;padding:16px;align-items:start}
  .schedule-time{font-size:1.13rem}.schedule-location{grid-column:2;max-width:100%;width:max-content;white-space:normal}
  .day-tabs button{padding:10px 13px}

  .profile-hero-card{padding:20px;grid-template-columns:64px minmax(0,1fr);gap:13px}.profile-avatar{width:64px;height:64px;border-radius:21px;font-size:1.8rem}.profile-hero-card h2{font-size:1.55rem}
  .profile-link{padding:17px}
  .notification-card{padding:17px;grid-template-columns:42px minmax(0,1fr);gap:12px}.notification-card time{font-size:.78rem}

  /* Les dialogues deviennent des feuilles mobiles lisibles. */
  .dialog,
  .profile-edit-dialog,
  .admin-edit-dialog{
    width:100vw;
    max-width:none;
    height:auto;
    max-height:94dvh;
    margin:auto 0 0;
    padding:22px 16px calc(22px + env(safe-area-inset-bottom));
    border:0;
    border-radius:24px 24px 0 0;
  }
  .auth-dialog{height:94dvh}
  .dialog-close{position:sticky;top:0;z-index:3;float:right;width:44px;height:44px;background:#e7ddca;color:#173a32}
  .auth-head{padding-right:48px}.auth-head h2{font-size:clamp(2.35rem,12vw,3.1rem);line-height:1}.auth-head p{font-size:.94rem;line-height:1.45}
  .auth-tabs{position:sticky;top:0;z-index:2;margin:16px 0;background:#e9ddc7}.auth-tabs button{min-height:44px;font-size:.84rem}
  .auth-form{gap:13px}.form-grid.two{grid-template-columns:1fr}
  .auth-form input,.auth-form textarea,.auth-form select,.profile-edit-form input,.profile-edit-form textarea,.profile-edit-form select{font-size:16px}
  .dialog-actions{display:grid;grid-template-columns:1fr 1fr}.dialog-actions .button{width:100%}

  .presence-picker{padding:14px 10px}
  .presence-day-grid{grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:5px!important}
  .presence-day>span{min-height:94px;padding:8px 2px!important;border-radius:8px 15px 9px 13px!important}
  .presence-day small{font-size:.57rem!important;letter-spacing:.04em}
  .presence-day b{font-size:2rem}
  .presence-day em{font-size:.55rem;letter-spacing:.06em}

  /* Admin mobile : plein écran, grandes actions. */
  .admin-drawer{width:100%;max-width:none;background:#f5ecdb}
  .admin-header{padding:14px 15px;align-items:flex-start}.admin-header h2{font-size:1.45rem;margin-top:3px}.admin-subheading{font-size:.78rem;max-width:34ch}
  .admin-tabs{top:78px;padding:8px 15px}
  .admin-content{padding:15px;gap:11px}
  .admin-welcome h3{font-size:1.8rem}
  .admin-action-grid{grid-template-columns:1fr;gap:8px}
  .admin-action-card{min-height:88px;grid-template-columns:42px minmax(0,1fr) 20px;padding:14px;border-radius:17px}
  .admin-action-card>span{width:42px;height:42px;border-radius:14px}
  .admin-action-card small{font-size:.76rem}
  .admin-card{padding:17px;border-radius:18px}
  .admin-list-row{grid-template-columns:minmax(0,1fr);gap:8px;align-items:stretch;padding:13px}
  .admin-list-row select,.admin-list-row input,.admin-list-row .text-button{width:100%!important}
  .admin-grid,.admin-stat-grid{grid-template-columns:1fr}
  .admin-actions{display:grid;grid-template-columns:1fr}.admin-actions .button{width:100%}
  .toast{bottom:calc(88px + env(safe-area-inset-bottom));max-width:calc(100vw - 24px);border-radius:15px;text-align:center}
}

@media(max-width:390px){
  .portal{padding-left:15px;padding-right:15px}.portal h1{font-size:clamp(2.75rem,16vw,3.45rem)}.portal-kicker{font-size:.66rem;letter-spacing:.11em}
  .portal-actions{width:100%}.portal-actions .button{width:100%}
  .camper-grid{grid-template-columns:1fr}
  .camper-card{display:grid;grid-template-columns:96px 1fr;min-height:142px}.camper-photo{height:100%;min-height:142px}.camper-card-content{display:flex;flex-direction:column;justify-content:center}
  .presence-day-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .presence-day>span{min-height:105px}.presence-day b{font-size:2.2rem}
  .bottom-nav button small{font-size:.61rem}
}

@media(prefers-contrast:more){
  :root{--line:rgba(23,58,50,.38);--muted:#35413d}
  .button.secondary,.card,.admin-action-card{border-width:2px}
}
