/* Meritto-Inspired Task Management System Styles */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global Loader (modern, subtle) */
.loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 40000;
    display: grid;
    place-items: center;
    background: radial-gradient(800px 400px at 50% -10%, rgba(13,28,64,.08), transparent 60%),
                radial-gradient(600px 300px at 10% 110%, rgba(0,184,148,.08), transparent 60%),
                rgba(255,255,255,0.65);
    -webkit-backdrop-filter: blur(6px) saturate(140%);
    backdrop-filter: blur(6px) saturate(140%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility .22s ease;
}
.loader-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}
.loader-shell { display: grid; justify-items: center; gap: 10px; }
.loader-logo { width: 56px; height: 56px; border-radius: 14px; box-shadow: 0 10px 30px rgba(13,28,64,.25); position: relative; z-index: 1; }
.logo-wrap { position: relative; display: grid; place-items: center; }
.logo-glow { position: absolute; width: 100px; height: 100px; border-radius: 50%; background: radial-gradient(circle, rgba(20,184,166,.35), rgba(20,184,166,0) 70%); filter: blur(14px); z-index: 0; }
.loader-text { font-weight: 700; color: #0d1c40; letter-spacing: .02em; }
.dots { display: inline-grid; grid-auto-flow: column; gap: 6px; }
.dots span { width:8px; height:8px; border-radius: 50%; background: #0d1c40; opacity: .25; animation: dotPulse 1.2s infinite ease-in-out; }
.dots span:nth-child(1){ animation-delay: 0s }
.dots span:nth-child(2){ animation-delay: .2s }
.dots span:nth-child(3){ animation-delay: .4s }
@keyframes dotPulse { 0%, 80%, 100% { opacity:.25; transform: translateY(0) } 40% { opacity:1; transform: translateY(-6px) } }

@media (prefers-reduced-motion: reduce) {
    .loader-overlay, .dots span { animation: none; transition: none; }
}

/* Harden fullscreen specifically for the task modal to avoid any cascade conflicts */
#taskModal.is-fullscreen,
#taskModal.fullscreen {
    padding: 0 !important;
    display: flex !important;
    align-items: stretch !important;
    justify-content: center !important;
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 10000 !important;
}
#taskModal.is-fullscreen .modal-content,
#taskModal.fullscreen .modal-content {
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
}
#taskModal.is-fullscreen .modal-header,
#taskModal.fullscreen .modal-header { position: sticky; top: 0; z-index: 1; }
#taskModal.is-fullscreen .modal-body,
#taskModal.fullscreen .modal-body {
    max-height: none !important;
    height: calc(100vh - 68px) !important; /* fallback header height */
    overflow: auto !important;
}

/* Prevent body scroll while fullscreen modal is active (already present but keep near hardened rules) */
body.modal-fullscreen-active { overflow: hidden !important; }

/* New fullscreen variant using 'is-fullscreen' class */
.modal.is-fullscreen {
    padding: 0;
    display: flex !important;
    align-items: stretch;
    justify-content: center;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 10000 !important;
}
.modal.is-fullscreen .modal-content {
    width: 100vw !important;
    max-width: none !important;
    height: 100vh !important;
    max-height: none !important;
    border-radius: 0 !important;
}
.modal.is-fullscreen .modal-header {
    position: sticky;
    top: 0;
    z-index: 1;
}
.modal.is-fullscreen .modal-body {
    max-height: none !important;
    height: calc(100vh - 68px) !important;
    overflow: auto !important;
}

/* Compact styling for quick filter buttons to reduce width */
.quick-filters {
    flex-wrap: nowrap !important; /* force single line */
    gap: 6px !important;
    overflow-x: auto; /* allow horizontal scroll on small screens */
    -webkit-overflow-scrolling: touch;
}
.quick-filters .btn {
    padding: 4px 8px; /* more compact */
    font-size: 11px;
    border-radius: var(--radius-md);
}
.quick-filters .btn i { font-size: 11px; }

/* Prevent hover-open unless toggled open */
.user-menu:hover .user-menu-dropdown:not(.open) {
    display: none;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
}

:root {
    /* Brand Color Palette (updated) */
    --brand-primary: #0d1c40;           /* main theme */
    --brand-primary-dark: #0a1634;      /* darker */
    --brand-primary-light: #e6ebf5;     /* light tint for focus/accents */

    /* Map existing tokens to brand to minimize template changes */
    --primary-teal: var(--brand-primary);
    --primary-teal-dark: var(--brand-primary-dark);
    --primary-teal-light: var(--brand-primary-light);
    --secondary-blue: var(--brand-primary);
    --accent-orange: #fd79a8;
    --success-green: #00b894;
    --warning-orange: #fdcb6e;
    --danger-red: #e17055;
    
    /* Neutral Colors */
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.6;
    font-size: 14px;
}

