/* =============================================
   AccountLens - Design System
   ============================================= */

:root {
  /* AWS Brand Colors */
  --aws-navy: #232F3E;
  --aws-navy-light: #2A3A4E;
  --aws-navy-darker: #1A2332;
  --aws-orange: #FF9900;
  --aws-orange-hover: #EC7211;
  --aws-orange-light: rgba(255, 153, 0, 0.1);
  --aws-blue: #146EB4;
  --aws-blue-light: #2196F3;
  --aws-teal: #1B9AAA;
  --aws-green: #1DAA6B;
  --aws-red: #D13212;
  --aws-purple: #8C4FFF;

  /* Neutrals */
  --bg-primary: #0F1318;
  --bg-secondary: #161B22;
  --bg-tertiary: #1C2128;
  --bg-card: #1C2128;
  --bg-card-hover: #22272E;
  --bg-input: #0D1117;
  --bg-hover: rgba(255, 255, 255, 0.06);
  --bg-main: var(--bg-primary);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-color-light: rgba(255, 255, 255, 0.12);
  --border: var(--border-color);
  --accent: var(--aws-orange);
  --text-primary: #E6EDF3;
  --text-secondary: #8B949E;
  --text-muted: #656D76;

  /* Spacing */
  --sidebar-width: 260px;
  --header-height: 56px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Shadows — layered for depth */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 20px rgba(255, 153, 0, 0.15), 0 0 60px rgba(255, 153, 0, 0.05);
  --shadow-card-hover: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.1);

  /* Transitions */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 0.15s;
  --duration-normal: 0.25s;
  --duration-slow: 0.4s;
}

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

html {
  font-size: 14px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
}

/* Global focus ring for accessibility */
:focus-visible {
  outline: 2px solid var(--aws-orange);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Selection color */
::selection {
  background: rgba(255, 153, 0, 0.3);
  color: #fff;
}

a { color: var(--aws-blue-light); text-decoration: none; }
a:hover { color: var(--aws-orange); }

/* =============================================
   Layout Shell
   ============================================= */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  height: 100vh;
  overflow: hidden;
}

/* =============================================
   Sidebar
   ============================================= */
.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, var(--aws-navy) 0%, var(--aws-navy-darker) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 100;
}

.sidebar-brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.sidebar-brand .logo {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--aws-orange) 0%, #E8860E 100%);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  letter-spacing: -0.5px;
  box-shadow: 0 2px 12px rgba(255, 153, 0, 0.35);
}

.sidebar-brand h1 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.sidebar-brand .badge {
  font-size: 9px;
  font-weight: 700;
  background: var(--aws-orange);
  color: #000;
  padding: 2px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-section {
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  padding: 8px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  position: relative;
  user-select: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  transform: translateX(2px);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(255, 153, 0, 0.12) 0%, rgba(255, 153, 0, 0.04) 100%);
  color: var(--aws-orange);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: linear-gradient(180deg, var(--aws-orange), var(--aws-orange-hover));
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(255, 153, 0, 0.4);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg { opacity: 1; }

.nav-item .count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 7px;
  border-radius: 10px;
  color: var(--text-muted);
}

.nav-item.active .count {
  background: rgba(255, 153, 0, 0.2);
  color: var(--aws-orange);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.sidebar-footer .user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--aws-teal), var(--aws-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 2px 8px rgba(27, 154, 170, 0.3);
}

.sidebar-footer .user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.sidebar-footer .user-role {
  font-size: 11px;
  color: var(--text-muted);
}

/* =============================================
   Header
   ============================================= */
.header {
  grid-area: header;
  background: rgba(22, 27, 34, 0.85);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 90;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-left .breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.header-left .breadcrumb .current {
  color: var(--text-primary);
  font-weight: 600;
}

.header-left .breadcrumb svg {
  width: 14px;
  height: 14px;
  opacity: 0.4;
}

.header-search {
  position: relative;
  width: 320px;
}

.header-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  background: rgba(13, 17, 23, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.header-search input::placeholder { color: var(--text-muted); }
.header-search input:focus {
  border-color: rgba(255, 153, 0, 0.5);
  background: rgba(13, 17, 23, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.08);
}

.header-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── User Menu ─── */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.user-menu-trigger:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-color);
}

