/* Aurocher Chat — styles (thème clair / sombre automatique, façon Telegram). */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --bg: #ffffff;
  --bg-2: #f5f1e8;
  --surface: #ffffff;
  --bar-bg: rgba(255, 255, 255, 0.96);
  --text: #1e464b;
  --text-2: #707579;
  --text-3: #a2acb4;
  --accent: #007f78;
  --accent-fill: #007f78;
  --accent-soft: rgba(0, 167, 158, 0.12);
  --danger: #e53935;
  --danger-soft: rgba(229, 57, 53, 0.1);
  --divider: rgba(0, 0, 0, 0.09);
  --hover: #f4f4f5;
  --pressed: #eaeaec;
  --search-bg: #f0f0f3;
  --input-bg: #ffffff;
  --input-border: #dadce0;
  --icon: #707579;
  --badge: #00a79e;
  --badge-muted: #b8bdc2;
  --switch-off: #e3e3e8;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
  --menu-bg: rgba(255, 255, 255, 0.94);

  --chat-bg: #ece7db;
  --chat-bg-image: radial-gradient(circle at 12% 18%, rgba(0, 167, 158, 0.22) 0, rgba(0, 167, 158, 0) 42%),
    radial-gradient(circle at 88% 22%, rgba(245, 241, 232, 0.9) 0, rgba(245, 241, 232, 0) 48%),
    radial-gradient(circle at 25% 88%, rgba(0, 127, 120, 0.16) 0, rgba(0, 127, 120, 0) 50%),
    radial-gradient(circle at 82% 86%, rgba(0, 167, 158, 0.2) 0, rgba(0, 167, 158, 0) 50%);
  --service-bg: rgba(30, 70, 75, 0.48);
  --service-text: #ffffff;
  --kb-bg: rgba(30, 70, 75, 0.44);
  --kb-bg-active: rgba(30, 70, 75, 0.6);
  --unread-sep-bg: rgba(255, 255, 255, 0.7);
  --stack-edge: rgba(30, 70, 75, 0.24);
  --stack-edge-2: rgba(30, 70, 75, 0.13);

  --bubble-in: #ffffff;
  --bubble-out: #e0f5f2;
  --bubble-shadow: 0 1px 2px rgba(16, 35, 47, 0.15);
  --text-in: #1e464b;
  --text-out: #1e464b;
  --meta-in: #8c959c;
  --meta-out: #007f78;
  --link-in: #007f78;
  --link-out: #007f78;
  --accent-in: #007f78;
  --accent-out: #007f78;
  --quote-bg-in: rgba(0, 127, 120, 0.08);
  --quote-bg-out: rgba(0, 127, 120, 0.12);
  --code-bg-in: rgba(0, 0, 0, 0.05);
  --code-bg-out: rgba(0, 127, 120, 0.12);
  --media-ph: rgba(0, 0, 0, 0.06);

  --nc0: #cc5049;
  --nc1: #d67722;
  --nc2: #955cdb;
  --nc3: #40a920;
  --nc4: #309eba;
  --nc5: #368ad1;
  --nc6: #c7508b;

  --list-w: 380px;
  --bar-h: 56px;
  --r: 16px;
  --r-small: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17212b;
    --bg-2: #0e1621;
    --surface: #17212b;
    --bar-bg: rgba(23, 33, 43, 0.97);
    --text: #f5f5f5;
    --text-2: #7f91a4;
    --text-3: #56687a;
    --accent: #2fc9be;
    --accent-fill: #00918a;
    --accent-soft: rgba(47, 201, 190, 0.14);
    --danger: #ef5b5b;
    --danger-soft: rgba(239, 91, 91, 0.14);
    --divider: rgba(255, 255, 255, 0.07);
    --hover: #202b36;
    --pressed: #2b3946;
    --search-bg: #242f3d;
    --input-bg: #242f3d;
    --input-border: transparent;
    --icon: #7f91a4;
    --badge: #00a79e;
    --badge-muted: #3b4d5f;
    --switch-off: #39485a;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
    --menu-bg: rgba(30, 42, 55, 0.96);

    --chat-bg: #0e1621;
    --chat-bg-image: radial-gradient(circle at 15% 20%, rgba(0, 92, 86, 0.4) 0, rgba(0, 92, 86, 0) 45%),
      radial-gradient(circle at 85% 80%, rgba(0, 70, 66, 0.45) 0, rgba(0, 70, 66, 0) 50%);
    --service-bg: rgba(30, 44, 58, 0.82);
    --kb-bg: rgba(30, 46, 62, 0.88);
    --kb-bg-active: rgba(43, 64, 86, 0.95);
    --unread-sep-bg: rgba(23, 33, 43, 0.75);
    --stack-edge: rgba(127, 145, 164, 0.38);
    --stack-edge-2: rgba(127, 145, 164, 0.2);

    --bubble-in: #182533;
    --bubble-out: #1f4d49;
    --bubble-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --text-in: #f5f5f5;
    --text-out: #ffffff;
    --meta-in: #6d7f8f;
    --meta-out: #7fd1c9;
    --link-in: #2fc9be;
    --link-out: #8fe3db;
    --accent-in: #2fc9be;
    --accent-out: #8fe3db;
    --quote-bg-in: rgba(47, 201, 190, 0.1);
    --quote-bg-out: rgba(255, 255, 255, 0.1);
    --code-bg-in: rgba(255, 255, 255, 0.07);
    --code-bg-out: rgba(255, 255, 255, 0.1);
    --media-ph: rgba(255, 255, 255, 0.05);

    --nc0: #ff7a75;
    --nc1: #f3a55f;
    --nc2: #b690ff;
    --nc3: #7ad167;
    --nc4: #5ac8dd;
    --nc5: #62b1f4;
    --nc6: #ee82c0;
  }
}

/* --- Base ----------------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
/* Taille de base : 16 px, remplacée par src/util/textSize.js (réglage iOS « Taille du texte » et
   « Texte plus grand » de l'app). Toutes les tailles de police sont en rem pour la suivre. */
html {
  font-size: 16px;
}
body {
  font-size: 1rem;
}
/* Sonde mesurée par textSize.js : sur iPhone et iPad, la taille du style « corps » suit le réglage
   de l'appareil (Dynamic Type) ; ailleurs, la valeur de repli de 16 px reste. */
