/* Design Tokens & Theme Configuration */
:root {
  /* Dynamic fonts and scroll behavior */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  
  /* Color Palette - Defined in HSL for compatibility and flexibility */
  --hue-primary: 224; /* Sleek Deep Blue */
  --hue-accent: 174;  /* Premium Emerald/Teal */
  --hue-success: 142; /* Vibrant Green */
  --hue-warning: 38;  /* Amber Alert */
  --hue-danger: 350;  /* Scarlet Red */

  /* Light Theme Values */
  --bg-app-light: hsl(220, 25%, 97%);
  --bg-sidebar-light: hsla(224, 30%, 15%, 0.95);
  --bg-card-light: rgba(255, 255, 255, 0.65);
  --border-card-light: rgba(224, 230, 240, 0.8);
  --text-primary-light: hsl(224, 25%, 12%);
  --text-secondary-light: hsl(224, 15%, 40%);
  --text-muted-light: hsl(224, 10%, 60%);
  --accent-color-light: hsl(var(--hue-accent), 90%, 40%);
  --shadow-light: 0 8px 32px 0 rgba(31, 38, 135, 0.05);

  /* Dark Theme Values */
  --bg-app-dark: hsl(224, 25%, 6%);
  --bg-sidebar-dark: hsla(224, 25%, 4%, 0.98);
  --bg-card-dark: rgba(15, 22, 36, 0.6);
  --border-card-dark: rgba(255, 255, 255, 0.06);
  --text-primary-dark: hsl(224, 20%, 94%);
  --text-secondary-dark: hsl(224, 15%, 70%);
  --text-muted-dark: hsl(224, 10%, 50%);
  --accent-color-dark: hsl(var(--hue-accent), 85%, 60%);
  --shadow-dark: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

  /* Resolve tokens dynamically based on color-scheme */
  --bg-app: light-dark(var(--bg-app-light), var(--bg-app-dark));
  --bg-sidebar: light-dark(var(--bg-sidebar-light), var(--bg-sidebar-dark));
  --bg-card: light-dark(var(--bg-card-light), var(--bg-card-dark));
  --border-card: light-dark(var(--border-card-light), var(--border-card-dark));
  --text-primary: light-dark(var(--text-primary-light), var(--text-primary-dark));
  --text-secondary: light-dark(var(--text-secondary-light), var(--text-secondary-dark));
  --text-muted: light-dark(var(--text-muted-light), var(--text-muted-dark));
  --accent-color: light-dark(var(--accent-color-light), var(--accent-color-dark));
  --box-shadow: light-dark(var(--shadow-light), var(--shadow-dark));

  /* Common UI colors */
  --color-brand: hsl(var(--hue-primary), 85%, 55%);
  --color-success: hsl(var(--hue-success), 72%, 45%);
  --color-warning: hsl(var(--hue-warning), 90%, 48%);
  --color-danger: hsl(var(--hue-danger), 85%, 55%);
  
  color-scheme: light dark;
  accent-color: var(--accent-color);
}

/* Fallback for browsers that don't support light-dark() */
@supports not (color: light-dark(white, black)) {
  :root {
    --bg-app: var(--bg-app-light);
    --bg-sidebar: var(--bg-sidebar-light);
    --bg-card: var(--bg-card-light);
    --border-card: var(--border-card-light);
    --text-primary: var(--text-primary-light);
    --text-secondary: var(--text-secondary-light);
    --text-muted: var(--text-muted-light);
    --accent-color: var(--accent-color-light);
    --box-shadow: var(--shadow-light);
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --bg-app: var(--bg-app-dark);
      --bg-sidebar: var(--bg-sidebar-dark);
      --bg-card: var(--bg-card-dark);
      --border-card: var(--border-card-dark);
      --text-primary: var(--text-primary-dark);
      --text-secondary: var(--text-secondary-dark);
      --text-muted: var(--text-muted-dark);
      --accent-color: var(--accent-color-dark);
      --box-shadow: var(--shadow-dark);
    }
  }
}

/* Base resets & layout */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* Custom Scrollbar */
.overflow-scroll {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--text-muted) transparent;
}

/* App Container */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
  width: 280px;
  background-color: var(--bg-sidebar);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 2rem;
  letter-spacing: -0.5px;
}

.brand-icon {
  width: 28px;
  height: 28px;
  color: var(--accent-color);
  filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.4));
}

.customer-picker-container {
  margin-bottom: 2rem;
}

.picker-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.5rem;
  font-weight: 700;
}

.custom-select-wrapper {
  position: relative;
}

.customer-select {
  width: 100%;
  appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
}

.customer-select:focus, .customer-select:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: var(--accent-color);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

.customer-select option {
  background: hsl(224, 30%, 12%);
  color: #fff;
}

.select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.3s ease;
}

.customer-select:focus + .select-arrow {
  color: var(--accent-color);
}

/* Sidebar Menu navigation */
.sidebar-nav {
  flex-grow: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
  padding-right: 4px;
}
.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
}

.sidebar-nav ul {
  list-style: none;
}

.sidebar-nav li {
  margin-bottom: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-weight: 500;
  border-radius: 10px;
  transition: all 0.3s ease;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  opacity: 0.7;
  transition: transform 0.3s ease;
}

.nav-item:hover {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.05);
}

.nav-item:hover svg {
  transform: translateX(4px);
}

.nav-item.active {
  color: #fff;
  background-color: var(--color-brand);
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 86, 179, 0.3);
}

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

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.theme-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.75rem;
  color: #fff;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.theme-toggle-btn svg {
  width: 18px;
  height: 18px;
}

/* Show/hide icons depending on color scheme */
:root[content="light"] .theme-toggle-btn .sun-icon { display: block; }
:root[content="light"] .theme-toggle-btn .moon-icon { display: none; }
:root[content="dark"] .theme-toggle-btn .sun-icon { display: none; }
:root[content="dark"] .theme-toggle-btn .moon-icon { display: block; }

/* If system default */
@media (prefers-color-scheme: dark) {
  :root:not([content="light"]):not([content="dark"]) .theme-toggle-btn .sun-icon { display: none; }
  :root:not([content="light"]):not([content="dark"]) .theme-toggle-btn .moon-icon { display: block; }
}
@media (prefers-color-scheme: light) {
  :root:not([content="light"]):not([content="dark"]) .theme-toggle-btn .sun-icon { display: block; }
  :root:not([content="light"]):not([content="dark"]) .theme-toggle-btn .moon-icon { display: none; }
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-color);
  color: #0b0f19;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
}

.user-info {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.user-role {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
}

/* Main Workspace Content */
.main-content {
  flex-grow: 1;
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  height: 100vh;
  overflow-y: auto;
}

/* Top Header */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  border-bottom: 1px solid var(--border-card);
  padding-bottom: 1.5rem;
  flex-shrink: 0;
}

.main-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.8px;
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

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

.search-box {
  position: relative;
}

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

