/* ============================================================
   FINSIMUL Portal — Stylesheet
   Design language: dark navy glassmorphism, blue/indigo accents
   Adapted from landing/assets/style.css + portal extensions
   ============================================================ */

/* === RESET & BASE === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* === DESIGN TOKENS === */
:root {
  --bg-deep:        #0f172a;
  --bg-surface:     #1e3a5f;
  --accent-blue:    #38bdf8;
  --accent-indigo:  #818cf8;
  --text-muted:     #64748b;
  --text-body:      #e2e8f0;
  --glass-bg:       rgba(255, 255, 255, 0.04);
  --glass-border:   rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.16);
  --radius-card:    1.5rem;
  --radius-btn:     0.75rem;
  --radius-pill:    999px;
  --shadow-card:    0 4px 32px rgba(0, 0, 0, 0.4);
  --shadow-btn:     0 4px 20px rgba(56, 189, 248, 0.25);
  --transition:     0.2s ease;
  --header-height:  72px;
}

/* === BODY & BACKGROUND === */
html { scroll-behavior: smooth; scrollbar-gutter: stable; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-surface) 50%, var(--bg-deep) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1; }

/* === TYPOGRAPHY === */
h1, h2, h3, h4 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--text-body);
}

h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 900; letter-spacing: -1.5px; }
h2 { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -0.5px; }
h3 { font-size: clamp(1rem, 2vw, 1.3rem);  font-weight: 700; }
h4 { font-size: 1rem; font-weight: 600; }

p {
  color: var(--text-body);
  font-size: 1rem;
  line-height: 1.75;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--accent-indigo); }

.header-logo-mark,
.footer-logo-mark {
  height: 32px;
  width: auto;
}

.header-logo-word {
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--text-body);
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.footer-logo-mark {
  height: 28px;
}

.footer-logo-word {
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--text-body);
}

/* === LAYOUT === */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* === HEADER === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  height: var(--header-height);
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  flex-wrap: nowrap;
  gap: 1rem;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo img {
  height: 32px;
  width: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* === MOBILE NAV TOGGLE (hamburger) === */
.site-nav-toggle {
  display: none; /* visible only below the responsive breakpoint */
  width: 40px;
  height: 40px;
  padding: 0;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.4rem;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.site-nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--accent-blue);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.site-nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.site-nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.site-nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* === FOOTER === */
.site-footer {
  background: rgba(15, 23, 42, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  height: var(--header-height);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.footer-tagline {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.footer-copy {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* === BUTTONS === */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: linear-gradient(90deg, var(--accent-blue) 0%, var(--accent-indigo) 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-btn);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition);
  letter-spacing: 0.02em;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-btn);
  color: #fff;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: transparent;
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(56, 189, 248, 0.35);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  letter-spacing: 0.02em;
}

.btn-ghost:hover {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.6);
  color: var(--accent-blue);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.45rem 1rem;
  font-size: 0.8rem;
}

/* Google sign-in button */
.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.75rem 1.75rem;
  background: #fff;
  color: #3c4043;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius-btn);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  text-decoration: none;
  transition: box-shadow var(--transition), transform var(--transition);
  letter-spacing: 0.01em;
  width: 100%;
}

.btn-google:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transform: translateY(-1px);
  color: #3c4043;
}

/* === BADGES === */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: var(--accent-blue);
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-blue);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.badge-portal {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: var(--accent-blue);
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-dot-portal {
  width: 6px;
  height: 6px;
  background: var(--accent-blue);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.env-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-pill);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.env-tag--dev {
  background: rgba(129, 140, 248, 0.15);
  border: 1px solid rgba(129, 140, 248, 0.45);
  color: #818cf8;
}

.env-tag--test {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #f59e0b;
}

.env-tag--prod {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #38bdf8;
}

.badge-warning {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: #fbbf24;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* === SECTIONS === */
.section { padding: 4rem 0; }

.divider {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin: 1.5rem 0;
}

/* === CARD === */
.card-feature {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  backdrop-filter: blur(10px);
  padding: 1.75rem;
  transition: border-color var(--transition), transform var(--transition);
}

.card-feature:hover {
  border-color: rgba(56, 189, 248, 0.2);
  transform: translateY(-3px);
}

.card-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.card-feature h3 { margin-bottom: 0.5rem; font-size: 1.05rem; }

.card-feature p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* === SPLASH (login / denied pages) === */
.splash-wrap {
  min-height: calc(100vh - var(--header-height) - 100px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}

.splash-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 3rem 3.5rem;
  text-align: center;
  max-width: 480px;
  width: 100%;
}

.splash-card img {
  height: 48px;
  width: auto;
  margin-bottom: 1.5rem;
}

.splash-card h1 { font-size: 1.75rem; margin-bottom: 0.5rem; }

.splash-sub {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.splash-message {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.75;
  margin: 1rem 0;
}

.splash-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.splash-actions .btn-ghost,
.splash-actions .btn-primary,
.splash-actions .btn-google {
  width: 100%;
  justify-content: center;
}

.splash-meta {
  margin-top: 2rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* === PORTAL — user info in header === */
.portal-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  object-fit: cover;
}

.user-email {
  font-size: 0.85rem;
  color: var(--text-muted);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === PORTAL — welcome + dashboard grid === */
.portal-welcome {
  margin-bottom: 0.5rem;
}

.portal-welcome h1 {
  margin-bottom: 0.75rem;
}

.portal-sub {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.8;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  margin-top: 2rem;
}

/* === ANIMATIONS === */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* === RESPONSIVE === */
@media (max-width: 900px) {
  .portal-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .portal-grid { grid-template-columns: 1fr; }
  .user-email  { display: none; }
  .splash-card { padding: 2rem 1.5rem; }
  .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  :root { --header-height: 64px; }
  .splash-card { padding: 2rem 1.25rem; }
}

/* === MOBILE NAV COLLAPSE (≤768px) ===
   Per design-language.md: "Navigation collapses to hamburger below 768px".
   Below the breakpoint the eight nav groups stack vertically inside a
   slide-down drawer so the eight-item header no longer overflows. */
@media (max-width: 768px) {
  .site-nav-toggle { display: flex; }

  .site-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem 1rem 1.25rem;
    background: rgba(15, 23, 42, 0.98);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    z-index: 150;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  }
  .site-nav.site-nav--open { display: flex; }

  .nav-link {
    padding: 0.7rem 0.75rem;
    font-size: 0.9rem;
  }

  .nav-group { width: 100%; }

  .nav-group-btn {
    width: 100%;
    padding: 0.7rem 0.75rem;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    cursor: default;
  }
  .nav-group-btn .nav-caret { display: none; }
  .nav-group:hover .nav-group-btn,
  .nav-group:focus-within .nav-group-btn {
    background: transparent;
  }

  /* Inline-expand all dropdown panels — no hover/tap state needed. */
  .nav-dropdown {
    position: static;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0 0 0.4rem 0.75rem;
    min-width: 0;
  }
  .nav-dropdown::before { display: none; }
  .nav-group:hover .nav-dropdown,
  .nav-group:focus-within .nav-dropdown {
    transform: none;
  }
  .nav-dropdown-item { padding: 0.55rem 0.75rem; font-size: 0.85rem; }
}

/* ============================================================
   PORTAL APP COMPONENTS
   (authenticated portal — nav, tables, forms, badges)
   ============================================================ */

/* === NAV LINKS === */
.nav-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  padding: 0.3rem 0.6rem;
  border-radius: 0.4rem;
  transition: color var(--transition), background var(--transition);
  white-space: nowrap;
}
.nav-link:hover,
.nav-link--active {
  color: var(--text-body);
  background: rgba(255, 255, 255, 0.05);
}

/* === NAV DROPDOWN GROUPS === */
.nav-group {
  position: relative;
}

.nav-group-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  padding: 0.3rem 0.6rem;
  border-radius: 0.4rem;
  cursor: default;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
  user-select: none;
}

.nav-group-btn .nav-caret {
  font-size: 0.55rem;
  opacity: 0.6;
  transition: transform 0.15s ease;
  line-height: 1;
  margin-top: 1px;
}

.nav-group:hover .nav-group-btn,
.nav-group:focus-within .nav-group-btn {
  color: var(--text-body);
  background: rgba(255, 255, 255, 0.05);
}

.nav-group:hover .nav-caret,
.nav-group:focus-within .nav-caret {
  transform: rotate(180deg);
}

/* Active group: label brightens when a child page is active */
.nav-group-btn--active {
  color: var(--text-body);
}

.nav-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 50%;
  transform: translateX(-50%);
  min-width: 176px;
  background: rgba(15, 23, 42, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 0.75rem;
  padding: 0.35rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  /* hidden by default */
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(-6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 200;
}

/* small arrow pointing up */
.nav-dropdown::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px;
  height: 8px;
  background: rgba(15, 23, 42, 0.98);
  border-left: 1px solid rgba(255, 255, 255, 0.10);
  border-top: 1px solid rgba(255, 255, 255, 0.10);
}

.nav-group:hover .nav-dropdown,
.nav-group:focus-within .nav-dropdown {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
}

.nav-dropdown-item:hover {
  color: var(--text-body);
  background: rgba(255, 255, 255, 0.06);
}

.nav-dropdown-item--active {
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.08);
}