.user-menu.open .user-menu-trigger {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-color);
}

.user-menu-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--aws-teal), var(--aws-blue));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-menu-info {
  text-align: left;
  min-width: 0;
}

.user-menu-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

.user-menu-role {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.user-menu-chevron {
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.user-menu.open .user-menu-chevron {
  transform: rotate(180deg);
}

.user-menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  padding: 4px;
  animation: dropdownFadeIn 0.15s ease;
}

.user-menu.open .user-menu-dropdown {
  display: block;
}

@keyframes dropdownFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-menu-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.1s;
}

.user-menu-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.user-menu-dropdown-item svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.user-menu-dropdown-item:hover svg {
  color: var(--text-secondary);
}

.user-menu-dropdown-sep {
  height: 1px;
  background: var(--border-color);
  margin: 4px 8px;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  white-space: nowrap;
}
.lang-toggle:hover {
  background: rgba(255, 153, 0, 0.08);
  color: var(--aws-orange);
  border-color: rgba(255, 153, 0, 0.3);
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}

.header-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); }

.header-btn .dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--aws-orange);
  border: 2px solid var(--bg-secondary);
}

/* =============================================
   Main Content
   ============================================= */
.main-content {
  grid-area: main;
  overflow-y: auto;
  padding: 24px;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 153, 0, 0.02) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(33, 150, 243, 0.015) 0%, transparent 50%),
    var(--bg-primary);
}

.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 3px; }
.main-content::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }

/* =============================================
   Page Header
   ============================================= */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-header .subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* =============================================
   Stats Row
   ============================================= */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: linear-gradient(135deg, rgba(28, 33, 40, 0.8) 0%, rgba(22, 27, 34, 0.9) 100%);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all var(--duration-normal) var(--ease-out-expo);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(8px);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent, var(--aws-orange)), transparent);
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  background: var(--accent-bg, var(--aws-orange-light));
}

.stat-card .stat-icon svg {
  width: 20px;
  height: 20px;
  color: var(--accent, var(--aws-orange));
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 4px;
}

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

/* =============================================
   Cards / Panels
   ============================================= */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--duration-fast);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

.card-body.no-pad {
  padding: 0;
}

/* =============================================
   Buttons
   ============================================= */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  white-space: nowrap;
  font-family: inherit;
  position: relative;
}

.btn svg { width: 16px; height: 16px; }

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--aws-orange) 0%, #E8860E 100%);
  color: #000;
  box-shadow: 0 2px 12px rgba(255, 153, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(255, 153, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  filter: brightness(1.05);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  backdrop-filter: blur(4px);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 10px;
}
.btn-ghost:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }

.btn-danger {
  background: rgba(209, 50, 18, 0.12);
  color: var(--aws-red);
  border: 1px solid rgba(209, 50, 18, 0.2);
}
.btn-danger:hover {
  background: rgba(209, 50, 18, 0.22);
  border-color: rgba(209, 50, 18, 0.4);
}

.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }

/* =============================================
   Customer Grid
   ============================================= */
.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.customer-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out-expo);
  position: relative;
}

.customer-card:hover {
  border-color: rgba(255, 153, 0, 0.4);
  box-shadow: var(--shadow-glow), var(--shadow-card-hover);
  transform: translateY(-3px);
}

.customer-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--duration-normal);
  background: linear-gradient(135deg, rgba(255, 153, 0, 0.04) 0%, transparent 60%);
  pointer-events: none;
}

.customer-card:hover::after {
  opacity: 1;
}

.customer-card .customer-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}

.customer-card .customer-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--aws-blue), var(--aws-teal));
  box-shadow: 0 4px 12px rgba(20, 110, 180, 0.25);
}

.customer-card .customer-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.customer-card .customer-industry {
  font-size: 12px;
  color: var(--text-secondary);
}

.customer-card .customer-meta {
  display: flex;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.customer-card .meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-secondary);
}

.customer-card .meta-item svg { width: 14px; height: 14px; opacity: 0.6; }

