:root {
  --paper: #f3eee4;
  --paper-deep: #ece4d6;
  --sheet: #fffdf8;
  --sheet-2: #faf6ee;
  --ink: #3b3832;
  --ink-soft: #6f6a60;
  --ink-faint: #8f887c;
  --line: #e4d8c6;
  --wood: #cbb79a;
  --sage: #6a7d68;
  --sage-deep: #4f5f4e;
  --sage-mid: #b7c6b4;
  --sage-soft: #e7eee5;
  --sage-glow: rgba(106, 125, 104, 0.14);
  --clay: #a78464;
  --clay-soft: #f4ece2;
  --highlight: #eef3ec;
  --highlight-strong: #e3ece2;
  --shadow: 0 18px 40px rgba(70, 58, 40, 0.07);
  --radius: 22px;
  --radius-sm: 12px;
  --serif: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --sans: "Noto Sans TC", "PingFang TC", "Noto Sans CJK TC", sans-serif;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(183, 198, 180, 0.45), transparent 60%),
    radial-gradient(700px 420px at 100% 8%, rgba(203, 183, 154, 0.28), transparent 58%),
    radial-gradient(800px 500px at 70% 100%, rgba(231, 238, 229, 0.8), transparent 55%),
    var(--paper);
}

.wash {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(180deg, rgba(255, 253, 248, 0.2), transparent 280px);
  z-index: 0;
}

main {
  position: relative;
  z-index: 1;
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.site-header {
  display: grid;
  gap: 18px;
  margin-bottom: 32px;
}

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

.mark {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background:
    linear-gradient(160deg, #8a9b86 0%, var(--sage) 55%, var(--sage-deep) 100%);
  box-shadow: 0 8px 18px rgba(79, 95, 78, 0.18);
  position: relative;
}

.mark::after {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1.5px solid rgba(255, 253, 248, 0.45);
  border-radius: 11px;
}
.mark::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f7f1e7;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 3px rgba(247, 241, 231, 0.18);
}

.eyebrow {
  margin: 0;
  color: var(--sage-deep);
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  font-weight: 500;
}

h1 {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.85rem, 4vw, 2.55rem);
  letter-spacing: 0.04em;
  line-height: 1.25;
  color: #2f322e;
}

.lede,
.dates {
  margin: 0;
  max-width: 74ch;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.dates {
  font-size: 0.9rem;
  color: var(--ink-faint);
}


.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.kpi {
  background: linear-gradient(180deg, var(--sheet) 0%, var(--sheet-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px 16px;
}

.kpi-label, .kpi-note {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.kpi-value {
  margin: 4px 0 2px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-weight: 600;
  font-size: 1.18rem;
  color: var(--ink);
  letter-spacing: 0.01em;
}

.summary {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background: linear-gradient(180deg, var(--sheet) 0%, var(--sheet-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px 20px;
}

.card h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--sage-deep);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px 16px;
}

.stat dt {
  margin: 0;
  color: var(--ink-faint);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.stat dd {
  margin: 2px 0 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-weight: 600;
  font-size: 1.12rem;
  color: var(--ink);
}

.stat dd em {
  font-style: normal;
  font-weight: 500;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.bars {
  display: grid;
  gap: 9px;
}

.bar-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr 2.2rem;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.bar-track {
  height: 10px;
  border-radius: 999px;
  background: #efe7da;
  overflow: hidden;
}

.bar-track > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8a9c86, var(--sage));
}

.bar-row strong {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}

.note-strip {
  margin: 0 0 22px;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--sage-soft);
  color: var(--sage-deep);
  font-size: 0.9rem;
}

.table-card {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 26px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  align-items: center;
  padding: 18px 20px 8px;
}

.search {
  flex: 1 1 240px;
  position: relative;
}

.search input {
  width: 100%;
  appearance: none;
  border: 1px solid var(--line);
  background: #fffaf3;
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px 10px 40px;
  font: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search input:focus {
  border-color: var(--sage);
  box-shadow: 0 0 0 4px var(--sage-glow);
}

.search svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--ink-faint);
}

.result-count {
  margin-left: auto;
  color: var(--ink-faint);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 20px 16px;
}

.chip {
  border: 1px solid var(--line);
  background: #fffaf3;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip:hover {
  border-color: var(--wood);
  color: var(--ink);
}

.chip[aria-pressed="true"] {
  background: var(--sage-soft);
  border-color: #b7c4b4;
  color: var(--sage-deep);
  font-weight: 600;
}

.chip:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 2px;
}

.table-wrap {
  overflow: auto;
  max-height: min(72vh, 920px);
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  min-width: 1080px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f7f1e7;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-align: right;
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  box-shadow: 0 1px 0 var(--line);
}

thead th:first-child,
thead th:nth-child(2) {
  text-align: left;
}

thead th:first-child,
tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f7f1e7;
}

