/* AI Radar Design System — Modern Tech Intelligence Aesthetic */
:root {
  --canvas: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --border-subtle: #edf2f7;
  --border-focus: #818cf8;
  --text-main: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --brand: #4f46e5;
  --brand-hover: #4338ca;
  --brand-soft: #eef2ff;
  --brand-border: #c7d2fe;
  --green: #059669;
  --green-soft: #ecfdf5;
  --green-border: #a7f3d0;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;
  --red: #dc2626;
  --red-soft: #fef2f2;
  --red-border: #fecaca;
  --sidebar-bg: #0b0f19;
  --sidebar-surface: #131b2e;
  --sidebar-border: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-bright: #f8fafc;
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.07), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --shadow-card-hover: 0 12px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 6px -2px rgba(15, 23, 42, 0.03);
}

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

html {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", -system-ui, sans-serif;
  color: var(--text-body);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

body.menu-open {
  overflow: hidden;
}

/* Typography & Headings */
h1, h2, h3, h4, p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.025em;
  color: var(--text-main);
}

h2 {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

h3 {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.015em;
  color: var(--text-main);
}

h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

p {
  margin-top: 6px;
  margin-bottom: 12px;
}

small {
  font-size: 12px;
  color: var(--text-muted);
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--brand-hover);
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Form Controls */
input, textarea, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #ffffff;
  color: var(--text-main);
  font-size: 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 6px;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.custom-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  user-select: none;
}

.custom-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

/* Base Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #ffffff;
  color: var(--text-body);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.button:hover {
  background: var(--surface-alt);
  color: var(--text-main);
  border-color: #cbd5e1;
}

.button.primary {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
  box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3), 0 1px 2px rgba(79, 70, 229, 0.2);
}

.button.primary:hover {
  background: var(--brand-hover);
  border-color: var(--brand-hover);
  box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

.button-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-xs);
}

.full {
  width: 100%;
}

.action-glow {
  position: relative;
}

/* Layout Shell */
.workspace {
  margin-left: 240px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--canvas);
}

main {
  max-width: 1440px;
  width: 100%;
  padding: 28px 36px 40px;
  margin: 0 auto;
  flex: 1;
}

/* Sidebar Backdrop */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(11, 15, 25, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 40;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

/* Sidebar Navigation */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 240px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  overflow-y: auto;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.sidebar-close {
  display: none;
  color: var(--sidebar-text);
  padding: 6px 8px;
  font-size: 16px;
  border-radius: var(--radius-xs);
}

.sidebar-close:hover {
  background: var(--sidebar-surface);
  color: #ffffff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand:hover {
  color: #ffffff;
}

.brand-text {
  line-height: 1.15;
}

.brand-text small {
  display: block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #818cf8;
}

.brand-mark {
  position: relative;
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.4);
}

.brand-ring {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
  border-radius: 50%;
}

.brand-dot {
  width: 6px;
  height: 6px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 0 6px #ffffff;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #475569;
  text-transform: uppercase;
  margin: 0 10px 10px;
}

.sidebar nav {
  display: grid;
  gap: 3px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.sidebar nav a:hover {
  background: var(--sidebar-surface);
  color: #ffffff;
}

.sidebar nav a.active {
  background: rgba(79, 70, 229, 0.16);
  color: #ffffff;
  font-weight: 600;
  border: 1px solid rgba(129, 140, 248, 0.25);
}

.nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #475569;
  transition: all 0.15s ease;
}

.sidebar nav a:hover .nav-dot {
  background: #818cf8;
}

.sidebar nav a.active .nav-dot {
  background: #818cf8;
  box-shadow: 0 0 8px #818cf8;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--sidebar-border);
}

.user-card {
  background: var(--sidebar-surface);
  border: 1px solid var(--sidebar-border);
  border-radius: var(--radius-md);
  padding: 10px;
}

.user-profile-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  overflow: hidden;
}

.user-avatar-icon {
  width: 28px;
  height: 28px;
  background: rgba(79, 70, 229, 0.2);
  color: #818cf8;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-email {
  display: block;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--sidebar-text-bright);
}

.user-role-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #818cf8;
}

.user-role-badge.admin {
  color: #34d399;
}

.user-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-link-btn {
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  padding: 3px 6px;
  border-radius: var(--radius-xs);
}

