/* Application quotidienne : charger après app.css.
   Les routes, panneaux masqués et états des étapes restent gérés par app.js. */

/* 1. Lecture, contrôles et largeur de travail */
:root {
  --app-gutter: 16px;
  --app-tab-height: 64px;
  --app-focus: #85641d;
}

body {
  font-size: 16px;
  line-height: 1.55;
}

body[data-theme="dark"] {
  --app-focus: #d6be83;
}

h1 {
  font-size: clamp(34px, 4vw, 44px);
  line-height: 1.08;
}

h2 {
  font-size: 28px;
}

h3 {
  font-size: 24px;
}

.workspace main {
  max-width: 1080px;
  padding: 32px;
}

.workspace,
.view,
.panel,
form,
fieldset,
.field-pair > *,
.edit-row > * {
  min-inline-size: 0;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: .07em;
  line-height: 1.5;
}

.helper,
.caption,
.empty,
.form-feedback,
.edit-row .field-error,
.event-description,
.event-copy > .event-description,
.next-event .event-description,
.team-intro p,
.prototype-tools,
.confirmation p {
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.page-heading > div > p:last-child:not(.eyebrow),
.announcement,
.schedule-day,
.schedule-day strong,
.schedule-time,
.status-bottom strong,
.access-panel p,
.day-session p,
.day-session strong {
  font-size: 15px;
  line-height: 1.5;
}

.schedule-day span,
.announcement time,
.event-copy .event-date,
.next-event .event-date,
.event-meta,
.team-event-row p,
.status-bottom small,
.edit-status,
.app-footer {
  font-size: 13px;
  line-height: 1.5;
}

.button,
.text-button,
.quiet,
.editor .actions .text-button,
.segmented button {
  min-height: 48px;
  font-size: 15px;
  line-height: 1.35;
  white-space: normal;
}

.icon-button {
  min-width: 48px;
  min-height: 48px;
}

button,
a,
input,
textarea,
select,
summary {
  scroll-margin-block: 100px;
}

:is(button, a, input, textarea, select, summary):focus-visible {
  outline: 3px solid var(--app-focus);
  outline-offset: 3px;
}

.editor label,
.editor-dialog label,
.choice-field legend {
  font-size: 15px;
  line-height: 1.45;
}

.editor input:not([type="radio"]),
.editor textarea,
.editor-dialog input:not([type="hidden"]),
.editor-dialog textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 48px;
  font-size: 16px;
}

.choice-field {
  flex-wrap: wrap;
}

.choice-field label {
  min-height: 48px;
  font-size: 15px;
}

.choice-field input[type="radio"] {
  width: 20px;
  height: 20px;
  flex: none;
}

.panel {
  padding: 24px;
  margin-bottom: 20px;
  border-radius: 10px;
}

.section-heading {
  flex-wrap: wrap;
  gap: 12px;
}

.section-heading h2 {
  font-size: 28px;
}

.team-grid {
  display: block;
}

.live-sync {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.live-sync.is-error {
  padding: 12px 16px;
  border-left: 3px solid var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.status-panel.stale .dot,
.status-panel.unknown .dot {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--muted);
}

#team-login {
  max-width: 500px;
}

#team-login-form label {
  display: block;
  margin: 24px 0 8px;
  font-size: 15px;
}

#team-code {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--strong-line);
  border-radius: 5px;
  font-size: 20px;
  letter-spacing: .2em;
}

#team-login-form > .button {
  margin-top: 20px;
}

.team-session {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 14px;
  margin-bottom: 20px;
  color: var(--muted);
}

#live-services summary,
.event-import summary {
  cursor: pointer;
  min-height: 44px;
  display: list-item;
  padding-block: 8px;
  color: var(--gold-ink);
}

#live-services .actions {
  margin-top: 20px;
}

.event-import {
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

#legacy-dates-note {
  padding: 12px;
  background: var(--accent-soft);
  border-left: 2px solid var(--gold-ink);
}

/* Accès repris de l'application en service. */
.salle-shortcuts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 24px;
}

