/* SUPERCOACH v2.0 — Modern UI with drawer navigation
   Clean, minimal design focused on the AI chat experience */

:root {
  /* Brand palette */
  --primary: #086068;
  --primary-hover: #064d54;
  --primary-light: rgba(8, 96, 104, 0.08);
  --primary-border: rgba(8, 96, 104, 0.25);
  
  --accent: #F88820;
  --accent-light: rgba(248, 136, 32, 0.12);
  --accent-border: rgba(248, 136, 32, 0.35);
  
  --destructive: #dc3545;
  --destructive-light: rgba(220, 53, 69, 0.1);
  
  /* Neutrals */
  --slate: #1a1d21;
  --slate-700: #2d3339;
  --slate-600: #404952;
  --slate-500: #5c6670;
  --slate-400: #8a939d;
  --slate-300: #b8bfc7;
  --slate-200: #e1e5e9;
  --slate-100: #f4f6f8;
  --slate-50: #f9fafb;
  --white: #ffffff;
  
  /* Semantic */
  --text: var(--slate);
  --text-muted: var(--slate-500);
  --text-light: var(--slate-400);
  --bg: var(--slate-50);
  --bg-card: var(--white);
  --border: var(--slate-200);
  --border-light: var(--slate-100);
  
  /* Typography */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', Monaco, Consolas, monospace;
  
  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  
  /* Radius */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  
  /* Layout */
  --header-h: 60px;
  --drawer-w: 320px;
  --chat-sidebar-w: 280px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; }

/* Utilities */
.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==================== LOGIN ==================== */
#loginView {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-6);
  background: linear-gradient(135deg, var(--slate-50) 0%, var(--white) 100%);
}

.login-card {
  width: min(960px, 100%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.login-brand {
  padding: var(--space-10);
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--slate-50) 100%);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.brand-logos {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.brand-logos img { height: 40px; width: auto; }

.brand-title {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--slate);
  margin: 0;
}

.brand-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.6;
}

.brand-bullets {
  margin: 0;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 14px;
}
.brand-bullets li { margin: var(--space-2) 0; }

.login-form {
  padding: var(--space-10);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.form-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--slate);
  margin: 0 0 var(--space-2);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.label {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-600);
}

.input, .select, .textarea {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
.input::placeholder, .textarea::placeholder { color: var(--slate-400); }

.textarea { resize: vertical; min-height: 80px; }

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

.legal {
  font-size: 12px;
  color: var(--text-light);
  margin-top: var(--space-3);
}

.login-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.role-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}
.role-row .select { flex: 1; }

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--slate-600);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn:hover { background: var(--slate-50); border-color: var(--slate-300); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { flex-shrink: 0; }
.btn:focus-visible, .select:focus-visible, .input:focus-visible, .textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  box-shadow: 0 0 0 2px var(--primary-light);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-secondary {
  background: var(--white);
  border-color: var(--slate-300);
  color: var(--slate-600);
}
.btn-secondary:hover { background: var(--slate-50); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--slate-500);
}
.btn-ghost:hover { background: var(--slate-100); color: var(--slate-700); }

.btn-destructive {
  background: var(--destructive-light);
  border-color: var(--destructive);
  color: var(--destructive);
}
.btn-destructive:hover { background: var(--destructive); color: var(--white); }

.btn-lg { padding: var(--space-4) var(--space-6); font-size: 15px; }
.btn-sm { padding: var(--space-2) var(--space-3); font-size: 13px; }
.btn-block { width: 100%; }

/* ==================== HEADER ==================== */
.header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left { display: flex; align-items: center; gap: var(--space-3); }
.header-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--space-3); }
.header-right { display: flex; align-items: center; gap: var(--space-3); }

.header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header-mascot {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  object-fit: cover;
}

.header-title {
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--slate);
  text-transform: uppercase;
}

.header-team-select {
  padding: var(--space-2) var(--space-4);
  padding-right: var(--space-8);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--slate-50);
  color: var(--slate-600);
  font-weight: 500;
  font-size: 13px;
}

.help-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--slate-50);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: var(--white);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}

.user-meta { line-height: 1.2; }
.user-name { font-size: 13px; font-weight: 600; color: var(--slate); }
.user-role { font-size: 11px; color: var(--text-muted); }

.nav-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius);
}

/* ==================== NAV DRAWER ==================== */
.nav-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}
.nav-drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--drawer-w);
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform var(--transition-slow);
}
.nav-drawer.open {
  transform: translateX(0);
}