.admin-link-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.logout-form {
  margin: 0;
}

.logout-btn {
  font-size: 11px;
  color: #94a3b8;
  padding: 3px 6px;
}

.logout-btn:hover {
  color: #f87171;
}

.guest-card {
  padding: 6px 4px;
}

.guest-desc {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 10px;
  line-height: 1.4;
}

.button-login {
  background: var(--sidebar-surface);
  color: #cbd5e1;
  border-color: var(--sidebar-border);
}

.button-login:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

/* Topbar */
.topbar {
  height: 60px;
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 30;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.crumb-root {
  color: var(--text-muted);
  font-weight: 500;
}

.crumb-root:hover {
  color: var(--brand);
}

.crumb-sep {
  color: var(--border);
}

.crumb-current {
  color: var(--text-main);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.system-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--text-body);
  box-shadow: var(--shadow-xs);
}

.live-dot {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  box-shadow: 0 0 0 3px var(--green-border);
  animation: pulse-ring 2.5s infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 2px var(--green-border); }
  50% { box-shadow: 0 0 0 5px rgba(167, 243, 208, 0.5); }
  100% { box-shadow: 0 0 0 2px var(--green-border); }
}

.pill-title {
  font-weight: 600;
  color: var(--text-main);
}

.pill-meta {
  color: var(--text-muted);
  font-size: 11px;
}

.topbar-ask-btn {
  display: none;
}

.icon-button {
  display: none;
  color: var(--text-main);
  padding: 8px;
  border-radius: var(--radius-sm);
  background: transparent;
}

.menu-bar {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  margin: 3px 0;
  border-radius: 1px;
  transition: all 0.2s ease;
}

/* Page Heading */
.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

.eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--brand);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 6px;
  margin-bottom: 0;
  max-width: 680px;
}

/* Stats Overview */
.stats-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
}

.stat-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  display: grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-card.stat-accent {
  background: linear-gradient(135deg, #ffffff, #faf5ff);
  border-color: #ddd6fe;
}

.stat-card.stat-accent .stat-icon-wrap {
  background: #f3e8ff;
}

.stat-card.stat-accent .stat-num {
  color: #7c3aed;
}

.stat-details {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-num {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.stat-caption {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 2px;
}

/* Content Layout (Main + Right Rail) */
.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 28px;
  align-items: start;
}

.main-column {
  min-width: 0;
}

/* Section Toolbar */
.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.toolbar-title-wrap h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.section-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.badge-accent {
  font-size: 10px;
  font-weight: 700;
  background: var(--brand-soft);
  color: var(--brand);
  border: 1px solid var(--brand-border);
  padding: 3px 8px;
  border-radius: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-neutral {
  font-size: 10px;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.search-box {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 4px 0 10px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.search-icon {
  font-size: 15px;
  color: var(--text-light);
  margin-right: 6px;
}

.search-box input {
  border: none;
  padding: 8px 4px;
  font-size: 13px;
  width: 170px;
  box-shadow: none;
}

.search-box input:focus {
  box-shadow: none;
}

.search-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  color: var(--text-muted);
  border-radius: var(--radius-xs);
}

.search-btn:hover {
  background: var(--surface-alt);
  color: var(--text-main);
}

/* Intelligence Cards Stack */
.card-stack {
  display: grid;
  gap: 20px;
}

.intelligence-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.intelligence-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-1px);
}

.card-header {
  display: flex;
  align-items: flex-start;
  gap: 18px;
}

.card-score {
  background: linear-gradient(135deg, var(--brand-soft), #ffffff);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius-md);
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
}

.score-num {
  font-size: 21px;
  font-weight: 800;
  line-height: 1;
  color: var(--brand);
  letter-spacing: -0.02em;
}

.score-sub {
  font-size: 8px;
  font-weight: 700;
  color: #6366f1;
  letter-spacing: 0.1em;
  margin-top: 3px;
}

.card-heading-group {
  flex: 1;
  min-width: 0;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.category-pill {
  font-size: 11px;
  font-weight: 700;
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
  padding: 2px 8px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.subcategory-pill {
  font-size: 11px;
  font-weight: 600;
  background: var(--surface-alt);
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 4px;
}

.meta-dot {
  color: var(--border);
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  overflow-wrap: break-word;
}

.card-title a {
  color: var(--text-main);
  transition: color 0.15s ease;
}

.card-title a:hover {
  color: var(--brand);
}

.card-source-bar {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.source-provider strong {
  color: var(--text-body);
}

.card-signal-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-alt);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.card-signal-btn:hover {
  background: var(--brand);
  color: #ffffff;
}

.card-summary {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-body);
  margin: 16px 0;
}

/* Why It Matters Callout */
.why-box {
  background: #f8faff;
  border: 1px solid #e0e7ff;
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.why-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--brand);
}

.why-star {
  font-size: 12px;
}

.why-desc {
  font-size: 13px;
  line-height: 1.55;
  color: #334155;
  margin: 6px 0 0;
}

/* Metrics Grid on Card */
.card-metrics-grid {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.metric-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.metric-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.metric-personal {
  margin-left: auto;
  color: #7c3aed;
}

.metric-personal .metric-val {
  color: #7c3aed;
}

/* Card Actions Row */
.card-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.card-user-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.action-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-body);
  border-radius: var(--radius-xs);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.action-button:hover {
  background: var(--surface-alt);
  border-color: #cbd5e1;
  color: var(--text-main);
}

.action-button.selected, .action-button.is-active {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand-border);
}

.action-button.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--text-light);
}

