/* ═══════════════════════════════════════════
   DESIGN TOKENS & CSS VARIABLES
   ═══════════════════════════════════════════ */
:root {
  --font-display: 'Outfit', 'Noto Sans Arabic', sans-serif;
  --font-body: 'DM Sans', 'Noto Sans Arabic', sans-serif;
  --radius: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] {
  --bg-root: #080b12;
  --bg-surface: rgba(255, 255, 255, 0.025);
  --bg-surface-hover: rgba(255, 255, 255, 0.055);
  --bg-card: rgba(255, 255, 255, 0.038);
  --bg-card-border: rgba(255, 255, 255, 0.08);
  --bg-input: rgba(255, 255, 255, 0.06);
  --bg-input-hover: rgba(255, 255, 255, 0.09);
  --bg-hover: rgba(255, 255, 255, 0.07);
  --bg-modal: #0d1117;
  --bg-modal-border: rgba(255, 255, 255, 0.1);
  --text-primary: #eef0f8;
  --text-secondary: #8892a4;
  --text-tertiary: #4e5668;

  --accent: #5de4c7;
  --accent-dim: rgba(93, 228, 199, 0.1);
  --accent-glow: rgba(93, 228, 199, 0.18);
  --accent-2: #80bfff;
  --accent-2-dim: rgba(128, 191, 255, 0.1);
  --accent-3: #c084fc;

  --danger: #ff6b6b;
  --danger-dim: rgba(255, 107, 107, 0.12);
  --danger-border: rgba(255, 107, 107, 0.3);

  --score-1: #ff7575;
  --score-1-bg: rgba(255, 117, 117, 0.12);
  --score-2: #ff9f43;
  --score-2-bg: rgba(255, 159, 67, 0.12);
  --score-3: #fcd34d;
  --score-3-bg: rgba(252, 211, 77, 0.12);
  --score-4: #4ade80;
  --score-4-bg: rgba(74, 222, 128, 0.12);
  --score-5: #5de4c7;
  --score-5-bg: rgba(93, 228, 199, 0.15);

  --divider: rgba(255, 255, 255, 0.065);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.35), 0 1px 4px rgba(0, 0, 0, 0.25);
  --shadow-modal: 0 24px 80px rgba(0, 0, 0, 0.55), 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 60px rgba(93, 228, 199, 0.06);
  --shadow-glow-strong: 0 0 30px rgba(93, 228, 199, 0.15);
}

[data-theme="light"] {
  --bg-root: #f0f2f8;
  --bg-surface: rgba(0, 0, 0, 0.018);
  --bg-surface-hover: rgba(0, 0, 0, 0.04);
  --bg-card: #ffffff;
  --bg-card-border: rgba(0, 0, 0, 0.07);
  --bg-input: rgba(0, 0, 0, 0.04);
  --bg-input-hover: rgba(0, 0, 0, 0.065);
  --bg-hover: rgba(0, 0, 0, 0.05);
  --bg-modal: #ffffff;
  --bg-modal-border: rgba(0, 0, 0, 0.1);
  --text-primary: #1a1f2e;
  --text-secondary: #5a6178;
  --text-tertiary: #8e96aa;

  --accent: #0da882;
  --accent-dim: rgba(13, 168, 130, 0.09);
  --accent-glow: rgba(13, 168, 130, 0.14);
  --accent-2: #2563eb;
  --accent-2-dim: rgba(37, 99, 235, 0.09);
  --accent-3: #9333ea;

  --danger: #dc2626;
  --danger-dim: rgba(220, 38, 38, 0.09);
  --danger-border: rgba(220, 38, 38, 0.25);

  --score-1: #dc2626;
  --score-1-bg: rgba(220, 38, 38, 0.08);
  --score-2: #d97706;
  --score-2-bg: rgba(217, 119, 6, 0.08);
  --score-3: #b45309;
  --score-3-bg: rgba(180, 83, 9, 0.08);
  --score-4: #16a34a;
  --score-4-bg: rgba(22, 163, 74, 0.08);
  --score-5: #0da882;
  --score-5-bg: rgba(13, 168, 130, 0.1);

  --divider: rgba(0, 0, 0, 0.065);
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 20px 60px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 40px rgba(13, 168, 130, 0.04);
  --shadow-glow-strong: 0 0 24px rgba(13, 168, 130, 0.12);
}

