.trace {
  --tr-ink: #11291d;
  --tr-muted: #465e4c;
  --tr-edge: #d8e4d6;
  --tr-paper: #fafbf5;
  --tr-accent: #c1ff72;
  color: var(--tr-ink);
  display: grid;
  gap: 19px;
}
.tr-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}
.tr-heading h2 {
  color: var(--tr-ink);
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 780;
  line-height: 1.08;
  letter-spacing: -.06em;
}
.tr-heading p:not(.tr-kicker),
.tr-panel p {
  margin: 8px 0 0;
  color: var(--tr-muted);
  font-size: .88rem;
  line-height: 1.56;
}
.tr-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 5px;
  color: #37613f;
  font-size: .75rem;
  font-weight: 760;
}
.tr-status-note, .tr-pill {
  flex: none;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  color: #265335;
  background: #e8f1e2;
  font-size: .68rem;
  font-weight: 740;
  line-height: 1.45;
}
.tr-pill.is-warning { color: #7a351f; background: #ffeddb; }
.tr-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr));
  gap: 9px;
}
.tr-summary article {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 9px;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--tr-edge);
  border-radius: 13px;
  background: #eef4e9;
}
.tr-summary svg { grid-row: span 2; color: #397447; }
.tr-summary strong { font-size: 1.26rem; letter-spacing: -.045em; line-height: 1.1; }
.tr-summary article span { color: #395745; font-size: .7rem; }
.tr-stations { display: flex; flex-wrap: wrap; gap: 7px; }
.tr-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 37px;
  padding: 7px 11px;
  border: 1px solid #c6d8c6;
  border-radius: 8px;
  background: #fff;
  color: #1a4329;
  font-size: .76rem;
  font-weight: 750;
  cursor: pointer;
}
.tr-button:hover { border-color: #7ea583; background: #edf6e9; }
.tr-primary, .tr-button.is-active { border-color: #123321; background: #123321; color: #fff; }
.tr-primary:hover, .tr-button.is-active:hover { border-color: #245b35; background: #245b35; color: #fff; }
.tr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.tr-panel {
  padding: clamp(14px, 2.4vw, 22px);
  min-width: 0;
  border: 1px solid var(--tr-edge);
  border-radius: 13px;
  background: var(--tr-paper);
}
.tr-panel h2 { font-size: 1.24rem; letter-spacing: -.045em; line-height: 1.2; }
.tr-panel h3 { font-size: .92rem; letter-spacing: -.025em; margin: 18px 0 0; }
.tr-audit { grid-column: 1 / -1; }
.tr-form { display: grid; gap: 10px; margin-top: 14px; }
.tr-form label { display: grid; gap: 4px; font-size: .74rem; font-weight: 730; }
.tr-form input:not([type="checkbox"]), .tr-form select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid #bfcebd;
  border-radius: 7px;
  padding: 6px 8px;
  color: var(--tr-ink);
  background: #fff;
  font-size: .8rem;
}
.tr-form input[type="checkbox"] { accent-color: #34643d; }
.tr-form fieldset { min-inline-size: 0; border: 1px solid var(--tr-edge); border-radius: 8px; padding: 6px; }
.tr-form legend { color: var(--tr-muted); font-size: .71rem; font-weight: 760; }
.tr-lookup { grid-template-columns: 1fr auto; align-items: end; }
.tr-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.tr-option, .tr-check { display: flex !important; gap: 6px; align-items: center; padding: 5px 6px; }
.tr-option + .tr-option, .tr-check + .tr-check { border-top: 1px solid var(--tr-edge); }
.tr-option label { display: flex; align-items: center; flex: 1; }
.tr-option input[type="number"] { width: 70px; }
.tr-option small, .tr-check small { display: block; color: var(--tr-muted); font-size: .65rem; font-weight: 550; }
.tr-options { max-height: 225px; overflow: auto; }
.tr-subform { border-top: 1px solid var(--tr-edge); padding-top: 12px; }
.tr-form.tr-remeasure { grid-column: 1 / -1; margin: 4px 0; padding: 9px; background: #edf3e9; border-radius: 8px; }
.tr-remeasure .tr-button { justify-self: start; }
.tr-list { margin: 12px 0 0; padding: 0; list-style: none; }
.tr-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 10px;
  row-gap: 6px;
  min-height: 53px;
  border-bottom: 1px solid var(--tr-edge);
  padding: 8px 0;
  font-size: .78rem;
}
.tr-list li:last-child { border-bottom: 0; }
.tr-list li strong, .tr-list small { display: block; overflow-wrap: anywhere; }
.tr-list small, .tr-list time { color: var(--tr-muted); font-size: .69rem; }
.tr-list li.tr-lot-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.tr-row-actions { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.tr-note { font-size: .73rem !important; }
.tr-callout { border-radius: 7px; background: #eaf4e5; padding: 8px; margin-bottom: 7px !important; }
.tr-feedback {
  margin: 0;
  background: #e4f2db;
  color: #284d2e;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: .83rem;
  font-weight: 650;
}
.tr-feedback.is-error { background: #ffe2d8; color: #792d1f; }
.tr-empty {
  margin-top: 13px;
  min-height: 113px;
  display: grid;
  gap: 5px;
  justify-items: center;
  align-content: center;
  text-align: center;
  background: #edf4eb;
  border-radius: 9px;
  padding: 12px;
  font-size: .8rem;
}
.tr-empty svg { color: #46804d; }
.tr-empty span { color: var(--tr-muted); font-size: .72rem; }
.tr-empty + .tr-button { margin-top: 10px; }
[data-tr-camera] { margin-top: 9px; }
[data-tr-camera] video { display: block; width: 100%; max-height: 260px; background: #081c17; border-radius: 9px; }
[data-tr-camera] .tr-button { margin-top: 6px; }
.tr-dialog {
  width: min(96vw, 720px);
  max-height: 86vh;
  border: 1px solid #b2c5af;
  border-radius: 14px;
  padding: 14px;
  color: var(--tr-ink);
  background: var(--tr-paper);
  overflow: auto;
}
.tr-dialog::backdrop { background: #051b14a8; }
.tr-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; margin-bottom: 10px; }
.tr-dialog-actions a { text-decoration: none; }
.tr-dialog-actions a.tr-primary { color: #fff; }
.tr-doc { color: #152419; background: white; font: 400 .88rem/1.5 system-ui, sans-serif; border: 1px solid #cad8c6; padding: 16px; border-radius: 9px; }
.tr-doc h2 { font-size: 1.5rem; letter-spacing: -.035em; }
.tr-doc p { margin: 6px 0; overflow-wrap: anywhere; }
.tr-doc header { display: flex; justify-content: space-between; align-items: center; gap: 8px; border-bottom: 1px solid #cad8c6; margin-bottom: 12px; padding-bottom: 7px; font-size: .72rem; }
.tr-doc-heading { color: #234f2f; font-size: 1.16rem; font-weight: 800; letter-spacing: -.06em; }
.tr-doc-code { color: #184d2a; font-weight: 760; }
.tr-doc footer { padding-top: 10px; border-top: 1px solid #cad8c6; margin-top: 13px; color: #49614a; font-size: .72rem; }
.tr-qr { display: flex; gap: 10px; align-items: center; }
.tr-qr svg { display: block; width: 110px; height: 110px; }
.tr-table { max-width: 100%; overflow-x: auto; margin: 10px 0; }
.tr-doc table { border-collapse: collapse; width: 100%; }
.tr-doc td, .tr-doc th { border-top: 1px solid #cad8c6; padding: 5px; text-align: left; }
.tr-inline-link { background: transparent; border: 0; color: #1c5832; padding: 0; text-decoration: underline; font-weight: 700; font-size: inherit; }
.trace-print { display: none; }

@media (max-width: 950px) {
  .tr-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .tr-heading { flex-direction: column; gap: 7px; }
  .tr-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tr-summary article { padding: 10px 8px; column-gap: 5px; }
  .tr-summary strong { font-size: 1rem; }
  .tr-summary article span { font-size: .66rem; }
  .tr-lookup, .tr-list li.tr-lot-row { grid-template-columns: 1fr; }
  .tr-button { min-height: 40px; }
}
@media print {
  body:has(.trace-print) > :not(.trace-print) { display: none !important; }
  .trace-print { display: block; }
  .trace-print .tr-doc { border: 0; border-radius: 0; padding: 0; }
  .trace-print .tr-doc tr { break-inside: avoid; }
  .trace-print .tr-inline-link { color: inherit; text-decoration: none; }
}
