:root {
  --bg: #eef5f7;
  --panel: rgba(255, 255, 255, 0.88);
  --line: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --muted: #64748b;
  --brand: #0f766e;
  --brand-soft: #d8f3ef;
  --accent: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "SF Pro Display", "PingFang SC", "Hiragino Sans GB", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, 0.15), transparent 22%),
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 24%),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

.login-card h1,
.page-title h1 {
  margin: 0 0 8px;
  font-size: 32px;
  line-height: 1.1;
}

.subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-size: 14px;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  padding: 14px 16px;
  font: inherit;
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.remember-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 16px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.remember-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
}

.button {
  border: 0;
  border-radius: 16px;
  padding: 13px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, #0f766e, #14b8a6);
}

.button-muted {
  background: #fff;
  border: 1px solid var(--line);
}

.error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px);
  padding: 28px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

.brand-badge {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #123b80, #0f766e);
  color: #fff;
  font-weight: 800;
  letter-spacing: 1px;
}

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

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

.nav button {
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 18px;
  padding: 16px 18px;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}

.nav button.active {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 700;
}

.content {
  padding: 30px;
}

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

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
}

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

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

.card {
  padding: 22px;
}

.metric-label {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 10px;
}

.metric-value {
  font-size: 40px;
  line-height: 1;
  font-weight: 800;
}

.metric-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.panel {
  margin-top: 20px;
  padding: 22px;
}

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

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

.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-weight: 600;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pill.active {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.pill.disabled {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

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

.token-usage {
  min-width: 180px;
}

.token-usage strong {
  display: block;
  font-size: 18px;
  margin-bottom: 6px;
}

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

.badge-subscription {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.14);
  color: var(--brand);
  font-size: 13px;
  font-weight: 700;
}

.token-group-select {
  min-width: 120px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

.token-row-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.action-icon-button {
  background: transparent;
  border: 0;
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  font: inherit;
  min-width: 52px;
}

.action-icon-button span {
  font-size: 12px;
  white-space: nowrap;
}

.action-icon-button strong {
  font-size: 22px;
  line-height: 1;
  color: #475569;
}

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

.mini-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 20;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(1120px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: #fff;
  border-radius: 28px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.2);
}

.modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 32px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  font-size: 26px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 26px;
  cursor: pointer;
}

.modal-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 32px 0;
  flex-wrap: wrap;
}

.modal-tabs.secondary {
  padding-top: 8px;
}

.tab-button {
  border: 0;
  background: transparent;
  border-bottom: 2px solid transparent;
  padding: 12px 6px;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
}

.tab-button.active {
  color: var(--brand);
  border-color: var(--brand);
  font-weight: 700;
}

.modal-body {
  padding: 22px 32px 32px;
}

.modal-notice {
  color: var(--warn);
  font-size: 14px;
  margin: 0 0 18px;
}

.code-block {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.12);
  margin-bottom: 18px;
}

.code-head {
  background: #1f2937;
  color: rgba(255, 255, 255, 0.86);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
}

.code-block pre {
  margin: 0;
  padding: 22px;
  overflow: auto;
  background: #111827;
  color: #e5eef9;
  font-family: "SFMono-Regular", "Menlo", monospace;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.hidden {
  display: none;
}

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

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

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

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
}

.status-chip strong {
  color: var(--brand);
}

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

.metric-mini {
  font-size: 15px;
  font-weight: 700;
  margin-top: 8px;
  color: var(--brand);
}

.overview-bottom {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
  margin-top: 20px;
}

.recent-list {
  display: grid;
  gap: 14px;
}

.recent-item {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.05);
}

.recent-icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(20, 184, 166, 0.18);
  color: var(--brand);
  font-size: 26px;
  font-weight: 700;
}

.recent-item strong {
  display: block;
  font-size: 18px;
  margin-bottom: 6px;
}

.recent-cost {
  text-align: right;
}

.recent-cost strong {
  color: #16a34a;
  font-size: 18px;
}

.action-list {
  display: grid;
  gap: 14px;
}

.action-card {
  display: grid;
  grid-template-columns: 58px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 20px;
  border-radius: 22px;
  background: rgba(248, 250, 252, 0.95);
  border: 1px solid rgba(15, 23, 42, 0.05);
}

.action-card .icon {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(20, 184, 166, 0.18);
  color: var(--brand);
  font-size: 26px;
}

.action-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}

.arrow {
  font-size: 28px;
  color: #94a3b8;
}

.toolbar {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.toolbar .field {
  margin-bottom: 0;
  min-width: 180px;
  flex: 1;
}

.toolbar .field.search {
  min-width: 280px;
  flex: 1.6;
}

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

.mono {
  font-family: "SFMono-Regular", "Menlo", monospace;
}

@media (max-width: 1200px) {
  .cards.cards-6,
  .overview-bottom {
    grid-template-columns: 1fr;
  }
}

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

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

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

.table-wrap table {
  min-width: 1120px;
}

.action-icon-button {
  transition: color 180ms ease;
}

.action-icon-button:hover {
  color: var(--brand);
}

.action-icon-button svg {
  width: 22px;
  height: 22px;
  color: #475569;
}

.action-icon-button:hover svg {
  color: var(--brand);
}

.mini-icon {
  transition: border-color 180ms ease, color 180ms ease;
}

.mini-icon:hover {
  border-color: rgba(15, 118, 110, 0.28);
  color: var(--brand);
}

.action-card {
  text-align: left;
}

.action-card .icon {
  font-size: 0;
}

.is-clickable {
  cursor: pointer;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.is-clickable:hover {
  border-color: rgba(15, 118, 110, 0.22);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.08);
}

.icon-svg {
  width: 24px;
  height: 24px;
  color: currentColor;
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: grid;
  gap: 10px;
  z-index: 30;
}

.toast {
  min-width: 240px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 18px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.16);
  color: #fff;
  background: rgba(15, 23, 42, 0.92);
  font-size: 14px;
}

.toast.success {
  background: rgba(22, 163, 74, 0.96);
}

.toast.error {
  background: rgba(220, 38, 38, 0.96);
}