/* ═══════════════════════════════════════════
   BASE & RESET
   ═══════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg-root);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Custom Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-tertiary); border-radius: 3px; opacity: 0.5; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* Background effects */
.bg-glow {
  position: fixed;
  top: -250px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 600px;
  background: radial-gradient(ellipse, var(--accent-glow) 0%, transparent 68%);
  pointer-events: none;
  z-index: 0;
}

.bg-glow-2 {
  position: fixed;
  bottom: -200px;
  right: -150px;
  width: 600px;
  height: 600px;
  background: radial-gradient(ellipse, var(--accent-2-dim) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.bg-noise {
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.018'/%3E%3C/svg%3E");
  background-repeat: repeat;
  pointer-events: none;
  z-index: 0;
}

.eval-card.eval-card-add {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--accent-glow);
  background: transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.eval-card.eval-card-add:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.eval-card.eval-card-add h3 {
  color: var(--accent);
  margin: 0;
}
.screen { display: none !important; position: relative; z-index: 1; }
.screen.active { display: block !important; }

#authScreen.active {
  display: flex !important;
}

.view { display: none; }
.view.active {
  display: block;
  animation: viewFadeIn 0.35s ease forwards;
}

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

/* ═══════════════════════════════════════════
   AUTHENTICATION SCREEN
   ═══════════════════════════════════════════ */
#authScreen {
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 24px;
  box-shadow: var(--shadow-modal);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 48px 40px 40px;
  animation: loginAppear 0.5s var(--transition-spring) forwards;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  border-radius: 24px 24px 0 0;
}

@keyframes loginAppear {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  background: var(--accent-dim);
  border: 1px solid rgba(93, 228, 199, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  animation: logoPulse 3s ease infinite;
}

.login-logo svg {
  width: 30px;
  height: 30px;
  color: var(--accent);
}

@keyframes logoPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 8px transparent; }
}

.login-header h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.login-header p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════════ */
.form-group { margin-bottom: 20px; }

.form-group label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  padding: 11px 16px;
  outline: none;
  transition: all var(--transition-fast);
  -webkit-appearance: none;
  appearance: none;
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238892a4' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--bg-input-hover);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.login-error {
  display: none;
  font-size: 0.82rem;
  color: var(--danger);
  background: var(--danger-dim);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 18px;
  text-align: center;
}

.form-divider {
  border: none;
  border-top: 1px solid var(--divider);
  margin: 16px 0;
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */
.btn {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-card-border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--transition-fast);
  user-select: none;
}

.btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.14);
}

.btn-accent {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-glow);
}

.btn-accent:hover {
  background: var(--accent-glow);
  color: var(--text-primary);
  border-color: var(--accent);
  box-shadow: var(--shadow-glow-strong);
}

.btn-danger {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: var(--danger-border);
}

.btn-danger:hover {
  background: rgba(255, 107, 107, 0.2);
  border-color: var(--danger);
  color: var(--text-primary);
}

.btn-block { width: 100%; }

.btn-large {
  padding: 12px 24px;
  font-size: 0.9rem;
  border-radius: var(--radius-md);
}

.btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn-back {
  gap: 6px;
  padding: 8px 14px;
  color: var(--text-tertiary);
  font-size: 0.82rem;
}

.btn-back:hover { color: var(--text-primary); }

.logout-btn {
  color: var(--text-tertiary);
}

.logout-btn:hover {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-dim);
}

/* ═══════════════════════════════════════════
   APP CONTAINER & HEADER
   ═══════════════════════════════════════════ */