.salle-shortcuts a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 64px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.salle-shortcuts a:hover {
  background: var(--soft);
  border-color: var(--strong-line);
}

.salle-shortcuts svg {
  color: var(--gold-ink);
}

.messages-feed {
  display: grid;
  gap: 16px;
  max-width: 800px;
}

.messages-feed .message-card {
  margin: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 16px;
  line-height: 1.65;
}

.message-card time {
  color: var(--gold-ink);
  font-size: 13px;
}

@media (max-width: 340px) {
  .salle-shortcuts {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .salle-shortcuts a {
    min-height: 52px;
    padding: 12px 14px;
  }
}

/* 2. Accueil de l'équipe : quatre actions, un écran à la fois */
.team-home {
  margin-block: 20px;
}

.team-home > nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.team-home > .team-intro,
.team-home > .prototype-tools {
  margin-top: 20px;
}

.team-action {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 16px;
  min-height: 108px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.team-action:hover,
.team-action:active {
  background: var(--soft);
  border-color: var(--strong-line);
}

.team-action-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 9px;
  background: var(--soft);
  color: var(--gold-ink);
}

.team-action-icon svg {
  width: 25px;
  height: 25px;
}

.team-action-copy {
  min-width: 0;
}

.team-action-copy strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.team-action-copy small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.team-action-arrow {
  justify-self: end;
  color: var(--muted);
}

.team-back {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-block: 0 20px;
}

.team-back > :is(a, button) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 48px;
  padding: 8px 0;
  font-size: 15px;
  text-decoration: none;
}

.team-screen-title {
  min-width: 0;
  margin: 0;
  font: 500 30px/1.15 var(--serif);
}

[data-team-screen] {
  max-width: 800px;
}

.team-event-row {
  align-items: flex-start;
}

.team-event-row > div:first-child {
  min-width: 0;
}

.team-event-row h3 {
  font-size: 26px;
}

.team-event-row .actions {
  margin-top: 0;
  gap: 8px;
}

/* 3. Éditeur de stage : contenu défilant et commandes de progression */
#event-editor {
  width: min(760px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
}

#event-editor[open] {
  display: flex;
  flex-direction: column;
}

#event-editor > .dialog-heading {
  align-items: center;
  flex: none;
  gap: 12px;
  margin: 0;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
}

#event-editor .dialog-heading > div {
  min-width: 0;
}

#event-editor .dialog-heading h2 {
  margin-top: 4px;
  font-size: 30px;
  line-height: 1.1;
}

#form-event {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-padding-block: 20px 120px;
  -webkit-overflow-scrolling: touch;
}

.event-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: none;
  gap: 4px;
  margin: 0;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.event-steps button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 48px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.event-steps button > span {
  display: inline-flex;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
}

.event-steps button:hover {
  background: var(--soft);
}

.event-steps button[aria-current]:not([aria-current="false"]),
.event-steps button[aria-selected="true"],
.event-steps button[aria-pressed="true"] {
  border-color: var(--strong-line);
  background: var(--soft);
  color: var(--text);
  font-weight: 600;
}

.event-step {
  flex: 1 0 auto;
  min-width: 0;
  padding: 20px 24px 28px;
}

.event-step > label:first-child {
  margin-top: 0;
}

.event-step .sessions-field {
  min-inline-size: 0;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
}

.event-step .sessions-field legend {
  margin-bottom: 12px;
  padding: 0;
  font-size: 25px;
}

#form-event > .form-feedback {
  margin: 0;
  padding: 0 24px 16px;
}

.event-step-actions {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  flex: none;
  gap: 12px;
  margin-top: auto;
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.event-step-actions button {
  min-height: 50px;
  font-size: 15px;
  line-height: 1.35;
}

.event-draft-note {
  flex: none;
  margin: 0;
  padding: 0 24px 16px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

#event-prev {
  flex: 0 1 38%;
  min-width: 88px;
  max-width: 160px;
  padding-inline: 12px;
}

#event-next,
#event-save {
  flex: 1 1 0;
  max-width: 320px;
  margin-inline-start: auto;
  padding-inline: 14px;
}

