:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-muted: #eef3f6;
  --line: #d9e1e7;
  --line-strong: #b6c5cf;
  --text: #15212b;
  --muted: #667784;
  --teal: #087f73;
  --teal-dark: #05655d;
  --amber: #c47a05;
  --red: #c0392b;
  --green: #1c7c3a;
  --blue: #2d5f9a;
  --shadow: 0 12px 32px rgba(23, 38, 49, 0.08);
  --radius: 8px;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 24px;
  align-items: center;
  padding: 18px 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.top-actions {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px;
  gap: 12px;
  align-items: center;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  background: var(--teal);
  color: #fff;
  font-weight: 800;
  border-radius: 8px;
}

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

h1 {
  font-size: 20px;
  line-height: 1.2;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.search-box {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface-muted);
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.language-box {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

.language-box select {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-weight: 700;
}

.search-box:focus-within {
  border-color: var(--teal);
  background: var(--surface);
}

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

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 360px;
  gap: 16px;
  padding: 16px;
  min-height: 0;
}

.site-footer {
  display: grid;
  gap: 4px;
  padding: 16px 20px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface);
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}

.site-footer a {
  color: var(--teal-dark);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.filters,
.detail,
.results {
  min-width: 0;
}

.filters,
.detail {
  align-self: start;
  position: sticky;
  top: 91px;
  max-height: calc(100vh - 108px);
  overflow-y: auto;
  overflow-x: hidden;
}

.filters section,
.detail-section,
.metrics,
.table-toolbar,
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filters section {
  padding: 14px;
  margin-bottom: 12px;
  overflow: hidden;
}

.filters h2,
.legend h2 {
  font-size: 13px;
  margin-bottom: 12px;
}

.filters label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filters select,
.filters input[type="search"] {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
  background: #fff;
  color: var(--text);
  font-weight: 500;
}

.toggles label {
  grid-template-columns: 16px 1fr;
  align-items: center;
  color: var(--text);
  font-weight: 600;
  gap: 8px;
}

.legend p {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 8px;
  font-size: 12px;
}

.dot {
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.dot.high {
  background: var(--red);
}

.dot.mid {
  background: var(--amber);
}

.dot.low {
  background: var(--green);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 14px;
  background: var(--surface);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric strong {
  font-size: 22px;
  line-height: 1;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.table-toolbar strong {
  font-size: 18px;
}

.toolbar-actions {
  display: flex;
  gap: 8px;
}

.toolbar-actions button,
.more-button {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  border-radius: 6px;
  padding: 7px 11px;
  font-weight: 700;
  font-size: 12px;
}

.toolbar-actions button:last-child,
.more-button {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 250px);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 960px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f9fbfc;
}

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

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

th button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-weight: 800;
}

th:nth-child(1),
td:nth-child(1) {
  width: 92px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 34%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 78px;
}

th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5),
th:nth-child(6),
td:nth-child(6),
th:nth-child(7),
td:nth-child(7) {
  width: 84px;
}

tr {
  background: #fff;
}

tbody tr:hover,
tbody tr.selected {
  background: #eef8f6;
}

.code {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.desc {
  display: grid;
  gap: 3px;
}

.desc strong {
  font-weight: 700;
  line-height: 1.35;
}

.desc strong + span {
  color: #38505f;
}

.desc span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.rate {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.policy-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  border: 1px solid transparent;
}

.badge.high {
  background: #fff1ee;
  color: var(--red);
  border-color: #f2c7bf;
}

.badge.mid {
  background: #fff7e8;
  color: var(--amber);
  border-color: #efd39a;
}

.badge.low {
  background: #edf8f0;
  color: var(--green);
  border-color: #c5e4cd;
}

.badge.info {
  background: #edf4fb;
  color: var(--blue);
  border-color: #c5d8ea;
}

.more-button {
  width: 100%;
  margin-top: 12px;
  background: #f8fffd;
}

.detail-section {
  padding: 16px;
  margin-bottom: 12px;
}

.detail h2 {
  font-size: 18px;
  margin-bottom: 6px;
}

.zh-line {
  margin-bottom: 8px;
  font-weight: 800;
  line-height: 1.4;
}

.detail h3 {
  font-size: 13px;
  margin-bottom: 10px;
}

.detail .subline {
  color: var(--muted);
  line-height: 1.45;
}

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

.tax-box {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.tax-box span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 5px;
}

.tax-box strong {
  font-size: 15px;
}

.policy-list,
.check-list {
  display: grid;
  gap: 8px;
}

.policy-item,
.check-list li {
  line-height: 1.5;
  color: var(--text);
}

.policy-item {
  padding-left: 10px;
  border-left: 3px solid var(--line-strong);
}

.policy-item.high {
  border-left-color: var(--red);
}

.policy-item.mid {
  border-left-color: var(--amber);
}

.policy-item.low {
  border-left-color: var(--green);
}

.raw-policy {
  white-space: pre-wrap;
  color: var(--muted);
  line-height: 1.55;
  font-size: 12px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  padding: 24px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .detail {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .detail-section {
    margin-bottom: 0;
  }
}

@media (max-width: 760px) {
  .topbar,
  .top-actions,
  .workspace,
  .detail,
  .metrics {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 14px;
    padding: 14px;
  }

  .workspace {
    padding: 10px;
  }

  .filters {
    position: static;
    max-height: none;
  }

  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions {
    flex-wrap: wrap;
  }
}