thead th:nth-child(2),
tbody td:nth-child(2) {
  position: sticky;
  left: 72px;
  z-index: 2;
  background: #f7f1e7;
}

thead th:nth-child(2) { z-index: 4; }
thead th:first-child { z-index: 5; }

th button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

th button .arrow {
  font-size: 0.7rem;
  opacity: 0.35;
}

th[aria-sort="ascending"] .arrow,
th[aria-sort="descending"] .arrow {
  opacity: 1;
  color: var(--sage-deep);
}

tbody td {
  padding: 13px 12px;
  border-bottom: 1px solid #efe6d8;
  text-align: right;
  vertical-align: middle;
  background: var(--sheet);
}

tbody td:first-child,
tbody td:nth-child(2) {
  text-align: left;
  background: var(--sheet);
}

tbody tr:hover td {
  background: #f8f4ec;
}

tbody tr:hover td:first-child,
tbody tr:hover td:nth-child(2) {
  background: #f4efe6;
}

.code {
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--sage-deep);
}

.name {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-weight: 500;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--clay-soft);
  color: #7a5c40;
}

.tag.soft {
  background: var(--sage-soft);
  color: var(--sage-deep);
}

.pct {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.mini {
  width: 52px;
  height: 6px;
  border-radius: 999px;
  background: #efe7da;
  overflow: hidden;
}

.mini > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--wood);
}

tr.high .mini > i,
tr.mid .mini.top10 > i {
  background: linear-gradient(90deg, #8a9c86, var(--sage));
}

tr.high td {
  background: var(--highlight);
}

tr.high td:first-child,
tr.high td:nth-child(2) {
  background: var(--highlight-strong);
}

tr.high:hover td,
tr.high:hover td:first-child,
tr.high:hover td:nth-child(2) {
  background: #e4ece2;
}

tr.mid td {
  background: #f6f8f3;
}

tr.mid td:first-child,
tr.mid td:nth-child(2) {
  background: #eef3ec;
}

tr.mid:hover td,
tr.mid:hover td:first-child,
tr.mid:hover td:nth-child(2) {
  background: #e8efe6;
}

.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--ink-faint);
}

.site-footer {
  margin-top: 28px;
  padding: 8px 8px 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.site-footer h2 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--sage-deep);
}

.site-footer ul {
  margin: 0;
  padding-left: 1.1rem;
  max-width: 90ch;
}

.site-footer li + li {
  margin-top: 6px;
}

@media (max-width: 860px) {
  main { padding-top: 28px; width: min(1240px, calc(100% - 20px)); }
  .kpis, .summary { grid-template-columns: 1fr; }
  .result-count { margin-left: 0; }
  thead th:nth-child(2),
  tbody td:nth-child(2) {
    position: static;
    left: auto;
    z-index: auto;
  }
  tbody td:nth-child(2),
  thead th:nth-child(2) { background: inherit; }
  thead th:nth-child(2) { background: #f7f1e7; }
}


@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