#appContainer {
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 28px 100px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  margin-bottom: 36px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-card);
  position: sticky;
  top: 16px;
  z-index: 50;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-icon svg {
  width: 18px;
  height: 18px;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-brand h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  background: linear-gradient(135deg, var(--text-primary) 20%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.header-brand .subtitle {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 1px;
}

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

.user-badge {
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 14px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  border-radius: 100px;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  flex-shrink: 0;
}

.theme-toggle svg { width: 16px; height: 16px; }

[data-theme="dark"] .theme-toggle .sun  { display: block; }
[data-theme="dark"] .theme-toggle .moon { display: none; }
[data-theme="light"] .theme-toggle .sun  { display: none; }
[data-theme="light"] .theme-toggle .moon { display: block; }

/* ═══════════════════════════════════════════
   DASHBOARD VIEW
   ═══════════════════════════════════════════ */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}

.view-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dashboard-tabs {
  display: flex;
  gap: 10px;
  background: var(--bg-surface);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.btn-tab {
  background: transparent;
  color: var(--text-tertiary);
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-xs);
}

.btn-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-card);
}

.eval-cards-grid {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.eval-cards-grid.active {
  display: grid;
}

.eval-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: all var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  height: 100%;
}

.eval-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0.6;
  transition: opacity var(--transition);
}

.eval-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent-glow);
  box-shadow: var(--shadow-card), var(--shadow-glow);
}

.eval-card:hover::before { opacity: 1; }

/* Sparkline */
.card-sparkline {
  margin-top: auto;
  padding-top: 14px;
}

.spark-bar {
  height: 4px;
  background: var(--bg-input);
  border-radius: 2px;
  overflow: hidden;
}

.spark-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 1s ease-out;
}

.eval-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.eval-card-badge {
  font-size: 0.64rem;
  padding: 4px 10px;
  border-radius: 100px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent-glow);
}

.eval-card-badge.project-type {
  background: var(--accent-2-dim);
  color: var(--accent-2);
  border-color: rgba(128, 191, 255, 0.2);
}

.eval-card-date {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.eval-card h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 18px;
  color: var(--text-primary);
  flex: 1;
}

.eval-card-stats {
  display: flex;
  gap: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--divider);
}

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

.stat-val {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-lbl {
  font-size: 0.67rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.eval-card-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  background: var(--bg-card);
  border: 1px dashed var(--bg-card-border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  animation: viewFadeIn 0.4s ease;
}

.eval-card-empty svg {
  width: 48px;
  height: 48px;
  color: var(--text-tertiary);
  margin-bottom: 14px;
  opacity: 0.5;
}

.eval-card-empty h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.eval-card-empty p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ═══════════════════════════════════════════
   EDITOR HEADER
   ═══════════════════════════════════════════ */
.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 36px;
  padding: 16px 22px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.editor-title-block {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.editor-meta {
  font-size: 0.68rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  white-space: nowrap;
}

.editor-title-block h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  outline: none;
  border-bottom: 2px dashed transparent;
  padding-bottom: 1px;
  transition: border-color var(--transition-fast);
  cursor: text;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 480px;
}

.editor-title-block h2:focus,
.editor-title-block h2:hover {
  border-bottom-color: var(--accent);
}

.editor-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ═══════════════════════════════════════════
   SECTION TITLES & LAYOUT
   ═══════════════════════════════════════════ */
.section-title {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--divider);
}

.team-section { margin-bottom: 32px; }

.grid-section { margin-bottom: 44px; }

.viz-section { margin-bottom: 44px; }

/* ═══════════════════════════════════════════
   TEAM CHIPS (AGENT LIST)
   ═══════════════════════════════════════════ */
.team-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.chip {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 6px 14px 6px 6px;
  border-radius: 100px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  color: var(--text-primary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(12px);
  transition: all var(--transition-fast);
}

.chip-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-display);
  border: 1px solid var(--accent-glow);
  flex-shrink: 0;
}