/* Ensure the viewport height calculations behave consistently */
html, body { height: 100%; }

/* When Teams Card View is active, prevent page-level scrolling to avoid bottom whitespace.
   The team grid will handle its own scroll area. */
body.teams-view { overflow: hidden; }

/* Lock the team grid to the viewport height minus header/nav area to prevent bottom gap */
#teamCardView, #ownerCardView {
  height: calc(100vh - 120px) !important; /* header (~56px) + nav (~64px) */
  max-height: calc(100vh - 120px) !important;
  padding-bottom: 8px !important; /* tighten bottom padding to remove white strip */
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* ========================= */
/* Modern Card Grid Styling  */
/* ========================= */

/* Apple-inspired color palette */
:root {
  --apple-blue: #0d1c40;
  --apple-blue-light: #0d1c40;
  --apple-purple: #AF52DE;
  --apple-purple-light: #BF5AF2;
  --apple-pink: #FF2D55;
  --apple-orange: #FF9500;
  --apple-green: #34C759;
  --apple-teal: #5AC8FA;
  --apple-indigo: #5856D6;
  --apple-gray-1: #F2F2F7;
  --apple-gray-2: #E5E5EA;
  --apple-gray-3: #D1D1D6;
  --apple-gray-4: #C7C7CC;
  --apple-gray-5: #AEAEB2;
  --apple-gray-6: #8E8E93;
  --apple-text-primary: #1C1C1E;
  --apple-text-secondary: #3A3A3C;
  --apple-text-tertiary: #48484A;
}

/* Grid shell spacing */
.grid-shell { 
  padding-top: 8px; 
  padding-bottom: 8px;
  background: linear-gradient(to bottom, #FAFAFA 0%, #F5F5F7 100%);
}
.grid-section { padding-top: 4px; }

/* Responsive, comfortable card grid */
#teamCardsContainer.card-grid,
#ownerCardsContainer.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* Headings with subtle Apple-like weight and tracking */
.grid-heading {
  font-weight: 800;
  letter-spacing: .04em;
  color: var(--apple-blue);
  text-transform: uppercase;
  font-size: 13px;
}

/* Base card look: soft, airy, high-contrast content with subtle depth */
.report-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-radius: 18px;
  background: #FFFFFF;
  border: 0.5px solid var(--apple-gray-2);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  text-decoration: none;
  color: inherit;
  transition: all 280ms cubic-bezier(.25,.46,.45,.94);
  will-change: transform, box-shadow;
  position: relative;
  overflow: hidden;
}

/* Subtle gradient overlay on hover */
.report-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0,122,255,0.02) 0%, rgba(175,82,222,0.02) 100%);
  opacity: 0;
  transition: opacity 280ms ease;
  pointer-events: none;
}

/* Glass effect where supported */
@supports (backdrop-filter: blur(10px)) {
  .report-card {
    background: rgba(255,255,255,0.85);
    backdrop-filter: saturate(180%) blur(20px);
  }
}

.report-card:hover {
  transform: translateY(-3px) scale(1.005);
  box-shadow: 0 12px 24px rgba(0,122,255,0.12), 0 4px 8px rgba(0,0,0,0.08);
  border-color: var(--apple-blue-light);
}

.report-card:hover::before {
  opacity: 1;
}

.report-card:active {
  transform: translateY(-1px) scale(1.002);
  transition-duration: 100ms;
}

/* Icon pill */
.report-card .icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--apple-blue) 0%, var(--apple-blue-light) 100%);
  box-shadow: 0 4px 12px rgba(0,122,255,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
  font-size: 20px;
  transition: transform 280ms cubic-bezier(.25,.46,.45,.94);
}

.report-card:hover .icon {
  transform: scale(1.08) rotate(-2deg);
}

/* Owner variant accent */
#ownerCardView .report-card .icon {
  background: linear-gradient(135deg, var(--apple-purple) 0%, var(--apple-purple-light) 100%);
  box-shadow: 0 4px 12px rgba(175,82,222,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}

.report-card .meta .title {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.35;
  color: var(--apple-text-primary);
  letter-spacing: -0.01em;
  margin-bottom: 2px;
}

.report-card .meta .sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--apple-text-tertiary);
  font-weight: 400;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.report-card .chev {
  margin-left: auto;
  color: var(--apple-gray-5);
  font-size: 14px;
  transition: transform 280ms cubic-bezier(.25,.46,.45,.94), color 280ms;
}

.report-card:hover .chev {
  transform: translateX(3px);
  color: var(--apple-blue);
}

