/* TalatYai app — colours of the validated mock-ups: blue #2477c9, orange accent #f58220,
   background #f5f7fb, text #1f2937. System fonts (Thai and Cyrillic built in). */
:root {
  --blue: #2477C9;
  --blue-dark: #1B5FA3;
  --blue-soft: #E8F1FB;
  --orange: #F58220;
  --orange-dark: #DE6F0F;
  --orange-soft: #FFF1E4;
  --page: #F5F7FB;
  --surface: #FFFFFF;
  --text: #1F2937;
  --muted: #6B7280;
  --divider: #E5E7EB;
  --danger: #B42318;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(31, 41, 55, .05), 0 4px 14px rgba(31, 41, 55, .06);
  --tabbar-h: 64px;
  --topbar-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --page: #292D33;
  --surface: #414750;
  --panel: #343941;
  --text: #F1F3F6;
  --muted: #B9C0C9;
  --divider: #4D545E;
  --blue-soft: #2C3E55;
  --orange-soft: #4A3626;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--page); }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 400 1rem/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", "Noto Sans", Tahoma, sans-serif;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
:root[data-theme="dark"] a { color: #7DB5EE; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.center { text-align: center; }
.pad { padding: 16px; }
.ic-blue { color: var(--blue); }
.ic-orange { color: var(--orange); }
:root[data-theme="dark"] .ic-blue { color: #6FAEF0; }
:root[data-theme="dark"] .ic-orange { color: #FFA559; }

/* ---------- Header ---------- */
#app { min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: calc(var(--topbar-h) + var(--safe-t)); padding: var(--safe-t) 6px 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  background: var(--panel, var(--surface)); border-bottom: 1px solid var(--divider);
}
.brand { justify-self: center; }
.brand img { height: 28px; width: auto; }
.topbar-actions { justify-self: end; display: flex; gap: 2px; }
.top-nav { display: none; }
/* Account icon of the header: hidden on phones (the bottom bar has "Compte"), kept on wide screens without bottom bar. */
.topbar .account-btn { display: none; }
.icon-btn { position: relative; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 50%; display: inline-grid; place-items: center; color: var(--text); }
:root[data-theme="dark"] .icon-btn { color: var(--text); }
.icon-btn:active { background: var(--blue-soft); }
.icon-btn.small { width: 36px; height: 36px; }
.icon-spacer { width: 44px; }
.badge-dot { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #E5383B; color: #fff; font-size: .68rem; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--panel, var(--surface)); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: inline-grid; place-items: center; font-weight: 700; object-fit: cover; flex: none; }
.avatar.small { width: 30px; height: 30px; font-size: .85rem; }
.avatar.big { width: 56px; height: 56px; font-size: 1.4rem; }

.main { padding: 0 16px calc(var(--tabbar-h) + var(--safe-b) + 24px); max-width: 1280px; margin: 0 auto; outline: none; container-type: inline-size; }

/* ---------- Bottom navigation ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--panel, var(--surface)); border-top: 1px solid var(--divider);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: .72rem; min-width: 0; }
:root[data-theme="dark"] .tab { color: var(--muted); }
.tab-icon { position: relative; display: grid; place-items: center; }
.tab-icon .badge-dot { top: -6px; right: -10px; }
.tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.tab[aria-current="page"] { color: var(--blue); font-weight: 600; }
:root[data-theme="dark"] .tab[aria-current="page"] { color: #7DB5EE; }
.tab-post .tab-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--orange); color: #fff; margin-top: -20px; box-shadow: 0 6px 14px rgba(245, 130, 32, .4); }
.tab-post { color: var(--text); font-weight: 600; }

/* ---------- Side menu ---------- */
.drawer-backdrop, .sheet-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(17, 24, 39, .45); }
.drawer { position: fixed; z-index: 51; top: 0; bottom: 0; left: 0; width: min(320px, 86vw); padding: calc(var(--safe-t) + 8px) 12px calc(var(--safe-b) + 16px); background: var(--surface); display: flex; flex-direction: column; gap: 8px; overflow-y: auto; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(-30px); opacity: 0; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px 8px; border-bottom: 1px solid var(--divider); }
.drawer-head img { height: 26px; width: auto; }
.drawer-row { display: flex; align-items: center; gap: 14px; min-height: 50px; padding: 0 10px; border-radius: 12px; color: var(--text); font-weight: 500; }
:root[data-theme="dark"] .drawer-row { color: var(--text); }
.drawer-row svg { color: var(--blue); }
.drawer-row:active { background: var(--blue-soft); }
.drawer-settings { border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider); padding: 6px 4px; margin-top: auto; }

/* ---------- Buttons and fields ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--divider); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; }
:root[data-theme="dark"] .btn { color: var(--text); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff !important; }
.btn-accent { background: var(--orange); border-color: var(--orange); color: #fff !important; box-shadow: 0 4px 12px rgba(245, 130, 32, .3); }
.btn-outline { background: var(--surface); border: 2px solid var(--blue); color: var(--blue) !important; }
:root[data-theme="dark"] .btn-outline { color: #7DB5EE !important; border-color: #7DB5EE; }
.btn-block { width: 100%; }
.btn.small { min-height: 38px; padding: 0 14px; font-size: .9rem; }
.btn:disabled { opacity: .6; }
.link { background: none; border: 0; padding: 0; color: var(--blue); font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
:root[data-theme="dark"] .link { color: #7DB5EE; }
.input, .select { width: 100%; min-height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--divider); background: var(--surface); }
.input.small { min-height: 42px; text-align: center; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.field-label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin: 0 0 6px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); }
.switch { appearance: none; width: 50px; height: 30px; border-radius: 15px; background: #D1D5DB; position: relative; flex: none; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch:checked { background: var(--blue); }
.switch:checked::after { transform: translateX(20px); }
:root[data-theme="dark"] .switch:not(:checked) { background: #5B626C; }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: center; gap: 4px; min-height: 52px; margin: 4px -8px 8px; }
.page-header h1 { flex: 1; margin: 0; font-size: 1.15rem; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-actions { display: flex; gap: 4px; align-items: center; min-width: 44px; justify-content: flex-end; padding-right: 8px; }

/* ---------- Home ---------- */
.hero {
  position: relative; margin: 0 -16px; padding: 28px 18px 22px; min-height: 230px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 16px;
  background: url("hero.svg") center / cover no-repeat, #1E8FB8; color: #fff;
}
.hero-text h1 { margin: 0; font-size: 1.65rem; line-height: 1.15; font-weight: 800; text-shadow: 0 2px 10px rgba(0, 0, 0, .35); max-width: 15ch; }
.hero-text p { margin: 6px 0 0; font-size: .92rem; opacity: .95; text-shadow: 0 1px 6px rgba(0, 0, 0, .35); }
.hero-search { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 16px; border-radius: 999px; border: 0; background: #fff; color: #6B7280; text-align: left; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.block { margin: 22px 0; }
.tiles-block { margin-top: 16px; }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.block-head h2 { margin: 0; font-size: 1.08rem; font-weight: 700; }
.tile-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 96px; padding: 12px 6px; border: 0; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); color: var(--text); font-size: .82rem; font-weight: 600; text-align: center; line-height: 1.2; }
.tile:active { transform: scale(.98); }
.tile > svg:not(.ic-orange):not(.ic-blue) { color: var(--blue); }
:root[data-theme="dark"] .tile > svg:not(.ic-orange):not(.ic-blue) { color: #6FAEF0; }
.tile-grid.in-sheet { padding: 8px 4px; }
.tile-grid.in-sheet .tile { box-shadow: none; background: var(--page); }
.carousel { display: grid; grid-auto-flow: column; grid-auto-columns: max(150px, 46%); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.slide { position: relative; scroll-snap-align: start; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.slide-body { padding: 8px 10px 10px; }

/* ---------- Cards ---------- */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container (min-width: 560px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } .carousel { grid-auto-columns: max(170px, 30%); } }
@container (min-width: 820px) { .cards { grid-template-columns: repeat(4, minmax(0, 1fr)); } .carousel { grid-auto-columns: max(190px, 23%); margin: 0; padding: 0 0 6px; scroll-padding-inline: 0; } .tile-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@container (max-width: 300px) { .cards { grid-template-columns: 1fr; } .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card { position: relative; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card.framed, .row-card.framed { outline: 2px solid var(--orange); }
.card-link, .row-link { display: block; color: inherit !important; height: 100%; }
.card-photo { position: relative; aspect-ratio: 4 / 3; background: var(--blue-soft); overflow: hidden; }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.no-photo { width: 100%; height: 100%; display: grid; place-items: center; color: var(--blue); opacity: .45; }
.no-photo.big { min-height: 260px; }
.badges { position: absolute; left: 8px; bottom: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .7rem; font-weight: 700; background: var(--blue-soft); color: var(--blue); }
.badge-featured { background: var(--blue); color: #fff; }
.badge-pro { background: #1F2937; color: #fff; }
:root[data-theme="dark"] .badge-pro { background: #F1F3F6; color: #292D33; }
.badge-urgent { background: var(--orange); color: #fff; }
.card-body { padding: 10px 12px 12px; display: grid; gap: 3px; }
.card-title { margin: 0; font-size: .92rem; font-weight: 700; line-height: 1.28; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-title.one { -webkit-line-clamp: 1; font-size: .86rem; }
.price { margin: 0; font-weight: 800; color: var(--orange); font-size: 1rem; }
:root[data-theme="dark"] .price { color: #FFA559; }
.card-type { margin: 0; font-size: .85rem; color: var(--muted); }
.card-specs { margin: 0; display: flex; flex-wrap: wrap; gap: 4px; font-size: .74rem; color: var(--muted); }
.card-specs span + span::before { content: "· "; }
.meta-line { margin: 0; display: flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--text); min-width: 0; }
.meta-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta-line svg { flex: none; color: var(--muted); }
.meta-line.muted { color: var(--muted); }
.heart { width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .92); color: #374151; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.heart.on { color: #E5383B; }
.heart.on svg { fill: currentColor; }
.card-heart { position: absolute; right: 8px; top: 8px; }
.heart.plain { width: 44px; height: 44px; background: none; box-shadow: none; color: var(--text); }
.heart.plain.on { color: #E5383B; }

/* List rows (results) */
.rows { display: grid; gap: 10px; }
.row-card { position: relative; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.row-link { display: grid !important; grid-template-columns: 38% 1fr; gap: 12px; padding: 8px; }
.row-link .card-photo { aspect-ratio: 1 / 1; border-radius: 12px; }
.row-body { display: grid; align-content: start; gap: 4px; min-width: 0; padding: 4px 34px 4px 0; }
.row-body .badge-pro { justify-self: start; }
.row-card .card-heart { top: 14px; left: calc(38% - 34px); right: auto; }
@container (min-width: 560px) { .rows { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.skeleton .card-photo, .skeleton.gallery, .line, .f-loading { background: linear-gradient(90deg, var(--blue-soft) 25%, var(--page) 50%, var(--blue-soft) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.line { display: block; height: 12px; border-radius: 6px; margin: 6px 0; }
.line.short { width: 55%; }
.f-loading { height: 120px; border-radius: 14px; margin: 8px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Search and results ---------- */
.search-wrap { position: relative; display: flex; align-items: center; gap: 6px; margin: 12px 0 10px; min-height: 50px; padding: 0 6px 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--divider); box-shadow: var(--shadow); }
.search-wrap > svg { color: var(--muted); flex: none; }
.search-input { flex: 1; min-width: 0; border: 0; background: none; height: 48px; outline: none; }
.search-input::-webkit-search-cancel-button { display: none; }
.suggestions { position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--divider); border-radius: 16px; box-shadow: 0 10px 28px rgba(31, 41, 55, .16); }
.suggestion { width: 100%; display: grid; grid-template-columns: 36px 1fr; grid-template-areas: "icon label" "icon detail"; align-items: center; column-gap: 10px; text-align: left; padding: 8px; border: 0; background: none; border-radius: 10px; }
.suggestion:active { background: var(--blue-soft); }
.suggestion > svg, .suggestion > img { grid-area: icon; width: 36px; height: 36px; object-fit: cover; border-radius: 8px; color: var(--blue); }
.suggestion > svg { padding: 8px; }
.suggestion span { grid-area: label; font-weight: 600; }
.suggestion small { grid-area: detail; color: var(--muted); }
.toolbar { display: flex; gap: 10px; align-items: center; }
.filter-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 999px; background: var(--blue); color: #fff !important; font-weight: 700; flex: none; }
.pill-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--orange); color: #fff; font-size: .78rem; display: grid; place-items: center; }
.sort-select { flex: 1; min-width: 0; min-height: 42px; padding: 0 34px 0 16px; border-radius: 999px; border: 1px solid var(--divider); background: var(--surface); appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; font-size: .9rem; }
.results-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 12px 2px 8px; }
.result-count { margin: 0; font-weight: 600; font-size: .92rem; }
.results-col > .btn-block { margin-top: 14px; }

/* Filters + results side by side when the screen is wide enough (open foldable, tablet) */
.split { display: grid; grid-template-columns: minmax(280px, 38%) 1fr; gap: 20px; align-items: start; padding-top: 12px; }
.split-side { position: sticky; top: calc(var(--topbar-h) + var(--safe-t) + 12px); max-height: calc(100dvh - var(--topbar-h) - var(--safe-t) - 24px - var(--tabbar-h)); display: flex; }
.split .rows { grid-template-columns: 1fr; }
.split .search-wrap { margin-top: 0; }

/* ---------- Filter panel ---------- */
.filters { display: flex; flex-direction: column; width: 100%; }
.filters-screen { min-height: calc(100dvh - var(--topbar-h) - var(--safe-t) - var(--tabbar-h)); }
.filters-side { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; max-height: inherit; }
.filters-head { display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 4px 4px 4px 0; }
.filters-side .filters-head { padding: 8px 14px; border-bottom: 1px solid var(--divider); }
.filters-head h2 { flex: 1; margin: 0; font-size: 1.15rem; }
.filters-screen .filters-head h2 { text-align: center; }
.filters-body { display: grid; gap: 10px; padding: 4px 0 16px; overflow-y: auto; }
.filters-side .filters-body { padding: 12px; }
.filters-foot { position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-b)); padding: 10px 0 12px; background: linear-gradient(transparent, var(--page) 25%); }
.filters-side .filters-foot { position: static; padding: 12px; background: var(--surface); border-top: 1px solid var(--divider); }
.f-row { width: 100%; background: var(--surface); border: 1px solid var(--divider); border-radius: 14px; padding: 12px 14px; text-align: left; color: var(--text); }
.filters-side .f-row { background: var(--page); border-color: transparent; }
.f-nav, .f-switch, .f-stepper { display: flex; align-items: center; gap: 12px; min-height: 54px; }
.f-icon { width: 24px; display: grid; place-items: center; color: var(--blue); flex: none; }
.f-icon .ic-orange { color: var(--orange); }
.f-label { font-weight: 600; flex: 1; }
.f-value { color: var(--muted); font-size: .9rem; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.f-nav > svg:last-child { color: var(--muted); flex: none; }
.f-block { display: grid; gap: 10px; }
.f-title { display: flex; align-items: center; gap: 12px; }
.f-range { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.dash { color: var(--muted); }
.f-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.f-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--divider); background: var(--surface); font-size: .9rem; }
.f-chip .ring { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #9CA3AF; }
.f-chip[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.f-chip.removable { background: var(--surface); border-color: var(--divider); color: var(--text); }
.f-chip.removable svg { color: var(--muted); }
.stepper { display: flex; align-items: center; gap: 4px; border: 1px solid var(--divider); border-radius: 12px; background: var(--surface); }
.stepper button { width: 38px; height: 38px; border: 0; background: none; display: grid; place-items: center; color: var(--text); }
.stepper output { min-width: 44px; text-align: center; font-weight: 700; }
.f-more-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; background: var(--blue-soft); border-color: transparent; font-weight: 700; }
.f-more-toggle svg { transform: rotate(90deg); color: var(--blue); transition: transform .15s; }
.f-more-toggle[aria-expanded="true"] svg { transform: rotate(-90deg); }
.f-more { display: grid; gap: 10px; }
.f-active { background: var(--blue-soft); border-radius: 14px; padding: 12px 14px; display: grid; gap: 10px; }
.f-active-title { margin: 0; font-weight: 700; }
.f-hint { margin: 0; color: var(--muted); font-size: .88rem; padding: 0 4px; }

/* ---------- Sheets ---------- */
.sheet { position: fixed; z-index: 51; left: 0; right: 0; bottom: 0; max-height: 85dvh; display: flex; flex-direction: column; background: var(--surface); border-radius: 22px 22px 0 0; padding-bottom: var(--safe-b); animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 20px; border-bottom: 1px solid var(--divider); }
.sheet-head h2 { margin: 0; font-size: 1.05rem; }
.sheet-body { overflow-y: auto; padding: 6px 8px 16px; overscroll-behavior: contain; }
.sheet-row { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 0; border-radius: 12px; background: none; text-align: left; }
.sheet-row > span { flex: 1; }
.sheet-row > svg:last-child { color: var(--muted); flex: none; }
.sheet-row.strong { font-weight: 700; color: var(--blue); }
.sheet-row.selected { background: var(--blue-soft); font-weight: 600; }
.sheet-back { color: var(--muted); font-size: .9rem; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, 90vw); transform: translate(-50%, -50%); border-radius: 22px; animation: none; }
}

/* ---------- Ad detail ---------- */
.ad-bar { display: flex; align-items: center; justify-content: space-between; margin: 0 -8px; min-height: 52px; }
.ad-bar-actions { display: flex; }
.ad-layout { display: grid; gap: 14px; }
.gallery { position: relative; margin: 0 -16px; background: #111; overflow: hidden; }
.gallery-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; aspect-ratio: 4 / 3; max-height: 66dvh; }
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track > * { flex: 0 0 100%; scroll-snap-align: center; width: 100%; height: 100%; object-fit: cover; }
.gallery.skeleton { aspect-ratio: 4 / 3; }
.dots { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; justify-content: center; gap: 6px; pointer-events: none; }
.dots span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, .6); }
.dots span.on { background: #fff; }
.gallery-count { position: absolute; right: 12px; bottom: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .8rem; }
.ad-info { display: grid; gap: 6px; min-width: 0; }
.ad-title { margin: 4px 0 0; font-size: 1.35rem; line-height: 1.25; overflow-wrap: anywhere; }
.ad-price { margin: 0; font-size: 1.55rem; font-weight: 800; color: var(--orange); }
:root[data-theme="dark"] .ad-price { color: #FFA559; }
.ad-info > .meta-line { font-size: .92rem; }
.key-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 8px 0 2px; padding: 12px 6px; border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider); }
.key-fact { display: grid; justify-items: center; gap: 4px; text-align: center; font-size: .82rem; font-weight: 600; min-width: 0; }
.key-fact svg { color: var(--text); }
.key-fact span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-section { margin-top: 8px; padding: 16px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.ad-section h2 { margin: 0 0 8px; font-size: 1rem; }
.ad-text { margin: 0 0 6px; white-space: pre-line; overflow-wrap: anywhere; color: var(--text); }
.ad-text.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 16px; margin: 0 0 8px; }
.fact dt { font-size: .78rem; color: var(--muted); }
.fact dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.seller-row { display: flex; align-items: center; gap: 12px; }
.seller-row > div { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ad-views { font-size: .8rem; margin: 10px 0 0; }
.notice { margin: 8px 0; padding: 10px 14px; border-radius: 12px; background: var(--blue-soft); color: var(--text); font-size: .9rem; }
.link-notice { display: block; margin: 0 0 12px; color: var(--text) !important; }
.contact-bar { position: fixed; z-index: 25; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b)); display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; padding: 10px 16px; background: var(--panel, var(--surface)); border-top: 1px solid var(--divider); }
.contact-bar .btn { white-space: nowrap; padding: 0 12px; }
.contact-bar .btn:only-child { grid-column: 1 / -1; }
body[data-view="ad"] .main { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 96px); }
@container (min-width: 720px) {
  .ad-layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; }
  .gallery { margin: 0; border-radius: var(--radius); position: sticky; top: calc(var(--topbar-h) + 12px); }
}
/* Foldable with a visible hinge between two screens: one pane on each screen. */
@media (horizontal-viewport-segments: 2) {
  .ad-layout, .split { grid-template-columns: env(viewport-segment-width 0 0, 1fr) env(viewport-segment-width 1 0, 1fr); column-gap: calc(env(viewport-segment-left 1 0, 0px) - env(viewport-segment-right 0 0, 0px)); }
}

/* ---------- Empty / error states ---------- */
.empty { text-align: center; padding: 48px 16px; display: grid; justify-items: center; gap: 8px; }
.empty-icon { width: 80px; height: 80px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.empty h2 { margin: 8px 0 0; font-size: 1.15rem; }
.empty p { margin: 0 0 8px; color: var(--muted); max-width: 32ch; }

/* ---------- Account ---------- */
.account { display: grid; gap: 16px; }
.account-hello { display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); }
.account-hello h2 { margin: 0; font-size: 1.15rem; }
.account-hello p { margin: 0; }
.menu, .settings, .login-form { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; }
.menu-row { width: 100%; min-height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 12px; border: 0; background: none; color: var(--text) !important; border-radius: 10px; text-align: left; }
.menu-row span { flex: 1; }
.menu-row svg { color: var(--muted); }
.menu-row svg:first-child { color: var(--blue); }
.menu-row + .menu-row { border-top: 1px solid var(--divider); border-radius: 0; }
.menu-row.danger, .menu-row.danger svg:first-child { color: var(--danger) !important; }
:root[data-theme="dark"] .menu-row.danger, :root[data-theme="dark"] .menu-row.danger svg:first-child { color: #FDA29B !important; }
.login-form { padding: 20px; display: grid; gap: 6px; }
.login-form h2 { margin: 0 0 8px; }
.login-form .input { margin-bottom: 8px; }
.form-error { margin: 0; color: var(--danger); min-height: 1.2em; font-size: .9rem; }
:root[data-theme="dark"] .form-error { color: #FDA29B; }
.login-links { display: flex; justify-content: space-between; margin: 8px 0 0; }
.settings { margin-top: 16px; padding: 12px 16px; }
.settings h2 { margin: 4px 0 8px; font-size: 1rem; }
.setting { display: grid; grid-template-columns: 24px 1fr minmax(130px, 46%); align-items: center; gap: 12px; min-height: 56px; }
.setting svg { color: var(--blue); }

/* ---------- Banners ---------- */
.install-banner, .update-bar, .offline-bar, .toast {
  position: fixed; z-index: 40; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px);
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 10px 28px rgba(31, 41, 55, .2);
  max-width: 560px; margin: 0 auto;
}
.install-banner img { border-radius: 10px; }
.install-banner div { flex: 1; font-size: .9rem; }
.install-banner p { margin: 2px 0 0; color: var(--muted); font-size: .82rem; }
.update-bar span { flex: 1; }
.offline-bar { top: calc(var(--topbar-h) + var(--safe-t) + 8px); bottom: auto; justify-content: center; background: #1F2937; color: #fff; font-size: .88rem; padding: 8px 12px; }
.toast { justify-content: center; background: #1F2937; color: #fff; opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
body[data-view="ad"] .toast { bottom: calc(var(--tabbar-h) + var(--safe-b) + 84px); }
.boot { min-height: 100dvh; display: grid; place-items: center; }
.boot img { width: 180px; height: auto; }

/* ---------- Tablet and desktop: navigation in the header (mock-up "Tablette") ---------- */
@media (min-width: 1000px) {
  .topbar { grid-template-columns: auto 1fr auto; padding: var(--safe-t) 20px 0; gap: 24px; }
  .menu-btn { display: none; }
  .brand { justify-self: start; }
  .top-nav { display: flex; gap: 4px; justify-self: center; }
  .top-nav a { padding: 8px 14px; border-radius: 999px; color: var(--text); font-weight: 600; font-size: .95rem; }
  .top-nav a[aria-current="page"] { color: var(--blue); background: var(--blue-soft); }
  .top-nav .top-nav-account { display: none; }
  .topbar .account-btn { display: inline-grid; }
  .tabbar { display: none; }
  .main { padding-bottom: 40px; }
  .hero { margin: 16px 0 0; border-radius: 22px; padding: 48px 48px 32px; min-height: 300px; }
  .hero-text h1 { font-size: 2.3rem; max-width: 18ch; }
  .hero-search { max-width: 640px; }
  .contact-bar { position: static; padding: 16px 0 0; background: none; border: 0; max-width: 560px; margin-left: auto; }
  body[data-view="ad"] .main { padding-bottom: 40px; }
  .install-banner, .update-bar, .toast { bottom: 24px; }
  .filters-foot { bottom: 0; }
  .split-side { max-height: calc(100dvh - var(--topbar-h) - 24px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Inputs never widen their column (side panel of open foldables). */
.f-range .input, .f-block .select { min-width: 0; }
.filters-body > *, .f-row { min-width: 0; }
.split-side, .split > * { min-width: 0; }
/* Accueil sans bandeau (maquette v1.1) */
.home-post { margin-top: 16px; }
.home-post-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 58px; padding: 0 20px; border-radius: 16px; background: var(--blue, #2477c9); color: #fff !important; font-size: 1.12rem; font-weight: 700; text-decoration: none; box-shadow: 0 6px 16px rgba(36, 119, 201, .35); }
.home-post-btn:active { transform: translateY(1px); box-shadow: 0 3px 10px rgba(36, 119, 201, .35); }
.home-post-btn svg { flex: 0 0 auto; stroke-width: 2.6; }
@media (min-width: 768px) { .home-post-btn { max-width: 520px; margin: 0 auto; min-height: 64px; font-size: 1.25rem; } }

/* ---------- Dépôt d'annonce en 4 étapes (maquette « Dépôt d'annonce ») */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.post-steps { list-style: none; display: flex; justify-content: space-between; margin: 0 0 18px; padding: 0 4px; position: relative; }
.post-steps::before { content: ""; position: absolute; left: 12%; right: 12%; top: 19px; height: 2px; background: var(--divider); }
.post-step { flex: 1; position: relative; }
.post-step button { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; background: none; border: 0; padding: 0; color: var(--muted); font: inherit; cursor: default; }
.post-step.done button { cursor: pointer; color: var(--blue); }
.post-step-num { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 2px solid var(--divider); font-weight: 700; color: var(--text); position: relative; z-index: 1; }
.post-step.current .post-step-num { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 4px 12px rgba(36, 119, 201, .35); }
.post-step.done .post-step-num { border-color: var(--blue); color: var(--blue); }
.post-step-label { font-size: .78rem; font-weight: 600; }
.post-step.current .post-step-label { color: var(--text); }
.post-body { padding-bottom: calc(96px + var(--safe-b, 0px)); }
.post-h2 { font-size: 1.1rem; margin: 0 0 12px; }
.post-h3 { font-size: 1rem; margin: 16px 0 8px; }
.post-path, .post-hint { color: var(--muted); margin: -6px 0 14px; font-size: .9rem; }
.post-lead { font-weight: 600; margin: 4px 0 12px; }
.post-crumb { display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 6px 0 12px; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.post-list { display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.post-row { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 0 16px; background: none; border: 0; border-bottom: 1px solid var(--divider); color: var(--text); font: inherit; font-size: 1rem; text-align: left; cursor: pointer; }
.post-row:last-child { border-bottom: 0; }
.post-row > span { flex: 1; }
.post-row > svg:last-child { color: var(--muted); }
.post-row.selected { background: var(--blue-soft); }
.post-field { margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.post-textarea { min-height: 140px; padding: 12px 14px; resize: vertical; line-height: 1.45; font: inherit; }
.post-unit { font-weight: 400; }
.post-section { background: var(--surface); border-radius: 16px; padding: 14px 14px 2px; margin: 0 0 14px; box-shadow: var(--shadow); }
.post-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 0 10px; }
.post-section-head h3 { margin: 0; font-size: 1rem; }
.post-section-head span { font-size: .8rem; color: var(--muted); }
.post-more { margin: 0 0 12px; }
.post-more summary { cursor: pointer; color: var(--blue); font-weight: 600; padding: 6px 0 12px; }
.post-land-units { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.post-land-unit span { display: block; font-size: .78rem; color: var(--muted); margin-bottom: 4px; }
.post-error { color: var(--danger); font-size: .85rem; margin: 6px 0 0; }
.input.invalid, .select.invalid, .post-photos.invalid, .post-terms.invalid { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(220, 38, 38, .15); }
.post-photos-head { display: flex; justify-content: space-between; font-weight: 600; margin: 0 0 8px; }
.post-count { color: var(--muted); }
.post-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; border-radius: 14px; }
.post-photo { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--muted); }
.post-photo img { width: 100%; height: 100%; object-fit: cover; }
.post-photo.add { border: 2px dashed var(--blue); background: var(--blue-soft); color: var(--blue); box-shadow: none; cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 4px; font-weight: 600; font-size: .85rem; }
.post-photo-main { position: absolute; left: 6px; bottom: 6px; background: var(--blue); color: #fff; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.post-photo-remove, .post-photo-first { position: absolute; top: 6px; width: 28px; height: 28px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(17, 24, 39, .65); color: #fff; cursor: pointer; }
.post-photo-remove { right: 6px; }
.post-photo-first { left: 6px; transform: rotate(180deg); }
.post-photo.uploading { flex-direction: column; }
.post-progress { position: absolute; left: 10px; right: 10px; bottom: 12px; height: 6px; border-radius: 3px; background: var(--divider); overflow: hidden; }
.post-progress-bar { display: block; height: 100%; width: 0; background: var(--blue); transition: width .2s; }
.post-summary { display: flex; gap: 12px; align-items: center; background: var(--surface); border-radius: 16px; padding: 12px; box-shadow: var(--shadow); margin: 0 0 14px; }
.post-summary img, .post-summary-ph { width: 76px; height: 76px; border-radius: 12px; object-fit: cover; flex: 0 0 auto; background: var(--blue-soft); display: grid; place-items: center; color: var(--blue); }
.post-summary h3 { margin: 2px 0; font-size: 1rem; }
.post-summary p { margin: 0; }
.post-summary-path { font-size: .8rem; color: var(--muted); }
.post-terms { border: 1px solid transparent; border-radius: 12px; padding: 0 8px; }
.post-note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: .88rem; background: var(--blue-soft); border-radius: 12px; padding: 10px 12px; }
.post-note svg { flex: 0 0 auto; color: var(--blue); margin-top: 1px; }
.post-footer { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h, 64px) + var(--safe-b, 0px)); display: flex; gap: 10px; padding: 10px 16px; background: var(--page); border-top: 1px solid var(--divider); z-index: 20; }
.post-footer:empty { display: none; }
.post-footer .btn { min-height: 50px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.post-prev { flex: 0 0 auto; }
.post-next { flex: 1; font-weight: 700; }
.post-done .empty-icon.ok { background: #DCFCE7; color: #16A34A; }
.post-done .btn { margin-top: 10px; min-width: 240px; }
.post-retry { padding: 16px; text-align: center; }
@media (min-width: 768px) {
  .post-body, .post-steps { max-width: 640px; margin-left: auto; margin-right: auto; }
  .post-footer { bottom: 0; justify-content: center; }
  .post-footer .btn { max-width: 300px; }
  .post-photos { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
[data-theme="dark"] .post-done .empty-icon.ok { background: #14532D; color: #86EFAC; }

/* ---------- Messagerie (maquette « Messagerie ») */
.msg-tabs { display: flex; gap: 10px; margin: 0 0 14px; }
.msg-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; border-radius: 999px; border: 1.5px solid var(--divider); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.msg-tab[aria-selected="true"] { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.msg-count, .msg-badge { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--blue); color: #fff; font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; }
.msg-list { display: flex; flex-direction: column; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.msg-list > .empty, .msg-list > .f-loading { background: var(--page); }
.msg-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--divider); color: var(--text) !important; text-decoration: none; }
.msg-row:last-child { border-bottom: 0; }
.msg-thumb, .msg-row .avatar { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.msg-row-body { flex: 1; min-width: 0; }
.msg-row-top { display: flex; justify-content: space-between; gap: 8px; }
.msg-time { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.msg-ad, .msg-last { margin: 2px 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .85rem; }
.msg-ad { color: var(--blue); }
.msg-last { color: var(--muted); }
.msg-row.unread strong, .msg-row.unread .msg-last { color: var(--text); font-weight: 700; }
.msg-head .page-header { margin-bottom: 4px; }
.msg-menu-wrap { position: relative; }
.msg-menu { position: absolute; right: 0; top: 44px; z-index: 30; min-width: 230px; background: var(--surface); border-radius: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); overflow: hidden; }
.msg-menu button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 0 14px; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.msg-menu button.danger { color: var(--danger); border-top: 1px solid var(--divider); }
.msg-adcard { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 0 0 8px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); color: var(--text) !important; text-decoration: none; }
.msg-adcard img, .msg-adcard .avatar { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; flex: 0 0 auto; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.msg-adcard > div { flex: 1; min-width: 0; }
.msg-adcard p, .msg-adcard strong { margin: 0; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-adcard p { font-size: .78rem; }
.msg-adcard .price { white-space: normal; }
.msg-thread { display: flex; flex-direction: column; gap: 6px; padding: 6px 0 calc(var(--tabbar-h, 64px) + 90px + var(--safe-b, 0px)); }
.msg-day { align-self: center; font-size: .75rem; color: var(--muted); background: var(--surface); padding: 3px 12px; border-radius: 999px; margin: 8px 0; }
.msg-bubble { max-width: 82%; padding: 9px 12px 6px; border-radius: 18px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.msg-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.msg-bubble.mine { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 6px; }
.msg-bubble.theirs { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 6px; }
.msg-meta { display: flex; justify-content: flex-end; align-items: center; gap: 3px; font-size: .7rem; opacity: .75; margin-top: 2px; }
.msg-bottom { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h, 64px) + var(--safe-b, 0px)); padding: 8px 12px; background: var(--page); border-top: 1px solid var(--divider); z-index: 20; }
.msg-composer { display: flex; align-items: flex-end; gap: 8px; max-width: 760px; margin: 0 auto; }
.msg-input { flex: 1; min-height: 44px; max-height: 140px; padding: 11px 14px; border-radius: 22px; border: 1px solid var(--divider); background: var(--surface); color: var(--text); font: inherit; resize: none; line-height: 1.35; }
.msg-send { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 50%; border: 0; background: var(--orange); color: #fff; display: grid; place-items: center; cursor: pointer; }
.msg-send:disabled { opacity: .5; }
.msg-locked, .msg-hint { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: .88rem; margin: 4px 0; }
.msg-hint { justify-content: flex-start; background: var(--orange-soft); color: var(--text); border-radius: 12px; padding: 10px 12px; }
@media (min-width: 768px) {
  .msg-list, .msg-tabs, .msg-thread, .msg-head { max-width: 760px; margin-left: auto; margin-right: auto; width: 100%; }
  .msg-bottom { bottom: 0; }
  .msg-thread { padding-bottom: 100px; }
}

/* ---------- Compte (inscription, informations, mes annonces) */
.me-body, .me-form { display: block; }
.me-form > .btn-block { min-height: 52px; font-weight: 700; }
.me-password summary { cursor: pointer; font-weight: 600; color: var(--blue); padding: 2px 0 12px; }
.post-hint.small { font-size: .8rem; margin: 6px 0 0; }
.msg-thumb.square, .avatar.square { border-radius: 12px; }
.myad strong.one { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.state-pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--divider); color: var(--text); }
.state-pill.green { background: #DCFCE7; color: #166534; }
.state-pill.orange { background: var(--orange-soft); color: #9A3412; }
.state-pill.red { background: #FEE2E2; color: #991B1B; }
[data-theme="dark"] .state-pill.green { background: #14532D; color: #BBF7D0; }
[data-theme="dark"] .state-pill.red { background: #7F1D1D; color: #FECACA; }
[data-theme="dark"] .state-pill.orange { color: #FED7AA; }
@media (min-width: 768px) { .me-body, .me-form { max-width: 640px; margin: 0 auto; } }

/* ---------- Options de visibilité et paiement PromptPay */
.opt-list { display: flex; flex-direction: column; gap: 10px; margin: 0 0 12px; }
.opt-row { display: grid; grid-template-columns: 40px 1fr auto 24px; align-items: center; gap: 10px; padding: 12px; border: 1.5px solid var(--divider); border-radius: 14px; background: var(--surface); cursor: pointer; }
.opt-row:has(input:checked) { border-color: var(--orange); background: var(--orange-soft); }
.opt-row.active { opacity: .7; cursor: default; }
.opt-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; background: var(--blue-soft); color: var(--blue); }
.opt-row.type-2 .opt-icon { background: #FEF3C7; color: #B45309; }
.opt-row.type-3 .opt-icon { background: #FEE2E2; color: #DC2626; }
.opt-copy strong, .opt-price strong { display: block; }
.opt-copy small, .opt-price small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.3; }
.opt-price { text-align: right; white-space: nowrap; }
.opt-price strong { color: var(--orange); }
.opt-row input { width: 22px; height: 22px; accent-color: var(--orange); }
.pay-body { padding-bottom: calc(var(--tabbar-h, 64px) + 24px); }
.pay-line { display: flex; justify-content: space-between; gap: 12px; margin: 6px 0; }
.pay-line.total { font-size: 1.1rem; border-top: 1px solid var(--divider); padding-top: 10px; margin-top: 10px; }
.pay-line.total strong { color: var(--orange); }
.pay-summary .post-section-head span { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .78rem; }
.pay-billing p { margin: 0 0 12px; color: var(--muted); }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; font-weight: 600; cursor: pointer; }
.pay-promptpay { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 16px; margin: 12px 0; text-align: center; border-top: 5px solid #1d4774; }
.pay-pp-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.pay-pp-head strong { color: #1d4774; font-size: 1.2rem; letter-spacing: .02em; }
.pay-pp-head span { color: var(--muted); font-size: .88rem; }
.pay-qr { display: block; width: min(240px, 80vw); height: auto; margin: 0 auto 6px; border-radius: 12px; background: #fff; padding: 6px; }
.pay-save { display: inline-flex; align-items: center; gap: 4px; font-size: .88rem; margin-bottom: 12px; }
.pay-amount, .pay-ref { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--page); margin: 6px 0; text-align: left; }
.pay-amount strong { font-size: 1.35rem; color: var(--orange); }
.pay-ref strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9rem; flex: 1; text-align: right; }
.pay-steps { text-align: left; margin: 12px 0; padding-left: 22px; line-height: 1.6; }
.pay-paid { min-height: 54px; font-weight: 700; display: flex; align-items: center; justify-content: center; gap: 6px; }
.pay-paid:disabled { opacity: .5; }
.myad-btn { margin-top: 6px; min-height: 32px; padding: 0 12px; font-size: .82rem; display: inline-flex; align-items: center; gap: 4px; }
.center.small, .muted.small { font-size: .82rem; }
[data-theme="dark"] .opt-row.type-2 .opt-icon { background: #78350F; color: #FDE68A; }
[data-theme="dark"] .opt-row.type-3 .opt-icon { background: #7F1D1D; color: #FECACA; }
[data-theme="dark"] .pay-promptpay { border-top-color: #7DB5EE; }
@media (min-width: 768px) { .pay-body { max-width: 640px; margin: 0 auto; } }

/* ---- Buy credits (views/pay.ts creditsView) */
.credit-intro { text-align: center; font-weight: 600; color: var(--blue); margin: 4px 0 2px; }
.credit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
@media (min-width: 600px) { .credit-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.credit-pack { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 84px; padding: 12px 6px; border: 1.5px solid var(--divider); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.credit-pack strong { font-size: 1.25rem; white-space: nowrap; }
.credit-pack small { color: var(--orange); font-weight: 600; font-size: .8rem; }
.credit-pack.selected { border-color: var(--orange); background: var(--orange-soft); box-shadow: inset 0 0 0 1px var(--orange); }
.credit-pack:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.pay-line.credit-add strong { color: var(--orange); }
.pay-line.credit-add small { display: block; color: var(--muted); font-size: .78rem; }

/* ---- Bank transfer (views/pay.ts payView): mock-up « Paiement par virement bancaire » */
.bank-pay { max-width: 560px; margin: 0 auto; padding: 14px 0 24px; display: flex; flex-direction: column; gap: 14px; }
.bank-head { display: flex; flex-direction: column; gap: 14px; }
.bank-title { display: flex; align-items: center; gap: 12px; }
.bank-title h2 { margin: 0; font-size: 1.2rem; line-height: 1.3; }
.bank-badge { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--blue-dark); color: #fff; }
.bank-steps { list-style: none; margin: 0 4px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; position: relative; }
.bank-steps::before { content: ""; position: absolute; top: 17px; left: 25%; right: 25%; height: 2px; background: var(--divider); }
.bank-steps li { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; font-size: .86rem; color: var(--muted); }
.bank-step-dot { position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--divider); color: var(--text); font-weight: 700; }
.bank-steps li.current { color: var(--blue); font-weight: 700; }
.bank-steps li.current .bank-step-dot, .bank-steps li.done .bank-step-dot { background: var(--blue); color: #fff; }
.bank-steps:has(li.done)::before { background: linear-gradient(to right, var(--blue) 50%, var(--blue) 50%); }
.bank-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.bank-amount { background: var(--blue-soft); border-radius: 14px; padding: 14px 12px; text-align: center; margin-bottom: 10px; }
.bank-amount span { display: block; color: var(--blue-dark); font-weight: 700; }
.bank-amount strong { display: block; font-size: clamp(2.2rem, 11vw, 2.9rem); line-height: 1.15; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
:root[data-theme="dark"] .bank-amount span { color: #9CC7F2; }
.bank-name { display: flex; align-items: center; gap: 12px; padding: 4px 2px 10px; }
.bank-name strong { font-size: 1.2rem; }
.bank-logo { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--blue-soft); color: var(--blue-dark); }
.bank-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--divider); }
.bank-row-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--page); color: var(--text); }
.bank-row-icon b { font-size: 1.25rem; }
.bank-row-icon.big { width: 56px; height: 56px; border-radius: 14px; background: var(--blue-soft); color: var(--blue-dark); flex: none; }
.bank-row-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bank-row-text span { color: var(--muted); font-size: .88rem; }
.bank-row-text strong { font-size: 1.12rem; overflow-wrap: anywhere; }
.bank-number { font-variant-numeric: tabular-nums; letter-spacing: .01em; white-space: nowrap; }
.bank-copy { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 0 11px; border: 1.5px solid var(--blue); border-radius: 12px; background: var(--surface); color: var(--blue); font: inherit; font-weight: 700; cursor: pointer; }
.bank-copy:active { background: var(--blue-soft); }
.bank-copy:focus-visible, .bank-drop:focus-within { outline: 3px solid var(--blue); outline-offset: 2px; }
:root[data-theme="dark"] .bank-copy { color: #9CC7F2; border-color: #9CC7F2; }
.bank-note { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 14px; border-radius: 14px; background: var(--blue-soft); line-height: 1.45; }
.bank-note svg { flex: none; color: var(--blue); margin-top: 2px; }
.bank-next, .bank-send { min-height: 56px; font-size: 1.05rem; font-weight: 700; }
.bank-next { justify-content: center; gap: 10px; }
.bank-confirm-head { flex-direction: row; align-items: center; gap: 14px; background: var(--blue-soft); box-shadow: none; }
.bank-confirm-head h3 { margin: 0 0 4px; font-size: 1.08rem; }
.bank-confirm-head p { margin: 0; line-height: 1.4; }
.bank-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 210px; padding: 18px; border: 2px dashed var(--blue); border-radius: 14px; background: var(--blue-soft); color: var(--text); text-align: center; cursor: pointer; }
.bank-drop strong { color: var(--blue-dark); font-size: 1.15rem; }
.bank-drop span:last-child { color: var(--muted); }
.bank-drop-icon { color: var(--blue-dark); }
:root[data-theme="dark"] .bank-drop strong, :root[data-theme="dark"] .bank-drop-icon { color: #9CC7F2; }
.bank-thumb { position: relative; align-self: flex-start; width: 150px; margin: 6px 0 0 4px; }
.bank-thumb[hidden], .bank-drop[hidden] { display: none; }
.bank-thumb img { display: block; width: 100%; max-height: 210px; object-fit: contain; border-radius: 12px; border: 1px solid var(--divider); background: #fff; box-shadow: var(--shadow); }
.bank-thumb-remove { position: absolute; top: -12px; right: -12px; display: grid; place-items: center; width: 40px; height: 40px; border: 2px solid var(--surface); border-radius: 50%; background: #374151; color: #fff; cursor: pointer; }
.bank-send.loading { opacity: .7; pointer-events: none; }
.bank-terms { margin: -4px 0 0; }
.bank-done { align-items: center; text-align: center; gap: 10px; padding: 26px 18px; }
.bank-done h3 { margin: 0; font-size: 1.2rem; line-height: 1.35; }
.bank-done p { margin: 0; }
.bank-done .btn { margin-top: 8px; }
.bank-done-icon { display: grid; place-items: center; width: 68px; height: 68px; border-radius: 50%; background: var(--orange-soft); color: var(--orange-dark); }
.bank-again { display: block; margin-top: 4px; }
.menu-row.attention { background: var(--orange-soft); border-radius: 10px; }
.menu-row.attention span { font-weight: 700; }
/* Very narrow screens (folded phones): the copy button goes under the value. */
@media (max-width: 359px) {
  .bank-row { grid-template-columns: 40px minmax(0, 1fr); row-gap: 8px; }
  .bank-row-icon { width: 40px; height: 40px; }
  .bank-copy { grid-column: 2; justify-self: start; }
  .bank-amount strong { font-size: 2.1rem; }
}
@media (min-width: 768px) { .bank-pay { padding-top: 24px; gap: 16px; } .bank-title h2 { font-size: 1.35rem; } }
.bank-done-text { font-size: 1.05rem; line-height: 1.5; max-width: 34ch; }
.bank-next.loading { opacity: .7; pointer-events: none; }

/* ---- Category filters: same spacing as the other filter blocks */
.f-group { display: grid; gap: 10px; }
.f-group:empty { display: none; }

/* ---- Language picker with flags (like the website header) */
.lang-picker { position: relative; justify-self: end; min-width: 0; }
.lang-btn { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 44px; padding: 0 10px 0 12px; border: 1px solid var(--divider); border-radius: 12px; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.lang-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lang-btn > svg:last-child { flex: none; transform: rotate(90deg); color: var(--muted); transition: transform .15s; }
.lang-btn[aria-expanded="true"] > svg:last-child { transform: rotate(-90deg); }
.flag { flex: none; width: 24px; height: 16px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .14); }
.lang-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 200px; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--divider); border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .2); }
.lang-menu.up { top: auto; bottom: calc(100% + 6px); }
.lang-menu[hidden] { display: none; }
.lang-menu button { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-size: 1rem; text-align: left; cursor: pointer; }
.lang-menu button span { flex: 1; }
.lang-menu button:hover, .lang-menu button:focus-visible { background: var(--page); outline: none; }
.lang-menu button[aria-selected="true"] { background: var(--blue-soft); font-weight: 700; }
.lang-menu button > svg { color: var(--blue); }
:root[data-theme="dark"] .lang-menu { box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }

/* ---- Pull to refresh (installed app) */
.ptr { position: fixed; z-index: 45; left: 50%; top: calc(var(--topbar-h) + var(--safe-t) + 6px); display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); color: var(--muted); box-shadow: 0 4px 14px rgba(0, 0, 0, .18); opacity: 0; transform: translate(-50%, 0); pointer-events: none; }
.ptr.ready { color: var(--blue); }
.ptr.loading svg { animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }

/* Drop-down lists like the desktop site (src/dropdown.ts) */
.dd-native { display: none !important; }
.dd-btn { display: flex; align-items: center; text-align: left; color: var(--text); font: inherit; cursor: pointer; }
.dd-btn.sort-select { font-size: .9rem; }
.dd-btn .dd-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn:focus, .dd-btn:focus-visible, .dd-list li:focus, .dd-list li:focus-visible { outline: none; box-shadow: none; }
.dd-btn:disabled { opacity: .6; cursor: default; }
.dd-list { position: fixed; z-index: 80; margin: 0; padding: 4px 0; list-style: none; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  background: var(--surface); color: var(--text); border: 1px solid var(--divider); border-radius: 10px; box-shadow: 0 10px 28px rgba(31, 41, 55, .18); }
.dd-list li { padding: 11px 14px; font-size: .95rem; line-height: 1.3; cursor: pointer; }
.dd-list li.dd-placeholder { color: var(--muted); }
.dd-list li[aria-selected="true"] { background: var(--blue); color: #fff; }
.dd-list li:not([aria-selected="true"]):active, .dd-list li:not([aria-selected="true"]):focus-visible { background: var(--blue-soft); outline: none; }
.dd-list li[aria-disabled="true"] { opacity: .5; cursor: default; }
@media (hover: hover) { .dd-list li:not([aria-selected="true"]):hover { background: var(--blue-soft); } }

/* Language picker: flags only */
.lang-btn { gap: 6px; padding: 0 8px 0 12px; }
.lang-btn .flag, .lang-menu .flag { width: 30px; height: 20px; }
.lang-menu { min-width: 0; padding: 4px; }
.lang-menu button { justify-content: center; gap: 0; min-height: 44px; padding: 0 14px; }

/* Shop (src/views/shop.ts) */
.shop-plans { display: grid; gap: 10px; margin: 0 0 12px; }
.shop-plan { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 12px 14px; border: 1.5px solid var(--divider); border-radius: 14px; background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.shop-plan-radio { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--divider); }
.shop-plan-label { flex: 1; min-width: 0; line-height: 1.3; }
.shop-plan-price { flex: none; color: var(--orange); white-space: nowrap; }
.shop-plan.selected { border-color: var(--orange); background: var(--orange-soft); }
.shop-plan.selected .shop-plan-radio { border-color: var(--orange); box-shadow: inset 0 0 0 4px var(--surface); background: var(--orange); }
.shop-status p { margin: 0 0 12px; }
.shop-pick-wrap { position: relative; }
.shop-pick { position: relative; display: grid; place-items: center; overflow: hidden; border: 1.5px dashed var(--divider); border-radius: 14px; background: var(--page); color: var(--muted); cursor: pointer; }
.shop-pick.cover { width: 100%; aspect-ratio: 1800 / 680; }
.shop-pick.logo { width: 96px; height: 96px; border-radius: 50%; }
.shop-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shop-pick img[hidden], .shop-pick-add[hidden], .shop-pick-remove[hidden], .shop-pick-progress[hidden] { display: none; }
.shop-pick-add { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: .8rem; text-align: center; padding: 6px; }
.shop-pick-progress { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--blue); transition: width .2s; }
.shop-pick-remove { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border: 0; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; }
.shop-pick-wrap.logo { flex: none; width: 96px; }
.shop-pick-wrap.logo .shop-pick-remove { top: -2px; right: -2px; }
.shop-logo-row { display: flex; align-items: center; gap: 14px; margin: 14px 0 14px; }
.info-page { line-height: 1.6; overflow-wrap: anywhere; }
.info-page h2, .info-page h3, .info-page h4 { margin: 18px 0 8px; font-size: 1.05rem; }
.info-page p { margin: 0 0 10px; }
.info-page table { width: 100%; border-collapse: collapse; }
.info-page td, .info-page th { border: 1px solid var(--divider); padding: 6px; }
/* Public shop page (#/store/<id>) */
.store-head { margin: 8px 0 12px; border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.store-cover { display: block; width: 100%; aspect-ratio: 1800 / 680; object-fit: cover; background: var(--blue-soft); }
.store-id { display: flex; align-items: center; gap: 12px; padding: 0 14px 14px; margin-top: -32px; }
.store-id h2 { margin: 30px 0 4px; font-size: 1.15rem; }
.store-logo { flex: none; width: 76px; height: 76px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface); background: var(--surface); display: grid; place-items: center; font-size: 1.6rem; }
.store .btn-block { margin: 0 0 12px; }
.section-title { margin: 18px 0 10px; font-size: 1.05rem; }
.captcha-box { margin: 10px 0 4px; min-height: 78px; }
.captcha-box.invalid iframe { outline: 2px solid var(--danger); border-radius: 4px; }

/* TALATYAI-FIX-SCROLL 2026-11-19 : place de la barre de défilement toujours réservée, la page ne se décale plus entre deux écrans. */
html { overflow-y: scroll; }
