:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #f0f4f8;
  --line: #d9e0e8;
  --text: #18202a;
  --muted: #667485;
  --accent: #2764d8;
  --accent-dark: #1d4fae;
  --success-bg: #eaf7ef;
  --success: #1c6c3d;
  --error-bg: #fff0ed;
  --error: #b23324;
  --shadow: 0 18px 45px rgba(18, 32, 52, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1220px, calc(100% - 32px));
  margin: 24px auto 36px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 2px 20px;
}

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

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
}

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

.service-meta {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel);
  font-size: 13px;
  white-space: nowrap;
}

.account-meta {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
  font-size: 13px;
}

.service-meta.online {
  color: var(--success);
  background: var(--success-bg);
  border-color: #c5e8d1;
}

.service-meta.offline {
  color: var(--error);
  background: var(--error-bg);
  border-color: #f2c5bc;
}

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.query-panel,
.results-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.query-panel {
  padding: 18px;
  position: sticky;
  top: 16px;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--text);
  font-weight: 700;
}

label span {
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
}

input:focus,
select:focus {
  outline: 3px solid rgba(39, 100, 216, 0.14);
  border-color: var(--accent);
}

.button-stack {
  display: grid;
  gap: 10px;
  margin-top: 2px;
}

button {
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

button.secondary {
  color: var(--accent);
  background: #eef4ff;
  border-color: #c9dafb;
}

button.secondary:hover {
  background: #e1ecff;
}

button.ghost {
  min-height: 38px;
}

.cleanup-note {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 13px;
  border: 1px solid #d7e3f2;
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 13px;
  line-height: 1.55;
}

.cleanup-note strong {
  color: var(--text);
}

.results-panel {
  min-width: 0;
  overflow: hidden;
}

.result-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
}

.status {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  word-break: break-word;
}

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

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

.select-all {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

input[type="checkbox"] {
  width: 16px;
  min-height: 16px;
  height: 16px;
  padding: 0;
}

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

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

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f5;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

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

tbody tr:hover {
  background: #f8fbff;
}

.check-col {
  width: 64px;
  text-align: center;
}

.title-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  line-height: 1.45;
}

.title-link:hover {
  color: var(--accent);
}

.mini-download {
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.empty {
  padding: 42px 12px;
  color: var(--muted);
  text-align: center;
}

.single-column {
  grid-template-columns: 1fr;
}

.admin-panel {
  padding-bottom: 10px;
}

.admin-grid {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.admin-form,
.auth-form {
  display: grid;
  gap: 14px;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(39, 100, 216, 0.14), transparent 30%),
    linear-gradient(180deg, #f8fbff 0%, #eef2f7 100%);
}

.auth-shell {
  width: min(100%, 460px);
}

.auth-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-subtitle {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-tip {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #d7e3f2;
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-soft);
  line-height: 1.6;
}

.auth-tabs {
  display: flex;
  gap: 10px;
  margin: 18px 0 14px;
}

.tab-button {
  min-height: 38px;
  color: var(--accent);
  background: #eef4ff;
  border-color: #c9dafb;
}

.tab-button.active {
  color: #fff;
  background: var(--accent);
}

.tab-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

@media (max-width: 860px) {
  .app-shell {
    width: min(100% - 20px, 1220px);
    margin-top: 12px;
  }

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

  .topbar-actions {
    justify-content: flex-start;
  }

  .service-meta {
    white-space: normal;
  }

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

  .query-panel {
    position: static;
  }
}

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

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

  .auth-card {
    padding: 20px;
  }
}
