/* 
  RiskOS V2: Premium Light Corporate Boardroom Design System
  Author: Antigravity AI
  Typography: Outfit (Headers), Inter (Dense/Tabular data)
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Colors */
  --bg-primary: #F8FAFC;       /* Soft corporate off-white background */
  --bg-secondary: #FFFFFF;     /* Pure white panels */
  --bg-tertiary: #F1F5F9;      /* Subtle inputs and headers */
  --panel-bg: rgba(255, 255, 255, 0.85); /* Frosted white glass */
  --border-color: rgba(0, 0, 0, 0.06);   /* Ultra-delicate boundary lines */
  --border-glow: rgba(79, 70, 229, 0.08);
  
  /* Text */
  --text-primary: #0F172A;     /* Deep slate charcoal text */
  --text-secondary: #475569;   /* Warm dark grey subheaders */
  --text-muted: #94A3B8;       /* Muted captions */
  
  /* Status Colors (Tailored for Light Backdrops) */
  --color-above-appetite: #E11D48; /* Clean Crimson Rose */
  --glow-above-appetite: rgba(225, 29, 72, 0.08);
  
  --color-near-appetite: #D97706;  /* Warm Amber */
  --glow-near-appetite: rgba(217, 119, 6, 0.06);
  
  --color-within-appetite: #059669; /* Rich Emerald */
  --glow-within-appetite: rgba(5, 150, 105, 0.08);
  
  --color-indigo: #00B5B5;       /* NAVIS Premium Compass Teal */
  --glow-indigo: rgba(0, 181, 181, 0.15);
  
  --color-blue: #2563EB;         /* Corporate Blue */
  --glow-blue: rgba(37, 99, 235, 0.08);
  
  /* Fonts */
  --font-header: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Layout */
  --sidebar-width: 280px;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-header);
  color: var(--text-primary);
  font-weight: 600;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-indigo);
}

/* --- APP LAYOUT --- */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  position: relative;
  background-image: 
    radial-gradient(circle at 10% 10%, rgba(79, 70, 229, 0.03) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(225, 29, 72, 0.02) 0%, transparent 40%);
}

/* --- SIDEBAR NAV (Cohesive White Premium Sidebar) --- */
.sidebar {
  width: var(--sidebar-width);
  background-color: #FFFFFF;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  z-index: 10;
  flex-shrink: 0;
  box-shadow: 2px 0 16px rgba(0, 0, 0, 0.015);
}

.brand-section {
  padding: 24px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--color-above-appetite), var(--color-indigo));
  box-shadow: 0 4px 10px var(--glow-above-appetite);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-family: var(--font-header);
  color: white;
}

.brand-name {
  font-family: var(--font-header);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #0F172A 60%, var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-section {
  padding: 20px 12px;
  flex-grow: 1;
  overflow-y: auto;
}

.nav-group-title {
  font-family: var(--font-header);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  margin-left: 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.nav-link:hover {
  background-color: rgba(0, 0, 0, 0.02);
  color: var(--text-primary);
}

.nav-link.active {
  background: rgba(79, 70, 229, 0.05);
  border-color: rgba(79, 70, 229, 0.12);
  color: var(--color-indigo);
  font-weight: 600;
}

.nav-link i, .nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.user-profile-section {
  padding: 16px 20px;
  border-top: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.005);
}

.profile-role-badge {
  font-size: 10px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--color-indigo);
  letter-spacing: 0.5px;
  display: block;
}

.profile-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.profile-company {
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- MAIN FRAME CONTENT --- */
.main-content {
  flex-grow: 1;
  height: 100vh;
  overflow-y: auto;
  padding: 32px;
  position: relative;
}

.page-header {
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.page-title-wrap h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.8px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 4px;
}

/* --- PREMIUM CARD & GLASS PANEL --- */
.glass-panel {
  background-color: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  backdrop-filter: blur(16px);
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.02);
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
  border-color: rgba(0, 0, 0, 0.12);
}

.glass-panel.clickable {
  cursor: pointer;
}

/* --- EXECUTIVE TICKER --- */
.ticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.ticker-card {
  display: flex;
  flex-direction: column;
  padding: 18px 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: #FFFFFF;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.01);
}

.ticker-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
}

