/* ==========================================================================
   Blok „Panel tonera” (.lift.tp.mo-tp) – kompaktowy arkusz na krawędzi nagłówka.
   Górny wiersz jak w innych arkuszach (kafelek + tytuł, po prawej odtwarzanie i etykieta),
   niżej jeden rząd: urządzenie z miernikiem po lewej, po prawej wstęp, tor etapów z nitką
   i opis bieżącego etapu (tylko tutaj – tytuł etapu jest w torze).
   Rama arkusza (.lift, .lift__sheet, .lift__top, .lift__title, .lift__state) – primitives.css.
   Klasy .tp* i .mo-tp występują tylko w tym bloku; view.js opiera się na .tp__*, data-tp-*.
   ========================================================================== */

.mo-tp .lift__sheet { padding: clamp(1.25rem, 2.4vw, 2rem); }

/* --------------------------------------------------------------------------
   Górny wiersz: kafelek + tytuł, przycisk odtwarzania + etykieta
   -------------------------------------------------------------------------- */

.mo-tp__top { flex-wrap: nowrap; }
.mo-tp__title { display: flex; align-items: center; gap: .8rem; min-width: 0; text-wrap: balance; }
.mo-tp__tile {
  flex: none; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: var(--navy-50); color: var(--navy);
}
.mo-tp__tile .icon { width: 1.15rem; height: 1.15rem; }
.tp__controls { flex: none; display: flex; align-items: center; gap: .65rem; }
.tp__play {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: #fff; border: 0; box-shadow: inset 0 0 0 1.5px var(--line-strong); color: var(--navy-900);
  transition: background-color .2s, color .2s, box-shadow .2s;
}
.tp__play:hover { background: var(--navy-900); color: #fff; box-shadow: inset 0 0 0 1.5px var(--navy-900); }
.tp__play .icon { width: .95rem; height: .95rem; }

/* --------------------------------------------------------------------------
   Układ: urządzenie | wstęp, tor etapów, opis
   -------------------------------------------------------------------------- */

.tp__layout {
  display: grid; margin-top: clamp(1rem, 1.6vw, 1.25rem);
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-template-areas: "dev lead" "dev track" "dev status";
  grid-template-rows: auto auto 1fr;
  gap: .65rem clamp(1.5rem, 3vw, 2.5rem);
}
.mo-tp .tp__lead { grid-area: lead; margin: 0; max-width: 66ch; font-size: .9375rem; line-height: 1.45; }

/* the device on a paper-2 panel: the instrument's own ground inside the sheet */
.tp__device {
  grid-area: dev; position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: .7rem;
  padding: .9rem 1.1rem .8rem; border-radius: 14px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line);
}
.tp__head { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding-bottom: .7rem; border-bottom: 1px solid var(--line); }
.tp__ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #fff; color: var(--navy); box-shadow: inset 0 0 0 1px var(--line); }
.tp__ico .icon { width: 1.05rem; height: 1.05rem; }
.tp__name { margin: 0; font-weight: 600; font-size: .9375rem; line-height: 1.3; color: var(--navy-900); }
.tp__where { margin: 0; font-size: .8125rem; line-height: 1.4; color: var(--muted); }
.tp__count { margin: 0; font-family: var(--font-ui); font-size: .8125rem; line-height: 1.35; color: var(--muted); text-align: right; white-space: nowrap; }
.tp__count > span { display: block; }
.tp__count b { font-size: 1rem; font-weight: 600; color: var(--navy-900); font-variant-numeric: tabular-nums; }