.nav-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.nav-drawer-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--slate);
  margin: 0;
}
.nav-drawer-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.nav-drawer-body {
  flex: 1;
  padding: var(--space-4);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.nav-drawer-body button {
  width: 100%;
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--slate-600);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition);
}
.nav-drawer-body button:hover {
  background: var(--slate-50);
  color: var(--slate);
}
.nav-drawer-body button.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.nav-drawer-actions {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
}

.nav-drawer-actions .divider {
  margin: 0 0 var(--space-4) 0;
}

.nav-drawer-footer {
  padding: var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mini-logos {
  display: flex;
  gap: var(--space-3);
}
.mini-logos img { height: 20px; opacity: 0.6; }

.nav-drawer-links {
  display: flex;
  gap: var(--space-4);
}
.nav-drawer-links a {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
  min-height: calc(100vh - var(--header-h));
  padding: var(--space-6);
}

.page { display: none; }
.page.active { display: block; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--slate);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.page-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin: var(--space-2) 0 0;
  max-width: 60ch;
}

.page-actions {
  display: flex;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ==================== CARDS ==================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--slate);
  margin: 0;
}

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: var(--space-1) 0 0;
}

.card-body {
  padding: var(--space-5);
}

.card-footer {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
}

/* ==================== GRIDS ==================== */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: flex-end;
}
.filter-row .field { min-width: 160px; }

/* ==================== BADGES & PILLS ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge.published {
  background: var(--primary-light);
  color: var(--primary);
}
.badge.draft {
  background: var(--slate-100);
  color: var(--slate-500);
}
.badge.review {
  background: var(--accent-light);
  color: #b35a00;
}

.badge-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  align-items: flex-end;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.pill {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  background: var(--slate-100);
  color: var(--slate-600);
  border: 1px solid var(--border);
}

.pill.scenario {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: #b35a00;
}

.pill.good {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
  color: #047857;
}

.pill.risk {
  background: rgba(245, 158, 11, 0.1);
  border-color: rgba(245, 158, 11, 0.3);
  color: #b45309;
}

.pill.info {
  background: var(--slate-100);
  border-color: var(--slate-200);
  color: var(--slate-600);
}

/* ==================== TOGGLES ==================== */
.toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--slate-600);
  cursor: pointer;
  user-select: none;
}
.toggle input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 13px;
  color: var(--slate-500);
}
.toggle-inline input {
  accent-color: var(--primary);
}

/* ==================== DIVIDER ==================== */
.divider {
  height: 1px;
  background: var(--border-light);
  margin: var(--space-4) 0;
}

.chat-sidebar-content .divider {
  background: linear-gradient(90deg, var(--border-light) 0%, transparent 100%);
}

/* Enhanced select in chat sidebar */
.chat-sidebar-content .select {
  border-radius: var(--radius-lg);
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: var(--space-3) var(--space-4);
  font-weight: 500;
  transition: all var(--transition);
}

.chat-sidebar-content .select:hover {
  border-color: var(--slate-300);
}

.chat-sidebar-content .select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.chat-sidebar-content .label {
  color: var(--slate-500);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ==================== CHAT WORKSPACE ==================== */
.chat-workspace {
  display: grid;
  grid-template-columns: var(--chat-sidebar-w) 1fr;
  gap: 0;
  height: calc(100vh - var(--header-h) - var(--space-6) * 2);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: linear-gradient(180deg, var(--slate-50) 0%, var(--white) 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}

.chat-sidebar {
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.chat-sidebar-header {
  padding: var(--space-5);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  gap: var(--space-3);
  align-items: center;
  background: linear-gradient(135deg, var(--primary-light) 0%, transparent 100%);
}

.chat-mascot {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: var(--shadow);
}

.chat-sidebar-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--slate);
  margin: 0;
}
.chat-sidebar-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin: var(--space-1) 0 0;
}