.ticker-card.above::before { background-color: var(--color-above-appetite); }
.ticker-card.near::before { background-color: var(--color-near-appetite); }
.ticker-card.within::before { background-color: var(--color-within-appetite); }
.ticker-card.indigo::before { background-color: var(--color-indigo); }

.ticker-card.above { box-shadow: 0 4px 12px rgba(225, 29, 72, 0.02); }
.ticker-card.near { box-shadow: 0 4px 12px rgba(217, 119, 6, 0.01); }
.ticker-card.within { box-shadow: 0 4px 12px rgba(5, 150, 105, 0.01); }

.ticker-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.ticker-value {
  font-size: 32px;
  font-weight: 700;
  font-family: var(--font-header);
  color: var(--text-primary);
  margin-top: 6px;
  line-height: 1;
}

.ticker-footer {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* --- DASHBOARD LAYOUT GRID --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 24px;
  margin-bottom: 24px;
}

.dashboard-card-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* --- HEATMAP (5x5 Grid) --- */
.heatmap-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: rgba(0, 0, 0, 0.015);
  border-radius: 12px;
  margin-bottom: 12px;
}

.heatmap-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.heatmap-cell {
  flex: 1;
  aspect-ratio: 1.8;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
  position: relative;
}

.heatmap-cell:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
}

.heatmap-cell.selected {
  outline: 2px solid var(--color-indigo);
  transform: scale(1.03);
  z-index: 2;
}

.heatmap-label-y {
  width: 24px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  padding-right: 8px;
}

.heatmap-row-x {
  display: flex;
  margin-left: 24px;
  margin-top: 4px;
  gap: 6px;
}

.heatmap-label-x {
  flex: 1;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-align: center;
}

/* Cell scoring colors mapping */
.cell-1 { background-color: rgba(5, 150, 105, 0.08); color: rgba(5, 150, 105, 0.85); border: 1px dashed rgba(5, 150, 105, 0.2); }
.cell-2 { background-color: rgba(5, 150, 105, 0.15); color: #059669; border: 1px solid rgba(5, 150, 105, 0.25); }
.cell-3 { background-color: rgba(217, 119, 6, 0.12); color: #D97706; border: 1px solid rgba(217, 119, 6, 0.2); }
.cell-4 { background-color: rgba(225, 29, 72, 0.1); color: #E11D48; border: 1px solid rgba(225, 29, 72, 0.2); }
.cell-5 { background-color: rgba(225, 29, 72, 0.2); color: #E11D48; border: 1px solid #E11D48; box-shadow: 0 0 8px rgba(225, 29, 72, 0.05); }

/* --- RISK NETWORK VISUALIZER --- */
.network-container {
  width: 100%;
  height: 380px;
  border-radius: 12px;
  background: #FAFBFD;
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.network-svg {
  width: 100%;
  height: 100%;
}

.network-node {
  cursor: pointer;
  transition: all 0.3s ease;
}

.network-node circle {
  stroke-width: 1.5;
  transition: all 0.3s ease;
}

.network-node:hover circle {
  stroke-width: 3;
}

.network-node.selected circle {
  stroke: var(--text-primary) !important;
  stroke-width: 3px;
  filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.15));
}

.network-node.active-chain circle {
  stroke-width: 2.5px;
  stroke-dasharray: 4;
  animation: strokeRotate 10s linear infinite;
}

.network-node text {
  font-family: var(--font-header);
  font-size: 10px;
  font-weight: 600;
  fill: var(--text-secondary);
  pointer-events: none;
}

.network-node:hover text, .network-node.selected text {
  fill: var(--text-primary);
  font-size: 11px;
}

.network-link {
  stroke-dasharray: 4;
  stroke-linecap: round;
  animation: dashMove 20s linear infinite;
}

.network-link.active-chain {
  stroke-width: 2px !important;
  animation: dashMove 5s linear infinite;
}

@keyframes dashMove {
  to {
    stroke-dashoffset: -40;
  }
}

/* --- STRATEGIC FRAGILITY MAP --- */
.fragility-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fragility-bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.fragility-bar-header {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.fragility-bar-outer {
  height: 10px;
  background-color: var(--bg-tertiary);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}

.fragility-bar-inner {
  height: 100%;
  border-radius: 5px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(90deg, var(--color-indigo), var(--color-above-appetite));
}

/* --- TREND TABLES & STATUS BADGES --- */
.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  padding: 12px 16px;
  font-family: var(--font-header);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

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

.custom-table tbody tr:hover td {
  background-color: rgba(0, 0, 0, 0.01);
}

/* Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  gap: 6px;
  line-height: 1;
}

.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.status-badge.above {
  background-color: rgba(225, 29, 72, 0.08);
  color: var(--color-above-appetite);
  border: 1px solid rgba(225, 29, 72, 0.15);
}
.status-badge.above::before { background-color: var(--color-above-appetite); }

.status-badge.near {
  background-color: rgba(217, 119, 6, 0.06);
  color: var(--color-near-appetite);
  border: 1px solid rgba(217, 119, 6, 0.15);
}
.status-badge.near::before { background-color: var(--color-near-appetite); }

.status-badge.within {
  background-color: rgba(5, 150, 105, 0.06);
  color: var(--color-within-appetite);
  border: 1px solid rgba(5, 150, 105, 0.15);
}
.status-badge.within::before { background-color: var(--color-within-appetite); }

/* Trend Indicator */
.trend-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 12px;
}

.trend-tag.deteriorating { color: var(--color-above-appetite); }
.trend-tag.improving { color: var(--color-within-appetite); }
.trend-tag.stable { color: var(--text-secondary); }

/* --- RISK REGISTER REGISTER FORM --- */
.register-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
}

.details-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-family: var(--font-header);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-indigo);
  box-shadow: 0 0 10px rgba(79, 70, 229, 0.15);
}

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

.slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.slider-group input[type="range"] {
  flex-grow: 1;
  accent-color: var(--color-indigo);
  cursor: pointer;
  height: 6px;
  border-radius: 3px;
}

.slider-value {
  width: 24px;
  font-family: var(--font-header);
  font-size: 14px;
  font-weight: 700;
  text-align: right;
}

/* AI Copilot Suggestion Box */
.copilot-suggestion {
  background: rgba(79, 70, 229, 0.05);
  border: 1px dashed rgba(79, 70, 229, 0.3);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
  position: relative;
  animation: fadeIn 0.3s ease;
}

.copilot-title {
  font-family: var(--font-header);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-indigo);
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.copilot-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.copilot-apply-btn {
  margin-top: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-family: var(--font-header);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  font-size: 13px;
}

.btn-primary {
  background-color: var(--color-indigo);
  color: white;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
  background-color: #3F37C9;
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.35);
}

.btn-secondary {
  background-color: transparent;
  border-color: rgba(0, 0, 0, 0.12);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
  background-color: rgba(0, 0, 0, 0.02);
}

.btn-danger {
  background-color: rgba(225, 29, 72, 0.05);
  border-color: rgba(225, 29, 72, 0.2);
  color: var(--color-above-appetite);
}

.btn-danger:hover {
  background-color: var(--color-above-appetite);
  color: white;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
}

/* --- BOARD QUESTIONS QA CHAT --- */
.board-qa-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  height: 580px;
}

.preset-question-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.preset-question-card {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: #FFFFFF;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
  color: var(--text-secondary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.005);
}

.preset-question-card:hover {
  background-color: rgba(0, 0, 0, 0.015);
  border-color: rgba(0, 0, 0, 0.1);
  color: var(--text-primary);
}

.preset-question-card.active {
  background-color: rgba(79, 70, 229, 0.05);
  border-color: var(--color-indigo);
  color: var(--color-indigo);
  font-weight: 600;
}

.chat-window {
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  background-color: #FFFFFF;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.015);
}

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.005);
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-within-appetite);
  box-shadow: 0 0 6px var(--color-within-appetite);
}

.chat-messages {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-bubble {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: 12px;
  line-height: 1.5;
  animation: slideInUp 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-bubble.bot {
  background-color: #F8FAFC;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  align-self: flex-start;
}

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

.chat-bubble-loader {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
}

.chat-bubble-loader span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-secondary);
  animation: dotFlash 1.4s infinite linear;
}

.chat-bubble-loader span:nth-child(2) { animation-delay: 0.2s; }
.chat-bubble-loader span:nth-child(3) { animation-delay: 0.4s; }

.chat-input-bar {
  display: flex;
  padding: 16px;
  border-top: 1px solid var(--border-color);
  background-color: rgba(0, 0, 0, 0.008);
  gap: 12px;
}