.text-probe {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  font-size: 16px;
  font: -apple-system-body;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
#app {
  height: 100%;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
button:disabled {
  cursor: default;
  opacity: 0.55;
}
a {
  color: var(--accent);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
h1,
h2 {
  margin: 0;
}
.noscript {
  padding: 24px;
  text-align: center;
}

.icon {
  flex-shrink: 0;
  display: block;
}
.spinner {
  animation: spin 0.9s linear infinite;
  color: var(--accent);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.splash {
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--bg);
}
.splash img {
  border-radius: 22px;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.6;
  }
}

/* --- Mise en page --------------------------------------------------------------------------- */

.app {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--vv-top, 0px);
  height: var(--vv-height, 100%);
  overflow: hidden;
  background: var(--bg);
}
.pane {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.app.narrow .pane-list {
  left: 0;
  right: 0;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.app.narrow.main-open .pane-list {
  transform: translateX(-22%);
}
.app.narrow .pane-main {
  inset: 0;
  z-index: 2;
  display: none;
}
.app.narrow.main-open .pane-main {
  display: flex;
}
.app.wide .pane-list {
  left: 0;
  width: var(--list-w);
  border-right: 1px solid var(--divider);
  padding-left: env(safe-area-inset-left);
}
.app.wide .pane-main {
  left: var(--list-w);
  right: 0;
  padding-right: env(safe-area-inset-right);
  background: var(--chat-bg);
  background-image: var(--chat-bg-image);
}
@media (min-width: 1100px) {
  :root {
    --list-w: 420px;
  }
}
.screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.app.narrow .screen {
  animation: slide-in 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.08);
}
@keyframes slide-in {
  from {
    transform: translateX(100%);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes slide-up {
  from {
    transform: translateY(100%);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
.placeholder {
  flex: 1;
  display: grid;
  place-items: center;
}

/* --- Barres --------------------------------------------------------------------------------- */

.bar {
  position: relative;
  z-index: 4;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: calc(var(--bar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 6px 0;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--divider);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
.app.narrow .bar {
  padding-left: max(6px, env(safe-area-inset-left));
  padding-right: max(6px, env(safe-area-inset-right));
}
.bar-title {
  flex: 1;
  text-align: center;
  font-size: 1.0625rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  border-radius: 20px;
  color: var(--icon);
  text-decoration: none;
  flex-shrink: 0;
}
.icon-btn-spacer {
  width: 40px;
  flex-shrink: 0;
}
@media (hover: hover) {
  .icon-btn:hover {
    background: var(--hover);
  }
}
.icon-btn.back {
  color: var(--accent);
  padding-right: 4px;
}
.back-count {
  margin-left: -4px;
  background: var(--accent-fill);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.5em;
  min-width: 1.5em;
  padding: 0 0.4em;
  border-radius: 0.75em;
}
.app.wide .chat-bar .back {
  display: none;
}
.app.wide .chat-bar {
  padding-left: 12px;
}
.text-btn {
  color: var(--accent);
  font-size: 1rem;
  padding: 8px 10px;
  white-space: nowrap;
}

.conn-banner {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.8438rem;
  font-weight: 500;
  background: var(--bg-2);
  color: var(--text-2);
  border-bottom: 1px solid var(--divider);
  position: relative;
  z-index: 3;
}
.conn-banner.offline {
  background: #fff4d6;
  color: #7a5a00;
  flex-wrap: wrap;
  text-align: center;
}
@media (prefers-color-scheme: dark) {
  .conn-banner.offline {
    background: #3a3220;
    color: #f0d48a;
  }
}

/* --- Liste des discussions ------------------------------------------------------------------ */

.chat-list-pane {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
}
.list-bar {
  border-bottom: 0;
}
.search-row {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px 8px;
  background: var(--bar-bg);
}
.search-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  background: var(--search-bg);
  color: var(--text-2);
}
.search-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 1rem;
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}
.search-field input::placeholder {
  color: var(--text-2);
}
.search-field input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.filters {
  flex-shrink: 0;
  display: flex;
  padding: 0 6px;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--divider);
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar {
  display: none;
}
.filter {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 10px 12px 11px;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}
.filter.active {
  color: var(--accent);
}
.filter.active::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
}
.filter-count {
  margin-left: 6px;
  min-width: 1.7em;
  height: 1.7em;
  padding: 0 0.5em;
  border-radius: 0.85em;
  background: var(--badge);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.7em;
  text-align: center;
}
.filter:not(.active) .filter-count {
  background: var(--badge-muted);
}
.chat-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: env(safe-area-inset-bottom);
}
.chat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 78px;
  padding: 0 0 0 10px;
  color: inherit;
  text-decoration: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.chat-item:active {
  background: var(--pressed);
}
@media (hover: hover) {
  .chat-item:hover {
    background: var(--hover);
  }
}
.app.wide .chat-item {
  margin: 0 6px;
  padding-left: 8px;
  border-radius: 12px;
}
.chat-item.active,
.chat-item.active:hover {
  background: var(--accent-fill);
  color: #fff;
}
.chat-item.active .ci-body {
  border-color: transparent;
}
.chat-item.active .ci-preview,
.chat-item.active .ci-time,
.chat-item.active .ci-sender,
.chat-item.active .ci-action,
.chat-item.active .ci-check,
.chat-item.active .ci-pin,
.chat-item.active .ci-muted,
.chat-item.active .ci-todo {
  color: #fff;
}
.chat-item.active .badge {
  background: #fff;
  color: var(--accent-fill);
}
.ci-body {
  flex: 1;
  min-width: 0;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: 12px;
  border-bottom: 0.5px solid var(--divider);
}
.app.wide .ci-body {
  border-bottom: 0;
}
.ci-top {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ci-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ci-muted {
  color: var(--text-3);
}
.ci-time {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: var(--text-2);
}
.ci-check {
  color: var(--meta-out);
}
@media (prefers-color-scheme: dark) {
  .ci-check {
    color: var(--accent);
  }
}
.ci-bottom {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 2px;
}
.ci-preview {
  flex: 1;
  min-width: 0;
  color: var(--text-2);
  font-size: 0.9375rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.ci-sender {
  color: var(--text);
}
.ci-draft {
  color: var(--danger);
}
.ci-action {
  color: var(--accent);
}
.ci-empty {
  font-style: italic;
}
.ci-pin,
.ci-todo {
  color: var(--text-3);
  margin-top: 2px;
}
.ci-todo {
  color: #f0a020;
}
.badge {
  flex-shrink: 0;
  min-width: 1.7em;
  height: 1.7em;
  padding: 0 0.55em;
  border-radius: 0.85em;
  background: var(--badge);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.7em;
  text-align: center;
}
.badge.muted {
  background: var(--badge-muted);
}
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 6px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg-2);
}
.chat-item.result {
  min-height: 72px;
}
/* Boîte « À traiter » : ligne + bouton « Retirer » */
.todo-row {
  display: flex;
  align-items: stretch;
}
.todo-row > .chat-item {
  flex: 1;
  min-width: 0;
}
.todo-row > .chat-item .ci-body {
  padding-right: 4px;
}
/* Page d'une fiche : le titre de la fiche sur une ligne (coupé « … »), puis ce qu'il y a à faire,
   en entier (jusqu'à 3 lignes) */
.ci-fiche {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ci-fiche + .ci-bottom .ci-preview {
  -webkit-line-clamp: 3;
}
.todo-dismiss {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 14px 0 6px;
  font-size: 0.9375rem;
  border-bottom: 0.5px solid var(--divider);
}
.app.wide .todo-dismiss {
  border-bottom: 0;
}
mark {
  background: rgba(255, 200, 0, 0.35);
  color: inherit;
  border-radius: 3px;
}
.empty-note {
  padding: 18px;
  text-align: center;
  color: var(--text-2);
  font-size: 0.875rem;
}
.empty-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 56px 32px;
  text-align: center;
  color: var(--text-3);
}
.empty-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text);
}
.empty-text {
  font-size: 0.9063rem;
  color: var(--text-2);
}
.center-loader {
  display: flex;
  justify-content: center;
  padding: 32px;
}

/* --- Avatars -------------------------------------------------------------------------------- */

.avatar {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 600;
  letter-spacing: 0.02em;
  -webkit-user-select: none;
  user-select: none;
  line-height: 1;
}
.avatar.c0 {
  background: linear-gradient(#ff885e, #ff516a);
}
.avatar.c1 {
  background: linear-gradient(#ffcd6a, #ffa85c);
}
.avatar.c2 {
  background: linear-gradient(#82b1ff, #665fff);
}
.avatar.c3 {
  background: linear-gradient(#a0de7e, #54cb68);
}
.avatar.c4 {
  background: linear-gradient(#53edd6, #28c9b7);
}
.avatar.c5 {
  background: linear-gradient(#72d5fd, #2a9ef1);
}
.avatar.c6 {
  background: linear-gradient(#e0a2f3, #d669ed);
}
.avatar.avatar-system {
  background: linear-gradient(#9aa7b3, #6b7a88);
}
.nc0 {
  --nc: var(--nc0);
}
.nc1 {
  --nc: var(--nc1);
}
.nc2 {
  --nc: var(--nc2);
}
.nc3 {
  --nc: var(--nc3);
}
.nc4 {
  --nc: var(--nc4);
}
.nc5 {
  --nc: var(--nc5);
}
.nc6 {
  --nc: var(--nc6);
}

/* --- Discussion ----------------------------------------------------------------------------- */

.chat-view {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--chat-bg);
  background-image: var(--chat-bg-image);
}
.chat-bar {
  gap: 4px;
}
.chat-bar-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px;
  border-radius: 10px;
  text-align: left;
}
@media (hover: hover) {
  .chat-bar-info:hover {
    background: var(--hover);
  }
}
.chat-bar-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.chat-bar-title {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.muted-icon {
  color: var(--text-3);
}
.chat-bar-sub {
  font-size: 0.8438rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-bar-sub.typing {
  color: var(--accent);
}
.dots {
  display: inline-flex;
  gap: 2px;
  margin-left: 3px;
}
.dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  animation: dot 1.2s infinite ease-in-out;
}
.dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes dot {
  0%,
  60%,
  100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}
.autodelete-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-right: 6px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.7813rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  flex-shrink: 0;
}
.chat-missing {
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--text-2);
}

.pinned-bar {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--divider);
  padding-right: 4px;
}
.pinned-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 14px;
  text-align: left;
}
.pinned-line {
  width: 2px;
  align-self: stretch;
  min-height: 34px;
  border-radius: 1px;
  background: var(--accent);
  flex-shrink: 0;
}
.pinned-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.pinned-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}
.pinned-text {
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Bandeau « Le robot attend votre réponse » (question force_reply sans réponse) ---------- */

.awaiting-bar {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bar-bg);
  border-bottom: 1px solid var(--divider);
  padding-right: 10px;
}
.awaiting-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 14px;
  text-align: left;
}
.awaiting-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.awaiting-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}
.awaiting-text {
  font-size: 0.875rem;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.messages-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}
.messages {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  overflow-anchor: none;
  -webkit-overflow-scrolling: touch;
}
.messages-inner {
  max-width: 760px;
  margin: 0 auto;
  overflow-x: hidden;
  overflow-x: clip;
  padding: 6px max(6px, env(safe-area-inset-right)) 10px max(6px, env(safe-area-inset-left));
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.history-loader {
  min-height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.day {
  position: relative;
}
.day-sep {
  display: flex;
  justify-content: center;
  margin: 8px 0 6px;
  pointer-events: none;
}
.service-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--service-bg);
  color: var(--service-text);
  font-size: 0.8438rem;
  font-weight: 500;
  line-height: 1.35;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.empty-chat {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 40px 0;
}
.unread-sep {
  margin: 8px -6px;
  padding: 4px 0;
  text-align: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--unread-sep-bg);
}

/* Lignes et bulles */
.msg-row {
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 1px 4px;
  touch-action: pan-y;
}
.msg-row.first {
  margin-top: 5px;
}
.msg-row.out {
  justify-content: flex-end;
}
.msg-row.highlight::before {
  content: '';
  position: absolute;
  inset: 0 -100vw;
  background: var(--accent-soft);
  animation: flash 1.6s ease forwards;
  pointer-events: none;
}
@keyframes flash {
  0%,
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
.msg-avatar {
  width: 34px;
  margin-right: 6px;
  flex-shrink: 0;
  align-self: flex-end;
}
.msg {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  max-width: min(calc(100% - 44px), 480px);
}
.msg-row.with-avatar .msg {
  max-width: min(calc(100% - 84px), 480px);
}
.bubble {
  --rtl: var(--r);
  --rtr: var(--r);
  --rbr: var(--r);
  --rbl: var(--r);
  position: relative;
  min-width: 0;
  max-width: 100%;
  padding: 6px 10px 7px;
  border-radius: var(--rtl) var(--rtr) var(--rbr) var(--rbl);
  background: var(--bubble-in);
  color: var(--text-in);
  box-shadow: var(--bubble-shadow);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.msg-row.in:not(.first) .bubble {
  --rtl: var(--r-small);
}
.msg-row.in:not(.last) .bubble {
  --rbl: var(--r-small);
}
.msg-row.out:not(.first) .bubble {
  --rtr: var(--r-small);
}
.msg-row.out:not(.last) .bubble {
  --rbr: var(--r-small);
}
.msg-row.in .bubble.tailed {
  --rbl: 0px;
}
.msg-row.out .bubble.tailed {
  --rbr: 0px;
}
.msg-row.out .bubble {
  background: var(--bubble-out);
  color: var(--text-out);
}
.tail {
  position: absolute;
  bottom: 0;
  left: -8.6px;
  fill: var(--bubble-in);
  filter: drop-shadow(0 1px 0 rgba(16, 35, 47, 0.1));
}
.msg-row.out .tail {
  left: auto;
  right: -8.6px;
  transform: scaleX(-1);
  fill: var(--bubble-out);
}
html.touch .bubble,
html.touch .keyboard {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.bubble.has-keyboard {
  align-self: stretch;
}

.sender {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--nc, var(--accent));
  margin-bottom: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.text {
  white-space: pre-wrap;
  font-size: 1rem;
  line-height: 1.3125;
}
.text a {
  color: var(--link-in);
  text-decoration: none;
}
.msg-row.out .text a {
  color: var(--link-out);
}
@media (hover: hover) {
  .text a:hover {
    text-decoration: underline;
  }
}
.text .command,
.text .mention,
.text .hashtag {
  color: var(--link-in);
}
.msg-row.out .text .command,
.msg-row.out .text .mention,
.msg-row.out .text .hashtag {
  color: var(--link-out);
}
.code-inline {
  font-family: var(--mono);
  font-size: 0.9em;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--code-bg-in);
  cursor: copy;
}
.msg-row.out .code-inline,
.msg-row.out .code-block {
  background: var(--code-bg-out);
}
.code-block {
  position: relative;
  display: block;
  margin: 4px 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--code-bg-in);
  font-family: var(--mono);
  font-size: 0.8438rem;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-x: auto;
  border-left: 3px solid var(--accent-in);
}
.msg-row.out .code-block {
  border-left-color: var(--accent-out);
}
.code-lang {
  display: block;
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-in);
  margin-bottom: 2px;
}
.msg-row.out .code-lang {
  color: var(--accent-out);
}
.quote {
  position: relative;
  margin: 4px 0;
  padding: 3px 22px 3px 10px;
  border-left: 3px solid var(--accent-in);
  border-radius: 4px;
  background: var(--quote-bg-in);
}
.msg-row.out .quote {
  border-left-color: var(--accent-out);
  background: var(--quote-bg-out);
}
.quote::after {
  content: '”';
  position: absolute;
  top: -2px;
  right: 6px;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--accent-in);
  opacity: 0.7;
}
.msg-row.out .quote::after {
  color: var(--accent-out);
}
.quote.expandable:not(.open) {
  max-height: 4.1em;
  overflow: hidden;
  cursor: pointer;
  -webkit-mask-image: linear-gradient(#000 60%, transparent);
  mask-image: linear-gradient(#000 60%, transparent);
}
.spoiler:not(.revealed) {
  color: transparent !important;
  border-radius: 4px;
  cursor: pointer;
  background-color: rgba(128, 128, 128, 0.35);
  background-image: radial-gradient(rgba(255, 255, 255, 0.55) 0.8px, transparent 1px);
  background-size: 4px 4px;
  -webkit-user-select: none;
  user-select: none;
  animation: shimmer 1.2s linear infinite;
}
.spoiler:not(.revealed) * {
  color: transparent !important;
  background: none !important;
}
.spoiler.revealed {
  animation: fade-in 0.3s ease;
}
@keyframes shimmer {
  to {
    background-position: 4px 4px;
  }
}

.meta {
  position: absolute;
  right: 9px;
  bottom: 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--meta-in);
  white-space: nowrap;
  pointer-events: none;
}
.msg-row.out .meta {
  color: var(--meta-out);
}
.meta.ghost {
  position: static;
  visibility: hidden;
  margin-left: 10px;
  vertical-align: -2px;
}
.meta.block {
  position: static;
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
  margin-right: -1px;
}
.meta.overlay {
  right: 6px;
  bottom: 6px;
  padding: 3px 6px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff !important;
}
.meta .edited {
  font-style: italic;
  margin-right: 1px;
}
.meta .status .icon {
  width: 16px;
  height: 16px;
}
.msg-row.out .meta .status.failed {
  color: var(--danger);
}
.meta.overlay .status {
  color: #fff;
}

.reply-quote {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 1px 0 4px;
  padding: 3px 8px 4px;
  border-left: 3px solid var(--nc, var(--accent-in));
  border-radius: 4px;
  background: var(--quote-bg-in);
  text-align: left;
  font-size: 0.875rem;
  line-height: 1.3;
  min-width: 0;
}
.msg-row.out .reply-quote {
  border-left-color: var(--accent-out);
  background: var(--quote-bg-out);
}
.reply-name {
  font-weight: 600;
  color: var(--nc, var(--accent-in));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-row.out .reply-name {
  color: var(--accent-out);
}
.reply-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.9;
}

/* Médias */
.bubble.has-media {
  padding: 0;
}
.bubble.has-media > .sender,
.bubble.has-media > .reply-quote {
  margin: 6px 10px 4px;
  width: auto;
}
.bubble.has-media > .sender {
  margin-bottom: 2px;
}
.bubble.has-media > .text {
  padding: 5px 10px 7px;
}
.bubble.has-media > .doc,
.bubble.has-media > .meta.block {
  margin: 4px 10px 6px;
}
.media {
  position: relative;
  display: block;
  max-width: 100%;
  overflow: hidden;
  background-color: var(--media-ph);
  background-size: cover;
  background-position: center;
}
.media img,
.media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
}
.bubble.has-media > .media:nth-child(1),
.bubble.has-media > .tail + .media,
.bubble.has-media > .album:nth-child(1),
.bubble.has-media > .tail + .album {
  border-top-left-radius: var(--rtl);
  border-top-right-radius: var(--rtr);
}
.bubble.media-only > .media,
.bubble.media-only > .album {
  border-radius: var(--rtl) var(--rtr) var(--rbr) var(--rbl);
}
.bubble.media-only {
  background: transparent;
  box-shadow: none;
}
.media.photo {
  cursor: zoom-in;
}
.media-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  pointer-events: none;
}
.bubble.has-album {
  width: min(360px, 100%);
}
.album {
  display: grid;
  gap: 2px;
  overflow: hidden;
  grid-template-columns: 1fr 1fr;
}
.album .media.cell {
  width: 100%;
  aspect-ratio: 1;
}
.album.n3 > :first-child {
  grid-column: span 2;
  aspect-ratio: 2 / 1;
}
.album.n5 {
  grid-template-columns: repeat(6, 1fr);
}
.album.n5 > * {
  grid-column: span 2;
}
.album.n5 > :nth-child(-n + 2) {
  grid-column: span 3;
}
.album.n6 {
  grid-template-columns: repeat(3, 1fr);
}

