/* ── API Keys page ── */

/* Unauthenticated gate */
.ak-gate {
  display: flex;
  justify-content: flex-start;
  padding: 16px 0 0;
}

.ak-gate-card {
  text-align: left;
  max-width: 480px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 24px;
  background: var(--bg-panel);
  border: 1px solid var(--glass-border-color, rgba(255,255,255,0.08));
  border-radius: 14px;
  padding: 28px 32px;
  width: 100%;
}

.ak-gate-icon {
  margin: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: rgba(0, 238, 255, 0.06);
  border: 1px solid rgba(0, 238, 255, 0.18);
  border-radius: 12px;
}

.ak-gate-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.ak-gate-card h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.ak-gate-card p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.9rem;
}

.ak-gate-card a.primary {
  margin-top: 4px;
  align-self: flex-start;
  padding: 10px 20px;
  font-size: 0.9rem;
}

/* Main section */
.ak-section {
  max-width: 720px;
  margin: 48px auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header row */
.ak-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.ak-tier-note {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin: 4px 0 0;
}

.ak-tier-note a {
  color: var(--color-accent);
}

/* Key list */
.ak-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--grid-line);
  border-radius: 8px;
  overflow: hidden;
}

.ak-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--color-surface, #fff);
  border-bottom: 1px solid var(--grid-line);
}

.ak-row:last-child {
  border-bottom: none;
}

.ak-row-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.ak-row-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ak-row-prefix {
  font-size: 0.8rem;
  color: var(--color-muted);
  background: none;
  padding: 0;
  letter-spacing: 0.02em;
}

.ak-row-meta {
  font-size: 0.78rem;
  color: var(--color-muted);
}

.ak-revoke {
  flex-shrink: 0;
  font-size: 0.82rem;
  padding: 4px 12px;
  color: var(--color-danger, #c0392b);
  border-color: var(--color-danger, #c0392b);
}

.ak-revoke:hover {
  background: color-mix(in srgb, var(--color-danger, #c0392b) 8%, transparent);
}

/* Empty state */
.ak-empty {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin: 0;
  padding: 20px 0;
  text-align: center;
}

/* Create form */
.ak-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.ak-name-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--grid-line);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--color-surface, #fff);
  color: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.ak-name-input:focus {
  border-color: var(--color-accent);
}

.ak-limit-reached {
  font-size: 0.88rem;
  color: var(--color-muted);
  margin: 0;
}

.ak-limit-reached a {
  color: var(--color-accent);
}

/* Error message */
.ak-error {
  font-size: 0.85rem;
  color: var(--color-danger, #c0392b);
  margin: 0;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--color-danger, #c0392b) 30%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--color-danger, #c0392b) 6%, transparent);
}

/* Usage example */
.ak-usage {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--grid-line);
}

.ak-usage .code-block {
  font-size: 0.8rem;
  overflow-x: auto;
  white-space: pre;
}

/* One-time reveal modal */
.ak-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.ak-modal[hidden] {
  display: none;
}

.ak-modal-box {
  background: var(--color-surface, #fff);
  border: 1px solid var(--grid-line);
  border-radius: 12px;
  padding: 32px;
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
}

.ak-modal-box h2 {
  margin: 0;
  font-size: 1.2rem;
}

.ak-modal-warn {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin: 0;
}

.ak-modal-key {
  display: block;
  font-size: 0.82rem;
  padding: 12px 14px;
  background: var(--color-bg, #f8f8f8);
  border: 1px solid var(--grid-line);
  border-radius: 6px;
  word-break: break-all;
  letter-spacing: 0.03em;
  user-select: all;
}

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

/* Mobile */
@media (max-width: 600px) {
  .ak-form {
    flex-direction: column;
    align-items: stretch;
  }

  .ak-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .ak-revoke {
    align-self: flex-end;
  }

  .ak-modal-actions {
    flex-direction: column-reverse;
  }
}