.chat-sidebar-content {
  flex: 1;
  padding: var(--space-4);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.chat-tips {
  background: linear-gradient(135deg, var(--primary-light) 0%, transparent 100%);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.chat-tips h4 {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.chat-tips h4::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
}
.chat-tips p {
  font-size: 13px;
  color: var(--slate-600);
  margin: 0;
  line-height: 1.6;
}

/* Chat sidebar buttons */
.chat-sidebar-content .btn {
  border-radius: var(--radius-lg);
  font-weight: 600;
}

.chat-sidebar-content .btn-secondary {
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.chat-sidebar-content .btn-secondary:hover {
  background: var(--slate-50);
  border-color: var(--slate-300);
  transform: translateY(-1px);
}

.chat-sidebar-content .btn-ghost {
  color: var(--slate-500);
}

.chat-sidebar-content .btn-ghost:hover {
  background: var(--slate-100);
  color: var(--primary);
}

/* Chat main area */
.chat-main {
  display: flex;
  flex-direction: column;
  background: transparent;
  position: relative;
  flex: 1;
  min-height: 0; /* Critical: allows flex child to shrink and enable scrolling */
  overflow: hidden; /* Prevent main from growing beyond workspace */
}

.chat-messages {
  flex: 1;
  min-height: 0; /* Critical: allows flex child to shrink and enable scrolling */
  padding: var(--space-8) var(--space-6);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  scroll-behavior: smooth;
}

.chat-welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-10);
}

.chat-welcome-mascot {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-lg);
  border: 3px solid var(--white);
}

.chat-welcome h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--slate);
  margin: 0 0 var(--space-3);
  letter-spacing: -0.02em;
}

.chat-welcome p {
  font-size: 15px;
  color: var(--text-muted);
  margin: 0 0 var(--space-8);
  max-width: 50ch;
  line-height: 1.6;
}

.chat-welcome-examples {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: center;
  max-width: 600px;
}

.example-btn {
  padding: var(--space-3) var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--white);
  color: var(--slate-600);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.example-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Messages */
.msg {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  max-width: 80%;
  animation: msgFadeIn 0.3s ease;
}
.msg.multi {
  max-width: 100%;
  width: 100%;
}
@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.msg.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.msg-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.msg-avatar.assistant {
  background: var(--primary);
  color: var(--white);
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 700;
}
.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-lg);
}

.bubble {
  padding: var(--space-5);
  border-radius: var(--radius-xl);
  background: var(--white);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  line-height: 1.6;
}
.user .bubble {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  border-color: transparent;
  color: var(--white);
  box-shadow: var(--shadow);
}

.bubble p { margin: 0; font-size: 15px; }
.bubble .section {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
}
.user .bubble .section {
  border-top-color: rgba(255,255,255,0.2);
}
.bubble h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate);
  margin: 0 0 var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.user .bubble h4 { color: rgba(255,255,255,0.95); }

.bubble ul {
  margin: var(--space-2) 0 0;
  padding-left: 20px;
}
.bubble li { 
  margin: var(--space-2) 0;
  font-size: 14px;
}

.dual-response-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-4);
}
.dual-col {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-3);
  box-shadow: var(--shadow-sm);
}
.dual-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.response-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--slate-50);
  padding: var(--space-4);
  margin: 0 0 var(--space-4);
}

.response-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.response-header h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  color: var(--slate);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.response-text {
  font-size: 15px;
  color: var(--slate);
  white-space: pre-wrap;
}

.response-why {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border);
}

.response-why-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: var(--space-2);
}

.response-why p {
  margin: 0;
  font-size: 14px;
  color: var(--slate);
}

.response-scores {
  margin-top: var(--space-3);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-2);
}

.response-score {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  font-size: 12px;
}

.response-score .score-label {
  color: var(--text-muted);
  font-weight: 600;
}

.confidence {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  max-width: 80%;
  animation: msgFadeIn 0.3s ease;
}

.typing-bubble {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-xl);
  background: var(--white);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: typingBounce 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(1) { animation-delay: 0s; }
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-8px);
    opacity: 1;
  }
}

/* Chat input */
.chat-input-area {
  padding: 0;
  background: transparent;
  position: relative;
  flex-shrink: 0; /* Prevent input area from shrinking */
}

.chat-input-wrapper {
  max-width: 100%;
  margin: 0;
  background: var(--white);
  border-top: 1px solid var(--border-light);
}

.chat-input-main {
  display: flex;
  align-items: flex-end;
  gap: var(--space-3);
  padding: var(--space-5) var(--space-6);
  background: var(--white);
}

.chat-textarea {
  flex: 1;
  min-height: 56px;
  max-height: 180px;
  padding: var(--space-4) var(--space-5);
  border: 2px solid var(--slate-200);
  border-radius: 28px;
  background: var(--slate-50);
  resize: none;
  font-size: 15px;
  line-height: 1.5;
  font-family: inherit;
  color: var(--slate);
  transition: all var(--transition);
}