.nav-dropdown-item--active:hover {
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.12);
}

.nav-dropdown-icon {
  font-size: 0.9rem;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.07);
  margin: 0.3rem 0.5rem;
}

/* Coming-soon items in dropdown */
.nav-dropdown-item--soon {
  color: var(--text-muted);
  opacity: 0.45;
  cursor: default;
  pointer-events: none;
  font-style: italic;
}

.nav-soon-badge {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(129, 140, 248, 0.12);
  border: 1px solid rgba(129, 140, 248, 0.2);
  color: var(--accent-indigo);
  opacity: 1;
}

/* === FLASH MESSAGES === */
.flash-messages { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1.5rem; }
.flash {
  padding: 0.75rem 1.1rem;
  border-radius: 0.6rem;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.5;
}
.flash-success { background: rgba(34,197,94,0.12); border: 1px solid rgba(34,197,94,0.3); color: #4ade80; }
.flash-error   { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.3);  color: #f87171; }
.flash-warning { background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.3); color: #fbbf24; }
.flash-invite  {
  background: rgba(129,140,248,0.12);
  border: 1px solid rgba(129,140,248,0.3);
  color: var(--accent-indigo);
  font-family: monospace;
  font-size: 0.82rem;
  word-break: break-all;
}

/* === PAGE HEADER === */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-header h2 { margin-bottom: 0; }

.page-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
}

/* Row that holds h2 + help button side by side */
.page-title-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

/* ── Page info (?) floating popup ───────────────────────────── */
.page-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.page-info-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(100, 116, 139, 0.12);
  border: 1px solid rgba(100, 116, 139, 0.28);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  margin-top: 0.2rem;
}
.page-info-btn:hover,
.page-info-btn[aria-expanded="true"] {
  background: rgba(56, 189, 248, 0.14);
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--accent-blue);
}
.page-info-btn:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 3px;
}

/* Floating popup */
.page-info-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 200;
  width: 380px;
  max-width: min(380px, calc(100vw - 2rem));
  max-height: 480px;
  overflow-y: auto;
  background: rgba(10, 18, 35, 0.98);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 0.875rem;
  padding: 1rem 1.25rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(56, 189, 248, 0.05);
  backdrop-filter: blur(16px);
  /* Hidden state — use opacity/visibility for CSS transitions */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
}

/* Triangle caret pointing up to the button */
.page-info-panel::before {
  content: '';
  position: absolute;
  top: -5px;
  left: 8px;
  width: 9px;
  height: 9px;
  background: rgba(10, 18, 35, 0.98);
  border-left: 1px solid rgba(56, 189, 248, 0.2);
  border-top: 1px solid rgba(56, 189, 248, 0.2);
  transform: rotate(45deg);
}

/* Open state */
.page-info-panel--open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.page-info-panel p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.7;
}
.page-info-panel p + p { margin-top: 0.6rem; }
.page-info-panel strong { color: var(--text-body); font-weight: 600; }

/* === BREADCRUMB === */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent-blue); }
.breadcrumb-sep { color: var(--text-muted); opacity: 0.5; }

/* === STATS ROW === */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-body);
  line-height: 1;
}
.stat-label { font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; }

/* === DATA TABLE === */
.table-wrap {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  padding: 0.75rem 1.1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.02);
}
.data-table td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.data-table--compact td,
.data-table--compact th { padding: 0.6rem 1.1rem; }

.row-name { font-weight: 600; color: var(--text-body); display: block; }
a.row-name:hover { color: var(--accent-blue); }
.row-sub  { font-size: 0.82rem; color: var(--text-muted); display: block; }
.row-date { font-size: 0.82rem; color: var(--text-muted); }

