:root {
  color-scheme: light;
  --tac-ink: #14313d;
  --tac-muted: #5c7681;
  --tac-line: #d5e2e7;
  --tac-line-soft: #e6eef1;
  --tac-bg: #eef3f5;
  --tac-card: #ffffff;
  --tac-teal: #0f646b;
  --tac-teal-deep: #0e3a48;
  --tac-teal-soft: #e7f3f4;
  --tac-danger: #a1392c;
  --tac-danger-soft: #fdf1ef;
  --tac-amber: #8a5a10;
  --tac-amber-soft: #fff8e8;
  --tac-ok: #17624b;
  --tac-ok-soft: #e7f5ef;
  --tac-radius: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 0;
  background: linear-gradient(180deg, #e7eff1 0, var(--tac-bg) 220px), var(--tac-bg);
  color: var(--tac-ink);
  font:
    15px/1.65 "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans SC",
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
li {
  overflow-wrap: anywhere;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: var(--tac-teal);
}

:focus-visible {
  outline: 3px solid #1b9aa0;
  outline-offset: 2px;
}

.tac-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 20;
  padding: 10px 16px;
  background: #fff;
  border-radius: 0 0 10px 0;
  font-weight: 700;
}

.tac-skip:focus {
  left: 0;
}

.tac-header {
  background: linear-gradient(135deg, var(--tac-teal-deep), #126169 78%, #177a78);
  color: #eaf6f7;
  padding: clamp(18px, 3.6vw, 34px) clamp(12px, 3.6vw, 38px);
  border-bottom: 4px solid #0b2c37;
}

.tac-header-inner {
  max-width: 1240px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  align-items: flex-end;
  justify-content: space-between;
}

.tac-brand {
  min-width: 0;
  flex: 1 1 420px;
}

.tac-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: #a7d6d9;
}

.tac-header h1 {
  margin: 0;
  font-size: clamp(26px, 3.6vw, 34px);
  line-height: 1.3;
  letter-spacing: 0.02em;
}

.tac-subtitle {
  margin: 8px 0 0;
  font-size: 14px;
  color: #c6e3e5;
  max-width: 64ch;
}

.tac-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tac-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid #4d8e93;
  border-radius: 999px;
  color: #eaf6f7;
  text-decoration: none;
  font-size: 13.5px;
  background: rgba(9, 45, 55, 0.28);
}

.tac-nav a:hover {
  background: rgba(9, 45, 55, 0.55);
  border-color: #86c2c6;
}

.tac-main {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(14px, 2.6vw, 30px) clamp(12px, 3.6vw, 34px) 40px;
}

.tac-notice {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  padding: 13px 16px;
  border: 1px solid #e2c581;
  border-left: 5px solid #b57e17;
  border-radius: 10px;
  background: var(--tac-amber-soft);
  color: #5e4309;
  font-size: 13.5px;
}

.tac-notice strong {
  font-size: 15px;
  color: #6b4a00;
}

.tac-global {
  margin: 0 0 6px;
  padding: 10px 14px;
  border: 1px dashed #b6ccd3;
  border-radius: 10px;
  background: #f7fbfc;
  color: var(--tac-muted);
  font-size: 13.5px;
}

.tac-global[data-tone="warn"] {
  border-color: #e5cb93;
  background: var(--tac-amber-soft);
  color: #6b4a00;
}

.tac-global[data-tone="error"] {
  border-color: #e3b4ae;
  background: var(--tac-danger-soft);
  color: #7d241b;
}

.tac-card {
  margin-block: 18px;
  padding: clamp(14px, 2.3vw, 24px);
  background: var(--tac-card);
  border: 1px solid var(--tac-line);
  border-radius: var(--tac-radius);
  box-shadow: 0 1px 2px rgba(18, 48, 61, 0.05);
  min-width: 0;
}

.tac-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  justify-content: space-between;
}

.tac-card h2 {
  margin: 0;
  font-size: clamp(18px, 2.2vw, 21px);
  line-height: 1.35;
  color: #0d4550;
}

.tac-h3 {
  margin: 18px 0 0;
  font-size: 15.5px;
  color: #0d4550;
}

.tac-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid #c7dde1;
  border-radius: 999px;
  background: var(--tac-teal-soft);
  color: #14565c;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.tac-desc {
  margin: 10px 0 0;
  color: #3f5a64;
  font-size: 14px;
}

.tac-scope-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: end;
  margin-top: 14px;
}

.tac-scope-actions {
  display: flex;
  gap: 10px;
  padding-bottom: 1px;
}

.tac-flow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: 12px 16px;
  margin-top: 14px;
}

.tac-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.tac-field > label {
  font-weight: 600;
  font-size: 14px;
  color: #1d4650;
}

