:root {
  color-scheme: light;
  --bg: #f5f8fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #e5eaf0;
  --line-strong: #d6dee8;
  --text: #111827;
  --muted: #667085;
  --faint: #94a3b8;
  --teal: #0f9f8f;
  --green: #16a34a;
  --blue: #2563eb;
  --indigo: #6366f1;
  --purple: #8b5cf6;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.07);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

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

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(204, 251, 241, 0.72), rgba(239, 246, 255, 0.84)),
    var(--bg);
}

.auth-panel {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 26px;
}

.auth-brand {
  margin-bottom: 28px;
}

.auth-copy {
  margin-bottom: 22px;
}

.auth-copy h1 {
  margin-bottom: 8px;
}

.auth-copy p:last-child {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

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

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.auth-form input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
}

.auth-form input:focus {
  outline: 3px solid #ccfbf1;
  border-color: #0f766e;
}

.auth-switch {
  width: 100%;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: #0f766e;
  margin-top: 14px;
  font-weight: 800;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: rgba(255, 255, 255, 0.92);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 14px 12px;
}

.brand {
  display: flex;
  align-items: center;
  min-height: 42px;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark,
.avatar {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: #ecfeff;
  border: 1px solid #c7f4f0;
  color: var(--teal);
  font-weight: 800;
}

.brand-name {
  font-weight: 800;
  font-size: 18px;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #445064;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #eaf8f6;
  color: #07877c;
}

.nav-icon,
.bell,
.calendar,
.chevron,
.close-icon {
  display: inline-block;
  width: 18px;
  height: 18px;
  color: currentColor;
  position: relative;
}

.nav-icon::before,
.nav-icon::after,
.bell::before,
.calendar::before,
.chevron::before,
.close-icon::before,
.close-icon::after {
  content: "";
  position: absolute;
  inset: 0;
}

.nav-icon.grid::before {
  border: 2px solid currentColor;
  border-radius: 4px;
  box-shadow: 9px 0 0 -5px currentColor, 0 9px 0 -5px currentColor,
    9px 9px 0 -5px currentColor;
}

.nav-icon.image::before {
  border: 2px solid currentColor;
  border-radius: 5px;
}

.nav-icon.image::after {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  inset: 4px auto auto 4px;
}

.nav-icon.key::before {
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  inset: 3px auto auto 1px;
}

.nav-icon.key::after {
  width: 12px;
  height: 2px;
  background: currentColor;
  transform: rotate(-40deg);
  inset: 10px auto auto 8px;
  box-shadow: 5px 0 0 currentColor;
}

.nav-icon.tag::before {
  border: 2px solid currentColor;
  border-radius: 4px;
  transform: rotate(45deg) scale(0.72);
}

.nav-icon.chart::before {
  inset: auto auto 2px 2px;
  width: 3px;
  height: 10px;
  background: currentColor;
  box-shadow: 6px -4px 0 currentColor, 12px -8px 0 currentColor;
  border-radius: 2px;
}

.nav-icon.gift::before {
  border: 2px solid currentColor;
  border-radius: 4px;
  top: 5px;
}

.nav-icon.gift::after {
  width: 2px;
  background: currentColor;
  left: 8px;
  box-shadow: 0 -5px 0 3px transparent;
}

.nav-icon.card::before {
  border: 2px solid currentColor;
  border-radius: 4px;
}

.nav-icon.card::after {
  height: 2px;
  background: currentColor;
  top: 6px;
}

.nav-icon.users::before {
  width: 7px;
  height: 7px;
  border: 2px solid currentColor;
  border-radius: 50%;
  left: 1px;
}

.nav-icon.users::after {
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  right: 0;
  top: 6px;
}

.nav-icon.user::before {
  width: 8px;
  height: 8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  left: 5px;
}

.nav-icon.user::after {
  border: 2px solid currentColor;
  border-radius: 50% 50% 0 0;
  top: 10px;
}

.main {
  min-width: 0;
  padding: 26px 34px 42px;
}

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

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-button,
.plain-button,
.balance-pill,
.profile-button,
.select-button,
.secondary-button,
.ghost-button,
.primary-button,
.method-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 40px;
  background: #fff;
  color: var(--text);
}

.icon-button {
  width: 40px;
  display: inline-grid;
  place-items: center;
}

.bell::before {
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 4px 4px;
  inset: 2px 4px 5px;
}

.bell::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  bottom: 2px;
  left: 6px;
}

.plain-button,
.select-button,
.secondary-button,
.ghost-button {
  padding: 0 14px;
}

.balance-pill {
  padding: 0 16px;
  color: #04786f;
  background: #e9fbf8;
  border-color: #d2f2ec;
  font-weight: 800;
}

.profile-button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 0 10px 0 0;
}

.profile-copy {
  display: grid;
  text-align: left;
  line-height: 1.15;
}

.profile-copy span {
  color: var(--muted);
  font-size: 12px;
}

.status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric-card {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 20px 18px;
}

.metric-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, white);
  font-weight: 800;
}