.self-badge {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.1rem 0.5rem;
  background: rgba(56,189,248,0.12);
  border: 1px solid rgba(56,189,248,0.25);
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent-blue);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* === STATUS BADGES === */
.badge-tenant-status {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge-active,    .badge-member    { background: rgba(34,197,94,0.12);  border: 1px solid rgba(34,197,94,0.25);  color: #4ade80; }
.badge-trial                       { background: rgba(56,189,248,0.12); border: 1px solid rgba(56,189,248,0.25); color: var(--accent-blue); }
.badge-pending,   .badge-viewer    { background: rgba(251,191,36,0.12); border: 1px solid rgba(251,191,36,0.25); color: #fbbf24; }
.badge-suspended, .badge-error     { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.25);  color: #f87171; }
.badge-paused,    .badge-invited   { background: rgba(148,163,184,0.12); border: 1px solid rgba(148,163,184,0.25); color: #94a3b8; }
.badge-disconnected, .badge-deactivated { background: rgba(100,116,139,0.12); border: 1px solid rgba(100,116,139,0.25); color: var(--text-muted); }

/* === EMPTY STATE === */
.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* === FORMS === */
.form-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1.25rem;
  padding: 2rem;
}
.form-group       { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1.25rem; }
.form-label       { font-size: 0.82rem; font-weight: 600; color: var(--text-body); letter-spacing: 0.01em; }
.form-hint        { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }
.form-input,
.form-select,
.form-textarea {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  border-radius: 0.6rem;
  color: var(--text-body);
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  transition: border-color var(--transition);
  font-family: inherit;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
}
.form-select { appearance: none; cursor: pointer; }
.form-select option { background: #1e3a5f; color: var(--text-body); }
.form-select--inline {
  padding: 0.25rem 0.5rem;
  font-size: 0.82rem;
  border-radius: 0.4rem;
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

.form-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent-blue);
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--glass-border);
}

.form-label--checkbox {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.88rem;
  cursor: pointer;
  line-height: 1.6;
}
.form-label--checkbox input {
  width: 16px;
  height: 16px;
  margin-top: 0.2rem;
  flex-shrink: 0;
  accent-color: var(--accent-blue);
}

/* === CARD LINK === */
.card-link { text-decoration: none; display: block; cursor: pointer; }
.card-link:hover { border-color: rgba(56,189,248,0.2); transform: translateY(-3px); color: inherit; }
.card-link h3 { color: var(--accent-blue); }

/* === DETAIL LAYOUT === */
.detail-columns {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
  align-items: start;
}
.detail-section {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.detail-section h3 { font-size: 0.95rem; margin-bottom: 0.75rem; }
.detail-dl { display: grid; grid-template-columns: auto 1fr; gap: 0.4rem 1rem; }
.detail-dl dt { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; padding-top: 0.1rem; }
.detail-dl dd { font-size: 0.88rem; color: var(--text-body); }

/* === DANGER BUTTON MODIFIER === */
.btn-danger {
  color: #f87171 !important;
  border-color: rgba(239,68,68,0.35) !important;
}
.btn-danger:hover {
  background: rgba(239,68,68,0.08) !important;
  border-color: rgba(239,68,68,0.6) !important;
}

/* === SOURCE TYPE SELECTION GRID === */
.source-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.source-type-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  backdrop-filter: blur(10px);
  padding: 1.75rem;
  position: relative;
  transition: border-color var(--transition), transform var(--transition);
}

.source-type-card--active {
  cursor: pointer;
  text-decoration: none;
  display: block;
  color: inherit;
}
.source-type-card--active:hover {
  border-color: rgba(56, 189, 248, 0.3);
  transform: translateY(-3px);
  color: inherit;
}
.source-type-card--active h3 { color: var(--accent-blue); }

.source-type-card--disabled {
  opacity: 0.5;
  cursor: default;
}

.source-type-icon {
  margin-bottom: 1rem;
}

.source-type-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.source-type-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.source-type-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.source-type-badge--ready {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #4ade80;
}
.source-type-badge--soon {
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #94a3b8;
}
.source-type-badge--roadmap {
  background: rgba(129, 140, 248, 0.12);
  border: 1px solid rgba(129, 140, 248, 0.3);
  color: var(--accent-indigo);
}

/* === ROADMAP CARD VARIANT === */
.source-type-card--roadmap {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.source-type-card--roadmap:hover {
  border-color: rgba(129, 140, 248, 0.3);
}
.source-type-card--roadmap h3 {
  color: #e2e8f0;
  margin-bottom: 0;
}
.source-type-card--roadmap p {
  flex: 1;
  margin-bottom: 0;
}

.source-type-card__head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.source-type-monogram {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-indigo) 100%);
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.18);
  flex-shrink: 0;
}

.source-type-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.25rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--glass-border);
}

.ds-notify-form { margin: 0; }

.btn-notify {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  background: transparent;
  color: var(--accent-blue);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  border-radius: 9999px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}
.btn-notify:hover {
  background: rgba(56, 189, 248, 0.1);
  border-color: rgba(56, 189, 248, 0.6);
  transform: translateY(-1px);
}

/* === STEPS BAR === */
.steps-bar {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 2rem;
  max-width: 720px;
}

.step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 0.78rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}

.step--active .step-num {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: var(--accent-blue);
}

.step--done .step-num {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: #4ade80;
}

.step-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}
.step--active .step-label { color: var(--text-body); }

.step-line {
  flex: 1;
  height: 1px;
  background: var(--glass-border);
  margin: 0 0.75rem;
}

/* === CODE BLOCK === */
.code-block {
  display: block;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: 0.5rem;
  padding: 0.6rem 0.85rem;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.85rem;
  color: var(--accent-blue);
  word-break: break-all;
}

pre.code-block {
  white-space: pre;
  word-break: normal;
  color: var(--text-body);
}

/* === VERIFY RESULT === */
.verify-result {
  padding: 1rem 1.25rem;
  border-radius: 0.75rem;
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 1rem;
}
.verify-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.25);
  color: #4ade80;
}
.verify-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
}

/* === RESPONSIVE ADDITIONS === */
@media (max-width: 900px) {
  .detail-columns { grid-template-columns: 1fr; }
  .form-grid-2    { grid-template-columns: 1fr; }
  .source-type-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   PROFILE — ACCOUNT SECTION
   ============================================================ */
.profile-account-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2rem;
}
.profile-account-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.profile-account-value {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-body);
}

/* ============================================================
   DASHBOARD WIDGETS
   ============================================================ */

/* ── Page header (dashboard) ────────────────────────────────── */
.dash-page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.dash-page-header h2 { margin-bottom: 0; }

