/* Intentionally minimal; main look is inlined in index.html as fallback */

html, body { height: 100%; }
* { box-sizing: border-box; }

/* Dual photo hover effect (Workday + Slack) */
.avatar-dual-photo {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
}

.avatar-dual-photo img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.3s ease;
}

.avatar-dual-photo .workday-photo {
  opacity: 1;
  z-index: 1;
}

.avatar-dual-photo .slack-photo {
  opacity: 0;
  z-index: 2;
}

.avatar-dual-photo:hover .workday-photo {
  opacity: 0;
}

.avatar-dual-photo:hover .slack-photo {
  opacity: 1;
}

/* Expanded card: dual photo matches avatar size */
.card.expanded .avatar-dual-photo {
  width: 108px !important;
  height: 108px !important;
}

:root { --dr-name-font-size: 12px; --dr-title-font-size: 11px; }

/* Authentication and Layout Styles */
html {
  overflow-x: hidden;
  max-width: 100vw;
}

body { 
  font-family: 'Public Sans', Arial, sans-serif; 
  margin: 0; 
  background: #0b1723; 
  color: #e6edf3;
  overflow-x: hidden;
  max-width: 100vw;
}

.container { 
  max-width: 1100px; 
  margin: 0 auto; 
  padding: 24px;
  overflow-x: hidden;
  box-sizing: border-box;
  width: 100%;
}

/* Header with authentication */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #22344a;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.logo h1 {
  font-size: 2.25rem;
  margin: 0;
  font-weight: 300;
  color: #FFD700;
}

.auth-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.auth-section .delegation-info {
  width: 100%;
  margin-top: 0;
}

.auth-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid #324761;
  background: #1a2d43;
  color: #e6edf3;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

.auth-btn:hover {
  background: #203651;
}

.user-info {
  color: #9fb3c8;
  font-size: 14px;
}

/* Login required message */
.login-required {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 400px;
}

.login-message {
  text-align: center;
  background: #0f2233;
  border: 1px solid #22344a;
  border-radius: 14px;
  padding: 40px;
  max-width: 400px;
}

.login-message h2 {
  margin: 0 0 16px 0;
  color: #FFD700;
}

.login-message p {
  margin: 0 0 24px 0;
  color: #9fb3c8;
}

/* Main content */
.main-content {
  display: block;
}

.search-section {
  margin-bottom: 24px;
}

.search-box {
  display: flex;
  gap: 12px;
  margin: 16px 0 24px;
}

.search-box input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #253347;
  background: #0f2233;
  color: #e6edf3;
  font-size: 16px;
}

.search-box button {
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid #324761;
  background: #1a2d43;
  color: #e6edf3;
  cursor: pointer;
  font-size: 16px;
}

.search-box button:hover {
  background: #203651;
}

/* History icon button - inside search box on the left */
.history-icon-btn {
  padding: 8px 12px !important;
  border: none !important;
  background: transparent !important;
  color: #9fb3c8;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.history-icon-btn:hover {
  background: rgba(255, 215, 0, 0.1) !important;
  color: #FFD700;
  transform: scale(1.1);
}

.history-icon-btn:active {
  transform: scale(0.95);
}

/* Hide history button when no history available */
.history-icon-btn.hidden {
  display: none;
}

