/* MB@Work — interface chantier (mobile d'abord) */

:root {
  --brand: #23598f;
  --brand-strong: #1a466f;
  --brand-soft: #e8f0f8;
  --appbar: #23598f;
  --accent: #f59e0b;
  --bg: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --text: #13202d;
  --text-soft: #5a6a7c;
  --line: #dde3ea;
  --ok: #1d7a3a;
  --ok-bg: #e5f4ea;
  --warn: #9a5a00;
  --warn-bg: #fff3df;
  --bad: #b42318;
  --bad-bg: #fdecea;
  --info: #1f5f9e;
  --info-bg: #e8f1fb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 32, 48, 0.06), 0 2px 8px rgba(16, 32, 48, 0.05);
  --nav-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #5b9bd8;
    --brand-strong: #7db2e6;
    --brand-soft: #1b2b3c;
    --appbar: #173451;
    --bg: #0f151c;
    --surface: #18212b;
    --surface-2: #1e2935;
    --text: #e6edf3;
    --text-soft: #9aa9b8;
    --line: #2b3846;
    --ok: #5cc27e;
    --ok-bg: #16301f;
    --warn: #f0b252;
    --warn-bg: #33270f;
    --bad: #f28b82;
    --bad-bg: #3a1a18;
    --info: #8ab8e8;
    --info-bg: #182a3d;
    --shadow: none;
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.25;
}

p {
  margin: 0;
}

a {
  color: var(--brand);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.ico {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ico-sm {
  width: 18px;
  height: 18px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.muted {
  color: var(--text-soft);
}

.small {
  font-size: 0.875rem;
}

.center {
  text-align: center;
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: 2px;
}

/* ---------- Boutons et champs ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s, border-color 0.15s, transform 0.05s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-strong);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.btn-secondary:hover {
  background: var(--surface-2);
}

.btn-danger {
  background: var(--bad-bg);
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 30%, transparent);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-lg {
  min-height: 54px;
  font-size: 1.05rem;
}

.btn-sm {
  min-height: 38px;
  padding: 6px 12px;
  font-size: 0.9rem;
}

.btn-sm .ico {
  width: 18px;
  height: 18px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.icon-btn:hover {
  background: color-mix(in srgb, currentColor 10%, transparent);
}

.link {
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.95rem;
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}

.input-with-btn {
  position: relative;
  display: block;
}

.input-with-btn input {
  padding-right: 54px;
}

.input-with-btn .icon-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  color: var(--text-soft);
}

.form-error {
  margin: -4px 0 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bad-bg);
  color: var(--bad);
  font-size: 0.95rem;
}

.search-box {
  position: relative;
}

.search-box .ico {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  color: var(--text-soft);
  pointer-events: none;
}

.search-box input {
  padding-left: 46px;
}

/* ---------- Connexion ---------- */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + var(--safe-bottom));
  background:
    radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--brand) 22%, transparent), transparent),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 28px 22px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(16, 32, 48, 0.12);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
}

.login-brand img {
  border-radius: 14px;
}

.login-brand h1 {
  font-size: 1.6rem;
}

.login-brand p {
  color: var(--text-soft);
}

.login-hint {
  margin-top: 16px;
  color: var(--text-soft);
  font-size: 0.875rem;
  text-align: center;
}

/* ---------- Structure ---------- */

.shell {
  min-height: 100vh;
}

.main {
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 60px;
  padding: 7px 8px 7px 16px;
  padding-top: max(7px, env(safe-area-inset-top, 0px));
  background: var(--appbar);
  color: #fff;
}

.appbar #btn-back {
  margin-left: -8px;
}

.appbar-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 1.15rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

#btn-sync.spinning .ico {
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.banner {
  margin: 0;
  padding: 10px 16px;
  font-size: 0.9rem;
}

.banner-warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.content {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 16px;
}

.content:focus {
  outline: none;
}

.view {
  display: grid;
  gap: 16px;
}

