/* ============================================================
   P&C Toolbox — v2 Design System
   Premium light glassmorphism · WBD brand · Linear/Vercel polish
   ============================================================ */

:root {
  /* WBD brand */
  --wbd-navy:        #1a237e;
  --wbd-navy-deep:   #0d1442;
  --wbd-gold:        #f0ab00;
  --wbd-gold-light:  #ffc933;
  --wbd-gold-dark:   #c48d00;

  /* Surface palette */
  --bg-base:         #f5f7fb;
  /* Opaque card / popover / legend background. Referenced by `.oc-legend`,
     `.oc-card-tip`, and the popover caret in this file. Previously undefined,
     which caused the hover popover and legend bar to render with no fill and
     bleed page content through the panel. */
  --surface:         #ffffff;

  /* Glass — multi-layer */
  --glass-surface:   linear-gradient(135deg, rgba(255,255,255,0.78) 0%, rgba(255,255,255,0.48) 100%);
  --glass-surface-strong: linear-gradient(135deg, rgba(255,255,255,0.92) 0%, rgba(255,255,255,0.68) 100%);
  --glass-surface-soft: linear-gradient(135deg, rgba(255,255,255,0.55) 0%, rgba(255,255,255,0.30) 100%);
  --glass-blur:      blur(28px) saturate(180%);
  --glass-blur-soft: blur(16px) saturate(150%);

  /* Borders */
  --hairline:        rgba(255, 255, 255, 0.7);
  --hairline-soft:   rgba(255, 255, 255, 0.4);
  --hairline-dark:   rgba(15, 23, 42, 0.06);
  --hairline-darker: rgba(15, 23, 42, 0.10);

  /* Shadows — layered for depth */
  --shadow-card:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 -1px 0 rgba(255, 255, 255, 0.18) inset,
    0 12px 32px -8px rgba(15, 23, 42, 0.10),
    0 4px 16px -4px rgba(15, 23, 42, 0.06);
  --shadow-card-hover:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 -1px 0 rgba(255, 255, 255, 0.18) inset,
    0 24px 48px -12px rgba(67, 56, 202, 0.20),
    0 8px 24px -8px rgba(15, 23, 42, 0.10);
  --shadow-soft:     0 4px 16px -4px rgba(15, 23, 42, 0.06);
  --shadow-pop:      0 8px 24px -8px rgba(67, 56, 202, 0.30);
  --shadow-glow:     0 0 0 4px rgba(99, 102, 241, 0.12);
  --shadow-glow-gold:0 0 0 4px rgba(240, 171, 0, 0.18);

  /* Text */
  --text-strong:     #0b1228;
  --text:            #1e293b;
  --text-muted:      #475569;
  --text-faint:      #94a3b8;
  --text-ghost:      #cbd5e1;

  /* Accents */
  --accent:          #4338ca;     /* deeper indigo */
  --accent-hover:    #3730a3;
  --accent-light:    #6366f1;
  --accent-soft:     #eef2ff;
  --accent-glow:     rgba(99, 102, 241, 0.35);

  --positive:        #059669;
  --positive-soft:   #d1fae5;
  --negative:        #e11d48;
  --negative-soft:   #ffe4e6;
  --warn:            #d97706;
  --warn-soft:       #fef3c7;
  --pink:            #ec4899;
  --teal:            #0d9488;
  --violet:          #7c3aed;

  /* Sizing */
  --sidebar-w:           280px;
  --sidebar-w-collapsed: 76px;
  --radius:              18px;
  --radius-md:           14px;
  --radius-sm:           10px;
  --radius-xs:           8px;
  --radius-pill:         999px;

  /* Motion */
  --t-fast:  0.18s cubic-bezier(.4,0,.2,1);
  --t-base:  0.28s cubic-bezier(.4,0,.2,1);
  --t-slow:  0.45s cubic-bezier(.4,0,.2,1);
  --t-spring: 0.5s cubic-bezier(.34,1.56,.64,1);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-base);
  overflow: hidden;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ============================================================
   ANIMATED AURORA BACKGROUND
   ============================================================ */
.bg-aurora {
  position: fixed;
  inset: -20%;
  z-index: -2;
  background:
    radial-gradient(ellipse 900px 700px at 18% 12%, rgba(165, 180, 252, 0.55) 0%, transparent 60%),
    radial-gradient(ellipse 800px 600px at 85% 88%, rgba(253, 224, 71, 0.32) 0%, transparent 62%),
    radial-gradient(ellipse 700px 900px at 70% 18%, rgba(244, 114, 182, 0.22) 0%, transparent 65%),
    radial-gradient(ellipse 1000px 600px at 8% 82%, rgba(110, 231, 183, 0.28) 0%, transparent 60%),
    radial-gradient(ellipse 600px 500px at 50% 50%, rgba(196, 181, 253, 0.18) 0%, transparent 70%),
    var(--bg-base);
  animation: aurora-drift 50s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes aurora-drift {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
  33%  { transform: translate(-1.5%, 1%) scale(1.04) rotate(0.5deg); }
  66%  { transform: translate(1%, -1.5%) scale(1.02) rotate(-0.3deg); }
  100% { transform: translate(0.5%, 0.5%) scale(1) rotate(0deg); }
}

/* Respect user's motion preferences (WCAG 2.1 SC 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  .bg-aurora {
    animation: none;
    will-change: auto;
  }
  .anim-in {
    animation: none;
    opacity: 1;
  }
  .mockup-ribbon::before {
    animation: none;
  }
}

/* Subtle grain overlay so glass reads properly */
.bg-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  transition: grid-template-columns var(--t-base);
}
.app.sidebar-collapsed {
  grid-template-columns: var(--sidebar-w-collapsed) 1fr;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  position: relative;
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--hairline);
  box-shadow: 1px 0 0 rgba(15, 23, 42, 0.04), 4px 0 24px -8px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 14px;
  overflow: hidden;
  transition: padding var(--t-base);
  z-index: 10;
}
.app.sidebar-collapsed .sidebar { padding: 20px 10px 14px; }

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--hairline-dark);
  margin-bottom: 14px;
}
.brand-mark {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 11px;
  background:
    radial-gradient(circle at 30% 28%, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.75) 60%, rgba(255,255,255,0.6) 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: 1px solid rgba(255,255,255,0.9);
  box-shadow:
    0 4px 14px -3px rgba(26, 35, 126, 0.20),
    inset 0 1px 0 rgba(255,255,255,1),
    inset 0 -1px 0 rgba(15, 23, 42, 0.06);
  position: relative;
  overflow: hidden;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 1px 1px rgba(15, 23, 42, 0.15)); }