.search-box input {
  padding: 0.6rem 1rem 0.6rem 2.2rem;
  border-radius: 10px;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  width: 240px;
  transition: all 0.3s ease;
}

.search-box input:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.15);
  width: 280px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: 10px;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 0.85rem;
  border: none;
}

.btn-primary {
  background: var(--color-brand);
  color: white;
}

.btn-primary:hover {
  background: hsl(var(--hue-primary), 85%, 48%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 86, 179, 0.25);
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-card);
}

.btn-secondary:hover {
  background: var(--border-card);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.75rem;
}

/* Dashboard Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
  flex-grow: 1;
}

/* Card Styling - Glassmorphism style */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  box-shadow: var(--box-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  border-color: hsla(224, 85%, 55%, 0.15);
}

.card-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.card-body {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Grid Columns Spanning */
.card-profile { grid-column: span 4; }
.card-health { grid-column: span 8; }
.card-usage { grid-column: span 6; }
.card-timeline { grid-column: span 6; }
.card-tickets { grid-column: span 7; }
.card-tasks { grid-column: span 5; }

/* Client Details styling */
.account-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.logo-placeholder {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: var(--color-brand);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(0, 86, 179, 0.2);
}

.account-identity h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.muted {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  border-bottom: 1px dashed var(--border-card);
  padding-bottom: 0.6rem;
}

.detail-item:last-child {
  border: none;
  padding: 0;
}

.detail-label {
  color: var(--text-secondary);
}

.detail-value {
  font-weight: 600;
  color: var(--text-primary);
}

.detail-value.highlight {
  color: var(--accent-color);
}

.text-success { color: var(--color-success) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-danger { color: var(--color-danger) !important; }

/* Health Gauge & Sentiment card */
.health-summary {
  display: flex;
  align-items: center;
  gap: 2.5rem;
}

.health-gauge-container {
  position: relative;
  width: 100px;
  height: 100px;
}

.health-gauge {
  width: 100%;
  height: 100%;
}

.gauge-bg {
  fill: none;
  stroke: var(--border-card);
  stroke-width: 3.5;
}

.gauge-fill {
  fill: none;
  stroke: var(--color-success);
  stroke-width: 3.5;
  stroke-linecap: round;
  transition: stroke-dasharray 0.8s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.8s ease;
}

.gauge-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  display: flex;
  flex-direction: column;
}

.gauge-number {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1;
}

.gauge-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.sentiment-card {
  flex-grow: 1;
  background: hsla(224, 85%, 55%, 0.04);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 1rem;
}

.sentiment-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.4rem;
}

.sentiment-badge-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.sentiment-text {
  color: var(--accent-color);
}

.nps-trend {
  border-top: 1px dashed var(--border-card);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
}

.nps-label {
  color: var(--text-secondary);
}

.nps-value {
  font-weight: 700;
}

/* Sparkline Chart */
.health-history {
  margin-top: 0.5rem;
}

.section-subtitle {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
}

.chart-container {
  background: rgba(0, 0, 0, 0.03);
  border-radius: 12px;
  padding: 0.5rem;
  border: 1px solid var(--border-card);
}
:root[content="dark"] .chart-container {
  background: rgba(0, 0, 0, 0.2);
}

.trend-chart {
  width: 100%;
  height: 80px;
  overflow: visible;
}

.chart-line {
  fill: none;
  stroke: var(--color-brand);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.5s ease;
}

.chart-area {
  fill: url(#chart-gradient);
  transition: all 0.5s ease;
}

.chart-point {
  fill: var(--color-brand);
  stroke: var(--bg-card);
  stroke-width: 2;
  cursor: pointer;
  transition: r 0.2s ease, fill 0.5s ease;
}

.chart-point:hover {
  r: 6px;
}

/* Usage adoption */
.license-usage {
  margin-bottom: 0.5rem;
}

.license-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.progress-bar-container {
  height: 10px;
  background: var(--border-card);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-container.mini {
  height: 6px;
  margin-top: 0.4rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-brand), var(--accent-color));
  border-radius: 5px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.usage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.usage-metric-box {
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 0.8rem;
  text-align: center;
}
:root[content="dark"] .usage-metric-box {
  background: rgba(255, 255, 255, 0.02);
}

.usage-metric-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.2rem;
}

.usage-metric-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.feature-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
}

.feature-tag {
  background: var(--border-card);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-weight: 600;
}

/* Timeline Components */
.timeline {
  position: relative;
  padding-left: 1.5rem;
  border-left: 2px solid var(--border-card);
  margin-left: 0.5rem;
}

.timeline-item {
  position: relative;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-badge {
  position: absolute;
  left: calc(-1.5rem - 11px);
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--color-brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  z-index: 2;
  transition: all 0.3s ease;
}

.timeline-badge.badge-call { border-color: #3b82f6; }
.timeline-badge.badge-email { border-color: #10b981; }
.timeline-badge.badge-meeting { border-color: #8b5cf6; }
.timeline-badge.badge-support { border-color: #f59e0b; }
.timeline-badge.badge-system { border-color: #ef4444; }

.timeline-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.timeline-title {
  font-weight: 600;
  font-size: 0.85rem;
}

.timeline-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.timeline-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.timeline-impact {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.impact-positive { background: rgba(var(--hue-success), 72%, 45%, 0.1); color: var(--color-success); }
.impact-neutral { background: rgba(var(--hue-warning), 90%, 48%, 0.1); color: var(--color-warning); }
.impact-negative { background: rgba(var(--hue-danger), 85%, 55%, 0.1); color: var(--color-danger); }

/* Support Tickets Table */
.tickets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.tickets-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-card);
}

.tickets-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px dashed var(--border-card);
}

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

.status-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.7rem;
}

.status-open { background: rgba(239, 68, 68, 0.1); color: #ef4444; }
.status-progress { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.status-resolved { background: rgba(16, 119, 81, 0.1); color: #10b981; }

.priority-badge {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.65rem;
}

.priority-high { color: var(--color-danger); }
.priority-medium { color: var(--color-warning); }
.priority-low { color: var(--text-secondary); }

/* Tasks Checklist */
.tasks-summary {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  border-bottom: 1px dashed var(--border-card);
  padding-bottom: 0.8rem;
}

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.01);
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border-card);
  font-size: 0.8rem;
  transition: all 0.25s ease;
}

.task-item:hover {
  background: rgba(0, 0, 0, 0.03);
}
:root[content="dark"] .task-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.task-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  cursor: pointer;
  border-radius: 4px;
}

.task-item-content {
  flex-grow: 1;
}

.task-desc {
  font-weight: 500;
  display: block;
}

.task-item.completed .task-desc {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Modals / Dialog Styling - Glassmorphism top layer */
.glass-modal {
  border: none;
  background: transparent;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  margin: auto;
  outline: none;
  overflow: hidden;
}

/* Backdrops */
.glass-modal::backdrop {
  background-color: rgba(0, 0, 0, 0);
  backdrop-filter: blur(0px);
  transition: 
    display 0.3s allow-discrete,
    overlay 0.3s allow-discrete,
    background-color 0.3s ease-out,
    backdrop-filter 0.3s ease-out;
}

.glass-modal[open]::backdrop {
  background-color: rgba(11, 15, 25, 0.55);
  backdrop-filter: blur(8px);

  @starting-style {
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0px);
  }
}

.modal-content {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  padding: 2rem;
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

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

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.close-modal-btn {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1;
}

.close-modal-btn:hover {
  color: var(--text-primary);
}

/* Form Styles */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

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

label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
}

input[type="text"],
input[type="date"],
select,
textarea {
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border-card);
  background: rgba(0, 0, 0, 0.02);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.3s ease;
}
:root[content="dark"] input[type="text"],
:root[content="dark"] input[type="date"],
:root[content="dark"] select,
:root[content="dark"] textarea {
  background: rgba(255, 255, 255, 0.03);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.15);
  background: var(--bg-card);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  border-top: 1px solid var(--border-card);
  padding-top: 1.25rem;
  margin-top: 0.5rem;
}

