/* ========== Sovereignty Exposure Dashboard – Dark Theme ========== */

body.dashboard-page {
  background: #0a1628;
  color: #e0e6f0;
  padding: 0;
}

/* ========== Main Layout ========== */
.dashboard {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 3rem;
  padding-left: calc(var(--sidebar-w) + 2.5rem);
}

/* ========== Header ========== */
.dash-header {
  text-align: center;
  margin-bottom: 2.5rem;
}
.dashboard-page h1 {
  background: linear-gradient(90deg, #ffffff, #0f9bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.dashboard-page h2 {
  color: #6b7a8d;
  font-weight: 500;
}
.dashboard-page h3 {
  color: #e0e6f0;
  text-align: left;
  font-size: 1.15rem;
  margin-bottom: 0.5rem;
}

/* ========== Stats Row ========== */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  padding: 1.5rem 1rem;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  opacity: 0;
  animation: fade-up 0.5s ease-out forwards;
}
.stat-card:nth-child(1) { animation-delay: 0s; }
.stat-card:nth-child(2) { animation-delay: 0.08s; }
.stat-card:nth-child(3) { animation-delay: 0.16s; }
.stat-card:nth-child(4) { animation-delay: 0.24s; }

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}
.stat-label {
  font-size: 0.8rem;
  color: #6b7a8d;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* RAG pills */
.rag-pills {
  display: flex;
  gap: 0.5rem;
}
.rag-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  border-radius: 15px;
  padding: 0 9px;
  font-weight: 700;
  font-size: 0.9rem;
}
.pill-red     { background: var(--rag-red); color: var(--rag-red-text); }
.pill-amber   { background: var(--rag-amber); color: var(--rag-amber-text); }
.pill-green   { background: var(--rag-green); color: var(--rag-green-text); }
.pill-dk-green { background: var(--rag-dk-green); color: var(--rag-dk-green-text); }

/* ========== Sovereignty Bars ========== */
.sov-section {
  margin-bottom: 3rem;
  padding: 2rem;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 14px;
}
.sov-subtitle {
  color: #6b7a8d;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.sov-bars {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sov-bar-row {
  display: grid;
  grid-template-columns: 80px 1fr 50px;
  align-items: center;
  gap: 1rem;
}
.sov-label {
  font-weight: 600;
  font-size: 0.95rem;
  color: #b0bec5;
  text-align: right;
}
.sov-bar-track {
  height: 18px;
  background: rgba(255,255,255,.06);
  border-radius: 9px;
  overflow: hidden;
}
.sov-bar-fill {
  height: 100%;
  border-radius: 9px;
  transform-origin: left;
  transform: scaleX(0);
  animation: bar-grow 0.8s ease-out forwards;
}
.sov-bar-row:nth-child(1) .sov-bar-fill { animation-delay: 0.2s; }
.sov-bar-row:nth-child(2) .sov-bar-fill { animation-delay: 0.35s; }
.sov-bar-row:nth-child(3) .sov-bar-fill { animation-delay: 0.5s; }
.sov-bar-row:nth-child(4) .sov-bar-fill { animation-delay: 0.65s; }

.sov-val {
  font-weight: 700;
  font-size: 1.1rem;
  text-align: left;
  opacity: 0;
  animation: fade-in 0.3s ease-out forwards;
}
.sov-bar-row:nth-child(1) .sov-val { animation-delay: 0.6s; }
.sov-bar-row:nth-child(2) .sov-val { animation-delay: 0.75s; }
.sov-bar-row:nth-child(3) .sov-val { animation-delay: 0.9s; }
.sov-bar-row:nth-child(4) .sov-val { animation-delay: 1.05s; }

/* Bar & text colours */
.sov-bar-fill.sov-green { background: var(--rag-green); }
.sov-bar-fill.sov-amber { background: var(--rag-amber); }
.sov-bar-fill.sov-red   { background: var(--rag-red); }
.sov-bar-fill.sov-grey  { background: #555; }

.sov-val.sov-green, .sov-cell.sov-green { color: var(--rag-green); }
.sov-val.sov-amber, .sov-cell.sov-amber { color: var(--rag-amber); }
.sov-val.sov-red,   .sov-cell.sov-red   { color: var(--rag-red); }
.sov-val.sov-grey,  .sov-cell.sov-grey  { color: #555; }

/* ========== Risks Table ========== */
.risks-section {
  margin-bottom: 3rem;
}
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.06);
  margin-top: 0.75rem;
}

.risks-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.risks-table th {
  background: rgba(255,255,255,.05);
  color: #6b7a8d;
  padding: 0.7rem 1rem;
  text-align: left;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.risks-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.04);
  vertical-align: middle;
}
.risks-table tbody tr:hover td {
  background: rgba(255,255,255,.03);
}

.dep-name {
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}

/* RAG dot */
.rag-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.rag-dot.rag-R { background: var(--rag-red); }
.rag-dot.rag-A { background: var(--rag-amber); }
.rag-dot.rag-G { background: var(--rag-green); }
.rag-dot.rag-D { background: var(--rag-dk-green); }
.rag-dot.rag-none { background: transparent; color: #555; font-size: 0.75rem; }

/* Sovereignty cells */
.sov-cell {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* Notes & activity count */
.notes-cell {
  color: #8899aa;
  font-size: 0.82rem;
  max-width: 180px;
}
.th-acts {
  text-align: center;
}
.acts-cell {
  text-align: center;
  cursor: help;
}
.acts-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  font-weight: 700;
  font-size: 0.85rem;
  color: #b0bec5;
}

/* ========== Navigation Cards ========== */
.nav-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}
.nav-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2rem;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  text-decoration: none;
  color: #e0e6f0;
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
}
.nav-card:hover {
  background: rgba(255,255,255,.08);
  border-color: rgba(15,155,255,.3);
  transform: translateY(-3px);
}
.nav-card i {
  font-size: 2rem;
  color: #0f9bff;
}
.nav-card span {
  font-size: 1.1rem;
  font-weight: 700;
}
.nav-card p {
  font-size: 0.85rem;
  color: #6b7a8d;
  margin: 0;
  text-align: center;
}

/* ========== Animations ========== */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes bar-grow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ========== Reduced motion ========== */
@media (prefers-reduced-motion: reduce) {
  .stat-card,
  .sov-val { opacity: 1; animation: none; }
  .sov-bar-fill { transform: scaleX(1); animation: none; }
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .nav-cards { grid-template-columns: 1fr; }
  .sov-bar-row { grid-template-columns: 60px 1fr 40px; }
}