input[type="text"],
input[type="file"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #b6ccd3;
  border-radius: 9px;
  background: #fff;
  color: var(--tac-ink);
}

input[type="file"] {
  padding: 7px 10px;
  font-size: 13px;
}

input[readonly] {
  background: #f1f5f7;
  color: #38525c;
  border-style: dashed;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-width: 18px;
  height: 18px;
  padding: 0;
  margin: 2px 0 0;
  accent-color: var(--tac-teal);
  flex: 0 0 auto;
}

select:disabled,
input:disabled,
textarea:disabled {
  background: #f2f5f6;
  color: #6b818a;
}

.tac-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(225px, 100%), 1fr));
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
}

.tac-fact {
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--tac-line-soft);
  border-radius: 10px;
  background: #f8fbfc;
}

.tac-fact dt {
  font-size: 12px;
  color: var(--tac-muted);
}

.tac-fact dd {
  margin: 4px 0 0;
  font-weight: 600;
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.tac-fact dd.tac-mono {
  font-weight: 500;
}

.tac-status {
  margin: 14px 0 0;
  padding: 11px 14px;
  border: 1px solid #cfe0e6;
  border-radius: 10px;
  background: #f4f9fb;
  color: #2c4d58;
  font-size: 13.5px;
}

.tac-status[data-tone="loading"] {
  border-color: #c6d8de;
  background: #f3f8fa;
  color: #3b5b66;
}

.tac-status[data-tone="ok"] {
  border-color: #b7ddcc;
  background: var(--tac-ok-soft);
  color: #14563f;
}

.tac-status[data-tone="warn"] {
  border-color: #e5cb93;
  background: var(--tac-amber-soft);
  color: #6b4a00;
}

.tac-status[data-tone="error"] {
  border-color: #e3b4ae;
  background: var(--tac-danger-soft);
  color: #7d241b;
}

.tac-status[data-tone="empty"] {
  border-color: #d7e3e7;
  background: #f7fafb;
  color: #4a6570;
}

.tac-summary {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px dashed #cbdde2;
  border-radius: 10px;
  background: #fbfdfd;
  color: #37535e;
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.tac-summary .tac-hint {
  margin-top: 6px;
}

.tac-zone-grid {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.tac-form {
  margin-top: 14px;
}

.tac-fieldset {
  display: grid;
  gap: 12px;
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--tac-line-soft);
  border-radius: 12px;
  background: #fcfeff;
}

.tac-fieldset > legend {
  padding-inline: 8px;
  font-weight: 700;
  font-size: 14px;
  color: #0f4c56;
}

.tac-fields-body {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.tac-fieldset:disabled .tac-fields-body,
.tac-fieldset[disabled] .tac-fields-body {
  opacity: 0.85;
}

.tac-subfield {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 11px 13px;
  border: 1px dashed #c7dbe1;
  border-radius: 10px;
  background: #f9fcfd;
}

.tac-subfield > legend {
  padding-inline: 6px;
  font-weight: 700;
  font-size: 13.5px;
  color: #14565c;
}

.tac-check-inline {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid var(--tac-line-soft);
  border-radius: 8px;
  background: #fff;
  font-size: 13.5px;
  color: #274a55;
}

.tac-check-inline span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tac-confirm {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid #b9d9d5;
  border-radius: 11px;
  background: #f2fbf8;
  font-size: 13.5px;
  font-weight: 600;
  color: #155346;
}

.tac-confirm span {
  min-width: 0;
}

.tac-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.tac-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid #a9c2ca;
  border-radius: 9px;
  background: #fff;
  color: #16434e;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
}

.tac-button:hover:not(:disabled) {
  background: #f1f8f9;
  border-color: #7ba8b2;
}

.tac-button:disabled {
  opacity: 0.55;
}

.tac-button-primary {
  border-color: #0f646b;
  background: var(--tac-teal);
  color: #fff;
}

.tac-button-primary:hover:not(:disabled) {
  background: #0d565c;
  border-color: #0a4a50;
}

.tac-button-small {
  min-height: 34px;
  padding: 5px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.tac-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--tac-muted);
}

.tac-hint:empty {
  display: none;
}

.tac-empty {
  margin: 0;
  padding: 14px;
  border: 1px dashed #cbdde2;
  border-radius: 10px;
  background: #fbfdfd;
  color: var(--tac-muted);
  font-size: 13.5px;
  text-align: center;
}

.tac-mono {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", monospace;
  font-size: 12.3px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.tac-muted {
  color: var(--tac-muted);
  font-size: 12.8px;
}

.tac-result {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.tac-result > .tac-empty {
  margin: 0;
}

.tac-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #cfe0e6;
  border-radius: 11px;
  background: #f5fafb;
}

.tac-result-head strong {
  font-size: 15px;
  color: #0f4550;
  overflow-wrap: anywhere;
}

.tac-lineage-head .tac-badge,
.tac-result-head .tac-badge {
  white-space: normal;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.tac-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}

.tac-badge-ok {
  border-color: #bfe3d6;
  background: var(--tac-ok-soft);
  color: var(--tac-ok);
}

.tac-badge-danger {
  border-color: #efc7c0;
  background: var(--tac-danger-soft);
  color: #8a2c1f;
}

.tac-badge-warn {
  border-color: #e7cf9d;
  background: var(--tac-amber-soft);
  color: #6b4a00;
}

.tac-badge-neutral {
  border-color: #d7e3e7;
  background: #eff4f6;
  color: #3d5a64;
}

.tac-note {
  margin: 0;
  padding: 11px 13px;
  border: 1px dashed #c7dbe1;
  border-radius: 10px;
  background: #f7fbfc;
  color: #3f5a64;
  font-size: 13px;
}

.tac-note[data-tone="warn"] {
  border-color: #e5cb93;
  background: var(--tac-amber-soft);
  color: #5e4309;
}

.tac-note[data-tone="ok"] {
  border-color: #b7ddcc;
  background: var(--tac-ok-soft);
  color: #14563f;
}

.tac-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.tac-lineage-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  min-width: 0;
}

.tac-lineage-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--tac-line);
  border-radius: 12px;
  background: #fdfefe;
}

