/* Diagnostics & DTCs (dtc) module styles.
   Reuses shell tokens and components from app/shell/tis.css. */

/* ---------- lookup & filter bars ---------- */
.dtc-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.dtc-search-row .inp {
  flex: 1 1 280px;
  max-width: 520px;
}
.dtc-search-row .sel {
  height: 40px;
  max-width: 220px;
}
.dtc-try {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 6px 0 14px;
}
.dtc-try-lbl {
  font-size: 13px;
  color: var(--muted);
}
.dtc-stats {
  font-size: 13px;
  color: var(--muted);
  margin: 4px 0 10px;
}
.dtc-code-cell {
  white-space: nowrap;
}
.dtc-subcode {
  color: var(--muted);
  font-weight: 500;
  margin-left: 4px;
}
.dtc-act-cell {
  white-space: nowrap;
  display: inline-flex;
  gap: 6px;
}
.dtc-grp-lbl {
  margin: 18px 0 6px;
}

/* ---------- procedure tree / accordion ---------- */
.dtc-proc-group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 8px 0;
  overflow: hidden;
}
.dtc-proc-group > summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
  font-weight: 620;
}
.dtc-proc-group > summary::-webkit-details-marker { display: none; }
.dtc-proc-group > summary:hover { background: var(--panel2); }
.dtc-proc-group > summary .dtc-proc-chev {
  color: var(--muted);
  display: inline-flex;
  transition: transform .15s;
}
.dtc-proc-group[open] > summary .dtc-proc-chev { transform: rotate(90deg); }
.dtc-proc-title {
  flex: 1 1 220px;
  min-width: 0;
}
.dtc-proc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.dtc-proc-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.dtc-proc-steps li {
  border-top: 1px solid var(--line);
}
.dtc-proc-steps li:first-child { border-top: 0; }
.dtc-proc-steps a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px 9px 26px;
  color: var(--fg);
  font-size: 14px;
}
.dtc-proc-steps a:hover {
  background: var(--panel2);
  text-decoration: none;
}
.dtc-proc-steps .dtc-step-code {
  min-width: 52px;
  font-weight: 700;
  font-size: 12.5px;
  color: var(--accent);
}
.dtc-proc-leaf {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 8px 0;
}

/* ---------- interactive flowchart step ---------- */
.dtc-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
  align-items: start;
}
.dtc-stepcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.dtc-stepcard.endcard {
  border-left: 5px solid var(--ok);
}
.dtc-step-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.dtc-sn {
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.dtc-stepcard.endcard .dtc-sn { color: var(--ok); }
.dtc-stepcard h2.dtc-stitle {
  font-size: 19px;
  margin: 4px 0 12px;
  line-height: 1.3;
}
.dtc-tester {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--hl);
  color: var(--fg);
  font-size: 13px;
  font-weight: 600;
}
.dtc-variants {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 10px 12px;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
}
.dtc-variants .chip {
  padding: 4px 10px;
  font-size: 12.5px;
}

/* Rich CPR body content */
.dtc-rich {
  overflow-wrap: anywhere;
}
.dtc-rich p { margin: 6px 0 10px; }
.dtc-rich ul, .dtc-rich ol { margin: 6px 0 10px; padding-left: 22px; }
.dtc-rich li { margin: 4px 0; }
.dtc-rich table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 14px;
}
.dtc-rich th, .dtc-rich td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}
.dtc-rich th { background: var(--panel2); font-weight: 700; }
:root[data-theme=dark] .dtc-rich font[color] { color: inherit; }

.dtc-spec {
  margin: 14px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-weak);
  border-radius: 6px;
}
.dtc-spec-lbl {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 750;
  color: var(--muted);
  margin-bottom: 4px;
}
.dtc-spec-val {
  font-weight: 650;
  font-size: 15.5px;
}
.dtc-term {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel2);
  font-size: 13.5px;
}

