@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Inter:wght@400;500;600;700&display=swap");

:root {
  --paper: #fbf8ef;
  --mint: #eef6eb;
  --surface: #ffffff;
  --line: #d8e8d1;
  --leaf: #2e684f;
  --leaf-dark: #1f4d39;
  --sage: #a9c6a5;
  --sage-soft: #dcebd7;
  --event: #c87658;
  --sun: #e4a954;
  --ink: #203027;
  --muted: #758076;
  --shadow: 0 6px 18px rgba(31, 77, 57, 0.11);
  --radius: 18px;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: linear-gradient(180deg, var(--mint), var(--paper));
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--font-display); color: var(--leaf-dark); line-height: 1.08; }
h1 { font-size: 2rem; margin-bottom: 0.2rem; }
h2 { font-size: 1.35rem; margin-bottom: 0.75rem; }
h3 { font-size: 1rem; margin-bottom: 0.25rem; }

.eyebrow {
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.login-card {
  width: min(100%, 26rem);
  padding: 1.4rem;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.login-logo {
  width: 5.5rem;
  height: 5.5rem;
  object-fit: contain;
  margin: 0 auto 1rem;
}

.login-intro, .demo-hint {
  color: var(--muted);
  line-height: 1.45;
}

.demo-hint {
  margin: 0.9rem 0 0;
  font-size: 0.84rem;
}

.app {
  min-height: 100vh;
  padding-bottom: calc(3.7rem + env(safe-area-inset-bottom));
}

.screen {
  width: min(100%, 34rem);
  margin: 0 auto;
  padding: 0.75rem 0.7rem 1rem;
}

.view { display: none; }
.view.is-active { display: block; }

.calendar-header {
  display: grid;
  grid-template-columns: 2.8rem 1fr 2.8rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0 0.65rem;
  text-align: center;
}

.calendar-header h1 {
  font-size: 1.72rem;
  margin: 0;
}

#week-label {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.round-btn {
  width: 2.8rem;
  height: 2.8rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--leaf);
  font-size: 2.1rem;
  line-height: 1;
}

.planning-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.42rem;
  margin-bottom: 0.7rem;
}

.filter-pill {
  min-height: 2.25rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 0.35rem;
  font-size: 0.76rem;
  font-weight: 900;
  white-space: nowrap;
}

.filter-pill span {
  display: inline-block;
  width: 0.58rem;
  height: 0.58rem;
  margin-right: 0.3rem;
  border-radius: 999px;
  background: var(--sage);
  vertical-align: 0.06rem;
}

.filter-pill[data-planning-filter="etage"] span { background: var(--leaf); }
.filter-pill.is-event span { background: var(--event); }
.filter-pill:not(.is-active) { opacity: 0.42; }

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin: 0 -0.15rem 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--line);
}

.weekdays span {
  color: var(--muted);
  text-align: center;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.28rem;
}

.day-cell {
  position: relative;
  min-height: 4.62rem;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  padding: 0.32rem 0.22rem;
  color: var(--ink);
}

.day-cell.is-empty {
  visibility: hidden;
}

.day-cell.is-selected {
  border-color: var(--leaf);
  background: #eaf3e7;
  box-shadow: inset 0 0 0 1px var(--leaf);
}

.day-cell.is-today {
  background: #fff7e4;
}

.day-number {
  display: block;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 900;
}

.marks {
  display: grid;
  gap: 0.22rem;
  margin-top: 0.42rem;
}

.mark {
  height: 0.34rem;
  border-radius: 999px;
  background: var(--sage);
}

.mark.etage { background: var(--leaf); }
.mark.event { background: var(--event); }