.chip:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent);
  box-shadow: 0 0 14px var(--accent-dim);
  transform: translateY(-1px);
}

.chip .remove {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  color: var(--text-tertiary);
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chip:hover .remove { color: var(--danger); background: var(--danger-dim); }

.chip-add {
  border-style: dashed;
  color: var(--text-tertiary);
  padding: 8px 14px;
}

.chip-add:hover { color: var(--accent); border-color: var(--accent); }

/* ═══════════════════════════════════════════
   EVALUATION SCORE GRID TABLE
   ═══════════════════════════════════════════ */
.grid-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.grid-scroll {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--text-tertiary) transparent;
}

.score-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}

.score-grid th {
  font-family: var(--font-display);
  font-weight: 600;
  padding: 14px 10px 6px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border-bottom: 1px solid var(--divider);
  background: var(--bg-surface);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.score-grid th.group-header {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 14px 10px 4px;
  border-bottom: none;
}

.group-client, .group-sales     { color: var(--accent); }
.group-team, .group-projects     { color: var(--accent-2); }
.group-execution, .group-technical { color: var(--score-2); }
.group-growth, .group-soft       { color: var(--accent-3); }

.score-grid th .weight {
  display: block;
  font-size: 0.58rem;
  font-weight: 400;
  color: var(--text-tertiary);
  margin-top: 3px;
  font-family: var(--font-body);
}

/* Sticky first/last columns */
.score-grid th:first-child,
.score-grid td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-modal);
  text-align: left;
  padding-left: 20px;
  min-width: 150px;
  font-weight: 600;
  border-right: 1px solid var(--divider);
  cursor: pointer;
}

.score-grid th:first-child { background: var(--bg-surface); cursor: default; }

.score-grid th:last-child,
.score-grid td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--bg-modal);
  padding-right: 20px;
  border-left: 1px solid var(--divider);
  min-width: 110px;
  text-align: center;
}

.score-grid th:last-child { background: var(--bg-surface); }

.score-grid td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
  transition: background var(--transition-fast);
}

.score-grid tbody tr:last-child td { border-bottom: none; }

.score-grid tbody tr:hover td { background: var(--bg-surface-hover); }

.score-grid td:first-child:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-style: dotted;
}

/* Score Cells */
.score-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 0.95rem;
  user-select: none;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  position: relative;
}

.score-cell:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 1;
}

.score-cell:active { transform: scale(0.92); }

.score-cell[data-score=""]  { background: var(--bg-input); color: var(--text-tertiary); font-size: 0.65rem; }
.score-cell[data-score=""]:hover { background: var(--bg-input-hover); color: var(--text-secondary); }
.score-cell[data-score="1"] { background: var(--score-1-bg); color: var(--score-1); border-color: rgba(255, 117, 117, 0.25); }
.score-cell[data-score="2"] { background: var(--score-2-bg); color: var(--score-2); border-color: rgba(255, 159, 67, 0.25); }
.score-cell[data-score="3"] { background: var(--score-3-bg); color: var(--score-3); border-color: rgba(252, 211, 77, 0.25); }
.score-cell[data-score="4"] { background: var(--score-4-bg); color: var(--score-4); border-color: rgba(74, 222, 128, 0.25); }
.score-cell[data-score="5"] { background: var(--score-5-bg); color: var(--score-5); border-color: rgba(93, 228, 199, 0.3); }

/* Total score column */
.total-score {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--accent);
}

.total-bar {
  width: 64px;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-input);
  overflow: hidden;
  margin: 5px auto 0;
}

.total-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width var(--transition);
}

/* Team average row */
.avg-row td {
  border-bottom: none;
  font-weight: 600;
  font-style: italic;
  color: var(--text-secondary);
  background: var(--bg-surface) !important;
  border-top: 1px solid var(--divider);
}

/* ═══════════════════════════════════════════
   ANALYTICS / VIZ CARDS
   ═══════════════════════════════════════════ */
.viz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 1024px) { .viz-grid { grid-template-columns: 1fr; } }