/* Animations for Modal entry/exit using starting style */
.glass-modal {
  opacity: 0;
  transform: scale(0.9) translateY(20px);
  transition-property: opacity, transform, display, overlay;
  transition-duration: 0.3s;
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1);
  transition-behavior: allow-discrete;
}

.glass-modal[open] {
  opacity: 1;
  transform: scale(1) translateY(0);

  @starting-style {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
}

/* Handle motion preferences */
@media (prefers-reduced-motion: reduce) {
  .glass-modal, .glass-modal[open], .glass-modal::backdrop, .glass-modal[open]::backdrop {
    transform: none;
    transition-duration: 0.1s;
  }
  @starting-style {
    .glass-modal[open] {
      transform: none;
    }
  }
}

/* Responsive Scaling */
@media (max-width: 1200px) {
  .card-profile { grid-column: span 5; }
  .card-health { grid-column: span 7; }
  .card-usage { grid-column: span 12; }
  .card-timeline { grid-column: span 12; }
  .card-tickets { grid-column: span 12; }
  .card-tasks { grid-column: span 12; }
}

@media (max-width: 850px) {
  .app-container {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  }
  .main-content {
    padding: 1.5rem;
    height: auto;
  }
  .card-profile { grid-column: span 12; }
  .card-health { grid-column: span 12; }
  .search-box input {
    width: 160px;
  }
  .search-box input:focus {
    width: 200px;
  }
}

/* Account Credits & Activity Section Styles */
.expiry-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  background: hsla(var(--hue-primary), 85%, 55%, 0.1);
  color: var(--color-brand);
  border: 1px solid hsla(var(--hue-primary), 85%, 55%, 0.25);
  letter-spacing: 0.2px;
}

.customer-select.mini {
  padding: 0.4rem 1.8rem 0.4rem 0.75rem !important;
  font-size: 0.8rem !important;
  border-radius: 8px !important;
  background: var(--bg-card) !important;
  border: 1px solid var(--border-card) !important;
  color: var(--text-primary) !important;
  font-weight: 600 !important;
  height: auto !important;
}

.customer-select.mini option {
  background: var(--bg-app) !important;
  color: var(--text-primary) !important;
}

/* Focus CSM dropdown sits on the (theme-aware) admin panel, not the always-dark sidebar,
   so it must follow the theme instead of the hardcoded white-on-dark .customer-select styling. */
#admin-csm-filter {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
}
#admin-csm-filter:hover, #admin-csm-filter:focus {
  background: var(--bg-card);
  border-color: var(--color-brand);
  box-shadow: 0 0 0 2px hsla(224, 85%, 55%, 0.18);
}
#admin-csm-filter option {
  background: var(--bg-card);
  color: var(--text-primary);
}
.admin-filter-bar .select-arrow {
  color: var(--text-muted);
}

.csm-risk-alert-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.csm-alert {
  display: flex;
  gap: 0.85rem;
  padding: 0.95rem 1.25rem;
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.45;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-width: 1px;
  border-style: solid;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.03);
  animation: alertFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.csm-alert.alert-danger {
  background: hsla(var(--hue-danger), 85%, 55%, 0.08);
  border-color: hsla(var(--hue-danger), 85%, 55%, 0.2);
  color: hsl(var(--hue-danger), 85%, 55%);
}

.csm-alert.alert-danger .alert-title {
  color: hsl(var(--hue-danger), 85%, 45%);
}

:root[content="dark"] .csm-alert.alert-danger .alert-title {
  color: hsl(var(--hue-danger), 85%, 70%);
}

.csm-alert.alert-warning {
  background: hsla(var(--hue-warning), 90%, 48%, 0.08);
  border-color: hsla(var(--hue-warning), 90%, 48%, 0.2);
  color: hsl(var(--hue-warning), 90%, 45%);
}

.csm-alert.alert-warning .alert-title {
  color: hsl(var(--hue-warning), 90%, 35%);
}

:root[content="dark"] .csm-alert.alert-warning .alert-title {
  color: hsl(var(--hue-warning), 90%, 65%);
}

.csm-alert.alert-success {
  background: hsla(var(--hue-success), 72%, 45%, 0.08);
  border-color: hsla(var(--hue-success), 72%, 45%, 0.2);
  color: hsl(var(--hue-success), 72%, 35%);
}

.csm-alert.alert-success .alert-title {
  color: hsl(var(--hue-success), 72%, 28%);
}

:root[content="dark"] .csm-alert.alert-success .alert-title {
  color: hsl(var(--hue-success), 72%, 60%);
}

.csm-alert .alert-icon {
  font-size: 1.15rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.csm-alert .alert-content {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.csm-alert .alert-title {
  font-weight: 700;
  font-size: 0.9rem;
}

.csm-alert .alert-desc {
  color: var(--text-secondary);
}

.csm-alert .alert-desc strong {
  color: var(--text-primary);
}

.credits-chart-wrapper {
  background: rgba(0, 0, 0, 0.015);
  border-radius: 16px;
  border: 1px solid var(--border-card);
  padding: 1.25rem;
}

:root[content="dark"] .credits-chart-wrapper {
  background: rgba(255, 255, 255, 0.01);
}

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

/* ===== Users on Account: clickable value + roster modal ===== */
.users-link {
  cursor: pointer;
  color: var(--color-brand);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
  transition: opacity 0.15s ease;
}
.users-link:hover { opacity: 0.78; text-decoration: underline; }
.users-link:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.users-link-chevron { font-size: 0.85rem; opacity: 0.7; }

.users-summary {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-card);
  flex-shrink: 0;
}
.users-summary-total { font-size: 0.9rem; color: var(--text-secondary); }
.users-summary-total strong { color: var(--text-primary); font-size: 1.05rem; }
.users-summary-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.role-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.role-chip.role-super  { color: hsl(260, 85%, 62%); background: hsla(260, 85%, 60%, 0.14); }
.role-chip.role-admin  { color: var(--color-brand); background: color-mix(in srgb, var(--color-brand) 14%, transparent); }
.role-chip.role-other  { color: var(--text-secondary); background: color-mix(in srgb, var(--text-secondary) 12%, transparent); }

.users-list {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1 1 auto;
  min-height: 0;          /* allow the flex child to shrink so it can scroll */
  overflow-y: auto;
  margin: 0 -0.5rem;
  padding: 0 0.5rem;
}
/* Slim scrollbar for the roster */
.users-list::-webkit-scrollbar { width: 8px; }
.users-list::-webkit-scrollbar-thumb { background: var(--border-card); border-radius: 8px; }
.user-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0.5rem;
  border-radius: 10px;
  transition: background 0.15s ease;
}
.user-row:hover { background: color-mix(in srgb, var(--color-brand) 6%, transparent); }
.user-row:not(:last-child) { border-bottom: 1px solid var(--border-card); }

