/* GrantCore.ai: Modern Workflow-Driven Design */

/* ==================== LAYOUT ==================== */

/* ==================== DESIGN TOKENS ==================== */
:root {
  /* Colors */
  --bg: #F4F6F9;
  --surface: #FFFFFF;
  --surface-secondary: #F0F2F5;
  --surface-hover: #F8F9FB;
  --border: #E5E7EB;
  --border-light: #F0F1F3;
  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;

  /* Accent */
  --accent: #667EEA;
  --accent-hover: #5A6FD6;
  --accent-light: #EEF0FF;
  --accent-gradient: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);

  /* Status */
  --success: #10B981;
  --success-light: #D1FAE5;
  --warning: #F59E0B;
  --warning-light: #FEF3C7;
  --danger: #EF4444;
  --danger-light: #FEE2E2;

  /* Sidebar */
  --sidebar-bg: #1A1D23;
  --sidebar-text: #A1A7B3;
  --sidebar-active: #FFFFFF;
  --sidebar-hover: rgba(255,255,255,0.06);
  --sidebar-accent: #667EEA;

  /* Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 4px 8px rgba(0,0,0,0.04);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.12);

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== RESET & BASE ==================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100vh;
  overflow: hidden;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition-fast); }
a:hover { color: var(--accent-hover); }

/* ==================== LAYOUT ==================== */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.main {
  flex: 1;
  padding: 20px 28px;
  max-width: 1400px;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.main-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  width: var(--sidebar-width, 220px);
  background: var(--sidebar-bg);
  padding: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  position: relative;
  min-width: 180px;
  max-width: 400px;
  z-index: 10;
}

.sidebar-resize-handle {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 50;
  background: transparent;
  transition: background 0.15s;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.active {
  background: var(--sidebar-accent);
  opacity: 0.6;
}

.sidebar-brand {
  padding: 14px 10px 10px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand img {
  display: block;
  margin: 0 auto 6px;
  filter: brightness(1.1);
}
.sidebar-brand span {
  font-size: 17px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.3px;
}

.sidebar nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: var(--transition-fast);
  border-left: 3px solid transparent;
  margin: 1px 0;
}
.sidebar nav a:hover {
  color: var(--sidebar-active);
  background: var(--sidebar-hover);
}
.sidebar nav a.active {
  color: var(--sidebar-active);
  background: rgba(102, 126, 234, 0.1);
  border-left-color: var(--sidebar-accent);
  font-weight: 600;
}
.sidebar nav a svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.sidebar nav a.active svg { opacity: 1; }

.sidebar-user {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: auto;
}
.sidebar-user-name {
  color: var(--sidebar-active);
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}
.sidebar-user a {
  color: var(--sidebar-text);
  font-size: 13px;
  text-decoration: none;
  transition: var(--transition-fast);
}
.sidebar-user a:hover { color: var(--danger); }

/* ==================== PAGE HEADER ==================== */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 12px;
  flex-shrink: 0;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}
.page-header h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text-primary);
  line-height: 1.3;
}

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

.back-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition-fast);
}
.back-link:hover { color: var(--accent); }
.back-link svg { width: 14px; height: 14px; }

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover {
  background: var(--surface-secondary);
  border-color: #D1D5DB;
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: var(--accent-gradient);
  color: #FFFFFF;
  border: none;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
  transform: translateY(-1px);
  background: var(--accent-gradient);
  color: #FFFFFF;
}
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-danger {
  color: var(--danger);
  border-color: #FCA5A5;
  background: var(--danger-light);
}
.btn-danger:hover {
  background: var(--danger);
  color: #FFFFFF;
  border-color: var(--danger);
}

.btn-logout {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}
.btn-logout:hover { color: var(--danger); border-color: var(--danger); }

/* AI Assist Button */
.btn-ai {
  background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
  color: #FFFFFF;
  border: none;
  box-shadow: 0 2px 8px rgba(118, 75, 162, 0.3);
  position: relative;
  overflow: hidden;
}
.btn-ai:hover {
  box-shadow: 0 4px 16px rgba(118, 75, 162, 0.4);
  transform: translateY(-1px);
}
.btn-ai::before {
  content: '\2728';
  margin-right: 4px;
}

/* Outline variant */
.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-outline:hover {
  background: var(--accent-light);
  box-shadow: var(--shadow-sm);
}

/* Small button */
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* Active / pressed states */
.btn:active { transform: scale(0.97); }
.btn-primary:active { transform: translateY(0) scale(0.97); box-shadow: 0 1px 4px rgba(102, 126, 234, 0.3); }
.btn-ai-assist { display:inline-flex; align-items:center; gap:5px; padding:5px 12px; font-size:11px; font-weight:600; border-radius:var(--radius-sm); border:1px solid var(--border-light); background:var(--surface); color:var(--accent); cursor:pointer; transition:var(--transition-fast); }
.btn-ai-assist:hover { background:rgba(102,126,234,0.08); border-color:var(--accent); }
.btn-ai-assist svg { width:12px; height:12px; }
.btn-ai:active { transform: translateY(0) scale(0.97); }