.viz-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition-fast);
}

.viz-card:hover { border-color: rgba(93, 228, 199, 0.18); }

.viz-card-header {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--divider);
  background: var(--bg-surface);
}

.viz-card-header h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}

.viz-card-header .badge {
  font-size: 0.62rem;
  padding: 3px 9px;
  border-radius: 100px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--accent-glow);
}

.viz-card-body {
  padding: 20px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex: 1;
  overflow: hidden;
}

.eval-card-template {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Template Manager */
.template-manager-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 30px;
  min-height: 400px;
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 500px;
  overflow-y: auto;
  padding-right: 10px;
}

.template-item {
  background: var(--bg-surface);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all var(--transition-fast);
}

.template-item:hover {
  background: var(--bg-surface-hover);
  border-color: var(--accent-glow);
}

.template-item-title {
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.template-item-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.btn-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
}

.btn-icon svg { width: 18px; height: 18px; }

.btn-danger-dim {
  color: var(--danger);
  background: var(--danger-dim);
}

.btn-danger-dim:hover {
  background: var(--danger);
  color: #fff;
}

.template-create-panel {
  padding-left: 30px;
  border-left: 1px solid var(--divider);
}

.header-buttons {
  display: flex;
  gap: 12px;
}

.eval-card-content {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.eval-card-select {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--bg-card-border);
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all var(--transition-fast);
}

.eval-card.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.eval-card.selected .eval-card-select {
  background: var(--accent);
  border-color: var(--accent);
}

.select-check {
  width: 10px;
  height: 6px;
  border-left: 2px solid #0d1117;
  border-bottom: 2px solid #0d1117;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}

.eval-card.selected .select-check {
  opacity: 1;
}

/* Comparison Toolbar */
.comparison-toolbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--accent-glow);
  padding: 12px 24px;
  border-radius: 100px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-modal);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
  transition: transform 0.4s var(--transition-spring), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

.comparison-toolbar.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.toolbar-info {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
}

.toolbar-actions {
  display: flex;
  gap: 12px;
}

/* Comparison View Layout */
.compare-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 30px;
  margin-top: 20px;
}

.compare-sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.compare-legend-card, .compare-summary-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 24px;
}

.legend-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.legend-item:not(:last-child) { margin-bottom: 20px; }

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-top: 4px;
}

.legend-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-tertiary);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.legend-name {
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 0.95rem;
  margin-top: 2px;
}

.performance-shift-val {
  font-size: 2.8rem;
  font-weight: 800;
  font-family: var(--font-display);
  margin: 10px 0;
}

.performance-shift-val.positive { color: var(--accent); }
.performance-shift-val.negative { color: var(--danger); }

/* Variance Bars */
.variance-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 10px;
}

.variance-item {
  display: grid;
  grid-template-columns: 100px 1fr 40px;
  gap: 15px;
  align-items: center;
}

.variance-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.variance-track {
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.variance-center {
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 100%;
  background: var(--divider);
  z-index: 2;
}

.variance-bar {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 4px;
  transition: width 0.8s var(--transition-spring);
}

.variance-bar.pos { background: var(--accent); left: 50%; }
.variance-bar.neg { background: var(--danger); right: 50%; }

.variance-val {
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-display);
}

.variance-val.pos { color: var(--accent); }
.variance-val.neg { color: var(--danger); }

/* Comparison Gaps */
.compare-gaps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.gap-item.improvement { border-left: 4px solid var(--accent); }
.gap-item.decline { border-left: 4px solid var(--danger); }

.gap-item.improvement .gap-item-badge { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-glow); }
.gap-item.decline .gap-item-badge { background: var(--danger-dim); color: var(--danger); border-color: var(--danger-border); }

.skills-breakdown-wrapper {
  padding: 15px;
  background: var(--bg-surface-hover);
  border-radius: var(--radius-sm);
  margin: 5px 0 15px;
}

.skills-breakdown-wrapper table {
  width: 100%;
  font-size: 0.8rem;
}

