/* ===== VERGO-INSPIRED DESIGN — FLAT, MINIMAL, HIGH-CONTRAST ===== */

:root {
  --bg-page: #e8e8e8;
  --bg-surface: #f8f8f8;
  --bg-white: #ffffff;
  --bg-dark: #222222;
  --bg-darker: #0a0a0a;
  --text-primary: #0a0a0a;
  --text-secondary: rgba(34, 34, 34, 0.6);
  --text-tertiary: rgba(34, 34, 34, 0.4);
  --text-inverse: #ffffff;
  --accent: #fd4500;
  --accent-light: rgba(253, 69, 0, 0.08);
  --highlight: #f2ff93;
  --green: #22c55e;
  --green-light: #dcfce7;
  --amber: #f59e0b;
  --amber-light: #fef3c7;
  --blue: #3b82f6;
  --blue-light: #dbeafe;
  --red: #ef4444;
  --red-light: #fee2e2;
  --border: rgba(0, 0, 0, 0.08);
  --border-dark: rgba(0, 0, 0, 0.15);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 24px;
  --font-display: 'Inter Tight', system-ui, -apple-system, sans-serif;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;
  --transition: 0.2s ease;

  /* Backward compatibility for templates with old var names */
  --slate-50: var(--bg-surface);
  --slate-100: var(--bg-surface);
  --slate-200: var(--border);
  --slate-300: var(--text-tertiary);
  --slate-400: var(--text-secondary);
  --slate-500: var(--text-secondary);
  --slate-600: var(--text-secondary);
  --slate-700: var(--text-primary);
  --slate-800: var(--text-primary);
  --slate-900: var(--bg-darker);
  --slate-950: var(--bg-darker);
  --amber-500: var(--accent);
  --amber-400: var(--accent);
  --amber-300: var(--accent);
  --amber-200: var(--accent-light);
  --amber-100: var(--accent-light);
  --amber-700: var(--accent);
  --amber-glow: var(--accent-light);
  --green-100: var(--green-light);
  --green-400: var(--green);
  --green-500: var(--green);
  --blue-500: var(--blue);
  --blue-100: var(--blue-light);
  --red-500: var(--red);
  --red-100: var(--red-light);

  /* Legacy transition vars */
  --transition-fast: var(--transition);
  --transition-smooth: var(--transition);
  --transition-bounce: 0.3s ease;

  /* Legacy shadow vars — all set to none for flat design */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-glow: none;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ===== TOP NAV BAR ===== */
.topbar {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-left { display: flex; align-items: center; gap: 24px; }
.topbar-logo {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.topbar-logo .logo-mark {
  width: 32px;
  height: 32px;
  background: var(--bg-dark);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-inverse);
  font-size: 16px;
  font-weight: 700;
}
.nav-links { display: flex; gap: 4px; }
.nav-link {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-pill);
  transition: all var(--transition);
  cursor: pointer;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-surface); }
.nav-link.active { color: var(--text-primary); background: var(--bg-surface); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-inverse);
  cursor: pointer;
  transition: opacity var(--transition);
  text-decoration: none;
  border: none;
  font-family: var(--font-body);
}
.profile-menu-wrapper { position: relative; }
.profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 200px;
  z-index: 200;
  overflow: hidden;
}
.profile-menu-wrapper.open .profile-dropdown { display: block; }
.profile-dropdown a:hover { background: var(--bg-surface); }
.avatar:hover { opacity: 0.8; }
.user-name { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
.role-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-light);
  color: var(--accent);
}
.role-stakeholder {
  background: var(--blue-light);
  color: var(--blue);
}

/* ===== PAGE LAYOUT ===== */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 32px;
}
.page-header {
  margin-bottom: 40px;
}
.page-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.page-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ===== CARDS ===== */
.card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: none;
  transition: all var(--transition);
  overflow: hidden;
}
.card:hover {
  background: var(--bg-surface);
}
.card-body { padding: 32px; }