/* Documents */
.doc {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: min(240px, 60vw);
  margin: 2px 0;
}
.doc-main {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  min-width: 0;
}
.doc-icon {
  position: relative;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-in);
  color: #fff;
  background-size: cover;
  background-position: center;
}
.msg-row.out .doc-icon {
  background-color: var(--accent-out);
}
@media (prefers-color-scheme: dark) {
  .msg-row.out .doc-icon {
    background-color: #00918a;
  }
}
.doc-icon.thumb {
  border-radius: 8px;
}
.doc-progress .spinner {
  color: #fff;
}
.doc-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.doc-name {
  font-weight: 500;
  font-size: 0.9375rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}
.doc-size {
  font-size: 0.8125rem;
  color: var(--meta-in);
}
.msg-row.out .doc-size {
  color: var(--meta-out);
}
.doc audio {
  width: 100%;
  height: 36px;
}
/* Aperçu d'un PDF (1re page, util/docPreview.js) : bloc média à la largeur de la bulle, page
   recadrée par le haut si elle est trop haute ; le liseré détache une page blanche de la bulle. */
.media.doc-preview {
  border: 1px solid var(--divider);
  background-position: top center;
  cursor: zoom-in;
}
.media.doc-preview img {
  object-position: top center;
}
/* Fiche « À traiter » : la page cède de la hauteur pour que la légende et les boutons tiennent à
   l'écran d'un petit iPhone (page recadrée par le haut, comme un ticket) */