.skills-breakdown-wrapper td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--divider);
}

.agent-summary-row {
  background: var(--bg-card);
}

.agent-summary-row:hover {
  background: var(--bg-surface-hover);
}

/* Heatmap */
.heatmap-grid {
  display: grid;
  gap: 3px;
  width: 100%;
}

.heatmap-label {
  font-size: 0.62rem;
  color: var(--text-secondary);
  font-family: var(--font-display);
  font-weight: 600;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 6px;
}

.heatmap-label.col-label {
  justify-content: center;
  text-align: center;
  font-size: 0.55rem;
  padding-bottom: 4px;
}

.heatmap-cell {
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: var(--font-display);
  min-height: 28px;
  transition: all var(--transition-fast);
  cursor: default;
}

.heatmap-cell:hover { transform: scale(1.12); z-index: 1; position: relative; }

/* Radar */
.radar-controls {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.radar-btn {
  font-family: var(--font-body);
  font-size: 0.68rem;
  padding: 4px 11px;
  border-radius: 100px;
  border: 1px solid var(--bg-card-border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.radar-btn:hover, .radar-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent-glow);
}

.radar-svg-wrapper {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.radar-svg-wrapper svg {
  max-width: 100%;
  max-height: 280px;
}

/* Rankings */
.ranking-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--divider);
  transition: all var(--transition-fast);
}

.ranking-item:hover {
  background: var(--bg-surface-hover);
  border-color: rgba(93, 228, 199, 0.15);
}

.rank-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-tertiary);
  width: 26px;
  text-align: center;
  flex-shrink: 0;
}

.ranking-item:nth-child(1) .rank-num { color: var(--accent); }
.ranking-item:nth-child(2) .rank-num { color: var(--accent-2); }
.ranking-item:nth-child(3) .rank-num { color: var(--score-2); }

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

.rank-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-details {
  font-size: 0.68rem;
  color: var(--text-secondary);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.rank-score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
  flex-shrink: 0;
}

.rank-bar {
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: var(--bg-input);
  margin-top: 6px;
  overflow: hidden;
}

.rank-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gap Analysis */
.gap-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.gap-item {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--divider);
  border-left: 3px solid;
  transition: background var(--transition-fast);
}

.gap-item.critical { border-left-color: var(--score-1); }
.gap-item.warning  { border-left-color: var(--score-2); }
.gap-item:hover    { background: var(--bg-surface-hover); }

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

.gap-item-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.84rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.gap-item-badge {
  font-size: 0.6rem;
  padding: 2px 7px;
  border-radius: 100px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.gap-item.critical .gap-item-badge { background: var(--score-1-bg); color: var(--score-1); }
.gap-item.warning  .gap-item-badge { background: var(--score-2-bg); color: var(--score-2); }

.gap-item-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.gap-empty {
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.84rem;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* ═══════════════════════════════════════════
   PROJECT MATRIX
   ═══════════════════════════════════════════ */
.project-toolbar {
  margin-bottom: 20px;
  display: flex;
  justify-content: flex-end;
}

.project-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.project-grid th,
.project-grid td {
  padding: 10px 8px;
  border: 1px solid var(--divider);
  text-align: center;
  vertical-align: middle;
}

.project-grid th {
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 0.72rem;
}

.project-grid th.group-header {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 12px 6px 4px;
}

.project-grid tbody tr {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.project-grid tbody tr:hover { background: var(--bg-surface-hover); }

.note-cell-text {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  max-width: 110px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

/* ═══════════════════════════════════════════
   SCORE LEGEND
   ═══════════════════════════════════════════ */
.legend-section { margin-top: 36px; }

.legend-toggle {
  width: 100%;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 13px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-card-border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  transition: all var(--transition-fast);
}

.legend-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.legend-toggle .arrow { transition: transform var(--transition); flex-shrink: 0; }
.legend-toggle.open .arrow { transform: rotate(180deg); }

.legend-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.legend-body.open { max-height: 500px; }

.legend-content {
  display: flex;
  gap: 10px;
  padding: 16px 2px 4px;
  flex-wrap: wrap;
}

.legend-item {
  flex: 1;
  min-width: 150px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transition: border-color var(--transition-fast);
}

.legend-item:hover { border-color: rgba(93, 228, 199, 0.2); }

.legend-score {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
  flex-shrink: 0;
}

.legend-text strong {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.82rem;
  display: block;
  margin-bottom: 3px;
}

.legend-text span {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ═══════════════════════════════════════════
   MODAL WINDOWS
   ═══════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 20px;
}

.modal-overlay.open {
  display: flex;
  animation: overlayFadeIn 0.2s ease forwards;
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-modal);
  border: 1px solid var(--bg-modal-border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 920px;
  max-height: 90vh;
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s var(--transition-spring) forwards;
  overflow: hidden;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.94) translateY(20px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-large { max-width: 920px; }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--divider);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  line-height: 1;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.modal-close:hover {
  background: var(--danger-dim);
  color: var(--danger);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--divider);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: var(--bg-surface);
}

/* Form section layouts inside modals */
.agent-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 640px) {
  .agent-details-grid { grid-template-columns: 1fr; }
}

.form-section-half h3,
.form-section-third h3,
.form-section-twothirds h3 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--divider);
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-full { grid-column: 1 / -1; }

/* Project dialog */
.project-details-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
}

