@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&display=swap");

:root {
  --bg: #f4f6f9;
  --bg-soft: #eef2f7;
  --panel: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #0f766e;
  --accent-hover: #0d9488;
  --accent-soft: #ccfbf1;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #d97706;
  --warn-soft: #fffbeb;
  --info: #0369a1;
  --info-soft: #e0f2fe;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 16px rgba(15, 23, 42, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --sidebar: #ffffff;
  --sidebar-border: #e2e8f0;
  --sidebar-text: #475569;
  --sidebar-active: #0f766e;
  --sidebar-active-bg: #f0fdfa;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    linear-gradient(180deg, #f8fafc 0%, var(--bg) 220px),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
.wrap { width: min(1120px, 94%); margin: 0 auto; }

/* —— 前台顶栏 —— */
.top {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}
.top-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  gap: 16px;
}
.brand {
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.01em;
  font-size: 1.05rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.brand::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), #38bdf8);
}
nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; font-size: 0.92rem; }
nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
nav a:hover { color: var(--text); text-decoration: none; }
.muted { color: var(--muted); font-size: 0.9rem; }
main.wrap { padding: 28px 0 56px; }
.foot {
  border-top: 1px solid var(--line);
  padding: 22px 0 36px;
  background: #fff;
}
.foot .wrap { color: var(--muted); font-size: 0.88rem; }

.hero {
  padding: 28px 0 8px;
  margin-bottom: 28px;
}
.hero h1 {
  font-size: clamp(1.55rem, 2.8vw, 2.05rem);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.hero p {
  color: var(--muted);
  margin: 0 0 22px;
  max-width: 38em;
  line-height: 1.65;
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 960px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 8px; font-size: 1.02rem; color: #0f172a; }
.card p { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; }
.stat-card .stat-num {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #0f172a;
  margin: 4px 0 0;
}
.stat-card .stat-label { font-size: 0.82rem; color: var(--muted); font-weight: 500; }

.price {
  font-size: 1.35rem;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}
.meta { font-size: 0.85rem; color: var(--muted); margin-bottom: 12px; }

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff !important;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none !important;
  transition: background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--accent-hover); filter: none; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }
.btn-ghost {
  background: #fff;
  border: 1px solid var(--line-strong);
  color: var(--text) !important;
}
.btn-ghost:hover { background: var(--bg-soft); border-color: #94a3b8; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-warn { background: #ea580c; }

.form { max-width: 480px; }
.form.form-wide { max-width: 720px; }
.form label {
  display: block;
  margin: 14px 0 6px;
  font-size: 0.86rem;
  color: #475569;
  font-weight: 600;
}
.form label.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  margin-top: 12px;
}
.form input, .form select, .form textarea,
.inline-form input, .inline-form select, .inline-form textarea,
table select, table input[type="text"], table input[type="number"], table input[type="email"], table input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
}
.form input:focus, .form select:focus, .form textarea:focus,
table select:focus, table input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}
.form textarea { min-height: 84px; resize: vertical; }
.form .actions { margin-top: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
@media (max-width: 640px) {
  .form-row { grid-template-columns: 1fr; }
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  border: 1px solid var(--line);
  font-size: 0.92rem;
}
.alert-ok { background: var(--ok-soft); border-color: #a7f3d0; color: #065f46; }
.alert-error { background: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert-info { background: var(--info-soft); border-color: #bae6fd; color: #075985; }

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th {
  color: #64748b;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f8fafc;
}
tbody tr:hover { background: #f8fafc; }
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
  background: var(--bg-soft);
  color: var(--muted);
}
.badge-active { background: var(--ok-soft); color: var(--ok); }
.badge-pending { background: var(--warn-soft); color: var(--warn); }
.badge-failed, .badge-disabled { background: var(--danger-soft); color: var(--danger); }
.badge-provisioning { background: var(--info-soft); color: var(--info); }
.badge-admin { background: #f1f5f9; color: #334155; }
.badge-user { background: #ecfeff; color: #0e7490; }

.section-title { margin: 0 0 16px; font-size: 1.28rem; letter-spacing: -0.02em; color: #0f172a; }
.page-desc { margin: -8px 0 20px; color: var(--muted); font-size: 0.92rem; }
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table-wrap {
  overflow-x: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.table-wrap table { min-width: 720px; }
.money { font-variant-numeric: tabular-nums; font-weight: 600; color: #0f172a; }
.money-pos { color: var(--ok); }
.money-neg { color: var(--danger); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filter-bar .field { display: flex; flex-direction: column; gap: 5px; min-width: 140px; }
.filter-bar .field label { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.filter-bar input, .filter-bar select {
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 0.9rem;
}

.panel-split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 900px) {
  .panel-split { grid-template-columns: 1fr; }
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.inline-form select, .inline-form input {
  width: auto;
  min-width: 110px;
  max-width: 160px;
  padding: 6px 8px;
  font-size: 0.82rem;
}

/* —— 管理后台壳（浅色商务） —— */
.admin-body { background: #f1f5f9; }
.admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.admin-aside {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
  box-shadow: 1px 0 0 rgba(15, 23, 42, 0.02);
}
.admin-brand {
  display: block;
  color: #0f172a;
  font-weight: 700;
  font-size: 1.02rem;
  text-decoration: none;
  padding: 8px 12px 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.admin-brand:hover { text-decoration: none; color: #0f172a; }
.admin-brand span {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: #94a3b8;
  margin-top: 5px;
  letter-spacing: 0.02em;
}
.admin-nav a {
  display: block;
  color: var(--sidebar-text);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 2px;
}
.admin-nav a:hover {
  background: #f8fafc;
  color: #0f172a;
  text-decoration: none;
}
.admin-nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--sidebar-active);
}
.admin-nav .nav-group {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: #94a3b8;
  padding: 16px 12px 6px;
  font-weight: 700;
}
.admin-main { min-width: 0; background: #f1f5f9; }
.admin-topbar {
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.admin-topbar .page-crumb {
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
}
.admin-content { padding: 24px 28px 40px; max-width: 1180px; }
.admin-user-chip {
  font-size: 0.86rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.admin-user-chip .chip {
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
}
@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-aside {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .admin-nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .admin-nav .nav-group { width: 100%; }
  .admin-nav a { padding: 8px 10px; }
  .admin-nav a.active { box-shadow: none; }
  .admin-content { padding: 16px; }
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.plan-card-featured {
  border-color: #99f6e4;
  box-shadow: 0 0 0 1px rgba(15, 118, 110, 0.08), var(--shadow);
}
.kv { display: grid; grid-template-columns: 88px 1fr; gap: 6px 10px; font-size: 0.88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); }

.action-links { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-hero {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-bottom: 18px;
  padding: 20px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.detail-hero h1 { margin: 0 0 6px; font-size: 1.25rem; }
.detail-hero .sub { color: var(--muted); font-size: 0.9rem; }
.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 14px;
}
.metric-row .m {
  min-width: 110px;
}
.metric-row .m .l { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.metric-row .m .v { font-size: 1.15rem; font-weight: 700; color: #0f172a; margin-top: 2px; }

.create-panel {
  margin-bottom: 18px;
  display: none;
}
.create-panel.open { display: block; }
