/* ── Reset & base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:            #0d1117;
  --bg-surface:    #161b22;
  --bg-elevated:   #1c2128;
  --bg-hover:      #21262d;
  --border:        #30363d;
  --border-light:  #21262d;
  --text:          #e6edf3;
  --text-secondary:#8b949e;
  --text-muted:    #484f58;
  --accent:        #58a6ff;
  --accent-dim:    #1f3a5c;
  --green:         #3fb950;
  --green-dim:     #1a3a24;
  --red:           #f85149;
  --red-dim:       #3d1f1f;
  --yellow:        #d29922;
  --yellow-dim:    #3a2d0e;
  --sidebar-w:     220px;
  --radius:        8px;
  --radius-sm:     5px;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text);
}
.hidden { display: none !important; }

/* ── Auth screens ────────────────────────────────────────────────────── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 28px;
}
.logo-icon {
  font-size: 24px;
  color: var(--accent);
}
.logo-text {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.auth-sub {
  color: var(--text-secondary);
  margin-bottom: 28px;
}
.auth-footer {
  text-align: center;
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ── Forms ───────────────────────────────────────────────────────────── */
.field-group {
  margin-bottom: 16px;
}
.field-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field-hint {
  font-weight: 400;
  color: var(--text-muted);
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
input, select, textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
input:focus, select:focus {
  border-color: var(--accent);
}
input::placeholder { color: var(--text-muted); }
select option { background: var(--bg-elevated); }

.form-error {
  background: var(--red-dim);
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.btn-primary:hover { opacity: 0.85; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary.btn-full { width: 100%; padding: 11px; font-size: 15px; }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--text-secondary); color: var(--text); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover { background: var(--red-dim); border-color: var(--red); }

.btn-copy {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  width: 100%;
  transition: all 0.15s;
}
.btn-copy:hover { border-color: var(--accent); color: var(--accent); }

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.btn-logout:hover { color: var(--red); border-color: var(--red); }

/* ── Dashboard layout ────────────────────────────────────────────────── */
#dashboard {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 20px 0;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 20px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 8px;
}
.env-badge {
  margin-left: auto;
  background: var(--yellow-dim);
  color: var(--yellow);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  flex: 1;
  padding: 0 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 14px;
  text-decoration: none;
  transition: all 0.15s;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-dim); color: var(--accent); font-weight: 500; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 16px 12px 0;
  border-top: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 8px;
}
.dev-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.dev-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dev-details { min-width: 0; }
.dev-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dev-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Main content ────────────────────────────────────────────────────── */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  background: var(--bg);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 { font-size: 20px; font-weight: 700; }
.page-sub { color: var(--text-secondary); font-size: 13px; margin-top: 2px; }

/* ── Stat cards ──────────────────────────────────────────────────────── */
.cards-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.stat-value {
  font-size: 24px;
  font-weight: 700;
}
.stat-value.accent { color: var(--accent); }
.stat-value.green  { color: var(--green); }
.stat-value.red    { color: var(--red); }

/* ── Section cards ───────────────────────────────────────────────────── */
.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.section-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-card-header h3 { font-size: 15px; font-weight: 600; }

/* ── Quick start ─────────────────────────────────────────────────────── */
.quickstart { display: flex; flex-direction: column; gap: 12px; }
.qs-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.qs-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 700;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.qs-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.qs-code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: nowrap;
}
.qs-code code { background: none; padding: 0; }

/* ── Resources ───────────────────────────────────────────────────────── */
.resources-grid { display: flex; flex-direction: column; gap: 8px; }
.resource-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s;
}
.resource-link:hover { border-color: var(--accent); text-decoration: none; }
.resource-icon { font-size: 20px; color: var(--accent); width: 24px; text-align: center; }
.resource-title { font-weight: 500; font-size: 13px; }
.resource-sub { font-size: 12px; color: var(--text-secondary); }

/* ── Data tables ─────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 16px;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.data-table th:first-child { border-radius: var(--radius) 0 0 0; }
.data-table th:last-child  { border-radius: 0 var(--radius) 0 0; }
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-elevated); }
.table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px !important;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-green  { background: var(--green-dim);  color: var(--green); }
.badge-red    { background: var(--red-dim);    color: var(--red); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-blue   { background: var(--accent-dim); color: var(--accent); }

.key-prefix {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Modals ──────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}
.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px;
  width: 100%;
  max-width: 460px;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

/* Key reveal */
.key-reveal-warning {
  background: var(--yellow-dim);
  border: 1px solid var(--yellow);
  color: var(--yellow);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
.key-reveal-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  word-break: break-all;
  margin-bottom: 10px;
  color: var(--green);
}

/* ── Checkboxes ──────────────────────────────────────────────────────── */
.checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
}
.checkbox-item input[type="checkbox"] {
  width: auto;
  margin-top: 2px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* ── Info banner ─────────────────────────────────────────────────────── */
.info-banner {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--text-secondary);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.info-banner strong { color: var(--text); }
.info-banner code { background: rgba(255,255,255,0.07); }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .cards-row { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  #dashboard { flex-direction: column; }
  .sidebar { width: 100%; height: auto; border-right: none; border-bottom: 1px solid var(--border); padding: 12px 0; }
  .sidebar-nav { display: flex; overflow-x: auto; padding: 0 8px; }
  .nav-item { white-space: nowrap; }
  .sidebar-footer { padding-top: 12px; }
  .main-content { padding: 20px 16px; }
  .cards-row { grid-template-columns: 1fr 1fr; }
}
