:root {
  color-scheme: light;
  --ink: #1c1c1c;
  --muted: #5c6770;
  --line: #9fb2c8;
  --panel: #e8eef6;
  --blue: #005e95;
  --blue-deep: #1565c0;
  --green: #2e7d32;
  --yellow: #f9a825;
  --gray: #757575;
  --orange: #f57c00;
  --paper: #f4f5f7;
  --card: #ffffff;
  --dialog: #eceff1;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #d9e6f2 0, transparent 36%),
    #e7ebf0;
}

button, input, select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #003d66;
  outline-offset: 2px;
}

.noscript {
  margin: 24px;
  padding: 16px;
  background: white;
}

.page {
  max-width: 1744px;
  margin: 0 auto;
  padding: 16px 20px 40px;
}

.page-intro {
  margin: 0 0 16px;
}

.page-intro h1 {
  margin: 0 0 8px;
  font-size: 1.8rem;
  letter-spacing: -0.03em;
}

.page-intro p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

.page-intro p + p {
  margin-top: 12px;
}

.page-intro p.italic {
  font-style: italic;
}

.layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(320px, 460px);
  gap: 24px;
  align-items: start;
}

.layout.with-progress {
  grid-template-columns: minmax(240px, 512px) minmax(320px, 460px) minmax(280px, 512px);
  column-gap: 24px;
  row-gap: 16px;
}

.layout.with-progress .side {
  display: contents;
}

.layout.with-progress .page-intro {
  grid-column: 1;
  grid-row: 1;
  margin-bottom: 0;
}

.layout.with-progress .lesson {
  grid-column: 1;
  grid-row: 2;
}

.layout.with-progress .tablet {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.layout.with-progress .progress-column {
  grid-column: 3;
  grid-row: 1 / span 2;
  display: grid;
  grid-template-rows: subgrid;
}

.progress-stack {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
  width: 100%;
}

.layout.with-progress .progress-note {
  align-self: start;
  width: 100%;
}

.lesson {
  background: var(--card);
  border: 1px solid #d5dde6;
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: 0 10px 30px rgba(20, 40, 60, 0.06);
}

.lesson h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.lesson p, .lesson li {
  line-height: 1.45;
}

.lesson p {
  margin: 0 0 12px;
  color: #333;
}

.lesson p.italic {
  font-style: italic;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.steps li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  align-items: start;
  color: #333;
}

.mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e1e6ec;
  color: #445;
}

.steps li.done .mark {
  background: var(--green);
  color: white;
}

.steps li ul {
  list-style: disc;
  margin: 6px 0 0;
  padding-left: 1.2rem;
}

.steps li li {
  display: list-item;
  margin: 0 0 4px;
}

.show-me {
  display: inline-block;
  margin-left: 8px;
  vertical-align: 1px;
  background: var(--blue);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 2px 10px;
  min-height: 26px;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
}

