:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --panel: #ffffff;
  --ink: #17212b;
  --muted: #66717f;
  --line: #d9e1e8;
  --blue: #1d5d89;
  --green: #24664b;
  --navy: #10293d;
  --amber: #a86315;
  --danger: #a43d3d;
  --shadow: 0 18px 45px rgba(23, 33, 43, 0.08);
  --button-shadow: 0 8px 18px rgba(16, 41, 61, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.92), rgba(243,246,248,0.94) 280px),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Hiragino Sans GB", sans-serif;
  font-size: 15px;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(29, 93, 137, 0.14);
  box-shadow: 0 8px 18px rgba(16, 41, 61, 0.1);
  overflow: hidden;
}

.brand-mark img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.brand small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.nav > a,
.language-switch a,
.link-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 12px;
  border: 1px solid rgba(29, 93, 137, 0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f4f7fa);
  color: var(--navy);
  font-weight: 750;
  box-shadow: var(--button-shadow);
}

.nav > a:hover,
.language-switch a:hover,
.link-button:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.language-switch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7fafc;
}

.language-switch a {
  min-height: 30px;
  padding: 5px 9px;
  box-shadow: none;
  color: var(--muted);
}

.language-switch a.active {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.logout-form {
  margin: 0;
}

.link-button {
  min-height: 36px;
  cursor: pointer;
}

.workspace {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.workspace.narrow {
  max-width: 980px;
}

.detail-workspace {
  max-width: 860px;
}

.login-workspace {
  max-width: 620px;
}

.login-panel {
  margin-top: 70px;
  padding: 38px;
  border-color: #d4e0e7;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.98), rgba(247,250,252,0.95)),
    #fff;
  box-shadow: 0 28px 72px rgba(16, 41, 61, 0.14);
}

.login-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 850;
  letter-spacing: 0;
}

.login-brand {
  width: 76px;
  height: 76px;
  display: grid;
  place-items: center;
  margin-bottom: 20px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid rgba(29, 93, 137, 0.14);
  box-shadow: 0 18px 36px rgba(16, 41, 61, 0.12);
}

.login-brand img {
  width: 62px;
  height: 62px;
  object-fit: contain;
}

.lead {
  color: var(--green);
  font-weight: 800;
}

.notice {
  padding: 10px 12px;
  border: 1px solid #dce5ee;
  border-radius: 8px;
  background: #f6f8fb;
  color: var(--muted);
}

.compact-notice {
  margin: 12px 0 0;
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.guide-grid span {
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  color: var(--muted);
  font-size: 13px;
}

.guide-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
}

.guide-state p {
  margin: 0 0 6px;
}

.update-alert {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
  background: #fff7e8;
  color: var(--amber);
}

.status-strip {
  min-height: 72px;
  display: grid;
  grid-template-columns: 180px 1fr 132px;
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, #ffffff, #f6faf7);
  border: 1px solid #d4e0e7;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.status-strip.compact {
  grid-template-columns: 160px 1fr 240px;
}

.label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.freshness-bars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  align-items: end;
  height: 40px;
}

.freshness-bars span {
  display: block;
  background: var(--green);
  border-radius: 4px 4px 0 0;
}

.freshness-bars span:nth-child(1) { height: 28%; background: var(--blue); }
.freshness-bars span:nth-child(2) { height: 60%; }
.freshness-bars span:nth-child(3) { height: 42%; background: var(--amber); }
.freshness-bars span:nth-child(4) { height: 82%; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  align-items: start;
}

.search-panel.full {
  max-width: none;
}

.search-hero {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border-color: #cddce5;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.98), rgba(246,250,252,0.94)),
    #fff;
}

.search-hero::after {
  content: "";
  position: absolute;
  right: 24px;
  top: 18px;
  width: 132px;
  height: 132px;
  background: url("meisyou.png") center / contain no-repeat;
  opacity: 0.045;
  pointer-events: none;
}

.search-hero .panel-head,
.search-hero .search-form,
.search-hero .meta-line,
.search-hero .results {
  position: relative;
  z-index: 1;
}

.search-hero h1 {
  font-size: 28px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
  margin-bottom: 6px;
}

h2 {
  font-size: 20px;
  margin-bottom: 8px;
}

h3 {
  font-size: 17px;
  line-height: 1.3;
  margin-bottom: 6px;
}

