:root {
  --ink: #17211c;
  --muted: #6f786f;
  --paper: #f5f1e7;
  --card: #fffdf7;
  --line: rgba(23, 33, 28, 0.1);
  --green: #0c7a53;
  --lime: #d8ef62;
  --amber: #d78a09;
  --red: #b44b3b;
  color: var(--ink);
  background: var(--paper);
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 90% 2%, rgba(216, 239, 98, 0.28), transparent 24rem),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.login-card {
  width: min(440px, 100%);
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 28px 80px rgba(23, 33, 28, 0.1);
}

.brand-mark,
.side-mark {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 16px;
  background: var(--lime);
  font-family: Georgia, serif;
  font-size: 27px;
  font-weight: 900;
  transform: rotate(-5deg);
}

.login-card h1 {
  margin: 24px 0 8px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 34px;
}

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

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

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

.field input,
.field select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}

.primary,
.ghost,
.danger {
  padding: 11px 16px;
  border: 0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 750;
}

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

.primary:hover {
  background: #2b3930;
}

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

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

.login-card .primary {
  width: 100%;
  margin-top: 24px;
  padding: 14px;
}

.form-error {
  min-height: 20px;
  margin-top: 12px;
  color: var(--red);
  font-size: 13px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 24px 18px;
  background: #17211c;
  color: #fff;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 26px;
}

.side-brand strong {
  display: block;
  font-size: 17px;
}

.side-brand small {
  color: #9ba89f;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav button {
  padding: 12px 14px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #bac5bd;
  text-align: left;
}

.nav button:hover,
.nav button.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.side-user {
  margin-top: auto;
  padding: 16px 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.side-user strong {
  display: block;
  font-size: 14px;
}

.side-user span {
  color: #9ba89f;
  font-size: 12px;
}

.side-user button {
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--lime);
}

.main {
  min-width: 0;
  padding: 30px;
}

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

.topbar h1 {
  margin: 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 34px;
  letter-spacing: -0.5px;
}

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

.role-chip,
.status {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  background: #ece9dd;
  color: #5e675f;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.status.online,
.status.paid {
  background: #e2f3e9;
  color: var(--green);
}

.status.offline,
.status.review {
  background: #fff0d4;
  color: var(--amber);
}

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

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.metric {
  padding: 20px;
}

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

.metric strong {
  display: block;
  margin-top: 12px;
  font-family: Georgia, "Songti SC", serif;
  font-size: 30px;
}

.content-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
}

.panel {
  min-width: 0;
  overflow: hidden;
}

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

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

.panel-body {
  padding: 18px 20px;
}

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

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

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
}

tr:last-child td {
  border-bottom: 0;
}

.row-main {
  font-weight: 750;
}

.row-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar select {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

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

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child {
  border-bottom: 0;
}

.empty,
.loading {
  padding: 50px 20px;
  color: var(--muted);
  text-align: center;
}

.chart {
  display: flex;
  min-height: 240px;
  align-items: flex-end;
  gap: 12px;
  padding-top: 20px;
}

.bar {
  display: grid;
  min-width: 44px;
  flex: 1;
  gap: 8px;
  align-items: end;
  text-align: center;
}

.bar-fill {
  min-height: 4px;
  border-radius: 10px 10px 3px 3px;
  background: linear-gradient(180deg, var(--lime), #98c926);
}

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

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

.modal {
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.26);
}

.modal h2 {
  margin: 0 0 16px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.toast {
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: 24px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 12px 36px rgba(23, 33, 28, 0.24);
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .side-brand {
    padding-bottom: 14px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
  }

  .nav button {
    white-space: nowrap;
  }

  .side-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
  }

  .main {
    padding: 20px 14px;
  }

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

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

@media (max-width: 520px) {
  .login-card {
    padding: 26px 22px;
  }

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

  .metric strong {
    font-size: 24px;
  }
}
