:root {
  /* Colors - Dark Theme */
  --bg-dark: #0f1115;
  --bg-card: #161b22;
  --bg-sidebar: #0a0c10;
  --primary: #2f80ed;
  --primary-hover: #1c6ddb;
  --text-main: #ffffff;
  --text-muted: #8b949e;
  --border: #30363d;
  --success: #2ea043;
  --warning: #d29922;
  --danger: #f85149;

  /* Dimensions */
  --sidebar-width: 260px;
  --header-height: 64px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* Copilot Sidebar Styles */
.copilot-sidebar {
  position: fixed;
  top: 0;
  right: -350px;
  /* Hidden by default */
  width: 350px;
  height: 100vh;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  transition: right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
}

.copilot-sidebar.open {
  right: 0;
}

.copilot-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  transition: transform 0.2s;
  z-index: 1001;
}

.copilot-toggle:hover {
  transform: scale(1.1);
}

.chat-container {
  flex-grow: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.5;
  max-width: 90%;
}

.chat-message.ai {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  align-self: flex-start;
  color: var(--text);
}

.chat-message.user {
  background: var(--primary);
  color: white;
  align-self: flex-end;
}

.suggestion-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.suggestion-pill:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary);
}

.nav-links {
  list-style: none;
  padding: 0;
  margin: 0;
  flex: 1;
}

.nav-item {
  margin-bottom: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--text-muted);
  border-radius: 6px;
  transition: all 0.2s;
  cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
  background-color: rgba(47, 128, 237, 0.1);
  color: var(--primary);
}

.nav-link i {
  margin-right: 0.75rem;
  width: 20px;
  text-align: center;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-bar {
  height: var(--header-height);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  background-color: var(--bg-card);
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.content-area {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

/* Components */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

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

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

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

.stat-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
}

.stat-trend {
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.trend-up {
  color: var(--success);
}

.trend-down {
  color: var(--danger);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

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

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

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

.table th,
.table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  color: var(--text-muted);
  font-weight: normal;
}

/* Utility */
.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-4 {
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-risk {
  background-color: rgba(248, 81, 73, 0.15);
  color: var(--danger);
}

.badge-safe {
  background-color: rgba(46, 160, 67, 0.15);
  color: var(--success);
}

/* Animation */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.visible {
  display: flex;
  /* Critical Fix */
  opacity: 1;
}

.modal {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.visible .modal {
  transform: translateY(0);
}

/* Detail View Styles */
.risk-factor-item {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  border-left: 3px solid var(--danger);
}

/* Board Report Styles */
.report-container {
  max-width: 800px;
  margin: 0 auto;
}

@media print {
  body {
    background-color: white;
    color: black;
    height: auto;
    overflow: visible;
  }

  .sidebar,
  .top-bar,
  .no-print,
  .btn {
    display: none !important;
  }

  .main-content,
  .content-area {
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .card {
    background-color: white;
    border: 1px solid #ddd;
    box-shadow: none;
    color: black;
  }

  .stat-label,
  .text-muted {
    color: #666 !important;
  }

  .table th {
    color: #444;
  }

  .table td {
    color: black;
    border-bottom: 1px solid #eee;
  }
}

/* --- Landing Page Extensions --- */
.lp-signal-card {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
}

@keyframes fadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}