/* ==================== CARDS ==================== */
.card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  border: 1px solid var(--border-light);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.card h4 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin: 16px 0 10px;
}

/* ==================== FORMS ==================== */
.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 5px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  transition: var(--transition-fast);
  outline: none;
  line-height: 1.5;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}
input::placeholder, textarea::placeholder {
  color: var(--text-muted);
}

/* ==================== UTILITIES ==================== */
.flex { display: flex; flex-direction: row; flex-wrap: nowrap; }
.flex-1 { flex: 1; min-width: 0; }
.flex-wrap { flex-wrap: wrap; }
.flex-col { flex-direction: column; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.hidden { display: none !important; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ==================== FORM ROW (cross-browser safe 2-col) ==================== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ==================== TABLES ==================== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
thead th {
  text-align: left;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  background: var(--surface-secondary);
  border-bottom: 1px solid var(--border-light);
}
tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  font-size: 13px;
}
tbody tr { transition: var(--transition-fast); }
tbody tr:hover { background: var(--surface-hover); }
tbody tr:nth-child(even) { background: rgba(0,0,0,0.01); }
tbody tr:nth-child(even):hover { background: var(--surface-hover); }

/* ==================== BADGES ==================== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  letter-spacing: 0.2px;
}
.badge-draft { background: var(--surface-secondary); color: var(--text-secondary); }
.badge-pass { background: var(--success-light); color: var(--success); }
.badge-fail { background: var(--danger-light); color: var(--danger); }
.badge-warn { background: var(--warning-light); color: var(--warning); }
.badge-blocker { background: var(--danger); color: #fff; }
.badge-high { background: #FEE2E2; color: #DC2626; }
.badge-med { background: var(--warning-light); color: var(--warning); }
.badge-low { background: #DBEAFE; color: #3B82F6; }
.badge-rejected { background: var(--danger-light); color: var(--danger); }
.badge-resubmitting { background: var(--warning-light); color: var(--warning); }

/* ==================== METRICS BAR ==================== */
.dashboard-metrics {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 16px;
}
.metric-item {
  flex: 1;
  text-align: center;
  padding: 4px 12px;
  border-right: 1px solid var(--border-light);
}
.metric-item:last-child { border-right: none; }
.metric-completeness {
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  flex: 1.5;
}
.metric-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.metric-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 3px;
  width: 0%;
  transition: width 0.5s;
}
.metric-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}
.metric-value.metric-progress { color: var(--warning); }
.metric-value.metric-info { color: #3b82f6; }
.metric-value.metric-success { color: var(--success); }
.metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ==================== WORKFLOW STEP CARDS ==================== */
.workflow-step-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.workflow-step-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border-left: 3px solid var(--accent);
}
.workflow-step-card::before { display: none; }
.workflow-step-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.workflow-step-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(102, 126, 234, 0.08);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.workflow-step-text {
  flex: 1;
  min-width: 0;
}
.workflow-step-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.workflow-step-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
  margin-top: 1px;
}
.sidebar-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.35);
  padding: 16px 14px 4px;
  margin-top: 4px;
}
.workflow-step-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
  flex-shrink: 0;
}
.workflow-step-status.status-pending {
  background: var(--surface-secondary);
  color: var(--text-secondary);
}
.workflow-step-status.status-progress {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}
.workflow-step-status.status-complete {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

/* Completed step */
.workflow-step-card.completed {
  border-left-color: var(--success);
}
.workflow-step-card.completed .workflow-step-icon-wrap {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

/* In Progress step */
.workflow-step-card.in-progress {
  border-left-color: var(--warning);
}
.workflow-step-card.in-progress .workflow-step-icon-wrap {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

/* Workflow card link styling */
a.workflow-step-card,
a.workflow-step-card:hover {
  color: inherit;
  text-decoration: none;
}

/* ==================== DASHBOARD ==================== */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.dashboard-panel {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}
.dashboard-panel:hover {
  box-shadow: var(--shadow-md);
}
.dashboard-panel h3 {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.dashboard-panel-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-secondary);
  margin-bottom: 6px;
  transition: var(--transition);
}
.dashboard-panel-item:hover {
  box-shadow: var(--shadow-sm);
  background: var(--surface);
}
.dashboard-panel-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.3;
}
.dashboard-panel-item-title:hover {
  color: var(--accent);
}
.dashboard-panel-item-sub {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.3;
}

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

/* ==================== PROGRESS BAR ==================== */
.profile-completeness {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.completeness-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.progress-bar {
  height: 8px;
  background: var(--surface-secondary);
  border-radius: 100px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 100px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== WIZARD STEPPER ==================== */
.wizard-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  margin-bottom: 16px;
  gap: 0;
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 12px 20px;
}
.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.wizard-step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  border: 2px solid var(--border-light);
  transition: var(--transition);
}
.wizard-step.active .wizard-step-circle {
  background: var(--accent);
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}
.wizard-step.completed .wizard-step-circle {
  background: var(--success);
  color: #FFFFFF;
  border-color: transparent;
}
.wizard-step-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
  max-width: 80px;
}
.wizard-step.active .wizard-step-label { color: var(--accent); font-weight: 700; }
.wizard-step-line {
  width: 32px;
  height: 2px;
  background: var(--border-light);
  flex-shrink: 0;
  margin: 0 4px;
  margin-bottom: 16px;
}
.wizard-step.completed + .wizard-step-line {
  background: var(--success);
}