/* ===== MODULE CARDS ===== */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}
.module-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  border: none;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
}
.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}
.module-card:hover {
  background: var(--bg-white);
}
.module-card:hover::before { opacity: 1; }
.module-card-body { padding: 32px; }
.module-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.module-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.status-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.status-active { background: var(--green-light); color: var(--green); }
.status-draft { background: var(--accent-light); color: var(--accent); }
.status-closed { background: rgba(0,0,0,0.05); color: var(--text-secondary); }
.status-assigned { background: var(--blue-light); color: var(--blue); }
.status-in-progress { background: var(--amber-light); color: var(--amber); }
.status-complete { background: var(--green-light); color: var(--green); }
.module-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.6;
}
.progress-section { margin-top: 16px; }
.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.progress-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.progress-count { font-size: 12px; color: var(--text-tertiary); }
.progress-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.8s ease;
}
.module-meta {
  display: flex;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.meta-item {
  font-size: 12px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ===== NEW MODULE CARD ===== */
.new-module-card {
  border: 2px dashed var(--border-dark);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  cursor: pointer;
  transition: all var(--transition);
  background: transparent;
  text-decoration: none;
}
.new-module-card:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.new-module-inner {
  text-align: center;
}
.new-module-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 24px;
  color: var(--text-tertiary);
  transition: all var(--transition);
}
.new-module-card:hover .new-module-icon {
  background: var(--accent-light);
  color: var(--accent);
}
.new-module-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ===== BUTTONS ===== */
.btn {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.btn-primary {
  background: var(--bg-dark);
  color: var(--text-inverse);
}
.btn-primary:hover {
  background: var(--bg-darker);
}
.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-dark);
}
.btn-secondary:hover { background: var(--bg-surface); border-color: var(--text-tertiary); }
.btn-amber {
  background: var(--accent);
  color: var(--text-inverse);
}
.btn-amber:hover { opacity: 0.9; }
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 16px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-surface); }
.btn-sm { padding: 7px 16px; font-size: 13px; }

/* ===== MODULE DETAIL TABS ===== */
.detail-tabs {
  display: flex;
  gap: 2px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-md);
  padding: 3px;
  width: fit-content;
  margin-bottom: 24px;
}
.detail-tab {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: none;
  font-family: var(--font-body);
}
.detail-tab:hover { color: var(--text-primary); }
.detail-tab.active {
  background: var(--bg-white);
  color: var(--text-primary);
  font-weight: 600;
}