.tp__meter-top { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.tp__read { flex: none; }
.tp__label { margin: 0 0 .3rem; font-family: var(--font-ui); font-weight: 500; font-size: .8125rem; line-height: 1.2; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.tp__level { margin: 0; color: var(--navy-900); font-weight: 300; font-size: clamp(2.125rem, 1.75rem + .9vw, 2.5rem); line-height: 1; letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.tp__level small { font-size: 1.125rem; font-weight: 400; letter-spacing: 0; margin-left: .12rem; }

.tp__bar { position: relative; height: 14px; margin: .7rem 0 1.4rem; border-radius: var(--radius-pill); background: #fff; box-shadow: inset 0 0 0 1px var(--line-strong); }
/* the level as a width, so the round ends keep their shape at any level */
.tp__fill {
  position: absolute; inset: 3px auto 3px 3px; width: calc((100% - 6px) * var(--lvl, 64) / 100);
  border-radius: var(--radius-pill); background: var(--navy-900); transition: background-color .5s;
}
/* at or below the threshold (order sent, toner on its way) the fill is the chart's lit state;
   is-low = poziom etapu ≤ próg (render.php), is-now = bieżący etap (view.js) */
.mo-tp:has(.tp__steps li.is-low.is-now) .tp__fill { background: var(--orange-600); }
/* left: próg z pola bloku (style="left:…%") */
.tp__mark { position: absolute; top: -6px; bottom: -6px; left: 20%; width: 3px; margin-left: -1px; border-radius: 2px; background: var(--orange); }
.tp__mark span { position: absolute; top: calc(100% + .3rem); left: 50%; transform: translateX(-50%); white-space: nowrap; font-family: var(--font-ui); font-weight: 500; font-size: .8125rem; line-height: 1.2; color: var(--muted); }

/* the notification sits beside the reading, its room kept while hidden (no jump) */
.tp__toast {
  display: grid; grid-template-columns: 1rem minmax(0, 1fr); gap: .55rem; align-items: start;
  width: fit-content; max-width: 16.5rem; padding: .55rem .75rem .55rem .65rem; border-radius: 12px;
  background: var(--navy-900); color: #fff; font-size: .8125rem; line-height: 1.4;
  box-shadow: 0 14px 28px -14px rgba(22, 42, 67, .6);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .35s var(--ease), transform .5s var(--ease), visibility 0s linear .5s;
}
.tp__toast .icon { width: 1rem; height: 1rem; color: var(--orange-400); margin-top: .1rem; }
.tp__toast b { display: block; font-weight: 600; text-wrap: balance; }
.tp__toast.is-shown { opacity: 1; visibility: visible; transform: none; transition: opacity .35s var(--ease), transform .5s var(--ease), visibility 0s linear 0s; }

/* --------------------------------------------------------------------------
   Tor etapów (poziomo) i opis bieżącego etapu
   -------------------------------------------------------------------------- */

.tp__track { grid-area: track; position: relative; }
.tp__steps { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; list-style: none; margin: 0; padding: 0; }
.tp__steps li { display: flex; }
.tp__thread { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 1; }
.tp__thread .track { fill: none; stroke: var(--orange-100); stroke-width: 2; }
.tp__thread .draw { fill: none; stroke: var(--orange); stroke-width: 2.5; stroke-linecap: round; }
.tp__step {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; width: 100%; min-height: 40px;
  margin: 0; padding: .6rem .55rem .6rem; background: none; border: 0; border-radius: 12px; text-align: left; cursor: pointer;
  font: inherit; transition: background-color .25s, box-shadow .25s;
}
.tp__step:hover { background: var(--paper-2); }
.tp__step b { font-weight: 600; font-size: .875rem; line-height: 1.35; color: var(--navy); transition: color .25s; }
/* the step's toner level rides on the thread beside its dot, on the step's own ground */
.tp__pct {
  order: -1; position: relative; z-index: 2; margin-left: calc(14px + .2rem); padding: 0 .3rem; border-radius: 4px;
  background: var(--paper); font-family: var(--font-ui); font-weight: 500; font-size: .8125rem; line-height: 1.35;
  color: var(--muted-2); font-variant-numeric: tabular-nums; transition: background-color .25s;
}
.tp__step:hover .tp__pct { background: var(--paper-2); }
.tp__sdesc { display: none; }
.tp__dot {
  position: absolute; z-index: 2; left: .55rem; top: calc(.6rem + 1px); width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--orange-100); transition: border-color .4s, background-color .4s, box-shadow .4s;
}
.tp__steps li.is-reached .tp__dot { border-color: var(--orange); background: var(--orange); }
.tp__steps li.is-now .tp__dot { box-shadow: 0 0 0 5px var(--orange-50); }
.tp__steps li.is-now .tp__step { background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--line); }
.tp__steps li.is-now b { color: var(--navy-900); }
.tp__steps li.is-now .tp__pct { color: var(--navy-900); font-weight: 600; background: var(--paper-2); }

/* min-height = the longest description at this width (view.js), so nothing below jumps */
.tp__status { grid-area: status; padding-top: .65rem; border-top: 1px solid var(--line); }
.tp__state { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: .7rem; align-items: start; margin: 0; font-size: .9375rem; line-height: 1.5; color: var(--muted); }
.tp__state .icon { box-sizing: content-box; width: 1rem; height: 1rem; padding: 8px; border-radius: 10px; background: var(--navy-50); color: var(--navy); }
.tp__state > span { padding-top: .2rem; }
.tp__status.is-swap .tp__state > span { animation: tp-swap .45s var(--ease) both; }
@keyframes tp-swap { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.tp__note { margin: .8rem 0 0; font-family: var(--font-ui); font-size: .8125rem; line-height: 1.45; color: var(--muted); }

/* --------------------------------------------------------------------------
   Mniejsze ekrany
   -------------------------------------------------------------------------- */

/* narrow two-column sheet: the material label spans the reading row, so the notification
   keeps two lines beside the level */
@media (min-width: 901px) and (max-width: 1100px) {
  .tp__meter-top { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "label label" "level toast"; align-items: center; column-gap: 1rem; }
  .tp__read { display: contents; }
  .tp__label { grid-area: label; }
  .tp__level { grid-area: level; min-width: 2.35em; } /* room for 100 %, so nothing reflows on the last step */
  .tp__toast { grid-area: toast; justify-self: end; }
}

@media (max-width: 900px) {
  .tp__layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "lead" "dev" "track" "status"; grid-template-rows: none; gap: .75rem; }
}

/* phones: one reading row in the device, the notification drops over the device head like a
   push banner, the steps become one-line rows with the level on the right */
@media (max-width: 600px) {
  .mo-tp__top { padding-bottom: .65rem; }
  .mo-tp__tile { display: none; }
  .mo-tp__top .lift__state { display: none; }
  .tp__layout { gap: .6rem; }
  .mo-tp .tp__lead { font-size: .875rem; line-height: 1.4; }
  .tp__device { padding: .65rem .8rem .6rem; gap: .45rem; }
  .tp__head { grid-template-columns: minmax(0, 1fr) auto; padding-bottom: .5rem; }
  .tp__ico { display: none; }
  .tp__read { flex: 1; display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
  .tp__label { margin: 0; }
  .tp__level { font-size: 2rem; }
  .tp__bar { margin: .45rem 0 1.25rem; }
  .tp__toast {
    position: absolute; z-index: 3; top: .45rem; left: .45rem; right: .45rem; width: auto; max-width: none;
    box-shadow: 0 16px 32px -14px rgba(22, 42, 67, .7); transform: translateY(-6px);
  }
  .tp__toast.is-shown { transform: none; }
  /* the banner stands in for the head while it shows (a two-line head would peek out below it) */
  .tp__head > * { transition: opacity .3s var(--ease); }
  .tp__device:has(.tp__toast.is-shown) .tp__head > * { opacity: 0; }
  .tp__steps { grid-auto-flow: row; grid-auto-columns: auto; gap: 0; }
  .tp__step { flex-direction: row; align-items: center; justify-content: space-between; gap: .6rem; padding: .45rem .55rem .45rem 2.2rem; min-height: 40px; }
  .tp__pct { order: 0; margin-left: 0; padding: 0; background: none; }
  .tp__step:hover .tp__pct, .tp__steps li.is-now .tp__pct { background: none; }
  .tp__dot { left: .75rem; top: 50%; margin-top: -7px; }
  /* the description reads on its own under the rows (the step icon is decoration here) */
  .tp__status { padding: .1rem .55rem 0; border-top: 0; }
  .tp__state { display: block; font-size: .875rem; line-height: 1.45; }
  .tp__state .icon { display: none; }
  .tp__state > span { padding-top: 0; }
  .tp__note { margin-top: .65rem; }
}

@media (prefers-reduced-motion: reduce) {
  .tp__status.is-swap .tp__state > span { animation: none; }
  .tp__toast, .tp__toast.is-shown, .tp__fill, .tp__head > * { transition: none; }
}
