:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --line: #cfd9d6;
  --text: #16211f;
  --muted: #66716e;
  --teal: #006d77;
  --teal-2: #0a8f8c;
  --amber: #c47a00;
  --green: #26734d;
  --red: #b23b35;
  --shadow: 0 12px 30px rgba(24, 40, 37, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 750;
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.workspace {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.tabs {
  display: flex;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  overflow-x: auto;
}

.tab {
  min-width: 144px;
  height: 54px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.tab.is-active {
  background: var(--surface);
  color: var(--teal);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 var(--teal);
}

.panel {
  padding: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 320px) auto;
  gap: 16px;
  align-items: end;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  border-radius: 6px;
}

.field input:focus {
  outline: 2px solid rgba(0, 109, 119, 0.18);
  border-color: var(--teal);
}

.primary-button,
.secondary-button,
.ghost-button {
  height: 44px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.primary-button {
  background: var(--teal);
  color: #fff;
}

.primary-button:hover {
  background: var(--teal-2);
}

.secondary-button,
.ghost-button {
  background: #fff;
  color: var(--teal);
  border-color: var(--line);
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: var(--teal);
}

button[disabled] {
  cursor: not-allowed;
  opacity: 0.62;
}

.status {
  min-height: 42px;
  margin-top: 16px;
  border: 1px solid var(--line);
  background: #fafcfb;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--text);
}

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

.status.error {
  border-color: rgba(178, 59, 53, 0.35);
  color: var(--red);
  background: #fff7f6;
}

.result-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  min-height: 86px;
  background: #fff;
}

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

.metric span {
  display: block;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.link-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 13px;
  color: #fff;
  background: var(--green);
  text-decoration: none;
  border-radius: 6px;
}

.link-button.secondary {
  background: var(--amber);
}

.batch-result {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  color: var(--muted);
}

.archive-tools {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(160px, 240px) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 16px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  background: #fff;
}

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

th {
  color: var(--muted);
  background: var(--surface-2);
  font-weight: 750;
}

td {
  color: var(--text);
}

.empty {
  text-align: center;
  color: var(--muted);
  height: 74px;
}

svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

@media (max-width: 840px) {
  .shell {
    width: min(100vw - 20px, 760px);
    padding-top: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-grid,
  .archive-tools {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

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

@media (min-width: 841px) and (max-width: 1060px) {
  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
