:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --line: #dfe6f1;
  --text: #142033;
  --muted: #66758a;
  --blue: #1769ff;
  --green: #16a34a;
  --orange: #d97706;
  --red: #dc2626;
  --shadow: 0 12px 34px rgba(17, 33, 62, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
  background: linear-gradient(135deg, #eef5ff, #ffffff 46%, #edf8ff);
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  width: min(420px, 100%);
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.login-brand img {
  width: 42px;
  height: 42px;
  border-radius: 10px;
}

.login-brand strong,
.login-brand span,
.login-card label span {
  display: block;
}

.login-brand strong {
  font-size: 19px;
}

.login-brand span,
.login-card label span,
.login-card p {
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.login-card input {
  height: 42px;
  padding: 0 12px;
}

.login-card button {
  width: 100%;
  margin-top: 4px;
}

.login-card p {
  margin: 14px 0 0;
  font-size: 12px;
  text-align: center;
}

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

button {
  cursor: pointer;
}

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 236px;
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 18px;
  border-bottom: 1px solid var(--line);
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 16px;
}

.brand span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 1px;
}

.nav {
  display: grid;
  gap: 4px;
  padding-top: 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  color: #46556b;
  padding: 10px;
  border-radius: 8px;
  text-align: left;
}

.nav-item:hover {
  background: #eef4ff;
  color: var(--blue);
}

.nav-item.active {
  background: #e7f0ff;
  color: var(--blue);
  font-weight: 700;
}

.nav-item span {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #edf2f8;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 22px clamp(16px, 3vw, 34px) 34px;
}

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

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
}

.admin-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.menu-btn {
  display: none;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.icon-btn span {
  display: block;
  width: 17px;
  height: 2px;
  background: var(--text);
  margin: 4px auto;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric span,
.metric em {
  color: var(--muted);
  font-style: normal;
}

.metric strong {
  display: block;
  margin: 8px 0 6px;
  font-size: 25px;
  line-height: 1.1;
}

.metric em {
  font-size: 12px;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
}

.panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 17px;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.pricing-list,
.alert-list,
.package-list,
.settings-form,
.card-generator,
.generated-box {
  padding: 18px 20px;
}

.pricing-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid #eef2f7;
}

.pricing-row:last-child {
  border-bottom: 0;
}

.pricing-row p {
  margin: 4px 0 0;
  color: var(--muted);
}

.feature-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-weight: 800;
}

.feature-mark.collect {
  background: #eaf2ff;
  color: var(--blue);
}

.feature-mark.image {
  background: #eaf8ef;
  color: var(--green);
}

.feature-mark.free {
  background: #fff4df;
  color: var(--orange);
}

.alert-list {
  display: grid;
  gap: 10px;
}

.alert-item {
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  padding: 12px;
}

.alert-item.warn {
  border-left-color: var(--orange);
}

.alert-item.ok {
  border-left-color: var(--green);
}

.alert-item strong,
.alert-item span {
  display: block;
}

.alert-item span {
  color: var(--muted);
  margin-top: 3px;
  font-size: 13px;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
}

.search-input,
input,
select,
textarea {
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text);
  border-radius: 8px;
  outline: none;
}

.search-input {
  width: 220px;
  height: 38px;
  padding: 0 12px;
}

.search-input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(23, 105, 255, 0.1);
}

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

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

th,
td {
  padding: 13px 18px;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  background: #fbfcfe;
}

td {
  color: #26364d;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e7f0ff;
  color: var(--blue);
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.badge.on {
  background: #dcfce7;
  color: #15803d;
}

.badge.off {
  background: #fee2e2;
  color: #b91c1c;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.primary,
.ghost,
.danger {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  border: 1px solid transparent;
  font-weight: 700;
}

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

.ghost {
  background: #fff;
  border-color: var(--line);
  color: #304158;
}

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

.small {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

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

.settings-form label,
.card-generator label {
  display: grid;
  gap: 7px;
}

.settings-form span,
.card-generator span {
  color: var(--muted);
  font-size: 13px;
}

.settings-form input,
.card-generator input,
.card-generator select {
  height: 40px;
  padding: 0 11px;
}

.package-list {
  display: grid;
  gap: 10px;
}

.package-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.package-list span {
  color: var(--muted);
}

.card-generator {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 12px;
}

.generated-box {
  display: grid;
  gap: 10px;
  padding-top: 0;
}

.generated-box textarea {
  width: 100%;
  min-height: 180px;
  padding: 12px;
  resize: vertical;
  line-height: 1.7;
}

.card-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 20px 12px;
}

.card-list-head h3 {
  margin: 0;
  font-size: 15px;
}

.card-list-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.card-table-wrap {
  padding: 0 20px 20px;
}

.card-table-wrap table {
  min-width: 900px;
}

.card-table-wrap td:first-child {
  font-family: Consolas, "SFMono-Regular", monospace;
  letter-spacing: 0;
}

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

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  background: #142033;
  color: #fff;
  border-radius: 8px;
  padding: 11px 14px;
  box-shadow: var(--shadow);
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

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

  .card-generator {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .admin-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    inset: 0 auto 0 0;
    transform: translateX(-102%);
    transition: transform 0.2s ease;
    box-shadow: 18px 0 40px rgba(17, 33, 62, 0.16);
  }

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

  .main {
    padding: 15px 12px 28px;
  }

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

  .topbar h1 {
    font-size: 20px;
  }

  .topbar p {
    font-size: 12px;
  }

  .menu-btn {
    display: inline-block;
    flex-shrink: 0;
  }

  .admin-user {
    display: none;
  }

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

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

  .toolbar {
    width: 100%;
    flex-direction: column;
  }

  .search-input,
  .toolbar button {
    width: 100%;
  }

  .pricing-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .pricing-row b {
    grid-column: 2;
  }

  .card-generator {
    grid-template-columns: 1fr;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
}