.brand-text { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.brand-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.1px;
  color: var(--text-strong);
  white-space: nowrap;
}
.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.2px;
  white-space: nowrap;
  margin-top: 2px;
}
.app.sidebar-collapsed .brand-text { display: none; }
.app.sidebar-collapsed .brand { justify-content: center; padding: 4px 0 18px; }

/* Section label */
.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--text-faint);
  padding: 6px 12px;
  margin-top: 4px;
}
.app.sidebar-collapsed .sidebar-label { display: none; }

/* Tool list */
.tool-list { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; padding-right: 2px; }
.tool-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
  position: relative;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
}
.tool-item:hover { background: rgba(255, 255, 255, 0.7); transform: translateX(2px); }
.tool-item .ti-icon {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
  color: var(--accent);
  font-size: 14px;
  border: 1px solid var(--hairline-dark);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: all var(--t-fast);
}
.tool-item:hover .ti-icon { color: var(--accent-hover); border-color: rgba(99, 102, 241, 0.30); }
.tool-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.10) 0%, rgba(124, 58, 237, 0.05) 100%);
  color: var(--text-strong);
  font-weight: 600;
}
.tool-item.active::before {
  content: '';
  position: absolute;
  left: -2px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.55);
}
.tool-item.active .ti-icon {
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 14px -2px var(--accent-glow);
}
.tool-item .ti-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.tool-item .ti-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--positive-soft);
  color: var(--positive);
}
.app.sidebar-collapsed .tool-item .ti-label,
.app.sidebar-collapsed .tool-item .ti-badge { display: none; }
.app.sidebar-collapsed .tool-item { justify-content: center; padding: 9px; }

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--hairline-dark);
  padding-top: 10px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.user-block {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
.user-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wbd-navy), var(--accent));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 10px rgba(26, 35, 126, 0.30), inset 0 1px 0 rgba(255,255,255,0.25);
  position: relative;
}
.user-avatar.online::after {
  content: '';
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--positive);
  border: 2px solid white;
  box-shadow: 0 0 0 1px var(--hairline);
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10.5px; color: var(--text-muted); letter-spacing: 0.2px; overflow: hidden; text-overflow: ellipsis; }
.app.sidebar-collapsed .user-meta { display: none; }
.app.sidebar-collapsed .user-block { justify-content: center; padding: 8px 0; }

.footer-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}
.footer-link:hover { background: rgba(255, 255, 255, 0.7); color: var(--text-strong); }
.footer-link .fl-icon { width: 18px; text-align: center; flex-shrink: 0; color: var(--text-faint); font-size: 13px; }
.footer-link.admin .fl-icon { color: var(--wbd-gold-dark); }
.footer-link.admin {
  background: linear-gradient(135deg, rgba(240, 171, 0, 0.10) 0%, rgba(240, 171, 0, 0.03) 100%);
  color: var(--wbd-navy);
  font-weight: 600;
}
.footer-link.admin:hover { background: linear-gradient(135deg, rgba(240, 171, 0, 0.18) 0%, rgba(240, 171, 0, 0.06) 100%); }
.app.sidebar-collapsed .footer-link span:not(.fl-icon) { display: none; }
.app.sidebar-collapsed .footer-link { justify-content: center; padding: 8px 0; }

/* Sidebar collapse toggle */
.sidebar-toggle {
  position: absolute;
  top: 30px;
  right: -13px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: white;
  border: 1px solid var(--hairline-darker);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.10);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 10px;
  z-index: 20;
  transition: transform var(--t-base), color var(--t-fast), background var(--t-fast);
}
.sidebar-toggle:hover { color: var(--accent); background: var(--accent-soft); }
.app.sidebar-collapsed .sidebar-toggle { transform: rotate(180deg); }

/* ============================================================
   MAIN FRAME
   ============================================================ */
.main {
  position: relative;
  overflow-y: auto;
  padding: 26px 36px 48px;
}

/* Top strip inside main */
.main-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  min-height: 40px;
  gap: 16px;
}
.main-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.main-title h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.6px;
  line-height: 1.1;
}
.main-title .subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  letter-spacing: 0.1px;
}
.main-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ============================================================
   GLASS CARDS
   ============================================================ */