.legend-card, .day-panel, .card, .college-card, .doc-card {
  margin-top: 1rem;
  padding: 1rem;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.legend-card h2 {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem 1rem;
}

.legend-grid span {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
}

.line {
  width: 2.25rem;
  height: 0.42rem;
  border-radius: 999px;
  background: var(--sage);
}

.line.etage { background: var(--leaf); }
.line.event { background: var(--event); }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.day-list, .stack {
  display: grid;
  gap: 0.75rem;
}

.booking-row {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-left: 0.45rem solid var(--sage);
  border-radius: 14px;
  background: #fff;
}

.booking-row.etage { border-left-color: var(--leaf); }
.booking-row.event { border-left-color: var(--event); }
.booking-row p { margin: 0; color: var(--muted); line-height: 1.4; }

.simple-header {
  padding: 0.8rem 0 0.25rem;
}

.simple-header p {
  color: var(--muted);
  line-height: 1.45;
}

.college-card h3, .doc-card h3 { color: var(--leaf-dark); }
.college-card p, .doc-card p { margin-bottom: 0; color: var(--muted); line-height: 1.45; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.75rem 0;
}

.tag, .status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.75rem;
  padding: 0 0.65rem;
  border-radius: 999px;
  background: var(--sage-soft);
  color: var(--leaf-dark);
  font-size: 0.78rem;
  font-weight: 900;
}

.doc-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  margin: 1rem 0;
}