/* Badge style for counts - Apple-inspired pills */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

/* Open count badge - Pink/Red gradient */
.badge-open {
  background: linear-gradient(135deg, var(--apple-pink) 0%, #FF3B58 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(255,45,85,0.25);
}

/* General badge styling - Blue gradient */
.card-grid .badge,
.quick-filters .badge {
  background: #036a56;
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,122,255,0.25);
}

/* Count text styling */
.count-text {
  color: var(--apple-text-secondary);
  font-weight: 500;
  font-size: 13px;
}

/* Ensure hover scaling never causes horizontal scrollbar */
#teamCardsContainer,
#ownerCardsContainer { overflow: hidden; }

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  .report-card,
  .report-card .icon,
  .report-card .chev { transition: none; }
  .report-card:hover,
  .report-card:hover .icon,
  .report-card:hover .chev { transform: none; }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  #teamCardsContainer.card-grid,
  #ownerCardsContainer.card-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  
  .report-card {
    padding: 16px;
  }
  
  .report-card .icon {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }
}

/* Color variants for different card states */
.report-card.high-priority {
  border-color: rgba(255,45,85,0.2);
}

.report-card.high-priority:hover {
  box-shadow: 0 12px 24px rgba(255,45,85,0.15), 0 4px 8px rgba(0,0,0,0.08);
}

.report-card.completed {
  opacity: 0.85;
  border-color: var(--apple-gray-3);
}

.report-card.completed .icon {
  background: linear-gradient(135deg, var(--apple-green) 0%, #30D158 100%);
  box-shadow: 0 4px 12px rgba(52,199,89,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
}

/* Empty state styling */
.grid-shell .empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--apple-text-tertiary);
}

.grid-shell .empty-state i {
  font-size: 48px;
  color: var(--apple-gray-4);
  margin-bottom: 16px;
  opacity: 0.5;
}

.grid-shell .empty-state h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--apple-text-primary);
  margin-bottom: 8px;
}

.grid-shell .empty-state p {
  font-size: 14px;
  color: var(--apple-text-tertiary);
}

/* Header Component - Meritto Style */
.header {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 8px 0; /* compact header height */
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.header-brand h1 {
    font-size: 20px; /* compact */
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.header-brand h1 i {
    color: var(--primary-teal);
    font-size: 22px; /* compact */
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Navigation Component - Meritto Style */
.navigation {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: var(--spacing-md) 0;
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Search Component */
.search-container {
    position: relative;
    width: 200px; /* fixed width */
}

.search-input {
    width: 100%;
    padding: 12px 16px 12px 44px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 14px;
    background: var(--white);
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px var(--primary-teal-light);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 16px;
}

/* View Toggle - Meritto Style */
.view-controls {
    display: flex;
    background: var(--gray-100);
    border-radius: var(--radius-lg);
    padding: 4px;
    border: 1px solid var(--gray-200);
}

.view-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: var(--gray-600);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.view-btn:hover {
    color: var(--gray-900);
    background: var(--gray-50);
}

.view-btn.active {
    background: var(--success-green);
    color: var(--white);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* Filters */
.filters {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.filter-select {
    padding: 10px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--white);
    color: var(--gray-700);
    width: 160px; /* fixed width */
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px var(--primary-teal-light);
}

/* Buttons - Meritto Style */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-teal);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-teal-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-300);
    transform: translateY(-1px);
}

/* Active state for Quick Filter buttons */
.quick-filter-btn.active {
    background: var(--success-green) !important;
    color: var(--white) !important;
    border-color: var(--success-green) !important;
}

.btn-success {
    background: var(--success-green);
    color: var(--white);
    box-shadow: var(--shadow-md);
}

.btn-success:hover:not(:disabled) {
    background: var(--primary-teal-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Stats Cards - Meritto Style */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-xl);
    margin: var(--spacing-2xl) 0;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* Compact variant for smaller, tighter stat cards */
.stats-compact {
    gap: var(--spacing-xs);
    margin: var(--spacing-sm) 0;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.stat-compact {
    padding: var(--spacing-xs) var(--spacing-sm);
    display: grid;
    grid-template-columns: auto 1fr; /* icon | text */
    align-items: center;
    column-gap: var(--spacing-xs);
    row-gap: 0;
    border-radius: var(--radius-md);
}

.stat-compact .stat-icon {
    width: 24px;
    height: 24px;
    font-size: 12px;
    margin: 0; /* horizontal layout */
    background: transparent; /* crisper, no pill */
    color: var(--primary-teal);
}

.stat-compact .stat-number {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
    line-height: 1.1;
    grid-column: 2;
}

.stat-compact .stat-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--gray-500);
    margin: 0;
    line-height: 1.1;
    grid-column: 2;
}

.stat-compact:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-teal);
}

