.oj-api-portal {
  --oj-api-border: rgba(148, 163, 184, 0.16);
  --oj-api-border-strong: rgba(148, 163, 184, 0.28);
  --oj-api-panel: var(--oj-surface, #151925);
  --oj-api-panel-strong: var(--oj-surface-strong, #1b2030);
  --oj-api-accent: var(--oj-accent, #3b82f6);
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  grid-template-areas:
    "header header"
    "nav content";
  gap: 0;
  width: min(1240px, calc(100% - 32px));
  min-height: 680px;
  margin: 32px auto 72px;
  overflow: hidden;
  color: var(--oj-text, #f3f5f9);
  background: var(--oj-bg, #0d1018);
  border: 1px solid var(--oj-api-border);
  border-radius: 20px;
  box-shadow: 0 28px 90px -48px rgba(0, 0, 0, 0.9);
}

.oj-api-header {
  grid-area: header;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-width: 0;
  padding: 20px 24px;
  background: var(--oj-api-panel-strong);
  border-bottom: 1px solid var(--oj-api-border);
}

.oj-api-header__brand,
.oj-api-header__user,
.oj-api-header__brand-copy,
.oj-api-header__user-copy {
  display: flex;
  align-items: center;
  min-width: 0;
}

.oj-api-header__brand,
.oj-api-header__user {
  gap: 12px;
}

.oj-api-header__brand-copy,
.oj-api-header__user-copy {
  flex-direction: column;
  align-items: flex-start;
}

.oj-api-header__mark {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #fff;
  font: 800 14px/1 "JetBrains Mono", monospace;
  background: linear-gradient(135deg, var(--oj-api-accent), #7c3aed);
  border-radius: 12px;
  box-shadow: 0 10px 24px -12px rgba(59, 130, 246, 0.7);
}

.oj-api-header__eyebrow,
.oj-api-header__user-label {
  color: var(--oj-muted, #929bad);
  font: 600 10px/1.4 "JetBrains Mono", monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.oj-api-header__title {
  margin-top: 2px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.oj-api-header__user-value {
  max-width: 280px;
  margin-top: 2px;
  overflow: hidden;
  font: 500 12px/1.4 "JetBrains Mono", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oj-api-nav {
  grid-area: nav;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 22px 14px;
  background: var(--oj-api-panel);
  border-right: 1px solid var(--oj-api-border);
}

.oj-api-nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  color: var(--oj-muted, #929bad);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.oj-api-nav__item:hover,
.oj-api-nav__item:focus-visible {
  color: var(--oj-text, #f3f5f9);
  background: rgba(148, 163, 184, 0.07);
  outline: none;
}

.oj-api-nav__item:focus-visible {
  border-color: rgba(59, 130, 246, 0.65);
}

.oj-api-nav__item.is-active {
  color: var(--oj-text, #f3f5f9);
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(59, 130, 246, 0.28);
}

.oj-api-nav__index {
  color: var(--oj-muted, #929bad);
  opacity: 0.72;
  font: 600 10px/1 "JetBrains Mono", monospace;
}

.oj-api-nav__item.is-active .oj-api-nav__index {
  color: var(--oj-api-accent);
  opacity: 1;
}

.oj-api-nav__label {
  min-width: 0;
  overflow: hidden;
  font: 600 13px/1.25 inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oj-api-content {
  grid-area: content;
  min-width: 0;
  padding: clamp(24px, 4vw, 44px);
}

.oj-api-page {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.oj-api-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.oj-api-page-head__copy {
  min-width: 0;
}

.oj-api-page-head__title {
  margin: 0;
  color: var(--oj-text, #f3f5f9);
  font-size: clamp(24px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.035em;
}

.oj-api-page-head__sub {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--oj-muted, #929bad);
  font-size: 14px;
  line-height: 1.65;
}

.oj-api-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 14px;
  color: var(--oj-text, #f3f5f9);
  font: 600 12.5px/1.25 inherit;
  white-space: nowrap;
  background: rgba(148, 163, 184, 0.09);
  border: 1px solid var(--oj-api-border-strong);
  border-radius: 9px;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, opacity 150ms ease;
}

.oj-api-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.52);
}

.oj-api-button:focus-visible {
  outline: 2px solid rgba(59, 130, 246, 0.72);
  outline-offset: 2px;
}

.oj-api-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.oj-api-button--primary {
  color: #fff;
  background: var(--oj-api-accent);
  border-color: transparent;
}

.oj-api-button--ghost {
  background: rgba(148, 163, 184, 0.055);
}

.oj-api-button--danger {
  color: #fda4af;
  background: rgba(244, 63, 94, 0.08);
  border-color: rgba(244, 63, 94, 0.2);
}

.oj-api-button--small {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 11px;
}

.oj-api-state {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
  background: var(--oj-api-panel);
  border: 1px solid var(--oj-api-border);
  border-radius: 13px;
}

.oj-api-state--error {
  background: rgba(244, 63, 94, 0.055);
  border-color: rgba(244, 63, 94, 0.18);
}

.oj-api-state--empty {
  background: rgba(148, 163, 184, 0.035);
  border-style: dashed;
}

.oj-api-state__icon {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--oj-api-accent);
  font: 700 14px/1 "JetBrains Mono", monospace;
  background: rgba(59, 130, 246, 0.12);
  border-radius: 50%;
}

.oj-api-state--loading .oj-api-state__icon {
  animation: oj-api-pulse 1.2s ease-in-out infinite;
}

.oj-api-state--error .oj-api-state__icon {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.12);
}

.oj-api-state__copy {
  flex: 1 1 auto;
  min-width: 0;
}

.oj-api-state__title {
  font-size: 13.5px;
  font-weight: 650;
}

.oj-api-state__body {
  margin-top: 4px;
  color: var(--oj-muted, #929bad);
  font-size: 12.5px;
  line-height: 1.55;
}

.oj-api-welcome {
  padding: 22px 24px;
  background:
    radial-gradient(80% 140% at 100% 0%, rgba(59, 130, 246, 0.2), transparent 62%),
    var(--oj-api-panel-strong);
  border: 1px solid var(--oj-api-border);
  border-radius: 14px;
}

.oj-api-welcome__label {
  color: var(--oj-muted, #929bad);
  font-size: 12px;
}

.oj-api-welcome__name {
  margin-top: 5px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.oj-api-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.oj-api-metric {
  position: relative;
  min-width: 0;
  padding: 20px;
  overflow: hidden;
  background: var(--oj-api-panel);
  border: 1px solid var(--oj-api-border);
  border-radius: 13px;
}

.oj-api-metric::after {
  position: absolute;
  right: -18px;
  bottom: -30px;
  width: 90px;
  height: 90px;
  content: "";
  background: currentColor;
  border-radius: 50%;
  opacity: 0.06;
}

.oj-api-metric--blue { color: #60a5fa; }
.oj-api-metric--violet { color: #a78bfa; }
.oj-api-metric--green { color: #34d399; }

.oj-api-metric__label {
  color: var(--oj-muted, #929bad);
  font-size: 11.5px;
  font-weight: 600;
}

.oj-api-metric__value {
  margin-top: 10px;
  color: currentColor;
  font: 700 30px/1 "JetBrains Mono", monospace;
}

.oj-api-panel,
.oj-api-callout,
.oj-api-security-card {
  background: var(--oj-api-panel);
  border: 1px solid var(--oj-api-border);
  border-radius: 14px;
}

.oj-api-panel {
  padding: 22px;
}

.oj-api-panel__title {
  margin-bottom: 16px;
  font-size: 13px;
  font-weight: 700;
}

.oj-api-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.oj-api-compact-list {
  display: flex;
  flex-direction: column;
}

.oj-api-compact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 13px 0;
  border-top: 1px solid var(--oj-api-border);
}

.oj-api-compact-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.oj-api-compact-row:last-child {
  padding-bottom: 0;
}

.oj-api-compact-row__copy {
  min-width: 0;
}

.oj-api-compact-row__title {
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oj-api-compact-row__meta {
  margin-top: 3px;
  color: var(--oj-muted, #929bad);
  font: 500 11px/1.4 "JetBrains Mono", monospace;
}

.oj-api-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  color: var(--oj-muted, #929bad);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  background: rgba(148, 163, 184, 0.08);
  border-radius: 999px;
}

.oj-api-status--active,
.oj-api-status--paid,
.oj-api-status--succeeded {
  color: #34d399;
  background: rgba(52, 211, 153, 0.11);
}

.oj-api-status--pending,
.oj-api-status--processing,
.oj-api-status--incomplete {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.11);
}

.oj-api-status--failed,
.oj-api-status--past_due {
  color: #fb7185;
  background: rgba(244, 63, 94, 0.11);
}

.oj-api-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.oj-api-product-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  padding: 21px;
  background: var(--oj-api-panel);
  border: 1px solid var(--oj-api-border);
  border-radius: 14px;
}

.oj-api-product-card__top,
.oj-api-product-card__identity {
  display: flex;
  align-items: center;
}

.oj-api-product-card__top {
  justify-content: space-between;
  gap: 14px;
}

.oj-api-product-card__identity {
  min-width: 0;
  gap: 12px;
}

.oj-api-product-card__mark {
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  color: var(--oj-api-accent);
  font: 750 12px/1 "JetBrains Mono", monospace;
  background: rgba(59, 130, 246, 0.12);
  border-radius: 11px;
}

.oj-api-product-card__copy {
  min-width: 0;
}

.oj-api-product-card__name {
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oj-api-product-card__plan {
  margin-top: 3px;
  color: var(--oj-muted, #929bad);
  font: 500 11px/1.4 "JetBrains Mono", monospace;
}

.oj-api-product-card__details,
.oj-api-info-grid {
  display: grid;
  gap: 12px;
}

.oj-api-product-card__details {
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  padding-top: 16px;
  border-top: 1px solid var(--oj-api-border);
}

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

.oj-api-info-field {
  min-width: 0;
}

.oj-api-info-field__label {
  color: var(--oj-muted, #929bad);
  font-size: 10.5px;
  font-weight: 600;
}

.oj-api-info-field__value {
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 12.5px;
  line-height: 1.5;
}

.oj-api-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
}

.oj-api-callout__copy {
  color: var(--oj-muted, #929bad);
  font-size: 12.5px;
  line-height: 1.55;
}

.oj-api-table-wrap {
  width: 100%;
  overflow-x: auto;
  background: var(--oj-api-panel);
  border: 1px solid var(--oj-api-border);
  border-radius: 14px;
  scrollbar-width: thin;
}

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

.oj-api-table th,
.oj-api-table td {
  padding: 13px 15px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--oj-api-border);
}

.oj-api-table th {
  color: var(--oj-muted, #929bad);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  background: rgba(148, 163, 184, 0.035);
}

.oj-api-table td {
  max-width: 280px;
  overflow: hidden;
  color: var(--oj-text, #f3f5f9);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oj-api-table tbody tr:last-child td {
  border-bottom: 0;
}

.oj-api-table tbody tr:hover td {
  background: rgba(148, 163, 184, 0.025);
}

.oj-api-table__money,
.oj-api-table__reference {
  font-family: "JetBrains Mono", monospace;
}

.oj-api-table__reference {
  color: var(--oj-muted, #929bad) !important;
  font-size: 10.5px !important;
}

.oj-api-table-actions {
  display: flex;
  gap: 6px;
}

.oj-api-privacy-note {
  margin-top: 20px;
  padding: 13px 14px;
  color: var(--oj-muted, #929bad);
  font-size: 11.5px;
  line-height: 1.55;
  background: rgba(148, 163, 184, 0.045);
  border-radius: 9px;
}

.oj-api-panel > .oj-api-button:last-child {
  margin-top: 18px;
}

.oj-api-security-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(280px, 1.4fr) minmax(0, 0.8fr);
  gap: 14px;
}

.oj-api-security-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: 20px;
}

.oj-api-security-card__icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--oj-api-accent);
  font-size: 12px;
  background: rgba(59, 130, 246, 0.11);
  border-radius: 10px;
}

.oj-api-security-card__copy {
  flex: 1 1 auto;
  margin-top: 16px;
}

.oj-api-security-card__title {
  font-size: 14px;
  font-weight: 700;
}

.oj-api-security-card__body {
  margin-top: 7px;
  color: var(--oj-muted, #929bad);
  font-size: 12px;
  line-height: 1.6;
}

.oj-api-security-card > .oj-api-button {
  width: 100%;
  margin-top: 18px;
}

.oj-api-password-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 18px;
}

.oj-api-password-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.oj-api-password-field label {
  color: var(--oj-muted, #929bad);
  font-size: 11px;
  font-weight: 650;
}

.oj-api-password-field input {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--oj-text, #f3f5f9);
  font: 500 13px/1.4 "JetBrains Mono", monospace;
  background: rgba(2, 6, 23, 0.3);
  border: 1px solid var(--oj-api-border-strong);
  border-radius: 9px;
}

.oj-api-password-field input:focus-visible {
  border-color: rgba(59, 130, 246, 0.72);
  outline: 2px solid rgba(59, 130, 246, 0.24);
  outline-offset: 1px;
}

.oj-api-password-field input[aria-invalid="true"] {
  border-color: rgba(244, 63, 94, 0.72);
}

.oj-api-password-field input:disabled {
  opacity: 0.62;
}

.oj-api-password-form__hint,
.oj-api-password-form__feedback {
  font-size: 11px;
  line-height: 1.5;
}

.oj-api-password-form__hint {
  color: var(--oj-muted, #929bad);
}

.oj-api-password-form__feedback--error {
  color: #fda4af;
}

.oj-api-password-form__feedback--success {
  color: #6ee7b7;
}

.oj-api-password-form > .oj-api-button {
  width: 100%;
  margin-top: 2px;
}

.oj-api-metric-grid--admin {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.oj-api-admin-tables {
  display: grid;
  gap: 20px;
}

.oj-api-admin-block {
  min-width: 0;
}

.oj-api-admin-block__title {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
}

.oj-api-table--compact {
  min-width: 620px;
}

.oj-api-table--compact th,
.oj-api-table--compact td {
  padding: 11px 13px;
}

@keyframes oj-api-pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.92); }
  50% { opacity: 1; transform: scale(1); }
}

@media (max-width: 980px) {
  .oj-api-portal {
    grid-template-columns: 196px minmax(0, 1fr);
  }

  .oj-api-product-grid,
  .oj-api-security-grid {
    grid-template-columns: 1fr;
  }

  .oj-api-metric-grid--admin {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .oj-api-portal {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "header"
      "nav"
      "content";
    width: min(100% - 20px, 720px);
    margin: 16px auto 48px;
    border-radius: 16px;
  }

  .oj-api-header {
    padding: 16px;
  }

  .oj-api-header__user-copy {
    display: none;
  }

  .oj-api-nav {
    flex-direction: row;
    gap: 5px;
    padding: 10px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--oj-api-border);
    scrollbar-width: thin;
  }

  .oj-api-nav__item {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    padding: 8px 11px;
  }

  .oj-api-nav__index {
    display: none;
  }

  .oj-api-content {
    padding: 24px 16px 32px;
  }

  .oj-api-page-head,
  .oj-api-callout {
    flex-direction: column;
    align-items: stretch;
  }

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

  .oj-api-password-field input {
    font-size: 16px;
  }

  .oj-api-product-card__details,
  .oj-api-info-grid {
    grid-template-columns: 1fr;
  }

  .oj-api-state {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .oj-api-state > .oj-api-button {
    width: 100%;
  }
}

@media (max-width: 440px) {
  .oj-api-header__mark {
    width: 36px;
    height: 36px;
  }

  .oj-api-header__brand-copy {
    display: none;
  }

  .oj-api-header__user {
    margin-left: auto;
  }

  .oj-api-header__user .oj-api-button {
    min-height: 36px;
    padding: 7px 10px;
  }

  .oj-api-page-head__title {
    font-size: 24px;
  }

  .oj-api-actions .oj-api-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .oj-api-nav__item,
  .oj-api-button,
  .oj-api-state--loading .oj-api-state__icon {
    animation: none;
    transition: none;
  }
}