.todo-stack .media.doc-preview {
  max-height: min(320px, 38vh);
}
/* Fiche à pages : même recadrage, pour que la PF, sa légende et ✅ / ✏️ tiennent à l'écran */
.fiche .media.doc-preview {
  max-height: min(320px, 38vh);
}
.doc.with-preview {
  min-width: 0;
}
.location {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--link-in);
  text-decoration: none;
  font-weight: 500;
  padding: 2px 0;
}
.location small {
  display: block;
  font-weight: 400;
  font-size: 0.7813rem;
  color: var(--meta-in);
}
.msg-row.out .location {
  color: var(--link-out);
}

/* Clavier inline */
.keyboard {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}
.kb-row {
  display: flex;
  gap: 4px;
}
.kb-btn {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--kb-bg);
  color: var(--service-text);
  font-size: 0.9063rem;
  font-weight: 500;
  line-height: 1.25;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  transition: background 0.15s ease;
}
.kb-btn:active,
.kb-btn.loading {
  background: var(--kb-bg-active);
}
@media (hover: hover) {
  .kb-btn:hover {
    background: var(--kb-bg-active);
  }
}
.kb-text {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.15s;
}
.kb-btn.loading .kb-text {
  opacity: 0.55;
}
.kb-corner {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0.85;
}
.kb-spin {
  position: absolute;
  top: 3px;
  right: 3px;
  color: #fff;
}

/* Boutons d'une carte avec `style` (extension Aurocher) : « choice » = grande tuile, « quiet » = discret */
.kb-btn.choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 104px;
  padding: 14px 10px 13px;
  border: 1.5px solid rgba(0, 167, 158, 0.45);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--bubble-shadow);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.12s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}
.kb-btn.choice:active,
.kb-btn.choice.loading {
  background: var(--surface);
  border-color: var(--accent);
  transform: scale(0.97);
}
@media (hover: hover) {
  .kb-btn.choice:hover {
    background: var(--surface);
    border-color: var(--accent);
  }
}
.kb-choice-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}
.kb-btn.choice .kb-text {
  font-size: 1.0625rem;
  font-weight: 700;
  white-space: normal;
}
.kb-hint {
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-2);
}
.kb-btn.choice .kb-spin {
  top: 8px;
  right: 8px;
  color: var(--accent);
}
/* Les tuiles ont besoin de place : la carte s'élargit au lieu de suivre la largeur du texte */
.keyboard:has(.kb-btn.choice) {
  min-width: min(80vw, 330px);
}
.kb-row:has(.kb-btn.choice) {
  gap: 8px;
  margin-bottom: 2px;
}
.kb-btn.quiet {
  min-height: 36px;
  background: transparent;
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.kb-btn.quiet:active,
.kb-btn.quiet.loading {
  background: var(--hover);
}
@media (hover: hover) {
  .kb-btn.quiet:hover {
    background: var(--hover);
  }
}
.kb-btn.quiet .kb-spin {
  color: var(--text-2);
}

/* Pile « À traiter » : une carte « 1 sur N » avec ◀ ▶ (components/TodoStack.js) */
.todo-stack {
  position: relative;
  margin: 10px 0 16px;
  padding: 6px 0 8px;
  border-radius: 18px;
  background: var(--unread-sep-bg);
  box-shadow:
    0 4px 0 -1px var(--stack-edge),
    0 8px 0 -3px var(--stack-edge-2);
}
.stack-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 6px 12px;
}
.stack-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 6px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}
.stack-title .icon,
.stack-count {
  color: var(--accent);
}
.stack-count {
  font-variant-numeric: tabular-nums;
}
.stack-day {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-2);
}
.stack-nav {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.stack-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-fill);
  color: #fff;
  transition: opacity 0.15s ease;
}
.stack-btn:active {
  opacity: 0.8;
}
.stack-btn:disabled {
  background: var(--divider);
  color: var(--text-3);
}
.stack-card {
  animation: stack-in 0.22s ease;
}
.stack-card.settling .keyboard {
  pointer-events: none;
}
@keyframes stack-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Fiche à pages : titre, « ◀ 1/3 ▶ », « ● k à traiter », ligne d'état (components/FichePages.js).
   Le fond de la carte est porté par l'en-tête et par la page (même couleur, sans couture). */
.fiche {
  position: relative;
  margin: 10px 0 16px;
  border-radius: 18px;
  box-shadow:
    0 3px 0 -1px var(--stack-edge),
    0 6px 0 -3px var(--stack-edge-2);
}
/* L'en-tête reste en haut de l'écran tant que sa page défile : sur une PF plus haute que l'écran,
   titre, « ◀ n/N ▶ », « ● k à traiter » et ligne d'état restent visibles quand ✅ est à l'écran.
   Fond flouté : la page passe dessous sans gêner la lecture. */
.fiche-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 8px 8px 6px 12px;
  border-radius: 18px 18px 0 0;
  background: var(--unread-sep-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--text);
}
/* Les flèches passent sous le titre quand la place manque (texte plus grand, mode simple) */
.fiche-line1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}
.fiche-title {
  flex: 1 1 9rem;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.fiche-title.full {
  white-space: normal;
  overflow-wrap: anywhere;
}
.fiche-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  margin-left: auto;
}
.fiche-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-fill);
  color: #fff;
  transition: opacity 0.15s ease;
}
.fiche-btn:active {
  opacity: 0.8;
}
.fiche-btn:disabled {
  background: var(--divider);
  color: var(--text-3);
}
.fiche-count {
  min-width: 2.4em;
  text-align: center;
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.fiche-day {
  color: var(--text-2);
  font-size: 0.8125rem;
  white-space: nowrap;
}
/* « dossier 74120 · reçu le 02/11 » n'est jamais coupé : « ● k à traiter » passe dessous s'il le faut */
.fiche-line2 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-height: 1.5rem;
}
.fiche-sub {
  flex: 1 1 10rem;
  min-width: 0;
  color: var(--text-2);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
}
.fiche-todo {
  flex-shrink: 0;
  margin-left: auto;
  min-height: 32px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}