.dash-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ── Control bar ─────────────────────────────────────────────── */
.dash-control-bar {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 0.85rem 1.25rem;
  margin-bottom: 1.5rem;
}
.dash-control-groups {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem 1rem;
  align-items: end;
}
.dash-control-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}
.dash-control-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  white-space: nowrap;
}
.dash-select {
  appearance: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 0.5rem;
  color: var(--text-body);
  font-size: 0.82rem;
  font-family: inherit;
  padding: 0.38rem 2rem 0.38rem 0.7rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  transition: border-color var(--transition);
}
.dash-select:hover,
.dash-select:focus {
  border-color: var(--accent-blue);
  outline: none;
}
.dash-select option { background: #1e3a5f; color: var(--text-body); }
.dash-control-group .dash-select {
  width: 100%;
  text-overflow: ellipsis;            /* clip long option labels in the closed select */
}
/* date-range row + copy-link button span all 4 columns, off the 4-up rhythm */
.dash-date-range,
.dash-copy-link,
#dash-copy-link { grid-column: 1 / -1; }
@media (max-width: 768px) {
  .dash-control-groups { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .dash-control-groups { grid-template-columns: 1fr; }
}

/* Custom date range panel */
.dash-date-range {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding-left: 0.5rem;
  border-left: 1px solid var(--glass-border);
}
.dash-date-sep {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.dash-date-input {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  border-radius: 0.5rem;
  color: var(--text-body);
  font-size: 0.82rem;
  font-family: inherit;
  padding: 0.38rem 0.65rem;
  transition: border-color var(--transition);
  color-scheme: dark;
  cursor: pointer;
}
.dash-date-input:focus {
  outline: none;
  border-color: var(--accent-blue);
}
.dash-apply-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.38rem 0.9rem;
  background: rgba(56,189,248,0.12);
  border: 1px solid rgba(56,189,248,0.3);
  border-radius: 0.5rem;
  color: var(--accent-blue);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: background var(--transition), border-color var(--transition);
}
.dash-apply-btn:hover {
  background: rgba(56,189,248,0.2);
  border-color: rgba(56,189,248,0.5);
}

/* ── Phase D control bar additions ─────────────────────────────── */
.dash-select-sm {
  padding: 0.25rem 1.6rem 0.25rem 0.55rem;
  font-size: 0.72rem;
}
.dash-copy-link {
  margin-left: auto;
  padding: 0.38rem 0.85rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: 0.5rem;
  color: var(--text-body);
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background var(--transition), border-color var(--transition);
}
.dash-copy-link:hover {
  background: rgba(56,189,248,0.12);
  border-color: rgba(56,189,248,0.4);
  color: var(--accent-blue);
}

/* Filter chips (active non-default filters) */
.dash-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--glass-border);
}
.dash-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.3);
  border-radius: 9999px;
  color: var(--accent-blue);
  font-size: 0.74rem;
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: background var(--transition);
}
.dash-chip:hover { background: rgba(56,189,248,0.2); }
.dash-chip-x { font-size: 0.65rem; opacity: 0.7; }
.dash-chip-clear {
  background: rgba(248,113,113,0.08);
  border-color: rgba(248,113,113,0.3);
  color: #f87171;
}
.dash-chip-clear:hover { background: rgba(248,113,113,0.18); }

/* Chart toggles row above the trend chart */
.dash-chart-toggles {
  display: flex;
  gap: 1.1rem;
  margin-bottom: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.dash-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}
.dash-toggle input[type="checkbox"] {
  appearance: none;
  width: 14px; height: 14px;
  border: 1px solid var(--glass-border);
  border-radius: 3px;
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  position: relative;
  transition: background var(--transition), border-color var(--transition);
}
.dash-toggle input[type="checkbox"]:checked {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}
.dash-toggle input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  top: 1px; left: 4px;
  width: 4px; height: 8px;
  border: solid #0f172a;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* Inline section actions (group-by select inside section title) */
.dash-section-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.dash-export-link {
  font-size: 0.72rem;
  margin-left: 0.6rem;
}

/* ── Legend pills (for daily chart section header) ───────────── */
.dash-legend-pills {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}
.dash-legend-pill {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
}
.dash-legend-pill--blue   { color: #38bdf8; }
.dash-legend-pill--indigo { color: #818cf8; }

/* ── Account name display ────────────────────────────────────── */
.dash-acct-name {
  display: block;
  font-weight: 600;
  color: var(--text-body);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 18ch;
}

/* ── KPI cards ───────────────────────────────────────────────── */
.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.dash-kpi-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-top: 2px solid var(--accent-blue);
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.dash-kpi-card--critical { border-top-color: #f87171; }
.dash-kpi-card--warning  { border-top-color: #f59e0b; }
.dash-kpi-card--info     { border-top-color: var(--accent-blue); }
.dash-kpi-card--bad      { border-top-color: #f87171; }
.dash-action-grid        { margin-top: 1rem; }
.dash-kpi-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-body);
  letter-spacing: -0.02em;
  line-height: 1;
}
.dash-kpi-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.dash-kpi-sub {
  font-size: 0.8rem;
  font-weight: 600;
}
.dash-kpi-sparkline {
  height: 24px;
  width: 100%;
  margin: 0.2rem 0;
}
.dash-sparkline-svg {
  width: 100%;
  height: 100%;
}

/* Delta colours */
.dash-delta-up   { color: #f59e0b; }
.dash-delta-down { color: #34d399; }

/* ── Dashboard sections ──────────────────────────────────────── */
.dash-section {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.dash-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.dash-period-tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--accent-blue);
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  text-transform: none;
  letter-spacing: 0;
}

/* 2-column grid */
.dash-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* Chart containers */
.dash-chart-wrap {
  position: relative;
  height: 260px;
}
.dash-chart-donut-wrap {
  height: 300px;
}

/* ── Currency footnote ───────────────────────────────────────── */
.dash-currency-note {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  font-style: italic;
  letter-spacing: 0.02em;
}
/* ── Data tables ─────────────────────────────────────────────── */
.dash-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.dash-table thead {
  border-bottom: 1px solid var(--glass-border);
}
.dash-table th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem 0.75rem;
  white-space: nowrap;
}
.dash-th-left   { text-align: left; }
.dash-th-right  { text-align: right; }
.dash-th-center { text-align: center; }
.dash-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  vertical-align: middle;
}
.dash-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}
.dash-td-right {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.dash-td-center {
  text-align: center;
}
.dash-td-muted {
  color: var(--text-muted);
  font-weight: 400;
}
.dash-td-service {
  font-weight: 500;
  color: var(--text-body);
  max-width: 24ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-td-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.1rem;
}
.dash-row-highlight {
  border-left: 3px solid #f59e0b;
}
.dash-mini-spark {
  width: 42px;
  height: 14px;
  display: inline-block;
  vertical-align: middle;
}

/* ── Top movers ──────────────────────────────────────────────── */
.dash-movers-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.dash-mover-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 0.5rem;
}
.dash-mover-arrow {
  font-size: 0.85rem;
  flex-shrink: 0;
  width: 1.2rem;
  text-align: center;
}
.dash-mover-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-mover-cost {
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.dash-mover-pct {
  font-size: 0.78rem;
  font-weight: 600;
  width: 6ch;
  text-align: right;
  flex-shrink: 0;
}

/* ── Anomaly severity cards ──────────────────────────────────── */
.dash-anomaly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.dash-anomaly-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--accent-blue);
}
.dash-anomaly-sev-critical-card { border-left-color: #f87171; }
.dash-anomaly-sev-warning-card  { border-left-color: #f59e0b; }
.dash-anomaly-sev-info-card     { border-left-color: var(--accent-blue); }

.dash-anomaly-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.dash-anomaly-sev-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}
.dash-anomaly-sev-critical {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #f87171;
}
.dash-anomaly-sev-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}
.dash-anomaly-sev-info {
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}
.dash-anomaly-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.dash-anomaly-card-service {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-body);
}
.dash-anomaly-card-detail {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
}
.dash-anomaly-card-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
}
.dash-anomaly-dir-badge {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
}
.dash-anomaly-dir-spike {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #f59e0b;
}
.dash-anomaly-dir-drop {
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  color: #34d399;
}
.dash-anomaly-empty {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
}
.dash-anomaly-check {
  display: inline-block;
  font-size: 1.5rem;
  color: #34d399;
  margin-bottom: 0.5rem;
}