.glass {
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  position: relative;
}
.glass-strong {
  background: var(--glass-surface-strong);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  position: relative;
}
.glass-soft {
  background: var(--glass-surface-soft);
  backdrop-filter: var(--glass-blur-soft);
  -webkit-backdrop-filter: var(--glass-blur-soft);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  font-family: inherit;
  letter-spacing: 0.1px;
  white-space: nowrap;
  text-decoration: none;
  position: relative;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
  color: white;
  box-shadow: 0 4px 14px -2px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover {
  box-shadow: 0 8px 22px -4px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.25);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-gold {
  background: linear-gradient(135deg, var(--wbd-gold-light) 0%, var(--wbd-gold) 100%);
  color: var(--wbd-navy);
  box-shadow: 0 4px 14px -2px rgba(240, 171, 0, 0.40), inset 0 1px 0 rgba(255,255,255,0.30);
}
.btn-gold:hover { transform: translateY(-1px); box-shadow: 0 8px 22px -4px rgba(240, 171, 0, 0.50), inset 0 1px 0 rgba(255,255,255,0.40); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.65);
  color: var(--text-strong);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(10px);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.btn-ghost:hover {
  background: white;
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 4px 10px -2px var(--accent-glow);
}

.btn-icon { width: 38px; padding: 0; justify-content: center; height: 38px; border-radius: var(--radius-sm); }
.btn-sm { padding: 6px 11px; font-size: 12px; gap: 5px; }

/* ============================================================
   PILLS / CHIPS / BADGES
   ============================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.75);
  color: var(--text-muted);
  border: 1px solid var(--hairline-soft);
  white-space: nowrap;
  letter-spacing: 0.1px;
  backdrop-filter: blur(8px);
}
.pill.accent { background: var(--accent-soft); color: var(--accent); border-color: rgba(99, 102, 241, 0.18); }
.pill.gold { background: rgba(240, 171, 0, 0.14); color: var(--wbd-gold-dark); border-color: rgba(240, 171, 0, 0.25); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: rgba(217, 119, 6, 0.20); }
.pill.pos { background: var(--positive-soft); color: var(--positive); border-color: rgba(5, 150, 105, 0.20); }
.pill.neg { background: var(--negative-soft); color: var(--negative); border-color: rgba(225, 29, 72, 0.20); }
.pill.violet { background: rgba(124, 58, 237, 0.10); color: var(--violet); border-color: rgba(124, 58, 237, 0.18); }

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.input, .select {
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-strong);
  outline: none;
  transition: all var(--t-fast);
  min-width: 200px;
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}
.input:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255,255,255,0.8);
  background: white;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  min-width: 280px;
  transition: all var(--t-fast);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: var(--shadow-glow), inset 0 1px 0 rgba(255,255,255,0.8);
  background: white;
}
.search-box input { border: none; outline: none; background: transparent; font-size: 13px; flex: 1; color: var(--text-strong); font-family: inherit; }
.search-box input::placeholder { color: var(--text-faint); }
.search-box .si { color: var(--text-faint); flex-shrink: 0; font-size: 13px; }
.search-box .kbd-hint {
  font-size: 10.5px;
  color: var(--text-faint);
  background: rgba(15, 23, 42, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, monospace;
}

/* ============================================================
   MOCKUP RIBBON
   ============================================================ */
.mockup-ribbon {
  position: fixed;
  bottom: 16px;
  right: 20px;
  z-index: 100;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  color: white;
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  box-shadow: 0 8px 24px -4px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.25);
  backdrop-filter: blur(10px);
}
.mockup-ribbon::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
  margin-right: 7px;
  box-shadow: 0 0 8px rgba(255,255,255,0.9);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ============================================================
   WELCOME / HERO
   ============================================================ */
.welcome-hero {
  padding: 32px 36px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 32px;
}
.welcome-hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 60%;
  height: 200%;
  background:
    radial-gradient(circle at 60% 40%, rgba(240, 171, 0, 0.14) 0%, transparent 55%),
    radial-gradient(circle at 30% 60%, rgba(99, 102, 241, 0.12) 0%, transparent 50%);
  pointer-events: none;
}
.welcome-hero .wh-text { flex: 1; min-width: 0; position: relative; z-index: 1; }
.welcome-hero h2 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text-strong);
  letter-spacing: -0.8px;
  margin-bottom: 8px;
  line-height: 1.05;
}
.welcome-hero h2 .accent-grad {
  background: linear-gradient(135deg, var(--accent-light), var(--wbd-navy));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.welcome-hero .greeting-sub {
  font-size: 14.5px;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.55;
}
.welcome-hero .greeting-meta {
  margin-top: 18px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-muted);
  align-items: center;
}
.welcome-hero .greeting-meta b { color: var(--text-strong); font-weight: 700; }
.welcome-hero .greeting-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-ghost); }

/* Hero side decoration */
.welcome-hero .wh-decor {
  position: relative;
  z-index: 1;
  width: 220px;
  height: 140px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   STAT CARDS
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card {
  padding: 18px 20px 14px;
  position: relative;
  overflow: hidden;
  transition: all var(--t-base);
}
.stat-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-2px);
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent-light) 0%, var(--accent) 50%, transparent 100%);
  opacity: 0.6;
  border-radius: var(--radius) var(--radius) 0 0;
}
.stat-card.gold::before { background: linear-gradient(90deg, var(--wbd-gold) 0%, var(--wbd-gold-dark) 50%, transparent 100%); }
.stat-card.green::before { background: linear-gradient(90deg, var(--positive) 0%, var(--teal) 50%, transparent 100%); }
.stat-card.rose::before { background: linear-gradient(90deg, var(--pink) 0%, var(--negative) 50%, transparent 100%); }

.sc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.sc-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.7px; font-weight: 700; }
.sc-trend { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--radius-pill); }
.sc-trend.pos { color: var(--positive); background: var(--positive-soft); }
.sc-trend.neg { color: var(--negative); background: var(--negative-soft); }
.sc-trend.neutral { color: var(--text-muted); background: rgba(15, 23, 42, 0.05); }

.sc-value-row { display: flex; align-items: baseline; gap: 6px; }
.sc-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-strong);
  letter-spacing: -0.8px;
  line-height: 1;
  font-feature-settings: 'tnum';
}
.sc-value-suffix { font-size: 14px; font-weight: 600; color: var(--text-muted); }

.sc-sub { font-size: 11.5px; color: var(--text-faint); margin-top: 8px; display: flex; align-items: center; gap: 6px; }

.sparkline-wrap { margin-top: 12px; height: 36px; position: relative; }
.sparkline { width: 100%; height: 100%; display: block; }
.spark-path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.spark-area { opacity: 0.18; }

/* ============================================================
   SECTION HEADER
   ============================================================ */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}
.section-header h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.section-header h3 .sh-count {
  font-size: 10.5px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
}
.section-header .sh-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap var(--t-fast);
}
.section-header .sh-link:hover { gap: 7px; }