.event-detail-body .description {
  font-size: 16px;
  line-height: 1.6;
}

.session-list li {
  font-size: 15px;
}

.session-list small {
  font-size: 14px;
  line-height: 1.5;
}

/* 4. Téléphone : barre de navigation basse, lecture prioritaire de l'ouverture */
@media (max-width: 820px), (max-height: 500px) and (pointer: coarse) {
  :root {
    --app-gutter: max(16px, env(safe-area-inset-left), env(safe-area-inset-right));
  }

  html {
    scroll-padding-top: calc(76px + env(safe-area-inset-top));
    scroll-padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .shell {
    display: block;
  }

  .rail {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    justify-content: center;
    height: calc(60px + env(safe-area-inset-top));
    padding: calc(8px + env(safe-area-inset-top)) var(--app-gutter) 8px;
  }

  .brand {
    width: max-content;
    min-height: 44px;
    gap: 10px;
  }

  .brand img {
    width: 24px;
    height: 36px;
  }

  .brand span {
    font-size: 18px;
    letter-spacing: .12em;
  }

  .brand small {
    margin-top: 4px;
    font-size: 10px;
    letter-spacing: .06em;
  }

  .rail-footer {
    display: none;
  }

  .app-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    min-height: calc(var(--app-tab-height) + env(safe-area-inset-bottom));
    margin: 0;
    padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
    border-top: 1px solid #44413a;
    background: var(--ink);
  }

  .app-nav a {
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    max-width: none;
    min-height: var(--app-tab-height);
    padding: 7px 8px;
    border: 0;
    border-radius: 0;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
  }

  .app-nav a[aria-current] {
    background: #2b2922;
    color: var(--gold);
  }

  .app-nav svg {
    width: 23px;
    height: 23px;
  }

  .dirty-dot {
    position: absolute;
    top: 9px;
    right: calc(50% - 23px);
    margin: 0;
  }

  .workspace {
    padding-bottom: calc(var(--app-tab-height) + 20px + env(safe-area-inset-bottom));
  }

  .workspace main {
    padding: 20px var(--app-gutter) 16px;
  }

  .trial-bar {
    min-height: 48px;
    padding: 2px var(--app-gutter);
    gap: 8px;
    font-size: 13px;
    line-height: 1.4;
  }

  .trial-bar > div {
    flex: none;
    gap: 4px;
  }

  .trial-bar .icon-button {
    min-width: 44px;
    min-height: 44px;
  }

  .trial-bar .theme-toggle {
    min-width: 0;
    min-height: 44px;
    font-size: 12px;
  }

  .trial-detail {
    display: none;
  }

  .page-heading {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    margin-bottom: 18px;
  }

  .page-heading h1 {
    margin: 4px 0 6px;
    font-size: 36px;
  }

  .page-heading > .text-button {
    display: none;
  }

  #view-salle .page-heading > div > p:last-child:not(.eyebrow) {
    display: none;
  }

  .salle-hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
  }

  .status-panel {
    min-height: 0;
    padding: 20px;
    border-radius: 10px;
  }

  .status-value {
    gap: 14px;
    margin-block: 10px 12px;
  }

  .status-value h2 {
    font-size: 40px;
    line-height: 1.05;
  }

  .status-panel p.status-message {
    font-size: 15px;
    line-height: 1.5;
  }

  .status-bottom {
    gap: 10px;
    margin-top: 18px;
    padding-top: 14px;
  }

  .status-bottom > div {
    min-width: 0;
  }

  .status-bottom small {
    font-size: 13px;
  }

  .status-bottom strong {
    font-size: 15px;
    line-height: 1.5;
  }



  .dashboard-grid {
    display: block;
  }

  .panel {
    padding: 16px;
    margin-bottom: 16px;
  }

  .section-heading {
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 16px;
  }

  .section-heading h2 {
    font-size: 27px;
    line-height: 1.15;
  }

  .section-heading > .caption {
    display: none;
  }

  .schedule-row {
    gap: 12px;
    padding-block: 14px;
  }

  .schedule-time {
    font-size: 14px;
  }

  .next-event h3 {
    margin-block: 10px;
    font-size: 28px;
  }

  .event-meta {
    gap: 6px;
    margin-block: 12px;
  }

  .tag {
    max-width: 100%;
    padding: 5px 8px;
  }

  .announcement {
    padding-block: 14px;
  }

  .access-panel {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding-block: 16px;
  }

  .access-panel h2 {
    font-size: 25px;
  }

  .access-panel .actions > .button {
    flex: 1;
  }

  .app-footer {
    flex-wrap: wrap;
    padding: 12px var(--app-gutter) 20px;
    gap: 8px 16px;
    font-size: 12px;
  }

  .app-footer a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .global-feedback,
  .storage-error {
    margin: 12px var(--app-gutter) 0;
    padding: 12px;
    font-size: 15px;
    line-height: 1.5;
    overflow-wrap: anywhere;
  }

  .global-feedback button {
    margin-inline-start: 0;
  }

  /* 5. Stages et calendrier : sept vraies cibles de 44 px dès 320 px */
  .segmented {
    display: flex;
    width: 100%;
  }

  .segmented button {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    font-size: 15px;
  }

  .event-card {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 14px;
    min-height: 0;
    margin-bottom: 16px;
    padding: 16px;
    border-radius: 10px;
  }

  .event-card > img {
    align-self: start;
    width: 76px;
    height: 100px;
    border-radius: 6px;
    object-fit: cover;
  }

  .event-card .event-copy {
    min-width: 0;
    padding: 0;
  }

  .event-card h2 {
    margin-block: 6px 10px;
    font-size: 27px;
    line-height: 1.1;
  }

  .event-card .event-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 15px;
  }

  .event-card .text-button {
    justify-content: flex-start;
    text-align: left;
  }

  #events-calendar {
    width: calc(100% + var(--app-gutter) + var(--app-gutter));
    max-width: none;
    margin-inline: calc(-1 * var(--app-gutter));
    padding: 16px 6px;
    border-inline: 0;
    border-radius: 0;
  }

  .calendar-toolbar,
  #events-calendar > .helper,
  #calendar-day {
    margin-inline: 10px;
  }

  .calendar-toolbar {
    gap: 8px;
  }

  .calendar-toolbar h2 {
    min-width: 0;
    font-size: 26px;
    line-height: 1.2;
    text-align: center;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
    margin-top: 16px;
  }

  .calendar-weekday {
    min-width: 0;
    padding-bottom: 8px;
    font-size: 12px;
  }

  .calendar-cell {
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    font-size: 15px;
    line-height: 1;
    border-radius: 5px;
  }

  .calendar-cell.has-event::after {
    bottom: 5px;
    width: 4px;
    height: 4px;
  }

  #calendar-day {
    margin-top: 18px;
    padding-top: 16px;
  }

  .day-session {
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
  }

  .day-session .text-button {
    justify-content: flex-start;
  }

  /* 6. Équipe : listes d'actions et formulaires sans colonnes trop étroites */
  .team-home {
    margin-block: 16px;
  }

  .team-home > nav {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .team-action {
    grid-template-columns: 44px minmax(0, 1fr) 20px;
    gap: 12px;
    min-height: 96px;
    padding: 16px;
  }

  .team-action-icon {
    width: 44px;
    height: 44px;
  }

  .team-action-arrow svg {
    width: 20px;
    height: 20px;
  }

  .team-intro {
    gap: 10px;
    padding: 14px;
    margin-bottom: 16px;
  }

  .team-back {
    gap: 12px;
    margin-bottom: 16px;
  }

  .team-screen-title {
    font-size: 28px;
  }

  .team-back .team-screen-title {
    font-size: 26px;
  }

  .editor .section-heading {
    align-items: flex-start;
  }

  .edit-status {
    padding: 5px 8px;
    white-space: normal;
  }

  .field-pair {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .edit-row,
  .sessions-field .edit-row {
    position: relative;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
    padding: 16px 0 20px;
  }

  .edit-row > .row-date {
    grid-column: 1 / -1;
    grid-row: 1;
    padding-inline-end: 60px;
  }

  .edit-row > .row-start {
    grid-column: 1;
    grid-row: 2;
  }

  .edit-row > .row-end {
    grid-column: 2;
    grid-row: 2;
  }

  .edit-row label {
    margin: 0 0 8px;
  }

  .edit-row > .icon-button {
    position: absolute;
    inset-block-start: 46px;
    inset-inline-end: 0;
    grid-row: auto;
    grid-column: auto;
    margin: 0;
  }

  .edit-row input[type="date"],
  .edit-row input[type="time"] {
    min-width: 0;
    max-width: 100%;
    padding-inline: 10px;
  }

  .edit-row input::-webkit-date-and-time-value {
    min-width: 0;
    text-align: left;
  }

  .edit-row input::-webkit-datetime-edit {
    min-width: 0;
    padding: 0;
  }

  .edit-row input::-webkit-calendar-picker-indicator {
    width: 20px;
    padding: 0;
    margin-inline-start: 2px;
  }

  .editor .actions {
    align-items: stretch;
    gap: 8px;
    margin-top: 20px;
  }

  .editor .actions > .button,
  #add-slot,
  #add-session,
  #new-event {
    width: 100%;
  }

  .editor .actions > .text-button {
    width: 100%;
    text-align: center;
  }

  #add-slot,
  #add-session {
    justify-content: flex-start;
    padding-inline: 4px;
  }

  .team-event-row {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding-block: 16px;
  }

  .team-event-row .actions {
    flex-wrap: wrap;
    gap: 8px 16px;
  }

  .team-event-row .actions > .button {
    flex: 1;
  }

  .prototype-tools summary {
    min-height: 48px;
    padding-block: 12px;
    font-size: 15px;
  }

  /* 7. Dialogues : plein écran pour écrire, contenu défilant sous le clavier */
  #event-editor {
    position: fixed;
    inset: var(--app-viewport-top, 0px) 0 auto;
    width: 100%;
    max-width: none;
    height: var(--app-visible-height, 100dvh);
    max-height: var(--app-visible-height, 100dvh);
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  #event-editor > .dialog-heading {
    padding: calc(12px + env(safe-area-inset-top)) var(--app-gutter) 12px;
  }

  #event-editor .dialog-heading h2 {
    font-size: 28px;
  }

  #event-editor .dialog-heading .eyebrow {
    font-size: 12px;
  }

  #form-event {
    scroll-padding-block: 16px 120px;
  }

  .event-steps {
    padding: 10px var(--app-gutter);
  }

  .event-steps button {
    padding-inline: 6px;
  }

  .event-step {
    padding: 20px var(--app-gutter) 28px;
  }

  #form-event > .form-feedback {
    padding: 0 var(--app-gutter) 16px;
  }

  .event-step-actions {
    padding: 12px var(--app-gutter) max(12px, env(safe-area-inset-bottom));
  }

  .event-draft-note {
    padding-inline: var(--app-gutter);
  }

  body[data-keyboard-open="true"] .app-nav {
    display: none;
  }

  body[data-keyboard-open="true"] .workspace {
    padding-bottom: 20px;
  }

  body[data-keyboard-open="true"] #event-editor > .dialog-heading {
    padding-block: 8px;
  }

  body[data-keyboard-open="true"] #event-editor .dialog-heading .eyebrow {
    display: none;
  }

  body[data-keyboard-open="true"] .event-steps {
    padding-block: 6px;
  }

  body[data-keyboard-open="true"] .event-step-actions {
    padding-block: 8px;
  }

  .photo-preview {
    max-width: 100%;
    max-height: 180px;
  }

  .event-dialog {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
    scroll-padding-block: 16px;
  }

  .event-detail-image {
    height: 150px;
  }

  .event-detail-body {
    padding: 20px;
  }

  .event-detail-body h2 {
    font-size: 32px;
  }

  .event-detail-body > .button {
    width: 100%;
  }

  .confirmation {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    padding: 20px;
    overflow-y: auto;
  }

  .confirmation h2 {
    font-size: 30px;
  }

  .confirmation .actions {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .confirmation .actions > .button,
  .confirmation > .button {
    width: 100%;
  }
}

