/* Detallar (06) va Joy-kommunikatsiya (05) ekranlari — faqat style.css tokenlari */

.dt-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.dt-back {
  background: none;
  border: 0;
  padding: 0;
  min-height: 48px;
  text-align: left;
}
.top .dt-back:focus-visible,
.top .top-link:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.top h1:focus {
  outline: none; /* dasturiy fokus (ekran almashganda) — ko'rinadigan ramka kerak emas, tab bilan kelinmaydi */
}

/* «hozir nima qilish kerak» */
.dt-now {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--navy-soft);
  color: var(--ink);
  font-weight: 600;
  border-left: 4px solid var(--navy);
}
.dt-now.is-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-left-color: var(--warn);
}
.dt-help {
  color: var(--ink-2);
  font-size: 13px;
}
.dt-sub {
  display: block;
  color: var(--ink-2);
  font-size: 14px;
  overflow-wrap: anywhere;
}

/* Android Chrome'ning ko'k «tap highlight» i o'rniga — token rangidagi bosilish holati */
.dt button {
  -webkit-tap-highlight-color: transparent;
}
.dt button:active {
  background-color: var(--navy-soft);
}
.dt button[aria-pressed="true"]:active {
  background-color: var(--navy);
}
.km-types button[aria-pressed="true"]:active {
  background-color: var(--navy-soft);
}

/* katta tugma o'lchami ≥ 48 px */
.dt .chips button,
.dt .seg button,
.dt .btn-line {
  min-height: 48px;
}
.dt .chips {
  margin: 0 0 10px;
}
.dt .btn-line + .btn-line,
.dt .btn-big + .btn-line {
  margin-top: 8px;
}

/* bosqichlar: shakl ichida faol qadam ko'k chiziq bilan */
.dt fieldset {
  border: 0;
  margin: 0 0 6px;
  padding: 6px 0 2px;
  min-width: 0;
}
.dt legend {
  font-size: 15px;
  font-weight: 700;
  padding: 0;
  margin-bottom: 6px;
}
.dt-step,
.km-step {
  border-left: 4px solid transparent;
  padding-left: 8px;
  margin-left: -12px;
  border-radius: 2px;
}
.dt-step.act,
.km-step.act {
  border-left-color: var(--navy);
}
.dt-step.act > span,
.dt-step.act > legend,
.km-step.act > span,
.km-step.act > legend {
  color: var(--navy);
}
.dt .grid2 > .dt-step:last-child,
.km .grid2 > .km-step:last-child {
  margin-left: 0;
  padding-left: 4px;
}

/* ro'yxat */
.dt-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.dt-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.dt-card.todo {
  border-color: var(--warn);
}
.dt-card-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  border: 0;
  background: none;
  color: var(--ink);
  text-align: left;
}
.dt-id {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 4px;
  border-radius: 18px;
  background: var(--navy);
  color: var(--on-navy);
  font-weight: 700;
  font-size: 14px;
}
.dt-card-body {
  min-width: 0;
}
.dt-card-body b {
  display: block;
  overflow-wrap: anywhere;
}
.dt-card-side {
  display: grid;
  justify-items: end;
  gap: 2px;
}
.dt-mini {
  width: 64px;
  height: 40px;
}
.dt-area {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.dt-card.todo .dt-area {
  color: var(--warn);
}
.dt-card-act {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--line);
}
.dt-card-act button {
  min-height: 48px;
  border: 0;
  background: none;
  color: var(--navy);
  font-weight: 600;
  font-size: 15px;
}
.dt-card-act button + button {
  border-left: 1px solid var(--line);
  color: var(--danger);
}

