/* Import Design Tokens */
@import url('./design-tokens.css');

* { box-sizing: border-box; }

body { 
  font-family: var(--font-family-primary); 
  margin: 0; 
  color: var(--color-text-charcoal); 
  background: var(--color-bg-lighter); 
  line-height: var(--line-height-default);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
}

/* Typography - Headings */
h1 {
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-charcoal);
  font-family: var(--font-family-primary);
  line-height: var(--line-height-default);
  margin: 0 0 var(--spacing-3) 0;
}

h2 {
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-charcoal);
  font-family: var(--font-family-primary);
  line-height: var(--line-height-default);
  margin: 0 0 var(--spacing-3) 0;
}

h3 {
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-charcoal);
  font-family: var(--font-family-primary);
  line-height: var(--line-height-default);
  margin: 0 0 var(--spacing-3) 0;
}
header { 
  position: sticky; 
  top: 0; 
  z-index: 50; 
  display: flex; 
  flex-direction: column;
  gap: var(--spacing-2);
  padding: var(--spacing-4) var(--spacing-4); 
  background: var(--color-bg-white); 
  border-bottom: 1px solid var(--color-border-light); 
  box-shadow: var(--elevation-sm);
}

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

.company-logo {
  height: 60px;
  width: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
nav a { 
  margin-left: var(--spacing-2); 
  text-decoration: none; 
  color: var(--color-text-steel); 
  font-weight: var(--font-weight-medium);
  padding: var(--spacing-2) var(--spacing-4);
  border-radius: var(--radius-md);
  transition: all var(--animation-duration-base) var(--animation-easing-default);
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  font-size: var(--font-size-small);
  border: 1px solid transparent;
}
nav a:hover { 
  color: var(--color-primary-default); 
  background: var(--color-bg-light); 
  border-color: var(--color-border-medium);
}
nav a.active { 
  color: var(--color-text-white);
  background: var(--color-primary-default);
  font-weight: var(--font-weight-semibold);
  border-color: var(--color-primary-default);
}
nav a.active:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

/* Notifications Menu */
.notifications-menu {
  position: relative;
}

.notifications-btn {
  position: relative;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.notifications-btn:hover {
  border-color: var(--brand);
  background: var(--gray-50);
}

.notifications-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: white;
  border-radius: 10px;
  min-width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid white;
}

.notifications-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 400px;
  max-width: 90vw;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: 500px;
  display: flex;
  flex-direction: column;
}

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

.notifications-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.mark-all-read-btn {
  font-size: 12px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.2s ease;
}

.mark-all-read-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.notifications-list {
  overflow-y: auto;
  max-height: 400px;
}

.notification-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.2s ease;
}

.notification-item:hover {
  background: var(--gray-50);
}

.notification-item.unread {
  background: #f0f7ff;
  border-left: 3px solid var(--brand);
}

.notification-item.unread:hover {
  background: #e5f0ff;
}

.notification-content {
  flex: 1;
  min-width: 0;
}

.notification-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
}

.notification-message {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
  line-height: 1.4;
}

.notification-time {
  font-size: 11px;
  color: var(--muted);
}

.notification-link {
  margin-left: 12px;
  font-size: 12px;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.notification-link:hover {
  background: var(--brand);
  color: white;
}

/* Mention styling */
.mention {
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.95em;
}

/* Mention autocomplete */
.mention-autocomplete {
  position: fixed !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow-lg) !important;
  z-index: 10000 !important;
  max-height: 200px;
  overflow-y: auto;
  margin-top: 0;
  display: block;
  width: 320px;
  max-width: 90vw;
}

.mention-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.2s ease;
  font-size: 14px;
  line-height: 1.4;
}

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

.mention-item:hover,
.mention-item.selected {
  background: var(--gray-50);
  border-left: 3px solid var(--brand);
}

.mention-item strong {
  font-size: 14px;
  color: var(--text);
}

.mention-item .muted {
  font-size: 12px;
}

/* Profile Menu */
.profile-menu {
  position: relative;
}

.profile-menu-btn {
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text);
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.profile-menu-btn:hover {
  color: var(--brand);
  background: #f1f5f9;
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  z-index: 100;
  overflow: hidden;
}

.profile-dropdown a {
  display: block;
  padding: 12px 16px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.2s;
  border: none;
  margin: 0;
  border-radius: 0;
  font-weight: 500;
}

.profile-dropdown a:hover {
  background: var(--gray-50);
  color: var(--brand);
  transform: none;
  box-shadow: none;
}

main { 
  padding: var(--spacing-4); 
  max-width: 1400px; 
  margin: 0 auto; 
}

.toolbar { 
  margin-bottom: var(--spacing-4); 
  padding: var(--spacing-3);
  background: var(--color-bg-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--elevation-sm);
  border: 1px solid var(--color-border-light);
  box-sizing: border-box;
  width: 100%;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-group {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 250px;
  max-width: 400px;
}

.search-group input {
  flex: 1;
  min-width: 200px;
  padding: var(--spacing-2) var(--spacing-3);
  font-size: var(--font-size-base);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

.search-group button {
  padding: 10px 20px;
  white-space: nowrap;
}

.filter-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 300px;
}

.filter-group select {
  min-width: 140px;
  padding: 10px 14px;
  font-size: 14px;
}

.action-group {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.icon-btn {
  padding: 10px 14px;
  min-width: 44px;
  font-size: 16px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.icon-btn:hover {
  background: var(--gray-200);
  border-color: var(--brand);
  color: var(--brand);
}

/* Date Filters Group */
.date-filters-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 300px;
}

.date-filter-wrapper {
  position: relative;
  display: inline-block;
  vertical-align: top;
}

.date-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  max-width: 280px;
  z-index: 100;
  display: none;
  padding: 12px;
}

.date-filter-dropdown.open {
  display: block;
}

.date-filter-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.date-operator-select {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.date-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  min-height: 44px; /* Touch-friendly */
}

.filter-label {
  display: inline-block;
}

.filter-active {
  color: var(--success);
  font-weight: 600;
  margin-left: 4px;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  .toolbar {
    padding: var(--spacing-2);
  }
  
  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .search-group {
    max-width: 100%;
    min-width: 100%;
    flex-direction: column;
  }
  
  .search-group input {
    min-width: 100%;
    padding: 12px;
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px; /* Touch-friendly */
  }
  
  .search-group button {
    width: 100%;
    padding: 12px;
    min-height: 44px;
    font-size: 16px;
  }
  
  .filter-group {
    width: 100%;
    min-width: 100%;
    flex-direction: column;
    gap: 8px;
  }
  
  .date-filters-group {
    width: 100%;
    min-width: 100%;
    flex-direction: column;
    gap: 8px;
  }
  
  .multi-select-wrapper,
  .date-filter-wrapper {
    width: 100%;
  }
  
  .multi-select-btn {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    min-height: 44px; /* Touch-friendly */
  }
  
  .multi-select-dropdown,
  .date-filter-dropdown {
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
    position: fixed;
    top: auto;
    bottom: 0;
    margin: 0;
    border-radius: 16px 16px 0 0;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  }
  
  /* Mobile dropdown overlay */
  body.dropdown-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: fadeIn 0.3s ease-out;
  }
  
  @keyframes slideUp {
    from {
      transform: translateY(100%);
    }
    to {
      transform: translateY(0);
    }
  }
  
  @keyframes fadeIn {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }
  
  /* Table responsive */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table-wrapper table {
    min-width: 800px;
  }
  
  /* Better touch targets */
  .multi-select-option {
    min-height: 48px;
    padding: 14px 16px;
  }
  
  .multi-select-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
  }
  
  .action-group {
    margin-left: 0;
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }
  
  .action-group button,
  .action-group a {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
    padding: 12px;
  }
  
  .icon-btn {
    min-height: 44px;
    font-size: 18px;
  }
}