/* 8. Petits téléphones et faible hauteur disponible */
body:has(#event-editor[open]) {
  overflow: hidden;
}

.event-step > h3:focus {
  outline: none;
}

.event-card:not(:has(> img)) {
  grid-template-columns: minmax(0, 1fr);
}

.event-card > div:empty {
  display: none;
}

@media (max-width: 380px) {
  .event-card {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .event-card > img {
    width: 64px;
    height: 88px;
  }

  .event-card h2 {
    font-size: 26px;
  }

  .team-action {
    padding: 14px;
    gap: 10px;
  }

  .schedule-row {
    gap: 8px;
  }

  .schedule-time {
    font-size: 14px;
  }
}

@media (max-height: 520px) and (max-width: 1024px) {
  #event-editor > .dialog-heading {
    padding-block: max(8px, env(safe-area-inset-top)) 8px;
  }

  #event-editor .dialog-heading h2 {
    font-size: 26px;
  }

  #event-editor .dialog-heading .eyebrow {
    display: none;
  }

  .event-steps {
    padding-block: 6px;
  }

  .event-steps button {
    min-height: 44px;
  }

  .event-step {
    padding-top: 12px;
  }

  .event-step-actions {
    padding-block: 8px max(8px, env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .team-action,
  .event-steps button {
    transition: none;
  }
}

.status-messages label{display:block;margin:20px 0 8px}
.team-message-history{margin-top:36px;padding-top:24px;border-top:1px solid var(--line)}
.published-message{padding:16px 0;border-bottom:1px solid var(--line)}
.published-message .announcement{padding:0;border:0}
.published-message .danger-text{margin-top:12px}

.sharing-dialog{width:min(580px,calc(100vw - 24px));max-height:calc(100dvh - 24px);padding:0;overflow:auto;background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:10px}
.sharing-dialog .dialog-heading{padding:20px;display:flex;justify-content:space-between;gap:16px}
.sharing-body{padding:0 20px 20px}
#share-preview{display:block;width:min(100%,280px);height:auto;margin:16px auto}
#share-preview[hidden]{display:none}
#share-caption{width:100%;font:inherit;font-size:16px;line-height:1.5;resize:vertical;padding:12px;background:var(--surface);color:var(--text);border:1px solid var(--strong-line);margin:8px 0 16px}

/* Repères de l’ancienne app : titres directs, état coloré, commandes franches. */
:root {
  --room-open: #176d40;
  --room-open-soft: #e3f3e8;
  --room-closed: #a92f3d;
  --room-closed-soft: #f9e5e7;
  --button-open: #177342;
  --button-close: #b53142;
}
body[data-theme="dark"] {
  --room-open: #73dda0;
  --room-open-soft: #19352a;
  --room-closed: #ff9eaa;
  --room-closed-soft: #3b232a;
}
h1, h2, h3, .team-screen-title {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: -.035em;
}
h1 { font-size: clamp(32px, 4vw, 42px); }
h2, .section-heading h2 { font-size: 23px; }
h3 { font-size: 21px; }
.page-heading { margin-bottom: 20px; }
.page-heading h1 { margin-block: 4px; }
.page-heading > div > .eyebrow:only-child { margin: 0; }
.section-heading { margin-bottom: 12px; }
.panel { border-radius: 18px; }
.button, .segmented, .segmented button, .tag { border-radius: 12px; }
.button { font-weight: 600; }
.button, .icon-button, .status-choice {
  transition: background-color 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}
.button:active, .icon-button:active, .status-choice:active { filter: brightness(.9); }
.empty { padding-block: 12px; }

.status-panel,
body[data-theme="dark"] .status-panel {
  --state: var(--room-open);
  --state-soft: var(--room-open-soft);
  min-height: 0;
  padding: 22px;
  background: var(--state-soft);
  color: var(--text);
  border: 1px solid var(--state);
  border-inline-start-width: 6px;
  border-radius: 22px;
}
.status-panel.closed { --state: var(--room-closed); --state-soft: var(--room-closed-soft); background: var(--state-soft); }
body[data-theme="dark"] .status-panel.closed { --state: var(--room-closed); --state-soft: var(--room-closed-soft); }
.status-panel.unknown, .status-panel.stale,
body[data-theme="dark"] .status-panel.unknown,
body[data-theme="dark"] .status-panel.stale { --state: var(--muted); --state-soft: var(--soft); }
.status-panel > .eyebrow { color: var(--state); font-size: 12px; font-weight: 600; }
.status-value { margin-block: 12px; gap: 16px; }
.status-value h2 { font: 700 clamp(36px, 6vw, 48px)/1.1 var(--sans); letter-spacing: -.05em; }
.status-panel .status-value .dot {
  width: 17px;
  height: 17px;
  background: var(--state);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--state) 15%, transparent);
}
.status-panel.unknown .status-value .dot, .status-panel.stale .status-value .dot {
  background: transparent;
  box-shadow: inset 0 0 0 2px var(--muted);
}
.status-panel p.status-message { color: var(--text); }
.status-panel .source-updated { color: var(--muted); margin-top: 8px; }
.status-bottom { margin-top: 16px; padding-top: 14px; border-color: var(--state); }
.status-bottom small { color: var(--muted); }
.status-bottom strong { color: var(--text); }