.action-button.quiet:hover {
  background: #fee2e2;
  color: var(--red);
}

.btn-research {
  background: linear-gradient(135deg, #ffffff, var(--brand-soft));
  color: var(--brand);
  border-color: var(--brand-border);
}

.btn-research:hover {
  background: var(--brand);
  color: #ffffff;
}

.card-link-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.card-read-link {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
}

.card-read-link:hover {
  text-decoration: underline;
}

.source-link {
  font-size: 12px;
  color: var(--text-muted);
}

.source-link:hover {
  color: var(--text-main);
}

/* Right Rail Panels */
.right-rail {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-header-sm {
  margin-bottom: 12px;
}

.editorial-card {
  background: linear-gradient(145deg, #0b0f19, #172038);
  color: #ffffff;
  border-color: #1e293b;
  position: relative;
  overflow: hidden;
}

.editorial-card h3 {
  color: #ffffff;
  font-size: 18px;
  margin-top: 8px;
}

.editorial-card p {
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.card-kicker {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #818cf8;
}

.mini-signal-graphic {
  display: flex;
  align-items: center;
  gap: 6px;
}

.radar-wave {
  height: 2px;
  background: rgba(129, 140, 248, 0.4);
  border-radius: 1px;
}

.wave-1 { width: 14px; }
.wave-2 { width: 22px; }

.radar-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #818cf8;
  box-shadow: 0 0 10px #818cf8;
}

.category-pills-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cat-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-body);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.cat-pill:hover {
  background: #ffffff;
  border-color: var(--border);
  color: var(--brand);
}

.cat-pill.active {
  background: var(--brand-soft);
  border-color: var(--brand-border);
  color: var(--brand);
  font-weight: 600;
}

/* Admin Pipeline in Rail */
.admin-pipeline-panel {
  background: #ffffff;
  border-color: #cbd5e1;
}

.pipeline-lines {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.pipeline-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 12px;
}

.status-good {
  background: var(--green-soft);
  color: var(--green);
  border: 1px solid var(--green-border);
}

.status-warning {
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid var(--amber-border);
}

.status-failed {
  background: var(--red-soft);
  color: var(--red);
  border: 1px solid var(--red-border);
}

.pending-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 0;
}

.pending-dot {
  width: 6px;
  height: 6px;
  background: var(--amber);
  border-radius: 50%;
}

.admin-panel-footer {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.text-link-sm {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
}

.jobs-compact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.job-mini-item {
  display: block;
  background: var(--surface-alt);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text-body);
}

.job-mini-item:hover {
  background: #ffffff;
  border-color: var(--border);
}

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

.job-mini-id {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
}

.job-mini-status {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.job-mini-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
}

.muted-sm {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Pagination Bar */
.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 32px 0 10px;
}

.page-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  box-shadow: var(--shadow-xs);
  transition: all 0.15s ease;
}

.page-link:hover:not(.disabled) {
  background: var(--surface-alt);
  border-color: #cbd5e1;
  color: var(--text-main);
}

.page-link.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-info {
  font-size: 13px;
  color: var(--text-muted);
}