.user-avatar {
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.78rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, hsl(220, 70%, 55%), hsl(250, 70%, 55%));
}
.user-avatar.is-super { background: linear-gradient(135deg, hsl(260, 85%, 60%), hsl(290, 80%, 52%)); }

.user-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.user-name { font-weight: 700; color: var(--text-primary); font-size: 0.9rem; }
.user-email { font-size: 0.75rem; color: var(--text-muted); word-break: break-all; }

.user-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.user-lastlogin { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }

/* Roster / drill-down modals: wider, height-capped, internally scrolling */
#users-dialog, #signal-dialog { max-width: 600px; }
#users-dialog .modal-content,
#signal-dialog .modal-content {
  min-width: 0;
  max-height: 85vh;
  gap: 1rem;
  padding: 1.75rem;
}
#users-dialog .modal-header,
#users-dialog .modal-footer,
#signal-dialog .modal-header,
#signal-dialog .modal-footer {
  flex-shrink: 0;
  margin: 0;
}
#users-dialog .modal-header h3,
#signal-dialog .modal-header h3 {
  font-size: 1.05rem;
  line-height: 1.35;
  padding-right: 0.5rem;
}
#users-dialog .close-modal-btn,
#signal-dialog .close-modal-btn { align-self: flex-start; }

/* Clickable health-signal tiles */
.signal-tile[role="button"] { cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.signal-tile[role="button"]:hover { transform: translateY(-2px); box-shadow: var(--box-shadow); border-color: var(--signal-accent, var(--color-brand)); }
.signal-tile[role="button"]:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }

/* Activity status chips (reuse role-chip base) */
.role-chip.stat-active   { color: var(--color-success); background: color-mix(in srgb, var(--color-success) 14%, transparent); }
.role-chip.stat-inactive { color: var(--color-warning); background: color-mix(in srgb, var(--color-warning) 14%, transparent); }
.role-chip.stat-never    { color: var(--color-danger);  background: color-mix(in srgb, var(--color-danger) 14%, transparent); }

/* Score-by-month rows in the Avg Candidate Score drill-down */
.score-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.55rem 0.5rem; }
.score-row:not(:last-child) { border-bottom: 1px solid var(--border-card); }
.score-row-label { width: 64px; flex-shrink: 0; font-weight: 700; font-size: 0.82rem; color: var(--text-primary); }
.score-bar-track { flex: 1; height: 8px; border-radius: 6px; background: color-mix(in srgb, var(--text-secondary) 12%, transparent); overflow: hidden; }
.score-bar-fill { display: block; height: 100%; border-radius: 6px; }
.score-row-val { width: 138px; flex-shrink: 0; text-align: right; font-size: 0.78rem; color: var(--text-secondary); }

/* ===== Key Health Signals grid ===== */
.health-signals { margin-top: 1.5rem; }
.signal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-top: 0.85rem;
}
.signal-tile {
  background: color-mix(in srgb, var(--text-secondary) 4%, transparent);
  border: 1px solid var(--border-card);
  border-left: 3px solid var(--signal-accent, var(--border-card));
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.signal-label {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--text-muted);
}
.signal-value {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text-primary);
}
.signal-sub {
  font-size: 0.72rem;
  color: var(--text-secondary);
}
@media (max-width: 520px) {
  .signal-grid { grid-template-columns: 1fr; }
}

/* ===== Account Intelligence card ===== */
.card-intelligence { grid-column: span 12; }
.card-intelligence .card-header {
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}
.intel-caption {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}
.intel-grid {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 0;
}
@media (max-width: 900px) {
  .intel-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .intel-grid { grid-template-columns: 1fr; }
}
/* Mini stacked funnel used in the completion drill-down */
.funnel-stage {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.6rem;
}
.funnel-stage-label {
  width: 92px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.funnel-stage-track {
  flex: 1;
  height: 26px;
  background: color-mix(in srgb, var(--text-secondary) 8%, transparent);
  border-radius: 7px;
  overflow: hidden;
}
.funnel-stage-fill {
  height: 100%;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
  min-width: 34px;
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}
.funnel-rate {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  width: 62px;
  text-align: right;
  flex-shrink: 0;
}

/* ===== Engagement & Outcomes trend (replaces fake health sparkline) ===== */
.trend-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.engagement-delta { font-size: 0.75rem; font-weight: 700; white-space: nowrap; }
.engagement-chart-wrapper {
  position: relative;
  width: 100%;
  height: 200px;
  border-radius: 12px;
  transition: background 0.15s ease;
}
.engagement-chart-wrapper[role="button"] { cursor: pointer; }
.engagement-chart-wrapper[role="button"]:hover { background: color-mix(in srgb, var(--color-brand) 5%, transparent); }
.engagement-chart-wrapper[role="button"]:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.engagement-legend {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  margin-top: 0.5rem;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  color: var(--text-secondary);
  font-weight: 600;
}
.legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Highlight state for clicked graph point month */
.score-row.highlighted {
  border: 1.5px solid var(--color-brand) !important;
  background: color-mix(in srgb, var(--color-brand) 8%, transparent);
  border-radius: 8px;
  padding: 6px 12px;
  margin: 4px 0;
  animation: pulse-highlight 2s ease-in-out infinite;
}

@keyframes pulse-highlight {
  0%, 100% {
    box-shadow: 0 0 4px rgba(0, 86, 179, 0.2);
    border-color: var(--color-brand);
  }
  50% {
    box-shadow: 0 0 10px rgba(0, 86, 179, 0.45);
    border-color: var(--accent-color);
  }
}


/* ===================== ADMIN PORTAL ===================== */
.nav-divider {
  list-style: none;
  margin: 0.85rem 0 0.35rem;
  padding: 0 1.1rem;
}
.nav-divider span {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--text-muted);
  opacity: 0.65;
}
.nav-item-admin svg { color: var(--color-warning); }
.nav-item-admin.active svg { color: #fff; }

.admin-portal {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: admin-fade 0.4s ease;
}
@keyframes admin-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.admin-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 1100px) { .admin-two-col { grid-template-columns: 1fr; } }