.leak-screen {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(40, 48, 56, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}

.leak-panel {
  width: 44.7vw;
  height: 44.7vh;
  background: #f6f3ec;
  border: 1px solid #d5d0c6;
  box-shadow: 0 16px 40px rgba(20, 30, 40, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.leak-fit {
  position: relative;
  flex: 1;
  min-height: 0;
}

.leak-stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 900px;
  height: 720px;
  margin-left: -450px;
  margin-top: -360px;
  background: #f6f3ec;
  overflow: hidden;
  transform-origin: center center;
}

.leak-housing,
.leak-rope {
  position: absolute;
  left: 18px;
  top: 36px;
  width: 826px;
  height: 420px;
  user-select: none;
  pointer-events: none;
}

.leak-housing { z-index: 2; }

.leak-rope {
  z-index: 3;
  animation: leak-dip 7.4s ease-in-out 1 forwards;
}

@keyframes leak-dip {
  0% { transform: translateY(0); }
  16.2% { transform: translateY(150px); }
  83.8% { transform: translateY(150px); }
  100% { transform: translateY(0); }
}

.leak-lead {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: visible;
}

.leak-cup-back,
.leak-cup-front {
  position: absolute;
  left: 372px;
  top: 500px;
  width: 460px;
  height: 196px;
  overflow: visible;
}

.leak-cup-back { z-index: 1; }
.leak-cup-front { z-index: 5; }

.leak-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 8px 10px 10px;
}

.leak-actions .show-me,
.show-row .show-me {
  margin-left: 0;
}

.show-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.leak-hold {
  margin: 8px 0 0;
}

.leak-watch {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 8;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: #f7f7f7;
  border: 5px solid #243040;
  box-shadow: inset 0 0 0 2px #d5dde6, 0 8px 18px rgba(0, 0, 0, 0.22);
}

.leak-watch[hidden] { display: none; }

.leak-watch::after {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 14px;
  height: 10px;
  margin-left: -7px;
  background: #243040;
  border-radius: 3px 3px 0 0;
}

.leak-watch-hand {
  position: absolute;
  left: 50%;
  top: 16px;
  width: 3px;
  height: 32px;
  margin-left: -1.5px;
  background: #c62828;
  border-radius: 2px;
  transform-origin: center bottom;
}

.leak-watch-time {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.92rem;
  color: #1c1c1c;
}

.leak-result {
  position: absolute;
  right: 10px;
  bottom: 8px;
  z-index: 7;
  width: min(42%, 230px);
  height: auto;
  border-radius: 12px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
  opacity: 0;
  animation: leak-result-show 7.4s linear 1 forwards;
  pointer-events: none;
}

@keyframes leak-result-show {
  0%, 74% { opacity: 0; }
  76%, 100% { opacity: 1; }
}

.probe-body {
  position: absolute;
  left: 40px;
  top: 16px;
  width: 630px;
  height: 420px;
  pointer-events: none;
}

.probe-tip {
  position: absolute;
  left: 190px;
  top: 248px;
  width: 234px;
  height: 197px;
  z-index: 4;
  pointer-events: none;
  animation: probe-dip 7.4s ease-in-out 1 forwards;
}

@keyframes probe-dip {
  0% { transform: translateY(0); }
  16.2% { transform: translateY(155px); }
  83.8% { transform: translateY(155px); }
  100% { transform: translateY(0); }
}

.probe-stage .leak-cup-back,
.probe-stage .leak-cup-front {
  left: 100px;
  top: 448px;
  width: 360px;
  height: 200px;
}

.progress-note {
  background: var(--card);
  border: 1px solid #d5dde6;
  border-radius: 18px;
  padding: 18px 18px 16px;
  box-shadow: 0 10px 30px rgba(20, 40, 60, 0.06);
}

.progress-note h2 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: var(--ink);
}

.progress-note p {
  margin: 0 0 10px;
  color: #333;
  line-height: 1.45;
}

.progress-note p:last-of-type {
  margin-bottom: 0;
}