.doc-tabs button {
  min-height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.doc-tabs button.is-active {
  background: var(--leaf);
  color: #fff;
}

.account-hero {
  position: relative;
  overflow: hidden;
  margin: 0.6rem 0 1rem;
  padding: 2rem 1rem 1.25rem;
  text-align: center;
}

.account-hero::before,
.account-hero::after {
  content: "";
  position: absolute;
  top: 2rem;
  width: 7rem;
  height: 7rem;
  border-radius: 50%;
  background: var(--sage-soft);
  opacity: 0.75;
}

.account-hero::before { left: -3.5rem; }
.account-hero::after { right: -3.5rem; background: #efe8ce; }
.account-hero img {
  position: relative;
  z-index: 1;
  width: 7rem;
  height: 7rem;
  margin: 0 auto 1rem;
  object-fit: contain;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 0.6rem var(--sage-soft);
}

.account-hero h1 { margin-bottom: 0.25rem; }
.account-hero p { margin-bottom: 0.85rem; color: var(--muted); }

.notice {
  padding: 0.85rem;
  border-radius: 12px;
  background: #f1ebe0;
  color: #6a5648;
  line-height: 1.45;
}

.form {
  display: grid;
  gap: 0.85rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

input, textarea, select {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  padding: 0.85rem;
  outline: none;
  text-transform: none;
  letter-spacing: 0;
}

textarea { resize: vertical; line-height: 1.45; }
input:focus, textarea:focus, select:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 4px rgba(46, 104, 79, 0.12);
}

.check-row {
  grid-template-columns: auto 1fr;
  align-items: start;
  padding: 0.85rem;
  border-radius: 14px;
  background: #eef3f8;
  color: var(--ink);
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
}

.check-row input {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: 0.15rem;
}

.btn {
  min-height: 3rem;
  border: 0;
  border-radius: 14px;
  padding: 0 1rem;
  font-weight: 900;
}

.btn.small { min-height: 2.45rem; border-radius: 999px; }
.btn-primary { background: var(--leaf); color: #fff; }
.btn-secondary { background: var(--ink); color: #fff; }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }

.logout-btn {
  width: 100%;
  margin-top: 1rem;
  min-height: 3rem;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 0.15rem;
  padding: 0.35rem 0.55rem calc(0.35rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(253, 252, 248, 0.96);
  backdrop-filter: blur(12px);
}

.bottom-nav button {
  min-height: 3.1rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.bottom-nav button.is-active {
  color: var(--leaf-dark);
  background: var(--sage-soft);
}

.bottom-nav span { display: block; }
.nav-icon { font-size: 1.45rem; line-height: 1; margin-bottom: 0; }

.modal {
  width: min(92vw, 28rem);
  padding: 0;
  border: 0;
  border-radius: 22px;
  box-shadow: 0 22px 70px rgba(31, 77, 57, 0.3);
}

.modal::backdrop { background: rgba(20, 34, 26, 0.42); }
.modal-card { padding: 1rem; }

.modal-head, .modal-actions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.modal-actions { align-items: center; margin-top: 1rem; }

.icon-btn {
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 1.4rem;
}

.toast {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(5.4rem + env(safe-area-inset-bottom));
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  text-align: center;
  font-weight: 900;
  transform: translateY(160%);
  transition: transform 0.2s ease;
  z-index: 10;
  display: none;
}

.toast.is-visible {
  display: block;
  transform: translateY(0);
}

@media (min-width: 760px) {
  .calendar-grid { gap: 0.55rem; }
  .day-cell { min-height: 7.4rem; }
  .bottom-nav {
    width: min(100%, 34rem);
    margin: 0 auto;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-bottom: 0;
    border-radius: 22px 22px 0 0;
  }
}

@media (max-width: 390px) {
  .filter-pill { font-size: 0.74rem; padding: 0 0.25rem; }
  .calendar-header h1 { font-size: 1.58rem; }
  .day-cell { min-height: 4.18rem; }
  .screen { padding-left: 0.55rem; padding-right: 0.55rem; }
}

/* ---- Ajouts application dynamique ---- */
.form-error {
  margin: 0;
  padding: 0.65rem 0.8rem;
  border-radius: 12px;
  background: #fbe4dc;
  color: #9a3b1f;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
}

.head-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }

.nav-label { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.02em; margin-top: 0.1rem; }
.nav-icon { font-size: 1.3rem; }

.line.rdc { background: var(--sage); }
.mark.rdc { background: var(--sage); }

.row-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.6rem; }
.row-owner { font-size: 0.8rem; font-weight: 700; color: var(--muted); }

.mini-btn {
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 0.25rem 0.7rem;
  font-size: 0.74rem;
  font-weight: 800;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 900;
  vertical-align: 0.08rem;
}
.badge-pending { background: #fbeecb; color: #8a6412; }
.badge-refuse { background: #f2d6d6; color: #8a2b2b; }
.badge-valide { background: var(--sage-soft); color: var(--leaf-dark); }

.empty-state { color: var(--muted); font-style: italic; line-height: 1.45; }

.card-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.5rem; }

.doc-link { display: block; text-decoration: none; color: inherit; }
.doc-link:active { transform: scale(0.995); }

/* Zones RDC dans la modale */
.field-label { margin: 0 0 0.15rem; font-size: 0.82rem; font-weight: 900; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink); }
.field-hint { margin: 0 0 0.55rem; font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.zone-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; }
.zone-chip {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.6rem 0.7rem;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  text-transform: none; letter-spacing: 0; font-weight: 800; font-size: 0.9rem;
  cursor: pointer;
}
.zone-chip input { width: 1.15rem; height: 1.15rem; }
.zone-chip:has(input:checked) { border-color: var(--leaf); background: #eaf3e7; }
.zone-full { grid-column: 1 / -1; }
.zone-full:has(input:checked) { border-color: var(--sun); background: #fff7e4; }

/* Admin */
.admin-topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.8rem 1rem;
  background: var(--leaf-dark); color: #fff;
}
.admin-topbar h1 { color: #fff; font-size: 1.15rem; margin: 0; }
.admin-topbar a { color: #fff; font-weight: 800; font-size: 0.82rem; text-decoration: none; opacity: 0.9; }
.admin-tabs {
  display: flex; gap: 0.35rem; overflow-x: auto;
  padding: 0.6rem 0.7rem; background: rgba(255,255,255,0.7); border-bottom: 1px solid var(--line);
  position: sticky; top: 3.1rem; z-index: 4;
}
.admin-tabs button {
  flex: none; min-height: 2.3rem; padding: 0 0.9rem;
  border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--muted);
  font-weight: 800; font-size: 0.8rem; white-space: nowrap;
}
.admin-tabs button.is-active { background: var(--leaf); color: #fff; border-color: var(--leaf); }
.admin-main { width: min(100%, 40rem); margin: 0 auto; padding: 1rem 0.8rem 3rem; }
.admin-section { display: none; }
.admin-section.is-active { display: block; }
.admin-list { display: grid; gap: 0.7rem; }
.admin-item {
  padding: 0.85rem; border: 1px solid var(--line); border-radius: 14px; background: #fff;
}
.admin-item .row-top { margin-bottom: 0.35rem; }
.admin-item p { margin: 0.1rem 0; color: var(--muted); font-size: 0.86rem; line-height: 1.4; }
.admin-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.6rem; }
.admin-actions .btn { min-height: 2.3rem; font-size: 0.82rem; padding: 0 0.8rem; }
.btn-danger { background: #b3402a; color: #fff; }

/* ================= Ajustements v5 : débordement + rendu calendrier ================= */

/* --- Anti-débordement des champs dans les modales (date/heure/select iOS) --- */
input, select, textarea { min-width: 0; max-width: 100%; }
.form label, .form-grid > label, .form > label { min-width: 0; }
.modal { width: min(30rem, calc(100vw - 1.5rem)); max-width: calc(100vw - 1.5rem); }
.modal-card { max-width: 100%; }
select {
  appearance: none; -webkit-appearance: none;
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%232e684f' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  text-overflow: ellipsis;
}

/* --- Calendrier : cases plus hautes et aérées (rendu type Terra Potes) --- */
.day-cell {
  min-height: 6.1rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
.day-number { text-align: left; padding-left: 0.15rem; font-size: 0.95rem; }
.marks { margin-top: auto; gap: 0.26rem; }
.mark { height: 0.46rem; }

/* Jours passés estompés */
.day-cell.is-past:not(.is-selected):not(.is-today) { opacity: 0.5; }

/* --- Filtres : pastille active remplie, inactives claires --- */
.filter-pill:not(.is-active) { opacity: 1; background: #fff; color: var(--muted); border-color: var(--line); }
.filter-pill.is-active { background: var(--leaf-dark); color: #fff; border-color: var(--leaf-dark); }
.filter-pill.is-active span { background: #fff; }

@media (min-width: 760px) {
  .day-cell { min-height: 7.6rem; }
}
@media (max-width: 380px) {
  .day-cell { min-height: 5.4rem; }
}

/* ================= Ajustements v6 : nav, espacement, calendrier ================= */

/* Icônes de la barre du bas (SVG cohérents) */
.nav-icon { display: flex; justify-content: center; align-items: center; margin-bottom: 0.14rem; }
.nav-icon svg { width: 1.6rem; height: 1.6rem; display: block; }
.bottom-nav button { color: var(--muted); }
.bottom-nav button.is-active { color: var(--leaf-dark); }

/* Espacement du cadre "jour sélectionné" */
.day-panel .section-head { margin-bottom: 0.35rem; }
#selected-day-list { margin-top: 1.1rem; }
.day-list .booking-row + .booking-row { margin-top: 0.1rem; }

/* Calendrier : un poil plus haut et bar avec petite marge basse */
.day-cell { min-height: 6.5rem; }
.marks { margin-bottom: 0.12rem; }
@media (min-width: 760px) { .day-cell { min-height: 8rem; } }
@media (max-width: 380px) { .day-cell { min-height: 5.7rem; } }

/* ================= Ajustements v7 : centrage des onglets ================= */
.bottom-nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.bottom-nav .nav-icon,
.bottom-nav .nav-label { width: auto; text-align: center; }

/* ================= Ajustements v8 : missions & sous-missions ================= */
.missions-block, .missions-admin { margin-top: 0.9rem; border-top: 1px solid var(--line); padding-top: 0.7rem; }
.mission, .mission-admin {
  margin-top: 0.6rem; padding: 0.75rem;
  border: 1px solid var(--line); border-radius: 12px; background: #fbfdf9;
}
.mission h3 { margin-bottom: 0.2rem; }
.sous-missions, .sous-list { display: grid; gap: 0.5rem; margin-top: 0.55rem; }
.sous-mission, .sous-admin {
  padding: 0.6rem 0.65rem; border-radius: 10px; background: #fff; border: 1px solid var(--line);
}
.sous-mission .row-top, .sous-admin .row-top { align-items: center; gap: 0.5rem; }
.sous-mission .tags, .sous-admin .tags { margin: 0.4rem 0 0; }
.inline-form { display: flex; gap: 0.4rem; margin-top: 0.6rem; flex-wrap: wrap; align-items: center; }
.inline-form input { flex: 1 1 8rem; min-height: 2.6rem; padding: 0.55rem 0.7rem; }
.inline-form input[type="date"] { flex: 0 0 auto; }
.inline-form .btn { flex: 0 0 auto; }
.member-list { display: grid; gap: 0.5rem; }
.member-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.6rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.member-row > div { min-width: 0; overflow-wrap: anywhere; }
.member-row .btn { flex: 0 0 auto; }

/* ================= Ajustements v9 : comptes, statut d'adhésion (admin) ================= */
.badge-ok { background: var(--sage-soft); color: var(--leaf-dark); }
.badge-warn { background: #fbeecb; color: #8a6412; }
.user-line { font-size: 0.82rem; color: var(--muted); font-weight: 700; }

/* ================= Ajustements v10 : onglets admin compacts ================= */
.admin-tabs { overflow: visible; gap: 0.2rem; padding: 0.5rem 0.4rem; }
.admin-tabs button {
  flex: 1 1 0; min-width: 0; padding: 0.4rem 0.1rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.18rem;
  border-radius: 12px; font-size: 0.62rem; line-height: 1.05; white-space: normal;
  position: relative;
}
.admin-tabs button svg { width: 1.3rem; height: 1.3rem; }
.tab-badge {
  position: absolute; top: 0.2rem; right: calc(50% - 1.5rem);
  min-width: 1rem; height: 1rem; padding: 0 0.22rem;
  border-radius: 999px; background: var(--sun); color: #fff;
  font-size: 0.6rem; font-weight: 900; display: flex; align-items: center; justify-content: center;
}
.subtabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.subtabs button {
  flex: 1; min-height: 2.5rem; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; color: var(--muted); font-weight: 800; font-size: 0.85rem;
}
.subtabs button.is-active { background: var(--leaf); color: #fff; border-color: var(--leaf); }

/* ================= Ajustements v11 : débordement modale (fix grille) ================= */
/* Correctif canonique du "grid blowout" : minmax(0,1fr) autorise les colonnes à
   rétrécir sous la taille de contenu des champs date/heure natifs iOS. */
.form { grid-template-columns: minmax(0, 1fr); }
.form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
label { min-width: 0; }
.modal-card { overflow-x: hidden; }

/* ================= Ajustements v12 : champs date/heure iOS (anti-débordement fort) ================= */
/* Sur iOS, input[type=time]/[date] gardent une largeur intrinsèque et débordent
   des colonnes de grille malgré min-width:0. On retire l'apparence native pour
   qu'ils respectent la largeur 100% de leur colonne. */
input[type="date"], input[type="time"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 0.6rem; }
.form-grid > label { min-width: 0; overflow: hidden; }

/* ================= Ajustements v13 : sélecteur de zones sur le plan ================= */
.plan-picker { position: relative; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); line-height: 0; }
.plan-picker img { width: 100%; display: block; }
.plan-zone {
  position: absolute;
  border: 2px dashed rgba(31, 77, 57, 0.5);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  padding: 0;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.plan-zone.is-selected {
  border-style: solid; border-color: var(--leaf-dark);
  background: rgba(46, 104, 79, 0.28);
  box-shadow: inset 0 0 0 3px var(--leaf-dark);
}
/* ✓ dans le coin, ne recouvre pas les libellés du plan */
.plan-zone.is-selected::after {
  content: "✓";
  position: absolute; top: 5px; right: 6px;
  width: 1.4rem; height: 1.4rem; border-radius: 999px;
  background: var(--leaf-dark); color: #fff;
  font-size: 0.9rem; font-weight: 900;
  display: flex; align-items: center; justify-content: center;
}
.zone-full-btn {
  width: 100%; margin-top: 0.55rem;
  display: flex; flex-direction: column; align-items: center; gap: 0.05rem;
  padding: 0.65rem; border: 2px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink); cursor: pointer;
}
.zone-full-btn b { font-weight: 900; }
.zone-full-btn span { font-size: 0.74rem; color: var(--muted); font-weight: 700; }
.zone-full-btn.is-selected { border-color: var(--sun); background: #fff7e4; }
.zone-full-btn.is-selected span { color: #8a6412; }

/* ================= Ajustements v14 : sous-onglets Documents (libellés longs) ================= */
.doc-tabs button {
  white-space: normal;
  line-height: 1.1;
  font-size: 0.72rem;
  padding: 0.4rem 0.25rem;
  min-height: 3rem;
  border-radius: 14px;
}

/* ================= Ajustements v15 : compte (titre section) + site vitrine ================= */
.account-section-title { margin: 1rem 0 0; font-family: var(--font-display); color: var(--leaf-dark); font-size: 1.15rem; }

.site-wrap { width: min(100%, 40rem); margin: 0 auto; padding: 1rem 0.9rem 3rem; }
.site-hero { text-align: center; padding: 1.5rem 0 0.5rem; }
.site-hero img { width: 5rem; height: 5rem; object-fit: contain; margin: 0 auto 0.8rem; }
.site-intro { color: var(--muted); line-height: 1.5; }
.site-card {
  padding: 1rem; border: 2px solid var(--line); border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.9); box-shadow: var(--shadow); cursor: pointer;
}
.site-card:active { transform: scale(0.995); }
.site-card h2 { margin-bottom: 0.35rem; }
.site-card p { color: var(--muted); line-height: 1.45; margin-bottom: 0.5rem; }
.site-more { font-weight: 800; color: var(--leaf); font-size: 0.85rem; }
.site-foot { text-align: center; margin-top: 1.5rem; }
.site-foot a { color: var(--leaf); font-weight: 800; text-decoration: none; }
.detail-presentation { line-height: 1.5; color: var(--ink); }
.detail-contacts { display: grid; gap: 0.4rem; margin: 0.8rem 0; }
.detail-contact {
  display: block; padding: 0.6rem 0.7rem; border: 1px solid var(--line);
  border-radius: 10px; text-decoration: none; color: var(--leaf-dark); font-weight: 700;
}

/* ================= Ajustements v16 : logo association ================= */
.logo-edit { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.9rem; }
.logo-preview {
  flex: none; width: 4.5rem; height: 4.5rem; border-radius: 14px;
  border: 1px solid var(--line); background: #fff;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-preview span { font-size: 0.68rem; color: var(--muted); text-align: center; padding: 0 0.3rem; }
.logo-actions { display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-start; }
.logo-choose { display: inline-flex; align-items: center; }
.logo-actions .field-hint { margin: 0; }
.logo-preview--ro { width: 5.5rem; height: 5.5rem; margin-bottom: 0.8rem; }

/* Vitrine app : logos sur les cartes */
.site-card--row { display: flex; gap: 0.9rem; align-items: flex-start; }
.site-logo { flex: none; width: 3.4rem; height: 3.4rem; border-radius: 999px; overflow: hidden; background: var(--sage-soft); display: flex; align-items: center; justify-content: center; border: 1px solid var(--line); }
.site-logo img { width: 100%; height: 100%; object-fit: cover; }
.site-logo--ph { font-family: var(--font-display); font-size: 1.4rem; color: var(--leaf-dark); }
.site-card-body { min-width: 0; }
.detail-logo { width: 4.5rem; height: 4.5rem; border-radius: 999px; overflow: hidden; margin-bottom: 0.8rem; background: var(--sage-soft); }
.detail-logo img { width: 100%; height: 100%; object-fit: cover; }

/* ================= Ajustements v17 : photo de couverture asso ================= */
.fiche-photo { width: 100%; border-radius: 14px; overflow: hidden; margin-bottom: 0.9rem; border: 1px solid var(--line); }
.fiche-photo img { width: 100%; display: block; max-height: 14rem; object-fit: cover; }
.photo-edit { margin-bottom: 0.9rem; }
.photo-preview { width: 100%; height: 8rem; border-radius: 12px; border: 1px solid var(--line); background: #fff; overflow: hidden; display: flex; align-items: center; justify-content: center; margin: 0.4rem 0; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview span { color: var(--muted); font-size: 0.8rem; }
.photo-actions { display: flex; flex-direction: column; gap: 0.35rem; align-items: flex-start; }
.photo-actions .field-hint { margin: 0; }

/* ================= Ajustements v18 : boutons logo/photo côte à côte ================= */
.logo-preview--edit { width: 5.5rem; height: 5.5rem; margin-bottom: 0.55rem; }
.img-btns { display: flex; gap: 0.5rem; }
.img-btns .img-btn {
  flex: 1 1 0; min-width: 0; min-height: 2.7rem;
  display: inline-flex; align-items: center; justify-content: center; text-align: center;
  padding: 0 0.6rem; grid-template-columns: none;
}