.customer-card .status-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.active {
  background: rgba(29, 170, 107, 0.12);
  color: var(--aws-green);
  box-shadow: 0 0 8px rgba(29, 170, 107, 0.15);
}
.status-badge.prospect {
  background: rgba(33, 150, 243, 0.12);
  color: var(--aws-blue-light);
  box-shadow: 0 0 8px rgba(33, 150, 243, 0.15);
}
.status-badge.inactive {
  background: rgba(139, 148, 158, 0.12);
  color: var(--text-muted);
}

/* =============================================
   Org Chart Container v2
   ============================================= */
.orgchart-container {
  width: 100%;
  min-height: 500px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 153, 0, 0.015) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg-primary) 0%, rgba(15,19,24,1) 100%);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  /* Dot grid background */
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 24px 24px;
}

.orgchart-canvas {
  width: 100%;
  height: 100%;
  min-height: 500px;
  cursor: grab;
  position: relative;
  overflow: hidden;
}

.orgchart-nodes {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}

.orgchart-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 20;
}

.orgchart-controls button {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(28, 33, 40, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.orgchart-controls button:hover {
  background: rgba(34, 39, 46, 0.95);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.12);
  transform: scale(1.05);
}

/* Zoom label */
.oc-zoom-label {
  position: absolute;
  bottom: 18px;
  right: 58px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  z-index: 20;
  pointer-events: none;
}

/* =============================================
   Org Chart Nodes v2
   ============================================= */
.org-node {
  position: absolute;
  background: rgba(28, 33, 40, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  text-align: center;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow: hidden;
}

.org-node:hover {
  border-color: var(--stance-color, var(--aws-orange));
  box-shadow: 0 0 20px color-mix(in srgb, var(--stance-color, var(--aws-orange)) 25%, transparent), 0 4px 16px rgba(0,0,0,0.3);
  z-index: 10;
  transform: translateY(-1px);
}

.org-node--selected {
  border-color: var(--aws-orange) !important;
  box-shadow: 0 0 0 2px rgba(255,153,0,0.25), 0 0 24px rgba(255,153,0,0.15) !important;
  z-index: 15 !important;
}

.org-node--root {
  border-color: rgba(255, 153, 0, 0.3);
  background: linear-gradient(180deg, rgba(255, 153, 0, 0.06) 0%, var(--bg-card) 100%);
}

/* Standard node layout */
.org-node__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.org-node__avatar--sm {
  width: 28px;
  height: 28px;
  font-size: 10px;
}

.org-node__name {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
  max-width: 100%;
}

.org-node__title {
  font-size: 10px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.org-node__dept {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid;
  display: inline-block;
  margin-top: 2px;
}

.org-node__stance {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  border-radius: 10px 10px 0 0;
}

/* Compact row layout (for 30+ members) */
.org-node__row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.org-node__row .org-node__info {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.org-node__row .org-node__stance {
  position: static;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Toggle (collapse/expand) */
.org-node__toggle {
  position: absolute;
  bottom: -12px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  cursor: pointer;
  z-index: 12;
  transition: all 0.15s;
  line-height: 1;
}

.org-node__toggle:hover {
  background: var(--aws-orange);
  color: #000;
  border-color: var(--aws-orange);
}

.org-node__badge {
  font-size: 9px;
  font-weight: 700;
  color: var(--aws-orange);
}

.org-node__toggle:hover .org-node__badge {
  color: #000;
}

/* =============================================
   Floating Info Card
   ============================================= */
.oc-floating-card {
  position: fixed;
  width: 340px;
  max-height: 480px;
  overflow-y: auto;
  background: rgba(28, 33, 40, 0.92);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  box-shadow: 0 16px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.04), 0 0 40px rgba(0,0,0,0.2);
  z-index: 1000;
  display: none;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity var(--duration-normal) var(--ease-out-expo), transform var(--duration-normal) var(--ease-out-expo);
}

.oc-floating-card::-webkit-scrollbar { width: 4px; }
.oc-floating-card::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.oc-fc--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.oc-fc__header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border-color);
  position: relative;
  cursor: grab;
  user-select: none;
}

.oc-fc__header:active {
  cursor: grabbing;
}

.oc-fc__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.oc-fc__headerinfo { flex: 1; min-width: 0; }

.oc-fc__name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.oc-fc__title {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 1px;
}

.oc-fc__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.oc-fc__tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.oc-fc__tag--level {
  background: rgba(140,79,255,0.15);
  color: var(--aws-purple);
}

.oc-fc__tag--inf {
  background: rgba(27,154,170,0.15);
  color: var(--aws-teal);
}

.oc-fc__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.15s;
}

.oc-fc__close:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }

.oc-fc__section {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
}

.oc-fc__section:last-child { border-bottom: none; }

.oc-fc__section--notes { padding-bottom: 14px; }

.oc-fc__label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.oc-fc__count {
  font-size: 10px;
  font-weight: 700;
  background: rgba(255,153,0,0.15);
  color: var(--aws-orange);
  padding: 0 5px;
  border-radius: 6px;
}

.oc-fc__grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.oc-fc__field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.oc-fc__icon {
  width: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.oc-fc__person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.oc-fc__person:hover { background: rgba(255,255,255,0.04); }

.oc-fc__person-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.oc-fc__person-avatar--sm {
  width: 26px;
  height: 26px;
  font-size: 9px;
}

.oc-fc__person-name {
  font-size: 12px;
  font-weight: 600;
}

.oc-fc__person-title {
  font-size: 10px;
  color: var(--text-muted);
}

.oc-fc__person--sm { padding: 4px 8px; }

.oc-fc__reports {
  display: flex;
  flex-direction: column;
}

.oc-fc__more {
  font-size: 11px;
  color: var(--aws-orange);
  padding: 4px 8px;
  cursor: pointer;
}

.oc-fc__rel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
}

.oc-fc__rel-type {
  font-weight: 600;
  text-transform: capitalize;
  font-size: 11px;
}

.oc-fc__rel-name {
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 0.15s;
}

.oc-fc__rel-name:hover { color: var(--aws-orange); }

.oc-fc__notes {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}

.oc-fc__profile-link {
  padding: 10px 16px 14px !important;
  border-top: 1px solid var(--border-color);
}

.oc-fc__profile-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.oc-fc__profile-btn:hover {
  color: var(--aws-orange);
  border-color: var(--aws-orange);
}

/* ── Member Profile Page ── */
.member-profile {
  animation: profileFadeIn 0.4s var(--ease-out-expo);
}

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

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

.profile-left { min-width: 0; }
.profile-right { min-width: 0; }

.profile-section-title {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.profile-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.report-card:hover {
  border-color: var(--aws-orange) !important;
  box-shadow: 0 0 0 1px var(--aws-orange);
}

/* ── Interaction Log ── */
.ilog { padding: 0 !important; }

.ilog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
}

.ilog-count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 10px;
}

.ilog-timeline {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

/* Custom scrollbar */
.ilog-timeline::-webkit-scrollbar { width: 5px; }
.ilog-timeline::-webkit-scrollbar-track { background: transparent; }
.ilog-timeline::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.ilog-timeline::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

.ilog-entry {
  position: relative;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--aws-orange);
  transition: all var(--duration-fast) var(--ease-out-expo);
}

.ilog-entry:hover {
  border-color: var(--aws-orange);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  transform: translateX(2px);
}

.ilog-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ilog-entry-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ilog-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--aws-orange);
}

.ilog-author {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-main);
  padding: 1px 8px;
  border-radius: 4px;
}

.ilog-edited {
  font-size: 10px;
  color: var(--text-muted);
  font-style: italic;
}

.ilog-entry-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.ilog-entry:hover .ilog-entry-actions {
  opacity: 1;
}

.btn-icon {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon:hover {
  color: var(--aws-orange);
  border-color: var(--aws-orange);
  background: rgba(255, 153, 0, 0.08);
}

.ilog-entry-content {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  word-break: break-word;
}

.ilog-entry-content p { margin: 0 0 8px; }
.ilog-entry-content p:last-child { margin-bottom: 0; }
.ilog-entry-content ul,
.ilog-entry-content ol { margin: 4px 0 8px 20px; padding: 0; }
.ilog-entry-content li { margin-bottom: 2px; }
.ilog-entry-content b,
.ilog-entry-content strong { color: var(--text-primary); }
.ilog-entry-content img {
  max-width: 100%;
  max-height: 300px;
  border-radius: 6px;
  margin: 8px 0;
  cursor: pointer;
}
.ilog-entry-content hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 12px 0;
}