.admin-card { margin: 0; }
.admin-hint { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }
.admin-pill {
  font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: hsla(var(--hue-danger), 85%, 55%, 0.15); color: var(--color-danger);
}

/* KPI strip */
.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
@media (max-width: 1100px) { .admin-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .admin-kpi-grid { grid-template-columns: 1fr; } }

.admin-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 14px;
  padding: 1.05rem 1.15rem;
  box-shadow: var(--box-shadow);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  position: relative;
  overflow: hidden;
}
.admin-kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--kpi-accent, var(--color-brand));
}
.admin-kpi-label {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text-muted);
}
.admin-kpi-value { font-size: 1.7rem; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.admin-kpi-sub { font-size: 0.74rem; color: var(--text-secondary); font-weight: 500; }

/* Risk radar segments */
.risk-seg {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.7rem 0.8rem; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; transition: background 0.15s, border-color 0.15s;
}
.risk-seg:hover { background: hsla(224, 30%, 50%, 0.08); border-color: var(--border-card); }
.risk-seg-dot { width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0; }
.risk-seg-name { font-weight: 600; font-size: 0.88rem; color: var(--text-primary); flex: 1; }
.risk-seg-desc { font-size: 0.72rem; color: var(--text-muted); }
.risk-seg-count { font-size: 1.25rem; font-weight: 800; color: var(--text-primary); }
.risk-seg-arrow { color: var(--text-muted); font-size: 1.1rem; }

/* CSM leaderboard table */
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.84rem; }
.admin-table th {
  text-align: left; padding: 0.6rem 0.7rem; font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.4px; text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border-card); white-space: nowrap;
}
.admin-table th.num, .admin-table td.num { text-align: right; }
.admin-table td {
  padding: 0.7rem 0.7rem; border-bottom: 1px solid var(--border-card);
  color: var(--text-secondary); white-space: nowrap;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr.clickable-row { cursor: pointer; transition: background 0.12s; }
.admin-table tr.clickable-row:hover { background: hsla(224, 30%, 50%, 0.07); }
.admin-table .csm-name { font-weight: 700; color: var(--text-primary); }
.admin-table .acct-name { font-weight: 600; color: var(--text-primary); }

.mini-bar-track {
  display: inline-block; width: 70px; height: 6px; border-radius: 3px;
  background: hsla(224, 30%, 50%, 0.18); vertical-align: middle; overflow: hidden;
}
.mini-bar-fill { display: block; height: 100%; border-radius: 3px; }

.health-chip {
  display: inline-block; min-width: 34px; text-align: center; padding: 2px 8px;
  border-radius: 999px; font-weight: 700; font-size: 0.76rem;
}
.health-good { background: hsla(var(--hue-success), 72%, 45%, 0.16); color: var(--color-success); }
.health-warn { background: hsla(var(--hue-warning), 90%, 48%, 0.16); color: var(--color-warning); }
.health-bad  { background: hsla(var(--hue-danger), 85%, 55%, 0.16); color: var(--color-danger); }

/* Account list rows (renewals / top accounts) */
.admin-acct-row {
  display: flex; align-items: center; gap: 0.85rem; padding: 0.65rem 0.4rem;
  border-bottom: 1px solid var(--border-card); cursor: pointer; transition: background 0.12s;
}
.admin-acct-row:last-child { border-bottom: none; }
.admin-acct-row:hover { background: hsla(224, 30%, 50%, 0.07); }
.admin-acct-avatar {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.74rem; color: #fff;
  background: linear-gradient(135deg, var(--color-brand), var(--accent-color));
}
.admin-acct-main { flex: 1; min-width: 0; }
.admin-acct-name { font-weight: 600; font-size: 0.86rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-acct-email {
  font-size: 0.72rem; font-weight: 500; color: var(--accent-color);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 1px 0;
}
.admin-acct-meta { font-size: 0.72rem; color: var(--text-muted); }
.admin-acct-right { text-align: right; flex-shrink: 0; }
.admin-acct-metric { font-weight: 800; font-size: 0.92rem; color: var(--text-primary); }
.admin-acct-tag { font-size: 0.7rem; font-weight: 600; }
.tag-danger { color: var(--color-danger); }
.tag-warn { color: var(--color-warning); }
.tag-muted { color: var(--text-muted); }

.admin-footnote { font-size: 0.72rem; color: var(--text-muted); text-align: center; padding: 0.25rem 0 0.5rem; }
.admin-empty { color: var(--text-muted); font-size: 0.84rem; text-align: center; padding: 1.5rem; }

/* ── Ticket Sentiment Analysis ───────────────────────────────── */
.sentiment-layout, .sentiment-admin-layout {
  display: flex; gap: 1.75rem; align-items: center; flex-wrap: wrap;
}
.sentiment-admin-layout { align-items: stretch; }
.sentiment-col-chart {
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
  flex: 0 0 240px; min-width: 220px;
}
.sentiment-col-critical { flex: 1; min-width: 260px; }
.sentiment-donut-wrap { flex: 0 0 150px; width: 150px; }
.sentiment-donut { width: 100%; height: auto; display: block; }
.sentiment-detail { flex: 1; min-width: 240px; }
.sentiment-legend { display: flex; flex-direction: column; gap: 0.5rem; width: 100%; }
.sentiment-col-chart .sentiment-legend { max-width: 240px; }
.sentiment-legend-row { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; }
.sentiment-legend-name {
  display: inline-flex; align-items: center; gap: 0.4rem; min-width: 108px;
  font-weight: 600; color: var(--text-secondary);
}
.sentiment-legend-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.sentiment-legend-bar {
  flex: 1; height: 7px; border-radius: 99px; overflow: hidden;
  background: hsla(224, 30%, 50%, 0.14);
}
.sentiment-legend-bar > span { display: block; height: 100%; border-radius: 99px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }
.sentiment-legend-count { font-weight: 700; font-size: 0.8rem; color: var(--text-primary); min-width: 56px; text-align: right; }
.sentiment-legend-count small { font-weight: 500; color: var(--text-muted); margin-left: 2px; }
.sentiment-insight {
  margin-top: 1rem; font-size: 0.86rem; color: var(--text-secondary); line-height: 1.5;
  padding: 0.75rem 1rem; border-radius: 10px; background: hsla(224, 30%, 50%, 0.06);
  border-left: 3px solid var(--color-brand);
}
.tsent-critical-list { display: flex; flex-direction: column; gap: 0.4rem; }
.tsent-critical-row {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.6rem; border-radius: 9px;
  text-decoration: none; color: inherit; transition: background 0.12s; border: 1px solid transparent;
  cursor: pointer;
}
.tsent-critical-row:hover { background: hsla(224, 30%, 50%, 0.08); border-color: var(--border-card); }
.tsent-critical-row:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.tsent-critical-score {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px; color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.78rem;
}
.tsent-critical-main { display: flex; flex-direction: column; min-width: 0; }
.tsent-critical-title { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tsent-critical-meta { font-size: 0.72rem; color: var(--text-muted); }
@media (max-width: 720px) {
  .sentiment-layout, .sentiment-admin-layout { flex-direction: column; align-items: stretch; }
  .sentiment-col-chart { flex-basis: auto; }
}

/* ── Expansion Opportunities card ─────────────────────────────── */
.expansion-card {
  border: 1px solid hsla(145, 65%, 45%, 0.35);
  background:
    linear-gradient(180deg, hsla(145, 65%, 45%, 0.06), transparent 120px),
    var(--bg-card);
}
.expansion-pill {
  background: hsla(145, 65%, 42%, 0.15) !important;
  color: hsl(145, 65%, 42%) !important;
  border: 1px solid hsla(145, 65%, 42%, 0.3);
  font-weight: 700;
}
.expansion-rank {
  background: linear-gradient(135deg, hsl(145,65%,42%), hsl(160,70%,38%)) !important;
}
.expansion-bar-wrap { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; max-width: 280px; }
.expansion-bar-track {
  flex: 1; height: 7px; border-radius: 99px; overflow: hidden;
  background: hsla(224, 30%, 50%, 0.15);
}
.expansion-bar-fill { display: block; height: 100%; border-radius: 99px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }
.expansion-bar-label { font-size: 0.74rem; font-weight: 800; min-width: 34px; }
.expansion-metrics { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.expansion-signal { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.expansion-signal small { font-weight: 500; color: var(--text-muted); }
.expansion-signal.muted { font-size: 0.7rem; font-weight: 500; color: var(--text-muted); }
.expansion-tag {
  background: hsla(145, 65%, 42%, 0.15); color: hsl(145, 65%, 40%);
  padding: 2px 8px; border-radius: 99px; font-weight: 700;
}
[data-theme="dark"] .expansion-tag { color: hsl(145, 65%, 55%); }
@media (max-width: 640px) {
  .expansion-metrics { align-items: flex-start; margin-top: 0.4rem; }
  .expansion-row { flex-wrap: wrap; }
}

/* Admin KPI clickable affordance + trend column hover */
.admin-kpi { cursor: pointer; transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s; }
.admin-kpi:hover { transform: translateY(-2px); border-color: var(--kpi-accent, var(--color-brand)); box-shadow: 0 10px 28px rgba(0,0,0,0.18); }
.admin-kpi:focus-visible { outline: 2px solid var(--color-brand); outline-offset: 2px; }
.admin-kpi-arrow {
  position: absolute; top: 0.9rem; right: 1rem; font-size: 1.05rem; font-weight: 700;
  color: var(--text-muted); opacity: 0; transition: opacity 0.12s, transform 0.12s;
}
.admin-kpi:hover .admin-kpi-arrow { opacity: 0.85; transform: translateX(2px); }
.admin-trend-col { transition: fill 0.1s; }
.admin-trend-col:hover { fill: hsla(224, 40%, 60%, 0.08); }

/* Clickable support-ticket rows */
.tickets-table tbody tr[role="button"] { transition: background 0.12s; }
.tickets-table tbody tr[role="button"]:hover { background: hsla(224, 30%, 50%, 0.07); }
.tickets-table tbody tr[role="button"]:focus-visible { outline: 2px solid var(--color-brand); outline-offset: -2px; }

/* Tickets pager */
.tickets-pager { margin-top: 0.75rem; }
.tickets-pager-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.65rem 0.25rem 0; border-top: 1px solid var(--border-card); flex-wrap: wrap;
}
.tickets-pager-left { display: flex; flex-direction: column; gap: 2px; }
.tickets-pager-range { font-size: 0.78rem; font-weight: 700; color: var(--text-primary); }
.tickets-pager-meta { font-size: 0.72rem; color: var(--text-muted); }
.tickets-pager-right { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pager-btn {
  min-width: 30px; height: 30px; padding: 0 9px; border-radius: 7px;
  border: 1px solid var(--border-card); background: transparent; color: var(--text-secondary);
  font-family: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.pager-btn:hover:not([disabled]) { border-color: var(--accent-color); color: var(--text-primary); background: hsla(224, 30%, 50%, 0.06); }
.pager-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.pager-btn.is-current { background: var(--color-brand); color: #fff; border-color: var(--color-brand); }
.pager-btn.pager-arrow { font-size: 0.95rem; line-height: 1; }
.pager-ellipsis { color: var(--text-muted); padding: 0 2px; font-weight: 700; user-select: none; }
.tickets-pager-summary {
  font-size: 0.72rem; color: var(--text-muted); text-align: right;
  padding: 0.45rem 0.25rem 0;
}

/* Trending keywords strip */
.tickets-trending-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-height: 26px;
}
.trending-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, hsla(38, 90%, 48%, 0.12), hsla(350, 85%, 55%, 0.10));
  border: 1px solid hsla(38, 90%, 48%, 0.3);
  color: hsl(38, 80%, 38%);
  white-space: nowrap;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}
.trending-chip:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}
.trending-chip:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}
@media (prefers-color-scheme: dark) {
  .trending-chip { color: hsl(38, 90%, 62%); }
}
.trending-chip-label { text-transform: capitalize; }
.trending-chip-sep { opacity: 0.4; margin: 0 1px; }
.trending-chip-vel {
  font-size: 0.68rem;
  font-weight: 700;
  color: hsl(142, 60%, 40%);
}
.trending-chip-open {
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.65;
  margin-left: 4px;
}

/* ── User Activity Card ─────────────────────────────────────────────────── */
.ua-search-input {
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-card);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.82rem;
  width: 200px;
  outline: none;
  transition: border-color 0.2s;
}
.ua-search-input:focus { border-color: var(--accent-color); }

.ua-tier-summary {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.ua-tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: default;
}
.ua-tier-badge.power   { background: hsla(270,80%,55%,0.12); color: hsl(270,70%,55%); border: 1px solid hsla(270,70%,55%,0.3); }
.ua-tier-badge.active  { background: hsla(142,72%,45%,0.12); color: hsl(142,60%,38%); border: 1px solid hsla(142,60%,38%,0.3); }
.ua-tier-badge.casual  { background: hsla(224,85%,55%,0.10); color: hsl(224,70%,55%); border: 1px solid hsla(224,60%,55%,0.25); }
.ua-tier-badge.dormant { background: hsla(38,90%,48%,0.12);  color: hsl(38,80%,40%);  border: 1px solid hsla(38,80%,40%,0.3); }
.ua-tier-badge.ghost   { background: hsla(350,85%,55%,0.10); color: hsl(350,70%,50%); border: 1px solid hsla(350,70%,50%,0.25); }

.ua-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.ua-table thead th {
  padding: 0.55rem 0.75rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-card);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.ua-table thead th:hover { color: var(--text-primary); }
.ua-table thead th.sorted-asc::after  { content: " ↑"; opacity: 0.7; }
.ua-table thead th.sorted-desc::after { content: " ↓"; opacity: 0.7; }
.ua-table thead th.num { text-align: right; }
.ua-table tbody tr {
  border-bottom: 1px solid var(--border-card);
  transition: background 0.15s;
}
.ua-table tbody tr:last-child { border-bottom: none; }
.ua-table tbody tr:hover { background: hsla(224,30%,50%,0.05); }
.ua-table tbody td { padding: 0.55rem 0.75rem; vertical-align: middle; }
.ua-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ua-user-name { font-weight: 600; color: var(--text-primary); font-size: 0.82rem; }
.ua-user-email { font-size: 0.72rem; color: var(--text-muted); margin-top: 1px; }
.ua-admin-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: hsla(224,85%,55%,0.12);
  color: hsl(224,70%,55%);
  border: 1px solid hsla(224,60%,55%,0.25);
  vertical-align: middle;
  margin-left: 4px;
}
.ua-inactive-row td { opacity: 0.45; }
.ua-num-zero { color: var(--text-muted); }

