/* Nexus — Shared Design System
   Imported by all Nexus pages. Each page overrides:
   --accent, --accent-light, --accent-hover */

/* ============ Design Tokens ============ */
:root {
  /* Backgrounds */
  --bg-0: #0a0a0b;
  --bg-1: #111113;
  --bg-2: #18181b;
  --bg-3: #222225;

  /* Text */
  --text-0: #fafafa;
  --text-1: #ececef;
  --text-2: #a0a0ab;
  --text-3: #63636e;

  /* Borders & Shadows */
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.1);
  --radius: 8px;
  --radius-lg: 12px;
  --radius-sm: 6px;
  --shadow: 0 0 0 1px var(--border), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-hover: 0 0 0 1px var(--border-hover), 0 4px 12px rgba(0,0,0,0.5);

  /* Semantic */
  --success: #22c55e;
  --warning: #eab308;
  --error: #ef4444;

  /* Timing */
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* ============ Base ============ */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-0);
  color: var(--text-1);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent, #10b981); text-decoration: none; }
a:visited { color: var(--accent, #10b981); }
a:hover { text-decoration: underline; }

/* ============ Utilities ============ */
.hidden { display: none !important; }

/* ============ Header ============ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 11, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}
.header-brand:hover { text-decoration: none; }

.header-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.header-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }

.header-brand h1 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-0);
  letter-spacing: -0.01em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.header-nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}
.header-nav-link:hover {
  color: var(--text-1);
  background: var(--bg-2);
  text-decoration: none;
}
.header-nav-link.active {
  color: var(--text-0);
  background: var(--bg-3);
}
.header-nav-link.logout { color: var(--text-3); }
.header-nav-link.logout:hover { color: var(--error); background: rgba(239,68,68,0.1); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.header-user { color: var(--text-3); font-size: 0.75rem; }
.header-link {
  color: var(--text-3);
  font-size: 0.75rem;
  text-decoration: none;
  transition: color var(--transition);
}
.header-link:hover { color: var(--text-2); }
.header-sep { width: 1px; height: 16px; background: var(--border); }

/* ============ Top Bar (back nav) ============ */
.topbar { background: var(--bg-0); border-bottom: 1px solid var(--border); padding: 0.35rem 1.5rem; }
.topbar-inner { max-width: 960px; margin: 0 auto; display: flex; justify-content: flex-end; }
.topbar a { font-size: 0.75rem; color: var(--text-3); text-decoration: none; display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.375rem 0.75rem; border-radius: 6px; transition: color var(--transition), background var(--transition); }
.topbar a:hover { color: var(--text-1); background: var(--bg-2); }
.topbar svg { width: 12px; height: 12px; fill: currentColor; }

/* ============ Sub Navigation ============ */
.sub-nav {
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  background: var(--bg-0);
}
.sub-nav-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  height: 40px;
}
.sub-nav-link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-3);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}
.sub-nav-link:hover {
  color: var(--text-1);
  text-decoration: none;
}
.sub-nav-link.active {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
}

/* ============ Login ============ */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90vh;
}

.login-card, .login-form {
  background: var(--bg-1);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-logo {
  width: 48px;
  height: 48px;
  margin: 0 auto 1.25rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }

.login-card h2, .login-form h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-0);
  margin-bottom: 0.35rem;
}
.login-card p, .login-form p {
  color: var(--text-3);
  font-size: 0.8rem;
  margin-bottom: 2rem;
  line-height: 1.4;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 1.25rem;
  background: white;
  color: #1f1f1f;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: box-shadow var(--transition);
}
.google-btn:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.25); }
.google-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ============ Buttons (.btn) ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  color: white;
}
.btn-primary { background: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-3); color: var(--text-1); border-color: var(--border-hover); }
.btn-danger { background: rgba(239,68,68,0.12); color: var(--error); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn svg { width: 14px; height: 14px; fill: currentColor; }

/* ============ Cards ============ */
.card {
  background: var(--bg-1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-hover); }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.card-title { font-weight: 600; }
.card-subtitle { color: var(--text-2); font-size: 0.8rem; margin-top: 0.25rem; }
.card-body { padding: 1.5rem; }

/* ============ Modals ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg-1);
  padding: 2rem;
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px var(--border), 0 8px 32px rgba(0,0,0,0.6);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal h3 { margin-bottom: 1.5rem; }

/* ============ Tables ============ */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-3); font-weight: 600; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
tr:hover td { background: rgba(255,255,255,0.02); }

/* ============ Forms ============ */
.form-group { margin-bottom: 1rem; }
.form-group label, .form-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-3);
  font-size: 0.75rem;
  font-weight: 500;
}
.form-group input, .form-group textarea, .form-group select, .form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-family: inherit;
  font-size: 0.8rem;
  transition: border-color var(--transition);
}
.form-group input:focus, .form-group textarea:focus, .form-input:focus {
  outline: none;
  border-color: var(--accent);
}
textarea.form-input {
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  resize: vertical;
}
.form-hint { color: var(--text-3); font-size: 0.7rem; margin-top: 0.25rem; }

.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-1);
  cursor: pointer;
}
.checkbox-grid input[type="checkbox"] { width: auto; }

.modal-actions, .modal-footer {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}
.modal-footer {
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.error-message, .error-msg { color: var(--error); font-size: 0.75rem; margin-top: 0.4rem; }

/* ============ Badges ============ */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

/* ============ Empty State ============ */
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-2);
}

/* ============ Segmented Control ============ */
.seg-nav {
  display: flex;
  gap: 0.25rem;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.25rem;
  margin-bottom: 1.5rem;
}
.seg-btn {
  flex: 1;
  text-align: center;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.seg-btn:hover {
  background: var(--bg-2);
  color: var(--text-1);
}
.seg-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
}