/* Diagnostic graphics on white paper */
.dtc-fig {
  margin: 12px 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: center;
}
.dtc-fig img {
  max-width: 100%;
  height: auto;
  display: inline-block;
  vertical-align: middle;
}
.dtc-fd-art img {
  max-width: 100%;
  height: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

/* Wiring component inline link */
a.dtc-wd-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 4px;
  background: var(--accent-weak);
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
a.dtc-wd-link:hover {
  text-decoration: underline;
}

/* Yes / No / Continue decision buttons */
.dtc-yn {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.dtc-yn .dtc-dec {
  flex: 1 1 200px;
  min-height: 52px;
  height: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  text-align: left;
  white-space: normal;
}
.dtc-yn .dtc-dec .d-main {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
  font-weight: 700;
}
.dtc-yn .dtc-dec .d-sub {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.3;
}
.btn.dtc-yes {
  border-color: var(--ok);
  color: var(--ok);
}
.btn.dtc-yes:hover {
  background: color-mix(in srgb, var(--ok) 10%, var(--panel));
  border-color: var(--ok);
}
.btn.dtc-no {
  border-color: var(--bad);
  color: var(--bad);
}
.btn.dtc-no:hover {
  background: color-mix(in srgb, var(--bad) 10%, var(--panel));
  border-color: var(--bad);
}
.btn.dtc-ref .d-sub { color: var(--accent-fg); opacity: .9; }

.dtc-step-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* Your path (trail) sidebar */
.dtc-trail {
  position: sticky;
  top: calc(var(--hdr) + 16px);
}
.dtc-trail-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.dtc-trail-head .lbl { flex: 1; }
.dtc-trail ol {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--line);
  margin-left: 5px;
  max-height: 60vh;
  overflow-y: auto;
}
.dtc-trail li {
  padding: 2px 0 10px 14px;
  position: relative;
  font-size: 13.5px;
  line-height: 1.35;
}
.dtc-trail li:last-child { padding-bottom: 2px; }
.dtc-trail li::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line);
}
.dtc-trail li.cur::before { background: var(--accent); }
.dtc-trail li a {
  display: block;
  color: var(--fg);
  padding: 2px 0;
}
.dtc-trail li a:hover { color: var(--accent); text-decoration: none; }
.dtc-ans {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 0 6px;
  border-radius: 4px;
  margin-left: 5px;
  vertical-align: middle;
}
.dtc-ans.y { background: #dcfce7; color: #166534; }
.dtc-ans.n { background: #fee2e2; color: #991b1b; }
.dtc-ans.r, .dtc-ans.l { background: var(--panel2); color: var(--muted); }
:root[data-theme=dark] .dtc-ans.y { background: #143622; color: #6ee799; }
:root[data-theme=dark] .dtc-ans.n { background: #3d181a; color: #fca5a5; }
.dtc-kbd-hint {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- linear printable outline ---------- */
.dtc-outline-step {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 12px 0;
  overflow: hidden;
  break-inside: avoid;
}
.dtc-outline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
}
.dtc-outline-body {
  padding: 14px 16px;
}
.dtc-outline-branches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  background: var(--panel2);
  border-top: 1px solid var(--line);
  font-size: 13px;
}

/* ---------- additional info ---------- */
.dtc-ai-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 10px 0;
  overflow: hidden;
}
.dtc-ai-item > summary {
  padding: 11px 14px;
  font-weight: 700;
  cursor: pointer;
  background: var(--panel2);
}
.dtc-ai-body {
  padding: 14px 16px;
}

/* ---------- data list ---------- */
.dtc-dl-section {
  margin: 16px 0 22px;
}
.dtc-dl-section h2 {
  margin: 18px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .dtc-flow { grid-template-columns: minmax(0, 1fr); }
  .dtc-trail { position: static; }
  .dtc-trail ol { max-height: none; }
}
@media (max-width: 640px) {
  .dtc-stepcard { padding: 15px 14px; }
  .dtc-yn .dtc-dec { flex-basis: 100%; }
  .dtc-proc-steps a { padding-left: 14px; }
  .dtc-search-row .sel { flex: 1 1 140px; max-width: none; }
}

/* ---------- print ---------- */
@media print {
  .dtc-trail, .dtc-yn, .dtc-step-foot, .dtc-kbd-hint, .tabs { display: none !important; }
  .dtc-flow { display: block; }
  .dtc-stepcard, .dtc-outline-step { border: 1px solid #ccc; break-inside: avoid; }
}