/* Ensure compact cards have subtler hover than default */
.stat-card.stat-compact:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary-teal);
    transition: width 0.3s ease;
}

/* Hide accent bar for compact cards for a cleaner, tighter look */
.stat-card.stat-compact::before {
    display: none;
}

.stat-card:hover::before {
    width: 8px;
}

.stat-header {
    display: flex;
    align-items: center;
    justify-content: between;
    margin-bottom: var(--spacing-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--primary-teal-light);
    color: var(--primary-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: var(--spacing-md);
}

.stat-number {
    font-size: 36px;
    font-weight: 800;
    color: var(--gray-900);
    margin-bottom: var(--spacing-xs);
}

.stat-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Task Cards - Meritto Style */
.tasks-container {
    display: grid;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

.task-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-teal);
}

.task-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.task-id {
    font-size: 12px;
    font-weight: 700;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 4px 12px;
    border-radius: var(--radius-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin: var(--spacing-sm) 0;
    line-height: 1.4;
}

.task-description {
    color: var(--gray-600);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: var(--spacing-lg);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.task-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.task-badges {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.badge {
    padding: 6px 16px;
    border-radius: var(--radius-lg);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* Hide department label and id in the task list UI (do not remove data) */
.dept-badge {
    display: none !important;
}

.badge.status-open {
    background: #dcfce7;
    color: #166534;
}

.badge.status-in-progress {
    background: #fef3c7;
    color: #92400e;
}

.badge.status-pending {
    background: #fce7f3;
    color: #be185d;
}

.badge.status-closed {
    background: var(--gray-100);
    color: var(--gray-600);
}

.badge.priority-high {
    background: #fee2e2;
    color: #dc2626;
}

.badge.priority-medium {
    background: #fef3c7;
    color: #d97706;
}

.badge.priority-low {
    background: #dcfce7;
    color: #059669;
}

.task-date {
    color: var(--gray-500);
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Loading and Empty States */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    color: var(--primary-teal);
    font-size: 16px;
    font-weight: 500;
}

.loading i {
    margin-right: var(--spacing-md);
    font-size: 20px;
}

.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--gray-500);
}

.empty-state i {
    font-size: 64px;
    margin-bottom: var(--spacing-xl);
    color: var(--gray-300);
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    color: var(--gray-700);
}

.empty-state p {
    font-size: 16px;
    color: var(--gray-500);
}

/* Error Messages */
.error-message {
    background: var(--danger-red);
    color: var(--white);
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    font-weight: 500;
}

/* Kanban Board - Meritto Style */
.kanban-board {
    /* Horizontal lane of columns */
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px; /* room for scrollbar */
    scroll-snap-type: x proximity;
}

.kanban-column {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    /* Fixed column width; prevents wrapping to next row */
    flex: 0 0 340px; /* adjust to taste */
    max-height: calc(100vh - 220px);
    display: flex;
    flex-direction: column;
    scroll-snap-align: start;
    padding: var(--spacing-lg);
    min-height: 600px;
}

.kanban-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--gray-100);
}

.kanban-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.kanban-header h3 i {
    color: var(--primary-teal);
}

.task-count {
    background: var(--primary-teal-light);
    color: var(--primary-teal);
    padding: 4px 12px;
    border-radius: var(--radius-lg);
    font-size: 12px;
    font-weight: 700;
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    overflow-y: auto;
}

.kanban-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.kanban-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-teal);
}

/* Modal - Meritto Style */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
    padding: 2rem;
    box-sizing: border-box;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: auto;
    animation: slideUp 0.3s ease;
    margin: auto;
    position: relative;
    display: flex;
    flex-direction: column;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-xl);
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--gray-500);
    cursor: pointer;
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.close-btn:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

.modal-body {
    padding: var(--spacing-lg); /* slightly reduced */
    max-height: 65vh; /* reduce height */
    overflow-y: auto;
}

/* Fullscreen modal variant */
.modal.fullscreen {
    padding: 0;
    display: flex !important; /* ensure centering layout */
    align-items: stretch;      /* allow content to stretch full height */
    justify-content: center;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 10000 !important;
}
.modal.fullscreen .modal-content {
    width: 100vw !important;      /* occupy full viewport width */
    max-width: none !important;
    height: 100vh !important;     /* occupy full viewport height */
    max-height: none !important;
    border-radius: 0 !important;
}

/* Move to Sprint modal - refine bootstrap-select look */
#moveToSprintModal .bootstrap-select>.dropdown-toggle {
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    background-color: #f9fafb;
    box-shadow: none;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--gray-700);
}