/* Searchable customer combobox */
.customer-combo { position: relative; }
.customer-combo-hidden-select { display: none !important; }
.customer-combo-trigger {
  width: 100%; appearance: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff; padding: 0.75rem 2.4rem 0.75rem 1rem; border-radius: 12px;
  font-family: var(--font-sans); font-weight: 600; font-size: 0.9rem; text-align: left;
  cursor: pointer; transition: all 0.25s ease; outline: none; position: relative;
  display: flex; align-items: center; gap: 0.5rem;
}
.customer-combo-trigger:hover, .customer-combo-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.15); border-color: var(--accent-color);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}
.customer-combo-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer-combo-trigger .select-arrow {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; pointer-events: none; color: rgba(255, 255, 255, 0.6); transition: transform 0.2s ease;
}
.customer-combo-trigger[aria-expanded="true"] .select-arrow { transform: translateY(-50%) rotate(180deg); color: var(--accent-color); }

.customer-combo-popup {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
  background: hsl(224, 30%, 10%); border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45); padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
  animation: comboFadeIn 0.14s ease;
}
@keyframes comboFadeIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }

.customer-combo-search {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; background: rgba(255,255,255,0.06); border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
}
.customer-combo-search svg { width: 14px; height: 14px; color: rgba(255,255,255,0.55); flex-shrink: 0; }
.customer-combo-search input {
  flex: 1; background: transparent; border: 0; outline: 0; color: #fff;
  font: inherit; font-size: 0.85rem; padding: 4px 0;
}
.customer-combo-search input::placeholder { color: rgba(255,255,255,0.4); }