/* Wizard Body */
.wizard-main { max-width: 1400px; }
.wizard-body { display: flex; gap: 20px; }
.wizard-content { flex: 1; min-width: 0; }
.wizard-panel { display: none; }
.wizard-panel:first-child { display: block; }

/* Wizard Navigation */
.wizard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-top: 8px;
}
.wizard-step-indicator {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ==================== PROFILE TABS ==================== */
.profile-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-light);
  padding-bottom: 0;
  overflow-x: auto;
}
.profile-tab {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}
.profile-tab:hover { color: var(--text-primary); background: var(--surface-hover); }
.profile-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.profile-tab-content { display: none; }
.profile-tab-content.active { display: block; }

/* ==================== CHIP SELECT ==================== */
.chip-select {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip-select .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  user-select: none;
}
.chip-select .chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.chip-select .chip.selected,
.chip-select .chip:has(input:checked) {
  background: var(--accent-gradient);
  color: #FFFFFF;
  border-color: transparent;
}
.chip-select .chip input[type="checkbox"] {
  display: none;
}

/* ==================== SAVED MESSAGE ==================== */
.saved-msg {
  color: var(--success);
  font-size: 14px;
  font-weight: 500;
  transition: opacity 0.3s;
}

/* ==================== INLINE FORM ==================== */
.inline-form {
  background: var(--surface-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

/* ==================== FINDER TABS ==================== */
.finder-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border-light);
}
.finder-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
  background: none;
  border: none;
  font-family: inherit;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.finder-tab:hover { color: var(--text-primary); }
.finder-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.finder-panel { }

/* ==================== CHIPS ==================== */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border-radius: 100px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition-fast);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

/* ==================== FUNDER GRID ==================== */
.funder-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}
.funder-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: var(--transition);
}
.funder-card:hover { box-shadow: var(--shadow-md); }
.funder-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.funder-card-header:hover { background: var(--surface-hover); }
.funder-card-header h3 { font-size: 16px; font-weight: 600; }
.funder-card-programs { padding: 0; border-top: 1px solid var(--border-light); }
.program-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-light);
  gap: 16px;
}
.program-row:last-child { border-bottom: none; }
.program-row:hover { background: var(--surface-hover); }

/* ==================== MATCH CARDS ==================== */
.match-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  transition: var(--transition);
}
.match-card:hover { box-shadow: var(--shadow-md); }

.match-score {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.match-score.high { background: var(--success); }
.match-score.medium { background: var(--warning); }
.match-score.low { background: var(--danger); }

/* ==================== GUIDANCE CARD ==================== */
.guidance-card {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.guidance-card h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.guidance-card p, .guidance-card div {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ==================== APPLICANT TYPE CARDS ==================== */
.applicant-type-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.applicant-type-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  position: relative;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  cursor: pointer;
  transition: var(--transition);
}
.applicant-type-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.applicant-type-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}
.applicant-type-card.selected::after {
  content: '\2713';
  position: absolute;
  top: 8px;
  right: 10px;
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
}
.applicant-type-card input[type="radio"] { display: none; }
.applicant-type-icon { font-size: 28px; margin-bottom: 8px; }
.applicant-type-label { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.applicant-type-desc { font-size: 13px; color: var(--text-secondary); }

/* ==================== MODAL / OVERLAY ==================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  justify-content: center;
  align-items: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.25s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal h3 { font-size: 20px; font-weight: 700; margin-bottom: 20px; }

/* ==================== DRAWER ==================== */
.drawer-overlay, .ccv-drawer-overlay, .cv-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
}
.drawer-overlay.open, .ccv-drawer-overlay.open, .cv-modal-overlay.open { display: block; }

.drawer, .ccv-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 90vw;
  height: 100vh;
  background: var(--surface);
  z-index: 101;
  box-shadow: var(--shadow-xl);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.drawer.open, .ccv-drawer.open { transform: translateX(0); }

.drawer-close, .ccv-drawer-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  transition: var(--transition-fast);
  line-height: 1;
}
.drawer-close:hover, .ccv-drawer-close:hover { color: var(--text-primary); }

.ccv-drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}
.ccv-drawer-header h3 { font-size: 18px; font-weight: 700; }
/* The dynamically-generated CV form fields live in #entryFormFields which
   sits between the drawer header and the action bar. Without padding the
   inputs hugged the left edge (QA finding). 24px matches the header. */