@media (max-width: 1200px) and (min-width: 769px) {
  .toolbar-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .search-group {
    max-width: 100%;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .date-filters-group {
    width: 100%;
  }
  
  .action-group {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}
input, select, textarea { 
  padding: var(--spacing-2) var(--spacing-3); 
  border: 1px solid var(--color-border-medium); 
  border-radius: var(--radius-md); 
  background: var(--color-bg-white);
  font-size: var(--font-size-base);
  transition: all var(--animation-duration-base) var(--animation-easing-default);
  font-family: var(--font-family-primary);
  color: var(--color-text-charcoal);
  box-sizing: border-box;
  width: 100%;
}

/* Text and email inputs - allow horizontal scrolling for long text */
input[type="text"],
input[type="email"],
input[type="url"],
input[type="search"],
input[type="tel"],
input[type="password"] {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary-default);
  box-shadow: 0 0 0 2px rgba(196, 58, 49, 0.1);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.6;
  overflow-x: auto;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
}

textarea.long-text {
  min-height: 200px;
}

select {
  overflow-x: auto;
  overflow-y: auto;
}
button { 
  padding: var(--spacing-2) var(--spacing-3); 
  border: 1px solid var(--color-border-medium); 
  border-radius: var(--radius-md);
  font-size: var(--font-size-base); 
  background: var(--color-bg-white); 
  cursor: pointer; 
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-primary);
  transition: all var(--animation-duration-base) var(--animation-easing-default);
  color: var(--color-text-charcoal);
}
button:hover { 
  background: var(--color-bg-light); 
  border-color: var(--color-border-medium); 
}
button.primary { 
  background: var(--color-primary-default); 
  color: var(--color-text-white); 
  border-color: var(--color-primary-default); 
  box-shadow: var(--elevation-sm);
  font-weight: var(--font-weight-medium);
}
button.primary:hover { 
  background: var(--color-primary-hover); 
  border-color: var(--color-primary-hover);
}

/* Filter buttons */
.btn-primary {
  background: var(--color-primary-default);
  color: var(--color-text-white);
  border: 1px solid var(--color-primary-default);
  padding: var(--spacing-2) var(--spacing-4);
  font-weight: var(--font-weight-semibold);
  box-shadow: var(--elevation-sm);
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  font-size: var(--font-size-base);
  border-radius: var(--radius-md);
  transition: all var(--animation-duration-base) var(--animation-easing-default);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  box-shadow: var(--elevation-md);
}

.btn-primary .btn-icon {
  font-size: 16px;
  font-weight: bold;
}

.btn-secondary {
  background: var(--color-secondary-default);
  color: var(--color-text-charcoal);
  border: 1px solid var(--color-border-medium);
  padding: var(--spacing-2) var(--spacing-4);
  font-weight: var(--font-weight-semibold);
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  font-size: var(--font-size-base);
  border-radius: var(--radius-md);
  transition: all var(--animation-duration-base) var(--animation-easing-default);
}
.btn-secondary:hover {
  background: var(--color-secondary-hover);
  border-color: var(--color-border-medium);
  color: var(--color-text-charcoal);
}

.btn-secondary .btn-icon {
  font-size: 16px;
  font-weight: bold;
}

/* Custom dropdown filter styling - for form fields, not toolbar */
.form-field .filter-group,
.custom-dropdown .filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
  position: relative;
}

.filter-group label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-steel);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--spacing-1);
}

.custom-dropdown {
  position: relative;
  width: 100%;
}

.dropdown-toggle {
  width: 100%;
  padding: var(--spacing-2) var(--spacing-3);
  background: var(--color-bg-white);
  border: 1px solid var(--color-border-medium);
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-charcoal);
  transition: all var(--animation-duration-base) var(--animation-easing-default);
  text-align: left;
  font-family: var(--font-family-primary);
}

.dropdown-toggle:hover {
  border-color: var(--color-border-medium);
  background: var(--color-bg-light);
}

.dropdown-toggle.active {
  border-color: var(--color-primary-default);
  box-shadow: 0 0 0 2px rgba(196, 58, 49, 0.1);
}

.dropdown-toggle.has-selection {
  background: var(--color-bg-light);
  border-color: var(--color-primary-default);
  color: var(--color-primary-default);
  font-weight: var(--font-weight-semibold);
}

.dropdown-arrow {
  font-size: 10px;
  color: var(--text-light);
  transition: transform 0.2s;
  margin-left: 8px;
}

.dropdown-toggle.active .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 220px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
  max-height: 350px;
  overflow: hidden;
}

.dropdown-menu.show {
  display: block;
  animation: dropdownSlideIn 0.2s ease-out;
}

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

.dropdown-header {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
}

.select-all-btn,
.deselect-all-btn {
  flex: 1;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  transition: all 0.2s;
}

.select-all-btn {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-hover) 100%);
  color: white;
  border: none;
}

.select-all-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 115, 234, 0.3);
}

.deselect-all-btn {
  background: white;
  color: var(--text);
  border: 1px solid var(--border);
}

.deselect-all-btn:hover {
  background: #f1f5f9;
  border-color: var(--text-light);
}

.dropdown-options {
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

.dropdown-options::-webkit-scrollbar {
  width: 8px;
}

.dropdown-options::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}

.dropdown-options::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.dropdown-options::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.dropdown-option {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
  user-select: none;
}

.dropdown-option:hover {
  background: #f1f5f9;
}

.dropdown-option input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 5px;
  margin-right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  transition: all 0.2s;
  flex-shrink: 0;
}

.dropdown-option input[type="checkbox"]:checked + .checkbox-custom {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-hover) 100%);
  border-color: var(--brand);
}

.dropdown-option input[type="checkbox"]:checked + .checkbox-custom::after {
  content: "✓";
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.option-label {
  flex: 1;
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
}

.dropdown-option input[type="checkbox"]:checked ~ .option-label {
  font-weight: 600;
  color: var(--brand);
}

/* Filter help tip */
.filter-help {
  padding: 12px 18px;
  background: linear-gradient(135deg, #fef3c7 0%, #fef9e6 100%);
  border-left: 4px solid var(--warning);
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 14px;
  color: #92400e;
  box-shadow: 0 2px 4px rgba(253, 171, 61, 0.1);
}

.help-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1.5;
}

.help-icon strong {
  color: #78350f;
}

/* Active filters display */
.active-filters-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 8px;
  margin-bottom: 16px;
  align-items: center;
  min-height: 48px;
}

.active-filters-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 8px;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-hover) 100%);
  color: white;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0, 115, 234, 0.2);
  transition: all 0.2s;
  animation: fadeIn 0.3s ease;
}

.filter-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 115, 234, 0.3);
}

.badge-remove {
  padding: 0;
  margin: 0;
  background: rgba(255, 255, 255, 0.3);
  border: none;
  color: white;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  line-height: 1;
}

.badge-remove:hover {
  background: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.no-filters {
  font-size: 13px;
  color: var(--text-light);
  font-style: italic;
  padding: 4px 0;
}

/* Milestone Summary Section */
.milestone-summary {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 24px 0;
  border: 1px solid var(--border-light);
}

.milestone-summary-header {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

.milestone-summary-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.milestone-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.milestone-card {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 2px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.milestone-card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: var(--brand);
  background: linear-gradient(135deg, #e8f4fd 0%, #f0f8ff 100%);
}

.milestone-card:not(.clickable) {
  opacity: 0.6;
}

.milestone-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  text-align: center;
  line-height: 1.3;
}

.milestone-count {
  font-size: 32px;
  font-weight: 700;
  color: var(--brand);
  margin: 4px 0;
  line-height: 1;
}

.milestone-card.clickable:hover .milestone-count {
  color: var(--brand-hover);
}

.milestone-label {
  font-size: 11px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Icon buttons */
.btn-icon {
  padding: 6px 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
}
.btn-icon:hover {
  background-color: #f0f3f8;
}
.delete.btn-icon:hover {
  background-color: #ffe0e0;
}

/* Document link */
.doc-link {
  text-decoration: none;
  font-size: 20px;
  transition: transform 0.15s ease;
  display: inline-block;
}
.doc-link:hover {
  transform: scale(1.2);
}

.doc-link-text {
  color: var(--brand);
  text-decoration: none;
  font-size: 13px;
  word-break: break-all;
  transition: color 0.15s ease;
}

.doc-link-text:hover {
  color: var(--brand-hover);
  text-decoration: underline;
}
/* Synced top + bottom horizontal scroll for wide lists */
.table-scroll-pair {
  max-width: 100%;
}

.table-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  height: 14px;
  margin-bottom: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--color-bg-lighter);
  scrollbar-width: thin;
}

.table-scroll-top-inner {
  height: 1px;
}

/* Monday.com-inspired table styles */
.table-wrapper {
  background: var(--color-bg-lighter);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--border-light);
  position: relative;
  max-width: 100%;
}

/* Ensure table background extends when scrolling horizontally */
#initiatives-table,
#cr-table {
  background: var(--color-bg-lighter);
  min-width: 100%;
}