/* Inline tables in interaction entries */
.rte-table,
.ilog-entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 12px;
}

.rte-table th,
.rte-table td,
.ilog-entry-content table th,
.ilog-entry-content table td {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  text-align: left;
}

.rte-table th,
.ilog-entry-content table th {
  background: var(--bg-main);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
}

/* ── Rich Text Editor ── */
.ilog-editor {
  border-top: 1px solid var(--border-color);
}

.rte-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(22, 27, 34, 0.6);
  backdrop-filter: blur(4px);
}

.rte-btn {
  width: 30px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.12s;
}

.rte-btn:hover {
  background: var(--bg-main);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.rte-btn:active {
  background: var(--aws-orange);
  color: #000;
}

.rte-sep {
  width: 1px;
  height: 18px;
  background: var(--border-color);
  margin: 0 4px;
}

.rte-body {
  min-height: 100px;
  max-height: 200px;
  overflow-y: auto;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-primary);
  outline: none;
}

.rte-body:empty::before {
  content: attr(placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.rte-body:focus {
  background: rgba(255, 153, 0, 0.02);
}

/* Editable tables in editor */
.rte-body table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.rte-body th, .rte-body td { padding: 4px 8px; border: 1px solid var(--border-color); min-width: 40px; }
.rte-body th { background: var(--bg-main); font-weight: 600; font-size: 11px; }
.rte-body img { max-width: 100%; max-height: 300px; border-radius: 6px; margin: 8px 0; }

.ilog-editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-secondary);
}

.ilog-editor-hint {
  font-size: 11px;
  color: var(--text-muted);
}

/* =============================================
   Project Org Chart
   ============================================= */
.proj-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.proj-toolbar-left,
.proj-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.proj-select {
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
}
.proj-select:focus {
  outline: none;
  border-color: rgba(255, 153, 0, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.08);
}
.proj-member-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}
.proj-member-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.proj-member-info {
  flex: 1;
  min-width: 0;
}

/* =============================================
   Chart Appearances (Member Profile)
   ============================================= */