#moveToSprintModal .bootstrap-select>.dropdown-toggle:focus,
#moveToSprintModal .bootstrap-select>.dropdown-toggle:hover {
    outline: none !important;
    border-color: var(--primary-teal);
    background-color: #ffffff;
    box-shadow: 0 0 0 2px var(--primary-teal-light);
}

#moveToSprintModal .bootstrap-select .dropdown-menu {
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
}

#moveToSprintModal .bootstrap-select .bs-searchbox input {
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    font-size: 13px;
}
.modal.fullscreen .modal-header {
    position: sticky;
    top: 0;
    z-index: 1;
}
.modal.fullscreen .modal-body {
    max-height: none !important;
    height: calc(100vh - 68px) !important; /* approx header height */
    overflow: auto !important;
}

/* Prevent background scroll when fullscreen modal is active */
body.modal-fullscreen-active {
    overflow: hidden;
}

/* Form Elements - Meritto Style */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: var(--spacing-sm);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 14px;
    background: var(--white);
    color: var(--gray-900);
    transition: all 0.2s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px var(--primary-teal-light);
}

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

.form-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--gray-200);
}

/* Task Detail Modal Content - Meritto Style */
.task-details-content {
    padding: 0;
}

/* Two-column layout for task details (Zendesk-like) */
.task-details-2col {
    display: grid;
    grid-template-columns: 1fr 340px; /* main | sidebar */
    gap: var(--spacing-xl);
}

.task-detail-main {
    padding-right: var(--spacing-lg);
}

.task-detail-sidebar {
    border-left: 1px solid var(--gray-200);
    padding-left: var(--spacing-lg);
}

.task-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-200);
}

.task-detail-id {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-500);
    background: var(--gray-100);
    padding: 8px 16px;
    border-radius: var(--radius-lg);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.task-detail-badges {
    display: flex;
    gap: var(--spacing-sm);
}

.task-detail-title {
    margin-bottom: var(--spacing-xl);
}

.task-detail-title h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
    line-height: 1.3;
}

.task-detail-section {
    margin-bottom: var(--spacing-lg); /* compact sections */
}

.section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.section-header i {
    color: var(--primary-teal);
    font-size: 18px;
}

.section-header h4 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.task-description-box {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    color: var(--gray-700);
    line-height: 1.6;
    white-space: pre-wrap;
    border-left: 4px solid var(--primary-teal);
}

/* Comments thread - chat bubbles */
.comments-thread {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.comment-item {
    display: grid;
    grid-template-columns: 40px 1fr; /* avatar | body */
    gap: var(--spacing-sm);
    align-items: flex-start;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-teal-light);
    color: var(--primary-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}

.comment-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.comment-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--gray-500);
}

.comment-author { font-weight: 700; color: var(--gray-800); }
.comment-dot { color: var(--gray-400); }
.comment-visibility { padding: 2px 8px; border-radius: 999px; font-weight: 600; font-size: 11px; }
.comment-visibility.pub { background: #e7f5ff; color: #1c7ed6; }
.comment-visibility.int { background: #f4f1ff; color: #5f3dc4; }

.comment-bubble {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
    color: var(--gray-800);
}

/* Ensure long content stays within the popup width */
.comment-bubble {
    overflow-wrap: anywhere; /* allow breaking long URLs/words */
    word-break: break-word;
    white-space: pre-wrap; /* preserve newlines but allow wrapping */
    max-width: 100%;
}

.comment-bubble * {
    max-width: 100%;
    box-sizing: border-box;
}

.comment-bubble img,
.comment-bubble video,
.comment-bubble iframe {
    max-width: 100%;
    height: auto;
}

.comment-bubble pre,
.comment-bubble code {
    white-space: pre-wrap; /* wrap long code blocks */
    word-wrap: break-word;
}

.comment-bubble pre {
    overflow-x: auto; /* allow horizontal scroll if absolutely needed */
}

.comment-item.internal .comment-bubble {
    background: #fbfbff;
    border-left: 4px solid #5f3dc4;
}

.comment-item.public .comment-bubble {
    background: #f8fdff;
    border-left: 4px solid #1c7ed6;
}

/* Loading state inside comments */
.comments-loading {
    color: var(--gray-500);
    margin-bottom: var(--spacing-md);
}

/* Modern comment input */
.comment-input-modern {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-sm);
}

.comment-input-modern textarea {
    width: 100%;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    font-size: 14px;
}

.comment-input-modern textarea:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px var(--primary-teal-light);
}

.comment-input-actions {
    margin-top: var(--spacing-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.public-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--gray-600);
}