#initiatives-table thead,
#cr-table thead {
  background: var(--color-bg-lighter);
  position: sticky;
  top: 0;
  z-index: 20;
}

#initiatives-table thead tr,
#cr-table thead tr {
  background: var(--color-bg-lighter);
}

#initiatives-table thead th,
#cr-table thead th {
  background: var(--color-bg-lighter);
  white-space: normal; /* Allow text wrapping */
  word-wrap: break-word;
  word-break: break-word;
  line-height: 1.4;
  vertical-align: top;
}

/* Horizontal scroll affordance for wide tables */
.table-wrapper::before,
.table-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.table-wrapper::before {
  left: 0;
  box-shadow: 8px 0 12px -8px rgba(15, 23, 42, 0.25);
}

.table-wrapper::after {
  right: 0;
  box-shadow: -8px 0 12px -8px rgba(15, 23, 42, 0.25);
}

.table-wrapper.has-left-shadow::before {
  opacity: 1;
}

.table-wrapper.has-right-shadow::after {
  opacity: 1;
}

.modern-table { 
  width: 100%; 
  min-width: 100%;
  border-collapse: separate; 
  border-spacing: 0; 
  background: var(--color-bg-lighter); 
  font-size: 14px;
  /* Allow user-resized column widths to actually take effect */
  table-layout: fixed;
}

.modern-table thead {
  background: var(--color-bg-lighter);
  position: sticky;
  top: 0;
  z-index: 20;
}

.modern-table thead tr {
  border-bottom: 2px solid var(--border);
  background: var(--color-bg-lighter);
}
th, td { 
  text-align: left; 
  padding: var(--spacing-2) var(--spacing-3); 
  border-bottom: 1px solid var(--color-border-light); 
  font-size: var(--font-size-base);
  vertical-align: middle;
  font-family: var(--font-family-primary);
}

/* Make fixed-layout tables behave nicely when columns are narrowed */
.modern-table th,
.modern-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
.modern-table td {
  white-space: nowrap;
}

.modern-table th {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-steel);
  text-transform: none;
  background: var(--color-bg-lighter);
  padding: var(--spacing-2) var(--spacing-3);
  white-space: normal; /* Allow text wrapping */
  word-wrap: break-word;
  word-break: break-word;
  line-height: 1.4;
  font-size: var(--font-size-small);
  font-family: var(--font-family-primary);
  position: relative;
  vertical-align: top; /* Align text to top when wrapping */
}


.modern-table tbody tr {
  transition: background-color 0.15s ease;
}

.modern-table tbody tr:hover {
  background-color: var(--gray-50);
}

.modern-table th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  transition: background-color 0.15s ease;
}

.modern-table th.sortable:hover {
  background-color: #ecedf5;
  color: var(--brand);
}

.modern-table th.sorted {
  color: var(--brand);
  font-weight: 700;
}

.sort-indicator {
  font-size: 12px;
  margin-left: 4px;
  opacity: 0.5;
}

.modern-table th.sorted .sort-indicator {
  opacity: 1;
  color: var(--brand);
}
thead th { 
  background: #f8fafc; 
  font-size: 12px; 
  text-transform: uppercase; 
  letter-spacing: 0.05em; 
  color: var(--muted);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
tbody tr { transition: all 0.2s; }
tbody tr:hover { background: var(--gray-50); }

/* Status-based row coloring - removed for cleaner look */
tbody tr.status-at-risk { 
  border-left: 3px solid var(--warning);
}

tbody tr.status-delayed { 
  border-left: 3px solid var(--danger);
}

tbody tr.status-live { 
  border-left: 3px solid var(--brand);
}
.muted { color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* Roles Management Grid */
.roles-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.role-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0;
  box-shadow: var(--shadow);
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.role-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--brand);
}

.role-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 2px solid var(--border-light);
}

.role-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  text-transform: capitalize;
}

.role-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  background: var(--brand);
  color: white;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
}

.role-users-list {
  max-height: 500px;
  overflow-y: auto;
  padding: 12px;
}

.role-user-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--gray-50);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.role-user-item:hover {
  background: var(--gray-100);
  border-color: var(--brand);
  transform: translateX(2px);
}

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

.role-user-info {
  flex: 1;
  min-width: 0;
}

.role-user-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-user-email {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-select {
  flex-shrink: 0;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 140px;
}

.role-select:hover {
  border-color: var(--brand);
  background: white;
}

.role-select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0, 115, 234, 0.1);
}

.role-empty-state {
  padding: 20px;
  text-align: center;
}

.card { 
  border: 1px solid var(--color-border-light); 
  border-radius: var(--radius-lg); 
  padding: var(--spacing-4); 
  background: var(--color-bg-white);
  box-shadow: var(--elevation-sm);
  box-sizing: border-box;
  overflow: visible;
}
.clickable-card {
  transition: transform 0.2s, box-shadow 0.2s;
}

.clickable-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.clickable-chart-item {
  transition: background-color 0.2s;
}

.clickable-chart-item:hover {
  background-color: #e2e8f0 !important;
}

/* Modal styles for initiatives popup */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.2s ease-out;
  overflow-y: auto;
}

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

.initiatives-modal {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 900px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.3s ease-out;
  margin: auto;
  box-sizing: border-box;
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  box-sizing: border-box;
  width: 100%;
  flex-shrink: 0;
}

.modal-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.modal-subtitle {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
}

.modal-close-btn {
  background: var(--gray-100);
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s;
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: var(--gray-200);
  transform: scale(1.05);
}

.modal-close-btn:active {
  transform: scale(0.95);
}

.initiatives-modal .modal-content {
  padding: 16px 24px 24px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 200px;
  /* Override generic modal-content constraints */
  width: 100%;
  max-width: 100%;
  background: var(--surface);
  border-radius: 0;
  box-shadow: none;
  box-sizing: border-box;
}

.initiatives-modal .initiative-card-modal:first-child {
  margin-top: 0;
}

.initiatives-modal .initiative-card-modal:last-child {
  margin-bottom: 0;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
}

.empty-state-subtext {
  font-size: 14px;
  color: var(--muted);
}

.initiative-card-modal {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: visible;
  margin-bottom: 12px;
  width: 100%;
  box-sizing: border-box;
}

.initiative-card-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--brand);
  transform: scaleY(0);
  transition: transform 0.3s ease;
}

.initiative-card-modal:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 115, 234, 0.15);
  border-color: var(--brand);
}

.initiative-card-modal:hover::before {
  transform: scaleY(1);
}

.initiative-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 16px;
}

.initiative-card-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--brand);
  line-height: 1.3;
  flex: 1;
  transition: color 0.2s;
}

.initiative-card-modal:hover .initiative-card-title {
  color: var(--brand-hover);
}

.initiative-card-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 0;
}

.initiative-card-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.initiative-card-section:last-child {
  margin-bottom: 0;
}

.initiative-card-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.initiative-card-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
  min-height: 20px;
  padding: 8px 0;
  display: block;
}

.initiative-card-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: flex-end;
}

.initiative-card-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.initiative-card-modal:hover .initiative-card-link {
  color: var(--brand-hover);
  transform: translateX(4px);
}

.kpis { 
  display: grid; 
  gap: 16px; 
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
}

/* CR Dashboard — compact KPI row */
.kpis.cr-dashboard-kpis {
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.kpis.cr-dashboard-kpis .card {
  padding: 10px 12px;
}

.kpis.cr-dashboard-kpis .muted {
  font-size: 11px;
  line-height: 1.3;
}

.kpis.cr-dashboard-kpis .cr-kpi-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  margin-top: 2px;
}

.kpis.cr-dashboard-kpis .cr-kpi-sub {
  font-size: 10px;
  margin-top: 4px;
  line-height: 1.35;
}

.kpis.cr-dashboard-kpis .cr-kpi-aging-main {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}

.kpis.cr-dashboard-kpis .cr-kpi-aging-side {
  font-size: 10px;
  line-height: 1.35;
  text-align: right;
}

.kpis.cr-dashboard-kpis .cr-kpi-aging-label {
  font-size: 9px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.35px;
}