.salle-shortcuts { gap: 12px; }
.salle-shortcuts .button { background: var(--surface); border-color: var(--line); border-radius: 16px; }
.salle-shortcuts .button:first-child { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.salle-shortcuts svg { width: 24px; height: 24px; }
.salle-shortcuts .button:hover { filter: brightness(.96); }
.team-action { border-radius: 18px; min-height: 84px; padding-block: 16px; }
.team-action-icon { border-radius: 14px; background: var(--accent-soft); }
.team-action-copy strong { font-size: 17px; }
.team-action-copy small { font-size: 13px; }
.team-action[href="#equipe/ouverture"] .team-action-icon { color: var(--room-open); background: var(--room-open-soft); }
.team-screen-title { font-size: 28px; }
.team-home { margin-block: 16px; }
.access-panel h2 { font: 700 23px/1.2 var(--sans); letter-spacing: -.03em; }
.next-event h3 { font-size: 27px; }
.message-card { border-radius: 18px; }

#form-status .choice-field { gap: 14px; margin-block: 10px 24px; }
#form-status .choice-field legend { margin-bottom: 12px; }
#form-status .status-choice {
  flex: 1;
  min-width: 128px;
  min-height: 72px;
  justify-content: center;
  gap: 9px;
  padding: 14px 12px;
  border: 2px solid transparent;
  border-radius: 16px;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  background: var(--button-open);
  cursor: pointer;
}
#form-status .status-choice-close { background: var(--button-close); }
#form-status .status-choice:has(input:checked) {
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--text);
}
#form-status .status-choice input { accent-color: #fff; }
#form-status .status-choice:has(input:focus-visible) { outline: 3px solid var(--app-focus); outline-offset: 6px; }
#form-status .status-choice:has(input:disabled) { opacity: .6; cursor: wait; }
#form-status .status-choice svg { width: 22px; height: 22px; }

@media (max-width: 760px) {
  .workspace main { padding-top: 20px; }
  .page-heading { margin-bottom: 16px; gap: 14px; }
  .page-heading h1 { font-size: 32px; }
  .status-panel, body[data-theme="dark"] .status-panel { padding: 20px; }
  .salle-hero { margin-bottom: 16px; }
  .team-action { min-height: 82px; padding-block: 14px; }
  .section-heading h2 { font-size: 22px; }
  .event-card h2 { font-size: 25px; }
  .status-panel .source-updated { font-size: 12px; }
  .app-nav a[aria-current] { border-radius: 14px; background: var(--gold); color: var(--ink); }
  #form-status .status-choice { font-size: 16px; }
}
@media (max-width: 360px) {
  #form-status .status-choice { min-width: 116px; gap: 6px; padding-inline: 8px; }
  #form-status .status-choice svg { width: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .button, .icon-button, .status-choice { transition: none; }
}
