/* LFC Logistique — mobile workspace */
@media (max-width: 700px) {
  body { font-size: 15px; overflow-x: hidden; padding-bottom: 76px; }
  .app-shell { display: block; }

  /* Navigation becomes a thumb-friendly bottom bar. */
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    width: 100%; height: 72px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: rgba(16,42,67,.98);
    box-shadow: 0 -8px 24px rgba(16,42,67,.16);
    display: flex; align-items: stretch;
  }
  .brand, .sidebar-bottom { display: none; }
  .sidebar nav {
    display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px;
    width: 100%; overflow: visible;
  }
  .nav-item {
    white-space: normal; justify-content: center; flex-direction: column;
    gap: 2px; padding: 5px 3px; border-radius: 9px;
    font-size: 12px; line-height: 1.1; text-align: center; padding-inline: 1px; hyphens: auto; overflow-wrap: anywhere;
  }
  .nav-item span { font-size: 17px; width: auto; line-height: 1; }
  .nav-item.active { box-shadow: inset 0 3px 0 var(--amber); }

  .topbar {
    height: auto; min-height: 74px; padding: 14px 15px;
    align-items: center; gap: 10px;
  }
  .eyebrow { font-size: 12px; margin-bottom: 3px; }
  .topbar h1 { font-size: 20px; line-height: 1.15; }
  .top-actions { display: flex; align-items: center; gap: 0; }
  .top-actions .button {
    white-space: normal; padding: 9px 10px; font-size: 12px;
    line-height: 1.15; text-align: center; min-height: 42px;
  }
  .content { padding: 20px 15px 30px; }
  .welcome-row, .section-heading {
    align-items: stretch; flex-direction: column; gap: 13px;
  }
  .welcome-row { margin-bottom: 20px; }
  .content h2 { font-size: 19px; }
  .date-chip { align-self: flex-start; }

  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 27px; }
  .metric { padding: 14px 13px; border-radius: 10px; }
  .metric-label { font-size: 12px; line-height: 1.25; }
  .metric-value { font-size: 25px; margin: 8px 0 2px; }
  .metric-note { font-size: 12px; }
  .section-heading { margin-bottom: 13px; }
  .filter-group { align-self: stretch; width: 100%; }
  .filter { flex: 1; padding: 9px 6px; font-size: 12px; }

  /* Operations become readable cards instead of a tiny desktop table. */
  .operations-card { border-radius: 10px; overflow: visible; background: transparent; border: 0; }
  .table-wrap { overflow: visible; }
  table { min-width: 0; width: 100%; border-collapse: separate; border-spacing: 0; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; }
  tr {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px; padding: 14px; background: var(--p-blanc);
    border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 3px 12px rgba(16,42,67,.045);
  }
  td { padding: 0; border: 0; min-width: 0; font-size: 13px; }
  td:nth-child(1) { grid-column: 1 / -1; }
  td:nth-child(2), td:nth-child(3), td:nth-child(4), td:nth-child(5), td:nth-child(6) {
    padding-top: 7px; border-top: 1px solid #edf1f3;
  }
  td:nth-child(2)::before, td:nth-child(3)::before, td:nth-child(4)::before, td:nth-child(5)::before {
    display: block; color: var(--muted); font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px;
  }
  /* Ces intitulés sont ceux du tableau des opérations : posés sur tout <table>, ils rangeaient le code provisoire de
     « Créer plusieurs comptes » sous « Responsable » (nuit des agents du 19/11, constat D-55). */
  #operations-body td:nth-child(2)::before { content: 'Chantier'; }
  #operations-body td:nth-child(3)::before { content: 'Créneau'; }
  #operations-body td:nth-child(4)::before { content: 'Responsable'; }
  #operations-body td:nth-child(5)::before { content: 'Affecté à'; }
  td:nth-child(2) { grid-column: 1 / -1; overflow-wrap: anywhere; }
  td:nth-child(3) { grid-column: 1; }
  td:nth-child(4) { grid-column: 1 / -1; }
  td:nth-child(5) { grid-column: 1; }
  td:nth-child(6) { grid-column: 2; grid-row: 4; align-self: end; border-top: 0; padding-top: 0; }
  td:nth-child(7) { grid-column: 2; grid-row: 3; align-self: end; }
  .operation-name { align-items: flex-start; }
  .operation-name > div { min-width: 0; overflow-wrap: anywhere; }
  .operation-sub { line-height: 1.35; }
  .owner { min-width: 0; overflow-wrap: anywhere; }
  .status { font-size: 12px; padding: 5px 7px; }
  .row-action { font-size: 12px; padding: 6px 0; }
  .empty-state { background: var(--p-blanc); border: 1px solid var(--line); border-radius: 10px; padding: 35px 20px; }

  .planning-board, .returns-grid { grid-template-columns: 1fr; gap: 10px; }
  .board-column { min-height: 0; padding: 11px; }
  .board-column h3 { margin-bottom: 10px; }
  .board-card { padding: 13px; margin-bottom: 8px; }
  .page-heading .button { width: 100%; min-height: 44px; }
  .return-card { padding: 15px; }

  /* The form stays usable above the phone keyboard and remains easy to cancel. */
  dialog {
    width: calc(100% - 16px); max-height: calc(100dvh - 16px);
    margin: auto; border-radius: 13px; overflow: hidden;
  }
  /* Chaque fenêtre défile à l'intérieur : la photo et les boutons du bas restent atteignables (retours machine, parc matériel, fiches). */
  dialog > form, dialog > div { max-height: calc(100dvh - 16px); overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  #operation-form { padding: 20px; }
  dialog form .dialog-actions { position: sticky; bottom: -20px; margin-inline: -20px; margin-bottom: -20px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px)); background: var(--surface); border-top: 1px solid var(--line); z-index: 1; }
  .dialog-head { padding-bottom: 15px; margin-bottom: 18px; }
  .dialog-head h2 { font-size: 18px; }
  .form-grid { grid-template-columns: 1fr; gap: 13px; }
  .form-grid label.full { grid-column: auto; }
  .form-grid input, .form-grid select, .form-grid textarea {
    font-size: 16px; padding: 11px; margin-top: 5px;
  }
  .dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  dialog form { padding: 20px; }
  .dialog-actions .button { min-height: 44px; padding: 10px 8px; }
}

@media (max-width: 360px) {
  .topbar h1 { font-size: 18px; }
  .top-actions .button { font-size: 12px; padding-inline: 8px; }
  .metric { padding-inline: 10px; }
  .metric-value { font-size: 23px; }
}

/* v0.112 — iPhone : Safari zoome sur un champ dont le texte fait moins de 16 px (§96). */
@media (max-width: 700px) {
  input, select, textarea { font-size: 16px; }
}
