:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #687386;
  --line: #e4e8f0;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --shadow: 0 14px 40px rgba(31, 41, 55, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(37, 99, 235, 0.18), transparent 28rem),
    radial-gradient(circle at 82% 12%, rgba(22, 163, 74, 0.12), transparent 30rem),
    #eef3fb;
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-brand,
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand h1 {
  margin: 0;
  font-size: 22px;
}

.auth-brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.38), transparent 45%),
    linear-gradient(135deg, #2563eb, #14b8a6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 24px 0;
  border-radius: 8px;
  background: #eef2f7;
  padding: 4px;
}

.segmented button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 10px;
}

.segmented button.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 6px rgba(31, 41, 55, 0.08);
}

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

label {
  display: grid;
  gap: 6px;
  color: #384254;
  font-size: 14px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  outline: none;
  padding: 10px 12px;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

button {
  border: 0;
}

.primary,
.secondary,
.danger {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  padding: 0 16px;
}

.primary {
  background: var(--brand);
  color: #fff;
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: #344055;
}

.danger {
  background: #fef2f2;
  color: var(--red);
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

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

.message.err {
  color: var(--red);
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
}

.logo {
  margin-bottom: 24px;
  color: var(--text);
  text-decoration: none;
}

#nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  color: #536074;
  cursor: pointer;
  padding: 10px 12px;
  text-decoration: none;
}

.nav-item.active {
  background: #eef4ff;
  color: var(--brand-dark);
  font-weight: 700;
}

.logout {
  margin-top: auto;
  border-radius: 8px;
  background: #fff1f2;
  color: var(--red);
  cursor: pointer;
  font-weight: 700;
  padding: 11px 12px;
  text-align: left;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  padding: 14px 22px;
  backdrop-filter: blur(10px);
}

.topbar div {
  display: grid;
  gap: 2px;
  justify-items: end;
}

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

.icon-btn {
  display: none;
  border-radius: 8px;
  background: #eef2f7;
  color: var(--text);
  cursor: pointer;
  padding: 9px 12px;
}

.content {
  display: grid;
  gap: 20px;
  padding: 24px;
}

.page-title h1 {
  margin: 0;
  font-size: 24px;
}

.page-title p {
  margin: 6px 0 0;
  color: var(--muted);
}

.hero-panel {
  overflow: hidden;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  padding: 26px;
  position: relative;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(20, 184, 166, 0.4), transparent 30%),
    radial-gradient(circle at 78% 0%, rgba(37, 99, 235, 0.45), transparent 34%);
}

.hero-panel > * {
  position: relative;
}

.hero-panel h1 {
  margin: 8px 0;
  font-size: 26px;
}

.hero-panel p {
  max-width: 760px;
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
}

.grid {
  display: grid;
  gap: 16px;
}

.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
  box-shadow: 0 1px 0 rgba(17, 24, 39, 0.02);
}

.stat {
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--brand);
}

.stat small {
  color: var(--muted);
}

.stat strong {
  display: block;
  margin-top: 2px;
  font-size: 24px;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9edf4;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #14b8a6);
}

.packages {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.package-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.package-card strong {
  font-size: 26px;
}

.pay-methods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.pay-method {
  display: grid;
  min-height: 78px;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  justify-items: start;
  padding: 14px;
  text-align: left;
}

.pay-method strong {
  font-size: 18px;
}

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

.pay-method.alipay:hover {
  border-color: #1677ff;
  box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

.pay-method.wechat:hover {
  border-color: #07c160;
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.12);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.55);
  padding: 18px;
}

.pay-modal {
  position: relative;
  display: grid;
  width: min(420px, 100%);
  gap: 16px;
  border-radius: 8px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.pay-modal-head {
  display: grid;
  gap: 8px;
  padding-right: 34px;
}

.pay-modal h2 {
  margin: 0;
  font-size: 24px;
}

.pay-modal p {
  margin: 0;
}

.qr-image {
  width: min(280px, 100%);
  aspect-ratio: 1 / 1;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  padding: 10px;
}

.pay-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pay-meta span {
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  padding: 10px 12px;
}

.pay-meta b {
  color: var(--text);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
}

.table th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
}

.badge.off {
  background: #f1f5f9;
  color: #64748b;
}

.doc-steps {
  margin: 12px 0 0;
  padding-left: 20px;
  color: #4b5563;
}

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

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    width: 248px;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .icon-btn {
    display: inline-flex;
  }

  .cols-2,
  .cols-3,
  .cols-4 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 16px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .hero-panel {
    padding: 20px;
  }

  .pay-methods,
  .pay-meta {
    grid-template-columns: 1fr;
  }
}
