:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9e0ec;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --green: #15803d;
  --green-bg: #dcfce7;
  --red: #b42318;
  --red-bg: #fee4e2;
  --amber: #a15c07;
  --amber-bg: #fef0c7;
  --shadow: 0 18px 42px rgba(32, 43, 68, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.shell {
  width: min(1420px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 88px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  line-height: 1.3;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button:hover {
  border-color: #b7c4d8;
  background: #f8fafc;
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.button.primary:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}

.button.secondary {
  border-color: #b7c4d8;
}

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

.button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.login-panel {
  display: grid;
  min-height: calc(100vh - 160px);
  place-items: center;
}

.login-box {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-box h2 {
  margin-bottom: 22px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.field input:focus,
.search:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(37, 99, 235, 0.14);
}

.form-error {
  margin: 0 0 14px;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.login-box .button {
  width: 100%;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin: 16px 0 18px;
}

.metric {
  min-height: 88px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 24px;
  line-height: 1.2;
}

.panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-head.split {
  justify-content: space-between;
}

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

.import-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 16px 18px;
}

.import-grid .button {
  min-width: 0;
}

.copy-note {
  margin: 10px 18px 16px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.copy-field {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 0 18px 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.copy-field input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.search {
  width: min(360px, 100%);
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid #edf1f7;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
  line-height: 1.45;
}

th {
  color: var(--muted);
  background: #fbfcfe;
  font-size: 12px;
  font-weight: 800;
}

td {
  overflow-wrap: anywhere;
}

tbody tr:hover {
  background: #f8fbff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.ok {
  background: var(--green-bg);
  color: var(--green);
}

.badge.error {
  background: var(--red-bg);
  color: var(--red);
}

.badge.wait,
.badge.timeout,
.badge.stale,
.badge.partial {
  background: var(--amber-bg);
  color: var(--amber);
}

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

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

@media (max-width: 860px) {
  .shell {
    width: min(100% - 20px, 1420px);
    padding-top: 18px;
  }

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

  .actions {
    justify-content: flex-start;
    width: 100%;
  }

  .button {
    flex: 1 1 150px;
  }

  .import-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  h1 {
    font-size: 24px;
  }

  .panel-head.split {
    align-items: stretch;
    flex-direction: column;
  }

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

  .copy-field {
    grid-template-columns: 1fr;
  }

  th,
  td {
    padding: 11px 12px;
  }
}