/* ============================================================
   APP TILES (home page)
   ============================================================ */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.app-tile {
  padding: 22px;
  cursor: pointer;
  transition: all var(--t-base);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  min-height: 200px;
}
.app-tile::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 140px;
  height: 140px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.10) 0%, transparent 70%);
  pointer-events: none;
  transition: all var(--t-base);
  opacity: 0;
}
.app-tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
}
.app-tile:hover::after { opacity: 1; }

.app-tile.tech::after { background: radial-gradient(circle, rgba(240, 171, 0, 0.14) 0%, transparent 70%); }

.app-tile .at-icon {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--accent) 100%);
  color: white;
  font-size: 19px;
  margin-bottom: 16px;
  box-shadow: 0 8px 20px -4px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.25);
  position: relative;
}
.app-tile.tech .at-icon {
  background: linear-gradient(135deg, var(--wbd-gold-light), var(--wbd-gold-dark));
  box-shadow: 0 8px 20px -4px rgba(240, 171, 0, 0.45), inset 0 1px 0 rgba(255,255,255,0.30);
}
.app-tile .at-title { font-size: 16px; font-weight: 700; color: var(--text-strong); margin-bottom: 6px; letter-spacing: -0.2px; }
.app-tile .at-desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; flex: 1; margin-bottom: 14px; }
.app-tile .at-meta { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-faint); flex-wrap: wrap; }
.app-tile .at-stat { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-muted); font-weight: 600; }
.app-tile .at-stat strong { color: var(--text-strong); }
.app-tile .at-arrow {
  position: absolute;
  bottom: 22px;
  right: 22px;
  color: var(--text-faint);
  font-size: 14px;
  transition: all var(--t-fast);
}
.app-tile:hover .at-arrow { color: var(--accent); transform: translate(3px, -3px); }

/* ============================================================
   ACTIVITY FEED (home)
   ============================================================ */
.activity-list { display: flex; flex-direction: column; }
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--hairline-dark);
  transition: background var(--t-fast);
}
.activity-row:hover { background: rgba(255, 255, 255, 0.5); }
.activity-row:last-child { border-bottom: none; }
.activity-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}
.activity-icon.gold { background: rgba(240, 171, 0, 0.14); color: var(--wbd-gold-dark); }
.activity-icon.pos { background: var(--positive-soft); color: var(--positive); }
.activity-icon.warn { background: var(--warn-soft); color: var(--warn); }
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 13px; color: var(--text); line-height: 1.4; }
.activity-text b { color: var(--text-strong); font-weight: 600; }
.activity-time { font-size: 11px; color: var(--text-faint); margin-top: 2px; }

/* ============================================================
   ORG CHART
   ============================================================ */
.oc-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 16px;
}
.oc-controls .ctrl-label { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 700; margin-right: 4px; }

.toggle-group {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.55);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid var(--hairline-soft);
  backdrop-filter: blur(8px);
}
.toggle-group button {
  border: none;
  background: transparent;
  padding: 6px 14px;
  font-size: 12.5px;
  cursor: pointer;
  border-radius: 7px;
  color: var(--text-muted);
  font-weight: 600;
  font-family: inherit;
  transition: all var(--t-fast);
}
.toggle-group button.active {
  background: white;
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.10), 0 0 0 1px var(--hairline-darker);
}

.oc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.oc-pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.oc-pane-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--hairline-dark);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(99, 102, 241, 0.02) 100%);
  position: relative;
}
.oc-pane-header::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
  opacity: 0.4;
}
.oc-pane.wbd .oc-pane-header { background: linear-gradient(135deg, rgba(240, 171, 0, 0.12) 0%, rgba(240, 171, 0, 0.03) 100%); }
.oc-pane.wbd .oc-pane-header::after { background: linear-gradient(90deg, transparent, var(--wbd-gold-dark), transparent); opacity: 0.4; }
.oc-pane-header h3 { font-size: 15px; font-weight: 700; color: var(--text-strong); letter-spacing: -0.2px; }
.oc-pane-header .pane-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; letter-spacing: 0.1px; }

.oc-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 14px 20px;
  gap: 0;
  background: rgba(255, 255, 255, 0.40);
  border-bottom: 1px solid var(--hairline-dark);
}
.oc-summary .sum {
  padding: 4px 14px;
  border-right: 1px solid var(--hairline-dark);
}
.oc-summary .sum:last-child { border-right: none; }
.oc-summary .sum-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.7px; font-weight: 700; margin-bottom: 4px; }
.oc-summary .sum-value { font-size: 19px; font-weight: 800; color: var(--text-strong); line-height: 1; letter-spacing: -0.4px; font-feature-settings: 'tnum'; }
.oc-summary .sum-value.accent { color: var(--accent); }
.oc-summary .sum-value.gold { color: var(--wbd-gold-dark); }

.oc-breadcrumb {
  padding: 11px 20px;
  font-size: 11.5px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.30);
  border-bottom: 1px solid var(--hairline-dark);
}
.oc-breadcrumb a { color: var(--accent); cursor: pointer; text-decoration: none; font-weight: 500; }
.oc-breadcrumb a:hover { text-decoration: underline; }
.oc-breadcrumb .sep { color: var(--text-ghost); }
.oc-breadcrumb .current { color: var(--text-strong); font-weight: 600; }

.oc-tree { padding: 22px 18px 26px; overflow-y: auto; flex: 1; }

/* Up arrow with curved svg-like connector */
.up-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: white;
  border: 1px solid var(--hairline-darker);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0 auto 14px;
  color: var(--accent);
  font-size: 14px;
  transition: all var(--t-fast);
  box-shadow: 0 3px 10px -2px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255,255,255,0.8);
  position: relative;
}
.up-arrow:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -4px var(--accent-glow);
}