.metric-copy {
  min-width: 0;
}

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

.metric-value {
  display: block;
  margin: 2px 0;
  font-weight: 850;
  font-size: 24px;
  line-height: 1.1;
  color: var(--text);
}

.toolbar {
  margin: 24px 0;
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.select-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.calendar::before {
  border: 2px solid currentColor;
  border-radius: 4px;
  top: 3px;
}

.calendar::after {
  content: "";
  position: absolute;
  height: 2px;
  background: currentColor;
  top: 7px;
  left: 2px;
  right: 2px;
}

.chevron {
  width: 14px;
  height: 14px;
}

.chevron::before {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  inset: 0 0 auto 2px;
}

.analytics-grid,
.bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

.bottom-grid {
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.55fr);
}

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

.panel-heading,
.section-heading,
.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading {
  margin-bottom: 18px;
}

.model-content {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: center;
  gap: 26px;
  min-height: 210px;
}

.donut {
  width: 196px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--blue) 0 100%);
  position: relative;
  box-shadow: inset 0 0 0 1px #dbeafe;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 50px;
  border-radius: inherit;
  background: #fff;
}

.model-table {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.5fr) 80px 100px 100px 100px;
  gap: 14px;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  color: #334155;
  font-size: 13px;
}

.table-row.header {
  color: var(--muted);
  font-weight: 700;
}

.money-good {
  color: var(--green);
  font-weight: 800;
}

.chart-panel canvas {
  display: block;
  width: 100%;
  height: 260px;
}

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

.usage-list,
.activity-list,
.key-list {
  display: grid;
  gap: 12px;
}

.usage-row,
.activity-row,
.key-row {
  display: grid;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 14px 16px;
}

.usage-row {
  grid-template-columns: 42px minmax(0, 1fr) auto;
}

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

.key-row {
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
}

.row-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: #ccfbf1;
  color: #0f766e;
  font-weight: 900;
}

.row-main {
  min-width: 0;
}

.row-main strong {
  display: block;
  margin-bottom: 3px;
}

.row-main span,
.row-side span,
.modal-note,
.empty-panel p {
  color: var(--muted);
  font-size: 13px;
}

.row-side {
  text-align: right;
}

.row-side strong {
  color: var(--green);
}

.section-heading {
  margin-bottom: 18px;
}

.primary-button {
  padding: 0 16px;
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
  font-weight: 800;
}

.primary-button:hover {
  background: #0b665e;
}

.secondary-button:hover,
.ghost-button:hover,
.select-button:hover,
.plain-button:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 18px;
}

.plan-card {
  min-height: 210px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 20px;
  display: grid;
  align-content: space-between;
  gap: 20px;
}

.plan-card.featured {
  border-color: #99f6e4;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 30px;
  font-weight: 900;
}

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

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

.modal-backdrop[hidden],
.toast[hidden],
.status-banner[hidden] {
  display: none;
}

.modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.24);
  padding: 20px;
}

.close-icon::before,
.close-icon::after {
  height: 2px;
  background: currentColor;
  top: 8px;
}

.close-icon::before {
  transform: rotate(45deg);
}

.close-icon::after {
  transform: rotate(-45deg);
}

.checkout-plans {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.checkout-plan {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 112px;
  padding: 14px;
  text-align: left;
}

.checkout-plan.active {
  border-color: #0f766e;
  box-shadow: 0 0 0 3px #ccfbf1;
}

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

.method-button {
  background: var(--panel-soft);
}

.method-button.active {
  border-color: #0f766e;
  background: #ecfdf5;
  color: #047857;
  font-weight: 800;
}

.full {
  width: 100%;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100vw - 48px));
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #f0fdf4;
  color: #166534;
  padding: 13px 16px;
  box-shadow: var(--shadow);
  z-index: 30;
}

.empty-panel {
  min-height: 320px;
  display: grid;
  align-content: center;
  justify-items: start;
}

.empty-inline {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 4px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  padding: 16px;
}

.empty-inline strong {
  color: var(--text);
}

@media (max-width: 1180px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .analytics-grid,
  .bottom-grid {
    grid-template-columns: 1fr;
  }

  .bottom-grid {
    margin-bottom: 0;
  }
}

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

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

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

  .main {
    padding: 20px 16px 34px;
  }

  .topbar,
  .toolbar,
  .status-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .toolbar-group {
    flex-wrap: wrap;
  }

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

  .donut {
    width: min(196px, 70vw);
  }

  .table-row {
    grid-template-columns: minmax(140px, 1fr) 56px 80px;
  }

  .table-row span:nth-child(4),
  .table-row span:nth-child(5) {
    display: none;
  }

  .plan-grid,
  .checkout-plans,
  .payment-methods {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .metrics-grid,
  .nav-list {
    grid-template-columns: 1fr;
  }

  .key-row,
  .usage-row {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .key-row button,
  .usage-row .row-side {
    grid-column: 2;
    justify-self: start;
    text-align: left;
  }
}