.page-info strong {
  color: var(--text-main);
}

/* Empty State */
.empty-state {
  text-align: center;
  background: #ffffff;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 50px 30px;
}

.empty-symbol {
  font-size: 40px;
  color: var(--brand);
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 18px;
  color: var(--text-main);
}

.empty-state p {
  color: var(--text-muted);
  max-width: 440px;
  margin: 8px auto 0;
}

/* GitHub Radar Page */
.inline-add-form {
  margin: 0;
}

.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn input {
  width: 220px;
}

.repo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.repo-card {
  display: flex;
  flex-direction: column;
}

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

.repo-badges {
  display: flex;
  gap: 8px;
}

.lang-tag {
  font-size: 11px;
  font-weight: 600;
  background: #eff6ff;
  color: #2563eb;
  padding: 3px 8px;
  border-radius: 4px;
}

.license-tag {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-alt);
  padding: 3px 8px;
  border-radius: 4px;
}

.repo-ext-btn {
  font-size: 14px;
  color: var(--text-muted);
  padding: 4px;
}

.repo-ext-btn:hover {
  color: var(--brand);
}

.repo-title {
  font-size: 18px;
  margin-bottom: 6px;
}

.repo-title a {
  color: var(--text-main);
}

.repo-title a:hover {
  color: var(--brand);
}

.repo-description {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-muted);
  flex: 1;
  margin-bottom: 16px;
}

.repo-stars-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 14px;
}

.star-icon {
  color: #f59e0b;
  font-size: 18px;
}

.star-count {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.star-label {
  font-size: 12px;
  color: var(--text-muted);
}

.velocity-box {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 14px;
}

.velocity-col {
  text-align: center;
  border-right: 1px solid var(--border);
}

.velocity-col:last-child {
  border-right: none;
}

.velocity-val {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: var(--green);
}

.velocity-sub {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.growth-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-body);
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.repo-stats-mini {
  display: flex;
  gap: 12px;
  color: var(--text-muted);
}

.repo-card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.footer-dot {
  color: var(--border);
}

/* Ask AI Studio */
.ask-studio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}

.ask-studio-card {
  padding: 30px 32px;
}

.ask-brand-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--brand);
  margin-bottom: 8px;
}

.ask-studio-header h2 {
  font-size: 22px;
  margin-bottom: 6px;
}

.ask-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.suggested-prompts-wrap {
  margin-bottom: 20px;
}

.suggest-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.suggest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.suggest-chip {
  font-size: 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-body);
  padding: 6px 12px;
  border-radius: 20px;
  transition: all 0.15s ease;
  text-align: left;
}

.suggest-chip:hover {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: var(--brand-border);
}