.dt-total {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 2px solid var(--navy);
}
.dt-total div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.dt-total dt {
  color: var(--ink-2);
}
.dt-total dd {
  margin: 0;
  font-weight: 700;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.dt-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.dt-two .btn-line {
  border-style: solid;
  padding: 10px 8px;
}

/* kesish ro'yxati */
.dt-cut {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 6px;
}
.dt-cut li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.dt-qty {
  min-width: 52px;
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.dt-cut-dim {
  display: block;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

/* detal shakli */
.dt-stepper {
  margin-bottom: 10px;
}
.dt-stepper button {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
}
.dt-stepper input {
  width: 88px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  min-height: 56px;
}
.dt-grain-seg button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 60px;
  font-size: 14px;
}
.dt-gico {
  width: 28px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.dt-gico circle {
  fill: currentColor;
  stroke: none;
}

.dt-edge {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  grid-template-areas: ". l1 ." "w1 fig w2" ". l2 .";
  gap: 4px;
  align-items: center;
  margin-bottom: 8px;
}
.dt-edge > button {
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 700;
}
.dt-edge > button[aria-pressed="true"] {
  background: var(--navy);
  border-color: var(--navy);
  color: var(--on-navy);
}
.dt-edge > button[aria-pressed="true"]::after {
  content: " ✓";
}
.dt-e-L1 {
  grid-area: l1;
}
.dt-e-L2 {
  grid-area: l2;
}
.dt-e-W1 {
  grid-area: w1;
  height: 100%;
}
.dt-e-W2 {
  grid-area: w2;
  height: 100%;
}
.dt-edge-fig {
  grid-area: fig;
  min-width: 0;
}
.dt-shape {
  display: block;
  width: 100%;
  height: auto;
}
.dt-body {
  fill: var(--navy-soft);
}
.dt-grain {
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1;
  opacity: 0.6;
}
.dt-side {
  stroke: var(--ink-2);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.dt-mini .dt-side {
  stroke-width: 1;
}
.dt-side.on {
  stroke: var(--navy);
  stroke-width: 6;
}
.dt-mini .dt-side.on {
  stroke-width: 3;
}
.dt-side-hit {
  stroke: transparent;
  stroke-width: 22;
  cursor: pointer;
}
.dt-svg-t {
  fill: var(--ink);
  font: 600 12px var(--sans);
  text-anchor: middle;
}
/* CSS dagi text-anchor SVG atributidan kuchli — atribut bilan berilgani saqlansin */
.dt-svg-t[text-anchor="start"],
.km-t[text-anchor="start"] {
  text-anchor: start;
}
.dt-svg-t[text-anchor="end"],
.km-t[text-anchor="end"] {
  text-anchor: end;
}
.dt-svg-ang {
  fill: var(--navy);
  font-weight: 700;
}
.dt-edge-quick button {
  font-size: 14px;
}

.dt-miter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  align-items: center;
  margin-bottom: 6px;
}
.dt-miter-l {
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.dt-miter .chips {
  margin: 0;
}
.dt-angle {
  display: flex;
  align-items: center;
  gap: 2px;
}
.dt-angle input {
  width: 72px;
  text-align: center;
  font-weight: 700;
  min-height: 48px;
}
.dt-miter .tape-err {
  grid-column: 1 / -1;
}
.dt-calc {
  margin: 8px 0 0;
  font-size: 17px;
}
.dt-calc .warn {
  display: block;
}

/* ───────── 05 Joy-kommunikatsiya ───────── */

.km-o {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 4px 12px 12px;
}
.km-o summary {
  cursor: pointer;
  min-height: 48px;
  display: flex;
  align-items: center;
  font-weight: 700;
}
.km-o .step-h > i,
.km .step-h > i {
  flex: 0 0 auto;
}
.km-o-svg,
.km-plan,
.km-top {
  display: block;
  width: 100%;
  height: auto;
}
.km-rules {
  padding-left: 18px;
  margin: 8px 0;
  font-size: 15px;
}
.km-rules li {
  margin-bottom: 4px;
}
.km-wall-solid {
  fill: var(--ink-2);
  opacity: 0.55;
}
.km-wall {
  fill: var(--navy-soft);
}
.km-floor {
  stroke: var(--ink);
  stroke-width: 2.5;
}
.km-tick {
  stroke: var(--ink-2);
  stroke-width: 1;
}
.km-end {
  stroke: var(--warn);
  stroke-width: 2;
  stroke-dasharray: 5 3;
}
.km-arrow {
  stroke: var(--navy);
  stroke-width: 2.5;
}
.km-arr-h {
  fill: var(--navy);
}
.km-o-dot {
  fill: var(--danger);
}
.km-o-pt {
  fill: var(--warn);
}
.km-t {
  fill: var(--ink);
  font: 600 12px var(--sans);
  text-anchor: middle;
}
.km-t-b {
  font-size: 13px;
  font-weight: 700;
}
.km-t-o {
  fill: var(--danger);
  font-size: 15px;
  font-weight: 800;
}
.km-t-s {
  fill: var(--ink-2);
  font-size: 10px;
  font-weight: 400;
}
.km-t-warn {
  fill: var(--warn);
  font-size: 10px;
}
.km-figs {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 6px 4px 2px;
  margin-bottom: 10px;
}
.km-empty {
  margin: 10px 8px;
  color: var(--ink-2);
}
.km-cap {
  margin: 0 6px 8px;
  font-size: 13px;
  color: var(--ink-2);
}

/* nuqta turlari ranglari */
.tone-el {
  color: var(--warn);
}
.tone-water {
  color: var(--navy);
}
.tone-drain {
  color: var(--ink-2);
}
.tone-gas {
  color: var(--danger);
}
.tone-vent {
  color: var(--ok);
}
.tone-other {
  color: var(--ink);
}
.km-pt {
  cursor: pointer;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.km-pt .f,
.km-ico .f {
  fill: currentColor;
  stroke: none;
}
.km-hit {
  fill: transparent;
  stroke: none;
}
.km-pt-bg {
  fill: var(--surface);
  stroke: currentColor;
  stroke-width: 1.5;
}
.km-pt.act .km-pt-bg {
  stroke-width: 3.5;
}
.km-pt.out .km-pt-bg {
  stroke: var(--warn);
  stroke-dasharray: 3 2;
}
.km-size {
  fill: currentColor;
  fill-opacity: 0.12;
  stroke: currentColor;
  stroke-width: 1;
  stroke-dasharray: 3 2;
}
.km-pt-id {
  fill: var(--ink);
  stroke: var(--surface);
  stroke-width: 3;
  paint-order: stroke;
  font-size: 11px;
  font-weight: 700;
}
.km-wl {
  stroke: var(--ink);
  stroke-width: 5;
  stroke-linecap: square;
}
.km-wl.unk {
  stroke: var(--ink-2);
  stroke-width: 2;
  stroke-dasharray: 6 4;
}
.km-dot {
  fill: currentColor;
}
.km-dot.out {
  stroke: var(--warn);
  stroke-width: 2;
}

.km-list {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  display: grid;
  gap: 8px;
}
.km-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 60px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}
.km-item.todo,
.km-item.out {
  border-color: var(--warn);
}
.km-item-ico {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg);
}
.km-item-body {
  min-width: 0;
}
.km-out {
  display: block;
  color: var(--warn);
  font-size: 14px;
  font-weight: 700;
}
.km-ico {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.km-types {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.km-types button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 72px;
  padding: 6px 2px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.km-types button span {
  color: var(--ink);
}
.km-types button[aria-pressed="true"] {
  border: 3px solid currentColor;
  background: var(--navy-soft);
  font-weight: 700;
}
.km-size-f .seg {
  margin-bottom: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .dt .tape.tape-ok {
    animation: none;
  }
}