.color-key {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.color-key .pill {
  width: 64px;
  min-height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.reset-side {
  align-self: flex-end;
  margin-top: 16px;
  margin-bottom: 36px;
  margin-left: auto;
  width: auto;
  min-width: 160px;
  background: var(--orange);
  color: white;
  border: 0;
  border-radius: 16px;
  min-height: 44px;
  padding: 8px 14px;
  font-weight: 700;
}

.tablet {
  position: relative;
  height: min(900px, calc(100vh - 40px));
  min-height: 680px;
  background: var(--paper);
  border-radius: 36px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 50px rgba(20, 40, 60, 0.18);
  border: 18px solid #000;
}

.tablet-body {
  flex: 1;
  overflow: auto;
  padding: 8px 16px 18px;
  container-type: inline-size;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  margin: 0 -16px 16px;
  padding: 8px 12px;
  border-bottom: 1px solid #e6e6e6;
}

.brand-icon {
  width: 92px;
  height: 92px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand-logo {
  height: 46px;
  width: auto;
  max-width: calc(100% - 110px);
  object-fit: contain;
}

.screen-title {
  margin: 0 0 14px;
  font-size: 1.25rem;
}

.screen-title.one-line {
  font-size: clamp(11px, 4.6cqi, 15px);
  white-space: nowrap;
}

.chooser {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 12px 8px;
}

.chooser button {
  background: transparent;
  border: 0;
  color: var(--ink);
  display: grid;
  justify-items: center;
  gap: 6px;
  min-height: 92px;
  padding: 4px;
}

.chooser button:disabled {
  color: #95a0aa;
  cursor: default;
}

.chooser-icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.chooser button:disabled .chooser-icon {
  opacity: 0.35;
}

.chooser span {
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}

.linkish {
  display: block;
  margin: 22px auto 0;
  background: transparent;
  border: 0;
  color: var(--blue-deep);
  font-weight: 700;
  text-decoration: underline;
  min-height: 44px;
}

.linkish:disabled {
  color: #a0a7ae;
  cursor: default;
}

.gateway-hint, .note, .callout {
  margin-top: 16px;
  padding: 12px;
  border-radius: 12px;
  background: white;
  border: 1px solid #dde3ea;
  line-height: 1.4;
}

.note {
  background: #fff8e8;
  border-color: #f0d48a;
}

.progress-card {
  background: white;
  border-radius: 16px;
  padding: 14px;
  border-left: 8px solid var(--gray);
  box-shadow: 0 4px 16px rgba(20, 40, 60, 0.05);
}

.progress-card.yellow { border-left-color: var(--yellow); }
.progress-card.green { border-left-color: var(--green); }
.progress-card.blue { border-left-color: var(--blue-deep); }

.progress-card h3 {
  margin: 0 0 6px;
}

.progress-card p {
  margin: 0;
  color: #333;
}

.primary, .secondary, .menu-button, .pill, .spot-hit, .leak-button {
  border: 0;
  border-radius: 12px;
}

.primary, .secondary, .menu-button, .leak-button {
  min-height: 46px;
  padding: 10px 14px;
  font-weight: 700;
}

.primary {
  background: var(--blue);
  color: white;
  width: 100%;
  margin-top: 14px;
}

.leak-button {
  background: var(--blue-deep);
  color: white;
  width: 100%;
}

.secondary {
  background: white;
  color: var(--blue);
  border: 1px solid var(--line);
}

.stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.menu-button {
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid #dde3ea;
  color: var(--ink);
}

.status-block {
  background: white;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  gap: 4px;
}

.status-block div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.status-block dt {
  color: var(--muted);
}

.status-block dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.section-label {
  margin: 16px 0 8px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.settings-screen {
  display: grid;
  gap: 8px;
}

.settings-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -4px 0 0;
}

.settings-top h2 {
  margin: 0;
  font-size: 1.25rem;
}

.settings-top .text-button {
  min-height: 36px;
}

.settings-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: start;
}

.settings-col,
.settings-section {
  display: grid;
  gap: 5px;
}

.settings-section h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.settings-section p {
  margin: 0;
  font-size: 0.86rem;
}

.settings-note {
  color: #444;
  font-size: 0.75rem;
}

.settings-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
  background: #e7e8ea;
}

.settings-status div {
  min-height: 52px;
  background: white;
  border: 1px solid #79747e;
  padding: 6px 8px;
}

.settings-status dt {
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-status dd {
  margin: 2px 0 0;
  font-size: 0.82rem;
}

.settings-screen .menu-button {
  min-height: 34px;
  padding: 4px 8px;
  border: 0;
  border-radius: 16px;
  background: var(--blue);
  color: white;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.2;
}

.settings-screen .reset-demo {
  background: var(--orange);
  font-weight: 700;
  animation: reset-pulse 1.6s ease-in-out infinite;
}

@keyframes reset-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}

@media (prefers-reduced-motion: reduce) {
  .settings-screen .reset-demo { animation: none; }
}

.plan-wrap {
  position: relative;
  background: white;
  border: 1px solid #d5dde6;
  border-radius: 16px;
  overflow: hidden;
}

.plan {
  position: relative;
  width: 100%;
  background: white;
}

.plan-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.floorplan-title {
  margin: 8px 0 4px;
  font-size: 2rem;
  font-weight: 700;
}

.floorplan-ribbon {
  display: flex;
  background: #005e95;
}

.floorplan-ribbon button {
  flex: 1;
  min-height: 48px;
  background: transparent;
  color: white;
  border: 0;
  font-weight: 700;
}

.gateway-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #e8eef6;
  border: 1px solid #9fb2c8;
  padding: 10px;
  margin-bottom: 12px;
  font-size: 0.85rem;
}

.gateway-bar .swatch,
.traffic-dot {
  margin-right: 0;
  width: 11px;
  height: 11px;
}

.traffic-dot {
  display: inline-block;
  border-radius: 50%;
  background: #b0b0b0;
  flex: none;
}

.traffic-dot.live {
  background: var(--yellow);
}

.gateway-bar .snr {
  color: #2e7d32;
}