/* Tree layout */
.oc-current-row { display: flex; justify-content: center; margin-bottom: 0; }
.oc-connector {
  width: 1.5px;
  height: 26px;
  background: linear-gradient(180deg, var(--accent), transparent);
  margin: 0 auto;
  opacity: 0.4;
}
.oc-pane.wbd .oc-connector { background: linear-gradient(180deg, var(--wbd-gold-dark), transparent); }

.oc-children {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 26px;
  position: relative;
}
.oc-child-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.oc-child-wrap::before {
  content: '';
  position: absolute;
  top: -26px;
  left: 50%;
  width: 1.5px;
  height: 26px;
  background: linear-gradient(180deg, transparent, rgba(99, 102, 241, 0.4));
}
.oc-pane.wbd .oc-child-wrap::before { background: linear-gradient(180deg, transparent, rgba(240, 171, 0, 0.5)); }
.oc-child-wrap::after {
  content: '';
  position: absolute;
  top: -26px;
  height: 1.5px;
  background: rgba(99, 102, 241, 0.35);
  left: 0;
  right: 0;
}
.oc-pane.wbd .oc-child-wrap::after { background: rgba(240, 171, 0, 0.45); }
.oc-child-wrap:first-child::after { left: 50%; border-radius: 2px 0 0 0; }
.oc-child-wrap:last-child::after { right: 50%; border-radius: 0 2px 0 0; }
.oc-child-wrap:only-child::after { display: none; }

/* Org card */
.org-card {
  width: 190px;
  background: linear-gradient(180deg, white 0%, #fafbfd 100%);
  border: 1px solid var(--hairline-darker);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05), inset 0 1px 0 rgba(255,255,255,0.6);
  transition: all var(--t-base);
  cursor: pointer;
  position: relative;
}
.org-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -8px rgba(99, 102, 241, 0.30), 0 6px 14px -6px rgba(15, 23, 42, 0.10);
  border-color: rgba(99, 102, 241, 0.40);
}
.org-card .oc-top-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--accent-light) 0%, var(--accent) 100%);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.30);
}
.org-card.wbd .oc-top-bar {
  background: linear-gradient(90deg, var(--wbd-gold-light) 0%, var(--wbd-gold-dark) 100%);
  box-shadow: 0 0 8px rgba(240, 171, 0, 0.40);
}
.org-card.current {
  border: 2px solid var(--accent);
  box-shadow: 0 12px 32px -6px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,0.8);
  transform: scale(1.02);
}
.org-card.wbd.current { border-color: var(--wbd-gold-dark); box-shadow: 0 12px 32px -6px rgba(240, 171, 0, 0.40); }
.org-card.current .oc-top-bar { height: 5px; }
.org-card .oc-body { padding: 14px 14px 12px; }
.org-card .ws-tag {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  margin-bottom: 8px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.org-card.wbd .ws-tag { background: rgba(240, 171, 0, 0.14); color: var(--wbd-gold-dark); }
.org-card .role-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
  line-height: 1.3;
  margin-bottom: 6px;
  min-height: 34px;
  letter-spacing: -0.1px;
}
.org-card .role-name {
  font-size: 11.5px;
  color: var(--accent);
  margin-bottom: 6px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}
.org-card.wbd .role-name { color: var(--wbd-gold-dark); }
.org-card .role-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
}
.org-card .role-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.org-card .role-bottom.role-bottom-stacked {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.org-card .dr-chip {
  display: inline-block;
  background: var(--surface-2, rgba(148, 163, 184, 0.18));
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  padding: 3px 11px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-feature-settings: 'tnum';
}
/* Focused-card DR chip previously had two overrides setting
   `rgba(255,255,255,0.22) + color:white` (indigo and WBD variants).
   But .org-card.current only modifies border/shadow/scale - the card
   body stays white - so the overrides rendered as white text on a
   near-white pill (visually empty; reported 2026-06-04, L0 / Zaslav
   card). Both overrides removed: focused indigo cards fall through to
   the base muted-gray .org-card .dr-chip; focused WBD cards fall
   through to the gold .org-card.wbd .dr-chip below. Focus state stays
   signalled by the card's border/shadow/scale and by the HC chip's
   gradient bump, so DR remains visually subordinate to HC and matches
   the legend's chip hierarchy (DR=muted, HC=branded). */
.org-card.wbd .dr-chip { background: rgba(240, 171, 0, 0.10); color: var(--wbd-gold-dark); }
.org-card .hc-chip {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius-pill);
  padding: 3px 11px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-feature-settings: 'tnum';
}
.org-card.current .hc-chip { background: linear-gradient(135deg, var(--accent-light), var(--accent)); color: white; box-shadow: 0 2px 6px var(--accent-glow); }
.org-card.wbd .hc-chip { background: rgba(240, 171, 0, 0.15); color: var(--wbd-gold-dark); }
.org-card.wbd.current .hc-chip { background: linear-gradient(135deg, var(--wbd-gold), var(--wbd-gold-dark)); color: white; box-shadow: 0 2px 6px rgba(240, 171, 0, 0.35); }
.org-card .layer-badge {
  font-size: 9.5px;
  color: var(--text-faint);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.org-card .small-team {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--warn-soft);
  color: var(--warn);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(217, 119, 6, 0.30);
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.20);
  z-index: 1;
}