.ccv-drawer #entryFormFields { padding: 16px 24px; }
.ccv-drawer #entryFormError { margin: 0 24px 12px; }
.ccv-drawer-actions {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
  margin-top: auto;
}

/* CV Modal */
.cv-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  z-index: 101;
  box-shadow: var(--shadow-xl);
  display: none;
  animation: modalIn 0.25s ease-out;
}
.cv-modal.open { display: block; }
.cv-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}
.cv-modal-header h3 { font-size: 18px; font-weight: 700; }
.cv-modal-body { padding: 24px; }
.cv-modal-footer {
  display: flex;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-light);
}

/* ==================== AUTH PAGES ==================== */
.auth-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  /* align-items: safe center keeps the card centered when it fits and
     anchors it to the top (so it stays scrollable) when the viewport is
     too short. Older browsers fall back to the second declaration. */
  align-items: center;
  align-items: safe center;
  justify-content: center;
  background: linear-gradient(135deg, #667EEA 0%, #764BA2 50%, #1A1D23 100%);
  padding: 40px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.auth-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
}
.auth-brand {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.auth-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
}
.auth-error {
  background: var(--danger-light);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
  display: none;
}
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* ==================== EMPTY STATE ==================== */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 2px dashed var(--border);
}
.empty-state h3 {
  font-size: 18px;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 15px;
  max-width: 400px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ==================== SETTINGS ==================== */
.settings-section {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.settings-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.provider-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  transition: var(--transition);
}
.provider-option:hover { border-color: var(--accent); }
.provider-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}
.provider-option input[type="radio"] { accent-color: var(--accent); }

/* ==================== CCV STYLES ==================== */
.ccv-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
  gap: 16px;
}
.ccv-type-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.ccv-type-bar label { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 0; }
.ccv-empty { text-align: center; padding: 40px; color: var(--text-secondary); }

.ccv-section {
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.ccv-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  transition: var(--transition-fast);
}
.ccv-section-header:hover { background: var(--surface-hover); }
.ccv-section-header h3 { font-size: 15px; font-weight: 600; }
.ccv-section-body { padding: 0 20px 16px; }
.ccv-entry-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  transition: var(--transition-fast);
}
.ccv-entry-card:hover { border-color: var(--accent); background: var(--surface-hover); }

/* CV Format Bar */
.cv-format-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.cv-format-bar label { font-size: 14px; font-weight: 600; color: var(--text-secondary); margin-bottom: 0; }
.cv-format-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* ==================== REFERENCE / MATERIAL CARDS ==================== */
.ref-card, .mat-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition-fast);
  gap: 16px;
}
.ref-card:hover, .mat-card:hover { box-shadow: var(--shadow-md); }
.ref-info, .mat-info { flex: 1; min-width: 0; }
.ref-name, .mat-title { font-weight: 600; font-size: 15px; }
.ref-detail, .mat-detail { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.ref-actions, .mat-actions { display: flex; gap: 6px; flex-shrink: 0; }

.mat-outcome { font-size: 12px; padding: 2px 8px; border-radius: 100px; font-weight: 600; }
.mat-outcome-funded { background: var(--success-light); color: var(--success); }
.mat-outcome-rejected { background: var(--danger-light); color: var(--danger); }
.mat-outcome-pending { background: var(--warning-light); color: var(--warning); }

.add-item-btn {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  cursor: pointer;
  transition: var(--transition-fast);
}
.add-item-btn:hover { background: var(--accent); color: #FFFFFF; border-style: solid; }

/* ==================== ELIGIBILITY ==================== */
.eligibility-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.eligibility-badge {
  display: inline-block;
  padding: 8px 24px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 100px;
  letter-spacing: 0.5px;
}
.eligibility-badge.eligible { background: var(--success-light); color: var(--success); }
.eligibility-badge.not-eligible { background: var(--danger-light); color: var(--danger); }
.eligibility-badge.borderline { background: var(--warning-light); color: var(--warning); }
.eligibility-criteria-list { margin-top: 16px; }
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 14px;
}
.text-sm { font-size: 13px; }

/* ==================== AI CHAT PANEL ==================== */
.ai-chat-panel {
  width: var(--chat-width, 320px);
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  max-width: 600px;
  min-width: 200px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.ai-chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}
.ai-chat-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: var(--transition-fast);
}
.ai-chat-toggle:hover { background: var(--surface-secondary); color: var(--text-primary); }
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
}
.ai-chat-input-area {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
  align-items: flex-end;
}
.ai-chat-input-area textarea {
  flex: 1;
  font-size: 13px;
  resize: none;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  min-height: 36px;
  max-height: 100px;
  line-height: 1.4;
}
.ai-chat-input-area .btn {
  font-size: 12px;
  padding: 6px 14px;
}
.chat-resize-handle {
  position: absolute;
  top: 0;
  left: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 50;
  background: transparent;
  transition: background 0.15s;
}
.chat-resize-handle:hover,
.chat-resize-handle.active {
  background: var(--accent);
  opacity: 0.4;
}