.project-feedback-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

@media (max-width: 900px) {
  .project-details-grid { grid-template-columns: 1fr; }
  .project-feedback-grid { grid-template-columns: 1fr; }
}

.proj-questions-scroll {
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
}

.modal-questions-table {
  width: 100%;
  border-collapse: collapse;
}

.modal-questions-table th,
.modal-questions-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--divider);
  text-align: left;
}

.modal-questions-table th {
  background: var(--bg-input);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
}

.modal-questions-table tr:last-child td { border-bottom: none; }

/* Rating buttons */
.rating-select { display: flex; gap: 4px; }

.rating-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--bg-card-border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  font-family: var(--font-display);
}

.rating-btn:hover { background: var(--bg-hover); color: var(--text-primary); transform: scale(1.1); }

.rating-btn.active {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.notes-input {
  width: 100%;
  padding: 7px 10px;
  font-size: 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--bg-card-border);
  border-radius: 6px;
  color: var(--text-primary);
  outline: none;
  font-family: var(--font-body);
  transition: border-color var(--transition-fast);
}

.notes-input:focus { border-color: var(--accent); }

.project-feedback-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 8px;
}

/* ═══════════════════════════════════════════
   SKILLS & WEIGHTS MODAL PANEL
   ═══════════════════════════════════════════ */
.skills-weights-flex {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.skills-list-panel {
  flex: 2;
  overflow-y: auto;
  max-height: 52vh;
  padding-right: 8px;
}

.add-skill-panel {
  flex: 1;
  border-left: 1px solid var(--divider);
  padding-left: 22px;
  position: sticky;
  top: 0;
}

.add-skill-panel h3 {
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--divider);
}

@media (max-width: 680px) {
  .skills-weights-flex { flex-direction: column; }
  .add-skill-panel { border-left: none; border-top: 1px solid var(--divider); padding-left: 0; padding-top: 20px; }
}

.weight-group { margin-bottom: 20px; }

.weight-group-title {
  font-family: var(--font-display);
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 600;
}

.weight-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--divider);
}

.weight-row:last-child { border-bottom: none; }

.weight-label {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.weight-slider {
  width: 120px;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--bg-input);
  outline: none;
  cursor: pointer;
}

.weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  border: 2px solid var(--bg-modal);
}

.weight-slider::-webkit-slider-thumb:hover {
  transform: scale(1.3);
  box-shadow: 0 0 8px var(--accent-glow);
}

.weight-value {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 36px;
  text-align: right;
  flex-shrink: 0;
}