.chat-textarea::placeholder {
  color: var(--slate-400);
}

.chat-textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--white);
  box-shadow: 0 0 0 4px var(--primary-light), var(--shadow-sm);
}

.chat-input-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* Scenario Picker */
.scenario-picker {
  position: relative;
}

.scenario-picker-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--slate-500);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.scenario-picker-btn:hover {
  background: var(--slate-50);
  border-color: var(--slate-300);
  color: var(--slate-700);
}

.scenario-picker-btn.has-scenario {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.scenario-picker-btn.has-scenario:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
}

.scenario-picker-chevron {
  transition: transform var(--transition);
}

.scenario-picker.open .scenario-picker-chevron {
  transform: rotate(180deg);
}

.scenario-picker-clear {
  position: absolute;
  right: -8px;
  top: -8px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--white);
  background: var(--slate-500);
  color: var(--white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.scenario-picker-clear:hover {
  background: var(--destructive);
  transform: scale(1.1);
}

.scenario-picker-clear.hidden {
  display: none;
}

.scenario-picker-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  width: 280px;
  max-height: 320px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--transition);
  z-index: 100;
}

.scenario-picker.open .scenario-picker-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scenario-picker-header {
  padding: var(--space-3) var(--space-4);
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-light);
  background: var(--slate-50);
}

.scenario-picker-list {
  max-height: 240px;
  overflow-y: auto;
}

.scenario-option {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition);
}

.scenario-option:hover {
  background: var(--slate-50);
}

.scenario-option.selected {
  background: var(--primary-light);
}

.scenario-option .pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.scenario-option-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate);
}

.scenario-option-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.scenario-option.selected .scenario-option-title {
  color: var(--primary);
}

.toggle-label {
  font-size: 13px;
  color: inherit;
  font-weight: 500;
}

.btn-send {
  width: 52px;
  height: 52px;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
  box-shadow: var(--shadow);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  border: none;
}

.btn-send svg {
  width: 20px;
  height: 20px;
  color: var(--white);
}

.btn-send:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.btn-send:active {
  transform: scale(0.98);
}

.btn-send:disabled {
  opacity: 0.5;
  transform: none;
  cursor: not-allowed;
}

.chat-input-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-6) var(--space-4);
  background: var(--white);
}

.chat-disclaimer {
  font-size: 12px;
  color: var(--slate-400);
  font-weight: 500;
}

.chat-shortcut {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: 12px;
  color: var(--slate-400);
}

.chat-shortcut kbd {
  padding: 3px 8px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: ui-monospace, monospace;
  color: var(--slate-500);
  font-weight: 500;
}

.kbd-hint {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.kbd {
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--slate-500);
}

/* ==================== FEEDBACK WIDGET ==================== */
.feedback {
  border-top: 1px solid var(--border-light);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  background: var(--slate-50);
  margin: var(--space-4) calc(-1 * var(--space-5)) calc(-1 * var(--space-5));
  padding: var(--space-4) var(--space-5) var(--space-5);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

.rating-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}

.stars {
  display: flex;
  gap: 6px;
}

.star {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  cursor: pointer;
  transition: all var(--transition);
}
.star:hover, .star.filled {
  background: var(--primary);
  border-color: var(--primary);
  transform: scale(1.1);
}

/* ==================== PLAYER CARDS ==================== */
.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.player-list.compact {
  gap: var(--space-2);
}

.player-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  transition: all var(--transition);
}
.player-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow);
}

.player-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
}

.player-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--slate);
  margin: 0;
}

.player-summary {
  font-size: 13px;
  color: var(--text-muted);
  margin: var(--space-2) 0 0;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.tag {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  background: var(--slate-100);
  color: var(--slate-600);
}

/* ==================== PROFILE PAGE ==================== */
.profile-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-5);
  align-items: start;
}

.profile-main { display: flex; flex-direction: column; gap: var(--space-5); }
.profile-sidebar { display: flex; flex-direction: column; gap: var(--space-4); }

.profile-bullets {
  margin: 0;
  padding-left: 20px;
}
.profile-bullets li {
  margin: var(--space-2) 0;
  color: var(--text);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-4);
}

.dashboard-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  background: var(--slate-50);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dashboard-card-header {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  align-items: baseline;
}

.dashboard-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate);
}

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

.dashboard-chart {
  width: 100%;
  position: relative;
}

.trend-chart {
  width: 100%;
  height: auto;
  display: block;
  color: var(--primary);
}