.fiche-dot {
  color: #f0a020;
}
.fiche-etat {
  margin-top: 4px;
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
/* flow-root : la marge haute de la bulle reste dans la page (sinon elle sort de la boîte et laisse
   une fente sans fond entre l'en-tête et la page) */
.fiche-page {
  display: flow-root;
  padding-bottom: 8px;
  border-radius: 0 0 18px 18px;
  background: var(--unread-sep-bg);
}
/* La bulle glisse en entrant ; le fond de la carte, lui, ne bouge pas */
.fiche-page > * {
  animation: stack-in 0.22s ease;
}
.fiche-page.settling .keyboard {
  pointer-events: none;
}

/* Alerte répétée : « ×3 · depuis 08:30 » (util/repeats.js) */
.repeat-row {
  display: flex;
  align-items: center;
  margin-top: 5px;
}
.repeat-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 16px;
  background: var(--quote-bg-in);
  color: var(--accent-in);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.repeat-times {
  margin-top: 5px;
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--meta-in);
}

.swipe-reply {
  position: absolute;
  top: 50%;
  right: -34px;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--service-bg);
  color: #fff;
  opacity: var(--swipe, 0);
  transform: scale(calc(0.5 + var(--swipe, 0) * 0.5));
  pointer-events: none;
}

.scroll-down {
  position: absolute;
  right: max(12px, env(safe-area-inset-right));
  bottom: 12px;
  z-index: 3;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--icon);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  pointer-events: none;
  transition:
    opacity 0.18s,
    transform 0.18s;
}
.scroll-down.visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.scroll-down .badge {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
}

/* --- Saisie --------------------------------------------------------------------------------- */

.composer {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  background: var(--bar-bg);
  border-top: 1px solid var(--divider);
  padding: 6px max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left));
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
html.kb-open .composer {
  padding-bottom: 6px;
}
.composer.readonly {
  text-align: center;
  color: var(--text-2);
  font-size: 0.875rem;
  padding-top: 12px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  max-width: 760px;
  margin: 0 auto;
}
.composer-input {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  max-height: 168px;
  padding: 8px 14px;
  resize: none;
  border: 1px solid var(--input-border);
  border-radius: 19px;
  outline: none;
  background: var(--input-bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.3;
  overflow-y: auto;
}
.composer-input::placeholder {
  color: var(--text-3);
}
.attach-wrap {
  position: relative;
}
.icon-btn.attach {
  height: 38px;
  color: var(--icon);
}
.send-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-3);
  transition:
    background 0.15s,
    color 0.15s,
    transform 0.15s;
}
.send-btn .icon {
  transform: translateX(1px);
}
.send-btn.active {
  background: var(--accent-fill);
  color: #fff;
}
.send-btn.active:active {
  transform: scale(0.92);
}

/* Barre fixe d'un robot au-dessus du champ de message (components/QuickBar.js, méthode setChatBar) */
.quick-bar {
  max-width: 760px;
  margin: 2px auto 8px;
  animation: quick-in 0.22s ease-out;
}
@keyframes quick-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .quick-bar {
    animation: none;
  }
}
.quick-title {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 4px 7px;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.quick-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
}
.quick-row {
  display: flex;
  gap: 8px;
}
.quick-btn {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.12s ease,
    background 0.15s ease,
    opacity 0.15s ease;
}
.quick-btn.first {
  background: var(--accent-fill);
  color: #fff;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.12),
    0 6px 16px rgba(0, 127, 120, 0.22);
}
.quick-btn:active:not(:disabled) {
  transform: scale(0.97);
}
.quick-btn:disabled {
  cursor: default;
}
.quick-btn:disabled:not(.loading) {
  opacity: 0.55;
}
.quick-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (hover: hover) {
  .quick-btn:not(:disabled):hover {
    filter: brightness(1.05);
  }
}
.quick-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Pastille d'information près du champ de message + sa bulle (QuickBar.js InfoChips, bouton `info` de setChatBar) */
.info-chips {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 760px;
  margin: 0 auto 6px;
  padding-left: 46px;
}
.info-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 3px 11px 3px 8px;
  border: 1px solid var(--divider);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}