/* Typeahead dropdown */
.typeahead { position: relative; }
.typeahead-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; background: #0f2233; border: 1px solid #22344a; border-top: none; border-radius: 0 0 8px 8px; max-height: 260px; overflow-y: auto; box-shadow: 0 6px 12px rgba(0,0,0,0.3); }
.typeahead-item { padding: 8px 10px; font-size: 14px; color: #e6edf3; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.typeahead-item:hover, .typeahead-item.active { background: #17334b; }
.typeahead-item .ti-name { font-weight: 600; }
.typeahead-item .ti-sub { font-size: 12px; color: #b9c3cf; }

/* Search history */
.typeahead-header { padding: 8px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: #7b8c9e; font-weight: 600; border-bottom: 1px solid #22344a; }
.history-item { padding: 8px 10px; font-size: 14px; color: #e6edf3; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.history-item:hover, .history-item.active { background: #17334b; }
.history-item .history-icon { font-size: 14px; flex-shrink: 0; }
.history-item .history-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.typeahead-clear-history { padding: 8px 10px; font-size: 12px; color: #7b8c9e; cursor: pointer; text-align: center; border-top: 1px solid #22344a; }
.typeahead-clear-history:hover { background: #17334b; color: #b9c3cf; }

.status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.status {
  color: #9fb3c8;
  font-size: 14px;
}

.export-btn {
  background: transparent;
  border: 1px solid #5f748b;
  border-radius: 6px;
  color: #9fb3c8;
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  min-width: 32px;
  height: 32px;
}

.export-btn:hover {
  background: rgba(95, 116, 139, 0.1);
  color: #FFD700;
  border-color: #FFD700;
}

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

/* Animated loading dots for NL search - Gold color */
.nl-loading-dots::after {
  content: '...';
  display: inline-block;
  width: 1.5em;
  animation: nl-loading-animation 1.5s infinite;
  letter-spacing: 2px;
  color: #FFD700; /* Axon Gold */
  font-weight: bold;
}

@keyframes nl-loading-animation {
  0% {
    content: '.';
  }
  33% {
    content: '..';
  }
  66% {
    content: '...';
  }
  100% {
    content: '.';
  }
}

/* Pulsing robot emoji for NL search */
.nl-loading-emoji {
  display: inline-block;
  animation: nl-emoji-pulse 1.5s ease-in-out infinite;
}

@keyframes nl-emoji-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.15);
    opacity: 0.8;
  }
}

.results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  max-width: 100%;
  overflow: hidden;
}

.details { border-top: 1px solid #22344a; margin-top: 8px; padding-top: 8px; }

/* Card styling */
.card {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 16px;
  border: 1px solid #22344a;
  border-radius: 14px;
  background: #0f2233;
  transition: border-color 0.2s;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

/* Only show pointer cursor on collapsed cards (since they can be clicked to expand) */
.card:not(.expanded) {
  cursor: pointer;
}

.card:hover {
  border-color: #324761;
}

.card.expanded {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 120px 1fr;
  grid-template-areas:
    "avatar meta"
    "details details"
    "story story"
    "directs directs"
    "peers peers"
    "coins coins"
    "charts charts";
  column-gap: 16px;
  align-items: start;
  max-width: 100%;
  box-sizing: border-box;
}

.card.expanded > * {
  min-width: 0; /* Prevents grid items from overflowing */
  box-sizing: border-box;
}

/* Card content layout */
.card .meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card .name {
  font-size: 18px;
  font-weight: 600;
  color: #FFD700;
  margin: 0;
}

.card .subtle {
  color: #9fb3c8;
  font-size: 14px;
  margin: 0;
}

.card .row {
  font-size: 13px;
  color: #e6edf3;
  margin: 0;
  line-height: 1.4;
}

.card .row.tiny {
  font-size: 12px;
  color: #9fb3c8;
  line-height: 1.35;
}

.card .pronouns {
  color: #7f8ea3;
  font-size: 14px;
  font-weight: normal;
}
/* Section headers for exact/partial match groups */
.section-header { margin: 18px 4px 8px; color: #9fb3c8; font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; grid-column: 1 / -1; }
.section-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.block-results { display: block; }

/* Tenure backgrounds (applied when worker type is Employee). Use higher specificity + !important
   to override inline fallback styles defined in index.html */
.card.bg-black { background: #FFF6CC !important; border-color: #FFF6CC !important; }
.card.bg-lightblue { background: #FFEB99 !important; border-color: #FFEB99 !important; }
.card.bg-yellow { background: #FFD700 !important; border-color: #FFD700 !important; }
.card.bg-red { background: #E6B800 !important; border-color: #E6B800 !important; }
.card.bg-purple { background: #CC9900 !important; border-color: #CC9900 !important; }
.card.bg-silver { background: #996600 !important; border-color: #996600 !important; }
.card.bg-gold { background: #664400 !important; border-color: #664400 !important; }

/* Title color */
.title { color: #FFD700 !important; }

/* Header/logo */
.header { display: flex; align-items: center; gap: 12px; }
.header h1 { font-size: 2.25rem; margin: 0; font-weight: 300; }
.logo { height: 5.0625rem; width: auto; border-radius: 6px; }

/* Avatar fallback */
.avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000000;
  color: #FFD700;
  font-weight: 700;
  font-size: 24px;
}

/* Direct reports section */
.dr-list { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.dr-item { width: 84px; text-align: center; display: flex; flex-direction: column; align-items: center; cursor: pointer; }
.dr-avatar {
  width: 56px; height: 56px; border-radius: 10px; border: 1px solid #1f2d40;
  display: flex; align-items: center; justify-content: center;
  background: #000000; color: #FFD700 !important; font-weight: 700; font-size: 18px;
}
.dr-item img { display: block; margin: 0 auto; }
.dr-item img { object-fit: cover; }
.avatar { object-fit: cover !important; }

/* Enlarge main photo when card is expanded (72px -> 108px) */
.card.expanded .avatar { grid-area: avatar; width: 108px !important; height: 108px !important; margin: 0; }
.card.expanded .avatar-container > div { width: 108px !important; height: 108px !important; }
.card.expanded .meta { grid-area: meta; width: 100%; }
.card.expanded .meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px 16px;
  align-content: start;
}
.card.expanded .meta .name,
.card.expanded .meta .subtle { grid-column: 1 / -1; }
.card.expanded .details { grid-area: details; display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 12px 16px; }
/* Ensure large sections span the full width below the two-column detail grid */
.card.expanded .charts-section .level-chart,
.card.expanded .charts-section .family-chart,
.card.expanded .charts-section .location-chart,
.card.expanded .charts-section .country-chart,
.card.expanded .charts-section .managers-chart,
.card.expanded .charts-section .worker-type-chart,
.card.expanded .directs-section .dr-header,
.card.expanded .directs-section .dr-list { grid-column: 1 / -1; }

/* Visual separation between charts on expanded cards */
/* Base spacing for chart sections */
.card.expanded .charts-section .level-chart,
.card.expanded .charts-section .family-chart,
.card.expanded .charts-section .country-chart,
.card.expanded .charts-section .location-chart,
.card.expanded .charts-section .managers-chart,
.card.expanded .charts-section .worker-type-chart {
  margin-top: 8px;
}

/* Strong visual separator ONLY between consecutive charts */
.card.expanded .charts-section :is(.level-chart, .family-chart, .country-chart, .location-chart, .managers-chart, .worker-type-chart)
  + :is(.level-chart, .family-chart, .country-chart, .location-chart, .managers-chart, .worker-type-chart) {
  margin-top: 10px;
  padding-top: 8px;
}
.card.expanded .charts-section :is(.level-chart, .family-chart, .country-chart, .location-chart, .managers-chart, .worker-type-chart)
  + :is(.level-chart, .family-chart, .country-chart, .location-chart, .managers-chart, .worker-type-chart)::before {
  content: '';
  display: block;
  height: 1px;
  background-color: rgba(95, 116, 139, 0.35); /* subtle neutral divider */
  border-radius: 0;
  margin-bottom: 8px;
}
/* Tighten topmost chart so it doesn't double-space with previous content */
.card.expanded .charts-section .level-chart:first-of-type {
  margin-top: 6px;
}
/* Job Family chart reuses level chart row styles */
.family-chart { margin-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.family-chart > div:first-child { font-size: 12px; color: #5a6b7e; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
/* Countries chart matches family/level chart layout */
.country-chart { margin-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.country-chart > div:first-child { font-size: 12px; color: #5a6b7e; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
/* Locations chart matches family/level chart layout */
.location-chart { margin-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.location-chart > div:first-child { font-size: 12px; color: #5a6b7e; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
/* Managers vs Creators chart matches family/level chart layout */
.managers-chart { margin-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.managers-chart > div:first-child { font-size: 12px; color: #5a6b7e; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
/* Worker Type chart matches family/level chart layout */
.worker-type-chart { margin-top: 4px; display: flex; flex-direction: column; gap: 6px; }
.worker-type-chart > div:first-child { font-size: 12px; color: #5a6b7e; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }

/* Mobile: use a softer divider and smaller spacing */
@media (max-width: 720px) {
  .card.expanded .charts-section .level-chart,
  .card.expanded .charts-section .family-chart,
  .card.expanded .charts-section .country-chart,
  .card.expanded .charts-section .location-chart,
  .card.expanded .charts-section .managers-chart,
  .card.expanded .charts-section .worker-type-chart {
    margin-top: 8px;
  }
  .card.expanded .charts-section :is(.level-chart, .family-chart, .country-chart, .location-chart, .managers-chart, .worker-type-chart)
    + :is(.level-chart, .family-chart, .country-chart, .location-chart, .managers-chart, .worker-type-chart) {
    margin-top: 10px;
    padding-top: 8px;
  }
  .card.expanded .charts-section :is(.level-chart, .family-chart, .country-chart, .location-chart, .managers-chart, .worker-type-chart)
    + :is(.level-chart, .family-chart, .country-chart, .location-chart, .managers-chart, .worker-type-chart)::before {
    height: 1px;
    background-color: rgba(95, 116, 139, 0.28);
    margin-bottom: 6px;
  }
}

/* Extra space before Direct Reports label for readability */
.card.expanded .directs-section .dr-header { margin-top: 14px; }

/* Hover effect for clickable Achievement Coins header only */
.card.expanded .directs-section .dr-header.clickable-header:hover { 
  color: #FF6B35;
  text-decoration: underline;
}

@media (max-width: 720px) {
  .card.expanded .details { grid-template-columns: 1fr; }
  
  /* Move time display below collapse button on mobile */
  .local-time-display {
    top: 52px !important;
    right: 12px !important;
  }
}
.dr-avatar { margin: 0 auto; }
.dr-name { 
  margin-top: 4px; 
  font-size: var(--dr-name-font-size, 12px); 
  line-height: 1.2; 
  font-weight: 700;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.dr-title { 
  font-size: var(--dr-title-font-size, 11px); 
  line-height: 1.3; 
  opacity: 0.9;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dr-level {
  font-size: var(--dr-title-font-size, 11px);
  line-height: 1.2;
  opacity: 0.85;
  font-weight: 600;
  width: 100%;
}
.dr-org { 
  font-size: var(--dr-title-font-size, 11px); 
  line-height: 1.2; 
  font-family: inherit; 
  font-weight: inherit;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Achievement Coins section */
.achievement-coins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--coin-size, 96px), var(--coin-size, 96px)));
  gap: 16px;
  margin-top: 8px;
  grid-column: 1 / -1;
  position: relative; /* Establish positioning context for tooltips */
}

.achievement-coin-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.achievement-coin {
  width: var(--coin-size, 96px);
  height: var(--coin-size, 96px);
  position: relative;
  cursor: help;
  transition: transform 0.2s ease;
}

.achievement-coin:hover {
  transform: scale(1.1);
}

.achievement-coin-label {
  font-size: 12px;
  font-weight: 700;
  color: #000000;
  text-align: center;
  line-height: 1.2;
  max-width: var(--coin-size, 96px);
  word-wrap: break-word;
}

.achievement-coin img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.achievement-coin-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.95);
  color: #FFD700;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: normal;
  min-width: 200px;
  max-width: min(350px, 90vw); /* Responsive max width */
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  margin-bottom: 8px;
  z-index: 99999;
  border: 1px solid #FFD700;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); /* Better visibility */
}

/* Left-align tooltip for leftmost coins to prevent left edge clipping */
.achievement-coin:first-child .achievement-coin-tooltip,
.achievement-coin:nth-child(2) .achievement-coin-tooltip {
  left: 0;
  right: auto;
  transform: translateX(0);
}

/* Right-align tooltip for rightmost coins to prevent right edge clipping */
.achievement-coin:last-child .achievement-coin-tooltip,
.achievement-coin:nth-last-child(2) .achievement-coin-tooltip {
  left: auto;
  right: 0;
  transform: translateX(0);
}

.achievement-coin:hover .achievement-coin-tooltip {
  opacity: 1;
}

.achievement-coin-tooltip-name {
  font-weight: 700;
  margin-bottom: 2px;
}

.achievement-coin-tooltip-description {
  font-size: 10px;
  opacity: 0.7;
  font-style: italic;
  margin-bottom: 4px;
  line-height: 1.3;
}

.achievement-coin-tooltip-date {
  font-size: 10px;
  opacity: 0.8;
}

/* Employees per Manager tooltip */
.employees-ratio-tooltip {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  margin-bottom: 4px;
  z-index: 1000;
}

div:hover > .employees-ratio-tooltip {
  opacity: 1;
}

/* Creators per Manager tooltip */
.creators-ratio-tooltip {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: rgba(0, 0, 0, 0.9);
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  margin-bottom: 4px;
  z-index: 1000;
}

div:hover > .creators-ratio-tooltip {
  opacity: 1;
}

/* Ensure achievement coins grid spans full width */
.card.expanded .details .achievement-coins-grid {
  grid-column: 1 / -1;
}

/* Clickable text utility */
.clickable { text-decoration: underline; cursor: pointer; }
/* Make manager clickable text and email links the same blue for clarity */
.card .row a { color: #1E90FF !important; text-decoration: underline; }
.clickable { color: #1E90FF !important; }

/* Management Chain Tooltip */
.management-chain-container {
  position: relative;
  display: inline-block;
}

.management-chain-icon {
  cursor: pointer;
  font-size: 14px;
  color: #1E90FF;
  margin-left: 4px;
  user-select: none;
  display: none; /* Hidden on desktop */
  transition: transform 0.2s ease;
}

.management-chain-icon:hover {
  transform: scale(1.2);
}

.management-chain-tooltip {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 8px;
  background: white;
  border: 2px solid #1E90FF;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 12px;
  min-width: 280px;
  max-width: 400px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  pointer-events: none;
}

.management-chain-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.management-chain-header {
  font-weight: 700;
  font-size: 13px;
  color: #0b1723;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ddd;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.management-chain-item {
  padding: 8px 10px;
  margin: 4px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border: 1px solid transparent;
}

.management-chain-item:hover {
  background-color: #f0f8ff;
  border-color: #1E90FF;
}

.management-chain-name {
  font-weight: 700;
  font-size: 13px;
  color: #0b1723;
  margin-bottom: 2px;
}

.management-chain-title {
  font-size: 11px;
  color: #5a6b7e;
  font-style: italic;
}

/* Mobile adjustments */
@media (max-width: 720px) {
  .management-chain-tooltip {
    min-width: 240px;
    max-width: 90vw;
    left: auto;
    right: 0;
  }
  
  .management-chain-icon {
    display: inline-block; /* Show icon on mobile */
    font-size: 16px;
    padding: 4px;
  }
}

/* Nested level results grid should span full width under a card */
.level-results {
  grid-column: 1 / -1;
  border: 1px solid #22344a; /* fallback; JS will override color to match parent card */
  border-radius: 14px;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  padding: 10px;
  margin: 0 0 0 0; /* connector handles spacing */
}

/* Small centered connector between card and level list */
.level-connector {
  grid-column: 1 / -1;
  position: relative;
  height: 18px;
  margin: 6px 0 0 0;
}

/* Contingent worker tenure backgrounds */
.card.bg-cw-palesky { background: #E6F2FF !important; border-color: #E6F2FF !important; }
.card.bg-cw-softazure { background: #B3D9FF !important; border-color: #B3D9FF !important; }
.card.bg-cw-anchor { background: #1E90FF !important; border-color: #1E90FF !important; }
.card.bg-cw-deepazure { background: #0066CC !important; border-color: #0066CC !important; }
.card.bg-cw-royal { background: #004C99 !important; border-color: #004C99 !important; }
.card.bg-cw-navy { background: #003366 !important; border-color: #003366 !important; }
.card.bg-cw-midnight { background: #001933 !important; border-color: #001933 !important; }

/* Card text: dark, no shadow */
.card { color: #0b1723 !important; }
.card .name,
.card .subtle,
.card .row,
.card .details {
  color: #0b1723 !important;
  text-shadow: none;
  -webkit-text-stroke: 0;
  text-stroke: 0;
}

/* 30+ years: gold text for visibility */
.card.bg-gold,
.card.bg-gold .name,
.card.bg-gold .subtle,
.card.bg-gold .row,
.card.bg-gold .details,
.card.bg-cw-midnight,
.card.bg-cw-midnight .name,
.card.bg-cw-midnight .subtle,
.card.bg-cw-midnight .row,
.card.bg-cw-midnight .details {
  color: #FFD700 !important;
}

/* Show pronouns next to the name in expanded view */
.card.expanded .pronouns { display: inline; margin-left: 4px; }


/* Employee Levels horizontal bar chart */
.level-chart {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.level-chart > div:first-child { /* header text */
  font-size: 12px;
  color: #5a6b7e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.level-row {
  display: grid;
  grid-template-columns: auto 240px 1fr auto; /* checkbox, label, bar, count */
  align-items: center;
  gap: 12px;
}
.level-label {
  justify-self: start;
  font-weight: 600;
  color: #0b1723 !important; /* override generic clickable blue */
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;           /* keep on one line */
  overflow: hidden;              /* avoid wrapping */
  text-overflow: ellipsis;       /* truncate if too long */
  min-width: 0;                  /* allow shrink inside CSS grid to avoid overflow */
  padding-right: 8px;            /* spacing from the bar column */
  display: inline-block;         /* clip underline to actual text width */
  max-width: 100%;
}
.level-bar {
  position: relative;
  height: 8px; /* shorter bars */
  background: #e9eef5;
  border: 1px solid #d4dbe6;
  border-radius: 4px;
  overflow: hidden;
}
.level-bar-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: #E09500; /* Axon orange-like */
  transform: none; /* render exact percentage width set via style */
}
.level-count {
  font-size: 12px;
  color: #5a6b7e;
  white-space: nowrap;
}

/* Mobile layout: keep desktop the same; optimize for small screens */
@media (max-width: 600px) {
  .container { padding: 14px; }
  /* Keep header as a row, put a small Sign Out on the right */
  header { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 4px; padding-bottom: 4px; }
  .logo h1 { font-size: 1.5rem; }
  .auth-section { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
  #statsBtn { display: none !important; }
  .user-info { display: none !important; }
  #logoutBtn { padding: 6px 10px; font-size: 12px; line-height: 1; }

  /* Search button small and to the right of the input */
  .search-box { flex-direction: row; gap: 6px; margin: 2px 0 8px; }
  .search-box input { font-size: 16px; padding: 10px 12px; }
  .search-box button { width: auto; font-size: 14px; padding: 10px 12px; }

  .results { grid-template-columns: 1fr; gap: 12px; }
  .section-grid { grid-template-columns: 1fr; gap: 12px; }

  .card { padding: 12px; gap: 12px; }
  .card .name { font-size: 16px; }
  .card .row { font-size: 12px; }

  .card.expanded { 
    grid-template-columns: 1fr !important; 
    grid-template-areas:
      'avatar'
      'meta'
      'details'
      'story'
      'directs'
      'peers'
      'coins'
      'charts';
    column-gap: 0;
  }
  .card.expanded .avatar { 
    width: 88px !important; 
    height: 88px !important;
    justify-self: center; /* Center the avatar on mobile */
  }
  .card.expanded .avatar-container > div { width: 88px !important; height: 88px !important; }
  .card.expanded .avatar-dual-photo { width: 88px !important; height: 88px !important; }
  .card.expanded .meta { grid-template-columns: 1fr !important; gap: 6px; }
  .card.expanded .details { grid-template-columns: 1fr !important; }
  .card.expanded > * { max-width: 100%; }

  .dr-list { flex-wrap: nowrap; overflow-x: auto; gap: 10px; padding-bottom: 4px; }
  .dr-item { width: 72px; }
  .dr-avatar { width: 52px; height: 52px; }

  .level-row { grid-template-columns: auto 160px 1fr auto; gap: 8px; }
  .level-label { font-size: 12px; }
  
  /* Make status more compact on mobile */
  #status { 
    font-size: 13px; 
    margin-bottom: 10px;
    line-height: 1.4;
  }
}

/* iPhone Pro Max-ish widths (≤440px) */
@media (max-width: 440px) {
  .container { padding: 14px; }
  header { gap: 8px; }
  header img { max-height: 40px; }
  .logo h1 { font-size: 1.25rem; }
  .user-info { width: 100%; font-size: 12px; line-height: 1.3; white-space: normal; word-break: break-word; }
  .auth-btn { width: 100%; }

  .results, .section-grid { gap: 10px; }
  .section-header { font-size: 12px; margin: 14px 2px 6px; }

  .card { padding: 10px; gap: 10px; }
  .card .name { font-size: 15px; }
  .card .row { font-size: 11.5px; }
  .slack-status-text { font-size: 11px !important; }
  .card.expanded .avatar { width: 84px !important; height: 84px !important; }
  .card.expanded .avatar-container > div { width: 84px !important; height: 84px !important; }
  .card.expanded .avatar-dual-photo { width: 84px !important; height: 84px !important; }
  .card.expanded .meta { grid-template-columns: 1fr !important; gap: 6px; }
  .card.expanded .details { grid-template-columns: 1fr !important; }

  .dr-list { gap: 8px; }
  .dr-item { width: 64px; }
  .dr-avatar { width: 48px; height: 48px; }

  .level-row { grid-template-columns: auto 150px 1fr auto; gap: 8px; }
  .level-label { font-size: 12px; }
}

/* iPhone 14/15 (≈393px) and narrower */
@media (max-width: 400px) {
  .container { padding: 12px; }
  header img { max-height: 36px; }
  .logo h1 { font-size: 1.1rem; }
  .auth-btn { padding: 9px 10px; font-size: 14px; }
  .user-info { font-size: 11.5px; }

  .search-box input { font-size: 15px; padding: 10px 12px; }
  .search-box button { font-size: 15px; padding: 10px 12px; }

  .card { padding: 10px; }
  .card .name { font-size: 14.5px; }
  .card .row { font-size: 11px; }
  .slack-status-text { font-size: 10.5px !important; }
  .card.expanded .avatar { width: 78px !important; height: 78px !important; }
  .card.expanded .avatar-container > div { width: 78px !important; height: 78px !important; }
  .card.expanded .avatar-dual-photo { width: 78px !important; height: 78px !important; }
  .card.expanded .meta { grid-template-columns: 1fr !important; }
  .card.expanded .details { grid-template-columns: 1fr !important; }

  .dr-item { width: 60px; }
  .dr-avatar { width: 46px; height: 46px; }

  .level-row { grid-template-columns: auto 140px 1fr auto; gap: 6px; }
  .level-count { font-size: 11px; }
}

.contingent-override,
.contingent-override a,
.card .row .contingent-override,
.card .row .contingent-override a {
  color: #000 !important;
  text-decoration: underline !important;
}

/* Coin Holders Modal */
.coin-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 23, 35, 0.92);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.coin-modal {
  background: linear-gradient(135deg, #0f2233 0%, #1a2f42 100%);
  border: 1px solid rgba(255, 215, 0, 0.2);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 215, 0, 0.1);
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease;
}

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

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

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

.coin-modal-header {
  display: flex;
  align-items: center;
  padding: 28px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.15);
  flex-shrink: 0;
  background: rgba(255, 215, 0, 0.03);
}

.coin-modal-header h2 {
  flex: 1;
  color: #FFD700;
  font-size: 26px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.coin-modal-close {
  background: rgba(255, 215, 0, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.2);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  color: #FFD700;
  padding: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-weight: 300;
}

.coin-modal-close:hover {
  background: rgba(255, 215, 0, 0.2);
  border-color: #FFD700;
  transform: scale(1.05);
}

.coin-modal-subtitle {
  padding: 18px 28px;
  color: #b8c5d6;
  font-size: 15px;
  border-bottom: 1px solid rgba(255, 215, 0, 0.1);
  flex-shrink: 0;
  font-weight: 500;
}

.coin-holders-list {
  overflow-y: auto;
  padding: 20px 28px;
  flex: 1;
}

.coin-holders-list::-webkit-scrollbar {
  width: 10px;
}

.coin-holders-list::-webkit-scrollbar-track {
  background: rgba(15, 34, 51, 0.4);
  border-radius: 5px;
}

.coin-holders-list::-webkit-scrollbar-thumb {
  background: rgba(255, 215, 0, 0.3);
  border-radius: 5px;
}

.coin-holders-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 215, 0, 0.5);
}

.coin-holder-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 18px;
  background: rgba(15, 34, 51, 0.6);
  border: 1px solid rgba(255, 215, 0, 0.1);
  border-radius: 10px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

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

.coin-holder-item:hover {
  background: rgba(15, 34, 51, 0.8);
  border-color: rgba(255, 215, 0, 0.4);
  transform: translateX(4px);
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.15);
}

.coin-holder-name {
  font-weight: 700;
  font-size: 16px;
  color: #e6edf3;
  margin-bottom: 6px;
}

.coin-holder-details {
  font-size: 14px;
  color: #8b9ab0;
  line-height: 1.6;
}

.coin-holder-details .coin-holder-title {
  display: block;
  margin-bottom: 2px;
  color: #b8c5d6;
}

.coin-holder-details .coin-holder-date {
  display: block;
  color: #FFD700;
  font-style: italic;
  font-size: 13px;
}

/* Mobile adjustments */
@media (max-width: 720px) {
  .coin-modal {
    max-height: 90vh;
    margin: 10px;
    border-width: 1px;
  }
  
  .coin-modal-header {
    padding: 20px;
  }
  
  .coin-modal-header h2 {
    font-size: 22px;
  }
  
  .coin-modal-subtitle {
    padding: 14px 20px;
  }
  
  .coin-holders-list {
    padding: 16px 20px;
  }
  
  .coin-holder-item {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px;
  }
}

/* Sort Group Separator */
.sort-group-separator {
  grid-column: 1 / -1;
  padding: 10px 16px;
  margin: 16px 0 10px 0;
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.06) 0%, rgba(255, 215, 0, 0.03) 100%);
  border-left: 3px solid rgba(139, 154, 176, 0.4);
  border-radius: 4px;
  color: #8b9ab0;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(139, 154, 176, 0.15);
  border-left: 3px solid rgba(139, 154, 176, 0.4);
}

/* Mobile adjustments for sort separator */
@media (max-width: 720px) {
  .sort-group-separator {
    font-size: 12px;
    padding: 8px 12px;
    margin: 12px 0 8px 0;
    letter-spacing: 0.6px;
  }
}

/* Filter Status Bar */
.filter-status-bar {
  padding: 16px 20px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f1923 100%);
  border-bottom: 2px solid #FFD700;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.filter-badges-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.sort-dropdown-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.sort-label {
  color: #b0c4de;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.sort-select {
  background: linear-gradient(135deg, #2a4563 0%, #1a2f42 100%);
  color: #FFD700;
  border: 1px solid #FFD700;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  outline: none;
}

.sort-select:hover {
  background: linear-gradient(135deg, #3a5573 0%, #2a3f52 100%);
  box-shadow: 0 2px 6px rgba(255, 215, 0, 0.3);
}

.clear-filters-btn {
  background: linear-gradient(135deg, #ff4757 0%, #dc3545 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.4);
  flex-shrink: 0;
}

.clear-filters-btn:hover {
  background: linear-gradient(135deg, #ff6b7a 0%, #ff4757 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.6);
}

.export-csv-btn {
  background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(76, 175, 80, 0.4);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.export-csv-btn:hover {
  background: linear-gradient(135deg, #66BB6A 0%, #4CAF50 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.6);
}

.export-csv-btn svg {
  flex-shrink: 0;
}

/* Export-only bar (when no filters active) */
.filter-status-bar.export-only {
  padding: 12px 20px;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f1923 100%);
  border-bottom: 2px solid #FFD700;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Mobile adjustments for filter bar */
@media (max-width: 720px) {
  .filter-status-bar {
    padding: 12px 14px;
    gap: 12px;
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-badges-container {
    gap: 8px;
    width: 100%;
  }
  
  .sort-dropdown-container {
    width: 100%;
    justify-content: flex-start;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 215, 0, 0.2);
  }
  
  .sort-label {
    font-size: 12px;
  }
  
  .sort-select {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    padding: 6px 10px;
  }
  
  .clear-filters-btn {
    width: 100%;
    padding: 10px 16px;
    margin-top: 8px;
    font-size: 13px;
  }
  
  .export-csv-btn {
    display: none; /* Hide export button on mobile */
  }
  
  .filter-status-bar.export-only {
    display: none; /* Hide export-only bar on mobile since it only contains export button */
  }
}
/* PhoneTool Admin Override Styling */
.admin-override-indicator {
  color: #FFD700 !important;
  font-style: italic !important;
  position: relative;
}

.admin-override-indicator::after {
  content: " ✏️";
  font-style: normal;
  font-size: 0.9em;
  opacity: 0.7;
}

.admin-override-badge {
  display: inline-block;
  background: #B8860B;
  color: #000;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: bold;
  margin-left: 6px;
  font-style: normal;
}

/* Story Section Styling */
.story-section {
  grid-area: story;
  margin: 12px 0 20px 0;
  padding: 16px;
  border: 1px solid rgba(95, 116, 139, 0.3);
  border-radius: 8px;
  background: rgba(95, 116, 139, 0.04);
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}

.story-header {
  display: flex !important;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #2c3e50;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  font-weight: 600;
  visibility: visible !important;
}

.story-header-buttons {
  display: flex;
  gap: 6px;
  align-items: center;
}

.story-edit-btn {
  padding: 4px 12px;
  background: #FFD700;
  color: #0b1723;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: background 0.2s;
}

.story-edit-btn:hover {
  background: #FFC700;
}

.story-delete-btn {
  padding: 4px 12px;
  background: transparent;
  color: #495057;
  border: 1px solid #6c757d;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.story-delete-btn:hover {
  background: #495057;
  color: #ffffff;
  border-color: #495057;
}

.story-done-btn {
  padding: 6px 16px;
  background: #4CAF50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
  margin-left: auto;
}

.story-done-btn:hover {
  background: #45a049;
}

.story-content {
  font-size: 14px;
  line-height: 1.6;
  color: #0b1723;
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  min-height: 60px;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  border: 2px solid transparent;
  transition: border-color 0.2s, background 0.2s;
  display: block !important;
  visibility: visible !important;
  max-width: 100%;
  box-sizing: border-box;
}

.story-content.editing {
  border: 2px solid #9fb3c8;
  cursor: text;
  background: rgba(255, 255, 255, 0.12);
}

.story-content.editing:focus {
  outline: none;
  border-color: #FFD700;
}

.story-content em {
  color: #7f8ea3;
}

.story-content a {
  color: #0066cc;
  text-decoration: underline;
  font-weight: 500;
}

.story-content a:hover {
  color: #004499;
  text-decoration: underline;
}

.story-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.story-toolbar button {
  padding: 6px 12px;
  background: #22344a;
  color: #e6edf3;
  border: 1px solid #324761;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.story-toolbar button:hover {
  background: #324761;
}

.story-toolbar button:active {
  background: #1a2837;
}

/* Active state for format buttons (bold/italic) */
.story-format-btn.active {
  background: #FFD700;
  color: #0b1723;
  border-color: #FFD700;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.story-format-btn.active:hover {
  background: #FFC700;
  border-color: #FFC700;
}

.story-char-counter {
  margin-left: auto;
  font-size: 12px;
  color: #2c3e50;
  font-weight: 600;
}

/* Emoji Picker Styling */
.emoji-picker {
  position: absolute;
  background: #ffffff;
  border: 2px solid #324761;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  max-width: 400px;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 8px;
}

.emoji-option {
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: background 0.2s;
  line-height: 1;
}

.emoji-option:hover {
  background: #f0f0f0;
  transform: scale(1.2);
}

.emoji-option:active {
  background: #e0e0e0;
}

/* Grid Area Assignments for Expanded Card Sections */
.directs-section {
  grid-area: directs;
  max-width: 100%;
  overflow: hidden;
}

.peers-section {
  grid-area: peers;
  max-width: 100%;
  overflow: hidden;
}

.coins-section {
  grid-area: coins;
  max-width: 100%;
  overflow: visible; /* Changed from hidden to allow tooltips to overflow */
  position: relative; /* Establish positioning context */
}

.charts-section {
  grid-area: charts;
  max-width: 100%;
  overflow: hidden;
}

/* Character counter shake animation when limit reached */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* ==============================
   DELEGATION UI STYLES
   ============================== */

.delegation-info {
  display: none;
  margin-top: -2px;
  font-size: 13px;
  color: #5f748c;
  line-height: 1.3;
}

.delegation-text {
  margin-bottom: 4px;
}

.delegation-link {
  color: #0066cc;
  text-decoration: none;
  font-weight: 500;
}

.delegation-link:hover {
  text-decoration: underline;
}

.delegation-manager-section {
  margin-top: 4px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  display: inline-block;
  transition: background-color 0.2s;
}

.delegation-manager-section:hover {
  background-color: rgba(0, 102, 204, 0.1);
}

/* Delegation Modal */
.modal {
  display: block;
  position: fixed;
  z-index: 10000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: #1a1d24;
  margin: 5% auto;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  border: 1px solid #30363d;
  animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #30363d;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #161b22;
  border-radius: 12px 12px 0 0;
}

.modal-header h2 {
  margin: 0;
  font-size: 20px;
  color: #e6edf3;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #8b949e;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background-color: #30363d;
  color: #e6edf3;
}

.modal-body {
  padding: 24px;
  background-color: #1a1d24;
  border-radius: 0 0 12px 12px;
}

.delegation-modal-content {
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.delegation-help {
  background-color: #161b22;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
  color: #8b949e;
  border: 1px solid #30363d;
}

.delegation-add-section {
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid #30363d;
}

.delegation-add-section h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 16px;
  color: #e6edf3;
}

.delegation-search-box {
  position: relative;
  margin-bottom: 12px;
}

.delegation-search-box input[type="text"] {
  width: 100%;
  padding: 10px;
  border: 1px solid #30363d;
  border-radius: 6px;
  font-size: 14px;
  background-color: #0d1117;
  color: #e6edf3;
}

.delegation-search-box input[type="text"]:focus {
  outline: none;
  border-color: #58a6ff;
  background-color: #161b22;
}

.delegation-search-box .typeahead-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #161b22;
  border: 1px solid #30363d;
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.delegation-search-box .typeahead-item {
  padding: 10px;
  cursor: pointer;
  border-bottom: 1px solid #30363d;
  color: #e6edf3;
}

.delegation-search-box .typeahead-item:hover {
  background-color: #21262d;
}

.delegation-search-box .typeahead-item:last-child {
  border-bottom: none;
}

.delegation-expiration {
  margin-bottom: 12px;
  font-size: 14px;
}

.delegation-expiration label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: #e6edf3;
}

.delegation-expiration input[type="date"] {
  padding: 6px 10px;
  border: 1px solid #30363d;
  border-radius: 4px;
  font-size: 14px;
  background-color: #0d1117;
  color: #e6edf3;
}

.delegation-list-section h3 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 16px;
  color: #e6edf3;
}

.delegation-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  border: 1px solid #30363d;
  border-radius: 6px;
  margin-bottom: 10px;
  background-color: #161b22;
}

.delegation-item-info {
  flex: 1;
  font-size: 14px;
}

.delegation-item-info strong {
  color: #e6edf3;
}

.delegation-item-info small {
  color: #8b949e;
}

.delegation-badge-ea {
  display: inline-block;
  background-color: #fbbf24;
  color: #92400e;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

.delegation-badge-expired {
  display: inline-block;
  background-color: #ef4444;
  color: white;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
  vertical-align: middle;
}

.delegation-expiration-text {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #8b949e;
  font-style: italic;
}

.delegation-expiration-text.expired {
  color: #f85149;
  font-weight: 600;
}

.delegation-item.expired {
  background-color: #2d1519;
  border-color: #da3633;
  opacity: 0.85;
}

.delegation-item-actions {
  display: flex;
  gap: 8px;
}

.delegation-empty {
  text-align: center;
  color: #8b949e;
  font-style: italic;
  padding: 20px;
}

.delegation-message {
  padding: 12px;
  border-radius: 6px;
  margin-top: 16px;
  font-size: 14px;
}

.delegation-message.success {
  background-color: #1c2d24;
  color: #56d364;
  border: 1px solid #2ea043;
}

.delegation-message.error {
  background-color: #2d1519;
  color: #f85149;
  border: 1px solid #da3633;
}

.delegation-message.info {
  background-color: #1c2d3a;
  color: #58a6ff;
  border: 1px solid #1f6feb;
}

/* Delegation Banner (above search results) */
.delegation-banner {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.delegation-banner-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.delegation-banner-icon {
  font-size: 20px;
}

.delegation-banner-filter {
  display: flex;
  align-items: center;
}

.delegation-banner-filter label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.delegation-banner-filter input[type="checkbox"] {
  cursor: pointer;
}

/* Button styles */
.btn-primary {
  background-color: #0066cc;
  color: white;
  border: none;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background-color: #0052a3;
}

.btn-primary:disabled {
  background-color: #cbd5e0;
  cursor: not-allowed;
}

.btn-small {
  background-color: #f0f4f8;
  color: #0b1723;
  border: 1px solid #cbd5e0;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-small:hover {
  background-color: #e0e6ed;
  border-color: #a0aec0;
}

.btn-small.btn-danger {
  color: #dc2626;
  border-color: #fca5a5;
}

.btn-small.btn-danger:hover {
  background-color: #fee2e2;
  border-color: #dc2626;
}

/* Mobile responsive */
@media (max-width: 600px) {
  .delegation-banner {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .delegation-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .delegation-item-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ===========================================
   BIRTHDAY & ANNIVERSARY CELEBRATION EFFECTS
   =========================================== */

/* Fireworks container on avatar */
.avatar-wrapper.has-fireworks {
  overflow: visible !important;
}

.fireworks-container {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 5;
}

/* Individual firework spark */
.firework-spark {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  opacity: 0;
}

/* Birthday fireworks - pink/magenta colors */
.firework-spark.birthday {
  animation: spark-burst-birthday 1.5s ease-out infinite;
}

/* Anniversary fireworks - gold colors */
.firework-spark.anniversary {
  animation: spark-burst-anniversary 1.5s ease-out infinite;
}

@keyframes spark-burst-birthday {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--spark-x), var(--spark-y)) scale(0);
    opacity: 0;
  }
}

@keyframes spark-burst-anniversary {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--spark-x), var(--spark-y)) scale(0);
    opacity: 0;
  }
}

/* Celebration container for effects */
.celebration-effects {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

/* Balloon styles */
.balloon {
  position: absolute;
  width: 30px;
  height: 38px;
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  animation: balloon-float 8s ease-in-out infinite;
  opacity: 0.85;
}

.balloon::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 10px solid inherit;
}

.balloon::after {
  content: '';
  position: absolute;
  bottom: -60px;
  left: 50%;
  width: 1px;
  height: 50px;
  background: rgba(255, 255, 255, 0.5);
}

@keyframes balloon-float {
  0% {
    transform: translateY(100vh) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.85;
  }
  90% {
    opacity: 0.85;
  }
  100% {
    transform: translateY(-120vh) rotate(15deg);
    opacity: 0;
  }
}

/* Confetti styles */
.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  opacity: 0.9;
}

.confetti.square {
  background: currentColor;
}

.confetti.circle {
  border-radius: 50%;
  background: currentColor;
}

.confetti.ribbon {
  width: 4px;
  height: 16px;
  background: currentColor;
  border-radius: 2px;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(-10vh) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(110vh) rotate(720deg);
    opacity: 0;
  }
}

/* Celebration badge on card */
.celebration-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 20px;
  animation: badge-bounce 1s ease-in-out infinite;
  z-index: 10;
}

@keyframes badge-bounce {
  0%, 100% { transform: scale(1) rotate(-5deg); }
  50% { transform: scale(1.15) rotate(5deg); }
}