.tac-lineage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  justify-content: space-between;
}

.tac-lineage-head strong {
  font-size: 14px;
  color: #0f4550;
}

.tac-lineage-sub {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #dbe7eb;
  min-width: 0;
}

.tac-lineage-sub > h4 {
  margin: 0 0 6px;
  font-size: 13.5px;
  color: #16505b;
}

.tac-lineage-sub .tac-facts {
  margin-top: 6px;
}

.tac-downstream {
  list-style: none;
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.tac-downstream-item {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--tac-line-soft);
  border-radius: 10px;
  background: #f8fbfc;
}

.tac-downstream-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  justify-content: space-between;
}

.tac-instruction-list {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0 0 0 10px;
  border-left: 3px solid #cfe0e6;
}

.tac-instruction-item {
  min-width: 0;
}

.tac-workorder-list {
  list-style: none;
  display: grid;
  gap: 4px;
  margin: 8px 0 0;
  padding: 0;
}

.tac-workorder-list li {
  padding: 6px 9px;
  border: 1px dashed #d7e3e7;
  border-radius: 8px;
  background: #fff;
  font-size: 12.8px;
  color: #37535e;
}

.tac-followup {
  display: grid;
  gap: 6px;
}

.tac-followup p {
  margin: 0;
  padding: 8px 11px;
  border-left: 4px solid #9fc4cc;
  border-radius: 0 8px 8px 0;
  background: #f5fafb;
  font-size: 13px;
  color: #2c4d58;
}

.tac-followup p[data-tone="warn"] {
  border-left-color: #c9912f;
  background: var(--tac-amber-soft);
  color: #5e4309;
}

.tac-coverage-note {
  margin: 14px 0 0;
  padding: 11px 13px;
  border: 1px dashed #cbdde2;
  border-radius: 10px;
  background: #fbfdfd;
  color: #4a6570;
  font-size: 12.8px;
}

.tac-footer {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 1px solid #d7e3e7;
  color: var(--tac-muted);
  font-size: 12.5px;
}

.tac-footer p {
  margin: 4px 0;
}

.tac-noscript {
  max-width: 900px;
  margin: 20px auto;
  padding: 12px 16px;
  border: 1px solid #e3b4ae;
  border-radius: 10px;
  background: var(--tac-danger-soft);
  color: #7d241b;
}

.authorized-document-picker {
  max-width: 100%;
}

@media (max-width: 860px) {
  .tac-scope-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .tac-scope-actions .tac-button {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .tac-header-inner {
    align-items: flex-start;
  }

  .tac-nav {
    width: 100%;
  }

  .tac-nav a {
    flex: 1 1 150px;
  }

  .tac-actions {
    flex-direction: column;
  }

  .tac-actions .tac-button {
    width: 100%;
  }
}

@media (max-width: 420px) {
  body {
    font-size: 14.5px;
  }

  .tac-header {
    padding: 16px 12px 18px;
  }

  .tac-main {
    padding: 12px 9px 30px;
  }

  .tac-card {
    padding: 12px;
    border-radius: 12px;
  }

  .tac-fieldset {
    padding: 11px;
  }

  .tac-nav a {
    flex: 1 1 100%;
  }

  .tac-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .tac-result-head {
    padding: 10px 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