/* --- BOARD NARRATIVE DRAWER --- */
.board-brief-markdown {
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--text-primary);
}

.board-brief-markdown h3, .board-brief-markdown h4 {
  font-family: var(--font-header);
  color: var(--text-primary);
  margin-top: 18px;
  margin-bottom: 8px;
}

.board-brief-markdown hr {
  border: 0;
  height: 1px;
  background: var(--border-color);
  margin: 16px 0;
}

.board-brief-markdown ul {
  padding-left: 20px;
  margin-bottom: 12px;
}

.board-brief-markdown li {
  margin-bottom: 6px;
}

/* --- ANIMATIONS --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes dotFlash {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

@keyframes strokeRotate {
  to { stroke-dashoffset: -80; }
}

/* --- High-Velocity Pulsing Glow (F3) --- */
.heatmap-cell.velocity-glow {
  box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.4);
  animation: pulse-glow-above 1.6s infinite cubic-bezier(0.66, 0, 0, 1);
  border: 1.5px solid var(--color-above-appetite) !important;
}

@keyframes pulse-glow-above {
  0% {
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.6);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(225, 29, 72, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(225, 29, 72, 0);
  }
}

/* --- PUBLIC ROUTES & AUTH BOUNDARY --- */
.is-hidden {
  display: none !important;
}

body.public-page {
  overflow: auto;
  height: auto;
  min-height: 100vh;
}

body.app-page {
  overflow: hidden;
  height: 100vh;
}

.public-route-container {
  min-height: 100vh;
  background:
    linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 48%, #EEF4F8 100%);
}

.public-page-shell {
  width: 100%;
  min-height: 100vh;
}

.public-nav,
.public-footer {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.public-nav {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.public-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text-primary);
  text-decoration: none;
  font-family: var(--font-header);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.public-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, #0F6E7A, var(--color-indigo));
  color: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
}

.public-nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.public-nav a,
.contact-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
}

.public-nav a:hover,
.contact-nav a:hover {
  color: var(--text-primary);
}

.public-route-container .btn-primary,
.public-route-container .btn-primary:hover {
  color: #FFFFFF;
}

.public-route-container .btn-primary:hover {
  background-color: #0F6E7A;
  box-shadow: 0 4px 16px rgba(15, 110, 122, 0.22);
}

.public-home {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.public-hero {
  min-height: calc(100vh - 190px);
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(320px, 0.74fr);
  gap: 56px;
  align-items: center;
  padding: 34px 0 48px;
}

.public-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(0, 181, 181, 0.08);
  border: 1px solid rgba(0, 181, 181, 0.16);
  color: #0F6E7A;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin-top: 18px;
  font-size: 70px;
  line-height: 0.96;
  font-weight: 800;
  letter-spacing: 0;
}

.hero-tagline {
  margin-top: 16px;
  font-family: var(--font-header);
  font-size: 28px;
  font-weight: 600;
  color: #123D54;
}

.hero-description,
.hero-support,
.section-copy p,
.auth-card p {
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.65;
}

.hero-description {
  max-width: 700px;
  margin-top: 18px;
}

.hero-support {
  max-width: 760px;
  margin-top: 14px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.hero-signal-panel {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: #FFFFFF;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}

.signal-header,
.signal-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.signal-header {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-header);
  font-weight: 700;
}

.signal-metric-row {
  margin-top: 18px;
  color: var(--text-secondary);
}

.signal-metric-row strong {
  color: var(--color-above-appetite);
  font-family: var(--font-header);
  font-size: 22px;
}

.signal-bars {
  height: 180px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  gap: 12px;
  margin: 24px 0;
  padding: 16px;
  border-radius: 8px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
}

.signal-bars span {
  display: block;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--color-indigo), #2563EB);
}

.signal-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.signal-grid div {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: #FFFFFF;
}

.signal-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.signal-grid strong {
  display: block;
  margin-top: 4px;
  font-family: var(--font-header);
  font-size: 20px;
}

.public-section {
  padding: 72px 0;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.public-section-split {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(280px, 0.58fr);
  gap: 48px;
  align-items: start;
}

.section-copy h2 {
  margin-top: 14px;
  font-size: 38px;
  line-height: 1.08;
  letter-spacing: 0;
}

.section-copy p {
  max-width: 850px;
  margin-top: 16px;
}

.capability-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.capability-card {
  min-height: 116px;
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: #FFFFFF;
}

.capability-dot {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-indigo);
  margin-bottom: 16px;
}