/* Barre de navigation : en bas sur mobile */
.nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.nav-brand {
  display: none;
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.nav-item .ico {
  width: 24px;
  height: 24px;
}

.nav-item[aria-current="page"] {
  color: var(--brand);
}

.nav-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 28%;
  right: 28%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--brand);
}

/* ---------- Blocs, cartes, listes ---------- */

.block {
  display: grid;
  gap: 10px;
}

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.block-head h3 {
  font-size: 1.05rem;
}

.card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.list {
  display: grid;
  gap: 10px;
}

.list-tight {
  gap: 8px;
}

.card-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}

.card-link:hover {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
}

.card-link:active {
  background: var(--surface-2);
}

.card-link > .ico {
  color: var(--text-soft);
}

.card-body {
  flex: 1;
  min-width: 0;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.card-sub {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.empty {
  padding: 22px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--text-soft);
  text-align: center;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px;
  color: var(--text-soft);
}

.loading::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.tag-current {
  background: var(--ok-bg);
  color: var(--ok);
}

.tag-upcoming {
  background: var(--info-bg);
  color: var(--info);
}

.tag-past {
  background: var(--surface-2);
  color: var(--text-soft);
}

.tag-nogps {
  background: var(--warn-bg);
  color: var(--warn);
}

/* ---------- Accueil ---------- */

.hello-date {
  color: var(--text-soft);
  font-size: 0.9rem;
  text-transform: capitalize;
}

.hello-name {
  font-size: 1.45rem;
}

.sync-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 4px;
}

/* ---------- Barres d'outils ---------- */

.toolbar {
  display: grid;
  gap: 10px;
}

.toolbar-sticky {
  position: sticky;
  top: 60px;
  z-index: 10;
  margin: -16px -16px 0;
  padding: 12px 16px;
  background: var(--bg);
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
}

.segmented button {
  min-height: 42px;
  padding: 6px 4px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.segmented .count {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-soft);
}

.chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.chip-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--brand);
}

.chip-toggle:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

/* ---------- Tâches ---------- */

.task {
  display: grid;
  gap: 6px;
  color: inherit;
  text-decoration: none;
}

.task-link {
  transition: border-color 0.15s, background-color 0.15s;
}

.task-link:hover {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
}

.task-link:active {
  background: var(--surface-2);
}

.task-more {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  margin-top: 2px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand);
}

.task-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.task-dates {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.task-title {
  font-size: 1.05rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.progress-bar {
  flex: 1;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}

.progress-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

/* ---------- Fiche chantier ---------- */

.site-card {
  display: grid;
  gap: 8px;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.site-title {
  font-size: 1.35rem;
  overflow-wrap: anywhere;
}

.site-address {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--text-soft);
}

.site-address .ico {
  margin-top: 2px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 6px;
}

.actions-stack {
  grid-template-columns: 1fr;
  margin-top: 0;
}

.upload-btn {
  position: relative;
}

/* Météo */
.meteo-card {
  display: grid;
  gap: 12px;
}

.meteo-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1.05rem;
}

.meteo-status .ico {
  width: 28px;
  height: 28px;
}

.meteo-ok {
  background: var(--ok-bg);
  color: var(--ok);
}

.meteo-ko {
  background: var(--bad-bg);
  color: var(--bad);
}

.rain-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.rain {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.rain-label {
  color: var(--text-soft);
  font-size: 0.8rem;
}

.rain-value {
  font-size: 1.2rem;
  font-weight: 700;
}

.rain-level {
  font-size: 0.85rem;
  font-weight: 600;
}

.rain-low .rain-level {
  color: var(--info);
}

.rain-medium .rain-level {
  color: var(--warn);
}

.rain-high .rain-level {
  color: var(--bad);
}

.meteo-details summary {
  padding: 6px 0;
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
}

.html-box {
  color: var(--text);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.html-box p {
  margin: 4px 0;
}

.html-box h4 {
  margin-top: 10px;
}

.meteo-meta {
  color: var(--text-soft);
  font-size: 0.8rem;
}

/* Photos */
.upload-queue {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.upload-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 0.9rem;
}

.upload-item-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 10px;
}

.upload-name {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.upload-item.is-done .upload-state {
  color: var(--ok);
}

.upload-item.is-done .progress-bar > span {
  background: var(--ok);
}

.upload-item.is-error {
  border-color: color-mix(in srgb, var(--bad) 40%, var(--line));
  background: var(--bad-bg);
}

.upload-item.is-error .upload-state {
  flex-basis: 100%;
  color: var(--bad);
}

.upload-item.is-error .progress-bar {
  display: none;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--surface-2);
  cursor: zoom-in;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb span {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 14px 6px 4px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  color: #fff;
  font-size: 0.72rem;
  text-align: left;
}

/* Visionneuse */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 10, 15, 0.94);
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.lightbox-bar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 8px 8px 16px;
  padding-top: max(8px, env(safe-area-inset-top, 0px));
  background: linear-gradient(rgba(0, 0, 0, 0.6), transparent);
  color: #fff;
}

.lightbox-bar span {
  flex: 1;
}

.icon-btn-light {
  color: #fff;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  transform: translateY(-50%);
  cursor: pointer;
}

.lightbox-prev {
  left: 10px;
}

.lightbox-next {
  right: 10px;
}

/* Profil */
.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  flex: none;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
}

