*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e4e4e7;
  --text-muted: #9ca3af;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --green: #22c55e;
  --red: #ef4444;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 8px;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 12px;
}

p.subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

/* Forms */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.15s;
}

.tab-btn:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.tab-btn:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
}

.tab-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.form-group {
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}

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

.btn {
  display: inline-block;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  text-align: center;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn-full {
  width: 100%;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* Alerts */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 16px;
  display: none;
}

.alert-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--red);
  color: var(--red);
}

.alert-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid var(--green);
  color: var(--green);
}

/* Dashboard specifics */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-box .value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-box .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.api-key-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 8px;
}

.api-key-display code {
  flex: 1;
  font-family: "SF Mono", Monaco, Consolas, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.copy-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.revoke-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 4px 10px;
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
}

.revoke-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-header-row h2 {
  margin-bottom: 0;
}

.key-actions {
  display: flex;
  gap: 8px;
}

.api-key-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.tier-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
}

.tier-free {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.tier-paid {
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
}

.tier-enterprise {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.endpoint-list {
  list-style: none;
}

.endpoint-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.endpoint-list li:last-child {
  border-bottom: none;
}

.endpoint-list .count {
  color: var(--accent);
  font-weight: 600;
}

.upgrade-section {
  display: flex;
  gap: 12px;
}

.upgrade-section .btn {
  flex: 1;
}

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

.header h1 {
  margin-bottom: 0;
}

.logout-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.85rem;
}

.logout-btn:hover {
  border-color: var(--red);
  color: var(--red);
}

.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
}

/* Verification */
.verification-banner {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid #fbbf24;
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 20px;
}

.verification-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #fbbf24;
  font-size: 0.9rem;
}

.resend-status {
  font-size: 0.8rem;
  margin-top: 6px;
}

.resend-success {
  color: var(--green);
}

.resend-error {
  color: var(--red);
}

.verified-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
  margin-left: 8px;
  vertical-align: middle;
}

.unverified-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
  margin-left: 8px;
  vertical-align: middle;
}

/* Accordion */
.accordion-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.accordion-arrow {
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.accordion-arrow.open {
  transform: rotate(180deg);
}

/* Password result */
.password-result {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 16px;
}

.password-result.success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid var(--green);
  color: var(--green);
}

.password-result.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid var(--red);
  color: var(--red);
}

/* Danger Zone */
.danger-card {
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger {
  display: inline-block;
  padding: 10px 20px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-danger:hover {
  background: #dc2626;
}

.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 420px;
  width: 100%;
}

.modal-content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--red);
}