.info-chip .icon {
  color: var(--accent);
}
.info-chip.open,
.info-chip:active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}
@media (hover: hover) {
  .info-chip:hover {
    background: var(--accent-soft);
    color: var(--accent);
  }
}
.info-chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.info-bubble {
  position: absolute;
  z-index: 46;
  left: 0;
  bottom: calc(100% + 12px);
  width: min(100%, 440px);
  display: flex;
  flex-direction: column;
  max-height: min(76vh, 680px); /* remplacée par la hauteur libre mesurée (InfoChips) */
  /* contour orange : on voit tout de suite que c'est une bulle posée par-dessus la discussion */
  border: 2px solid #e8912d;
  border-radius: 18px;
  background: var(--surface);
  box-shadow:
    var(--shadow),
    0 0 0 4px rgba(232, 145, 45, 0.14);
  animation: pop 0.14s ease-out;
  transform-origin: bottom left;
}
.info-bubble-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 6px 16px;
  border-bottom: 1px solid var(--divider);
}
.info-bubble-title {
  flex: 1;
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent);
}
.info-bubble-close {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--hover);
  color: var(--text);
  transition:
    transform 0.12s ease,
    background 0.15s ease;
}
.info-bubble-close:active,
.info-bubble-close:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.info-bubble-close:active {
  transform: scale(0.92);
}
.info-bubble-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 16px 16px;
  font-size: 1rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.info-bubble-title small {
  display: block;
  margin-top: 1px;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-2);
}
/* Fiche d'une bulle (QuickBar.js InfoCard) : bloc sombre, groupes en couleur, mots à écrire en pastilles */
.info-bubble-body.card {
  padding: 12px 12px 16px;
  white-space: normal;
}
.info-card {
  --c: #00a79e;
  --f: rgba(0, 167, 158, 0.13);
  color: var(--text);
}
.info-lead {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 16px;
  background: #1e464b;
  color: #fff;
}
.info-lead-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #00a79e;
}
.info-lead b {
  display: block;
  font-size: 1.0625rem;
}
.info-lead span {
  font-size: 0.9375rem;
  line-height: 1.35;
  opacity: 0.94;
}
.info-group {
  margin-top: 12px;
  border: 1.5px solid var(--f);
  border-radius: 16px;
  overflow: hidden;
}
.info-group.c-amber {
  --c: #d98a1f;
  --f: rgba(217, 138, 31, 0.16);
}
.info-group.c-blue {
  --c: #4f7cac;
  --f: rgba(79, 124, 172, 0.16);
}
.info-group h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 14px;
  background: var(--f);
  /* teinte du groupe, foncée vers la couleur du texte pour rester lisible sur le fond pâle */
  color: color-mix(in srgb, var(--c) 62%, var(--text));
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.info-group h3 i {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
}
.info-item {
  padding: 10px 14px 11px;
  border-top: 1px solid var(--divider);
}
.info-group h3 + .info-item,
.info-item:first-child {
  border-top: 0;
}
.info-words {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.info-word {
  display: inline-block;
  padding: 4px 12px;
  border: 1.5px solid var(--c);
  border-radius: 999px;
  background: var(--f);
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}
.info-item-text {
  margin-top: 6px;
  font-size: 1rem;
  line-height: 1.35;
  color: color-mix(in srgb, var(--text) 82%, transparent);
}
.info-note {
  padding: 10px 14px;
  background: var(--f);
  font-size: 0.9375rem;
  line-height: 1.35;
}
.info-examples {
  margin-top: 16px;
  padding: 0 2px;
}
.info-examples h4 {
  margin: 0 0 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-2);
}
.info-examples .info-word {
  margin: 0 6px 8px 0;
  border-color: var(--divider);
  background: var(--hover);
  font-weight: 600;
}
.start {
  padding-top: 0;
}
.start-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  height: 50px;
  color: var(--accent);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 760px;
  margin: 0 auto 6px;
  padding: 2px 0 2px 6px;
}
.reply-bar-icon {
  color: var(--accent);
}
.reply-bar-body {
  flex: 1;
  min-width: 0;
  border-left: 2px solid var(--accent);
  padding-left: 8px;
}
.reply-bar-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-bar-text {
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.commands {
  list-style: none;
  margin: -6px -6px 6px;
  padding: 4px 0;
  max-height: 220px;
  overflow-y: auto;
  border-bottom: 1px solid var(--divider);
}
.commands button {
  display: flex;
  align-items: baseline;
  gap: 10px;
  width: 100%;
  padding: 9px 16px;
  text-align: left;
}
.commands button:active,
.commands button:hover {
  background: var(--hover);
}
.cmd {
  font-weight: 600;
  color: var(--accent);
}
.cmd-desc {
  color: var(--text-2);
  font-size: 0.9063rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drop-zone {
  position: absolute;
  inset: 8px;
  z-index: 10;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  color: var(--accent);
  font-size: 1.125rem;
  font-weight: 600;
}

/* --- Menus, dialogues, toast ---------------------------------------------------------------- */

.menu-backdrop,
.menu-layer {
  position: fixed;
  inset: 0;
  z-index: 45;
}
html.touch .menu-layer {
  background: rgba(0, 0, 0, 0.18);
  animation: fade-in 0.15s ease;
}
.popover {
  position: absolute;
  z-index: 46;
  min-width: 210px;
  padding: 6px 0;
  border-radius: 12px;
  background: var(--menu-bg);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  animation: pop 0.14s ease-out;
  transform-origin: bottom left;
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
}
.popover button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 16px;
  font-size: 1rem;
  text-align: left;
  white-space: nowrap;
}
.popover button .icon {
  color: var(--icon);
}
.popover button:active,
.popover button:hover {
  background: var(--hover);
}
.popover button.danger,
.popover button.danger .icon {
  color: var(--danger);
}
.attach-menu {
  bottom: 46px;
  left: 0;
}
/* Boutons d'un robot en tête du menu 📎 (setChatBar, place « attach ») : « Scanner au chalet »… */
.popover button.menu-action {
  color: var(--accent);
  font-weight: 600;
}
.popover button.menu-action:disabled {
  opacity: 0.5;
}
.menu-action-icon {
  display: grid;
  place-items: center;
  width: 24px;
  color: var(--accent);
}
.menu-sep {
  height: 1px;
  margin: 6px 0;
  background: var(--divider);
}
.context-menu {
  position: fixed;
  transform-origin: top left;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.4);
  animation: fade-in 0.15s ease;
}
.dialog {
  width: min(340px, 100%);
  padding: 20px 20px 10px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: pop 0.16s ease-out;
  transform-origin: center;
}
.dialog-title {
  font-size: 1.0625rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.dialog-text {
  font-size: 0.9375rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 50vh;
  overflow-y: auto;
}
.dialog-input {
  width: 100%;
  margin-top: 12px;
  height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  font-size: 1rem;
  outline: none;
}
.dialog-input:focus {
  border-color: var(--accent);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 14px;
}
.dialog-btn {
  padding: 9px 14px;
  border-radius: 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9375rem;
}
.dialog-btn:hover {
  background: var(--accent-soft);
}
.dialog-btn.danger {
  color: var(--danger);
}
/* Un toast ne prend jamais un appui : les boutons qu'il recouvre (bas d'une fiche, composeur)
   restent touchables pendant qu'il s'affiche, et il s'efface seul */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 60;
  pointer-events: none;
  transform: translateX(-50%);
  max-width: min(92vw, 440px);
  width: max-content;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(20, 24, 28, 0.86);
  color: #fff;
  font-size: 0.9375rem;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: toast-in 0.2s ease-out;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
}

/* Feuille d'envoi */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  animation: fade-in 0.15s ease;
}
.sheet {
  width: min(520px, 100%);
  max-height: 92%;
  overflow-y: auto;
  padding: 6px 14px calc(14px + env(safe-area-inset-bottom));
  border-radius: 16px 16px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: slide-up 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@media (min-width: 768px) {
  .sheet-backdrop {
    align-items: center;
  }
  .sheet {
    border-radius: 16px;
    padding-bottom: 14px;
  }
}
.sheet-head {
  display: flex;
  align-items: center;
  min-height: 48px;
}
.sheet-head .text-btn {
  padding-left: 0;
}
.sheet-title {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 1.0625rem;
}
.sheet-head-spacer {
  width: 72px;
}
.upload-previews {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 4px 0 10px;
}
.upload-previews.single {
  grid-template-columns: 1fr;
}
.upload-item.visual {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--media-ph);
}
.upload-previews.single .upload-item.visual {
  aspect-ratio: auto;
  max-height: 46vh;
  display: flex;
  justify-content: center;
}
.upload-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.upload-previews.single .upload-item img {
  object-fit: contain;
  max-height: 46vh;
  width: auto;
  max-width: 100%;
}
.upload-item.doc {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.9375rem;
}
.check-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-fill);
}
.check-row small {
  color: var(--text-2);
}
.sheet-compose {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.caption-input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border-radius: 21px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  font-size: 1rem;
  outline: none;
}
.caption-input:focus {
  border-color: var(--accent);
}
.progress {
  position: relative;
  margin-top: 12px;
  height: 22px;
  border-radius: 11px;
  background: var(--search-bg);
  overflow: hidden;
}
.progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent-fill);
  transition: width 0.2s ease;
}
.progress-label {
  position: relative;
  display: block;
  text-align: center;
  font-size: 0.7813rem;
  line-height: 22px;
  font-weight: 600;
  mix-blend-mode: difference;
  color: #fff;
}
.form-error {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.875rem;
}
.form-error.upload-failed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.form-error.upload-failed .text-btn {
  flex-shrink: 0;
  font-weight: 600;
}

/* Visionneuse */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  color: #fff;
  animation: fade-in 0.18s ease;
}
.viewer-backdrop {
  position: absolute;
  inset: 0;
  background: #000;
}
.viewer-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(6px + env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 6px max(8px, env(safe-area-inset-left));
  background: linear-gradient(rgba(0, 0, 0, 0.55), transparent);
}
.viewer-top .icon-btn {
  color: #fff;
}
.viewer-top .icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}
.viewer-info {
  flex: 1;
  min-width: 0;
}
.viewer-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viewer-date {
  font-size: 0.8125rem;
  opacity: 0.75;
}
.viewer-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
}
.viewer-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}
.viewer-img.placeholder {
  position: absolute;
  filter: blur(6px);
}
.viewer-img.loading {
  opacity: 0;
}
.viewer-spinner {
  position: absolute;
}
.viewer-spinner .spinner {
  color: #fff;
}
.viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 48px;
  margin-top: -24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}
.viewer-nav.prev {
  left: max(12px, env(safe-area-inset-left));
}
.viewer-nav.next {
  right: max(12px, env(safe-area-inset-right));
}
html.touch .viewer-nav {
  display: none;
}
.viewer-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 24px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  font-size: 0.9375rem;
  white-space: pre-wrap;
  max-height: 40%;
  overflow-y: auto;
}
/* PDF : la page occupe tout l'espace entre les deux barres, rien ne passe par-dessus (le montant
   est souvent en bas) ; gros bouton « Ouvrir le PDF » en bas. */
.viewer.is-pdf .viewer-stage {
  position: relative;
  inset: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.viewer-img.page {
  width: 100%;
  height: 100%;
}
.viewer-doc-bar {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 10px max(16px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.viewer-doc-name {
  max-width: 100%;
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.viewer-doc-name .tech {
  font-weight: 400;
  opacity: 0.75;
}
/* PDF de plusieurs pages : « ‹ Page 1 sur 2 › », visible aussi au toucher (les flèches sur les
   côtés y sont masquées) */
.viewer-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 100%;
}
.viewer-page {
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.viewer-pager .icon-btn:disabled {
  opacity: 0.35;
}
.viewer-open-pdf {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(100%, 26rem);
  min-height: 3.25rem;
  padding: 10px 20px;
  border-radius: 14px;
  background: var(--accent-fill);
  color: #fff;
  font-size: 1.0625rem;
  font-weight: 600;
}
.viewer-open-pdf::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--p, 0) * 100%);
  background: rgba(255, 255, 255, 0.2);
  transition: width 0.2s ease;
}
.viewer-open-pdf > * {
  position: relative;
}
.viewer-open-pdf .spinner {
  color: #fff;
}
.viewer-open-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  opacity: 0.85;
}
.viewer.is-pdf ~ .toast {
  bottom: calc(7rem + 24px + env(safe-area-inset-bottom));
}

