/* ==========================================================================
   TRAVERSE — appli du métreur (téléphone). S'appuie sur traverse.css.
   Le configurateur occupe tout l'écran : cotes en haut, dessin à l'échelle au
   centre, prix et débit dessous, total et envoi collés en bas.
   ========================================================================== */

html, body { height: 100%; }
body.mt { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; background: var(--calque); }
.mt .demo-bar { flex: none; }

.stage {
  flex: 1 1 auto; min-height: 0; position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 430px) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  align-items: center; gap: 0 40px; padding: 22px 24px;
  background-color: var(--calque);
  background-image: linear-gradient(rgba(214, 211, 200, .5) 1px, transparent 1px), linear-gradient(90deg, rgba(214, 211, 200, .5) 1px, transparent 1px), linear-gradient(rgba(227, 225, 217, .55) 1px, transparent 1px), linear-gradient(90deg, rgba(227, 225, 217, .55) 1px, transparent 1px);
  background-size: 50px 50px, 50px 50px, 10px 10px, 10px 10px;
}

/* Planche (ordinateur) : la ligne en cours, en grand, avec son cartouche */
.planche { grid-column: 1; grid-row: 1; justify-self: end; align-self: center; width: min(520px, 100%); }
.planche__paper { display: flex; flex-direction: column; gap: 14px; padding: 22px; border: 1.5px solid var(--ink); background: rgba(251, 250, 247, .72); box-shadow: 8px 8px 0 rgba(21, 24, 27, .06); }
.planche__k { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.planche__draw { display: flex; justify-content: center; height: min(56vh, 520px); }
.planche__draw .dw { width: auto; height: 100%; max-width: 100%; }
.planche__cart { align-self: flex-end; max-width: 100%; overflow: hidden; }

/* ---------- Le téléphone ---------------------------------------------------------------- */
.app {
  grid-column: 2; grid-row: 1; position: relative; isolation: isolate;
  display: flex; flex-direction: column; width: 100%; height: min(100%, 880px);
  background: var(--calque); border: 10px solid #111316; border-radius: 54px; overflow: hidden; overflow: clip;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .3), 0 0 0 5px rgba(251, 250, 247, .6), 0 50px 90px -40px rgba(21, 24, 27, .6), 0 22px 40px -24px rgba(21, 24, 27, .4);
}
.sb { flex: none; position: relative; display: flex; align-items: center; justify-content: space-between; height: 44px; padding: 0 30px 0 34px; background: var(--anthracite); color: #fff; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.sb__island { position: absolute; left: 50%; top: 9px; width: 104px; height: 29px; margin-left: -52px; border-radius: 999px; background: #111316; }
.sb__icons { display: flex; align-items: center; gap: 6px; }
.sb__icons svg { height: 12px; width: auto; fill: currentColor; }

.screen { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: 0 16px 26px; scrollbar-width: thin; scrollbar-color: var(--grid-2) transparent; }

/* Barre du haut (onglets) */
.ah { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 56px; padding: 6px 14px 8px 16px; background: var(--anthracite); color: #fff; }
.ah__brand { display: inline-flex; min-height: 44px; align-items: center; text-decoration: none; color: #fff; }
.ah__brand .logo-mark { width: 28px; height: 28px; }
.ah__brand .logo__w b { font-size: 18px; color: #fff; }
.ah__who { display: flex; align-items: center; gap: 9px; }
.ah__role { font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .62); }
.ah__av { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--metre); color: var(--ink); font-family: var(--display); font-weight: 700; font-size: 15px; }

/* Bandeau de tête */
.band { position: relative; margin: 0 -16px; padding: 14px 16px 60px; background: var(--anthracite); color: #fff; overflow: hidden; }
.band::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px); background-size: 12px 12px; pointer-events: none; }
.band > * { position: relative; }
.band__k { font-family: var(--mono); font-size: 11.5px; color: var(--metre); }
.band__t { margin-top: 6px; font-family: var(--display); font-weight: 680; font-stretch: 106%; font-size: 27px; line-height: 1.06; letter-spacing: -.02em; }
.band__s { margin-top: 6px; font-size: 13.5px; color: rgba(255, 255, 255, .72); line-height: 1.4; }
.lift { position: relative; z-index: 1; margin-top: -44px; }
.sec__h { margin: 22px 0 10px; font-family: var(--display); font-weight: 650; font-size: 15.5px; }
.cardx { padding: 16px; border-radius: 18px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
.muted { color: var(--ink-3); font-size: 13px; line-height: 1.45; }
.amt { font-family: var(--display); font-weight: 680; font-stretch: 104%; font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.01em; }

/* Visites */
.vlist { display: grid; gap: 10px; }
.vis { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 76px; padding: 12px 12px 12px 14px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.vis.is-link { border: 1.5px solid var(--ink); }
.vis.is-link:active { transform: scale(.99); }
.vis__h { font-size: 15px; font-weight: 700; color: var(--ink); }
.vis__b { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.vis__b b { font-size: 15px; line-height: 1.25; }
.vis__b span { display: flex; align-items: flex-start; gap: 4px; font-size: 12.5px; color: var(--ink-3); line-height: 1.35; }
.vis__b .i { width: 14px; height: 14px; margin-top: 1px; }
.vis__s { display: flex; align-items: center; gap: 4px; }
.vis__go { width: 18px; height: 18px; color: var(--ink-3); }
.vlist--dim .vis { box-shadow: none; background: transparent; }

/* Relevés */
.rlist { display: grid; gap: 10px; }
.rel { display: grid; grid-template-columns: 62px minmax(0, 1fr); grid-template-rows: auto auto; gap: 4px 12px; padding: 12px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.rel.is-alert { border-color: rgba(200, 64, 46, .55); box-shadow: 0 0 0 3px var(--red-soft); }
.rel__art { grid-row: 1 / span 2; display: flex; align-items: center; justify-content: center; height: 70px; border-radius: 10px; background: var(--calque); background-image: var(--mm); background-size: 8px 8px; }
.rel__art .dw { width: 100%; height: 100%; }
.rel__b { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.rel__b b { font-size: 15px; }
.rel__b > span:not(.tag) { font-size: 12.5px; color: var(--ink-3); line-height: 1.35; }
.rel__p { font-size: 15px; }

/* Devis : lignes */
.llist { display: grid; gap: 10px; }
.ln { display: grid; grid-template-columns: 80px minmax(0, 1fr); grid-template-rows: auto auto; gap: 4px 12px; padding: 12px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.ln.is-alert { border-color: rgba(200, 64, 46, .55); box-shadow: 0 0 0 3px var(--red-soft); }
.ln__art { grid-row: 1 / span 2; display: flex; align-items: center; justify-content: center; height: 92px; border-radius: 10px; background: var(--calque); background-image: var(--mm); background-size: 8px 8px; padding: 4px; }
.ln__art .dw { width: 100%; height: 100%; }
.ln__b { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.ln__id { font-size: 11px; color: var(--ink-3); }
.ln__b b { font-size: 15px; line-height: 1.25; }
.ln__dims { font-size: 14px; color: var(--ink); }
.ln__spec { font-size: 12px; color: var(--ink-3); line-height: 1.35; }
.ln__b .tag { margin-top: 3px; white-space: normal; }
.ln__p { font-size: 16px; }
.tots { margin-top: 14px; display: grid; gap: 6px; }
.tots p { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; }
.tots p .amt { font-size: 15px; }
.tots__ttc { padding-top: 8px; border-top: 1px dashed var(--grid-2); font-weight: 700; }
.tots__ttc .amt { font-size: 22px !important; }
.tots__ac { color: var(--ink-2); }

/* Pied d'action : total et envoi */
.act { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 74px; padding: 10px 12px 10px 16px; background: var(--paper); border-top: 1px solid var(--line); box-shadow: 0 -12px 28px -22px rgba(21, 24, 27, .45); }
.act__sum { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.act__k { font-size: 11.5px; font-weight: 650; color: var(--ink-3); white-space: nowrap; }
.act__sum b { font-size: 20px; }
.act__sum small { font-size: 11px; color: var(--ink-3); }
.act__btn { flex: none; min-height: 50px; padding: 0 16px; font-size: 15px; border-radius: 14px; }
.act__btn .i { width: 18px; height: 18px; }
.act__st { display: inline-flex; align-items: center; gap: 9px; min-height: 50px; padding: 0 12px; border-radius: 14px; background: var(--warn-soft); color: #6d4206; line-height: 1.15; }
.act__st b { display: block; font-size: 14px; }
.act__st small { display: block; font-size: 11.5px; opacity: .85; }
.act__st.is-ok { background: var(--ok-soft); color: #1f6b43; }
.act__st .i { width: 18px; height: 18px; stroke-width: 2.4; }
.act__dot { width: 9px; height: 9px; flex: none; border-radius: 50%; background: var(--warn); animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* Barre d'onglets */
.tabbar { flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 6px 4px calc(8px + env(safe-area-inset-bottom, 0px)); background: rgba(251, 250, 247, .98); border-top: 1px solid var(--line); }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; border-radius: 14px; color: var(--ink-3); font-size: 12px; font-weight: 650; text-decoration: none; }
.tabbar__ico { position: relative; display: grid; place-items: center; width: 54px; height: 30px; border-radius: 999px; transition: background-color .25s; }
.tabbar__ico .i { width: 22px; height: 22px; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] .tabbar__ico { background: var(--metre); }
.badge { position: absolute; top: -2px; right: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--paper); }
.is-cfg .tabbar { display: none; }

/* ---------- Configurateur ---------------------------------------------------------------- */
.ch { flex: none; display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px 44px; align-items: center; gap: 2px; min-height: 58px; padding: 6px 6px 6px 4px; background: var(--anthracite); color: #fff; }
.ch__icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: #fff; }
.ch__icon:hover { background: rgba(255, 255, 255, .08); }
.ch__icon .i { width: 22px; height: 22px; stroke-width: 2.2; }
.ch__t { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ch__k { font-family: var(--mono); font-size: 11px; color: var(--metre); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch__t b { font-family: var(--display); font-weight: 650; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cfg { padding-top: 12px; background-color: var(--calque); }
.ro { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 9px 12px; border-radius: 12px; background: var(--ok-soft); color: #1f6b43; font-size: 13px; font-weight: 600; line-height: 1.35; }
.ro .i { width: 17px; height: 17px; stroke-width: 2.4; }
.todo { display: grid; grid-template-columns: 44px minmax(0, 1fr) 20px; align-items: center; gap: 10px; margin: -2px 0 12px; padding: 9px 10px; border-radius: 14px; background: var(--paper); border: 1.5px solid rgba(200, 64, 46, .45); color: inherit; text-decoration: none; }
.todo__art { height: 50px; display: flex; align-items: center; justify-content: center; }
.todo__art .dw { width: 100%; height: 100%; }
.todo__b { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.todo__b b { font-size: 14px; line-height: 1.25; }
.todo__b small { font-size: 11px; color: var(--ink-3); }
.todo > .i { width: 18px; height: 18px; color: var(--ink-3); }
.dims { display: grid; grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr); align-items: end; gap: 6px; }
.dim { position: relative; display: grid; gap: 4px; min-width: 0; }
.dim > span { font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.dim input { width: 100%; min-width: 0; height: 50px; padding: 0 34px 0 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--white); font-family: var(--mono); font-size: 21px; font-variant-numeric: tabular-nums; text-align: center; letter-spacing: .01em; -webkit-appearance: none; appearance: none; transition: border-color .2s, box-shadow .2s; }
.dim input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(242, 194, 27, .35); }
.dim input[readonly] { background: transparent; }
.dim input[aria-invalid="true"] { border-color: var(--red); }
.dim i { position: absolute; right: 11px; bottom: 15px; font-style: normal; font-family: var(--mono); font-size: 12px; color: var(--ink-3); pointer-events: none; }
.dims__x { padding-bottom: 13px; text-align: center; font-family: var(--mono); font-size: 18px; color: var(--ink-3); }
.draw.is-over ~ .price .price__ttc { color: var(--ink-3); }

.spec { display: flex; flex-wrap: nowrap; overflow: hidden; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); gap: 4px; width: 100%; margin-top: 8px; padding: 6px 0; border: 0; background: none; text-align: left; cursor: pointer; min-height: 44px; align-content: center; }
.spec span { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; background: rgba(21, 24, 27, .06); font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.sw { width: 10px; height: 10px; border-radius: 3px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }

.draw { position: relative; display: flex; justify-content: center; align-items: flex-end; height: 320px; margin: 4px -6px 0; border-radius: 14px; background: var(--paper); background-image: var(--mm); background-size: 10px 10px; box-shadow: inset 0 0 0 1px var(--line); padding: 6px 4px 2px; touch-action: none; user-select: none; -webkit-user-select: none; }
.draw .dw { width: 100%; height: 100%; }
.is-drag .draw { box-shadow: inset 0 0 0 1.5px var(--metre-2); }
.draw .dw-knob__halo { animation: halo 2.2s var(--ease) infinite; transform-box: fill-box; transform-origin: center; }
.is-drag .draw .dw-knob__halo { animation: none; }
@keyframes halo { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }

.limit { margin-top: 10px; padding: 13px 14px; border-radius: 14px; background: var(--red-soft); border: 1.5px solid rgba(200, 64, 46, .4); animation: limit-in .45s var(--ease) both; }
@keyframes limit-in { from { opacity: 0; transform: translateY(-6px); } }
.limit__msg { display: flex; gap: 9px; font-size: 14.5px; line-height: 1.4; font-weight: 650; color: #8f2a1c; }
.limit__msg .i { color: var(--red); margin-top: 1px; }
.limit__sub { margin: 4px 0 10px 29px; font-size: 13px; color: #7a3226; }
.limit__fixes { display: grid; gap: 8px; }
.limit__fixes .btn { min-height: 46px; font-size: 14.5px; justify-content: flex-start; text-align: left; }

.price { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin-top: 10px; padding: 10px 14px; border-radius: 14px; background: var(--anthracite); color: #fff; }
.price > div { display: flex; flex-direction: column; line-height: 1.1; }
.price small { margin-top: 3px; font-size: 11px; color: rgba(255, 255, 255, .6); }
.price__ttc { font-size: 27px; color: var(--metre); transition: color .2s; }
.price__ttc.is-tick { animation: tick .35s var(--ease); }
@keyframes tick { 30% { transform: translateY(-2px); } }
.price__ht { text-align: right; }
.price__ht .amt { font-size: 16px; }
.price.is-over .price__ttc { color: rgba(255, 255, 255, .5); text-decoration: line-through; text-decoration-thickness: 1.5px; }

.deb { margin-top: 12px; padding: 12px 12px 10px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); }
.deb__h { display: flex; align-items: center; gap: 7px; font-size: 13.5px; font-weight: 700; }
.deb__h .i { width: 17px; height: 17px; }
.deb__n { margin-left: auto; font-size: 11.5px; font-weight: 400; color: var(--ink-2); white-space: nowrap; }
.deb__bars { display: grid; gap: 4px; margin-top: 8px; }
.deb__row { display: grid; grid-template-columns: 62px minmax(0, 1fr); align-items: center; gap: 6px; }
.deb__ref { font-size: 10px; color: var(--ink-3); white-space: nowrap; }
.deb__s { margin-top: 8px; font-size: 11.5px; color: var(--ink-3); line-height: 1.4; }

.opts { margin-top: 6px; }
.fld2 { display: grid; gap: 7px; margin-top: 14px; }
.fld2 > span { font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.fld2 > small { font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { min-height: 44px; padding: 0 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--white); color: var(--ink-2); font-size: 13.5px; font-weight: 600; white-space: nowrap; transition: background-color .2s, border-color .2s, color .2s; }
.chips button[aria-checked="true"] { background: var(--metre); border-color: var(--ink); color: var(--ink); }
.chips button:disabled { opacity: .55; cursor: default; }
.chips button[aria-checked="true"]:disabled { opacity: 1; }
.sws { display: flex; flex-wrap: wrap; gap: 6px; }
.swb { width: 44px; height: 44px; border-radius: 12px; border: 0; background: linear-gradient(135deg, var(--c) 50%, var(--c2) 50%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2); transition: transform .2s var(--ease), box-shadow .2s; }
.swb[aria-checked="true"] { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .2), 0 0 0 2.5px var(--calque), 0 0 0 4.5px var(--ink); }
.swb:disabled { opacity: .25; cursor: default; }
.swb[aria-checked="true"]:disabled { opacity: 1; }
.togs { display: grid; gap: 6px; }
.tog { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); text-align: left; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.tog__t { position: relative; flex: none; width: 40px; height: 24px; border-radius: 999px; background: var(--grid-2); transition: background-color .25s; }
.tog__t::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .3s var(--ease); }
.tog[aria-checked="true"] { color: var(--ink); border-color: var(--ink-3); }
.tog[aria-checked="true"] .tog__t { background: var(--metre-2); }
.tog[aria-checked="true"] .tog__t::after { transform: translateX(16px); }
.tog:disabled { opacity: .55; }
.imp { display: flex; align-items: center; gap: 8px; }
.imp b { min-width: 86px; text-align: center; font-size: 16px; font-weight: 500; }
.imp__b { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--white); font-size: 20px; font-weight: 600; }
.imp__b:disabled { opacity: .4; }
.imp__x { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-left: auto; padding: 0 12px; border: 0; border-radius: 12px; background: rgba(21, 24, 27, .06); font-size: 13px; font-weight: 600; color: var(--ink-2); }
.imp__x .i { width: 15px; height: 15px; }
.cfg__cart { display: flex; justify-content: flex-end; margin-top: 18px; overflow: hidden; }
.cfg__cart .cartouche { font-size: 9.5px; }
.cfg__cart .cartouche > span { padding: 5px 6px; }

/* Toasts au-dessus du pied d'action : jamais sur les cotes ni sur le bouton d'envoi */
.app .toast-stack { position: absolute; top: auto; bottom: 86px; left: 10px; right: 10px; transform: none; width: auto; z-index: 50; }
.app:not(.is-cfg) .toast-stack { bottom: 150px; }

/* ---------- Téléphone : plein écran ; intégré : plein cadre ----------------------------------- */
@media (max-width: 1099px) { .planche { display: none; } }
@media (max-width: 639px) {
  .stage { display: block; padding: 0; background: none; }
  .app { width: 100%; height: 100%; border: 0; border-radius: 0; box-shadow: none; }
  .sb { display: none; }
}
.is-embed .stage { display: block; padding: 0; background: none; }
.is-embed .planche { display: none; }
.is-embed .app { width: 100%; height: 100%; border: 0; border-radius: 0; box-shadow: none; }
.is-embed .sb { display: none; }

@media (prefers-reduced-motion: reduce) {
  .draw .dw-knob__halo { animation: none; }
}