/* Sortable + resizable columns */
th.sortable { 
  cursor: pointer; 
  user-select: none; 
  transition: all 0.2s;
  position: relative;
}
th.sortable:hover { background: #f1f5f9; }
th { 
  position: relative; 
  white-space: normal; /* Allow text wrapping */
  word-wrap: break-word;
  word-break: break-word;
  line-height: 1.4;
  vertical-align: top;
}
.col-resize { 
  position: absolute; 
  top: 0; 
  right: 0; 
  width: 8px; 
  height: 100%; 
  min-height: 100%; /* Ensure it covers full header height even when wrapped */
  cursor: col-resize;
  background: rgba(15, 23, 42, 0.08);
  transition: background 0.2s;
  z-index: 10;
  pointer-events: auto;
}
.col-resize:hover { 
  background: var(--brand); 
  width: 10px;
}

/* Expandable table cells (Description / Remark) */
td.cell-expandable .cell-full { display: none; }
td.cell-expandable .cell-toggle {
  margin-left: 8px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
}
td.cell-expandable .cell-toggle:hover { text-decoration: underline; }

td.cell-expandable.expanded .cell-short { display: none; }
td.cell-expandable.expanded .cell-full { display: inline; }
td.cell-expandable.expanded { white-space: normal; }

/* Status badges */
.status-badge { 
  display: inline-flex; 
  align-items: center; 
  padding: 4px 12px; 
  border-radius: 20px; 
  font-size: 12px; 
  font-weight: 600; 
  text-transform: uppercase;
  letter-spacing: 0.025em;
}
/* Status-based row coloring - case-insensitive (all lowercase) */
.status-not-started { background: #f1f5f9; color: #64748b; }
.status-on-hold { background: #fef3c7; color: #92400e; }
.status-on-track { background: #d1fae5; color: #065f46; }
.status-at-risk { background: #fed7aa; color: #9a3412; }
.status-delayed { background: #fecaca; color: #991b1b; }
.status-live { background: #dbeafe; color: #1e40af; }
.status-cancelled { background: #f3f4f6; color: #6b7280; }
/* Task status enums */
.status-in-progress { background: #d1fae5; color: #065f46; }
.status-cancel { background: #f3f4f6; color: #6b7280; }
.status-done { background: #dbeafe; color: #1e40af; }

/* Priority badges */
.priority-badge { 
  display: inline-flex; 
  align-items: center; 
  padding: 4px 8px; 
  border-radius: 6px; 
  font-size: 11px; 
  font-weight: 700; 
  text-transform: uppercase;
}
/* Priority badges - Monday.com style */
.priority-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.priority-p0 { background: #ffccd7; color: #c4003c; border: 1px solid #e44258; }
.priority-p1 { background: #ffe6cc; color: #c87400; border: 1px solid #fdab3d; }
.priority-p2 { background: #cce5ff; color: #0060b9; border: 1px solid #0073ea; }

/* Status badges - Monday.com style with softer colors */
.status-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 13px;
}
.status-not-started { background: #d1d5db; color: #374151; }
.status-on-hold { background: #fef3c7; color: #92400e; }
.status-on-track { background: #d1fae5; color: #065f46; }
.status-at-risk { background: #fed7aa; color: #9a3412; }
.status-delayed { background: #fecaca; color: #991b1b; }
.status-live { background: #dbeafe; color: #1e40af; }
.status-cancelled { background: #e5e7eb; color: #6b7280; }
/* Task status enums */
.status-in-progress { background: #d1fae5; color: #065f46; }
.status-cancel { background: #e5e7eb; color: #6b7280; }
.status-done { background: #dbeafe; color: #1e40af; }

/* Column widths - Monday.com inspired */
.col-ticket { width: 100px; min-width: 90px; font-family: var(--font-family-primary); }
.col-name { width: 200px; min-width: 180px; font-weight: 600; }
.col-name a { 
  color: var(--brand); 
  text-decoration: none; 
  cursor: pointer;
  transition: color 0.2s ease;
}
.col-name a:hover { 
  text-decoration: underline; 
  color: var(--brand-hover);
}
.col-name a:visited {
  color: var(--brand);
}
.col-description { width: 250px; min-width: 200px; max-width: 300px; color: var(--text-light); }
.col-business-impact { width: 250px; min-width: 200px; max-width: 300px; color: var(--text-light); }
.col-priority { width: 90px; min-width: 80px; text-align: center; }
.col-status { width: 130px; min-width: 120px; }
.col-milestone { width: 140px; min-width: 130px; }
.col-department { width: 140px; min-width: 130px; }
.col-start-date { width: 110px; min-width: 100px; font-size: 13px; }
.col-end-date { width: 110px; min-width: 100px; font-size: 13px; }
.col-doc-link { width: 300px; min-width: 250px; word-break: break-all; font-size: 12px; color: var(--text-light); }
.col-remark { width: 180px; min-width: 150px; color: var(--text-light); font-style: italic; }
.col-actions { width: 120px; min-width: 110px; text-align: center; white-space: nowrap; }
.col-timeline { width: 400px; min-width: 350px; }
.col-milestone { width: 130px; min-width: 130px; }
.col-department { width: 120px; min-width: 120px; }
.col-owner { width: 150px; min-width: 150px; }
.col-pic { width: 120px; min-width: 120px; }
.col-date { width: 110px; min-width: 110px; }
.col-impact { width: 300px; min-width: 200px; max-width: 400px; }
.col-remark { width: 200px; min-width: 150px; }
.col-doc { width: 200px; min-width: 150px; }
.col-timeline { width: 300px; min-width: 250px; }
.col-actions { width: 120px; min-width: 120px; }

#search { 
  min-width: 300px; 
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}

/* Form Styles */
.form-container {
  max-width: 1200px;
  margin: 0 auto;
}

.form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding: 24px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.form-header h2 {
  margin: 0;
  font-size: 28px;
  color: var(--text);
}

.initiative-form {
  background: var(--surface);
  padding: 32px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  margin-bottom: 32px;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-section.full-width {
  grid-column: 1 / -1;
}

.form-section h3 {
  margin: 0 0 16px 0;
  font-size: 18px;
  color: var(--text);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
  font-weight: 700;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-field label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.required {
  color: var(--danger);
  font-weight: 700;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  max-width: 100%;
  padding: var(--spacing-2) var(--spacing-3);
  border: 1px solid var(--color-border-medium);
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-family: var(--font-family-primary);
  transition: all var(--animation-duration-base) var(--animation-easing-default);
  box-sizing: border-box;
  min-width: 0;
}

/* Text and email inputs in form fields */
.form-field input[type="text"],
.form-field input[type="email"],
.form-field input[type="url"],
.form-field input[type="search"],
.form-field input[type="tel"],
.form-field input[type="password"] {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
}


.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-primary-default);
  box-shadow: 0 0 0 2px rgba(196, 58, 49, 0.1);
}

.form-field textarea {
  resize: vertical;
  line-height: 1.5;
  overflow-x: auto;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
}

.form-field select {
  overflow-x: auto;
  overflow-y: auto;
}

.form-row-inline {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.form-actions {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  padding-top: 24px;
  border-top: 2px solid var(--border-light);
}

.form-actions button {
  min-width: 140px;
}

/* Legacy form styles */
.form-row { 
  display: grid; 
  grid-template-columns: 180px 1fr; 
  gap: var(--spacing-3); 
  align-items: start;
  margin-bottom: var(--spacing-3);
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}


.form-row:last-child {
  margin-bottom: 0;
}

.form-row label {
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-base);
  color: var(--color-text-charcoal);
  font-family: var(--font-family-primary);
  padding-top: var(--spacing-2);
  min-width: 0; /* Allow label to shrink if needed */
}

.form-row input,
.form-row select,
.form-row textarea {
  padding: var(--spacing-2) var(--spacing-3);
  border: 1px solid var(--color-border-medium);
  border-radius: var(--radius-md);
  background: var(--color-bg-white);
  font-size: var(--font-size-base);
  font-family: var(--font-family-primary);
  color: var(--color-text-charcoal);
  transition: all var(--animation-duration-base) var(--animation-easing-default);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

/* Text and email inputs in form rows - wider fields */
.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="url"],
.form-row input[type="search"],
.form-row input[type="tel"],
.form-row input[type="password"] {
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  min-width: 300px;
}

.form-row textarea {
  overflow-x: auto;
  overflow-y: auto;
  white-space: pre-wrap;
  word-wrap: break-word;
  word-break: break-word;
}

.form-row select {
  overflow-x: auto;
  overflow-y: auto;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
  outline: none;
  border-color: var(--color-primary-default);
  box-shadow: 0 0 0 2px rgba(196, 58, 49, 0.1);
}

.form-row small.muted {
  font-size: var(--font-size-xs);
  color: var(--color-text-steel);
  margin-top: var(--spacing-1);
  grid-column: 2;
}

.form { 
  display: grid; 
  gap: var(--spacing-3);
  width: 100%;
  box-sizing: border-box;
}

.form button.primary {
  margin-top: var(--spacing-2);
  box-sizing: border-box;
}

/* Full width primary button only for main forms, not modals */
.form > button.primary,
.form > div > button.primary:only-of-type {
  width: 100%;
}

/* Form Actions - right-aligned button group */
.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  margin-top: 24px;
}

/* Shared fixed-size button class - enforces EXACT same dimensions for all buttons */
.btn-fixed,
button.btn-fixed,
button.btn-fixed.primary {
  /* Explicit dimensions - override everything */
  width: 140px !important;
  height: 40px !important;
  min-width: 140px !important;
  max-width: 140px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  
  /* Reset padding and line-height for consistent height */
  padding: 0 !important;
  line-height: 38px !important; /* 40px - 2px for border */
  
  /* Typography */
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-family-primary);
  text-align: center;
  
  /* Layout */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 140px;
  
  /* Appearance */
  border-radius: 6px;
  cursor: pointer;
  box-sizing: border-box;
  vertical-align: middle;
}

/* Default (Cancel) button style */
.btn-fixed:not(.primary) {
  background: #F4F4F4;
  color: #2B2B2B;
  border: 1px solid #C4C4C4;
}

.btn-fixed:not(.primary):hover {
  background: #E8E8E8;
}

/* Primary (Create) button style */
button.btn-fixed.primary {
  background: #C43A31;
  color: #FFFFFF;
  border: 1px solid #C43A31;
}

button.btn-fixed.primary:hover {
  background: #9E2C25;
  border-color: #9E2C25;
}

/* Monday.com-inspired Dashboard Styles */
.dashboard {
  padding: 0;
}

.dashboard-header {
  margin-bottom: 24px;
}

.dashboard-header h2 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

/* Insights Section */
.insights-section {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 32px;
  border-radius: 12px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-lg);
  color: white;
}

.insights-header h3 {
  margin: 0 0 24px 0;
  font-size: 22px;
  font-weight: 700;
  color: white;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.insight-card {
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(10px);
  padding: 20px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.insight-card.clickable {
  cursor: pointer;
}

.insight-card:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.insight-card.warning {
  background: rgba(253, 171, 61, 0.2);
  border-color: rgba(253, 171, 61, 0.4);
}

.insight-card.danger {
  background: rgba(228, 66, 88, 0.2);
  border-color: rgba(228, 66, 88, 0.4);
}

.insight-card.success {
  background: rgba(0, 217, 126, 0.2);
  border-color: rgba(0, 217, 126, 0.4);
}

.insight-card.info {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.4);
}

.insight-icon {
  font-size: 32px;
  margin-bottom: 12px;
}

/* Weekly Trend Chart Styles */
.trend-chart-container {
  margin-top: 16px;
}

.trend-chart {
  width: 100%;
}

.trend-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
  padding: 12px;
  background: #f8fafc;
  border-radius: 8px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #475569;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
}

.legend-line {
  width: 24px;
  height: 3px;
  border-radius: 2px;
}

.trend-chart-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.line-chart-container {
  background: #fafbfc;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  overflow-x: auto;
}

.line-chart-svg {
  display: block;
  margin: 0 auto;
}

.trend-line {
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke-width 0.2s ease;
}

.trend-line:hover {
  stroke-width: 4px;
}

.data-point {
  cursor: pointer;
  transition: r 0.2s ease;
}

.data-point:hover {
  r: 6;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.chart-data-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
}

.data-row:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.week-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.week-label {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.trend-indicator {
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  text-align: center;
  min-width: 80px;
}

.trend-up {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.trend-down {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.trend-stable {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.week-values {
  display: flex;
  gap: 16px;
  align-items: center;
}

.value-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 50px;
}

.value-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.value-number {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
}

.trend-chart .no-data {
  text-align: center;
  color: #64748b;
  font-style: italic;
  padding: 40px;
  background: #f8fafc;
  border-radius: 8px;
  border: 2px dashed #cbd5e1;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .trend-legend {
    gap: 12px;
  }
  
  .legend-item {
    font-size: 12px;
  }
  
  .data-row {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  .week-values {
    justify-content: space-around;
  }
  
  .value-item {
    min-width: auto;
  }
}

.no-data {
  text-align: center;
  padding: 40px;
  color: #94a3b8;
  font-style: italic;
}

.insight-label {
  font-size: 13px;
  opacity: 0.9;
  margin-bottom: 8px;
  font-weight: 500;
}

.insight-value {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 4px;
}

.insight-subtext {
  font-size: 12px;
  opacity: 0.8;
}

.recommendations-box {
  background: rgba(255, 255, 255, 0.1);
  padding: 24px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 20px;
}

.recommendations-box h4 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 700;
  color: white;
}

.recommendations-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recommendations-list li {
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.15);
  margin-bottom: 8px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid rgba(255, 255, 255, 0.5);
}

.recommendations-list li:last-child {
  margin-bottom: 0;
}

.insight-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.insight-detail-item {
  background: rgba(255, 255, 255, 0.1);
  padding: 16px;
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.detail-label {
  font-size: 14px;
  font-weight: 600;
  opacity: 0.9;
}

.detail-value {
  font-size: 14px;
  font-weight: 700;
  text-align: right;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.stat-number {
  font-size: 36px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 8px;
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 24px;
}

.dashboard-card {
  background: var(--surface);
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

.dashboard-card h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 20px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

.chart-container {
  min-height: 200px;
}

.bar-item {
  margin-bottom: 16px;
  text-decoration: none;
  color: inherit;
  display: block;
}

.bar-item.clickable {
  cursor: pointer;
  padding: 8px;
  margin-left: -8px;
  margin-right: -8px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.bar-item.clickable:hover {
  background: var(--gray-50);
  transform: translateX(4px);
}

.bar-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.bar-container {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  background: #f0f3f8;
  border-radius: 4px;
  overflow: hidden;
  height: 32px;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand) 0%, #00a8ff 100%);
  border-radius: 4px;
  transition: width 0.5s ease;
  min-width: 24px;
  display: flex;
  align-items: center;
  padding-left: 8px;
}

.bar-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  padding: 0 12px;
  white-space: nowrap;
}

.aging-list, .milestone-list {
  max-height: 400px;
  overflow-y: auto;
}

.aging-item, .milestone-item {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.15s ease;
}

.aging-item:hover, .milestone-item:hover {
  background-color: #f6f7fb;
}

.aging-item:last-child, .milestone-item:last-child {
  border-bottom: none;
}

.project-name {
  font-weight: 600;
  color: var(--text);
  flex: 1;
}

.aging-days {
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  margin-right: 12px;
}

.aging-status {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.milestone-info {
  font-size: 13px;
  color: var(--text-light);
  font-weight: 500;
}

.no-data {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
  font-style: italic;
}

/* Enhanced Project Aging Grid */
.dashboard-card.full-width {
  grid-column: 1 / -1;
}

.aging-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  max-height: 500px;
  overflow-y: auto;
}

.aging-card {
  background: var(--gray-50);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
}

.aging-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  border-color: var(--brand);
}

.aging-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}

.project-name-large {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  flex: 1;
  line-height: 1.4;
}

.aging-badge {
  background: var(--brand);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.aging-value {
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
}

.aging-normal {
  background: #e8f5e8;
  color: #2d5a2d;
}

.aging-warning {
  background: #fff3cd;
  color: #856404;
}

.aging-critical {
  background: #f8d7da;
  color: #721c24;
}

.aging-card-details {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.milestone-badge {
  background: #e0f2fe;
  color: #0369a1;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.dept-badge {
  background: #f3e8ff;
  color: #7c3aed;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

/* Milestone Duration Table - Matrix View */
.milestone-table-wrapper {
  max-height: 600px;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  position: relative;
}

.milestone-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.milestone-table thead {
  position: sticky;
  top: 0;
  background: var(--gray-100);
  z-index: 20;
}

.milestone-table th {
  padding: 14px 20px;
  text-align: center;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  background: var(--gray-100);
}

.milestone-table th.sticky-col {
  position: sticky;
  left: 0;
  z-index: 11;
  text-align: left;
  background: var(--gray-100);
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.05);
  min-width: 200px;
}

.milestone-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background-color 0.15s ease;
}

.milestone-table tbody tr:hover {
  background-color: var(--gray-50);
}

.milestone-table td {
  padding: 12px 20px;
  vertical-align: middle;
  text-align: center;
  border-right: 1px solid var(--border-light);
}

.milestone-table td.sticky-col {
  position: sticky;
  left: 0;
  background: white;
  z-index: 5;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  box-shadow: 2px 0 4px rgba(0, 0, 0, 0.03);
}

.milestone-table tbody tr:hover td.sticky-col {
  background-color: var(--gray-50);
}

/* Sticky key columns so context is preserved while scrolling horizontally */
#initiatives-table th.col-ticket,
#initiatives-table td.col-ticket,
#cr-table th.col-ticket,
#cr-table td.col-ticket {
  position: sticky;
  left: 0;
  z-index: 30;
  background: var(--color-bg-lighter);
}

.milestone-cell {
  font-weight: 500;
}

.milestone-cell.empty {
  color: var(--text-light);
  font-weight: 400;
  opacity: 0.4;
}

.milestone-cell.current-milestone {
  background: #e0f2fe;
}

.milestone-cell.completed-milestone {
  background: #f0f9ff;
}

.duration-value-cell {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 13px;
  background: var(--gray-100);
  color: var(--text);
}

.duration-value-cell.current {
  background: var(--brand);
  color: white;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

/* View Page Styles */
.view-container {
  max-width: 1200px;
  margin: 0 auto;
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding: 24px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.view-header h2 {
  margin: 0;
  font-size: 28px;
  color: var(--text);
}

.view-actions {
  display: flex;
  gap: 12px;
}

.view-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.view-section {
  background: var(--surface);
  padding: 24px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
}

.view-section.full-width {
  grid-column: 1 / -1;
}

.view-section h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  color: var(--text);
  padding-bottom: 12px;
  border-bottom: 2px solid var(--border-light);
}

.view-field {
  display: flex;
  margin-bottom: 16px;
  align-items: flex-start;
}

.view-field:last-child {
  margin-bottom: 0;
}

.view-field label {
  font-weight: 600;
  color: var(--text-light);
  min-width: 150px;
  font-size: 14px;
}

.view-field span {
  color: var(--text);
  font-size: 14px;
}

.view-section p {
  color: var(--text);
  line-height: 1.6;
  margin: 0;
}

/* Remark Content Styling */
.remark-content {
  color: var(--text);
  line-height: 1.8;
  font-size: 14px;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 16px;
  background: var(--gray-50);
  border-radius: 6px;
  border: 1px solid var(--border-light);
}

.remark-date-header {
  font-weight: 700;
  font-size: 15px;
  color: var(--brand);
  margin-top: 16px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--border-light);
}

.remark-date-header:first-child {
  margin-top: 0;
}

.remark-date-content {
  color: var(--text);
  line-height: 1.8;
  font-size: 14px;
  margin-bottom: 12px;
  padding-left: 8px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.doc-path {
  font-family: 'Courier New', monospace;
  font-size: 13px;
  color: var(--text-light);
  background: var(--gray-50);
  padding: 12px 16px;
  border-radius: 6px;
  border: 1px solid var(--border-light);
  word-break: break-all;
  line-height: 1.8;
}

/* Pagination Styles */
.results-info {
  padding: 12px 24px;
  color: var(--text-light);
  font-size: 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border-light);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  margin-top: 24px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.page-btn:hover:not(.disabled):not(.active) {
  background: var(--gray-50);
  border-color: var(--brand);
  color: var(--brand);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.page-btn.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
  cursor: default;
  font-weight: 600;
}

.page-btn.disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.5;
  background: var(--gray-100);
}

.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  color: var(--muted);
  font-weight: 500;
}

.page-info {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  padding: 0 12px;
}

/* Clickable rows */
.clickable-row:hover {
  background: var(--gray-50);
  transform: scale(1.01);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Auth styles */
.auth-card {
  max-width: 550px;
  width: 100%;
  margin: var(--spacing-6) auto;
  padding: var(--spacing-5);
  box-sizing: border-box;
  overflow: visible;
}

.auth-card h2 {
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-charcoal);
  margin: 0 0 var(--spacing-2) 0;
  font-family: var(--font-family-primary);
}

.auth-card p.muted {
  color: var(--color-text-steel);
  font-size: var(--font-size-small);
  margin: 0 0 var(--spacing-4) 0;
}

.tabs {
  display: flex;
  gap: 0;
  margin: var(--spacing-3) 0 0 0;
  border-bottom: 1px solid var(--color-border-light);
  position: relative;
}

.tabs .tab {
  flex: 1;
  padding: var(--spacing-2) var(--spacing-3);
  border: 1px solid var(--color-border-light);
  border-bottom: none;
  background: var(--color-bg-white);
  cursor: pointer;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-primary);
  color: var(--color-text-steel);
  transition: all var(--animation-duration-base) var(--animation-easing-default);
  position: relative;
  margin-bottom: -1px;
}

.tabs .tab:not(:first-child) {
  margin-left: -1px;
}

.tabs .tab:hover {
  background: var(--color-bg-light);
  color: var(--color-text-charcoal);
  z-index: 1;
}

.tabs .tab.active {
  background: var(--color-primary-default);
  color: var(--color-text-white);
  border-color: var(--color-primary-default);
  border-bottom-color: var(--color-bg-white);
  font-weight: var(--font-weight-semibold);
  z-index: 2;
}

.tabs .tab.active:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  border-bottom-color: var(--color-bg-white);
}

.auth-view.hidden {
  display: none;
}

.auth-view {
  margin-top: 0;
  padding-top: var(--spacing-4);
  border-top: 1px solid var(--color-border-light);
  margin-top: -1px;
  width: 100%;
  box-sizing: border-box;
  overflow: visible;
}

.auth-view .form {
  width: 100%;
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

/* --- Management Dashboard (reference-style) --- */
.mgmt-dashboard {
  background: linear-gradient(180deg, #e6eef6 0%, #f7fafc 40%, #eef2f7 100%);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.mgmt-header {
  background: #0b3b5a;
  color: #fff;
  padding: 14px 16px;
  font-weight: 900;
  letter-spacing: 0.5px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.mgmt-header .asof {
  font-weight: 700;
  opacity: 0.95;
}

.mgmt-dept-group-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  padding: 4px 10px 4px 12px;
}

.mgmt-dept-group-filter-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.95;
  white-space: nowrap;
}

.mgmt-dept-group-filter select {
  min-width: 200px;
  max-width: 280px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: #fff;
  color: #0f172a;
  font-weight: 700;
  font-size: 13px;
}

.mgmt-top-row {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
  padding: 12px;
  background: #d7e3ef;
}

.mgmt-status-box {
  background: #ffffffcc;
  border: 1px solid #b6c6d6;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mgmt-status-title {
  font-weight: 800;
  color: #0f172a;
}

.mgmt-status-pill {
  font-weight: 900;
  font-size: 18px;
}

.mgmt-notes-box {
  background: #ffffffcc;
  border: 1px solid #b6c6d6;
  border-radius: 10px;
  padding: 12px;
}

.mgmt-notes-box textarea {
  min-height: 54px;
  max-height: 160px;
}

.mgmt-notes-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}

.mgmt-section {
  margin: 0;
  border-top: 1px solid #b6c6d6;
}

.mgmt-section-title,
.mgmt-box .box-title {
  justify-content: space-between;
}

.mgmt-section-title {
  background: linear-gradient(180deg, #0f5b82 0%, #0b4a6a 100%);
  color: #fff;
  font-weight: 900;
  padding: 10px 12px;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mgmt-section-title-text {
  flex: 1;
  min-width: 0;
}

.mgmt-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.mgmt-box .box-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mgmt-section-title::before {
  content: '';
  width: 4px;
  height: 1.1em;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.85);
  flex-shrink: 0;
}

.mgmt-body {
  padding: 12px;
  background: #e9f1f8;
}

/* --- Management Dashboard: per-section color themes --- */
.mgmt-top-row.mgmt-panel--overview {
  background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 50%, #dbeafe 100%);
  border-bottom: 1px solid #c7d2fe;
}

.mgmt-top-row.mgmt-panel--overview .mgmt-status-box,
.mgmt-top-row.mgmt-panel--overview .mgmt-notes-box {
  border-color: #a5b4fc;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.08);
}

.mgmt-section--warranty {
  border-top-color: #7dd3fc;
  box-shadow: inset 4px 0 0 #0284c7;
}

.mgmt-section--warranty .mgmt-section-title {
  background: linear-gradient(180deg, #0ea5e9 0%, #0369a1 100%);
}

.mgmt-section--warranty .mgmt-body {
  background: linear-gradient(180deg, #e0f2fe 0%, #f0f9ff 100%);
}

.mgmt-section--warranty .mgmt-timeline {
  border-color: #7dd3fc;
}

.mgmt-section--warranty .mgmt-timeline thead th,
.mgmt-section--warranty .mgmt-simple-table thead th {
  background: #bae6fd;
  color: #0c4a6e;
}

.mgmt-section--timeline {
  border-top-color: #a5b4fc;
  box-shadow: inset 4px 0 0 #4f46e5;
}

.mgmt-section--timeline .mgmt-section-title {
  background: linear-gradient(180deg, #6366f1 0%, #4338ca 100%);
}

.mgmt-section--timeline .mgmt-body {
  background: linear-gradient(180deg, #eef2ff 0%, #f5f3ff 100%);
}

.mgmt-section--timeline .mgmt-timeline {
  border-color: #a5b4fc;
}

.mgmt-section--timeline .mgmt-timeline thead th {
  background: #c7d2fe;
  color: #312e81;
}

.mgmt-section--timeline .mgmt-timeline .sticky-col {
  background: #faf5ff;
}

.mgmt-section--timeline .mgmt-percent {
  border-color: #4f46e5;
  color: #4338ca;
}

.mgmt-section--fully-live {
  border-top-color: #6ee7b7;
  box-shadow: inset 4px 0 0 #059669;
}

.mgmt-section--fully-live .mgmt-section-title {
  background: linear-gradient(180deg, #10b981 0%, #047857 100%);
}

.mgmt-section--fully-live .mgmt-body {
  background: linear-gradient(180deg, #d1fae5 0%, #ecfdf5 100%);
}

.mgmt-section--fully-live .mgmt-timeline {
  border-color: #6ee7b7;
}

.mgmt-section--fully-live .mgmt-timeline thead th,
.mgmt-section--fully-live .mgmt-simple-table thead th {
  background: #a7f3d0;
  color: #064e3b;
}

.mgmt-section--not-started {
  border-top-color: #fcd34d;
  box-shadow: inset 4px 0 0 #d97706;
}

.mgmt-section--not-started .mgmt-section-title {
  background: linear-gradient(180deg, #f59e0b 0%, #b45309 100%);
}

.mgmt-section--not-started .mgmt-body {
  background: linear-gradient(180deg, #fef3c7 0%, #fffbeb 100%);
}

.mgmt-section--not-started .mgmt-timeline {
  border-color: #fcd34d;
}

.mgmt-section--not-started .mgmt-timeline thead th,
.mgmt-section--not-started .mgmt-simple-table thead th {
  background: #fde68a;
  color: #78350f;
}

.mgmt-body.mgmt-panel--bottom {
  background: #f1f5f9;
  border-top: 1px solid #cbd5e1;
}

.mgmt-box--cr-funnel {
  border-color: #67e8f9;
  box-shadow: 0 2px 10px rgba(8, 145, 178, 0.12);
}

.mgmt-box--cr-funnel .box-title {
  background: linear-gradient(180deg, #06b6d4 0%, #0e7490 100%);
}

.mgmt-box--cr-funnel .box-body {
  background: linear-gradient(180deg, #cffafe 0%, #ecfeff 100%);
}

.mgmt-box--cr-funnel .mgmt-simple-table thead th {
  background: #a5f3fc;
  color: #164e63;
}

.mgmt-box--risks {
  border-color: #fda4af;
  box-shadow: 0 2px 10px rgba(225, 29, 72, 0.12);
}

.mgmt-box--risks .box-title {
  background: linear-gradient(180deg, #f43f5e 0%, #be123c 100%);
}

.mgmt-box--risks .box-body {
  background: linear-gradient(180deg, #ffe4e6 0%, #fff1f2 100%);
}

.mgmt-box--risks .mgmt-simple-table thead th {
  background: #fecdd3;
  color: #881337;
}

.mgmt-timeline {
  background: #fff;
  border: 1px solid #b6c6d6;
  border-radius: 10px;
  overflow: auto;
}

.mgmt-timeline table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.mgmt-timeline th,
.mgmt-timeline td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 10px;
  font-size: 13px;
}

.mgmt-timeline thead th {
  background: #dbe8f4;
  color: #0f172a;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.mgmt-timeline .sticky-col {
  position: sticky;
  left: 0;
  background: #ffffff;
  z-index: 2;
  min-width: 260px;
  max-width: 360px;
}

.mgmt-timeline .sticky-col .sub {
  display: block;
  color: #64748b;
  font-weight: 700;
  font-size: 11px;
  margin-top: 2px;
}

.mgmt-bar {
  height: 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, #3aa6c8 0%, #2b7aa0 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}

/* Timeline bar colors aligned to Project List status palette */
.mgmt-bar.status-on-track { background: #22c55e; }
.mgmt-bar.status-at-risk { background: #f59e0b; }
.mgmt-bar.status-delayed { background: #ef4444; }
.mgmt-bar.status-live { background: #3b82f6; }

.mgmt-bar-wrap {
  position: relative;
  height: 16px;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
}

.mgmt-percent {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: #fff;
  border: 2px solid #0b4a6a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #0b4a6a;
  margin-left: 10px;
  flex: 0 0 auto;
}

.mgmt-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mgmt-box {
  background: #fff;
  border: 1px solid #b6c6d6;
  border-radius: 10px;
  overflow: hidden;
}

.mgmt-box .box-title {
  background: linear-gradient(180deg, #0f5b82 0%, #0b4a6a 100%);
  color: #fff;
  font-weight: 900;
  padding: 10px 12px;
}

.mgmt-box .box-body {
  padding: 10px 12px;
}

.mgmt-funnel {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items: start;
}

.mgmt-funnel-nums {
  display: grid;
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
}

.mgmt-funnel-nums .n {
  background: #e6f0f8;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  font-weight: 900;
  color: #0f172a;
  font-size: 18px;
}

.mgmt-simple-table {
  width: 100%;
  border-collapse: collapse;
}

.mgmt-simple-table th,
.mgmt-simple-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 10px;
  font-size: 13px;
  vertical-align: top;
}

.mgmt-simple-table thead th {
  background: #dbe8f4;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
}

@media (max-width: 1100px) {
  .mgmt-top-row {
    grid-template-columns: 1fr;
  }
  .mgmt-bottom-grid {
    grid-template-columns: 1fr;
  }
}

.error {
  padding: var(--spacing-3);
  background: #fee2e2;
  color: #991b1b;
  border-radius: var(--radius-md);
  margin: var(--spacing-3) 0;
  border: 1px solid #fecaca;
  font-size: var(--font-size-small);
  font-family: var(--font-family-primary);
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

/* Floating recent activity (Project list + CR list) */
.recent-activity-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none;
}

.recent-activity-root > * {
  pointer-events: auto;
}

.recent-activity-fab {
  position: relative;
  z-index: 1102;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: white;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.45);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.recent-activity-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.55);
}

.recent-activity-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 1098;
}

.recent-activity-backdrop.hidden {
  display: none;
}

.recent-activity-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(440px, 100vw);
  height: 100%;
  max-height: 100dvh;
  background: var(--surface);
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.15);
  z-index: 1099;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-light);
}

.recent-activity-panel.hidden {
  display: none;
}

.recent-activity-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.recent-activity-panel-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.recent-activity-close {
  border: none;
  background: var(--gray-100);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
}

.recent-activity-close:hover {
  background: var(--gray-200);
}

.recent-activity-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 24px;
}

.recent-activity-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.recent-activity-item:last-child {
  border-bottom: none;
}

.recent-activity-item-header {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}

.recent-activity-item-header a {
  color: var(--brand);
  text-decoration: none;
}

.recent-activity-item-header a:hover {
  text-decoration: underline;
}

.recent-activity-item-meta {
  font-size: 12px;
  margin-bottom: 8px;
}

.recent-activity-changes {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.5;
}

.modal-content {
  background: var(--surface);
  border-radius: 8px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

/* Meeting Notes modal polish */
.meeting-note-modal-content {
  max-width: 1180px !important;
  width: 96% !important;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.meeting-note-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

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

.meeting-note-section {
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 14px;
  background: #fafbfd;
  grid-column: 1 / -1;
}

.meeting-note-section h4 {
  margin: 0 0 10px 0;
  font-size: 14px;
  color: var(--text);
  font-weight: 700;
}

.meeting-note-actions-table th,
.meeting-note-actions-table td {
  padding: 8px;
  vertical-align: middle;
}

.meeting-note-actions-table input,
.meeting-note-actions-table select {
  width: 100%;
  min-width: 0;
}

.meeting-note-remove-action-btn {
  color: var(--danger);
}

.meeting-note-email-preview input[disabled] {
  background: #f3f4f6;
  color: #374151;
}

.meeting-note-mention-autocomplete {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  max-height: 220px;
  overflow-y: auto;
}

.meeting-note-mention-autocomplete.hidden {
  display: none !important;
}

.meeting-note-send-email-block {
  grid-column: 1 / -1;
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--gray-50, #f9fafb);
}

.meeting-note-send-email-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
}

.meeting-note-send-email-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.meeting-note-send-email-help {
  margin: 8px 0 0 28px;
  font-size: 13px;
}

.meeting-note-form-actions {
  grid-column: 1 / -1;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
  margin-top: 2px;
}

/* Column Settings Modal Specific Styles */
.column-settings-modal {
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.column-settings-modal .modal-title {
  margin: 0;
  font-size: 20px;
  font-weight: var(--font-weight-bold);
  color: var(--color-text-charcoal);
  font-family: var(--font-family-primary);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--color-border-light);
}

.modal-checkbox-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: 8px;
}

.modal-checkbox-controls .btn-link {
  background: none;
  border: none;
  color: var(--color-primary-default);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-primary);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--animation-duration-base) var(--animation-easing-default);
  text-decoration: none;
}

.modal-checkbox-controls .btn-link:hover {
  background: var(--color-bg-light);
  color: var(--color-primary-hover);
}

.modal-checkbox-controls .btn-link:active {
  transform: scale(0.98);
}

.control-separator {
  color: var(--color-border-medium);
  font-size: var(--font-size-small);
  padding: 0 4px;
}

.column-checkboxes-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 0;
  padding: 0;
}

.column-checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  transition: background-color var(--animation-duration-base) var(--animation-easing-default);
  user-select: none;
}

.column-checkbox-label:hover {
  background-color: var(--color-bg-light);
}

.column-checkbox {
  margin-right: 12px;
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--color-primary-default);
  flex-shrink: 0;
}

.column-checkbox-text {
  font-size: var(--font-size-base);
  color: var(--color-text-charcoal);
  font-family: var(--font-family-primary);
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--color-border-light);
  margin-top: auto;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  font-family: var(--font-family-primary);
  cursor: pointer;
  transition: all var(--animation-duration-base) var(--animation-easing-default);
  border: 1px solid transparent;
  min-width: 100px;
}

.modal-actions .btn-primary {
  background: var(--color-primary-default);
  color: var(--color-text-white);
  border-color: var(--color-primary-default);
}

.modal-actions .btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.modal-actions .btn-secondary {
  background: var(--color-bg-white);
  color: var(--color-text-charcoal);
  border-color: var(--color-border-medium);
}

.modal-actions .btn-secondary:hover {
  background: var(--color-bg-light);
  border-color: var(--color-border-medium);
}

.admin-link.hidden {
  display: none;
}

/* Milestone Graph */
.milestone-graph {
  background: var(--surface);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.milestone-graph h3 {
  margin: 0 0 24px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.milestone-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 20px 0;
}

.milestone-step {
  display: flex;
  align-items: center;
  gap: 8px;
}

.milestone-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--gray-50);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.3s ease;
  cursor: default;
  flex-shrink: 0;
}

.milestone-circle.active {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: scale(1.05);
}

.milestone-name {
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  padding: 0 4px;
  line-height: 1.2;
  margin-bottom: 4px;
}

.milestone-circle.active .milestone-name {
  font-weight: 700;
}

.milestone-count-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  color: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  border: 2px solid var(--surface);
}

.milestone-circle:not(.active) .milestone-count-badge {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.milestone-arrow {
  font-size: 20px;
  color: var(--border);
  font-weight: 300;
  margin: 0 4px;
  transition: all 0.3s ease;
  line-height: 1;
  display: flex;
  align-items: center;
}

.milestone-step:has(.milestone-circle.active) + .milestone-step .milestone-arrow,
.milestone-step:has(.milestone-circle.active) .milestone-arrow {
  transform: scale(1.1);
}

@media (max-width: 768px) {
  .milestone-flow {
    gap: 2px;
    padding: 10px 0;
  }
  
  .milestone-circle {
    width: 70px;
    height: 70px;
  }
  
  .milestone-name {
    font-size: 9px;
    padding: 0 2px;
    margin-bottom: 2px;
  }
  
  .milestone-arrow {
    font-size: 16px;
    margin: 0 2px;
  }
  
  .milestone-count-badge {
    width: 20px;
    height: 20px;
    font-size: 10px;
    top: -4px;
    right: -4px;
  }
}

/* Multi-select Dropdown */
.multi-select-wrapper {
  position: relative;
  display: inline-block;
  vertical-align: top;
}

.multi-select-btn {
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  min-width: 140px;
  max-width: 180px;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.multi-select-btn:hover {
  border-color: var(--brand);
  background: var(--gray-50);
}

.multi-select-btn::after {
  content: '▼';
  font-size: 10px;
  margin-left: 8px;
  opacity: 0.6;
}

.multi-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  max-width: 280px;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  display: none;
  padding: 4px 0;
}

.multi-select-dropdown::-webkit-scrollbar {
  width: 6px;
}

.multi-select-dropdown::-webkit-scrollbar-track {
  background: var(--gray-50);
  border-radius: 3px;
}

.multi-select-dropdown::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 3px;
}

.multi-select-dropdown::-webkit-scrollbar-thumb:hover {
  background: var(--gray-400);
}

.multi-select-dropdown.open {
  display: block;
}

.multi-select-option {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 0;
  transition: background 0.2s;
  font-size: 14px;
  min-height: 40px;
  box-sizing: border-box;
  line-height: 1.4;
}

.multi-select-option:first-child {
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.multi-select-option:last-child {
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

.multi-select-option:hover {
  background: var(--gray-50);
}

.multi-select-option input[type="checkbox"] {
  margin-right: 12px;
  cursor: pointer;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--color-primary-default);
  margin-top: 0;
  margin-bottom: 0;
}

.multi-select-option {
  user-select: none;
}

/* Multi-select search box */
.multi-select-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.multi-select-search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.multi-select-search-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.multi-select-options {
  max-height: 250px;
  overflow-y: auto;
}

/* Searchable Single-Select Dropdown */
.searchable-select-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
}

.searchable-select-btn {
  width: 100%;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
}

.searchable-select-btn:hover {
  border-color: var(--brand);
  background: var(--gray-50);
}

.searchable-select-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchable-select-arrow {
  font-size: 10px;
  margin-left: 8px;
  opacity: 0.6;
}

.searchable-select-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: none;
}

.searchable-select-dropdown.open {
  display: block;
}

.searchable-select-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
}

.searchable-select-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
}

.searchable-select-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.1);
}

.searchable-select-options {
  max-height: 250px;
  overflow-y: auto;
  padding: 4px 0;
}

.searchable-select-option {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.searchable-select-option:hover {
  background: var(--gray-50);
}

.searchable-select-option.selected {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 500;
}

/* Comments Section */
.comment-item {
  transition: background 0.2s;
}

.comment-item:hover {
  background: var(--gray-100) !important;
}

.comment-body {
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Tasks Section */
.task-view {
  margin-top: 16px;
}

.task-view.hidden {
  display: none;
}

.task-view-btn {
  padding: 8px 16px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.task-view-btn:hover {
  background: var(--gray-200);
}

.task-view-btn.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

/* Kanban Board */
.kanban-board {
  min-height: 400px;
}

.kanban-column {
  min-height: 200px;
  max-height: 80vh;
  overflow-y: auto;
}

.kanban-task {
  transition: transform 0.2s, box-shadow 0.2s;
  user-select: none;
}

.kanban-task:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg) !important;
}

.kanban-task.dragging {
  opacity: 0.5;
}

.kanban-column {
  transition: background-color 0.2s;
}

.kanban-column.drag-over {
  background-color: var(--gray-100) !important;
  border: 2px dashed var(--brand);
}

.kanban-tasks {
  min-height: 100px;
}

/* Gantt Chart */
#gantt-container {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.gantt-task-bar {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-task-bar:hover {
  z-index: 20;
}

#gantt-chart {
  position: relative;
}

