:root {
  --blue: #1677ff;
  --green: #16a35f;
  --ink: #102033;
  --muted: #64748b;
  --line: #dde5ef;
  --bg: #f5f7fb;
  --panel: #ffffff;
}

* { box-sizing: border-box; }

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

button, input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  font: inherit;
}

button {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
  cursor: pointer;
}

button.secondary {
  border-color: #b9d5ff;
  background: #f7fbff;
  color: var(--blue);
}

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

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.admin-link, a {
  color: var(--blue);
  text-decoration: none;
}

.center-page {
  display: grid;
  place-items: center;
  padding: 18px;
}

.login-card, .query-card {
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}

.query-page {
  min-height: 100vh;
  padding: 56px 18px 24px;
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 18px;
}

.public-title {
  width: min(760px, calc(100vw - 32px));
  text-align: center;
}

.login-card h1, .public-title h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.25;
  letter-spacing: 0;
}

.login-card p, .login-card small, .muted, .sync-status {
  margin: 0;
  color: var(--muted);
}

.sync-status {
  margin-top: 4px;
  font-size: 13px;
}

.public-meta {
  margin-top: 8px;
  display: flex;
  justify-content: center;
  gap: 8px 18px;
  flex-wrap: wrap;
}

.public-meta .sync-status {
  margin-top: 0;
}

.query-card {
  margin: 0;
}

.query-actions {
  display: grid;
  gap: 10px;
}

.upload-status {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.upload-status:empty {
  display: none;
}

.upload-status.ok {
  color: var(--green);
}

.upload-status.err {
  color: #dc2626;
}

.result-box {
  display: grid;
  gap: 12px;
}

.result-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.result-row span {
  color: var(--muted);
  font-size: 13px;
}

.result-row strong {
  font-size: 22px;
}

.result-note {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top: 1px solid #edf1f6;
  line-height: 1.6;
}

.result-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #edf1f6;
}

.status-badge {
  min-width: 72px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 18px;
  text-align: center;
}

.status-badge.ok {
  color: var(--green);
  background: #eaf8f0;
}

.status-badge.warn {
  color: #b45309;
  background: #fff7e8;
}

.status-badge.err {
  color: #ef4444;
  background: #fff0f0;
}

@media (min-width: 720px) {
  .query-card {
    width: min(720px, calc(100vw - 40px));
  }

  .result-row {
    grid-template-columns: 1fr 1fr 1fr;
    align-items: end;
  }

  .result-status { grid-column: 1 / -1; grid-row: 1; }
  .result-row span:nth-of-type(1) { grid-column: 1; grid-row: 2; }
  .result-row strong:nth-of-type(1) { grid-column: 1; grid-row: 3; }
  .result-row span:nth-of-type(2) { grid-column: 2; grid-row: 2; }
  .result-row strong:nth-of-type(2) { grid-column: 2; grid-row: 3; }
  .result-row span:nth-of-type(3) { grid-column: 3; grid-row: 2; }
  .result-row strong:nth-of-type(3) { grid-column: 3; grid-row: 3; }
}

@media (min-width: 521px) {
  .query-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .query-page {
    padding-top: 34px;
  }

  .login-card h1, .public-title h1 {
    font-size: 26px;
  }
}