/* --- Réglages ------------------------------------------------------------------------------- */

.settings {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg-2);
}
.settings-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px max(0px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(0px, env(safe-area-inset-left));
}
.settings-scroll > * {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 16px 22px;
  text-align: center;
}
.profile-name {
  margin-top: 8px;
  font-size: 1.375rem;
  font-weight: 600;
}
.profile-sub {
  color: var(--text-2);
  font-size: 0.9375rem;
}
.group {
  margin-bottom: 24px;
  padding: 0 16px;
}
.group-title {
  padding: 0 14px 6px;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-2);
}
.group-body {
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.group-foot {
  padding: 7px 14px 0;
  font-size: 0.8125rem;
  color: var(--text-2);
}
.cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 9px 14px;
  text-align: left;
  color: inherit;
}
.cell + .cell::before,
.token-once + .cell::before {
  content: '';
  position: absolute;
  top: 0;
  left: 56px;
  right: 0;
  border-top: 0.5px solid var(--divider);
}
.cell.link:active {
  background: var(--pressed);
}
@media (hover: hover) {
  .cell.link:hover {
    background: var(--hover);
  }
}
.cell-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent-fill);
  color: #fff;
}
.cell-icon.warn {
  background: #ff9500;
}
.cell-icon.ok {
  background: #34c759;
}
.cell-icon.danger {
  background: var(--danger);
}
.cell-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.cell-title {
  font-size: 1rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.cell-title.primary {
  color: var(--accent);
}
.cell-title.mono {
  font-family: var(--mono);
  font-size: 0.9375rem;
}
.cell.danger .cell-title {
  color: var(--danger);
}
.cell-sub {
  font-size: 0.8125rem;
  color: var(--text-2);
}
.cell-chevron {
  color: var(--text-3);
}
.cell.radio .cell-body {
  padding-left: 2px;
}
.cell.radio + .cell.radio::before {
  left: 14px;
}
.radio-check {
  color: var(--accent);
}
.tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  margin-left: 4px;
}
.switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 51px;
  height: 31px;
  margin: 0;
  border-radius: 16px;
  background: var(--switch-off);
  cursor: pointer;
  transition: background 0.2s;
}
.switch::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.switch:checked {
  background: #34c759;
}
.switch:checked::before {
  transform: translateX(20px);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 14px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn.primary {
  background: var(--accent-fill);
  color: #fff;
}
.btn.primary .spinner {
  color: #fff;
}
.btn.danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn.small {
  min-height: 32px;
  padding: 3px 12px;
  font-size: 0.875rem;
}
.btn.block {
  width: 100%;
  min-height: 50px;
  border-radius: 12px;
  font-size: 1rem;
}
.token-once {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  padding: 12px 14px;
  background: var(--accent-soft);
}
.token-label {
  font-size: 0.875rem;
  font-weight: 600;
}
.token-value {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 0.8125rem;
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}
.app-version {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-3);
}
.help {
  padding: 0 20px;
}
.help-hero {
  width: 72px;
  height: 72px;
  margin: 8px auto 14px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(#ff5e57, #ff3b30);
}
.help h2 {
  text-align: center;
  font-size: 1.25rem;
  margin-bottom: 10px;
}
.help p {
  color: var(--text-2);
  font-size: 0.9375rem;
}
.help-warn {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger) !important;
}
.steps {
  list-style: none;
  margin: 18px 0;
  padding: 0;
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.steps li {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  font-size: 0.9688rem;
}
.steps li + li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50px;
  right: 0;
  border-top: 0.5px solid var(--divider);
}
.step-n {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-fill);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
}
.inline-icon {
  display: inline-block;
  vertical-align: -3px;
  color: var(--accent);
}
.help-note {
  font-size: 0.8438rem !important;
}

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

.login {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg-2);
}
.login-card {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: center;
}
.login-logo {
  align-self: center;
  width: min(240px, 70vw);
  height: auto;
}
.login-title {
  margin: 8px 0 6px;
  font-size: 1.625rem;
  font-weight: 700;
}
.login-text {
  margin: 0 0 20px;
  color: var(--text-2);
  font-size: 0.9688rem;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.code-input {
  min-height: 54px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--input-border);
  background: var(--surface);
  text-align: center;
  font-family: var(--mono);
  font-size: 1.375rem;
  letter-spacing: 0.18em;
  outline: none;
}
.code-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.code-input::placeholder {
  font-family: var(--font);
  font-size: 1rem;
  letter-spacing: 0;
  color: var(--text-3);
}
.login-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: var(--text-3);
  font-size: 0.875rem;
}
.login-sep::before,
.login-sep::after {
  content: '';
  flex: 1;
  border-top: 1px solid var(--divider);
}
.login .btn:not(.primary) {
  background: var(--surface);
  border: 1px solid var(--divider);
}
.login-card > .text-btn {
  margin-top: 8px;
}
.login-hint {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 22px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 0.875rem;
  text-align: left;
  color: var(--text);
}
.login-hint .icon {
  color: var(--accent);
  margin-top: 1px;
}

/* --- Gros envois (par morceaux) ------------------------------------------------------------- */

.media.video video {
  object-fit: contain;
  background: #000;
}
.upload-row .msg {
  width: min(320px, 100%);
}
.upload-bubble {
  width: 100%;
}
.upload-bubble .doc {
  min-width: 0;
}
.upload-ring {
  position: relative;
  border: 0;
  cursor: pointer;
  background: var(--accent-in);
}
.msg-row.out .upload-ring {
  background-color: var(--accent-out);
}
.upload-ring::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: conic-gradient(rgba(255, 255, 255, 0.95) calc(var(--p, 0) * 360deg), rgba(255, 255, 255, 0.25) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px));
  transition: background 0.2s;
}
.doc-icon.warn,
.msg-row.out .doc-icon.warn {
  background: #f0a020;
}
.upload-bar {
  height: 4px;
  margin: 8px 0 2px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.08);
}
@media (prefers-color-scheme: dark) {
  .upload-bar {
    background: rgba(255, 255, 255, 0.14);
  }
}
.upload-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-out);
  transition: width 0.25s linear;
}
.msg-row.in .upload-bar-fill {
  background: var(--accent-in);
}
.upload-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.8438rem;
  font-weight: 500;
}
.upload-status.warn {
  color: #b7791f;
}
.upload-status.warn .spinner {
  color: currentColor;
}
.upload-status.error {
  color: var(--danger);
}
@media (prefers-color-scheme: dark) {
  .upload-status.warn {
    color: #f0c46a;
  }
}
.upload-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.upload-bubble.interrupted .doc-name {
  -webkit-line-clamp: 3;
}
.keep-open-banner {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--accent-fill);
  color: #fff;
  font-size: 0.875rem;
  line-height: 1.3;
  animation: fade-in 0.2s ease;
}
.keep-open-banner.warn {
  background: #d9822b;
}
.form-hint {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 4px 0 6px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  font-size: 0.8438rem;
}
.form-hint .icon {
  color: var(--accent);
  margin-top: 1px;
}

/* Pastille de date flottante : seulement pendant le défilement, puis fondu. */
.floating-date {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.35s ease,
    visibility 0s linear 0.35s;
}
.floating-date.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.15s ease;
}
@media (prefers-reduced-motion: reduce) {
  .floating-date,
  .floating-date.visible {
    transition: none;
  }
  .stack-card,
  .fiche-page > * {
    animation: none;
  }
}

/* --- Bandeau « Activer les notifications sur cet appareil » (liste des discussions) --------- */

.push-banner {
  position: relative;
  z-index: 3;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px 8px 14px;
  background: var(--bg-2);
  color: var(--text);
  border-bottom: 1px solid var(--divider);
  font-size: 0.9375rem;
  line-height: 1.3;
  animation: fade-in 0.2s ease;
}
.push-banner-icon {
  flex-shrink: 0;
  color: var(--accent);
}
.push-banner-text {
  flex: 1;
  min-width: 0;
}
.push-banner .btn {
  flex-shrink: 0;
}
.push-banner-close {
  flex-shrink: 0;
  color: var(--text-2);
}
.cell-sub .push-on {
  color: var(--accent);
}