.filter-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.ask-options-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.checkbox-group {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.ask-submit-btn {
  padding: 10px 24px;
}

/* Ask Answer Container */
.answer-container {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.ask-loading-state {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.pulsing-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(79, 70, 229, 0.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.loading-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.loading-text strong {
  color: var(--text-main);
  font-size: 14px;
}

.loading-text span {
  font-size: 12px;
  color: var(--text-muted);
}

.answer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.answer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 4px 10px;
  border-radius: 20px;
}

.retrieval-pill {
  font-size: 11px;
  color: var(--text-muted);
}

.retrieval-pill code {
  background: var(--surface-alt);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.answer-body {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-main);
  white-space: pre-wrap;
  margin-bottom: 24px;
}

.answer-sources-section {
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

.answer-sources-section h4 {
  font-size: 13px;
  margin-bottom: 12px;
  color: var(--text-muted);
}

.answer-sources-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.source-citation-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-body);
  transition: all 0.15s ease;
}

.source-citation-card:hover {
  background: #ffffff;
  border-color: var(--brand);
}

.citation-index {
  font-weight: 700;
  color: var(--brand);
  font-size: 12px;
}

.citation-content {
  flex: 1;
  min-width: 0;
}

.citation-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.citation-name {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Ask Pipeline Steps */
.ask-pipeline-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ask-pipeline-steps li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.step-text {
  font-size: 12px;
  color: var(--text-body);
  line-height: 1.45;
}

.step-text strong {
  display: block;
  color: var(--text-main);
}

.pipeline-guarantee {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
}

.guarantee-icon {
  font-size: 16px;
  color: var(--green);
}

.pipeline-guarantee p {
  font-size: 12px;
  color: #166534;
  margin: 0;
  line-height: 1.45;
}

/* Job View */
.timeline-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.timeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  margin-top: 6px;
  flex-shrink: 0;
}

.timeline-body strong {
  font-size: 13px;
  color: var(--text-main);
}

.timeline-msg {
  font-size: 13px;
  color: var(--text-body);
  margin: 3px 0;
}

.timeline-time {
  font-size: 11px;
  color: var(--text-muted);
}

.structured-report {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.report-section-group {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.report-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 6px;
}

.report-text {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-body);
  margin: 0;
}

.report-list {
  padding-left: 20px;
  margin: 6px 0;
  font-size: 13px;
  color: var(--text-body);
  line-height: 1.6;
}

/* Profile Page */
.profile-panel {
  max-width: 740px;
  margin: 0 auto;
}

.interest-chips-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.interest-checkbox-card {
  cursor: pointer;
  margin: 0;
}

.interest-checkbox-card input {
  display: none;
}

.interest-card-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.interest-checkbox-card:hover .interest-card-inner {
  border-color: var(--border-focus);
}

.interest-check-indicator {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 10px;
  flex-shrink: 0;
}

.interest-checkbox-card input:checked + .interest-card-inner {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
}

.interest-checkbox-card input:checked + .interest-card-inner .interest-check-indicator {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.interest-checkbox-card input:checked + .interest-card-inner .interest-check-indicator::after {
  content: "✓";
}

.interest-card-title {
  font-size: 13px;
  font-weight: 600;
}

/* Watch Manager */
.watched-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.watched-tag-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 12px;
}

.tag-type {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.btn-unwatch {
  color: var(--text-light);
  padding: 2px 4px;
  font-size: 11px;
}

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

.watched-repos-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}

.watched-repo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.watched-repo-link {
  font-weight: 600;
  color: var(--text-main);
}

.watched-repo-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: 10px;
}

/* Admin Styling */
.admin-tabs-bar {
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
}

.admin-tabs-scroller {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.admin-tabs-scroller::-webkit-scrollbar {
  display: none;
}

.admin-tab-item {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: all 0.15s ease;
}

.admin-tab-item:hover {
  background: var(--surface-alt);
  color: var(--text-main);
}

.admin-tab-item.active {
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
  box-shadow: var(--shadow-xs);
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}

.source-card {
  display: flex;
  flex-direction: column;
}

.source-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.source-name {
  font-size: 16px;
}

.tag-source-type {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: #f1f5f9;
  color: #475569;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
}

.source-url {
  font-size: 12px;
  color: var(--text-light);
  overflow-wrap: anywhere;
  margin-bottom: 12px;
}

.source-metrics {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px;
  background: var(--surface-alt);
  border-radius: var(--radius-xs);
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.edit-source-details {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.edit-summary {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
  cursor: pointer;
  user-select: none;
}

.admin-edit-form {
  margin-top: 12px;
  padding: 12px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
}

/* Articles Admin List */
.articles-admin-list {
  display: flex;
  flex-direction: column;
}

.article-admin-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.article-admin-main {
  flex: 1;
  min-width: 0;
}

.article-admin-title {
  font-weight: 600;
  color: var(--text-main);
  display: block;
}

.article-admin-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* Durable Queue Job Record */
.job-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.job-record-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-xs);
}

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

.job-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.job-actions-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #ffffff;
  box-shadow: var(--shadow-xs);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.data-table th {
  background: var(--surface-alt);
  color: var(--text-main);
  font-weight: 700;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-body);
  vertical-align: top;
  max-width: 320px;
  overflow-wrap: break-word;
}

.data-table tr:hover td {
  background: #f8faff;
}

/* Pre / Code Boxes */
pre, .code-box, .code-editor {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-family: "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.65;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

/* Notices, Alerts & Feedback */
.notice, .alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
}

.notice {
  background: var(--green-soft);
  color: #065f46;
  border: 1px solid var(--green-border);
}

.alert {
  background: var(--red-soft);
  color: #991b1b;
  border: 1px solid var(--red-border);
}

.alert-sm {
  padding: 6px 10px;
  font-size: 11px;
}

.feedback {
  position: fixed;
  z-index: 100;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  background: #0f172a;
  color: #ffffff;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideUp 0.2s ease;
}

.feedback.feedback-error {
  background: #b91c1c;
}

@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Login Page Shell */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  background: #ffffff;
}