.chart-appearances {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.chart-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--duration-fast) var(--ease-out-expo);
  cursor: default;
}
.chart-badge--active {
  background: rgba(29,170,107,0.1);
  color: #1DAA6B;
  border-color: rgba(29,170,107,0.2);
  box-shadow: 0 0 8px rgba(29,170,107,0.1);
}
.chart-badge--inactive {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  border-color: var(--border-color);
}
.chart-projects-detail {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chart-project-item {
  padding: 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.chart-project-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.chart-project-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}
.chart-project-relations {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chart-rel-row {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chart-rel-label {
  color: var(--text-muted);
  white-space: nowrap;
}
.chart-rel-name {
  color: var(--aws-orange);
  cursor: pointer;
}

/* =============================================
   Minimap
   ============================================= */
.oc-minimap {
  position: absolute;
  bottom: 16px;
  left: 16px;
  width: 180px;
  height: 120px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  z-index: 20;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.oc-minimap:hover { opacity: 1; }

/* =============================================
   Political Graph
   ============================================= */
.pg-canvas {
  width: 100%;
  height: 100%;
  cursor: grab;
  display: block;
}

.pg-canvas:active { cursor: grabbing; }

.pg-floating-card {
  max-height: 440px;
}

.pg-legend {
  position: absolute;
  top: 16px;
  left: 16px;
  background: rgba(28, 33, 40, 0.88);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  z-index: 20;
  min-width: 150px;
}

.pg-legend__title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.pg-legend__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  padding: 3px 0;
}

.pg-legend__line {
  width: 20px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.pg-legend__dot {
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-muted);
}

.pg-legend__dot--lg {
  width: 14px;
  height: 14px;
}

.pg-legend__dot--sm {
  width: 8px;
  height: 8px;
}

.pg-legend__sep {
  height: 1px;
  background: var(--border-color);
  margin: 8px 0;
}

.pg-controls {
  bottom: 16px;
  right: 16px;
}

.pg-rel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid var(--border-color);
}

.pg-rel-row:last-child { border-bottom: none; }

.pg-rel-person {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.pg-rel-person:hover { opacity: 0.8; }

.pg-rel-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* =============================================
   Tables
   ============================================= */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.02);
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background var(--duration-fast);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table .cell-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.data-table .cell-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.data-table .cell-name { font-weight: 600; }
.data-table .cell-sub { font-size: 11px; color: var(--text-muted); }

.data-table .actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}

/* ── Page Header Actions ── */
.page-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-search {
  position: relative;
  display: flex;
  align-items: center;
}

.table-search svg {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.table-search input {
  padding: 7px 12px 7px 34px;
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  width: 220px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.table-search input:focus {
  outline: none;
  border-color: var(--aws-orange);
  box-shadow: 0 0 0 2px rgba(255, 153, 0, 0.15);
}

.table-search input::placeholder {
  color: var(--text-muted);
}

/* ── Sortable Table Headers ── */
.data-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
  white-space: nowrap;
}

.data-table th.sortable:hover {
  color: var(--aws-orange);
}

.data-table th.sort-active {
  color: var(--aws-orange);
}

.data-table th .sort-arrow {
  font-size: 10px;
  margin-left: 4px;
  opacity: 0.5;
}

.data-table th.sort-active .sort-arrow {
  opacity: 1;
}

/* ── Filter Row ── */
.data-table .filter-row th {
  padding: 4px 8px 8px;
  background: rgba(255, 255, 255, 0.01);
  border-bottom: 2px solid var(--border-color-light);
}

.data-table .filter-select,
.data-table .filter-input {
  width: 100%;
  padding: 4px 6px;
  font-size: 11px;
  font-family: inherit;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--bg-input);
  color: var(--text-primary);
  transition: border-color 0.15s;
}

.data-table .filter-select:focus,
.data-table .filter-input:focus {
  outline: none;
  border-color: var(--aws-orange);
}

.data-table .filter-select {
  cursor: pointer;
  appearance: auto;
}

.data-table .filter-input::placeholder {
  color: var(--text-muted);
  font-size: 10px;
}

/* ── Drag Handle Column ── */
.data-table .col-drag {
  width: 36px;
  min-width: 36px;
  max-width: 36px;
  padding: 0 4px !important;
  text-align: center;
}

.drag-handle {
  cursor: grab;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 2px;
  border-radius: 4px;
  transition: background 0.15s, opacity 0.15s;
}

.drag-handle:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.08);
}

.drag-handle:active:not(.disabled) {
  cursor: grabbing;
}

.drag-handle.disabled {
  cursor: default;
  opacity: 0.15;
}

/* Dragging state */
.data-table tbody tr.dragging {
  opacity: 0.35;
}

.data-table tbody tr[draggable="true"] {
  transition: opacity 0.15s;
}

/* Drop indicator lines */
.data-table tbody tr.drag-over-top {
  box-shadow: inset 0 2px 0 0 var(--aws-orange);
}

.data-table tbody tr.drag-over-bottom {
  box-shadow: inset 0 -2px 0 0 var(--aws-orange);
}

/* =============================================
   Modal
   ============================================= */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px) saturate(150%);
  -webkit-backdrop-filter: blur(8px) saturate(150%);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: rgba(28, 33, 40, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 560px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: visible;
  transform: translateY(24px) scale(0.95);
  transition: transform var(--duration-slow) var(--ease-spring);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 1px rgba(255, 255, 255, 0.08);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.modal-close:hover { background: rgba(255,255,255,0.06); color: var(--text-primary); }

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
}

/* =============================================
   Forms
   ============================================= */
.form-group {
  margin-bottom: 18px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: all var(--duration-normal) var(--ease-out-expo);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: rgba(255, 153, 0, 0.5);
  box-shadow: 0 0 0 3px rgba(255, 153, 0, 0.08);
}

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

.form-group select {
  appearance: auto;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* =============================================
   Tags / Chips
   ============================================= */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: all var(--duration-fast);
}

.tag-orange { background: rgba(255,153,0,0.12); color: var(--aws-orange); }
.tag-blue { background: rgba(33,150,243,0.12); color: var(--aws-blue-light); }
.tag-green { background: rgba(29,170,107,0.12); color: var(--aws-green); }
.tag-purple { background: rgba(140,79,255,0.12); color: var(--aws-purple); }
.tag-red { background: rgba(209,50,18,0.12); color: var(--aws-red); }
.tag-teal { background: rgba(27,154,170,0.12); color: var(--aws-teal); }

