@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;700&display=swap");

:root {
  --bg0: #eef2f4;
  --bg1: #e7eef0;
  --card: rgba(255, 255, 255, 0.92);
  --text: #0f172a;
  --muted: #64748b;
  --line: rgba(15, 23, 42, 0.08);
  --accent: #0f766e;
  --accent-2: #0d9488;
  --danger: #b91c1c;
  --ok: #047857;
  --sidebar: #0b1220;
  --sidebar-2: #132033;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  --font: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(13, 148, 136, 0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(3, 105, 161, 0.10), transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); }
code { font-family: var(--mono); font-size: 12px; background: rgba(15,23,42,.05); padding: 1px 6px; border-radius: 6px; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(185deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: #cbd5e1;
  padding: 28px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar h1 {
  font-size: 17px;
  letter-spacing: 0.02em;
  margin: 0 0 28px;
  color: #fff;
  font-weight: 600;
}
.sidebar a {
  display: block;
  color: #94a3b8;
  padding: 11px 14px;
  border-radius: 10px;
  margin-bottom: 4px;
  transition: background .15s, color .15s;
}
.sidebar a.active, .sidebar a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}

.main { flex: 1; padding: 28px 32px 40px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
  gap: 16px;
}
.page-kicker {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
}
.page-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.card {
  background: var(--card);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h3 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.card-head h3 { margin: 0; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat { position: relative; overflow: hidden; }
.stat::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15,118,110,.12), transparent 70%);
}
.stat .n {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #0f172a;
}
.stat .l { color: var(--muted); font-size: 13px; margin-top: 6px; }

table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
tbody tr:hover { background: rgba(15, 118, 110, 0.03); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: #fff !important;
  border: 0;
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  box-shadow: 0 6px 14px rgba(15, 118, 110, 0.22);
  transition: transform .12s, filter .12s;
}
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn.secondary { background: #334155; box-shadow: none; }
.btn.danger {
  background: linear-gradient(180deg, #dc2626, var(--danger));
  box-shadow: 0 6px 14px rgba(185, 28, 28, 0.18);
}
.btn.small { padding: 6px 10px; font-size: 12px; border-radius: 8px; box-shadow: none; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 6px 0 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
textarea { resize: vertical; min-height: 120px; line-height: 1.45; }
label { font-size: 13px; color: var(--muted); font-weight: 500; }
.chk {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  margin: 0;
}
.chk input { width: auto; margin: 0; }

.flash {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  border: 1px solid transparent;
}
.flash.ok { background: #ecfdf5; color: var(--ok); border-color: #a7f3d0; }
.flash.err { background: #fef2f2; color: var(--danger); border-color: #fecaca; }

.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 420px;
  max-width: 100%;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.12);
}

.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1; min-width: 140px; }
.stack-form { display: flex; flex-direction: column; }
.inline-form {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.mono { font-family: var(--mono); word-break: break-all; font-size: 13px; }

/* 统一筛选 / 发送验证码行：标签 + 控件同高对齐 */
.filters,
.code-send-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.filters .field,
.code-send-row .field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 140px;
  flex: 1 1 140px;
  margin: 0;
}
.filters .field label,
.code-send-row .field label {
  display: block;
  margin: 0 0 6px;
  line-height: 1.2;
  min-height: 1.2em;
}
.filters .field input,
.filters .field select,
.code-send-row .field input {
  width: 100%;
  margin: 0;
  height: 42px;
}
.filters .field-action,
.code-send-row .field-action {
  flex: 0 0 auto;
  min-width: auto;
}
.filters .field-action .btn,
.code-send-row .field-action .btn {
  height: 42px;
  margin: 0;
  white-space: nowrap;
  padding-left: 18px;
  padding-right: 18px;
}
.code-send-row .field-email { flex: 1 1 220px; }
.auth-card .code-send-row { margin-bottom: 14px; }
.auth-card h2 { margin: 0 0 6px; font-size: 22px; }
.auth-card > .muted { margin: 0 0 16px; }
.auth-card form:not(.code-send-row) .btn { width: 100%; margin-top: 4px; }
.auth-card form:not(.code-send-row) input { margin-bottom: 10px; }
.auth-card form:not(.code-send-row) label { display: block; margin-top: 2px; }
.export-cols { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.export-cols .chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  margin: 0;
  white-space: nowrap;
}
.export-cols .chk input { width: auto; margin: 0; }
.table-scroll { overflow-x: auto; }
#tx-table th[data-col], #tx-table td[data-col] { white-space: nowrap; }
table input[type="checkbox"] { width: auto; margin: 0; }

.ops { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ops form { display: inline; margin: 0; }
.batch-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.view-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.view-tabs .tab {
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.view-tabs .tab.active, .view-tabs .tab:hover {
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
}

.chart-wrap { height: 340px; position: relative; }
.chart-wrap-sm { height: 320px; max-width: 720px; margin: 0 auto; }

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fee2e2;
  color: var(--danger);
  font-size: 12px;
  font-weight: 500;
}
.pill.ok { background: #d1fae5; color: var(--ok); }

@media (max-width: 980px) {
  .layout { display: block; }
  .sidebar {
    width: auto;
    height: auto;
    position: relative;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    padding: 16px;
  }
  .sidebar h1 { width: 100%; margin-bottom: 8px; }
  .sidebar a { margin: 0; }
  .grid, .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 32px; }
}