/* --- Fiche unique (lot du 11/10/2026) : saisie dans la carte, Accueil à tuiles ---------------- */

:root {
  --lv-ok: #2b8448;
  --lv-ok-soft: rgba(43, 132, 72, 0.12);
  --lv-warn: #9a6512;
  --lv-warn-soft: rgba(214, 140, 20, 0.14);
  --tile-bg: var(--surface);
  --tile-ic-bg: var(--search-bg);
}
@media (prefers-color-scheme: dark) {
  :root {
    --lv-ok: #62c885;
    --lv-ok-soft: rgba(98, 200, 133, 0.14);
    --lv-warn: #e6b354;
    --lv-warn-soft: rgba(230, 179, 84, 0.15);
    --tile-bg: #1e2a36;
    --tile-ic-bg: #2a3846;
  }
}

/* Saisie dans la carte : le texte part au robot avec le clic (bouton à saisie) */
.kb-btn.has-input.active {
  background: var(--kb-bg-active);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}
.kb-input {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  padding: 10px;
  border-radius: 14px;
  background: var(--bubble-in);
  color: var(--text-in);
  box-shadow: var(--bubble-shadow);
  animation: fade-in 0.15s ease;
}
.kb-input-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-in);
}
.kb-input-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.kb-chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--divider);
  background: var(--search-bg);
  color: var(--text);
  font-size: 0.8438rem;
  line-height: 1.2;
}
.kb-chip:active {
  background: var(--pressed);
}
.kb-input-field {
  width: 100%;
  min-height: 76px;
  max-height: 40vh;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* 16 px : pas de zoom automatique sur iPhone */
  line-height: 1.35;
  resize: vertical;
}
.kb-input-field:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}
.kb-input-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.kb-input-cancel,
.kb-input-send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
}
.kb-input-cancel {
  color: var(--text-2);
}
.kb-input-send {
  background: var(--accent-fill);
  color: #fff;
}
.kb-input-send:disabled {
  opacity: 0.5;
}

/* Accueil : tuiles posées par les robots */
.home {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 12px 20px;
}
.home-label {
  margin: 0 4px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  padding: 12px;
  border-radius: 16px;
  background: var(--tile-bg);
  color: var(--text);
  text-align: left;
  border: 1px solid var(--divider);
  transition: background 0.15s ease;
}
.tile:active {
  background: var(--pressed);
}
@media (hover: hover) {
  .tile:hover {
    background: var(--hover);
  }
}
.tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tile.wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
}
.tile-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--tile-ic-bg);
  color: var(--text-2);
}
.tile-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  width: 100%;
}
.tile-title {
  font-size: 0.8438rem;
  font-weight: 500;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.tile-value {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.tile-detail {
  font-size: 0.8125rem;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.tile.lv-info .tile-ic {
  background: var(--accent-soft);
  color: var(--accent);
}
.tile.lv-ok .tile-ic {
  background: var(--lv-ok-soft);
  color: var(--lv-ok);
}
.tile.lv-warn .tile-ic {
  background: var(--lv-warn-soft);
  color: var(--lv-warn);
}
.tile.lv-alert {
  border-color: var(--danger-soft);
}
.tile.lv-alert .tile-ic {
  background: var(--danger-soft);
  color: var(--danger);
}
.tile.lv-alert .tile-value {
  color: var(--danger);
}

/* Écran « Envoyer à… » (feuille de partage Android) */
.share-what {
  padding: 0 14px 10px;
  font-size: 0.9375rem;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.share-search {
  width: 100%;
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
  font: inherit;
}
.share-wait {
  display: grid;
  place-items: center;
  padding: 48px 0;
}
.share-target .avatar {
  flex-shrink: 0;
}

/* Réglages → Partage → Conversations proposées */
.share-pref {
  align-items: flex-start;
}
.share-pref.off .cell-title {
  color: var(--text-2);
}
.share-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.share-kinds .kind {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 3px 11px;
  border-radius: 16px;
  border: 1px solid var(--divider);
  color: var(--text-2);
  font-size: 0.875rem;
}
.share-kinds .kind.on {
  border-color: transparent;
  background: var(--accent-fill);
  color: #fff;
}
.share-order {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.share-order .icon-btn:disabled {
  opacity: 0.25;
}

/* Mode simple (Réglages → Affichage, util/simpleMode.js) : texte grand (textSize.js), deux onglets,
   boutons des cartes plus grands et plus espacés, informations techniques masquées. */
html.simple .tech {
  display: none !important;
}
.cell.toggle-cell.disabled {
  opacity: 0.6;
}
.cell.toggle-cell.disabled .switch {
  cursor: default;
}
/* Deux onglets de même largeur, faciles à toucher */
html.simple .filter {
  flex: 1 1 0;
  justify-content: center;
  padding: 13px 12px 14px;
  font-size: 1.0625rem;
  font-weight: 600;
}
/* Boutons des cartes : plus hauts, plus espacés, libellé entier sur plusieurs lignes au besoin
   (pas de « … ») ; une ligne trop serrée passe à la ligne suivante, dans le même ordre. */
html.simple .keyboard {
  gap: 10px;
  margin-top: 8px;
}
html.simple .kb-row {
  flex-wrap: wrap;
  gap: 10px;
}
html.simple .kb-btn {
  flex: 1 1 8em;
  min-height: 3.25rem;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 1.0625rem;
  font-weight: 600;
}
html.simple .kb-text {
  white-space: normal;
  overflow-wrap: anywhere;
}
html.simple .kb-corner {
  top: 6px;
  right: 6px;
}
html.simple .kb-input-label,
html.simple .kb-chip {
  font-size: 1rem;
}
html.simple .kb-chip {
  padding: 9px 14px;
}
html.simple .kb-input-actions {
  gap: 12px;
}
html.simple .kb-input-cancel,
html.simple .kb-input-send {
  min-height: 3rem;
  padding: 10px 20px;
  font-size: 1.0625rem;
}
/* Pile « À traiter » : flèches plus grandes et plus écartées */
html.simple .stack-nav {
  gap: 14px;
}
html.simple .stack-btn {
  width: 56px;
  height: 56px;
}
html.simple .stack-btn .icon {
  width: 28px;
  height: 28px;
}
/* Fiche à pages : flèches plus grandes, comme celles de la pile ; « ● k à traiter » plus grand */
html.simple .fiche-nav {
  gap: 8px;
}
html.simple .fiche-btn {
  width: 56px;
  height: 56px;
}
html.simple .fiche-btn .icon {
  width: 28px;
  height: 28px;
}
html.simple .fiche-todo {
  min-height: 2.75rem;
  padding: 6px 14px;
  font-size: 1rem;
}
html.simple .fiche-sub,
html.simple .fiche-day {
  font-size: 0.9375rem;
}
/* Visionneuse d'un PDF : bouton « Ouvrir le PDF » encore plus grand */
html.simple .viewer-open-pdf {
  min-height: 3.75rem;
  font-size: 1.1875rem;
}
/* Accueil : une tuile par ligne, grande, icône à gauche */
html.simple .tiles {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
html.simple .tile {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 16px;
}
html.simple .tile-ic {
  width: 44px;
  height: 44px;
}
html.simple .tile-title {
  font-size: 1rem;
}
html.simple .tile-detail {
  font-size: 0.9375rem;
}
/* Sans onglet « À traiter », l'indicateur de la liste doit se voir */
html.simple .ci-todo .icon {
  width: 22px;
  height: 22px;
}
/* Petits textes secondaires un peu plus grands */
html.simple .ci-time,
html.simple .meta,
html.simple .doc-size,
html.simple .cell-sub,
html.simple .home-label {
  font-size: 0.875rem;
}
/* Mots-clés d'une conversation proposée (Réglages → Partage) */
.share-keywords {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}
.share-keywords-label {
  font-size: 0.8125rem;
  color: var(--text-2);
}
.share-keywords-input {
  width: 100%;
  height: 2.5rem;
  padding: 0 12px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* 16 px au moins : pas de zoom automatique sur iPhone */
}
.share-keywords-input::placeholder {
  color: var(--text-3);
}
.share-keywords-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}