/* Status below comment (single action layout) */
.status-below-comment {
    margin-top: var(--spacing-sm);
    display: grid;
    grid-template-columns: 90px 1fr;
    align-items: center;
    gap: var(--spacing-sm);
}
.status-below-comment .status-label {
    font-size: 12px;
    color: var(--gray-600);
    font-weight: 600;
}
.status-below-comment select {
    width: 100%;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    background: var(--white);
}

/* Owner assignment tidy layout */
.task-detail-sidebar .status-update {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}
.task-detail-sidebar #ownerSelect {
    width: 100%;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    background: var(--white);
}

/* Responsive: stack columns on smaller screens */
@media (max-width: 992px) {
    .task-details-2col {
        grid-template-columns: 1fr;
    }
    .task-detail-sidebar {
        border-left: none;
        border-top: 1px solid var(--gray-200);
        padding-left: 0;
        padding-top: var(--spacing-lg);
    }
}

.task-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-sm); /* tighter grid spacing */
}

/* Dedicated layout for Update Fields grid */
.update-fields-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 10px 12px;
}

.info-item {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 8px 10px; /* compact single-line */
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 34px;
    gap: 10px;
}

.info-item:hover {
    border-color: var(--primary-teal);
    box-shadow: var(--shadow-sm);
}

.info-label {
    font-size: 11px; /* smaller */
    font-weight: 600;
    color: var(--gray-600);
    text-transform: none; /* avoid uppercase for compactness */
    letter-spacing: 0;
    margin-bottom: 0; /* single-line */
    margin-right: 0;
    min-width: 120px;
    flex: 0 0 120px; /* fixed label width for alignment */
}

.info-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1 1 auto;
}

.info-value i {
    color: var(--primary-teal);
    font-size: 16px;
}

/* Inputs in Update Fields should be equal height and full width */
.update-fields-grid .info-value input,
.update-fields-grid .info-value select {
    width: 100%;
    height: 36px;
    padding: 6px 10px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.2;
    color: var(--gray-900);
    background: var(--white);
    box-sizing: border-box;
}

/* Ensure date inputs match the rest visually */
.update-fields-grid .info-value input[type="date"],
.update-fields-grid .info-value input[type="datetime-local"] {
    appearance: none;
    -webkit-appearance: none;
}

/* Compact selects arrow rendering consistency across browsers */
.update-fields-grid .info-value select {
    appearance: none;
    -webkit-appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--gray-500) 50%),
                      linear-gradient(135deg, var(--gray-500) 50%, transparent 50%),
                      linear-gradient(to right, var(--gray-300), var(--gray-300));
    background-position: calc(100% - 16px) calc(50% - 3px), calc(100% - 11px) calc(50% - 3px), calc(100% - 36px) 50%;
    background-size: 5px 5px, 5px 5px, 1px 22px;
    background-repeat: no-repeat;
    padding-right: 40px;
}

.status-update-form {
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
}

/* Task Owners View */
.owners-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
}

.owner-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.owner-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-teal);
}

.owner-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary-teal);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.owner-card:hover::before {
    transform: scaleX(1);
}

.owner-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary-teal-light);
    color: var(--primary-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    margin: 0 auto var(--spacing-md);
}

.owner-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--spacing-sm);
}

.owner-tasks {
    font-size: 14px;
    color: var(--gray-600);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .nav-content {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .search-container {
        min-width: 280px;
    }
    
    .stats {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-lg);
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: var(--spacing-md);
        text-align: center;
    }
    
    .nav-left,
    .nav-right {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .search-container {
        min-width: auto;
        width: 100%;
    }
    
    .stats {
        grid-template-columns: 1fr;
    }
    
    .task-header {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .task-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .header-brand h1 {
        font-size: 20px;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 13px;
    }
    
    .task-card,
    .stat-card {
        padding: var(--spacing-lg);
    }
    
    .task-title {
        font-size: 16px;
    }
    
    .stat-number {
        font-size: 28px;
    }
}

/* Microsoft-style User Menu (ported from styles.css) */
.user-menu {
    position: relative;
    display: inline-block;
}

.user-menu-btn {
    background-color: #ffffff;
    color: #323130;
    border: 1px solid #edebe9;
    padding: 6px 10px; /* compact */
    border-radius: 9999px; /* circular */
    cursor: pointer;
    font-size: 13px; /* compact */
    font-weight: 500;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px; /* compact */
    transition: box-shadow 0.2s ease, background-color 0.15s ease, border-color 0.15s ease, transform 0.06s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    min-width: 36px; /* compact */
    height: 36px; /* compact */
}

.user-menu-btn:hover {
    background-color: #f3f2f1;
    border-color: #c8c6c4;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.user-menu-btn:active {
    background-color: #edebe9;
    transform: translateY(1px);
}

.user-menu-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(13, 28, 64, 0.28), 0 2px 8px rgba(0, 0, 0, 0.16);
    border-color: #9fb0c9;
}

/* Animate caret like Facebook */
.user-menu-btn .fa-caret-down {
    transition: transform 0.15s ease;
}

.user-menu-btn[aria-expanded="true"] .fa-caret-down {
    transform: rotate(180deg);
}

.user-menu-btn[aria-expanded="true"] {
    background-color: #f3f2f1;
    border-color: #c8c6c4;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}

/* Optional avatar inside the user menu button */
.user-menu-btn .avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-block;
}

.user-menu-btn .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 220px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14), 0 2px 6px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    z-index: 1000;
    top: 100%;
    right: 0;
    margin-top: 8px;
    border: 1px solid #edebe9;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: all 0.2s ease;
    pointer-events: none;
}