/* Fast custom tooltip for the warn icon.
   ─────────────────────────────────────────
   Replaces the native `title` attribute (which gates the tooltip behind
   an uncontrollable ~500–700ms browser delay). Driven by data-warn-reason
   emitted by tree.js. Scoped to .oc-tree[data-hover-detail="off"] so the
   tooltip and the rich .oc-card-tip popover never stack — when the
   hover-detail toggle is ON, the popover's tip-warn row owns the message.
   z-index sits below the popover (9999) but above sibling cards (2).
*/
.oc-tree[data-hover-detail="off"] .org-card .small-team[data-warn-reason]::after {
  content: attr(data-warn-reason);
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: var(--text-strong);
  color: #fff;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.1px;
  white-space: nowrap;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(2px);
  transition: opacity 80ms ease-out, transform 80ms ease-out;
  z-index: 50;
}
.oc-tree[data-hover-detail="off"] .org-card .small-team[data-warn-reason]:hover::after {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .oc-tree[data-hover-detail="off"] .org-card .small-team[data-warn-reason]::after {
    transition: none;
  }
}
@media print {
  .org-card .small-team[data-warn-reason]::after { display: none !important; }
}
.org-card .chevron {
  text-align: center;
  padding: 6px 0;
  border-top: 1px solid var(--hairline-dark);
  color: var(--accent);
  font-size: 12px;
  background: linear-gradient(180deg, rgba(99, 102, 241, 0.04), rgba(99, 102, 241, 0.08));
  cursor: pointer;
  font-weight: 600;
  transition: all var(--t-fast);
}
.org-card .chevron:hover { background: linear-gradient(180deg, rgba(99, 102, 241, 0.10), rgba(99, 102, 241, 0.18)); }
.org-card.wbd .chevron { color: var(--wbd-gold-dark); background: linear-gradient(180deg, rgba(240, 171, 0, 0.05), rgba(240, 171, 0, 0.10)); }
.org-card.wbd .chevron:hover { background: linear-gradient(180deg, rgba(240, 171, 0, 0.12), rgba(240, 171, 0, 0.22)); }
.org-card .chevron.disabled { color: var(--text-faint); background: transparent; cursor: default; }

/* ============================================================
   Card legend (top of each pane body)
   ─────────────────────────────────────────────────────────────
   Explains the warning icon and chip vocabulary at a glance.
   Same wording is pinned by tree.test.mjs.
   ============================================================ */
.oc-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 14px;
  margin: 0 0 14px;
  background: var(--surface);
  border: 1px solid var(--hairline-dark);
  border-radius: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
}
.oc-legend-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text);
  padding-right: 10px;
  border-right: 1px solid var(--hairline-dark);
}
.oc-legend-item { display: inline-flex; align-items: center; gap: 7px; }
.oc-legend-warn {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--warn-soft); color: var(--warn);
  font-size: 9px;
}
.oc-legend-chip {
  display: inline-block;
  font-feature-settings: 'tnum';
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.2px;
  border-radius: var(--radius-pill);
  padding: 2px 8px;
}
.oc-legend-chip.dr { background: var(--surface-2, rgba(148, 163, 184, 0.18)); color: var(--text-muted); }
.oc-legend-chip.hc { background: var(--accent-soft); color: var(--accent); }
.oc-legend-chip.layer { background: rgba(15,23,42,0.06); color: var(--text-faint); font-size: 9.5px; padding: 2px 7px; letter-spacing: 0.5px; text-transform: uppercase; }
.oc-legend-foot {
  margin-left: auto;
  font-size: 11px;
  color: var(--accent);
  font-style: italic;
}

/* ============================================================
   Floating hover-detail popover (single-instance, body-attached)
   ─────────────────────────────────────────────────────────────
   Only used when the user opts in via the "Card detail on hover"
   display toggle. Single element appended to <body> so it can
   never be clipped by .oc-tree's overflow:auto or .org-card's
   overflow:hidden. Positioned by JS (tree.js → positionTip()).
   ============================================================ */
.oc-card-tip {
  position: fixed;
  z-index: 9999;
  width: 240px;
  max-width: calc(100vw - 20px);
  background: var(--surface);
  border: 1px solid var(--hairline-dark);
  border-radius: 12px;
  box-shadow: 0 18px 40px -12px rgba(15, 23, 42, 0.20), 0 6px 14px -6px rgba(15, 23, 42, 0.12);
  padding: 12px 14px;
  font-size: 12px;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 140ms ease-out, transform 140ms ease-out;
}
.oc-card-tip.is-open { opacity: 1; transform: translateY(0); }

/* Caret / tail pointing at the source card. JS sets --caret-left to the
   horizontal pixel offset (in tip-local coords) of the card's centre, so
   the tail still points at the card even when the panel was clamped near
   a viewport edge. The pair below renders the tail downward (popover
   above the card) or upward (popover below the card when .is-below). */
