@import url("./app-shell.css");

.dash-panel {
  display: none;
  animation: dashIn 0.2s var(--app-ease);
}

.dash-panel.active {
  display: block;
}

@keyframes dashIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dash-title {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.dash-subtitle {
  color: var(--app-muted);
  font-size: 0.92rem;
  margin-bottom: 24px;
  line-height: 1.5;
}

.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.dash-stat {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  padding: 18px 18px 16px;
}

.dash-stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--app-muted);
  margin-bottom: 8px;
}

.dash-stat-label svg {
  width: 15px;
  height: 15px;
  opacity: 0.7;
}

.dash-stat-value {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
  font-variant-numeric: tabular-nums;
}

.dash-stat-hint {
  font-size: 0.75rem;
  color: var(--app-dim);
}

.dash-card {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

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

.dash-card-head h3 {
  font-size: 0.95rem;
  font-weight: 600;
}

.dash-chart-empty {
  min-height: 200px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--app-dim);
  font-size: 0.88rem;
  border: 1px dashed var(--app-border);
  border-radius: var(--app-radius);
  background: rgba(255, 255, 255, 0.01);
}

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

.dash-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border);
  background: var(--app-card);
  color: var(--app-ink);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
  text-align: left;
}

.dash-action:hover {
  background: var(--app-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
}

.dash-action svg {
  width: 18px;
  height: 18px;
  color: var(--app-primary);
  flex-shrink: 0;
}

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

.dash-table-wrap {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-card);
  overflow: hidden;
}

.dash-table-head,
.dash-table-row {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
}

.dash-table-head {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--app-dim);
  border-bottom: 1px solid var(--app-border);
}

.dash-table-row {
  font-size: 0.86rem;
  border-bottom: 1px solid var(--app-border-soft);
}

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

.dash-table-row:hover {
  background: rgba(255, 255, 255, 0.02);
}

.dash-table-keys {
  grid-template-columns: 1.2fr 1fr 0.7fr 0.8fr auto;
}

.dash-table-usage {
  grid-template-columns: 1.2fr 0.8fr 1fr 0.9fr;
}

.dash-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--app-muted);
}

.dash-empty svg {
  width: 32px;
  height: 32px;
  margin: 0 auto 12px;
  opacity: 0.35;
}

.dash-empty p {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.dash-empty span {
  font-size: 0.8rem;
  color: var(--app-dim);
}

.dash-row-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

.dash-icon-action {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--app-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.dash-icon-action:hover {
  color: var(--app-ink);
  background: rgba(255, 255, 255, 0.05);
}

.dash-icon-action.danger:hover {
  color: var(--app-red);
  background: rgba(248, 113, 113, 0.08);
}

.dash-wallet {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 12px;
  margin-bottom: 16px;
}

.dash-wallet-main {
  padding: 24px;
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), var(--app-card) 45%);
}

.dash-wallet-amount {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 4px;
}

.dash-wallet-label {
  color: var(--app-muted);
  font-size: 0.85rem;
  margin-bottom: 16px;
}

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

.dash-billing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.dash-billing-card {
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-lg);
  background: var(--app-card);
  padding: 20px;
}

.dash-billing-card h4 {
  font-size: 0.92rem;
  margin-bottom: 6px;
}

.dash-billing-card p {
  color: var(--app-muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.dash-progress {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
  flex: 1;
}

.dash-progress > span {
  display: block;
  height: 100%;
  background: var(--app-primary);
  border-radius: inherit;
}

.dash-usage-metric {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  place-items: center;
  padding: 20px;
}

.dash-modal-backdrop.open {
  display: grid;
}

.dash-modal {
  width: min(440px, 100%);
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: var(--app-radius-xl);
  padding: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.dash-modal h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.dash-modal p {
  color: var(--app-muted);
  font-size: 0.88rem;
  line-height: 1.45;
  margin-bottom: 18px;
}

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

.dash-field label {
  font-size: 0.8rem;
  color: var(--app-muted);
  font-weight: 600;
}

.dash-field input {
  height: 42px;
  border-radius: var(--app-radius);
  border: 1px solid var(--app-border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--app-ink);
  padding: 0 12px;
  font-size: 0.9rem;
}

.dash-field input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.45);
}

.dash-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.dash-modal-actions .app-btn {
  flex: 1;
  height: 42px;
}

.dash-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.dash-chip {
  height: 40px;
  border-radius: var(--app-radius);
  border: 1px solid var(--app-border);
  background: transparent;
  color: var(--app-ink);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.dash-chip.active {
  border-color: var(--app-primary);
  background: var(--app-primary-soft);
  color: var(--app-primary-hover);
}

.dash-secret {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: var(--app-radius);
  border: 1px solid var(--app-border);
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 14px;
}

.dash-secret code {
  flex: 1;
  font-family: var(--app-mono);
  font-size: 0.78rem;
  word-break: break-all;
}

.dash-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 120;
  padding: 12px 16px;
  border-radius: var(--app-radius);
  background: var(--app-card);
  border: 1px solid var(--app-border);
  font-size: 0.86rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: 0.2s;
}

.dash-toast.show {
  opacity: 1;
  transform: none;
}

.dash-quickstart {
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--app-radius-lg);
  border: 1px solid var(--app-border);
  background: var(--app-card);
}