.skill-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.skill-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--divider);
  background: var(--bg-input);
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  padding: 0;
  line-height: 1;
}

.skill-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.skill-btn.delete-btn:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }

.weight-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 0;
  border-top: 2px solid var(--divider);
  margin-top: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
}

.weight-total-value { color: var(--accent); }
.weight-total-value.over { color: var(--danger); }

/* ═══════════════════════════════════════════
   TOAST NOTIFICATION
   ═══════════════════════════════════════════ */
#toastNotif {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  animation: toastIn 0.3s var(--transition-spring) forwards;
  pointer-events: auto;
  max-width: 320px;
  border: 1px solid;
}

.toast.toast-success {
  background: rgba(13, 168, 130, 0.12);
  border-color: rgba(93, 228, 199, 0.3);
  color: var(--accent);
}

.toast.toast-error {
  background: var(--danger-dim);
  border-color: var(--danger-border);
  color: var(--danger);
}

.toast.toast-info {
  background: var(--accent-2-dim);
  border-color: rgba(128, 191, 255, 0.25);
  color: var(--accent-2);
}

.toast-icon { font-size: 1rem; flex-shrink: 0; }
.toast-msg { flex: 1; line-height: 1.4; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px) scale(0.95); }
  to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0) scale(1); }
  to   { opacity: 0; transform: translateX(20px) scale(0.92); }
}

/* ═══════════════════════════════════════════
   PRINT LAYOUT
   ═══════════════════════════════════════════ */
@media print {
  body { background: #ffffff !important; color: #1a1a2e !important; }

  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    box-shadow: none !important;
  }

  .bg-glow, .bg-glow-2, .bg-noise, .app-header,
  .editor-actions, .team-section, .radar-controls,
  .legend-section, .modal-overlay, #authScreen,
  .project-toolbar, #toastNotif {
    display: none !important;
  }

  #appContainer { padding: 0 !important; max-width: none !important; }

  .editor-header {
    border-bottom: 2px solid #000 !important;
    margin-bottom: 20px !important;
    padding: 10px 0 !important;
    background: transparent !important;
    border: none !important;
    border-bottom: 2px solid #000 !important;
  }

  .editor-title-block h2 { color: #000 !important; font-size: 1.6rem !important; }
  .editor-meta { color: #555 !important; }

  .grid-wrapper { border: 1px solid #ccc !important; background: #fff !important; border-radius: 0 !important; }

  .score-grid th, .score-grid td,
  .project-grid th, .project-grid td { border: 1px solid #ddd !important; color: #000 !important; }

  .score-grid th { background: #f0f0f0 !important; }

  .score-grid th:first-child, .score-grid td:first-child,
  .score-grid th:last-child, .score-grid td:last-child {
    position: static !important;
    background: transparent !important;
  }

  .score-cell[data-score="1"] { background: #fde8e8 !important; color: #dc2626 !important; }
  .score-cell[data-score="2"] { background: #fdebd0 !important; color: #ea580c !important; }
  .score-cell[data-score="3"] { background: #fef9e7 !important; color: #ca8a04 !important; }
  .score-cell[data-score="4"] { background: #d5f5e3 !important; color: #16a34a !important; }
  .score-cell[data-score="5"] { background: #d1f2eb !important; color: #0f9f83 !important; }

  .total-bar, .rank-bar { display: none !important; }

  .viz-section { page-break-before: always; }
  .viz-grid { grid-template-columns: 1fr 1fr !important; gap: 15px !important; }

  .viz-card { border: 1px solid #ccc !important; background: #fff !important; break-inside: avoid; }
  .viz-card-header { background: #f5f5f5 !important; }
  .viz-card-header h3 { color: #000 !important; }

  .ranking-item { background: #f9f9f9 !important; border: 1px solid #ddd !important; }
  .gap-item { background: #f9f9f9 !important; }
  .gap-item.critical { border-left-color: #dc2626 !important; }
  .gap-item.warning  { border-left-color: #ea580c !important; }
}