/* ── KPI card as clickable link ──────────────────────────────── */
.dash-kpi-card--link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
.dash-kpi-card--link:hover {
  border-color: rgba(56, 189, 248, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ── Section header link ─────────────────────────────────────── */
.dash-section-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent-blue);
  text-decoration: none;
  margin-left: auto;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.dash-section-link:hover { opacity: 1; }

/* ── Anomalies Page ──────────────────────────────────────────── */
.anom-tag--critical {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.3);
  color: #f87171;
}

/* ── Summary strip ───────────────────────────────────────────── */
.anom-summary-strip {
  display: flex;
  align-items: stretch;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.anom-strip-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.4rem;
  flex: 1;
  border-right: 1px solid var(--glass-border);
  min-width: 0;
}
.anom-strip-item:last-child { border-right: none; }
.anom-strip-icon {
  width: 28px;
  height: 28px;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent-blue);
}
.anom-strip-icon--critical { background: rgba(248, 113, 113, 0.12); color: #f87171; }
.anom-strip-icon--warning  { background: rgba(245, 158,  11, 0.12); color: #f59e0b; }
.anom-strip-icon--info     { background: rgba(129, 140, 248, 0.12); color: #818cf8; }
.anom-strip-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.anom-strip-value {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  color: var(--text-body);
  white-space: nowrap;
}
.anom-strip-value--critical { color: #f87171; }
.anom-strip-value--warning  { color: #f59e0b; }
.anom-strip-value--impact   { color: var(--accent-blue); }
.anom-strip-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

/* ── Anomaly card grid ───────────────────────────────────────── */
.anom-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}
.anom-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--accent-blue);
  border-radius: 0.75rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.anom-card--critical { border-left-color: #f87171; }
.anom-card--warning  { border-left-color: #f59e0b; }

.anom-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.anom-card-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.anom-card-period {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.anom-card-service {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-body);
}
.anom-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.anom-metric {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.anom-metric-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.anom-metric-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-body);
}
.anom-card-deviation {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.anom-card-source { margin-top: 0.15rem; }
.anom-source-tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.2rem 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  color: var(--text-muted);
}
.anom-persist-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(129, 140, 248, 0.15);
  border: 1px solid rgba(129, 140, 248, 0.4);
  color: #818cf8;
}

/* ── Anomaly table rows ──────────────────────────────────────── */
.anom-table tbody tr { vertical-align: middle; }
.anom-row { border-left: 3px solid transparent; }
.anom-row--critical { border-left-color: #f87171; }
.anom-row--warning  { border-left-color: #f59e0b; }
.anom-row-service {
  font-weight: 600;
  color: var(--text-body);
  font-size: 0.85rem;
  max-width: 24ch;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.anom-td-nowrap { white-space: nowrap; }
.anom-td-source { font-size: 0.78rem; white-space: nowrap; }

/* ── Others summary block ────────────────────────────────────── */
.anom-others-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
}
.anom-others-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.anom-others-count {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-blue);
  line-height: 1;
}
.anom-others-label {
  font-size: 0.85rem;
  color: var(--text-body);
  font-weight: 600;
}
.anom-others-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 48ch;
  line-height: 1.55;
  margin-top: 0.3rem;
}
.anom-others-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
  flex-shrink: 0;
}
.anom-others-impact-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}
.anom-others-impact-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-body);
  letter-spacing: -0.02em;
}

/* ── Data freshness footer ───────────────────────────────────── */
.dash-freshness {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 1rem 0;
  margin-top: 1rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-top: 1px solid var(--glass-border);
}
.dash-freshness-sep {
  opacity: 0.4;
}
.dash-freshness-warn {
  color: #f59e0b;
  font-weight: 600;
  margin-left: 0.5rem;
}

/* ── No-data empty state ─────────────────────────────────────── */
.dash-empty {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1rem;
  padding: 3rem 2rem;
  text-align: center;
  margin-bottom: 2rem;
}
.dash-empty-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-body);
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
  .dash-kpi-grid, .dash-action-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-grid-2   { grid-template-columns: 1fr; }
  .dash-anomaly-grid { grid-template-columns: 1fr; }
  .dash-legend-pills { display: none; }
  .anom-card-grid { grid-template-columns: 1fr; }
  .anom-others-block { flex-direction: column; align-items: flex-start; }
  .anom-others-right { align-items: flex-start; }
  .anom-summary-strip { flex-wrap: wrap; }
  .anom-strip-item { flex: 1 1 40%; border-right: none; border-bottom: 1px solid var(--glass-border); }
  .anom-strip-item:last-child { border-bottom: none; }
}
@media (max-width: 640px) {
  .dash-kpi-grid, .dash-action-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-table { font-size: 0.78rem; }
  .dash-td-service { max-width: 14ch; }
  .dash-acct-name { max-width: 12ch; }
  .dash-control-bar { padding: 0.75rem 1rem; }
  .dash-control-groups { gap: 0.75rem; }
  .dash-date-range { border-left: none; padding-left: 0; border-top: 1px solid var(--glass-border); padding-top: 0.6rem; width: 100%; }
}
@media (max-width: 480px) {
  .dash-kpi-grid, .dash-action-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   BUDGET PLANNING
   ============================================================ */

/* ── Plan list cards ─────────────────────────────────────────── */
.budget-plan-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.budget-plan-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1.25rem;
  padding: 1.5rem 1.75rem;
  transition: border-color var(--transition);
}
.budget-plan-card:hover { border-color: rgba(56,189,248,0.2); }
.budget-plan-card.plan-archived { opacity: 0.65; }
.bpc-top { margin-bottom: 1rem; }
.bpc-header { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.3rem; }
.bpc-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-body);
  text-decoration: none;
}
.bpc-name:hover { color: var(--accent-blue); }
.bpc-meta { font-size: 0.82rem; color: var(--text-muted); }
.bpc-kpis {
  display: flex;
  gap: 2.5rem;
  align-items: flex-end;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.bpc-kpi { display: flex; flex-direction: column; gap: 0.2rem; }
.bpc-kpi-value {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
  color: var(--text-body);
}
.bpc-kpi-label { font-size: 0.72rem; color: var(--text-muted); letter-spacing: 0.05em; text-transform: uppercase; }
.bpc-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Plan status badges ──────────────────────────────────────── */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.75rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.plan-badge--active {
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.3);
  color: var(--accent-blue);
}
.plan-badge--draft {
  background: rgba(100,116,139,0.1);
  border: 1px solid rgba(100,116,139,0.25);
  color: var(--text-muted);
}
.plan-badge--archived {
  background: rgba(100,116,139,0.08);
  border: 1px solid rgba(100,116,139,0.2);
  color: var(--text-muted);
  opacity: 0.8;
}