/* Show dropdown when toggled via JS */
.user-menu-dropdown.open {
    display: block;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.user-menu-item {
    color: #323130;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 14px;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
    font-weight: 400;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid #f3f2f1;
    position: relative;
}

.user-menu-item:hover {
    background-color: #f3f2f1;
    color: #323130;
    text-decoration: none;
}

.user-menu-item:last-child {
    border-bottom: none;
}

.user-menu-item i {
    font-size: 16px;
    width: 20px;
    color: #605e5c;
    flex-shrink: 0;
}

.user-menu-item:hover i {
    color: #323130;
}

.user-menu-group {
    padding: 8px 16px 4px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #605e5c;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', 'Helvetica Neue', sans-serif;
    background-color: #faf9f8;
    border-bottom: 1px solid #edebe9;
}

.user-menu-divider {
    height: 1px;
    margin: 0;
    background-color: #edebe9;
    border: none;
}

/* Avatar trigger and profile header */
.user-menu-avatar {
    width: 24px; /* compact */
    height: 24px; /* compact */
    border-radius: 50%;
    background-color: var(--brand-primary);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px; /* compact */
}

.menu-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
}

.menu-profile .avatar-lg {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.menu-profile .profile-details {
    display: flex;
    flex-direction: column;
}

.menu-profile .profile-details .name {
    font-size: 14px;
    font-weight: 600;
    color: #323130;
}

.menu-profile .profile-details .meta {
    font-size: 12px;
    color: #605e5c;
}

/* ---- Reports: Meritto Card Grid ---- */
.card-list, .reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-xl);
    margin: var(--spacing-xl) 0;
}

.card, .report-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    text-decoration: none;
    color: inherit;
    transition: all 0.25s ease;
    box-shadow: var(--shadow-sm);
}

.card:hover, .report-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-teal);
}

.card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--primary-teal-light);
    color: var(--primary-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.card-content h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.card-content .meta, .card-content .chip {
    font-size: 12px;
    color: var(--gray-600);
}

.card-action {
    margin-left: auto;
    color: var(--gray-400);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

/* ---- Microsoft-style Admin UI ---- */
.ms-surface {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: var(--spacing-xl);
    margin-top: var(--spacing-xl);
}

.ms-panel {
    background: #ffffff;
    border: 1px solid #edebe9;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.ms-panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid #edebe9;
    background: #faf9f8;
    font-weight: 600;
    color: #323130;
}

.ms-panel-body {
    padding: 20px;
}

.ms-form .form-group label,
.ms-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #605e5c;
    margin-bottom: 6px;
}

.ms-input, .ms-text, .ms-url, .ms-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #edebe9;
    border-radius: 6px;
    background: #ffffff;
    color: #323130;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ms-input:focus, .ms-text:focus, .ms-url:focus, .ms-select:focus {
    outline: none;
    border-color: #c8c6c4;
    box-shadow: 0 0 0 2px rgba(0,120,212,0.15);
}

.ms-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 16px;
}

.ms-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 6px;
    border: 1px solid #edebe9;
    background: #ffffff;
    color: #323130;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.ms-btn:hover {
    background: #f3f2f1;
    border-color: #c8c6c4;
}

.ms-btn.primary {
    background: #0078d4;
    color: #ffffff;
    border-color: #0078d4;
}

.ms-btn.primary:hover {
    background: #106ebe;
    border-color: #106ebe;
}

.ms-btn.danger {
    background: #d13438;
    color: #ffffff;
    border-color: #d13438;
}

.ms-btn.danger:hover {
    background: #a80000;
    border-color: #a80000;
}

.ms-table-wrapper {
    background: #ffffff;
    border: 1px solid #edebe9;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.ms-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ms-table thead th {
    text-align: left;
    background: #faf9f8;
    color: #323130;
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 1px solid #edebe9;
}

.ms-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f3f2f1;
    color: #323130;
}