.login-story {
  background: #0b0f19;
  color: #ffffff;
  padding: 50px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  border-right: 1px solid #1e293b;
}

.story-header .brand-light {
  display: inline-flex;
}

.story-body {
  margin: 40px 0;
  max-width: 480px;
}

.story-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: #818cf8;
  margin-bottom: 12px;
}

.login-story h1 {
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: #ffffff;
  margin-bottom: 16px;
}

.login-story p {
  font-size: 15px;
  line-height: 1.65;
  color: #94a3b8;
  margin-bottom: 30px;
}

.story-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.story-feat-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
}

.feat-bullet {
  color: #818cf8;
  font-size: 14px;
}

.story-footnote {
  font-size: 11px;
  color: #475569;
}

.login-form-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px;
  background: var(--canvas);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  box-shadow: var(--shadow-md);
}

.login-card-header {
  margin-bottom: 24px;
}

.login-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--brand);
}

.login-card-header h2 {
  font-size: 22px;
  margin-top: 4px;
}

.login-card-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 0;
}

.auth-form .form-group {
  margin-bottom: 18px;
}

.auth-submit-btn {
  padding: 12px;
  font-size: 14px;
  margin-top: 8px;
}

.login-card-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
}

.muted-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

/* Footer */
.app-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 0 0;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.footer-brand {
  font-weight: 700;
  color: var(--text-main);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.footer-admin-link, .footer-login-link {
  color: var(--text-muted);
  font-weight: 500;
}

.footer-admin-link:hover, .footer-login-link:hover {
  color: var(--brand);
}

/* Responsive Media Queries */
@media (max-width: 1200px) {
  .sidebar {
    width: 220px;
    padding: 20px 12px;
  }
  .workspace {
    margin-left: 220px;
  }
  main {
    padding: 24px 28px 36px;
  }
  .content-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 22px;
  }
  .stats-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    box-shadow: none;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.4);
  }
  .sidebar-close {
    display: block;
  }
  .workspace {
    margin-left: 0;
  }
  .icon-button {
    display: block;
  }
  .content-layout {
    grid-template-columns: 1fr;
  }
  .right-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
  }
  .ask-studio-layout {
    grid-template-columns: 1fr;
  }
  .repo-grid, .source-grid, .job-grid {
    grid-template-columns: 1fr;
  }
  .login-shell {
    grid-template-columns: 1fr;
  }
  .login-story {
    padding: 40px 30px;
    min-height: 240px;
  }
  .login-story p, .story-features {
    display: none;
  }
  .login-story h1 {
    font-size: 32px;
  }
  .login-form-pane {
    padding: 40px 20px;
  }
}

@media (max-width: 768px) {
  main {
    padding: 18px 16px 30px;
  }
  .topbar {
    padding: 0 16px;
    height: 56px;
  }
  .desktop-only {
    display: none;
  }
  .topbar-ask-btn {
    display: inline-flex;
    padding: 5px 10px;
    font-size: 11px;
  }
  .page-heading {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 20px;
  }
  .heading-actions {
    display: none;
  }
  .stats-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 20px;
  }
  .stat-card {
    padding: 12px 14px;
    gap: 12px;
  }
  .stat-icon-wrap {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .stat-num {
    font-size: 22px;
  }
  .right-rail {
    grid-template-columns: 1fr;
  }
  .intelligence-card {
    padding: 18px 16px;
  }
  .card-header {
    gap: 12px;
  }
  .card-score {
    width: 44px;
    height: 44px;
  }
  .score-num {
    font-size: 18px;
  }
  .card-title {
    font-size: 16px;
  }
  .card-metrics-grid {
    gap: 10px;
    padding: 10px 12px;
  }
  .metric-personal {
    margin-left: 0;
  }
  .form-grid, .form-grid-3, .filter-grid {
    grid-template-columns: 1fr;
  }
  .interest-chips-grid {
    grid-template-columns: 1fr;
  }
  .ask-studio-card {
    padding: 20px 18px;
  }
  .answer-sources-grid {
    grid-template-columns: 1fr;
  }
  .login-card {
    padding: 24px 20px;
  }
  .app-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