/* ==================== SPINNER ==================== */
.spinner, .ai-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ==================== ONBOARDING WIZARD ==================== */
.onboarding-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  margin-bottom: 20px;
}
.onboarding-step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: var(--transition);
}
.onboarding-step-dot.active { background: var(--accent); transform: scale(1.2); }
.onboarding-step-dot.completed { background: var(--success); }

.onboarding-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

/* ==================== MOBILE HAMBURGER ==================== */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-primary);
  z-index: 20;
}
.hamburger-btn svg { width: 24px; height: 24px; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .main { padding: 12px 16px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .workflow-step-cards { grid-template-columns: repeat(2, 1fr); }
  .dashboard-metrics { flex-wrap: wrap; padding: 10px 12px; }
  .metric-item { min-width: 60px; padding: 4px 8px; }
  .metric-completeness { flex-basis: 100%; border-right: none; border-bottom: 1px solid var(--border-light); padding-bottom: 8px; margin-bottom: 4px; }
  .applicant-type-cards { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .app-meta { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.mobile-open {
    display: flex;
    position: fixed;
    top: 0; left: 0;
    width: 260px;
    height: 100vh;
    z-index: 200;
    box-shadow: var(--shadow-xl);
  }
  .sidebar-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    display: none;
  }
  .sidebar-mobile-overlay.open { display: block; }
  .hamburger-btn { display: block; }
  .main { padding: 16px; }
  .page-header { flex-direction: column; gap: 8px; }
  .flex.gap-4 { flex-direction: column; gap: 8px; }
  .form-row { grid-template-columns: 1fr; gap: 8px; }
  .wizard-stepper { overflow-x: auto; justify-content: flex-start; padding: 16px 0; }
  .profile-tabs, .finder-tabs, .pa-tabs, .disc-tabs { gap: 0; overflow-x: auto; }
  .auth-card { padding: 28px 24px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .kanban { grid-template-columns: 1fr; }
  .app-meta { grid-template-columns: 1fr; }
  .kg-detail-panel { width: 100%; }
  .inline-form { flex-direction: column; }
}

@media (max-width: 600px) {
  .workflow-step-cards { grid-template-columns: 1fr; }
  .dashboard-metrics { flex-direction: column; gap: 4px; }
  .metric-item { border-right: none; border-bottom: 1px solid var(--border-light); padding: 6px 0; }
  .metric-item:last-child { border-bottom: none; }
  .stat-grid { grid-template-columns: 1fr; }
}

/* ==================== MISC ==================== */
.lang-btn { cursor: pointer; padding: 4px 8px; border-radius: 6px; font-size: 14px; font-weight: 600; transition: var(--transition-fast); }
.lang-btn:hover { background: var(--accent-light); }

/* Share status */
.share-status { font-size: 14px; margin-top: 8px; padding: 10px 14px; border-radius: var(--radius-sm); display: none; }
.share-status.success { display: block; background: var(--success-light); color: var(--success); }
.share-status.error { display: block; background: var(--danger-light); color: var(--danger); }

/* ==================== POST-AWARD (from post_award.html) ==================== */
.pa-tabs { display:flex; gap:2px; border-bottom:2px solid var(--border); margin-bottom:12px; flex-shrink:0; overflow-x:auto; }
.pa-tab { padding:8px 14px; font-size:12px; font-weight:600; cursor:pointer; border:none; background:none; color:var(--text-secondary);
  border-bottom:2px solid transparent; margin-bottom:-2px; white-space:nowrap; transition:all 0.15s; }
.pa-tab:hover { color:var(--text-primary); background:var(--surface-secondary); }
.pa-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.pa-panel { display:none; flex:1; overflow-y:auto; min-height:0; }
.pa-panel.active { display:block; }

.stat-grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:10px; margin-bottom:14px; }
.stat-grid .stat-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px 14px; }
.stat-grid .stat-card .stat-label { font-size:11px; color:var(--text-secondary); font-weight:500; margin-bottom:4px; }
.stat-grid .stat-card .stat-value { font-size:22px; font-weight:700; color:var(--text-primary); background:none; -webkit-text-fill-color:var(--text-primary); }
.stat-grid .stat-card .stat-sub { font-size:10px; color:var(--text-muted); margin-top:2px; }

.progress-fill.green { background:var(--success); }
.progress-fill.yellow { background:var(--warning); }
.progress-fill.red { background:var(--danger); }

.award-header { display:flex; align-items:center; gap:12px; margin-bottom:10px; flex-wrap:wrap; }
.award-title { font-size:16px; font-weight:700; flex:1; min-width:0; }
.award-meta { display:flex; gap:16px; font-size:11px; color:var(--text-secondary); flex-wrap:wrap; }
.award-meta span { display:flex; align-items:center; gap:4px; }

.pa-inline-form { display:flex; gap:8px; align-items:flex-end; flex-wrap:wrap; padding:10px; background:var(--surface-secondary); border-radius:var(--radius-sm); margin-bottom:12px; }
.pa-inline-form .form-group { flex:1; min-width:120px; margin:0; }
.pa-inline-form label { font-size:10px; font-weight:600; color:var(--text-secondary); display:block; margin-bottom:2px; }
.pa-inline-form input, .pa-inline-form select, .pa-inline-form textarea { font-size:12px; padding:5px 8px; width:100%; }
.pa-inline-form .btn { white-space:nowrap; padding:6px 14px; font-size:11px; }

.pa-table { width:100%; border-collapse:collapse; font-size:12px; }
.pa-table th { text-align:left; font-size:10px; font-weight:600; color:var(--text-secondary); text-transform:uppercase; padding:6px 8px; border-bottom:2px solid var(--border); }
.pa-table td { padding:8px; border-bottom:1px solid var(--border); vertical-align:middle; }
.pa-table tr:hover { background:var(--surface-secondary); }
.pa-table .actions { white-space:nowrap; }
.pa-table .actions button { background:none; border:none; cursor:pointer; color:var(--text-secondary); padding:2px 4px; font-size:11px; }
.pa-table .actions button:hover { color:var(--accent); }

.deadline-list { list-style:none; padding:0; margin:0; }
.deadline-item { display:flex; align-items:center; gap:8px; padding:6px 0; border-bottom:1px solid var(--border); font-size:12px; }
.deadline-type { font-size:9px; font-weight:700; text-transform:uppercase; padding:2px 6px; border-radius:10px; background:var(--surface-secondary); color:var(--text-secondary); }
.deadline-overdue { color:var(--danger); font-weight:600; }

.kanban { display:grid; grid-template-columns:repeat(3, 1fr); gap:10px; }
.kanban-col { background:var(--surface-secondary); border-radius:var(--radius-sm); padding:8px; min-height:120px; }
.kanban-col-title { font-size:11px; font-weight:700; text-transform:uppercase; color:var(--text-secondary); margin-bottom:8px; display:flex; align-items:center; gap:6px; }
.kanban-col-title .count { font-size:10px; background:var(--border); border-radius:10px; padding:1px 6px; }
.kanban-card { background:var(--surface); border:1px solid var(--border); border-radius:6px; padding:8px 10px; margin-bottom:6px; cursor:pointer; font-size:11px; }
.kanban-card:hover { border-color:var(--accent); }
.kanban-card .task-title { font-weight:600; margin-bottom:3px; }
.kanban-card .task-meta { font-size:10px; color:var(--text-secondary); display:flex; gap:8px; }
.kanban-card .priority-high { border-left:3px solid var(--danger); }
.kanban-card .priority-med { border-left:3px solid var(--warning); }

.collab-card { display:flex; align-items:center; gap:10px; padding:10px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); margin-bottom:6px; }
.collab-avatar { width:32px; height:32px; border-radius:50%; background:var(--accent); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; flex-shrink:0; }
.collab-info { flex:1; min-width:0; }
.collab-name { font-weight:600; font-size:12px; }
.collab-email { font-size:11px; color:var(--text-secondary); }
.collab-actions { display:flex; gap:4px; }

