:root {
  --bg: #eef5f8;
  --panel: #ffffff;
  --ink: #16212b;
  --muted: #76838f;
  --line: #dbe6ec;
  --blue: #1473e6;
  --cyan: #00a6c8;
  --green: #15a075;
  --orange: #ec8a2e;
  --red: #d84a4a;
  --shadow: 0 16px 42px rgba(31, 68, 94, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, rgba(0, 166, 200, 0.14), transparent 28%),
    linear-gradient(135deg, #f8fbfc 0%, #e6f0f5 100%);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 36px;
}

.login-panel h1,
.topbar h1,
.sidebar h2 {
  margin: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

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

label {
  display: grid;
  gap: 8px;
}

label span {
  font-size: 13px;
  font-weight: 700;
  color: #405161;
}

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

textarea {
  resize: vertical;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(20, 115, 230, 0.11);
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
}

.primary {
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
}

.secondary {
  color: var(--blue);
  background: #e7f2ff;
}

.ghost {
  color: var(--muted);
  background: #f4f8fa;
}

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

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px 18px;
  background: rgba(255, 255, 255, 0.86);
  border-right: 1px solid rgba(219, 230, 236, 0.82);
}

.sidebar nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.nav {
  height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  text-align: left;
  color: #506271;
  background: transparent;
  font-weight: 700;
}

.nav.active {
  color: #fff;
  background: var(--blue);
}

.content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric {
  min-height: 112px;
  padding: 18px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.metric strong {
  display: block;
  margin-top: 12px;
  font-size: 28px;
}

.panel {
  margin-bottom: 16px;
  padding: 18px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(219, 230, 236, 0.92);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-head h3 {
  margin: 0;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

th {
  color: #536574;
  font-size: 12px;
  white-space: nowrap;
}

td {
  color: #1d2b36;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  color: var(--blue);
  background: #e7f2ff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.tag.green {
  color: var(--green);
  background: #e5f8f2;
}

.tag.orange {
  color: var(--orange);
  background: #fff1e2;
}

.tag.red {
  color: var(--red);
  background: #ffe8e8;
}

.inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-actions button {
  min-height: 32px;
}

.split-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
  align-items: start;
}

.form-panel {
  position: sticky;
  top: 24px;
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.tier-card {
  display: grid;
  gap: 14px;
}

.tier-card h3 {
  margin: 0;
}

.tier-card .price {
  font-size: 30px;
  font-weight: 800;
  color: var(--blue);
}

.tier-card ul {
  margin: 0;
  padding-left: 18px;
  color: #4c5c68;
  line-height: 1.8;
}

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

.wide {
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 50;
  max-width: min(520px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  background: rgba(22, 33, 43, 0.92);
  box-shadow: var(--shadow);
}

@media (max-width: 1100px) {
  .metric-grid,
  .tier-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .form-panel {
    position: static;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .content {
    padding: 18px;
  }

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

  .metric-grid,
  .tier-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