.info-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 4px 16px;
}

.info-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.info-list > div:last-child {
  border-bottom: 0;
}

.info-list dt {
  color: var(--text-soft);
}

.info-list dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* Notification */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 14px);
  z-index: 200;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border-radius: 12px;
  background: #13202d;
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
}

.toast.is-error {
  background: #9b1c13;
}

body:not(.is-logged) .toast {
  bottom: calc(20px + var(--safe-bottom));
}

/* ---------- Grand écran : navigation latérale ---------- */

@media (min-width: 900px) {
  .nav {
    top: 0;
    right: auto;
    width: 232px;
    height: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 12px;
    border-top: 0;
    border-right: 1px solid var(--line);
  }

  .nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 18px;
    font-size: 1.15rem;
    font-weight: 800;
  }

  .nav-brand img {
    border-radius: 9px;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 0.98rem;
  }

  .nav-item:hover {
    background: var(--surface-2);
  }

  .nav-item[aria-current="page"] {
    background: var(--brand-soft);
  }

  .nav-item[aria-current="page"]::before {
    display: none;
  }

  .main {
    margin-left: 232px;
    padding-bottom: 32px;
  }

  .appbar {
    padding-left: 24px;
  }

  .content {
    padding: 24px;
  }

  .toolbar-sticky {
    margin: -24px -24px 0;
    padding: 16px 24px;
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  #view-planning .toolbar {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .segmented {
    min-width: 440px;
  }

  .segmented .count {
    display: inline;
  }

  .actions-stack {
    grid-template-columns: 1fr 1fr;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .toast {
    bottom: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.meteo-card .empty {
  padding: 6px 4px;
  border: 0;
}

/* ---------- Ergonomie tactile et écrans particuliers ---------- */

/* Liens texte (« Tout le planning », « Actualiser ») : zone de toucher de 44 px. */
.link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

/* Encoche des iPhone tenus à l'horizontale. */
@media (max-width: 899px) {
  .appbar,
  .content {
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
  }

  .appbar {
    padding-right: max(8px, env(safe-area-inset-right, 0px));
  }

  .nav {
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
}

/* Téléphone à l'horizontale (peu de hauteur) : barres plus fines, recherche non fixée,
   pour laisser la place au contenu. */
@media (max-width: 899px) and (max-height: 500px) {
  :root {
    --nav-h: 50px;
  }

  .appbar {
    min-height: 46px;
    padding-top: 3px;
    padding-bottom: 3px;
  }

  .toolbar-sticky {
    position: static;
    margin: 0;
    padding: 0;
    background: none;
  }

  .nav-item {
    flex-direction: row;
    gap: 8px;
    font-size: 0.85rem;
  }

  .nav-item .ico {
    width: 20px;
    height: 20px;
  }
}

/* Petits boutons : zone de toucher de 44 px malgré tout. */
.btn-sm {
  min-height: 44px;
}