.oc-card-tip::after,
.oc-card-tip.is-below::before {
  content: '';
  position: absolute;
  left: clamp(14px, var(--caret-left, 50%), calc(100% - 14px));
  width: 12px; height: 12px;
  background: var(--surface);
  border: 1px solid var(--hairline-dark);
  transform: translateX(-50%) rotate(45deg);
}
/* Default (popover ABOVE the card): tail below the panel, pointing down. */
.oc-card-tip::after {
  bottom: -7px;
  border-top: none;
  border-left: none;
}
/* When .is-below: hide the bottom tail, show one above pointing up. */
.oc-card-tip.is-below::after { display: none; }
.oc-card-tip.is-below::before {
  top: -7px;
  border-bottom: none;
  border-right: none;
}
.oc-card-tip .tip-head {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 8px; margin-bottom: 8px;
  border-bottom: 1px solid var(--hairline-dark);
}
.oc-card-tip .tip-pos-id {
  background: var(--surface-2, rgba(148, 163, 184, 0.18));
  color: var(--text-muted);
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.3px;
  font-feature-settings: 'tnum';
  padding: 2px 7px; border-radius: var(--radius-pill);
  flex-shrink: 0;
}
.oc-card-tip .tip-title { font-weight: 700; color: var(--text-strong); font-size: 12.5px; line-height: 1.3; }
.oc-card-tip .tip-warn {
  display: flex; align-items: center; gap: 8px;
  background: var(--warn-soft); color: var(--warn);
  padding: 7px 9px; border-radius: 8px;
  font-size: 11px; font-weight: 600;
  margin-bottom: 8px;
}
.oc-card-tip .tip-warn i { font-size: 10px; flex-shrink: 0; }
.oc-card-tip .tip-row { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.oc-card-tip .tip-label { color: var(--text-muted); font-size: 11px; }
.oc-card-tip .tip-value { color: var(--text-strong); font-weight: 500; text-align: right; }
.oc-card-tip .tip-foot {
  display: flex; justify-content: space-between;
  padding-top: 8px; margin-top: 8px;
  border-top: 1px solid var(--hairline-dark);
  font-size: 11px; color: var(--text-muted);
}

/* ============================================================
   Spotlight effect: when one card has the popover open, the
   tree gets `.is-spotlighting` and OTHER cards fade. Opacity +
   slight desaturation, no blur (blur is janky on weak machines
   and over large trees).
   ============================================================ */
.oc-tree.is-spotlighting .org-card { transition: opacity 180ms ease-out, filter 180ms ease-out, box-shadow 180ms ease-out; }
.oc-tree.is-spotlighting .org-card:not(.is-tip-source) {
  /* Drop hard enough to read as "background" — the previous 0.55 left
     siblings competing for attention with the popover's source card. */
  opacity: 0.25;
  filter: saturate(0.6);
}
.oc-tree.is-spotlighting .org-card.is-tip-source {
  /* Keep the "current" card's existing scale and shadow; lift it above
     siblings and add a soft outline so the popover's anchor is obvious
     at a glance, even before the caret resolves. */
  z-index: 2;
  box-shadow:
    0 0 0 2px rgba(124, 58, 237, 0.35),
    0 18px 40px -12px rgba(15, 23, 42, 0.22),
    0 6px 14px -6px rgba(15, 23, 42, 0.14);
}
@media (prefers-reduced-motion: reduce) {
  .oc-card-tip { transition: none; }
  .oc-tree.is-spotlighting .org-card { transition: none; }
}

/* Browser Cmd-P / "Print" path (not the production Export pipeline, which
   renders a separate PDF via the org-chart-render Lambda). The hover popover
   is a screen-only affordance — suppress it on print, and cancel the
   spotlight dim so siblings render at full opacity in the printed output.
   The production Export button is unaffected by this rule. */
@media print {
  .oc-card-tip { display: none !important; }
  .oc-tree.is-spotlighting .org-card:not(.is-tip-source) {
    opacity: 1 !important;
    filter: none !important;
  }
}

/* ============================================================
   ADMIN AREA
   ============================================================ */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 0 4px;
  position: relative;
  border-bottom: 1px solid var(--hairline-dark);
}
.admin-tab {
  padding: 11px 18px;
  background: transparent;
  border: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast);
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
  bottom: -1px;
}
.admin-tab:hover { color: var(--text-strong); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.admin-tab.active::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-light), var(--accent));
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.40);
}
.admin-tab .tab-count {
  font-size: 10.5px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-weight: 700;
}

.table-card { padding: 0; overflow: hidden; }
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--hairline-dark);
}
.table-wrap { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  text-align: left;
  padding: 12px 20px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: rgba(15, 23, 42, 0.025);
  border-bottom: 1px solid var(--hairline-dark);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  backdrop-filter: blur(10px);
}
.data-table tbody td {
  padding: 13px 20px;
  border-bottom: 1px solid var(--hairline-dark);
  color: var(--text);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--t-fast); }
.data-table tbody tr:hover td { background: rgba(99, 102, 241, 0.04); }
.data-table tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; color: var(--text-strong); }
.cell-muted { color: var(--text-muted); }
.cell-mono { font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace; font-size: 12px; color: var(--text-muted); }

.row-actions { display: flex; gap: 6px; }
.row-actions .btn { padding: 5px 11px; font-size: 11.5px; font-weight: 600; }

/* avatar in tables */
.mini-avatar { display: inline-flex; align-items: center; gap: 10px; }
.mini-avatar .ma-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(67, 56, 202, 0.20), inset 0 1px 0 rgba(255,255,255,0.20);
}

/* App chips */
.app-chips { display: flex; flex-wrap: wrap; gap: 5px; max-width: 360px; }
.app-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.15);
  transition: all var(--t-fast);
}
.app-chip:hover { background: rgba(99, 102, 241, 0.18); }
.app-chip.tech { background: rgba(240, 171, 0, 0.14); color: var(--wbd-gold-dark); border-color: rgba(240, 171, 0, 0.25); }
.app-chip.tech:hover { background: rgba(240, 171, 0, 0.22); }
.app-chip .x { cursor: pointer; font-size: 11px; opacity: 0.6; transition: opacity var(--t-fast); }
.app-chip .x:hover { opacity: 1; }

/* Empty state */
.empty-state-card {
  padding: 60px 44px;
  text-align: center;
  max-width: 580px;
  margin: 60px auto;
  position: relative;
  overflow: hidden;
}
.empty-state-card::before {
  content: '';
  position: absolute;
  top: -30%; left: 50%; transform: translateX(-50%);
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.10), transparent 60%);
  pointer-events: none;
}
.empty-state-card .es-illustration {
  width: 96px;
  height: 96px;
  margin: 0 auto 22px;
  position: relative;
  z-index: 1;
}
.empty-state-card h2 {
  font-size: 24px;
  color: var(--text-strong);
  margin-bottom: 12px;
  letter-spacing: -0.4px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}
.empty-state-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 18px;
  position: relative;
  z-index: 1;
}
.empty-state-card .es-actions { display: inline-flex; gap: 10px; position: relative; z-index: 1; margin-top: 8px; }

/* ============================================================
   DONUT CHART (for admin roles tab)
   ============================================================ */
