:root {
  --bg: #eceae4;
  --bg-grid: rgba(44, 51, 56, 0.04);
  --surface: #faf9f6;
  --surface-2: #fff;
  --ink: #2c3338;
  --ink-muted: #6b7280;
  --line: #d8d3c8;
  --brand: #1a5f4a;
  --brand-dark: #134636;
  --accent: #c45c26;
  --accent-hover: #a84d1f;
  --warn-bg: #fff4e6;
  --warn-border: #f0c987;
  --ok-bg: #e8f5ef;
  --ok-border: #9fd4b8;
  --err-bg: #fdeeee;
  --err-border: #f0a8a8;
  --site-a: #2563eb;
  --site-b: #059669;
  --site-c: #b45309;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(44, 51, 56, 0.06), 0 8px 24px rgba(44, 51, 56, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 24px 24px;
}

/* ===== 顶栏 ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 56px;
  background: var(--brand);
  color: #fff;
  border-bottom: 3px solid var(--accent);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: #fff;
}

.topbar-brand:hover { color: #fff; opacity: 0.92; }

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-user {
  font-size: 13px;
  opacity: 0.85;
  padding-right: 8px;
  border-right: 1px solid rgba(255,255,255,0.25);
}

.btn-top {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  background: transparent;
  transition: background 0.15s, border-color 0.15s;
}

.btn-top:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
  border-color: rgba(255,255,255,0.5);
}

.btn-top-solid {
  background: var(--accent);
  border-color: var(--accent);
}

.btn-top-solid:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* ===== 布局 ===== */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}

.panel {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}

.panel-body { padding: 18px; }

.panel-foot {
  padding: 10px 18px 14px;
  font-size: 12px;
  color: var(--ink-muted);
  border-top: 1px dashed var(--line);
}

/* ===== 表单 ===== */
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 6px;
  text-transform: none;
  letter-spacing: 0.04em;
}

.field-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 95, 74, 0.12);
}

.field-input::placeholder { color: #aaa; }

.btn-main {
  width: 100%;
  padding: 11px 16px;
  border: none;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-main:hover { background: var(--accent-hover); }
.btn-main:active { transform: scale(0.98); }

.btn-secondary {
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn-secondary:hover {
  border-color: var(--brand);
  background: var(--surface);
}

.query-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  align-items: end;
}

@media (max-width: 768px) {
  .query-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  .page { padding: 16px 12px 32px; }
}

/* ===== 登录页 ===== */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}

.auth-side {
  background: var(--brand);
  color: #fff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.auth-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(196, 92, 38, 0.35) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08) 0%, transparent 40%);
  pointer-events: none;
}

.auth-side-inner { position: relative; z-index: 1; }

.auth-side h1 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 12px;
  line-height: 1.3;
}

.auth-side p {
  margin: 0;
  opacity: 0.88;
  font-size: 15px;
  max-width: 320px;
  line-height: 1.7;
}

.auth-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.auth-tag {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
}

.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 24px;
}

.auth-box {
  width: 100%;
  max-width: 380px;
}

.auth-box h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink);
}

.auth-box .sub {
  color: var(--ink-muted);
  font-size: 13px;
  margin-bottom: 24px;
}

.auth-box .field { margin-bottom: 16px; }

/* ===== 提示 ===== */
.alert-box {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid;
}

.alert-ok { background: var(--ok-bg); border-color: var(--ok-border); color: #1e5631; }
.alert-err { background: var(--err-bg); border-color: var(--err-border); color: #9b2c2c; }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); color: #8a5a12; font-size: 13px; margin: 12px 18px 0; }

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line);
}

.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}

a.pager-btn:hover {
  border-color: var(--brand);
  background: var(--surface);
  color: var(--brand);
}

.pager-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

.pager-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pager-ellipsis {
  padding: 0 4px;
  color: var(--ink-muted);
  font-size: 13px;
}

/* ===== 表格 ===== */
.result-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-count {
  font-size: 13px;
  color: var(--ink-muted);
}

.result-count strong {
  color: var(--brand);
  font-size: 18px;
  margin-right: 4px;
}

.table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 11px 14px;
  background: var(--surface);
  border-bottom: 2px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #ece8e0;
  vertical-align: middle;
}

.data-table tbody tr:hover td {
  background: #f7f5f0;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.empty-row td {
  text-align: center;
  color: var(--ink-muted);
  padding: 36px 14px !important;
  font-size: 14px;
}

.site-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.site-tag-a { background: #dbeafe; color: var(--site-a); }
.site-tag-b { background: #d1fae5; color: var(--site-b); }
.site-tag-c { background: #ffedd5; color: var(--site-c); }
.site-tag-default { background: #f3f4f6; color: #6b7280; }

.d-none { display: none; }
@media (min-width: 768px) {
  .d-md-inline { display: inline; }
}
.mb-4 { margin-bottom: 20px; }

.code-cell {
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  color: var(--brand-dark);
}