.result-card h3 {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.panel-head p,
.result-card p,
.note,
.meta-line {
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 650;
}

input,
select,
button,
.button-link {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

.secondary-button {
  background: #fff;
  color: var(--blue);
}

.small-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 13px;
}

input,
select {
  width: 100%;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 750;
  cursor: pointer;
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.button-link:hover,
button:hover {
  text-decoration: none;
  filter: brightness(0.96);
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 136px;
  gap: 12px;
  padding: 8px;
  border: 1px solid #cddce5;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(16, 41, 61, 0.08);
}

.search-row input {
  min-height: 48px;
  border-color: transparent;
  font-size: 16px;
}

.search-row input:focus {
  outline: none;
  border-color: rgba(29, 93, 137, 0.28);
  box-shadow: inset 0 0 0 1px rgba(29, 93, 137, 0.08);
}

.search-row button {
  min-height: 48px;
  box-shadow: 0 10px 20px rgba(29, 93, 137, 0.2);
}

.meta-line {
  min-height: 24px;
  margin: 12px 0;
}

.results {
  display: grid;
  gap: 12px;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
}

.result-card.selected {
  border-color: var(--green);
  box-shadow: inset 0 0 0 2px rgba(47, 111, 79, 0.14);
}

.result-card.is-top {
  background: #fbfdfb;
}

.result-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 12px;
  align-items: start;
}

.result-head.no-action {
  grid-template-columns: 1fr;
}

.code-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-weight: 900;
  letter-spacing: 0;
}

.code-link span {
  font-size: 26px;
  line-height: 1;
}

.code-link small {
  padding: 2px 7px;
  border-radius: 8px;
  background: #edf5ec;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
}

.code-label {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 8px;
  background: #eef3f8;
  color: var(--blue);
  font-size: 12px;
  font-weight: 750;
}

.hs-code-title {
  font-size: 42px;
  letter-spacing: 0;
  color: var(--navy);
}

.code-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.viewed-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 2px 8px;
  border-radius: 8px;
  background: #f4f0e8;
  color: var(--amber);
  font-size: 12px;
  font-weight: 750;
}

.rate-row {
  color: var(--ink);
  font-weight: 650;
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.section-mini-title {
  margin: 14px 0 8px;
  font-size: 14px;
  color: var(--ink);
}

.tax-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.tax-grid div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.tax-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tax-grid strong {
  color: var(--ink);
  line-height: 1.35;
}

.compact-tax {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.compact-facts span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 8px;
  background: #f6f8fb;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.china-rate-card {
  display: grid;
  gap: 9px;
  margin-top: 11px;
  padding: 11px;
  border: 1px solid #d5e4da;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbf7 0%, #ffffff 100%);
  box-shadow: 0 8px 18px rgba(31, 64, 55, 0.06);
}

.china-rate-heading {
  display: grid;
  gap: 4px;
}

.china-rate-heading span,
.rate-section-title {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}

.china-rate-heading strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
}

.china-rate-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.china-rate-chips span {
  display: inline-grid;
  min-width: 116px;
  gap: 2px;
  padding: 7px 9px;
  border-radius: 8px;
  background: #edf5ec;
  border: 1px solid #d5e4da;
}

.china-rate-chips span.is-missing {
  background: #f6f8fb;
  border-color: var(--line);
}

.china-rate-chips em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.china-rate-chips strong {
  color: var(--ink);
  font-size: 13px;
}

.china-rate-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.detail-china-rate {
  margin-top: 0;
}

