/* ==========================================================================
   Zorraga Connect — back-office stylesheet (admin, sales, retailers)
   --------------------------------------------------------------------------
   Loaded AFTER the shared design system assets/styles/ui.css (tokens, buttons, forms, shell,
   cards, badges, tables, filters, pagination, toasts, modals: sections 1–13 there).
   Only what the back-office alone uses lives here; every class is defined ONCE.

   14. Detail pages (lists, items, timeline, files)
   15. Offers & comparison
   16. Auth, errors & documentation
   17. Dashboards (greeting, KPI cards, charts)
   18. Real-time alerts & motion preferences
   ========================================================================== */

/* 14. Detail pages (facts, items, timeline and files are shared: ui.css §16) ============= */
.ap-line { border: 1px solid var(--ap-border); border-radius: var(--ap-radius); padding: 1.1rem; background: var(--ap-surface-2); position: relative; }
.ap-line + .ap-line { margin-top: .85rem; }
.ap-line-index { width: 28px; height: 28px; border-radius: 9px; background: var(--ap-primary); color: #fff; font-weight: 750; font-size: .78rem; display: grid; place-items: center; }
.ap-diff { font-size: .8rem; margin-top: .4rem; background: var(--ap-surface-2); border: 1px solid var(--ap-border); border-radius: var(--ap-radius-xs); padding: .55rem .7rem; }
.ap-diff del { color: var(--ap-danger); text-decoration-color: rgba(192, 38, 45, .5); }
.ap-diff ins { color: var(--ap-primary-700); text-decoration: none; font-weight: 650; }
.ap-activity-details { max-width: 360px; word-break: break-all; }

/* 15. Offers & comparison ================================================== */
.ap-offer { display: flex; gap: .75rem; align-items: flex-start; padding: .8rem .9rem; border: 1px solid var(--ap-border); border-radius: var(--ap-radius-sm); background: var(--ap-surface); }
.ap-offer + .ap-offer { margin-top: .5rem; }
.ap-offer.is-muted { opacity: .6; background: var(--ap-surface-2); }
.ap-offer.is-selected { border-color: var(--ap-primary); background: var(--ap-primary-50); }
.ap-offer-form { border: 1px solid var(--ap-border); border-radius: var(--ap-radius); padding: 1.1rem; background: linear-gradient(180deg, var(--ap-surface-2), var(--ap-surface)); margin-top: .85rem; }
.ap-compare th[data-sort] { cursor: pointer; user-select: none; }
.ap-compare th[data-sort]:hover { color: var(--ap-primary-700); }
.ap-compare th[data-sort]::after { content: ' ↕'; opacity: .35; }
.ap-compare th[data-sort].is-asc::after { content: ' ↑'; opacity: 1; }
.ap-compare th[data-sort].is-desc::after { content: ' ↓'; opacity: 1; }
.ap-compare tr.is-best > td { background: #F6FCF8; }
.ap-compare tr.is-best > td:first-child { box-shadow: inset 4px 0 0 var(--ap-primary); }
.ap-compare .ap-sale-input { width: 120px; text-align: right; font-variant-numeric: tabular-nums; }

/* 16. Errors & documentation (login page and password field are shared: ui.css §17) ===== */
.ap-error-page { min-height: 75vh; display: grid; place-items: center; text-align: center; padding: 1.5rem; }
.ap-error-card { max-width: 480px; background: var(--ap-surface); border: 1px solid var(--ap-border); border-radius: 22px; padding: 2.5rem 2rem; box-shadow: var(--ap-shadow-lg); }
.ap-error-code { font-size: 4.2rem; font-weight: 850; letter-spacing: -.05em; line-height: 1; background: linear-gradient(135deg, #18A262, var(--ap-info)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.ap-doc { font-size: .95rem; line-height: 1.7; color: var(--ap-text); }
.ap-doc h2 { font-size: 1.25rem; margin: 2.2rem 0 .8rem; padding-top: 1.4rem; border-top: 1px solid var(--ap-border); }
.ap-doc h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.ap-doc h3 { font-size: 1.05rem; margin: 1.6rem 0 .55rem; color: var(--ap-primary-700); }
.ap-doc h4 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
.ap-doc h2[id], .ap-doc h3[id] { scroll-margin-top: calc(var(--ap-topbar-h) + 1rem); }
.ap-doc p, .ap-doc ul, .ap-doc ol { margin-bottom: .9rem; }
.ap-doc li + li { margin-top: .2rem; }
.ap-doc hr { margin: 2rem 0; opacity: .15; }
.ap-doc .table-responsive { margin-bottom: 1.1rem; border: 1px solid var(--ap-border); border-radius: var(--ap-radius-sm); }
.ap-doc .ap-table { font-size: .86rem; }
.ap-doc .ap-table > thead th { white-space: normal; }
.ap-doc .ap-table td { vertical-align: top; }
.ap-doc code { background: var(--ap-muted-bg); color: var(--ap-text); padding: .1rem .38rem; border-radius: 5px; font-size: .85em; }
.ap-doc pre { background: var(--ap-surface-2); border: 1px solid var(--ap-border); border-radius: var(--ap-radius-sm); padding: .9rem 1rem; font-size: .82rem; white-space: pre-wrap; }
.ap-doc pre code { background: none; padding: 0; }
.ap-doc blockquote.ap-doc-note { border-left: 4px solid var(--ap-primary); background: var(--ap-primary-50); padding: .8rem 1rem; border-radius: 0 var(--ap-radius-sm) var(--ap-radius-sm) 0; margin: 1rem 0; }
.ap-doc blockquote.ap-doc-note p:last-child { margin-bottom: 0; }
.ap-doc-toc { position: sticky; top: calc(var(--ap-topbar-h) + 1rem); max-height: calc(100vh - var(--ap-topbar-h) - 2rem); overflow: auto; }
.ap-doc-toc summary { cursor: pointer; list-style: none; }
.ap-doc-toc summary::-webkit-details-marker { display: none; }
.ap-doc-toc a { display: block; padding: .3rem .55rem; border-radius: var(--ap-radius-xs); color: var(--ap-text-2); font-size: .84rem; }
.ap-doc-toc a:hover { background: var(--ap-hover); color: var(--ap-primary-700); }
.ap-doc-toc a.active { background: var(--ap-primary-50); color: var(--ap-primary-700); font-weight: 650; }
.ap-doc-toc .ap-doc-toc-3 a { padding-left: 1.3rem; font-size: .8rem; }
@media (max-width: 991.98px) { .ap-doc-toc { position: static; max-height: none; } }

/* 17. Dashboards (the greeting banner and the KPI cards are shared: ui.css §15) ========= */
/* 18. Real-time alerts, preferences & motion =============================== */
@keyframes ap-bell-ring {
    0%, 100% { transform: rotate(0); }
    10%, 30%, 50% { transform: rotate(14deg); }
    20%, 40%, 60% { transform: rotate(-14deg); }
    70% { transform: rotate(6deg); }
}
@keyframes ap-dot-pop { 0% { transform: scale(.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.ap-bell.is-ringing > svg { animation: ap-bell-ring 1s ease-in-out 2; transform-origin: 50% 4px; color: var(--ap-primary); }
.ap-bell .ap-dot.is-pop { animation: ap-dot-pop .5s ease-out; }
/* Order alert: violet bell + a brief glow under the top bar (static colour kept with reduced motion). */
.ap-bell.is-ringing.is-strong > svg { color: var(--ap-violet); animation-iteration-count: 3; }
.ap-topbar.is-order-alert { box-shadow: inset 0 -3px 0 var(--ap-violet); animation: ap-order-glow 1.2s ease-out 2; }
@keyframes ap-order-glow { 0% { background-color: var(--ap-violet-bg); } 100% { background-color: transparent; } }
/* "Activer le son": shown only while sound is on but the browser still blocks it (no click yet). */
.ap-sound-unlock { display: inline-flex; align-items: center; gap: .35rem; color: var(--ap-warning); font-weight: 650; font-size: .8rem; }
.ap-sound-unlock[hidden] { display: none; }
.ap-sound-unlock.is-attention { background: var(--ap-warning-bg); animation: ap-dot-pop .5s ease-out 2; }
@media (max-width: 575.98px) { .ap-sound-unlock span { display: none; } }
.ap-pref { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; padding: 1rem 0; border-bottom: 1px solid var(--ap-border); flex-wrap: wrap; }
.ap-pref:last-child { border-bottom: 0; }
.ap-pref-status { font-size: .8rem; }
.ap-pref-help { background: var(--ap-surface-2); border: 1px solid var(--ap-border); border-radius: var(--ap-radius-sm); padding: .75rem .9rem; }
.ap-pref-help ol { padding-left: 1.1rem; }

/* ---------- Mobile ergonomics ---------- */
.ap-tab-icon { position: relative; display: inline-flex; }
.ap-tab-badge { position: absolute; top: -6px; right: -10px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--ap-danger); color: #fff; font-size: .62rem; font-weight: 700; line-height: 17px; text-align: center; box-shadow: 0 0 0 2px var(--ap-surface); }
.ap-tab-badge[hidden] { display: none; }
.ap-photo-bar { display: flex; flex-wrap: wrap; gap: .5rem; }
.ap-photo-bar .btn { min-height: 44px; flex: 1 1 140px; justify-content: center; }
.ap-photo-preview { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; font-size: .8rem; color: var(--ap-text-2); }
.ap-photo-preview[hidden] { display: none; }
.ap-photo-preview img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; border: 1px solid var(--ap-border); }
.ap-photo-preview span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-piece-nav { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .25rem; margin-bottom: .75rem; scrollbar-width: none; }
.ap-piece-nav::-webkit-scrollbar { display: none; }
.ap-piece-nav a { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .75rem; border-radius: 999px; border: 1px solid var(--ap-border); background: var(--ap-surface); font-size: .78rem; font-weight: 600; color: var(--ap-text); white-space: nowrap; }
.ap-piece-nav a.is-done { border-color: rgba(var(--ap-primary-rgb), .35); color: var(--ap-primary); }
.ap-piece-nav a svg { width: 14px; height: 14px; flex-shrink: 0; }
.ap-piece-nav a .ap-truncate { max-width: 160px; }
@media (max-width: 991.98px) {
    /* Main actions of a detail page stay under the thumb, above the bottom bar. */
    .ap-sticky-actions { position: sticky; bottom: calc(72px + env(safe-area-inset-bottom)); z-index: 1010; box-shadow: 0 -8px 24px -12px rgba(23, 43, 77, .35); }
    .ap-sticky-actions .btn { min-height: 48px; }
    .ap-offer-form .btn[type=submit], [data-offer-actions] .btn { min-height: 48px; }
}

/* ---------- Progressive Web App ---------- */
.ap-install-steps { padding-left: 1.2rem; margin-bottom: 1rem; }
.ap-install-steps li { margin-bottom: .55rem; line-height: 1.45; }
.ap-devices { list-style: none; padding: 0; margin: 0 0 .5rem; }
.ap-devices li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .55rem 0; border-bottom: 1px dashed var(--ap-border); }
.ap-devices li:last-child { border-bottom: 0; }
.ap-devices li > span { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-weight: 600; font-size: .88rem; min-width: 0; }
.ap-devices li small { flex-basis: 100%; font-weight: 400; color: var(--ap-text-3); font-size: .76rem; }
/* Installed app: status bar style "default" (content starts below the iOS status bar); the bottom
   bar already keeps clear of the home indicator (env(safe-area-inset-bottom)). */

/* Accessibility: the global "no motion" rule lives in ui.css §14; here the back-office transforms and named animations. */
@media (prefers-reduced-motion: reduce) {
    .ap-kpi, a.ap-kpi:hover, .ap-kpi::after { transform: none; }
    .ap-kpi.is-bumped, .ap-kpi.is-bumped .ap-kpi-value, .ap-bell.is-ringing > svg, .ap-bell .ap-dot.is-pop, .ap-toast, .ap-toast.is-order, .ap-topbar.is-order-alert, .ap-sound-unlock.is-attention { animation: none !important; }
}

/* ===== Admin « Codes de vérification » (manual one-time codes) ===== */
.ap-otp-code { display: inline-block; font-size: 1.15rem; font-weight: 750; letter-spacing: .12em; padding: .15rem .55rem; border-radius: var(--ap-radius-xs); background: var(--ap-primary-50); color: var(--ap-primary-700); }

/* ===== Public customer portal (/demande-piece) ===== */
.ap-portal-body { background: var(--ap-bg); }
.ap-portal { min-height: 100vh; display: flex; flex-direction: column; }
.ap-portal-wrap { width: 100%; max-width: 860px; margin-inline: auto; padding-inline: 16px; }
.ap-portal-header { position: sticky; top: 0; z-index: 1020; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--ap-border); }
.ap-portal-header-inner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 66px; max-width: 1160px; }
.ap-portal-header-links { display: flex; align-items: center; gap: .35rem; }
.ap-portal-header-links .btn { min-height: 40px; }
.ap-portal-logo { --ap-logo-h: 42px; }
.ap-portal-lang { display: flex; gap: .2rem; margin-inline-end: .25rem; }
.ap-portal-lang a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 .6rem; border-radius: 999px; font-size: .85rem; color: var(--ap-text-2); text-decoration: none; border: 1px solid transparent; }
.ap-portal-lang a:hover { background: var(--ap-hover); color: var(--ap-text); }
.ap-portal-lang a.is-active { background: var(--ap-primary-50); color: var(--ap-primary-700); font-weight: 600; }

/* Green hero (same identity as the customer home page) that the first card overlaps */
.ap-portal-hero { position: relative; overflow: hidden; color: #fff; padding: 2.5rem 0 5rem;
    background: radial-gradient(900px 520px at 0% 0%, #22B36D 0%, transparent 60%), linear-gradient(140deg, var(--ap-primary) 0%, #0C6A3D 55%, #1D4FA8 140%); }
.ap-portal-hero::after { content: ''; position: absolute; width: 460px; height: 460px; inset-inline-end: -170px; inset-block-start: -190px; border-radius: 50%; border: 70px solid rgba(255, 255, 255, .06); pointer-events: none; }
.ap-portal-hero .ap-portal-wrap { position: relative; z-index: 1; }
.ap-portal-badge { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .8rem; border-radius: 999px; background: rgba(255, 255, 255, .14); font-size: .82rem; font-weight: 600; margin-bottom: 1rem; }
.ap-portal-hero h1 { color: #fff; font-size: clamp(1.75rem, 4.5vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; margin-bottom: .6rem; }
.ap-portal-hero p { color: rgba(255, 255, 255, .88); font-size: 1.05rem; line-height: 1.6; max-width: 680px; margin-bottom: 1.5rem; }
.ap-portal-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .65rem; }
.ap-portal-steps li { display: flex; align-items: center; gap: .65rem; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); border-radius: var(--ap-radius-sm); padding: .75rem .85rem; font-size: .88rem; color: #fff; }
.ap-portal-steps span { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; background: #fff; color: var(--ap-primary-700); font-weight: 800; display: grid; place-items: center; }

.ap-portal-page { flex: 1; }
.ap-portal-main { width: 100%; max-width: 860px; margin: 0 auto; padding: 1.5rem 16px 2rem; position: relative; z-index: 2; }
.ap-portal-hero + .ap-portal-main { margin-top: -3.5rem; padding-top: 0; }

/* Form: numbered section cards */
.ap-portal-form { counter-reset: ap-portal-step; }
.ap-portal-form > .card { border-radius: 18px; box-shadow: var(--ap-shadow-lg); border-color: var(--ap-border); overflow: hidden; }
.ap-portal-form > .card > .card-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.35rem; background: var(--ap-surface-2); }
.ap-portal-form > .card > .card-body { padding: 1.35rem; }
.ap-portal-form .card-header h2 { display: flex; align-items: center; gap: .6rem; font-size: 1.05rem; font-weight: 700; margin: 0; }
.ap-portal-form .card-header h2::before { counter-increment: ap-portal-step; content: counter(ap-portal-step); flex-shrink: 0; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--ap-primary); color: #fff; font-size: .9rem; font-weight: 800; }
.ap-portal-form .card-header h2 svg { color: var(--ap-primary); }
.ap-portal-form .ap-line { border-radius: 14px; }
/* Reference field (monospace): the placeholder ("Facultatif", Arabic) keeps the normal font. */
.ap-portal-form .font-mono::placeholder { font-family: var(--bs-body-font-family); letter-spacing: normal; }
.ap-portal-form [data-line-add] { min-height: 48px; font-weight: 600; color: var(--ap-primary-700); }
/* Photos: the file field drawn as a drop zone */
.ap-portal-drop input[type=file] { padding: 1.4rem 1rem; border: 2px dashed var(--ap-border-strong); border-radius: 14px; background: var(--ap-surface-2); cursor: pointer; }
.ap-portal-drop input[type=file]:hover { border-color: var(--ap-primary); background: var(--ap-hover); }
.ap-portal-drop input[type=file]::file-selector-button { margin-inline-end: 1rem; padding: .55rem 1rem; border: 0; border-radius: 999px; background: var(--ap-primary-50); color: var(--ap-primary-700); font-weight: 600; }
/* Last card: contact + send, highlighted */
.ap-portal-form > .ap-portal-send { border: 2px solid var(--ap-primary-100); }
.ap-portal-send button[type=submit] { min-height: 56px; font-size: 1.1rem; font-weight: 700; border-radius: 14px; box-shadow: 0 14px 28px -14px rgba(var(--ap-primary-rgb), .8); }

.ap-portal-photos { display: flex; flex-wrap: wrap; gap: .5rem; margin: -.25rem 0 1rem; }
.ap-portal-photos[hidden] { display: none; }
.ap-portal-photos figure { position: relative; margin: 0; }
.ap-portal-photos img { width: 76px; height: 76px; object-fit: cover; border-radius: var(--ap-radius-sm); border: 1px solid var(--ap-border); }
.ap-portal-photos button { position: absolute; top: -8px; inset-inline-end: -8px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: var(--ap-danger); color: #fff; font-size: .9rem; line-height: 1; }
.ap-portal-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.ap-portal-footer { text-align: center; font-size: .8rem; color: var(--ap-text-3); padding: 1.5rem 16px 2rem; border-top: 1px solid var(--ap-border); background: var(--ap-surface); }
.ap-portal-trust { list-style: none; padding: 0; margin: 0 auto 1rem; max-width: 1000px; display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem 1.75rem; font-size: .86rem; color: var(--ap-text-2); }
.ap-portal-trust li { display: inline-flex; align-items: center; gap: .45rem; text-align: start; }
.ap-portal-trust svg { flex-shrink: 0; color: var(--ap-primary); }

.ap-portal-thanks { text-align: center; max-width: 560px; margin: 1rem auto; border-radius: 20px; box-shadow: var(--ap-shadow-lg); }
.ap-portal-thanks .card-body { padding: 2.25rem 1.5rem; }
.ap-portal-thanks h1 { font-size: 1.5rem; font-weight: 800; }
.ap-portal-thanks-icon { display: inline-grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--ap-success-bg); color: var(--ap-success); font-size: 2.2rem; margin-bottom: 1rem; box-shadow: 0 0 0 8px rgba(var(--ap-primary-rgb), .06); }
.ap-portal-ref { display: inline-block; font-size: 1.3rem; font-weight: 750; padding: .3rem .8rem; border-radius: var(--ap-radius-xs); background: var(--ap-primary-50); color: var(--ap-primary-700); }
@media (max-width: 767.98px) {
    .ap-portal-steps { grid-template-columns: 1fr; }
}
@media (max-width: 575.98px) {
    .ap-portal-logo { --ap-logo-h: 30px; }
    .ap-portal-hide-xs { display: none; }
    .ap-portal-lang a { padding: 0 .45rem; }
    .ap-portal-header-links { gap: .15rem; }
    .ap-portal-hero { padding: 1.75rem 0 4.5rem; }
    .ap-portal-hero p { font-size: 1rem; }
    .ap-portal-form > .card > .card-header, .ap-portal-form > .card > .card-body { padding-inline: 1rem; }
}

/* ===== Retailer quick answer (« Demandes reçues », retailer-quick.js) ===== */
.ap-quick-list { padding: .75rem; display: grid; gap: .75rem; }
.ap-quick-list > .pagination, .ap-quick-list > nav { margin: .25rem 0 0; }
.ap-quick { border: 1px solid var(--ap-border); border-radius: var(--ap-radius-sm); background: var(--ap-surface); box-shadow: var(--ap-shadow-sm); }
.ap-quick.is-new { border-left: 3px solid var(--ap-warning); }
.ap-quick-head { display: flex; align-items: center; gap: .6rem; padding: .65rem .85rem; flex-wrap: wrap; }
.ap-quick-toggle svg { transition: transform .15s; }
.ap-quick-toggle[aria-expanded="false"] svg { transform: rotate(-90deg); }
.ap-quick-title { flex: 1 1 260px; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.ap-quick-vehicle { flex-basis: 100%; font-size: .85rem; color: var(--ap-text-2); }
.ap-quick-vehicle svg { width: 15px; height: 15px; vertical-align: -2px; }
.ap-quick-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; justify-content: flex-end; }
.ap-quick-meta .ap-count { font-size: .76rem; font-weight: 600; color: var(--ap-text-2); background: var(--ap-surface-2); border: 1px solid var(--ap-border); border-radius: 999px; padding: .1rem .55rem; }
.ap-quick-meta svg { width: 14px; height: 14px; vertical-align: -2px; }
.ap-quick-body { border-top: 1px solid var(--ap-border); padding: .6rem .85rem .75rem; }
.ap-quick-body[hidden] { display: none; }
.ap-quick-table { margin-bottom: 0; font-size: .86rem; }
.ap-quick-table > thead th { font-size: .72rem; white-space: nowrap; }
.ap-quick-table > tbody td { vertical-align: top; }
.ap-quick-table .form-control, .ap-quick-table .form-select { min-width: 92px; }
.ap-quick-table .ap-quick-price { min-width: 104px; text-align: right; font-variant-numeric: tabular-nums; }
.ap-quick-table .ap-chip { margin-left: .25rem; }
.ap-quick-table tr.is-dirty > td:first-child { box-shadow: inset 3px 0 0 var(--ap-primary); }
.ap-quick-table tr.is-readonly { color: var(--ap-text-2); }
.ap-quick-table .invalid-feedback:empty { display: none !important; }
.ap-quick-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; margin-top: .6rem; }
.ap-quick-foot [data-draft-status] { margin-right: auto; }
.ap-quick-banner { display: flex; align-items: center; gap: .6rem; margin: .75rem .75rem 0; padding: .55rem .85rem; border-radius: var(--ap-radius-sm); background: var(--ap-primary-50); color: var(--ap-primary-700); font-weight: 600; font-size: .88rem; }
.ap-quick-banner[hidden] { display: none; }
.ap-quick-banner .btn { margin-left: auto; }
.ap-quick-panel { --bs-offcanvas-width: min(720px, 100vw); }
.ap-quick-panel-content { font-size: .9rem; }
.ap-quick-panel-section { margin-bottom: 1.25rem; }
.ap-quick-panel-section h3 { display: flex; align-items: center; gap: .35rem; margin-bottom: .6rem; }
.ap-quick-panel-section h3 svg { width: 14px; height: 14px; }
.ap-quick-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.ap-quick-gallery-item { display: block; padding: .4rem; border: 1px solid var(--ap-border); border-radius: var(--ap-radius-sm); color: inherit; text-decoration: none; min-width: 0; }
.ap-quick-gallery-item:hover { border-color: rgba(var(--ap-primary-rgb), .4); }
.ap-quick-gallery-item img { display: block; width: 100%; height: 110px; object-fit: cover; border-radius: var(--ap-radius-xs); margin-bottom: .35rem; }
.ap-quick-gallery-item .ap-file-thumb { width: 100%; height: 110px; margin-bottom: .35rem; }
.ap-quick-history { list-style: none; padding: 0; margin: .25rem 0 .5rem; font-size: .84rem; }
.ap-quick-history li { padding: .3rem 0; border-bottom: 1px dashed var(--ap-border); }
.ap-quick-history li.is-muted { opacity: .6; }
@media (max-width: 767.98px) {
    .ap-quick-list { padding: .5rem; }
    .ap-quick-head { padding: .6rem; }
    .ap-quick-meta { justify-content: flex-start; }
    .ap-quick-body { padding: .5rem; }
    .ap-quick-table > tbody { padding: 0; }
    .ap-quick-table > tbody tr { padding: .7rem .75rem; }
    .ap-quick-table > tbody td[data-label] .form-control, .ap-quick-table > tbody td[data-label] .form-select { display: inline-block; width: 58%; min-width: 0; }
    .ap-quick-table > tbody td[data-label] .invalid-feedback { text-align: right; }
    .ap-quick-foot .btn { flex: 1 1 auto; }
}

/* ---------- Customer proposal (WhatsApp) and preparation tracking ---------- */
.ap-wa-message { font-size: .9rem; line-height: 1.45; white-space: pre-wrap; }
.ap-steps { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; padding: 0; margin: .5rem 0 0; font-size: .78rem; }
.ap-steps li { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; background: var(--ap-muted-bg); color: var(--ap-text); opacity: .65; }
.ap-steps li.is-done { background: var(--ap-success-bg); color: var(--ap-success); opacity: 1; }
.ap-steps li.is-done::before { content: '✓'; font-weight: 700; }
.ap-steps li.is-current { background: var(--ap-primary); color: #fff; opacity: 1; font-weight: 650; }
@media (max-width: 767.98px) {
    [data-proposal-lines] td[data-label] .form-select { display: inline-block; width: 64%; min-width: 0; }
    [data-proposal] .btn-whatsapp, [data-proposal] [name="transmit"] { flex: 1 1 100%; }
}

/* Customer WhatsApp messages from a request (lot 4.1) */
.ap-msg-stages { display: flex; flex-wrap: wrap; gap: .4rem; }
.ap-msg-preview { white-space: pre-wrap; overflow-wrap: anywhere; background: #e7f8dc; border: 1px solid #cdeebb; border-radius: 12px; padding: .75rem 1rem; font-size: .95rem; max-width: 36rem; }