.dash-quickstart h4 {
  font-size: 0.88rem;
  margin-bottom: 10px;
}

.dash-quickstart pre {
  font-family: var(--app-mono);
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--app-muted);
  overflow-x: auto;
}

.dash-upgrade-banner {
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), transparent);
  border-radius: var(--app-radius-lg);
  padding: 24px;
  margin-bottom: 16px;
}

.dash-upgrade-banner h3 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.dash-upgrade-banner p {
  color: var(--app-muted);
  font-size: 0.9rem;
  max-width: 52ch;
  line-height: 1.55;
  margin-bottom: 16px;
}

/* Profile menu (sidebar user pill) */
.dash-profile {
  position: relative;
}

.dash-profile .app-user-pill {
  gap: 10px;
}

.dash-profile-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.dash-profile-chevron {
  flex-shrink: 0;
  color: var(--app-dim);
  transition: transform 0.15s var(--app-ease);
}

.dash-profile.is-open .dash-profile-chevron {
  transform: rotate(180deg);
}

.dash-profile-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 256px;
  max-width: calc(100vw - 24px);
  border-radius: 12px;
  border: 1px solid var(--app-border);
  background: var(--app-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
  z-index: 60;
  overflow: hidden;
  animation: dashProfileIn 0.15s var(--app-ease);
}

.dash-profile-menu[hidden] {
  display: none !important;
}

@keyframes dashProfileIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dash-profile-id {
  padding: 12px 16px;
  border-bottom: 1px solid var(--app-border-soft);
}

.dash-profile-id-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--app-dim);
  margin-bottom: 6px;
}

.dash-profile-id-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dash-profile-id-row code {
  flex: 1;
  min-width: 0;
  font-family: var(--app-mono);
  font-size: 0.72rem;
  color: rgba(244, 244, 245, 0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-page.light .dash-profile-id-row code {
  color: rgba(24, 24, 27, 0.8);
}

.dash-profile-icon-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--app-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.dash-profile-icon-btn:hover {
  color: var(--app-ink);
  background: rgba(255, 255, 255, 0.06);
}

.dash-profile-icon-btn.is-ok {
  color: var(--app-green);
}

.dash-profile-section {
  padding: 4px 0;
}

.dash-profile-footer {
  border-top: 1px solid var(--app-border-soft);
}

.dash-profile-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 16px;
  border: none;
  background: transparent;
  color: rgba(244, 244, 245, 0.82);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}

.app-page.light .dash-profile-item {
  color: rgba(24, 24, 27, 0.82);
}

.dash-profile-item svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.85;
}

.dash-profile-item:hover {
  color: var(--app-ink);
  background: rgba(255, 255, 255, 0.05);
}

.app-page.light .dash-profile-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.dash-profile-item.is-danger {
  color: #f87171;
}

.dash-profile-item.is-danger:hover {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.1);
}

.dash-profile-email {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 0.75rem;
  color: var(--app-dim);
  min-width: 0;
}

.dash-profile-email svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.dash-profile-email span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-profile-add-ico {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--app-border);
  display: grid;
  place-items: center;
  font-size: 1rem;
  color: var(--app-muted);
}

.dash-profile-account {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: transparent;
  color: var(--app-ink);
  text-align: left;
  cursor: pointer;
  border-radius: 10px;
}

.dash-profile-account:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dash-profile-account .meta {
  min-width: 0;
  flex: 1;
}

.dash-profile-account .meta strong {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-profile-account .meta span {
  display: block;
  font-size: 0.72rem;
  color: var(--app-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-profile-account.is-current .app-avatar {
  border-color: rgba(99, 102, 241, 0.45);
  background: rgba(99, 102, 241, 0.25);
}

@media (max-width: 900px) {
  .dash-stat-grid,
  .dash-actions,
  .dash-wallet,
  .dash-billing-grid {
    grid-template-columns: 1fr;
  }

  .dash-table-keys,
  .dash-table-usage,
  .dash-table-head.dash-table-keys,
  .dash-table-head.dash-table-usage {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .dash-table-head {
    display: none;
  }

  .dash-table-row {
    padding: 16px;
  }
}