.capability-card h3 {
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

.intelligence-list {
  display: grid;
  gap: 10px;
}

.intelligence-list span {
  display: block;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #FFFFFF;
  color: var(--text-secondary);
  font-weight: 600;
}

.public-footer {
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-muted);
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.auth-page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
}

.auth-brand {
  position: absolute;
  top: 28px;
  left: 32px;
}

.auth-card {
  width: min(440px, 100%);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: #FFFFFF;
  padding: 34px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.08);
}

.auth-card h1 {
  margin-top: 14px;
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: 0;
}

.auth-card p {
  margin-top: 10px;
}

.auth-form {
  margin-top: 26px;
}

.auth-submit {
  width: 100%;
  justify-content: center;
}

.auth-submit:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.auth-message {
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 16px;
}

.auth-message.error {
  border: 1px solid rgba(225, 29, 72, 0.18);
  background: rgba(225, 29, 72, 0.06);
  color: var(--color-above-appetite);
}

.auth-message.success {
  border: 1px solid rgba(5, 150, 105, 0.18);
  background: rgba(5, 150, 105, 0.06);
  color: var(--color-within-appetite);
}

.contact-shell {
  display: block;
}

.contact-nav {
  width: min(920px, 100%);
  min-height: 54px;
  margin: 0 auto 42px;
}

.contact-card {
  width: min(620px, 100%);
  margin: 0 auto;
}

.main-content {
  display: flex;
  flex-direction: column;
}

#page-render-container {
  flex: 1 0 auto;
}

.private-preview-footer {
  flex: 0 0 auto;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sign-out-button {
  width: 100%;
  justify-content: center;
  margin-top: 14px;
}

@media (max-width: 920px) {
  .public-hero,
  .public-section-split {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .public-hero {
    min-height: auto;
    padding: 28px 0 44px;
  }

  .hero-copy h1 {
    font-size: 52px;
  }

  .hero-tagline {
    font-size: 24px;
  }

  .hero-signal-panel {
    max-width: 560px;
  }

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

@media (max-width: 640px) {
  .public-nav,
  .public-footer,
  .public-home {
    width: min(100% - 32px, 1180px);
  }

  .public-nav {
    min-height: 68px;
  }

  .public-nav-actions {
    gap: 10px;
  }

  .public-nav-actions a:not(.btn) {
    display: none;
  }

  .hero-copy h1 {
    font-size: 44px;
  }

  .hero-tagline {
    font-size: 21px;
  }

  .hero-description,
  .hero-support,
  .section-copy p,
  .auth-card p {
    font-size: 15px;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .signal-bars {
    height: 130px;
    gap: 8px;
  }

  .signal-grid,
  .capability-grid {
    grid-template-columns: 1fr;
  }

  .public-section {
    padding: 48px 0;
  }

  .section-copy h2 {
    font-size: 30px;
  }

  .auth-brand {
    position: static;
    margin-bottom: 28px;
    justify-self: start;
  }

  .auth-page-shell {
    display: block;
  }

  .auth-card {
    padding: 26px 20px;
  }

  .auth-card h1 {
    font-size: 29px;
  }
}

/* --- PRINT MEDIA RULES (PDF Pack) --- */
@media print {
  body {
    background-color: white !important;
    color: black !important;
    font-size: 12px !important;
  }
  
  .sidebar, .nav-section, .chat-input-bar, .btn, .no-print {
    display: none !important;
  }
  
  .app-container {
    background-image: none !important;
  }
  
  .main-content {
    padding: 0 !important;
    overflow: visible !important;
    height: auto !important;
    width: 100% !important;
  }
  
  .glass-panel {
    background: transparent !important;
    border: 1px solid #CCC !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    page-break-inside: avoid;
    margin-bottom: 20px !important;
  }
  
  .network-container {
    border: 1px solid #CCC !important;
  }
  
  .custom-table th, .custom-table td {
    border-bottom: 1px solid #CCC !important;
    color: black !important;
  }
  
  .status-badge {
    border: 1px solid black !important;
    color: black !important;
    background: transparent !important;
    box-shadow: none !important;
  }
}