.customer-combo-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 320px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.25) transparent;
}
.customer-combo-list::-webkit-scrollbar { width: 8px; }
.customer-combo-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 4px; }

.customer-combo-item {
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 10px; border-radius: 7px; cursor: pointer;
  color: rgba(255,255,255,0.85); transition: background 0.1s;
}
.customer-combo-item:hover, .customer-combo-item.is-active {
  background: rgba(0, 229, 255, 0.12);
  color: #fff;
}
.customer-combo-item.is-selected {
  background: rgba(34, 102, 255, 0.22);
  color: #fff;
}
.customer-combo-item.is-selected.is-active { background: rgba(34, 102, 255, 0.35); }
.customer-combo-item-name {
  font-size: 0.85rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.customer-combo-item-meta {
  font-size: 0.7rem; color: rgba(255,255,255,0.5); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.customer-combo-item-meta mark { background: rgba(0,229,255,0.35); color: #fff; border-radius: 2px; padding: 0 1px; }
.customer-combo-item-name mark { background: rgba(0,229,255,0.35); color: #fff; border-radius: 2px; padding: 0 1px; }

.customer-combo-empty {
  padding: 14px; text-align: center; color: rgba(255,255,255,0.5); font-size: 0.82rem;
}
.customer-combo-footer {
  padding: 4px 10px 2px; font-size: 0.68rem; color: rgba(255,255,255,0.4);
  border-top: 1px solid rgba(255,255,255,0.06); margin-top: 2px; font-weight: 600; letter-spacing: 0.4px;
}

/* ===================== Live Sync Badge ===================== */
.live-sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.85rem;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(16, 185, 129, 0.08));
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: var(--color-success);
  cursor: default;
  user-select: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.live-sync-badge:hover {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.14));
  border-color: rgba(34, 197, 94, 0.5);
  box-shadow: 0 0 16px rgba(34, 197, 94, 0.15);
}

.live-sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
  animation: live-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes live-pulse {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.9), 0 0 28px rgba(34, 197, 94, 0.3);
    transform: scale(1.3);
  }
}

/* ===================== Admin Loading Overlay ===================== */
/* ── Page-level account-switch overlay ──────────────────────── */
.page-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--bg-main-rgb, 10, 15, 30), 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: page-overlay-in 0.15s ease;
}

.page-loading-overlay[hidden] {
  display: none;
}

@keyframes page-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.page-loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  padding: 2.5rem 3rem;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
  text-align: center;
  min-width: 240px;
}

.page-loading-spinner {
  width: 40px !important;
  height: 40px !important;
  border-width: 4px !important;
}

.page-loading-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.page-loading-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.admin-loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3.5rem 1rem;
  border-radius: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--box-shadow);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.admin-loading-overlay.hidden {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.admin-loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}

.admin-loading-spinner {
  font-size: 2.5rem;
  animation: spin-hourglass 1.8s ease-in-out infinite;
  display: inline-block;
}

@keyframes spin-hourglass {
  0% { transform: rotate(0deg); }
  50% { transform: rotate(180deg); }
  100% { transform: rotate(360deg); }
}

.admin-loading-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.2px;
}

/* Sidebar Search Box Styles */
.sidebar-search-box {
  width: 100%;
}

.sidebar-search-box input[type="search"] {
  width: 100% !important;
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
  padding: 0.6rem 1rem 0.6rem 2.2rem !important;
  border-radius: 12px !important;
  font-size: 0.85rem !important;
  outline: none !important;
  transition: all 0.3s ease !important;
}

.sidebar-search-box input[type="search"]::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.sidebar-search-box input[type="search"]:focus {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: var(--accent-color) !important;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.25) !important;
  width: 100% !important;
}

.sidebar-search-box .search-icon {
  color: rgba(255, 255, 255, 0.45) !important;
}