.pa-empty { text-align:center; padding:30px 20px; color:var(--text-secondary); font-size:13px; }
.pa-empty svg { opacity:0.3; margin-bottom:8px; }

.ip-filter-btn { font-size:11px; padding:4px 10px; border-radius:14px; }
.ip-filter-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }

.cat-badge { display:inline-block; font-size:10px; font-weight:600; padding:2px 8px; border-radius:10px; text-transform:uppercase; }
.cat-RESEARCH { background:#e0f2fe; color:#0369a1; }
.cat-ANALYSIS { background:#fef3c7; color:#92400e; }
.cat-WRITING { background:#ede9fe; color:#6d28d9; }
.cat-ADMIN { background:#f3f4f6; color:#4b5563; }
.cat-EXPERIMENT { background:#dcfce7; color:#166534; }
.cat-FIELDWORK { background:#ffedd5; color:#9a3412; }
.cat-MEETING { background:#fce7f3; color:#9d174d; }

.ip-cls-badge { display:inline-block; font-size:10px; font-weight:600; padding:2px 8px; border-radius:10px; }
.ip-cls-BACKGROUND { background:#f3f4f6; color:#4b5563; }
.ip-cls-FOREGROUND { background:#e0f2fe; color:#0369a1; }
.ip-cls-GRANT_GENERATED { background:#dcfce7; color:#166534; }

/* ==================== APPLICATION PAGE (from grants_app.html) ==================== */
.app-meta { display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; margin-bottom:20px; padding:16px; background:var(--surface); border-radius:var(--radius-sm); box-shadow:var(--shadow-sm); }
.meta-item label { font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:0.3px; color:var(--text-secondary); }
.meta-value { font-size:13px; font-weight:600; margin-top:2px; color:var(--text-primary); }
.doc-editor { width:100%; min-height:500px; font-family:'Georgia', serif; font-size:14px; line-height:1.8; padding:20px; border:1px solid var(--border); border-radius:var(--radius-sm); resize:vertical; }
.doc-tab { display:inline-block; padding:6px 14px; margin-right:4px; margin-bottom:8px; border-radius:var(--radius-sm); font-size:12px; font-weight:600; cursor:pointer; border:1px solid var(--border); background:var(--surface-secondary); color:var(--text-secondary); }
.doc-tab.active { background:var(--accent); color:white; border-color:var(--accent); }
.save-bar { display:flex; gap:8px; align-items:center; margin-top:12px; flex-wrap:wrap; }
.save-status { font-size:12px; color:var(--success); }
.ai-panel { background:var(--surface); border:1px solid var(--border-light); border-radius:var(--radius-sm); padding:14px; margin-top:14px; box-shadow:var(--shadow-sm); }
.ai-panel h3 { font-size:13px; font-weight:700; color:var(--text-primary); margin-bottom:10px; }
.ai-actions { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:12px; }
.ai-btn { padding:6px 14px; border-radius:var(--radius-sm); font-size:12px; font-weight:600; cursor:pointer; border:1px solid #C7D2FE; background:white; color:var(--accent); transition:all 0.15s; }
.ai-btn:hover { background:var(--accent); color:white; }
.ai-btn.active { background:var(--accent); color:white; }
.ai-instruction { width:100%; padding:8px 12px; border:1px solid #C7D2FE; border-radius:var(--radius-sm); font-size:13px; margin-bottom:8px; }
.ai-output { background:white; border:1px solid #C7D2FE; border-radius:var(--radius-sm); padding:16px; margin-top:12px; white-space:pre-wrap; font-size:13px; line-height:1.7; max-height:400px; overflow-y:auto; }
.export-btn { padding:4px 10px; border-radius:4px; font-size:11px; font-weight:600; cursor:pointer; border:1px solid var(--border); background:var(--surface-secondary); color:var(--text-secondary); text-decoration:none; display:inline-block; transition:all 0.15s; }
.export-btn:hover { background:var(--accent); color:white; border-color:var(--accent); }
.qa-action-card { background:var(--surface); border:1px solid var(--border-light); border-radius:var(--radius-sm); padding:16px; margin-bottom:10px; box-shadow:var(--shadow-sm); }
.qa-action-card h4 { font-size:13px; font-weight:700; margin-bottom:6px; color:var(--text-primary); }
.qa-action-card p { font-size:12px; color:var(--text-secondary); margin-bottom:10px; line-height:1.5; }
.qa-result { margin-top:12px; padding:12px; background:var(--surface-secondary); border-radius:var(--radius-sm); font-size:13px; line-height:1.6; white-space:pre-wrap; }
.qa-result.success { background:var(--success-light); color:var(--success); }
.qa-result.warning { background:var(--warning-light); color:var(--warning); }
.qa-result.error { background:var(--danger-light); color:var(--danger); }

/* ==================== DISCOVERY (from discovery.html) ==================== */
.disc-header { display:flex; justify-content:space-between; align-items:flex-start; padding:24px; flex-wrap:wrap; gap:16px; }
.disc-tabs { display:flex; gap:0; margin:0 24px 20px; border-bottom:2px solid var(--border); }
.disc-tab { padding:10px 20px; font-size:14px; font-weight:500; background:none; border:none; cursor:pointer; color:var(--text-secondary); border-bottom:2px solid transparent; margin-bottom:-2px; transition:color 0.2s, border-color 0.2s; }
.disc-tab.active { color:var(--accent); border-bottom-color:var(--accent); }
.disc-tab:hover { color:var(--text-primary); }
.disc-panel { padding:0 24px 24px; }
.disc-filter-bar { display:flex; gap:12px; margin-bottom:16px; flex-wrap:wrap; align-items:center; }
.disc-filter-bar select, .disc-filter-bar input { min-width:140px; }
.disc-event-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:16px; margin-bottom:12px; transition:box-shadow 0.2s; }
.disc-event-card:hover { box-shadow:var(--shadow-md); }
.disc-event-type { font-size:11px; font-weight:600; padding:3px 10px; border-radius:4px; color:#fff; display:inline-block; margin-bottom:8px; }
.disc-type-new_call { background:#10B981; }
.disc-type-deadline_change { background:#EF4444; }
.disc-type-guideline_update { background:#F59E0B; }
.disc-type-priority_shift { background:#8B5CF6; }
.disc-type-new_program { background:#3B82F6; }
.disc-event-title { font-size:15px; font-weight:600; margin:0 0 4px; }
.disc-event-desc { font-size:13px; color:var(--text-secondary); margin:0 0 8px; line-height:1.5; }
.disc-event-meta { font-size:12px; color:var(--text-secondary); display:flex; gap:12px; flex-wrap:wrap; }
.disc-event-meta a { color:var(--accent); text-decoration:none; }
.disc-event-meta a:hover { text-decoration:underline; }
.disc-sub-card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:16px; margin-bottom:12px; display:flex; justify-content:space-between; align-items:center; gap:16px; }
.disc-sub-info { flex:1; }
.disc-sub-info h4 { margin:0 0 4px; font-size:14px; }
.disc-sub-info p { margin:0; font-size:12px; color:var(--text-secondary); }
.disc-sub-actions { display:flex; gap:8px; align-items:center; flex-shrink:0; }
.disc-add-form { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); padding:20px; margin-bottom:20px; }
.disc-add-form h3 { margin:0 0 16px; font-size:15px; }
.disc-notif-section { margin-top:24px; border-top:1px solid var(--border); padding-top:20px; }
.disc-notif-card { display:flex; justify-content:space-between; align-items:flex-start; padding:12px 16px; border-bottom:1px solid var(--border); gap:12px; }
.disc-notif-card:last-child { border-bottom:none; }
.disc-notif-card.unread { background:var(--surface-secondary); }
.disc-notif-text { flex:1; font-size:13px; line-height:1.5; }
.disc-notif-time { font-size:11px; color:var(--text-secondary); white-space:nowrap; }
.disc-notif-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; }
.disc-empty { text-align:center; padding:40px; color:var(--text-secondary); }
.disc-bell { position:relative; cursor:pointer; background:none; border:none; font-size:20px; color:var(--text-secondary); }
.disc-bell-badge { position:absolute; top:-4px; right:-6px; background:#EF4444; color:#fff; border-radius:50%; width:16px; height:16px; font-size:10px; display:flex; align-items:center; justify-content:center; font-weight:700; }
.disc-toggle { display:flex; align-items:center; gap:6px; font-size:13px; }
.disc-toggle input[type="checkbox"] { width:auto; }

/* ==================== KNOWLEDGE GRAPH (from knowledge_graph.html) ==================== */
.kg-header { display:flex; justify-content:space-between; align-items:flex-start; padding:24px; flex-wrap:wrap; gap:16px; }
.kg-controls { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.kg-graph-container { position:relative; margin:0 24px 24px; border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface); overflow:hidden; }
.kg-graph-svg { width:100%; height:500px; display:block; cursor:grab; }
.kg-graph-svg:active { cursor:grabbing; }
.kg-legend { display:flex; gap:16px; padding:12px 16px; border-top:1px solid var(--border); flex-wrap:wrap; font-size:12px; }
.kg-legend-item { display:flex; align-items:center; gap:4px; }
.kg-legend-dot { width:12px; height:12px; border-radius:50%; }
.kg-detail-panel { position:absolute; top:0; right:0; width:320px; height:100%; background:var(--surface); border-left:1px solid var(--border); padding:20px; overflow-y:auto; display:none; box-shadow:-2px 0 8px rgba(0,0,0,0.1); }
.kg-detail-panel.open { display:block; }
.kg-detail-panel h3 { margin:0 0 4px; font-size:15px; }
.kg-detail-close { position:absolute; top:12px; right:12px; background:none; border:none; font-size:18px; cursor:pointer; color:var(--text-secondary); }
.kg-detail-props { margin-top:12px; }
.kg-detail-props dt { font-size:11px; color:var(--text-secondary); text-transform:uppercase; letter-spacing:0.5px; margin-top:10px; }
.kg-detail-props dd { margin:2px 0 0 0; font-size:13px; }
.kg-connections { margin-top:16px; }
.kg-connections h4 { font-size:13px; margin:0 0 8px; }
.kg-conn-item { padding:6px 0; border-bottom:1px solid var(--border); font-size:12px; cursor:pointer; }
.kg-conn-item:hover { color:var(--accent); }
.kg-predict-section { margin:0 24px 24px; padding:20px; background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-sm); }
.kg-predict-section h2 { margin:0 0 12px; font-size:16px; }
.kg-gauge { width:120px; height:120px; position:relative; margin:16px auto; }
.kg-gauge-circle { fill:none; stroke-width:10; stroke-linecap:round; }
.kg-gauge-bg { stroke:var(--border); }
.kg-gauge-fill { transition:stroke-dashoffset 0.8s ease; }
.kg-gauge-text { font-size:20px; font-weight:700; text-anchor:middle; dominant-baseline:central; fill:var(--text-primary); }
.kg-gauge-label { font-size:11px; text-anchor:middle; fill:var(--text-secondary); }
.kg-predict-details { margin-top:16px; font-size:13px; }
.kg-predict-details dt { color:var(--text-secondary); font-size:11px; text-transform:uppercase; margin-top:8px; }
.kg-predict-details dd { margin:2px 0 0 0; }
.kg-empty { text-align:center; padding:60px 24px; color:var(--text-secondary); }
.kg-building { text-align:center; padding:40px; }
.kg-node-tooltip { position:absolute; background:var(--surface); border:1px solid var(--border); border-radius:6px; padding:8px 12px; font-size:12px; pointer-events:none; display:none; box-shadow:0 2px 8px rgba(0,0,0,0.15); z-index:10; }