.ms-table tbody tr:hover {
    background: #f8f8f8;
}

.command-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

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

/* ---- Generic Admin UI Helpers ---- */
/* Tables */
.table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    background: var(--white);
}
.table thead th {
    position: sticky;
    top: 0;
    background: var(--white);
    text-align: left;
    padding: 10px 8px;
    font-weight: 700;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-200);
}
.table tbody td {
    padding: 10px 8px;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-100);
}
.table tbody tr:nth-child(even) {
    background: #fcfcfc;
}

/* Form control baseline (to match .form-control used in templates) */
.form-control {
    width: 100%;
    height: 34px;
    padding: 6px 10px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--gray-900);
    font-size: 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px var(--primary-teal-light);
}

/* Flash alerts for Flask messages */
.alert {
    border-radius: var(--radius-md);
    padding: 10px 12px;
    margin: 10px 0 14px;
    font-weight: 600;
}
.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}
.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

/* Simple spacing utilities */
.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }
.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

/* --- Advanced Filters Modal (Task Management) --- */
.filter-modal .modal-header {
  border-bottom: 1px solid #edf2f7;
}
.filter-modal .modal-body {
  background: #fafbfc;
}
.filter-modal {
  /* Glassy surface */
  background: linear-gradient(180deg, rgba(255,255,255,0.88) 0%, rgba(255,255,255,0.92) 100%);
  backdrop-filter: saturate(140%) blur(6px);
  border: 1px solid rgba(17,24,39,0.06);
}
.filter-modal.modal-content {
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(17,24,39,0.18);
}
.filter-conditions {
  display: grid;
  gap: 8px;
}
.filter-row {
  display: grid !important;
  grid-template-columns: 200px 160px 1fr 40px;
  gap: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 2px 10px rgba(17,24,39,0.04);
  transition: box-shadow .18s ease, border-color .18s ease, transform .12s ease;
}
.filter-row:hover { box-shadow: 0 6px 16px rgba(17,24,39,0.08); border-color: #dfe3e8; }
.filter-row:focus-within { box-shadow: 0 8px 20px rgba(17,24,39,0.12); border-color: #c7d2fe; }
.filter-modal .filter-select,
.filter-modal .search-input { 
  height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 0 10px;
  font-size: 13px;
  background: #fff;
  color: #0f172a;
}
#saveViewName {
  width: 280px;
  max-width: 50vw;
}
.filter-row .filter-select:focus,
.filter-row .search-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}
.filter-modal .btn.btn-secondary.icon-only,
.filter-row > button {
  width: 36px;
  min-width: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  background: #f3f4f6;
  color: #111827;
  border-radius: 12px;
}
.filter-row > button:hover { background: #eef2f7; }
.filter-row > button i { margin: 0; }
.filter-actions-row,
.saved-views-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap; /* avoid clipping on narrow widths */
}
.filter-actions-row .search-input { min-width: 240px; }
.filter-actions-row .filter-select { min-width: 160px; }
.filter-actions-row .btn,
.saved-views-row .btn {
  height: 36px;
  border-radius: 10px;
}
.filter-actions-row .btn i,
.filter-row .btn i,
.saved-views-row .btn i { margin-right: 6px; }
.saved-views-row .sv-label { font-size: 12px; color: #6b7280; }

/* --- Fluent-inspired buttons inside filter modal --- */
.filter-modal .btn {
  font-weight: 600;
  letter-spacing: .15px;
  min-height: 36px;
  padding: 8px 16px;
  border-radius: 8px;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease, transform .06s ease;
  white-space: nowrap; /* keep label visible */
}
.filter-modal .btn,
.filter-modal .filter-select,
.filter-modal .search-input { line-height: 1.2; }
.filter-actions-row .btn,
.saved-views-row .btn { min-width: 92px; }
.filter-modal #saveFilterViewBtn,
.filter-modal #applyAdvancedFiltersBtn,
.filter-modal #loadSavedViewBtn { min-width: 100px; }
.filter-modal .btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #2563eb; /* Fluent focus ring */
}
.filter-modal .btn:active { transform: translateY(1px); }
#applyAdvancedFiltersBtn:hover { filter: brightness(1.05); transform: translateY(-1px); }
#applyAdvancedFiltersBtn:active { transform: translateY(0); }

/* Softer secondary buttons in modal */
.filter-modal .btn.btn-secondary {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.filter-modal .btn.btn-secondary:hover { background: #eef2f7; }

@media (max-width: 720px) {
  .filter-row { grid-template-columns: 1fr; }
}

button#zohohc-asap-web-button {
    margin-bottom: 50px;
}
div#zohoasap_root {
    margin-bottom: 30px;
}