/* Signout Button Hover Effect */
.signout-btn:hover {
  color: var(--color-danger) !important;
  background: rgba(239, 68, 68, 0.1) !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

/* ===================== Notification Bell & Dropdown ===================== */
.notification-wrapper {
  position: relative;
  display: inline-block;
  z-index: 100;
}

.notification-bell-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.notification-bell-btn:hover {
  background: var(--border-card);
  transform: translateY(-1px);
  border-color: hsla(224, 85%, 55%, 0.25);
  box-shadow: 0 0 12px hsla(224, 85%, 55%, 0.15);
}

.notification-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--color-danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-app);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
  animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { transform: scale(1.05); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.notification-popup {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 20px;
  box-shadow: var(--box-shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 480px;
  transition: opacity 0.3s ease, transform 0.3s ease;
  animation: popup-slide-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popup-slide-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.notification-popup[hidden] {
  display: none !important;
}

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

.notification-header h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
}

.notification-list {
  flex-grow: 1;
  max-height: 350px;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.notification-item {
  padding: 0.9rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-card);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: all 0.2s ease;
}
:root[content="light"] .notification-item {
  background: rgba(0, 0, 0, 0.01);
}

.notification-item:hover {
  background: rgba(255, 255, 255, 0.04);
}
:root[content="light"] .notification-item:hover {
  background: rgba(0, 0, 0, 0.03);
}

/* Severity styling indicators */
.notification-item.severity-high {
  border-left: 4px solid var(--color-danger);
}

.notification-item.severity-warning {
  border-left: 4px solid var(--color-warning);
}

.notification-item-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notification-item-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.notification-item-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

.notification-item-dismiss-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notification-item-dismiss-btn:hover {
  color: var(--color-danger);
  background: rgba(239, 68, 68, 0.1);
}

.notification-empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.notification-footer {
  padding: 0.75rem 1.25rem;
  background: rgba(0, 0, 0, 0.1);
  border-top: 1px solid var(--border-card);
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.4px;
}

/* ===================== Live News Feed Styles ===================== */
.news-feed-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.news-item {
  display: flex;
  gap: 1rem;
  background: rgba(0, 0, 0, 0.02);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  /* Keep natural height — in the flex-column scroll container, default flex-shrink
     would crush each item and clip the meta badges + summary. */
  flex-shrink: 0;
}

[data-theme="dark"] .news-item {
  background: rgba(255, 255, 255, 0.015);
}

.news-item:hover {
  transform: translateY(-2px);
  border-color: var(--color-brand);
  background: rgba(0, 0, 0, 0.04);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.08);
  text-decoration: none;
  color: inherit;
}

[data-theme="dark"] .news-item:hover {
  background: rgba(255, 255, 255, 0.035);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.news-icon-wrapper {
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--border-card);
  flex-shrink: 0;
  transition: all 0.3s;
}

.news-item:hover .news-icon-wrapper {
  background: var(--color-brand-light);
  transform: scale(1.05);
}

.news-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.news-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.news-title-link {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  line-height: 1.4;
  transition: color 0.2s;
  display: block;
}

.news-title-link:hover {
  color: var(--color-brand);
  text-decoration: underline;
}

.news-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
  flex-wrap: wrap;
}

.news-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.news-badge.hiring {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.news-badge.ld-talent {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

.news-badge.assessment {
  background: rgba(14, 165, 233, 0.1);
  color: #0ea5e9;
}

.news-badge.executive-move {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.news-badge.general-business {
  background: rgba(107, 114, 128, 0.1);
  color: var(--text-muted);
}

.news-scope-pill {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--color-brand-light);
  color: var(--color-brand);
  white-space: nowrap;
}

.news-client-pill {
  background: var(--color-brand-light);
  color: var(--color-brand);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  text-transform: uppercase;
}

.news-summary {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Universal card loading spinner ─────────────────────────── */
.card-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.25rem 1rem;
  gap: 0.7rem;
  width: 100%;
}

.card-loader-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-card, rgba(0,0,0,0.1));
  border-top-color: var(--color-brand, #6366f1);
  border-radius: 50%;
  animation: card-loader-spin 0.7s linear infinite;
  flex-shrink: 0;
}

[data-theme="dark"] .card-loader-spinner {
  border-color: rgba(255,255,255,0.1);
  border-top-color: var(--color-brand, #6366f1);
}

.card-loader-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
}

@keyframes card-loader-spin {
  to { transform: rotate(360deg); }
}

/* news-loading now delegates to card-loader */
.news-loading {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.news-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-card, rgba(0,0,0,0.1));
  border-top-color: var(--color-brand, #6366f1);
  border-radius: 50%;
  animation: card-loader-spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

.news-empty-state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  border: 1px dashed var(--border-card);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.01);
}

[data-theme="dark"] .news-empty-state {
  background: rgba(255, 255, 255, 0.005);
}

.news-empty-icon {
  font-size: 1.8rem;
}

button:disabled .refresh-icon {
  animation: news-spin 1.2s linear infinite;
  display: inline-block;
}

/* ===================== Floating CSM Chatbot ===================== */
.csm-chat-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: inherit;
}

.csm-chat-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-brand), var(--color-brand-hover, #4f46e5));
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.csm-chat-fab:hover {
  transform: scale(1.1) translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.csm-chat-fab:active {
  transform: scale(0.95);
}

.chat-badge-pulse {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  background: var(--color-success, #10b981);
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}

/* Chat Window Container */
.csm-chat-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 380px;
  height: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 1;
  transform: translateY(0);
}

.csm-chat-window.hidden {
  display: none !important;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
}

/* Header */
.csm-chat-header {
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid var(--border-card);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.chat-avatar {
  font-size: 1.5rem;
}

.chat-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.chat-status {
  font-size: 0.72rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #10b981;
}

.csm-chat-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
  border-radius: 50%;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.csm-chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

/* Chat Messages */
.csm-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scroll-behavior: smooth;
}

/* Scrollbar styling for message log */
.csm-chat-messages::-webkit-scrollbar {
  width: 6px;
}
.csm-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.csm-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
}
:root[content="light"] .csm-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.08);
}

/* Message Bubble */
.chat-msg {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.82rem;
  line-height: 1.45;
  word-break: break-word;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--color-brand);
  color: #fff;
  border-bottom-right-radius: 2px;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.chat-msg.ai {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  color: var(--text-primary);
  border-bottom-left-radius: 2px;
}

:root[content="light"] .chat-msg.ai {
  background: rgba(0, 0, 0, 0.02);
}

/* Markdown formatting inside messages */
.chat-msg p {
  margin: 0 0 0.5rem 0;
}
.chat-msg p:last-child {
  margin-bottom: 0;
}
.chat-msg ul, .chat-msg ol {
  margin: 0.25rem 0 0.5rem 0;
  padding-left: 1.25rem;
}
.chat-msg li {
  margin-bottom: 0.25rem;
}
.chat-msg strong {
  font-weight: 700;
  color: inherit;
}

/* Input Area */
.csm-chat-input-area {
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.08);
  border-top: 1px solid var(--border-card);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.csm-chat-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-card);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.82rem;
  padding: 0.6rem 0.85rem;
  transition: all 0.3s;
  outline: none;
}

:root[content="light"] .csm-chat-input {
  background: rgba(0, 0, 0, 0.02);
}

.csm-chat-input:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 8px rgba(99, 102, 241, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.csm-chat-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--color-brand);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.csm-chat-send-btn:hover {
  background: var(--color-brand-hover, #4f46e5);
  transform: translateY(-1px);
}

.csm-chat-send-btn:active {
  transform: translateY(0);
}

/* Typing Indicator Balloon */
.chat-msg.typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0.6rem 1rem;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing-bounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