.donut-wrap { display: flex; align-items: center; gap: 28px; padding: 24px; }
.donut { position: relative; width: 160px; height: 160px; flex-shrink: 0; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut .donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.donut .donut-center .dc-value { font-size: 26px; font-weight: 800; color: var(--text-strong); letter-spacing: -0.6px; line-height: 1; font-feature-settings: 'tnum'; }
.donut .donut-center .dc-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-top: 4px; font-weight: 700; }
.donut-legend { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.donut-legend-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.donut-legend-row .dl-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend-row .dl-name { color: var(--text-strong); font-weight: 600; flex: 1; }
.donut-legend-row .dl-value { color: var(--text-muted); font-weight: 600; font-feature-settings: 'tnum'; }
.donut-legend-row .dl-pct { color: var(--text-faint); font-size: 11.5px; min-width: 40px; text-align: right; }

/* ============================================================
   SCROLLBARS
   ============================================================ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.15); border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, 0.28); background-clip: content-box; border: 2px solid transparent; }

/* ============================================================
   UTILITIES
   ============================================================ */
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-end { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.strong { color: var(--text-strong); font-weight: 600; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 18px; }
.mb-3 { margin-bottom: 26px; }

/* Status dots */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.live { background: var(--positive); box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.18); }
.status-dot.disabled { background: var(--text-faint); }
.status-dot.maintenance { background: var(--warn); box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18); }

/* ============================================================
   ENTRY ANIMATIONS
   ============================================================ */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-in {
  opacity: 0;
  animation: fade-up 0.6s cubic-bezier(.16,1,.3,1) forwards;
}
.anim-in.d1 { animation-delay: 0.05s; }
.anim-in.d2 { animation-delay: 0.10s; }
.anim-in.d3 { animation-delay: 0.15s; }
.anim-in.d4 { animation-delay: 0.20s; }
.anim-in.d5 { animation-delay: 0.25s; }
.anim-in.d6 { animation-delay: 0.30s; }

@keyframes count-up {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   AVATAR GROUP (for hero etc.)
   ============================================================ */
.avatar-group { display: inline-flex; }
.avatar-group .ag-item {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--bg-base);
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-size: 10.5px; font-weight: 700;
  margin-left: -8px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.10);
}
.avatar-group .ag-item:first-child { margin-left: 0; }
.avatar-group .ag-more {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-muted);
  font-weight: 700;
  border-color: var(--bg-base);
}

/* ============================================================
   ADMIN — extras (cells / chips / modals / forms / table foot)
   ============================================================ */

.cell-with-icon { display: inline-flex; align-items: center; gap: 12px; }
.cell-icon {
  width: 34px; height: 34px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  flex: 0 0 34px;
}
.cell-sub { font-size: 11.5px; line-height: 1.4; margin-top: 2px; }

.user-avatar.small {
  width: 30px; height: 30px;
  font-size: 11px;
}

.mono {
  font-family: 'JetBrains Mono', 'SF Mono', Monaco, monospace;
  font-size: 11.5px;
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 10px;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.10);
  color: var(--accent);
  font-size: 11.5px; font-weight: 600;
  margin: 2px 4px 2px 0;
}
.chip-x {
  border: none; background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px; line-height: 1;
  padding: 0 2px;
  opacity: 0.6;
  transition: opacity var(--t-fast);
}
.chip-x:hover { opacity: 1; color: #ef5350; }

.table-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border-light, rgba(15, 23, 42, 0.06));
  font-size: 12px;
}

/* Modal */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
}
.modal-panel {
  position: relative;
  width: 100%; max-width: 480px;
  border-radius: 16px;
  padding: 0;
  display: flex; flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}
.modal-head, .modal-foot {
  padding: 18px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-body { padding: 4px 24px 16px; overflow-y: auto; }
.modal-foot { border-top: 1px solid var(--border-light, rgba(15, 23, 42, 0.06)); justify-content: flex-end; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.field input[type=text],
.field input[type=email],
.field textarea,
.field select {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(15, 23, 42, 0.10));
  background: white;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-strong);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.field-row { display: flex; gap: 14px; margin-bottom: 14px; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.checkbox input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }

.actions { text-align: right; white-space: nowrap; }
.data-table .actions .btn { margin-left: 4px; }

/* ============================================================
   SKELETON LOADING (UX-002)
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, rgba(15, 23, 42, 0.06) 25%, rgba(15, 23, 42, 0.12) 50%, rgba(15, 23, 42, 0.06) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-text { height: 16px; width: 120px; }
.skeleton-text-sm { height: 14px; width: 80px; }
.skeleton-badge { height: 22px; width: 60px; border-radius: 11px; }
.skeleton-actions { height: 28px; width: 90px; }
.skeleton-row td { padding: 14px 12px; }

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; background: rgba(15, 23, 42, 0.08); }
}

/* ============================================================
   OFFLINE INDICATOR (UX-004)
   ============================================================ */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #ef4444;
  color: white;
  text-align: center;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}
.offline-banner.visible { transform: translateY(0); }
.offline-banner i { font-size: 14px; }

/* ============================================================
   ERROR DISPLAY (UX-003)
   ============================================================ */
.error-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid #ef4444;
  border-radius: 8px;
  padding: 16px 20px;
  max-width: 400px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  animation: toast-in 0.3s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.error-toast-title {
  font-weight: 600;
  color: #991b1b;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.error-toast-message {
  font-size: 13px;
  color: #7f1d1d;
  line-height: 1.5;
}
.error-toast-id {
  font-size: 11px;
  color: #b91c1c;
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
}
.error-toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #b91c1c;
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
}

/* ============================================================
   FORM VALIDATION (UX-005)
   ============================================================ */
.field input:invalid:not(:placeholder-shown),
.field input.invalid {
  border-color: #ef4444;
}
.field input:invalid:not(:placeholder-shown):focus,
.field input.invalid:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}
.field-error {
  font-size: 11px;
  color: #ef4444;
  margin-top: 4px;
  display: none;
}
.field input:invalid:not(:placeholder-shown) + .field-error,
.field input.invalid ~ .field-error {
  display: block;
}
.field input:valid:not(:placeholder-shown) {
  border-color: #22c55e;
}
.field input:valid:not(:placeholder-shown):focus {
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15);
}
