/* [Claude 2026-11-24] UX/UI pass, phone (375 × 812) and portrait tablet (800 × 1280). Hadi: « optimize and enhance the ux, ui,
     buttons, positions, colors, everything ». Loaded last (after refresh.css). Layout only: no colour of its own (tokens from
     base/refresh.css), no feature moved or removed, no menu entry touched. Rules that need :has() each sit on their own line, so
     an old engine (S600: WebView 91) drops only that line. */

/* 1 · The floating chat button never covers the last row or button of a page. It floats 76 px above the bottom of a phone (over the
     tab bar) and 18 px above the bottom elsewhere; the page gets that much room under its last card. The selling screen keeps its
     own layout (the button moves to the left of the basket bar there). */
body:has(> .chat-fab) .main > .content:not(:has(> .sl-split)) { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
@media (max-width: 640px) {
     body:has(> .chat-fab) .main > .content:not(:has(> .sl-split)) { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
}
/* …and it hides behind an open side panel (a task, a customer, a document), like it already does behind sheets. */
body:has(> .drawer-wrap:not(.closing)) .chat-fab { visibility: hidden; }

/* 2 · Header on a phone: the company button showed « Flo… ». Under 420 px it keeps the name only (the logo gives it its room, the
     button's label still says « Changer de société · Flower Lab »), like the device-locked chip already does. */
@media (max-width: 420px) {
     .ctab-switch { gap: 4px; padding: 0 8px 0 10px; font-size: 14px; }
     .app-top:not(.has-back) .ctab-switch > .blogo { display: none; }
     .ctab-switch > svg.i { flex: none; }
     /* A page with « ‹ Retour » has no room for the name (it showed a lone « ⌄ »): there the button is the company's logo. */
     .app-top.has-back .ctab-switch { padding: 0 6px; gap: 0; }
     .app-top.has-back .ctab-switch > .ctab-switch-l, .app-top.has-back .ctab-switch > svg.i { display: none; }
}

/* 3 · Search and filters on a phone: one white search field, the filter buttons as pills beside it (or on the next row when there
     are two of them), instead of « Filtrer » alone on a second row of the same white box. A page without a search (Planning) puts
     its view switch first and « Filtrer » beside it. */
@media (max-width: 640px) {
     .ltitle .searchbar, .ltitle .searchbar:focus-within { background: none; box-shadow: none; border-radius: 0; }
     .toolbar > .searchbar, #lt-tools .searchbar { align-items: center; }
     .searchbar > label.search { flex: 999 1 160px; min-width: 0; }
     .ltitle .searchbar > label.search:not(:focus-within) { background: var(--surface); }
     .search input { min-width: 0; }
     .searchbar > .filter-btn { flex: 0 0 auto; min-height: 44px; padding: 0 14px; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
     .searchbar > .filter-btn.active { background: var(--accent-fill); color: #fff; box-shadow: none; }
     .searchbar > .grow:empty { display: none; }
     .searchbar > .seg { order: -1; flex: 1 1 auto; min-width: 0; }
     .searchbar > .seg > button { flex: 1 1 auto; min-width: 0; }
}
/* With two buttons beside it the search gets its own row and the buttons share the next one. */
@media (max-width: 640px) { .searchbar:has(> .filter-btn ~ .filter-btn) > label.search { flex-basis: 100%; } }
@media (max-width: 640px) { .searchbar:has(> .filter-btn ~ .filter-btn) > .filter-btn { flex: 1 1 0; justify-content: center; } }
/* A search hint longer than its field ends with « … » instead of being cut mid-word (« …une banque, une c »). */
input[type="search"] { text-overflow: ellipsis; }
/* A narrow phone keeps the view switch's words and drops its little icons, so it fits beside « Filtrer ». */
@media (max-width: 420px) { .searchbar > .seg svg.i { display: none; } .searchbar > .seg > button { padding-inline: 8px; } }

/* 4 · A full-width button with a long label wraps inside itself instead of spilling past both edges of the screen
     (« Décisions déjà prises sur les écarts de caisse » on À approuver). */
.btn.block { white-space: normal; text-align: center; }

/* 4b · Drop-down lists show their little arrow again (refresh.css now sets only their colour). The stock request / send sheet sets
     its own « background » shorthand after that, so « Depuis / Vers » looked like two buttons: it gets the arrow back here, with room
     for it on the right. Longhands only: the sheet keeps its own colour. */
/* The customer card's right-aligned lists (no padding) get the compact arrow of the form rows (.cm-f), so it never sits on the value. */
.cl-field > select { padding-right: 22px; background-position: calc(100% - 9px) 50%, calc(100% - 4px) 50%; text-align-last: right; }
.sa-field select:not([multiple]) { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
/* A drop-down that follows a title in a row takes its own width, not the whole row: « Verrouillage automatique des caisses » was
     squeezed to one letter per line by its « après 5 min » list (Réglages › Appareils › Caisses). */
.row > .grow + select { width: auto; flex: 0 1 auto; max-width: 55%; }

/* 4c · « pad muted » messages (« Rien aujourd’hui pour l’instant. », « Aucun … ») sat against their card's edge: « pad » means
     padding there, but only « card pad » ever had any. Zero specificity, so a screen's own spacing still wins. */
:where(.pad.muted) { padding: 14px 16px; }

/* 4d · Record tables (Clients, Employés…) on a phone: the phone pass gives every table's first column 120 px for a name, but here
     the first column is the 42 px tick box, so a third of the screen was an empty tick column. It keeps its 42 px. */
@media (max-width: 640px) { #view .record-grid th.grid-select, #view .record-grid td.grid-select { min-width: 42px; white-space: nowrap; } }

/* 5 · Home « Ma formation »: its buttons line up at the full width of the card on a phone instead of three ragged widths; in its
     reminder and welcome-video sheets the buttons share the row (« Faire maintenant » · « Plus tard », « Passer pour l’instant »). */
@media (max-width: 640px) {
     .trn-actions > .btn { flex: 1 1 auto; }
     .trn-card .trn-actions > .btn { flex-basis: 100%; }
}

/* 5b · Task sheet: « Créée par … le … » under the activity list lines up with it and with « Activité » instead of the sheet's edge. */
.drawer .timeline + .tiny.faint { padding-inline: 16px; }

/* 6 · Réglages › Appareils › État: the tab already says « État des appareils »; the card under it keeps only its live line
     (« 1 en ligne · à 04:45 ») instead of the same title a second time. */
.dev-sec > .dh-card > .row > .section-title { visibility: hidden; }
/* Its tabs (État · Appareils · Caisses · Écrans · Codes QR) were 500 px wide on a 375 px phone: the chosen « Écrans » sat cut
     off at the edge. On a narrow phone they drop their small icons and all fit; a longer bar (the till's « Cet appareil ») still
     scrolls sideways. */
@media (max-width: 420px) { .dev-tabs .seg > button { padding-inline: 9px; } .dev-tabs .seg > button > svg.i { display: none; } }
/* Réglages › Appareils › « À activer · n »: the folded list was a 22 px strip with its triangle on the card's edge; it is a
     proper 44 px row now. */
details.card > summary.pad { min-height: 44px; padding: 12px 16px; font-weight: 600; cursor: pointer; }
details.card[open] > summary.pad { box-shadow: 0 1px 0 var(--line); }

/* [Claude 2026-11-27] Hadi: « users are claiming that the dimensions move a bit sometimes on the phone ». Two causes:
   (1) iPhone Safari zooms the whole page in when a field under 16 px gets the focus (many compact fields use 13–15 px), and stays
   zoomed after; (2) one element a few pixels wider than the screen lets the page slide sideways under the finger. On phones and
   small tablets every text field is at least 16 px, and the page itself never scrolls sideways (tables keep their own scroller). */
@media (pointer: coarse) and (max-width: 900px) {
     input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: max(16px, 1em) !important; }
     html, body { overflow-x: clip; overscroll-behavior-x: none; }
}