/* =============================================
   Relationship Colors
   ============================================= */
.rel-champion { color: var(--aws-green); }
.rel-supporter { color: var(--aws-blue-light); }
.rel-neutral { color: var(--text-muted); }
.rel-blocker { color: var(--aws-red); }
.rel-decision-maker { color: var(--aws-orange); }

/* =============================================
   Detail Panel (Side Drawer)
   ============================================= */
.detail-panel {
  position: fixed;
  top: 0;
  right: -480px;
  width: 480px;
  height: 100vh;
  background: rgba(28, 33, 40, 0.95);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 200;
  transition: right var(--duration-slow) var(--ease-out-expo);
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 48px rgba(0, 0, 0, 0.5);
}

.detail-panel.open {
  right: 0;
}

.detail-panel .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.detail-panel .panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.detail-panel .panel-body::-webkit-scrollbar { width: 4px; }
.detail-panel .panel-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

/* =============================================
   Person Detail
   ============================================= */
.person-detail-header {
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.person-detail-header .avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
}

.person-detail-header .name { font-size: 20px; font-weight: 700; }
.person-detail-header .title { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

.detail-section {
  margin-bottom: 20px;
}

.detail-section h4 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
}

.detail-row .label {
  font-size: 13px;
  color: var(--text-secondary);
}

.detail-row .value {
  font-size: 13px;
  font-weight: 600;
}

/* =============================================
   Tabs
   ============================================= */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 20px;
}

.tab {
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--duration-fast) var(--ease-out-expo);
  user-select: none;
  position: relative;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab.active {
  color: var(--aws-orange);
  border-bottom-color: var(--aws-orange);
  background: rgba(255, 153, 0, 0.04);
}

/* =============================================
   Empty State
   ============================================= */
.empty-state {
  text-align: center;
  padding: 72px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  opacity: 0.2;
}

.empty-state h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 13px;
  max-width: 320px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

/* =============================================
   Tooltip
   ============================================= */
.tooltip {
  position: absolute;
  background: rgba(35, 47, 62, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: all var(--duration-fast) var(--ease-out-expo);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* =============================================
   Tab Content
   ============================================= */
.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* =============================================
   SVG Lines for org chart v2
   ============================================= */
.orgchart-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  will-change: transform;
  overflow: visible;
}

.oc-line {
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 1.5;
  fill: none;
}

.oc-rel-line {
  stroke-dasharray: 5 4;
  stroke-width: 1.5;
  fill: none;
  opacity: 0.45;
}

/* =============================================
   Animations
   ============================================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes slideInRight {
  from { transform: translateX(20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.animate-in {
  animation: fadeInScale 0.4s var(--ease-out-expo) both;
}

.customer-card:nth-child(1) { animation-delay: 0.03s; }
.customer-card:nth-child(2) { animation-delay: 0.06s; }
.customer-card:nth-child(3) { animation-delay: 0.09s; }
.customer-card:nth-child(4) { animation-delay: 0.12s; }
.customer-card:nth-child(5) { animation-delay: 0.15s; }
.customer-card:nth-child(6) { animation-delay: 0.18s; }
.customer-card:nth-child(7) { animation-delay: 0.21s; }
.customer-card:nth-child(8) { animation-delay: 0.24s; }

.stat-card:nth-child(1) { animation: fadeInScale 0.4s var(--ease-out-expo) 0.05s both; }
.stat-card:nth-child(2) { animation: fadeInScale 0.4s var(--ease-out-expo) 0.1s both; }
.stat-card:nth-child(3) { animation: fadeInScale 0.4s var(--ease-out-expo) 0.15s both; }
.stat-card:nth-child(4) { animation: fadeInScale 0.4s var(--ease-out-expo) 0.2s both; }

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "main";
  }
  .sidebar { display: none; }
  .customer-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .header-search { width: 200px; }
  .detail-panel { width: 100%; right: -100%; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; }
}

/* =============================================
   Reduced Motion
   ============================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