.muted-line {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.law-alert {
  display: inline-flex;
  width: fit-content;
  min-height: 28px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  background: #fff7e8;
  color: var(--amber);
  border: 1px solid #dfd2bd;
  font-size: 12px;
  font-weight: 850;
}

.law-alert-full {
  width: 100%;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 8px 10px;
  line-height: 1.45;
}

.law-alert-full strong {
  color: var(--amber);
}

.law-alert-full span {
  color: var(--ink);
  font-weight: 650;
}

.detail-law-alert {
  margin-bottom: 8px;
}

.law-detail-panel {
  border-color: #dfd2bd;
}

.rate-notes {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid #dfd2bd;
  background: #fffaf0;
}

.rate-notes strong {
  color: var(--amber);
  font-size: 12px;
}

.rate-notes p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.summary-line {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.summary-line span {
  color: var(--muted);
}

.rate-groups {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}

.rate-groups article {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.result-rate-groups {
  margin-top: 10px;
}

.rate-section-title {
  margin-top: 12px;
}

.result-rate-groups article {
  grid-template-columns: 92px minmax(0, 1fr);
  padding: 8px;
}

.rate-groups em {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 2px 7px;
  border-radius: 8px;
  background: #f4f0e8;
  color: var(--amber);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.rate-groups article div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rate-groups span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 2px 7px;
  border-radius: 8px;
  background: #eef3f8;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.requirement-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.requirement-list article {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.requirement-list h3,
.requirement-list h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.requirement-list p {
  margin: 6px 0;
  color: var(--ink);
  line-height: 1.45;
}

.small-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.reason-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.reason-row span,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 8px;
  background: #eef3f8;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.translation-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
}

.translation-list div {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
}

.translation-list dt {
  color: var(--muted);
  font-size: 12px;
}

.translation-list dd {
  color: var(--ink);
  line-height: 1.45;
}

.translation-status {
  display: inline-flex;
  width: fit-content;
  margin-top: 10px;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border-radius: 8px;
  background: #edf5ec;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
}

.result-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.miss-feedback {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 4px 0 0;
}

.miss-feedback-button {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13px;
}

.miss-feedback-message {
  color: var(--muted);
  font-size: 13px;
}

td form {
  display: inline-flex;
  margin: 2px 4px 2px 0;
}

.secondary-link {
  text-decoration: none;
  background: #eef3f8;
  color: var(--blue);
}

.danger-button {
  background: var(--danger);
}

.version-ribbon {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #edf5ec;
  color: var(--green);
  font-weight: 800;
}

.stack-form {
  display: grid;
  gap: 14px;
}

.grid-three {
  display: grid;
  grid-template-columns: 1fr 1fr 180px;
  gap: 12px;
  align-items: end;
  margin-bottom: 22px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 24px;
}

.import-box {
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  resize: vertical;
}

.translation-form {
  display: grid;
  gap: 10px;
  min-width: 360px;
}

.translation-table td {
  min-width: 120px;
}

code {
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--muted);
  font-size: 12px;
}

.site-footer {
  display: grid;
  justify-content: center;
  justify-items: center;
  gap: 7px;
  padding: 18px 24px 28px;
  color: var(--muted);
  text-align: center;
}

.site-footer strong {
  color: var(--green);
}

.footer-provider a {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  padding: 4px 10px;
  border-radius: 8px;
  background: #edf5ec;
  color: var(--green);
}

.footer-disclaimer {
  max-width: 980px;
  line-height: 1.55;
}

.note {
  margin: 10px 0 0;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.segmented label {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
  font-weight: 700;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 14px 0;
  color: var(--muted);
  font-weight: 650;
}

.check-line input,
.segmented input {
  width: auto;
  min-height: 0;
}

.wide-button {
  width: 100%;
}

.calc-result {
  margin-top: 16px;
}

.calc-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: #f4f0e8;
  border: 1px solid #dfd2bd;
  border-radius: 8px;
}

.calc-total strong {
  color: var(--amber);
  font-size: 22px;
}

.calc-lines,
.detail-list {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.calc-lines div,
.detail-list div {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
}

.warning-list,
.note-list,
.empty-state {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
}

.warning-list {
  background: #fff1f1;
  border: 1px solid #f0c2c2;
  color: var(--danger);
}

.note-list,
.empty-state {
  background: #f6f8fb;
  border: 1px solid #dce5ee;
  color: var(--muted);
}

.warning-list p,
.note-list p {
  margin: 0 0 6px;
}

.warning-list p:last-child,
.note-list p:last-child {
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
  margin: 12px 0 22px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.badge.success {
  background: #e8f5ee;
  color: var(--green);
}

.badge.error {
  background: #fff1f1;
  color: var(--danger);
}

.badge.running {
  background: #f4f0e8;
  color: var(--amber);
}

@media (max-width: 980px) {
  .layout,
  .status-strip,
  .status-strip.compact {
    grid-template-columns: 1fr;
  }

  .calculator-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .topbar,
  .panel-head,
  .result-head {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    padding: 14px;
  }

  .search-row,
  .grid-two,
  .grid-three,
  .tax-grid,
  .rate-groups article,
  .compact-tax,
  .guide-grid,
  .segmented,
  .calc-lines div,
  .detail-list div {
    grid-template-columns: 1fr;
  }

  .nav {
    width: 100%;
  }
}