/* ===== CHAT INTERFACE ===== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  background: var(--bg-page);
}
.chat-header {
  padding: 16px 32px;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-header-left { display: flex; align-items: center; gap: 12px; }
.chat-module-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.chat-session-info { font-size: 13px; color: var(--text-tertiary); }
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}
.message {
  display: flex;
  gap: 14px;
  animation: messageIn 0.4s ease;
}
@keyframes messageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
}
.message-avatar.claude {
  background: var(--bg-dark);
  color: var(--text-inverse);
}
.message-avatar.user {
  background: var(--accent);
  color: var(--text-inverse);
}
.message-body { flex: 1; max-width: 600px; }
.message-sender {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}
.message-content {
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-surface);
  padding: 16px 20px;
  border-radius: 2px var(--radius-md) var(--radius-md) var(--radius-md);
  border: none;
}
.message.from-user { flex-direction: row-reverse; }
.message.from-user .message-body { text-align: right; }
.message.from-user .message-content {
  background: var(--bg-dark);
  color: var(--text-inverse);
  border-radius: var(--radius-md) 2px var(--radius-md) var(--radius-md);
  text-align: left;
}
.message-attachment {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-surface);
  border: 1px dashed var(--border-dark);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
}
.message.from-user .message-attachment {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
}
.chat-input-area {
  padding: 20px 32px;
  background: var(--bg-white);
  border-top: 1px solid var(--border);
}
.chat-input-wrapper {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 12px 18px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  outline: none;
  resize: none;
  min-height: 46px;
  transition: border-color var(--transition);
  color: var(--text-primary);
  background: var(--bg-white);
}
.chat-input::placeholder { color: var(--text-tertiary); }
.chat-input:focus { border-color: var(--text-primary); }
.chat-upload-btn {
  width: 46px;
  height: 46px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-md);
  background: var(--bg-white);
  color: var(--text-tertiary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.chat-upload-btn:hover { border-color: var(--text-primary); color: var(--text-primary); }
.chat-send-btn {
  width: 46px;
  height: 46px;
  background: var(--bg-dark);
  border: none;
  border-radius: var(--radius-md);
  color: var(--text-inverse);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.chat-send-btn:hover { background: var(--bg-darker); }

/* ===== SESSION TABLE ===== */
.session-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.session-table thead th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.session-table tbody td {
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.session-table tbody tr:hover td { background: var(--bg-surface); }
.session-table .user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.session-table .mini-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}
.status-dot::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.status-dot.complete::before { background: var(--green); }
.status-dot.in-progress::before { background: var(--accent); animation: pulse 2s infinite; }
.status-dot.assigned::before { background: var(--text-tertiary); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== CONSOLIDATION VIEW ===== */
.consolidation-panel {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.consolidation-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.consolidation-body {
  padding: 32px;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-primary);
}
.consolidation-body h3 {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--text-primary);
  margin: 24px 0 8px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
.consolidation-body h3:first-child { margin-top: 0; }
.consolidation-body ul {
  padding-left: 20px;
  margin: 8px 0;
}
.consolidation-body li { margin-bottom: 6px; }
.conflict-callout {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 12px 0;
  font-size: 14px;
}
.conflict-callout strong { color: var(--accent); }

/* ===== STAKEHOLDER DASHBOARD ===== */
.session-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  max-width: 700px;
}
.session-card {
  background: var(--bg-surface);
  border: none;
  border-radius: var(--radius-md);
  padding: 28px 32px;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
}
.session-card::after {
  content: '\2192';
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%) translateX(-4px);
  font-size: 18px;
  color: var(--text-tertiary);
  transition: all var(--transition);
}
.session-card:hover {
  background: var(--bg-white);
}
.session-card:hover::after {
  color: var(--accent);
  transform: translateY(-50%) translateX(0);
}
.session-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}
.session-card-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}
.session-card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.session-card-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ===== COMPLETE BUTTON / BANNER ===== */
.complete-banner {
  padding: 12px 32px;
  background: var(--green-light);
  border-top: 1px solid rgba(34, 197, 94, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}
.complete-banner p { font-size: 14px; color: var(--green); font-weight: 500; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-tertiary);
}
.empty-state-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.4;
}
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 700;
}
.empty-state p { font-size: 14px; }

/* ===== USER MANAGEMENT TABLE ===== */
.user-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.user-table thead th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.user-table tbody td {
  padding: 12px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.user-table tbody tr:hover td { background: var(--bg-surface); }
.role-select {
  font-family: var(--font-body);
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: var(--bg-white);
  cursor: pointer;
}

/* ===== BACKGROUND PATTERN — REMOVED (kept class for compat) ===== */
.page-bg-pattern {
  display: none;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp 0.5s ease forwards; }
.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }
.delay-4 { animation-delay: 0.4s; opacity: 0; }
.delay-5 { animation-delay: 0.5s; opacity: 0; }
.delay-6 { animation-delay: 0.6s; opacity: 0; }

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 14px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: var(--bg-white);
  outline: none;
  transition: border-color var(--transition);
}
.form-input:focus { border-color: var(--text-primary); }
.form-input::placeholder { color: var(--text-tertiary); }
.form-textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  padding: 10px 14px;
  border: 1px solid var(--border-dark);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  background: var(--bg-white);
  outline: none;
  resize: vertical;
  min-height: 100px;
  transition: border-color var(--transition);
}
.form-textarea:focus { border-color: var(--text-primary); }

/* ===== FLASH MESSAGES ===== */
.flash-messages { padding: 0 32px; max-width: 1200px; margin: 16px auto 0; }
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
}
.flash-success { background: var(--green-light); color: var(--green); }
.flash-error { background: var(--red-light); color: var(--red); }
.flash-info { background: var(--blue-light); color: var(--blue); }