/* ── Variance colours (budget context) ───────────────────────── */
.delta-under { color: #4ade80; }  /* under budget = favourable */
.delta-over  { color: #f87171; }  /* over budget  = attention  */

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 1.25rem;
  padding: 4rem 2rem;
  text-align: center;
}
.empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state h3 { margin-bottom: 0.5rem; font-size: 1.1rem; }
.empty-state p  { color: var(--text-muted); font-size: 0.9rem; max-width: 480px; margin: 0 auto; }

/* ── Radio option cards (new plan form) ──────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: 0.75rem; }
.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 0.875rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.radio-option:hover { border-color: rgba(56,189,248,0.25); }
.radio-option--selected {
  border-color: rgba(56,189,248,0.45);
  background: rgba(56,189,248,0.05);
}
.radio-option input[type=radio] { margin-top: 0.2rem; accent-color: var(--accent-blue); flex-shrink: 0; }
.radio-label { display: flex; flex-direction: column; gap: 0.2rem; }
.radio-label strong { font-size: 0.95rem; color: var(--text-body); }
.radio-sub   { font-size: 0.8rem; color: var(--text-muted); }
.radio-years { display: flex; gap: 0.5rem; font-size: 0.75rem; color: var(--accent-indigo); margin-top: 0.15rem; }

/* ── Colour swatch picker (categories) ───────────────────────── */
.colour-picker { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.35rem; }
.colour-swatch {
  width: 32px; height: 32px;
  border-radius: 0.5rem;
  border: 2px solid transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--transition), transform var(--transition);
}
.colour-swatch:hover  { transform: scale(1.1); }
.colour-swatch--selected { border-color: white; }
.colour-swatch-dot {
  width: 20px; height: 20px;
  border-radius: 0.3rem;
  display: flex; align-items: center; justify-content: center;
}
.colour-swatch-none {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Danger button ghost variant ─────────────────────────────── */
.btn-danger-ghost {
  color: #f87171 !important;
  border-color: rgba(239,68,68,0.3) !important;
}
.btn-danger-ghost:hover {
  background: rgba(239,68,68,0.08) !important;
  border-color: rgba(239,68,68,0.55) !important;
  color: #f87171 !important;
}

/* ── Form required asterisk ──────────────────────────────────── */
.form-required { color: #f87171; }

@media (max-width: 768px) {
  .budget-plan-card { padding: 1.25rem; }
  .bpc-kpis { gap: 1.5rem; }
  .bpc-kpi-value { font-size: 1.15rem; }
}

/* ===================================================================
   REPORT STYLES — Phase 7
   =================================================================== */

/* ── Report container ──────────────────────────────────────────── */
.report { padding: 0; }

/* ── Report header ─────────────────────────────────────────────── */
.report-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-wrap: wrap;
}
.report-header-left { display: flex; flex-direction: column; gap: 0.4rem; }
.report-header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.3rem; }
.report-title { font-size: 1.75rem; font-weight: 800; color: #e2e8f0; margin: 0; line-height: 1.1; }
.report-subtitle { color: #64748b; font-size: 0.875rem; margin: 0; }
.report-meta { font-size: 0.75rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Persona badges ────────────────────────────────────────────── */
.report-persona-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  width: fit-content;
}
.report-persona-badge--executive  { background: rgba(56,189,248,0.1); border: 1px solid rgba(56,189,248,0.3); color: #38bdf8; }
.report-persona-badge--finance    { background: rgba(129,140,248,0.1); border: 1px solid rgba(129,140,248,0.3); color: #818cf8; }
.report-persona-badge--engineering { background: rgba(52,211,153,0.1); border: 1px solid rgba(52,211,153,0.3); color: #34d399; }

/* ── KPI grid ──────────────────────────────────────────────────── */
.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.report-kpi-grid--2col { grid-template-columns: repeat(2, 1fr); max-width: 500px; }
.report-kpi {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1rem;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.report-kpi-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: #64748b; }
.report-kpi-value { font-size: 1.5rem; font-weight: 800; color: #e2e8f0; line-height: 1; }
.report-kpi-value--up   { color: #f87171; }
.report-kpi-value--down { color: #34d399; }
.report-kpi-value--muted { color: #64748b; }
.report-kpi-change { font-size: 0.75rem; color: #64748b; }
.report-kpi-change--up   { color: #f87171; }
.report-kpi-change--down { color: #34d399; }

/* ── Sections ──────────────────────────────────────────────────── */
.report-section {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.report-section--narrative { background: rgba(56,189,248,0.04); border-color: rgba(56,189,248,0.12); }
.report-section--forecast  { background: rgba(129,140,248,0.04); border-color: rgba(129,140,248,0.12); }
.report-section-title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.12em; color: #64748b; margin: 0 0 1rem 0; font-weight: 700; }
.report-lede { font-size: 1.05rem; color: #e2e8f0; line-height: 1.7; margin: 0; }
.report-narrative-block { margin-bottom: 1rem; }
.report-narrative-block p { color: #e2e8f0; line-height: 1.65; margin: 0; }
.report-forecast-text { color: #e2e8f0; line-height: 1.65; margin: 0; font-size: 1rem; }

/* ── Signals ───────────────────────────────────────────────────── */
.report-signals { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin-top: 1.25rem; }
.report-signal { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 0.75rem; padding: 1rem; }
.report-signal--warning { border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.05); }
.report-signal-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.1em; color: #64748b; display: block; margin-bottom: 0.4rem; font-weight: 700; }
.report-signal p { color: #cbd5e1; line-height: 1.6; margin: 0; font-size: 0.9rem; }

/* ── Bar chart ─────────────────────────────────────────────────── */
.report-bar-chart { display: flex; flex-direction: column; gap: 0.6rem; }
.report-bar-row { display: grid; grid-template-columns: 10rem 1fr 5rem 3.5rem; align-items: center; gap: 0.75rem; }
.report-bar-label { font-size: 0.8rem; color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-bar-track { background: rgba(255,255,255,0.06); border-radius: 9999px; height: 6px; overflow: hidden; }
.report-bar-fill  { background: linear-gradient(90deg, #38bdf8, #818cf8); height: 100%; border-radius: 9999px; transition: width 0.3s ease; }
.report-bar-value { font-size: 0.8rem; color: #e2e8f0; font-weight: 600; text-align: right; }
.report-bar-pct   { font-size: 0.75rem; color: #64748b; text-align: right; }
.report-bar-mom   { font-size: 0.75rem; font-weight: 600; text-align: right; }

/* ── Trend arrows ──────────────────────────────────────────────── */
.trend-up   { color: #f87171; }
.trend-down { color: #34d399; }
.trend-flat { color: #64748b; }

/* ── Tables ────────────────────────────────────────────────────── */
.report-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 0.75rem; }
.report-table th { text-align: left; padding: 0.5rem 0.75rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: #64748b; border-bottom: 1px solid rgba(255,255,255,0.08); font-weight: 600; }
.report-table td { padding: 0.5rem 0.75rem; color: #cbd5e1; border-bottom: 1px solid rgba(255,255,255,0.04); }
.report-table th.num, .report-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.report-table tfoot td { border-top: 1px solid rgba(255,255,255,0.12); border-bottom: none; color: #e2e8f0; }
.report-table-row--current td { background: rgba(56,189,248,0.06); }
.report-forecast-basis { color: #64748b; font-size: 0.8rem; }

/* ── Budget grid ───────────────────────────────────────────────── */
.report-budget-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 0.75rem; margin-bottom: 1rem; }

/* ── Service insights ──────────────────────────────────────────── */
.report-insights-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.report-insight-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); border-radius: 0.75rem; padding: 1rem; }
.report-insight-service { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: #38bdf8; display: block; margin-bottom: 0.4rem; font-weight: 700; }
.report-insight-card p { color: #cbd5e1; line-height: 1.6; margin: 0; font-size: 0.875rem; }

/* ── Anomaly callout ───────────────────────────────────────────── */
.report-anomaly-callout { background: rgba(251,191,36,0.05); border: 1px solid rgba(251,191,36,0.25); border-radius: 0.75rem; padding: 1.25rem; }
.report-anomaly-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: #fbbf24; display: block; margin-bottom: 0.6rem; font-weight: 700; }
.report-anomaly-callout p { color: #e2e8f0; line-height: 1.65; margin: 0 0 0.75rem 0; font-size: 0.9rem; }
.report-anomaly-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.4rem 0; border-top: 1px solid rgba(255,255,255,0.05); flex-wrap: wrap; }
.report-anomaly-service { font-weight: 600; color: #e2e8f0; font-size: 0.85rem; }
.report-anomaly-stat { color: #94a3b8; font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.report-anomaly-pill { font-size: 0.65rem; padding: 0.15rem 0.5rem; border-radius: 9999px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.report-anomaly-pill--info     { background: rgba(56,189,248,0.1); color: #38bdf8; }
.report-anomaly-pill--warning  { background: rgba(251,191,36,0.1); color: #fbbf24; }
.report-anomaly-pill--critical { background: rgba(248,113,113,0.1); color: #f87171; }

/* ── Anomaly detail (engineering) ──────────────────────────────── */
.report-anomaly-detail { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); border-radius: 0.75rem; padding: 1rem 1.25rem; margin-bottom: 0.75rem; }
.report-anomaly-detail-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.report-anomaly-context { color: #cbd5e1; font-size: 0.875rem; line-height: 1.6; margin: 0 0 0.75rem 0; }
.report-investigation-steps { background: rgba(255,255,255,0.03); border-left: 3px solid #38bdf8; padding: 0.6rem 0.9rem; border-radius: 0 0.4rem 0.4rem 0; }
.report-investigation-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.1em; color: #38bdf8; display: block; margin-bottom: 0.3rem; font-weight: 700; }
.report-investigation-steps p { color: #94a3b8; font-size: 0.8rem; line-height: 1.6; margin: 0; }

/* ── Recommendations ───────────────────────────────────────────── */
.report-recommendations { display: flex; flex-direction: column; gap: 0.75rem; }
.report-rec { display: flex; align-items: flex-start; gap: 1rem; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); border-radius: 0.75rem; padding: 1rem 1.25rem; }
.report-rec-rank { display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; min-width: 2rem; border-radius: 50%; background: linear-gradient(135deg, #38bdf8, #818cf8); color: #0f172a; font-weight: 800; font-size: 0.9rem; }
.report-rec-body { flex: 1; display: flex; flex-direction: column; gap: 0.3rem; }
.report-rec-title { font-size: 0.85rem; font-weight: 700; color: #e2e8f0; }
.report-rec-tag { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.08em; color: #34d399; font-weight: 600; }
.report-rec-action { font-size: 0.875rem; color: #cbd5e1; line-height: 1.55; margin: 0; }
.report-rec-impact { font-size: 0.75rem; color: #64748b; }

/* ── Movers (engineering) ──────────────────────────────────────── */
.report-movers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.report-mover-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); border-radius: 0.75rem; padding: 1rem; }
.report-mover-card--up   { border-color: rgba(248,113,113,0.2); }
.report-mover-card--down { border-color: rgba(52,211,153,0.2); }
.report-mover-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; gap: 0.5rem; }
.report-mover-service { font-size: 0.8rem; font-weight: 700; color: #e2e8f0; }
.report-mover-pct { font-size: 0.8rem; font-weight: 700; }
.report-mover-insight { color: #94a3b8; font-size: 0.8rem; line-height: 1.55; margin: 0; }

/* ── Account ID chip ───────────────────────────────────────────── */
.report-account-id { font-size: 0.72rem; color: #64748b; margin-left: 0.35rem; }

/* ── Empty state ───────────────────────────────────────────────── */
.report-empty-note { color: #64748b; font-size: 0.875rem; margin: 0; }

/* ── Footer ────────────────────────────────────────────────────── */
.report-footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,0.06); }
.report-footer p { font-size: 0.72rem; color: #475569; margin: 0.2rem 0; }

/* ── Reports list page ─────────────────────────────────────────── */
.report-persona-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; padding: 1rem 0 0; }
.report-persona-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.07); border-radius: 0.75rem; padding: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.report-persona-desc { font-size: 0.8rem; color: #64748b; margin: 0; line-height: 1.5; }
.report-gen-time { font-size: 0.72rem; color: #475569; }
.badge-status { font-size: 0.72rem; padding: 0.2rem 0.6rem; border-radius: 9999px; letter-spacing: 0.06em; text-transform: uppercase; }
.badge-status--warning  { background: rgba(251,191,36,0.1); color: #fbbf24; border: 1px solid rgba(251,191,36,0.3); }
.badge-status--error    { background: rgba(248,113,113,0.1); color: #f87171; border: 1px solid rgba(248,113,113,0.3); }
.badge-status--muted    { background: rgba(100,116,139,0.1); color: #64748b; border: 1px solid rgba(100,116,139,0.2); }


/* ── Cost Allocation ────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-box {
  background: #1a2d4a;
  border: 1px solid rgba(56,189,248,0.2);
  border-radius: 1.25rem;
  padding: 2rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.form-row .form-group { min-width: 120px; }
.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}
.badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background: rgba(56,189,248,0.1);
  border: 1px solid rgba(56,189,248,0.25);
  color: #38bdf8;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
  vertical-align: middle;
}

/* ── Task management ──────────────────────────────────────────────────────────── */

/* Priority dot */
.task-priority-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.task-priority-dot--critical { background: #ef4444; box-shadow: 0 0 4px rgba(239,68,68,0.6); }
.task-priority-dot--high     { background: #f97316; }
.task-priority-dot--medium   { background: #38bdf8; }
.task-priority-dot--low      { background: #64748b; }

/* Type badge */
.task-type-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.task-type-badge--anomaly          { background: rgba(239,68,68,0.15);   color: #f87171; }
.task-type-badge--budget_deviation { background: rgba(249,115,22,0.15);  color: #fb923c; }
.task-type-badge--optimisation     { background: rgba(34,197,94,0.15);   color: #4ade80; }
.task-type-badge--commitment       { background: rgba(129,140,248,0.15); color: #818cf8; }
.task-type-badge--manual           { background: rgba(100,116,139,0.15); color: #94a3b8; }
.task-type-badge--renewal          { background: rgba(56,189,248,0.15);  color: #38bdf8; }

/* Source badge */
.task-source-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(100,116,139,0.12);
  color: #94a3b8;
}

/* Status badge */
.task-status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.task-status-badge--open        { background: rgba(56,189,248,0.1);  border: 1px solid rgba(56,189,248,0.3);  color: #38bdf8; }
.task-status-badge--in_progress { background: rgba(251,191,36,0.1);  border: 1px solid rgba(251,191,36,0.3);  color: #fbbf24; }
.task-status-badge--resolved    { background: rgba(34,197,94,0.1);   border: 1px solid rgba(34,197,94,0.3);   color: #4ade80; }
.task-status-badge--dismissed   { background: rgba(100,116,139,0.1); border: 1px solid rgba(100,116,139,0.3); color: #94a3b8; }
.task-status-badge--wont_fix    { background: rgba(239,68,68,0.08);  border: 1px solid rgba(239,68,68,0.2);   color: #f87171; }

/* Labels */
.task-crit-label    { color: #ef4444; font-weight: 600; }
.task-overdue-label { color: #ef4444; }
.task-savings       { color: #4ade80; font-size: 0.85rem; }

/* Filter bar */
.task-filter-bar {
  margin-bottom: 1rem;
}
.task-filter-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.task-filter-tab {
  padding: 0.5rem 0.9rem;
  font-size: 0.8rem;
  color: #64748b;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.task-filter-tab:hover { color: #e2e8f0; }
.task-filter-tab--active { color: #38bdf8; border-bottom-color: #38bdf8; }
.task-filter-count {
  background: rgba(56,189,248,0.12);
  color: #38bdf8;
  border-radius: 9999px;
  padding: 0 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
}
.task-filter-selects {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Detail layout */
.task-detail-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 800px) {
  .task-detail-layout { grid-template-columns: 1fr; }
}
.task-detail-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}
.task-detail-desc {
  color: #94a3b8;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 1rem;
}
.task-section { margin-top: 1.25rem; }
.task-section-heading {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.6rem;
}
.task-resource-list { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.task-resource-chip {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  color: #94a3b8;
}

/* Activity log */
.task-activity { display: flex; flex-direction: column; gap: 0.75rem; }
.task-activity-item { border-radius: 6px; }
.task-activity-item--comment {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  padding: 0.6rem 0.75rem;
}
.task-activity-item--system { padding: 0.2rem 0; }
.task-activity-meta { font-size: 0.8rem; margin-bottom: 0.25rem; }
.task-activity-body { font-size: 0.85rem; color: #e2e8f0; line-height: 1.5; }
.task-comment-input { resize: vertical; }

/* Sidebar */
.task-detail-sidebar { display: flex; flex-direction: column; gap: 0.75rem; }
.task-sidebar-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
}
.task-sidebar-heading {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.6rem;
}
.task-meta-list {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 0.3rem 0.5rem;
  font-size: 0.82rem;
}
.task-meta-list dt { color: #64748b; }
.task-meta-list dd { color: #e2e8f0; margin: 0; }
.task-action-btn { text-align: center; }
.task-source-pre {
  font-size: 0.7rem;
  color: #64748b;
  overflow-x: auto;
  background: rgba(0,0,0,0.2);
  border-radius: 4px;
  padding: 0.5rem;
  margin: 0;
}

/* Color variable aliases used in task templates */
:root {
  --color-success: #4ade80;
  --red: #ef4444;
}

/* === REPORT LIBRARY === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  backdrop-filter: blur(10px);
  padding: 1.75rem;
  transition: border-color var(--transition), transform var(--transition);
}

.library-card {
  text-decoration: none;
  display: block;
  color: inherit;
}

.library-card:hover {
  border-color: rgba(56, 189, 248, 0.2);
  transform: translateY(-3px);
}

.library-card h3 { color: var(--accent-blue); margin-bottom: 0.5rem; }

.library-card-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.library-card-stat {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.library-card-cost {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-body);
}

.library-card-mom {
  font-size: 0.8rem;
  font-weight: 600;
}

.library-card-mom.up { color: #f87171; }
.library-card-mom.down { color: #34d399; }

.back-link {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-decoration: none;
  margin-bottom: 0.5rem;
}
.back-link:hover { color: var(--accent-blue); }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.kpi-tile {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.25rem 1.5rem;
}

.kpi-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-body);
  letter-spacing: -0.02em;
}

/* ── Support widget (COMM-06) ──────────────────────────────────── */
.support-widget-btn {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 150;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-indigo));
  color: var(--bg-deep);
  border: none;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: transform var(--transition);
}
.support-widget-btn:hover { transform: scale(1.06); }
