:root {
  --bg: #1c1c1c;
  --bg-overlay: #242424;
  --bg-surface: #171717;
  --bg-input: #1e1e1e;
  --border: #2e2e2e;
  --border-strong: #3a3a3a;
  --text: #ededed;
  --text-muted: #a1a1a1;
  --text-light: #6e6e6e;
  --brand: #3ecf8e;
  --brand-hover: #2db77a;
  --brand-bg: rgba(62,207,142,0.1);
  --danger: #f87171;
  --danger-bg: rgba(248,113,113,0.1);
  --warning: #fbbf24;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, -apple-system, sans-serif; font-size: 14px; line-height: 1.5; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ── */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--bg-surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.main { flex: 1; overflow-y: auto; }

/* ── Topbar ── */
.topbar { height: 56px; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 20px; gap: 12px; background: var(--bg-surface); }
.topbar-logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.topbar-logo svg { color: var(--brand); }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; cursor: pointer; }
.topbar-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--brand-bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--brand); font-size: 12px; }
.org-badge { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted); }

/* ── Sidebar ── */
.sidebar-section { padding: 8px 0; border-bottom: 1px solid var(--border); }
.sidebar-label { padding: 8px 16px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-light); font-weight: 600; }
.sidebar-item { display: flex; align-items: center; gap: 10px; padding: 8px 16px; color: var(--text-muted); cursor: pointer; transition: all 0.15s; border-radius: 0; font-size: 13px; border: none; background: none; width: 100%; text-align: left; }
.sidebar-item:hover { background: var(--bg-overlay); color: var(--text); }
.sidebar-item.active { background: var(--brand-bg); color: var(--brand); }
.sidebar-item svg { flex-shrink: 0; }

/* ── Content ── */
.content { padding: 32px 40px; max-width: 900px; }
.page-header { margin-bottom: 28px; }
.page-title { font-size: 22px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.page-subtitle { color: var(--text-muted); font-size: 14px; }

/* ── Cards ── */
.card { background: var(--bg-overlay); border: 1px solid var(--border); border-radius: var(--radius); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 15px; font-weight: 600; }
.card-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── Project Grid ── */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 20px; }
.project-card { background: var(--bg-overlay); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; position: relative; }
.project-card:hover { border-color: var(--border-strong); box-shadow: 0 2px 12px rgba(0,0,0,0.3); }
.project-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.project-card-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--brand-bg); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; color: var(--brand); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 4px; }
.status-dot.active { background: var(--brand); box-shadow: 0 0 6px var(--brand); }
.status-dot.paused { background: var(--text-light); }
.project-name { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.project-id { font-size: 12px; color: var(--text-muted); font-family: monospace; margin-bottom: 16px; }
.project-meta { font-size: 12px; color: var(--text-light); margin-bottom: 16px; }
.project-actions { display: flex; gap: 8px; }
.project-card-menu { position: absolute; top: 16px; right: 16px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all 0.15s; white-space: nowrap; }
.btn-primary { background: var(--brand); color: #000; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: transparent; color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--bg-overlay); border-color: #555; }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { background: transparent; color: var(--text-muted); padding: 4px 8px; }
.btn-ghost:hover { color: var(--text); background: var(--bg-overlay); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-muted); }
.form-input { width: 100%; padding: 8px 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-size: 14px; outline: none; transition: border-color 0.15s; }
.form-input:focus { border-color: var(--brand); }
.form-input:disabled { opacity: 0.6; cursor: not-allowed; }
.form-input.mono { font-family: monospace; font-size: 12px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.input-copy-row { display: flex; gap: 8px; }
.input-copy-row .form-input { flex: 1; }

/* ── Key display ── */
.key-box { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; font-family: monospace; font-size: 12px; color: var(--text); word-break: break-all; position: relative; }
.key-row { display: flex; gap: 10px; align-items: flex-start; }
.key-row .key-box { flex: 1; }
.key-masked { filter: blur(4px); user-select: none; }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 24px; }
.tab { padding: 10px 16px; font-size: 13px; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.15s; background: none; border-top: none; border-left: none; border-right: none; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 16px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 500; border-bottom: 1px solid var(--border); }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
tr:last-child td { border-bottom: none; }
.token-preview { font-family: monospace; font-size: 12px; color: var(--text-muted); }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-green { background: var(--brand-bg); color: var(--brand); }
.badge-gray { background: rgba(100,100,100,0.2); color: var(--text-muted); }
.badge-red { background: var(--danger-bg); color: var(--danger); }

/* ── Modal ── */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.7); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--bg-overlay); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; width: 480px; max-width: 95vw; box-shadow: var(--shadow); }
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.hidden { display: none !important; }

/* ── Alert ── */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; border: 1px solid; }
.alert-info { background: var(--brand-bg); border-color: rgba(62,207,142,0.3); color: #7eeabc; }
.alert-danger { background: var(--danger-bg); border-color: rgba(248,113,113,0.3); color: var(--danger); }
.alert-warning { background: rgba(251,191,36,0.1); border-color: rgba(251,191,36,0.3); color: var(--warning); }

/* ── Toast ── */
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast-item { padding: 12px 18px; border-radius: var(--radius-sm); font-size: 13px; box-shadow: var(--shadow); animation: slideIn 0.2s ease; }
.toast-success { background: #1a3a2a; border: 1px solid rgba(62,207,142,0.4); color: var(--brand); }
.toast-error { background: #3a1a1a; border: 1px solid rgba(248,113,113,0.4); color: var(--danger); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── Login page ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { width: 380px; padding: 40px; }
.login-logo { display: flex; align-items: center; justify-content: center; margin-bottom: 32px; }
.login-title { font-size: 20px; font-weight: 600; text-align: center; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text-muted); text-align: center; margin-bottom: 28px; }
.login-error { display: none; }

/* ── Danger zone ── */
.danger-zone { border: 1px solid rgba(248,113,113,0.3); border-radius: var(--radius); }
.danger-zone .card-header { border-color: rgba(248,113,113,0.2); }
.danger-row { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid rgba(248,113,113,0.1); }
.danger-row:last-child { border-bottom: none; }
.danger-title { font-weight: 500; font-size: 14px; }
.danger-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Section divider ── */
.section-divider { margin: 28px 0; border: none; border-top: 1px solid var(--border); }

/* ── Utility ── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-danger { color: var(--danger); }
.text-brand { color: var(--brand); }
.mono { font-family: monospace; }
.w-full { width: 100%; }
.empty-state { padding: 48px; text-align: center; color: var(--text-muted); }
.empty-state-icon { font-size: 36px; margin-bottom: 12px; }