.trend-grid line {
  stroke: var(--border);
  stroke-width: 1;
}

.trend-axis {
  stroke: var(--slate-200);
  stroke-width: 1;
}

.trend-point {
  fill: currentColor;
}

.trend-hit {
  fill: transparent;
  cursor: pointer;
  pointer-events: all;
}

.trend-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -120%);
  background: var(--slate);
  color: var(--white);
  font-size: 11px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  white-space: nowrap;
  z-index: 2;
}

.trend-tooltip.show {
  opacity: 1;
}

.trend-labels text {
  font-size: 10px;
  fill: var(--text-muted);
}

.trend-tick {
  stroke: var(--slate-200);
  stroke-width: 1;
}

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 var(--space-3);
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-500);
  margin: 0 0 var(--space-2);
}

.profile-section {
  padding: var(--space-3);
  background: var(--slate-50);
  border-radius: var(--radius);
  margin-bottom: var(--space-3);
}
.profile-section p {
  font-size: 13px;
  color: var(--text);
  margin: 0;
}

/* Evidence chips */
.evidence-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.evidence-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--primary-border);
  background: var(--white);
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.evidence-chip:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.evidence-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  background: currentColor;
}

/* KV Grid */
.kv-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-2) var(--space-4);
}
.kv-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: uppercase;
}
.kv-value {
  font-size: 13px;
  color: var(--slate);
}

/* Timeline */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.timeline-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--slate-50);
  border-radius: var(--radius);
}

.timeline-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate);
}
.timeline-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate);
}
.timeline-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* Tabs */
.tab-row {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.tab-btn {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--slate-600);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.tab-btn:hover { background: var(--slate-50); }
.tab-btn.is-active {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.dev-view { }
.dev-view.hidden { display: none; }

/* ==================== SCENARIOS ==================== */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}

/* ==================== DOCUMENTS ==================== */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.doc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3);
  background: var(--slate-50);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.doc-meta {
  min-width: 0;
}
.doc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-sub {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==================== TABLES ==================== */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}

th {
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: var(--slate-50);
}

td {
  font-size: 13px;
  color: var(--text);
}

tr:hover td {
  background: var(--slate-50);
}

/* ==================== DROPZONE ==================== */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  background: var(--slate-50);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: all var(--transition);
}
.dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.dropzone strong { color: var(--slate); }

/* ==================== QUOTE ==================== */
.quote {
  padding: var(--space-4);
  background: var(--slate-50);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  font-style: italic;
}

/* ==================== DRAWER ==================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}
.drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  height: 100vh;
  background: var(--white);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 301;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}
.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.drawer-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--slate);
  margin: 0;
}

.drawer-body {
  flex: 1;
  padding: var(--space-5);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.meta strong {
  color: var(--slate);
  font-weight: 600;
}

.why-card {
  padding: var(--space-4);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
}
.why-card h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 var(--space-2);
}
.why-card p {
  font-size: 13px;
  color: var(--slate-600);
  margin: 0;
}

/* ==================== TOAST ==================== */
#toast {
  position: fixed;
  top: calc(var(--header-h) + var(--space-4));
  right: var(--space-4);
  width: min(360px, calc(100vw - var(--space-8)));
  z-index: 400;
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition);
}
#toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-4);
}
.toast-card .t-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--slate);
}
.toast-card .t-body {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* ==================== HELP ICONS ==================== */
.help-icon {
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--slate-500);
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-left: var(--space-2);
  transition: all var(--transition);
}
.help-icon:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
  .profile-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1024px) {
  .chat-workspace {
    grid-template-columns: 1fr;
  }
  .chat-sidebar {
    display: none;
  }
}

@media (max-width: 900px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .login-card {
    grid-template-columns: 1fr;
  }
  .login-brand {
    padding: var(--space-6);
  }
  .login-form {
    padding: var(--space-6);
  }
}

@media (max-width: 640px) {
  :root {
    --drawer-w: 100vw;
  }
  
  .main-content {
    padding: var(--space-4);
  }
  
  .page-header {
    flex-direction: column;
    gap: var(--space-4);
  }
  
  .page-actions {
    width: 100%;
  }
  .page-actions .btn {
    flex: 1;
  }
  
  .player-grid {
    grid-template-columns: 1fr;
  }
  
  .header-center {
    display: none;
  }
  
  .user-meta {
    display: none;
  }
  
  .drawer {
    width: 100vw;
  }
}