.progress-table {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.progress-labels,
.progress-row {
  display: grid;
  align-items: center;
  gap: 4px;
  min-width: 280px;
}

.progress-labels {
  color: #333;
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
}

.progress-row img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.seg {
  display: block;
  height: 14px;
  border-radius: 3px;
}

.seg.gray { background: #bdbdbd; }
.seg.yellow { background: var(--yellow); }
.seg.green { background: var(--green); }
.seg.blue { background: var(--blue-deep); }

.about-copy {
  white-space: pre-wrap;
}

.paired { color: #2e7d32; font-weight: 700; }
.unpaired { color: #666; font-weight: 700; }

.plain-list {
  margin: 0 0 12px;
  padding-left: 1.2rem;
}

.spot {
  position: absolute;
  width: var(--dot, 22px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  z-index: 1;
}

.spot-hit {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  padding: 0;
  box-shadow: none;
}

.spot-hit.fcu { background: #d32f2f; }
.spot-hit.humidifier { background: #c2185b; }
.spot-hit.selected { box-shadow: 0 0 0 2px white, 0 0 0 4px #005e95; }

.tags {
  position: absolute;
  left: 16px;
  top: -8px;
  display: grid;
  gap: 2px;
}

.spot.right .tags { left: auto; right: 16px; }

.tag {
  white-space: nowrap;
  background: white;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.tag.gray { color: #222; }
.tag.yellow { color: #8a5a00; }
.tag.green { color: var(--green); }
.tag.blue { color: var(--blue-deep); }

.spot.right .tag { left: auto; right: 16px; }

.unit-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.unit-row .progress-card {
  flex: 1;
}

.unit-sensors {
  margin-top: 14px;
  background: white;
  border: 1px solid #d0d0d0;
  padding: 12px;
  max-width: 100%;
  overflow-x: auto;
}

.unit-sensors table {
  width: 100%;
  min-width: 360px;
  table-layout: fixed;
  font-size: 0.82rem;
}

.unit-sensors th,
.unit-sensors td {
  white-space: normal;
  padding: 6px 3px;
}

.unit-sensors th:nth-child(1),
.unit-sensors td:nth-child(1) { width: 16%; }
.unit-sensors th:nth-child(2),
.unit-sensors td:nth-child(2) { width: 22%; }
.unit-sensors th:nth-child(3),
.unit-sensors td:nth-child(3) { width: 13%; }
.unit-sensors th:nth-child(4),
.unit-sensors td:nth-child(4) { width: 24%; }
.unit-sensors th:nth-child(5),
.unit-sensors td:nth-child(5) { width: 14%; }

.unit-sensors h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.unit-sensors p {
  margin: 0;
}

.unit-sensors .add-sensor-hint {
  margin: 0 0 10px;
}

.unit-sensors th.status,
.unit-sensors td.status {
  text-align: center;
  width: 34px;
  padding-left: 2px;
  padding-right: 2px;
}

.status-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.unit-sensors th.status img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.status-dot.green { background: var(--green); }
.status-dot.blue { background: var(--blue-deep); }

.status-dot.flash-red {
  background: #c62828;
  animation: status-blink 0.5s linear infinite;
}

.status-dot.flash-blue {
  background: var(--blue-deep);
  animation: status-blink 0.5s linear 4;
}

@keyframes status-blink {
  0% { opacity: 1; }
  50% { opacity: 0.15; }
  100% { opacity: 1; }
}

.icon-launch {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  padding: 0;
}

.icon-launch img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.legend img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  margin-right: 4px;
  vertical-align: -6px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: #333;
  font-size: 0.92rem;
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -1px;
}

.swatch.gray { background: var(--gray); }
.swatch.yellow { background: var(--yellow); }
.swatch.green { background: var(--green); }
.swatch.blue { background: var(--blue-deep); }

.ribbon {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--blue);
  color: white;
  padding: 6px 8px 8px;
}

.ribbon button {
  background: transparent;
  color: white;
  border: 0;
  min-width: 42px;
  min-height: 42px;
  border-radius: 8px;
}

.ribbon button img {
  width: 28px;
  height: 28px;
  display: block;
  margin: 0 auto;
}

.ribbon button.filter-on {
  background: #2e7d32;
}

.ribbon .spacer {
  flex: 1;
}

.ribbon .identity {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: 4px;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.78rem;
  font-weight: 400;
  white-space: nowrap;
}

.demo-word {
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 0 6px;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(40, 48, 56, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 30;
}

.dialog.lora-dialog {
  width: min(100%, 420px);
}

.lora-note,
.dialog-note {
  margin: 0 0 12px;
  font-style: italic;
  line-height: 1.4;
}

.lora-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  overflow: auto;
  min-height: 0;
}

.lora-steps li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  line-height: 1.35;
}

.lora-ok,
.lora-ready {
  color: #2e7d32;
  font-weight: 700;
}

.lora-ok { flex: none; }

.lora-ready { margin: 12px 0 0; }

.dialog {
  width: min(100%, 340px);
  max-width: 100%;
  min-width: 0;
  max-height: calc(100% - 8px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--dialog);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.2);
}

.dialog h3 {
  margin: 0 0 10px;
  font-size: 1.25rem;
}

.dialog p {
  margin: 0 0 12px;
  line-height: 1.4;
}

.pills {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 8px;
  overflow: auto;
  min-height: 0;
}

.pill {
  min-height: 48px;
  min-width: 0;
  padding: 8px 10px;
  color: white;
  font-weight: 700;
}

.pill.gray { background: var(--gray); }
.pill.yellow { background: var(--yellow); color: #2b2108; }
.pill.green { background: var(--green); }
.pill.blue { background: var(--blue-deep); }
.pill.selected { box-shadow: inset 0 0 0 2px #10283f; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.dialog-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

.dialog-figure {
  width: 132px;
  max-width: 48%;
  height: auto;
  display: block;
}

.dialog.collector-dialog {
  width: min(100%, 420px);
}

.collector-body {
  overflow: auto;
  min-height: 0;
}

.transport-row {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.transport-row button,
.text-button.align-start {
  background: transparent;
  border: 0;
  color: var(--blue-deep);
  font-weight: 700;
  min-height: 36px;
  padding: 4px 8px;
  text-align: left;
}

.filled-button {
  background: var(--blue);
  color: white;
  border: 0;
  border-radius: 16px;
  min-height: 36px;
  padding: 6px 14px;
  font-weight: 700;
}

.text-button:disabled,
.filled-button:disabled {
  opacity: 0.38;
}

.text-button {
  background: transparent;
  border: 0;
  color: var(--blue-deep);
  font-weight: 700;
  min-height: 44px;
  padding: 8px 10px;
}

.tablet.scanning .tablet-body {
  padding: 0;
  overflow: hidden;
  background: #0c0e12;
}

.camera {
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  background: #0c0e12;
  color: white;
}

.viewfinder {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #111;
}

.camera-zoom {
  position: relative;
  height: 100%;
  max-width: 100%;
  aspect-ratio: 379 / 541;
  overflow: hidden;
  transform-origin: 58.84% 56.19%;
  animation: camera-zoom 2s ease-in-out forwards;
}

.camera-zoom img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.qr-lock {
  position: absolute;
  left: 49.08%;
  top: 49.54%;
  width: 19.53%;
  height: 13.31%;
  box-sizing: border-box;
  border: 2px solid #e53935;
  opacity: 0;
  animation: qr-lock 2s linear forwards;
}

.camera-status {
  margin: 4px 18px 0;
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.camera-cancel {
  margin: 8px auto 16px;
  background: transparent;
  border: 0;
  color: white;
  font-weight: 700;
  min-height: 44px;
  padding: 8px 18px;
}

@keyframes camera-zoom {
  from { transform: scale(1); }
  to { transform: scale(2.45); }
}

@keyframes qr-lock {
  0%, 49% { opacity: 0; }
  50%, 100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .camera-zoom,
  .qr-lock { animation: none; }
  .camera-zoom { transform: scale(2.45); }
  .qr-lock { opacity: 1; }
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.tabs button {
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  font-weight: 700;
}

.tabs button.selected {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.field {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  font-weight: 700;
}

.field input {
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid #b7c3cf;
  padding: 8px 10px;
  font-weight: 500;
}

.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid #e4e8ee;
  white-space: nowrap;
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.log-list li {
  background: white;
  border-radius: 10px;
  padding: 8px 10px;
}

.log-list time {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.back-row {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 8px;
}

pre.header {
  white-space: pre-wrap;
  background: white;
  border-radius: 10px;
  padding: 10px;
  font-size: 0.78rem;
  line-height: 1.35;
}

.page-foot {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 70ch;
}

@media (max-width: 860px) {
  .layout,
  .layout.with-progress { grid-template-columns: 1fr; }
  .layout.with-progress .side { display: block; }
  .layout.with-progress .page-intro,
  .layout.with-progress .lesson,
  .layout.with-progress .tablet,
  .layout.with-progress .progress-column,
  .layout.with-progress .progress-note,
  .reset-side {
    grid-column: auto;
    grid-row: auto;
  }
  .layout.with-progress .progress-column { display: flex; flex-direction: column; gap: 16px; }
  .reset-side { width: 100%; }
  .layout.with-progress .page-intro { margin-bottom: 16px; }
  .tablet {
    order: -1;
    height: auto;
    min-height: 760px;
  }
}
