html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Theming variables */
:root {
    --brand-color: #1b6ec2;
    --accent-color: #258cfb;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--brand-color);
}

.btn-primary {
    color: #fff;
    background-color: var(--brand-color);
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--accent-color);
}

.content {
    padding-top: 1.1rem;
}

/* Virtualized rows */
.row.border-bottom { align-items: center; }
.row.border-bottom:nth-child(odd) { background-color: rgba(0,0,0,0.015); }

/* Lightweight skeleton */
.skeleton {
    display: inline-block;
    height: 1em;
    width: 100%;
    background: linear-gradient(90deg, #eee, #f5f5f5, #eee);
    background-size: 200% 100%;
    animation: shine 1.2s infinite;
}
@keyframes shine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Calendar View Styles */
.calendar-container {
    width: 100%;
    max-width: 100%;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #dee2e6;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
}

.calendar-header {
    display: contents;
}

.calendar-day-header {
    background-color: #f8f9fa;
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #6c757d;
    border-bottom: 1px solid #dee2e6;
}

.calendar-body {
    display: contents;
}

.calendar-week {
    display: contents;
}

.calendar-day {
    background-color: #fff;
    min-height: 120px;
    padding: 0.25rem;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
}

.calendar-day:hover {
    background-color: #f8f9fa;
}

.calendar-day.other-month {
    background-color: #f8f9fa;
    color: #6c757d;
}

.calendar-day-empty {
    min-height: 120px;
    border: 1px solid #e9ecef;
    background-color: transparent;
}

.calendar-day.today {
    background-color: #e3f2fd;
    border: 2px solid #2196f3;
}

.calendar-day.has-entries {
    background-color: #e8f5e8;
}

.calendar-day.has-time {
    background-color: #e8f5e8; /* Green for 7+ hours */
}

.calendar-day.overtime {
    background-color: #fff3cd; /* Yellow for 1-6 hours */
}

.calendar-day-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 0.25rem;
    cursor: pointer;
    transition: background-color 0.15s ease-in-out;
}

.calendar-day-header:hover {
    background-color: #e9ecef;
}

.calendar-day-number {
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0;
}

.calendar-add-btn {
    background: none;
    border: none;
    padding: 0.125rem;
    border-radius: 50%;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: #343a40;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    opacity: 0.8;
}

.calendar-add-btn:hover {
    background-color: #e9ecef;
    color: #212529;
    opacity: 1;
}

.calendar-add-btn i {
    line-height: 1;
}

.calendar-time-summary {
    font-size: 0.75rem;
    line-height: 1.2;
}

.time-total {
    font-weight: 600;
    color: #495057;
    font-size: 0.75rem;
    margin: 0;
}

.time-project {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
    padding: 0.125rem 0.25rem;
    background: rgba(0,0,0,0.05);
    border-radius: 3px;
    margin-bottom: 0.125rem;
}

.project-name {
    font-weight: 500;
    color: #495057;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}

.project-hours {
    color: #6c757d;
    font-weight: 600;
}

.time-billable {
    color: #28a745;
}

.time-maintenance {
    color: #ffc107;
}

/* Weekly Grid Styles */
.weekly-grid-container {
    width: 100%;
}

.weekly-grid {
    display: grid;
    grid-template-columns: 120px 1fr 1fr 1fr 1fr 1fr;
    gap: 1px;
    background-color: #dee2e6;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
}

.weekly-header {
    display: contents;
}

.week-label, .hours-label {
    background-color: #f8f9fa;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
}

.weekly-row {
    display: contents;
}

.weekly-row.current-week {
    background-color: #e3f2fd;
}

.weekly-row.has-hours {
    background-color: #fff3cd;
}

.weekly-row.high-hours {
    background-color: #d4edda;
}

.week-cell, .hours-cell {
    background-color: #fff;
    padding: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

.week-cell {
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
}

.week-date {
    font-weight: 600;
    font-size: 0.875rem;
}

.week-range {
    font-size: 0.75rem;
    color: #6c757d;
}

.hours-value {
    font-weight: 600;
    font-size: 0.875rem;
}

.hours-value.full-time {
    color: #28a745;
}

.hours-value.part-time {
    color: #ffc107;
}

.hours-value.low-hours {
    color: #fd7e14;
}

.hours-value.no-hours {
    color: #6c757d;
}

.hours-value.billable {
    color: #28a745;
}

.hours-value.maintenance {
    color: #ffc107;
}

.hours-value.over-hours {
    color: #28a745;
    font-weight: 700;
}

.hours-value.under-hours {
    color: #dc3545;
    font-weight: 700;
}

.hours-value.exact-hours {
    color: #6c757d;
}

.weekly-summary {
    display: grid;
    grid-template-columns: 120px 1fr 1fr 1fr 1fr 1fr;
    gap: 1px;
    background-color: #dee2e6;
    border-top: 2px solid #495057;
    margin-top: 1px;
}

.summary-label {
    background-color: #495057;
    color: #fff;
    padding: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.summary-value {
    background-color: #f8f9fa;
    padding: 0.75rem;
    font-weight: 600;
    text-align: center;
    color: #495057;
}

/* Daily Details Styles */
.daily-summary {
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    padding: 1rem;
}

.summary-card {
    text-align: center;
}

.summary-label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #495057;
}

.summary-value.billable {
    color: #28a745;
}

.summary-value.maintenance {
    color: #ffc107;
}

.summary-value.non-billable {
    color: #6c757d;
}

/* Kanban Board Styles */
.kanban-board-container {
  padding: 1rem;
  background: #f8f9fa;
  min-height: 100vh;
}

.kanban-board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.board-title-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.board-title {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 600;
  color: #2c3e50;
}

.board-meta {
  display: flex;
  gap: 0.5rem;
}

.board-actions {
  display: flex;
  gap: 0.5rem;
}

.kanban-filters {
  background: white;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.kanban-statistics {
  background: white;
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card {
  text-align: center;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 0.5rem;
  border: 1px solid #e9ecef;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.875rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  min-height: 400px;
}

.kanban-board.loading {
  opacity: 0.6;
  pointer-events: none;
}

.kanban-loading {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  text-align: center;
}

.kanban-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  text-align: center;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Kanban Column Styles */
.kanban-column {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 0.75rem;
  padding: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
  position: relative;
}

.kanban-column:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.kanban-column.drag-over {
  border-color: #007bff;
  background: #f8f9ff;
  transform: scale(1.02);
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid #e9ecef;
}

.column-title-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.column-title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: #2c3e50;
}

.column-meta {
  display: flex;
  gap: 0.5rem;
}

.column-actions {
  display: flex;
  gap: 0.25rem;
}

.column-statistics {
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid #e9ecef;
}

.stat-item {
  text-align: center;
}

.stat-item .stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2c3e50;
}

.stat-item .stat-label {
  font-size: 0.75rem;
  color: #6c757d;
  text-transform: uppercase;
}

.wip-progress {
  margin-top: 0.5rem;
}

.kanban-cards {
  min-height: 200px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.kanban-cards.drag-enabled {
  border: 2px dashed transparent;
  transition: border-color 0.2s ease;
}

.kanban-empty-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  color: #6c757d;
  border: 2px dashed #dee2e6;
  border-radius: 0.5rem;
  margin: 1rem 0;
}

.column-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e9ecef;
}

/* Kanban Card Styles */
.kanban-card {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
}

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

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

.kanban-card.selected {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

.kanban-card.priority-high {
  border-left: 4px solid #dc3545;
}

.kanban-card.priority-medium {
  border-left: 4px solid #ffc107;
}

.kanban-card.priority-low {
  border-left: 4px solid #28a745;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.card-title-section {
  flex: 1;
}

.card-id {
  font-size: 0.75rem;
  color: #6c757d;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #2c3e50;
  line-height: 1.3;
  margin: 0;
}

.card-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.kanban-card:hover .card-actions {
  opacity: 1;
}

.card-body {
  margin-bottom: 0.75rem;
}

.card-priority,
.card-sprint,
.card-sequence,
.card-created {
  display: flex;
  align-items: center;
  font-size: 0.8rem;
  color: #6c757d;
  margin-bottom: 0.25rem;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f3f4;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.25rem;
}

.card-assignee,
.card-due-date {
  display: flex;
  align-items: center;
  font-size: 0.75rem;
  color: #6c757d;
}

.card-due-date.overdue {
  color: #dc3545;
  font-weight: 500;
}

.card-edit-mode {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: white;
  border-radius: 0.5rem;
  padding: 1rem;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.edit-form {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.edit-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.card-drag-handle {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  color: #6c757d;
  opacity: 0;
  transition: opacity 0.2s ease;
  cursor: grab;
}

.kanban-card:hover .card-drag-handle {
  opacity: 1;
}

.card-drag-handle:active {
  cursor: grabbing;
}

.card-selection-indicator {
  position: absolute;
  top: -0.5rem;
  right: -0.5rem;
  background: #007bff;
  color: white;
  border-radius: 50%;
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
  .kanban-board {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .kanban-board-header {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }
  
  .board-actions {
    justify-content: center;
  }
  
  .kanban-filters .row {
    flex-direction: column;
  }
  
  .kanban-filters .col-md-3,
  .kanban-filters .col-md-2,
  .kanban-filters .col-md-1 {
    width: 100%;
    margin-bottom: 0.5rem;
  }
}

/* Advanced UI Components Styles */

/* Card Editor Modal */
.modal-backdrop {
  background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
  display: block !important;
}

.modal-dialog {
  max-width: 800px;
}

.tag-input-container {
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 0.75rem;
  background: #f8f9fa;
}

.tag-list {
  min-height: 2rem;
}

.tag-suggestions {
  margin-top: 0.5rem;
}

.comments-container {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 0.75rem;
  background: #f8f9fa;
}

.comment-item {
  padding: 0.5rem;
  border-bottom: 1px solid #e9ecef;
  margin-bottom: 0.5rem;
}

.comment-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}

.comment-body {
  font-size: 0.9rem;
  color: #495057;
}

.attachments-container {
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 0.75rem;
  background: #f8f9fa;
}

.attachment-item {
  display: flex;
  align-items: center;
  padding: 0.5rem;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
}

.template-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Board Customization Panel */
.modal-xl {
  max-width: 1200px;
}

.settings-section {
  padding: 1rem;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  background: #f8f9fa;
}

.nav-pills .nav-link {
  border-radius: 0.375rem;
  margin-bottom: 0.25rem;
  color: #6c757d;
}

.nav-pills .nav-link.active {
  background-color: #007bff;
  color: white;
}

.column-item {
  background: white;
  transition: all 0.2s ease;
}

.column-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

.color-scheme-item {
  border: 2px solid #e9ecef;
  border-radius: 0.5rem;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  background: white;
}

.color-scheme-item:hover {
  border-color: #007bff;
  transform: translateY(-2px);
}

.color-scheme-item.selected {
  border-color: #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

.color-preview {
  width: 100%;
  height: 3rem;
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
}

.scheme-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.scheme-colors {
  display: flex;
  gap: 0.25rem;
}

.color-dot {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid #e9ecef;
}

.template-item,
.permission-item {
  background: white;
  transition: all 0.2s ease;
}

.template-item:hover,
.permission-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.export-section,
.import-section {
  padding: 1rem;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  background: white;
}

/* Advanced Filter Panel */
.advanced-filter-panel {
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 1rem;
}

.filter-header {
  padding: 1rem;
  border-bottom: 1px solid #e9ecef;
  background: #f8f9fa;
  border-radius: 0.5rem 0.5rem 0 0;
}

.filter-content {
  padding: 1rem;
  transition: all 0.3s ease;
  overflow: hidden;
}

.filter-content.collapsed {
  max-height: 0;
  padding: 0 1rem;
}

.filter-content.expanded {
  max-height: 1000px;
}

.filter-section {
  border-bottom: 1px solid #f1f3f4;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}

.filter-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.priority-filters,
.assignee-filters,
.due-date-filters,
.tag-filters {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 0.5rem;
  background: #f8f9fa;
}

.priority-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.priority-badge.priority-high {
  background: #dc3545;
  color: white;
}

.priority-badge.priority-medium {
  background: #ffc107;
  color: #212529;
}

.priority-badge.priority-low {
  background: #28a745;
  color: white;
}

.custom-field-filter {
  padding: 0.5rem;
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  background: #f8f9fa;
}

.query-builder {
  border: 1px solid #e9ecef;
  border-radius: 0.375rem;
  padding: 0.75rem;
  background: #f8f9fa;
}

.query-conditions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.query-condition {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem;
  background: white;
  border: 1px solid #e9ecef;
  border-radius: 0.25rem;
}

.condition-text {
  font-family: monospace;
  font-size: 0.875rem;
}

.filter-results-summary {
  padding: 0.75rem;
  background: #e3f2fd;
  border-radius: 0.375rem;
  border: 1px solid #bbdefb;
}

.search-highlight-info {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: #e8f5e8;
  border-radius: 0.25rem;
  border: 1px solid #c8e6c9;
}

/* Responsive Design for Advanced Components */
@media (max-width: 768px) {
  .modal-xl {
    max-width: 95%;
  }
  
  .color-schemes {
    grid-template-columns: 1fr;
  }
  
  .preset-buttons {
    flex-direction: column;
  }
  
  .query-builder .input-group {
    flex-direction: column;
  }
  
  .query-builder .input-group > * {
    border-radius: 0.375rem !important;
    margin-bottom: 0.5rem;
  }
  
  .query-builder .input-group > *:last-child {
    margin-bottom: 0;
  }
}

/* Drag and Drop Styles */

/* Global drag and drop states */
.drag-active {
  user-select: none;
}

.multi-select-mode {
  cursor: crosshair;
}

/* Draggable card styles */
.draggable-card {
  cursor: grab;
  transition: all 0.2s ease;
}

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

.draggable-card.dragging {
  opacity: 0.5;
  transform: rotate(5deg) scale(1.05);
  z-index: 1000;
  cursor: grabbing;
}

.draggable-card.selected {
  border: 2px solid #007bff;
  box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

/* Drop zone styles */
.drop-zone {
  transition: all 0.2s ease;
  position: relative;
}

.drop-zone.drag-over {
  background: rgba(0,123,255,0.1);
  border: 2px dashed #007bff;
  transform: scale(1.02);
}

.drop-zone.drag-enter {
  background: rgba(0,123,255,0.05);
}

.drop-zone.drop-allowed {
  border-color: #28a745;
  background: rgba(40,167,69,0.1);
}

.drop-zone.drop-forbidden {
  border-color: #dc3545;
  background: rgba(220,53,69,0.1);
}

/* Column reordering styles */
.reorderable-column {
  position: relative;
}

.column-drag-handle {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  font-size: 0.75rem;
  color: #6c757d;
  z-index: 10;
  transition: all 0.2s ease;
}

.column-drag-handle:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.column-drag-handle:active {
  cursor: grabbing;
  background: #dee2e6;
}

/* Drag preview styles */
.drag-preview {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  transform: rotate(5deg);
  opacity: 0.8;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

/* Multi-select styles */
.multi-select-indicator {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1.25rem;
  height: 1.25rem;
  background: #007bff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: bold;
  z-index: 10;
}

/* Touch drag styles for mobile */
.touch-dragging {
  transform: scale(1.1);
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  z-index: 1000;
}

/* Animation classes */
@keyframes dragEnter {
  from {
    transform: scale(1);
    background: transparent;
  }
  to {
    transform: scale(1.02);
    background: rgba(0,123,255,0.1);
  }
}

@keyframes dragLeave {
  from {
    transform: scale(1.02);
    background: rgba(0,123,255,0.1);
  }
  to {
    transform: scale(1);
    background: transparent;
  }
}

.drag-enter-animation {
  animation: dragEnter 0.2s ease forwards;
}

.drag-leave-animation {
  animation: dragLeave 0.2s ease forwards;
}

/* Drop indicator styles */
.drop-indicator {
  height: 2px;
  background: #007bff;
  margin: 0.25rem 0;
  border-radius: 1px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.drop-indicator.active {
  opacity: 1;
}

/* Bulk selection styles */
.bulk-selection-bar {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #007bff;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 2rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.bulk-selection-bar button {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.bulk-selection-bar button:hover {
  background: rgba(255,255,255,0.3);
  border-color: rgba(255,255,255,0.5);
}

/* Undo/Redo button styles */
.undo-redo-buttons {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: 0.5rem;
  z-index: 1000;
}

.undo-redo-buttons button {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid #dee2e6;
  background: white;
  color: #6c757d;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
}

.undo-redo-buttons button:hover:not(:disabled) {
  background: #f8f9fa;
  border-color: #adb5bd;
  color: #495057;
}

.undo-redo-buttons button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Conflict resolution styles */
.conflict-resolution-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: 2000;
}

.conflict-resolution-content {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

/* Mobile-specific drag and drop styles */
@media (max-width: 768px) {
  .draggable-card {
    touch-action: none;
  }
  
  .column-drag-handle {
    width: 2rem;
    height: 2rem;
    font-size: 1rem;
  }
  
  .bulk-selection-bar {
    bottom: 0.5rem;
    left: 0.5rem;
    right: 0.5rem;
    transform: none;
    border-radius: 0.5rem;
  }
  
  .undo-redo-buttons {
    top: 0.5rem;
    right: 0.5rem;
  }
  
  .undo-redo-buttons button {
    width: 2rem;
    height: 2rem;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .kanban-board-container {
    background: #1a1a1a;
  }
  
  .kanban-board-header,
  .kanban-filters,
  .kanban-statistics,
  .kanban-column,
  .kanban-card {
    background: #2d2d2d;
    border-color: #404040;
    color: #e9ecef;
  }
  
  .board-title,
  .column-title,
  .card-title {
    color: #e9ecef;
  }
  
  .stat-value {
    color: #e9ecef;
  }
  
  .modal-content,
  .settings-section,
  .advanced-filter-panel {
    background: #2d2d2d;
    border-color: #404040;
    color: #e9ecef;
  }
  
  .tag-input-container,
  .comments-container,
  .attachments-container,
  .priority-filters,
  .assignee-filters,
  .due-date-filters,
  .tag-filters,
  .custom-field-filter,
  .query-builder {
    background: #3d3d3d;
    border-color: #404040;
  }
  
  .filter-header {
    background: #3d3d3d;
    border-color: #404040;
  }
  
  /* Drag and drop dark mode */
  .draggable-card.selected {
    border-color: #4dabf7;
    box-shadow: 0 0 0 3px rgba(77,171,247,0.25);
  }
  
  .drop-zone.drag-over {
    background: rgba(77,171,247,0.1);
    border-color: #4dabf7;
  }
  
  .drop-zone.drop-allowed {
    border-color: #51cf66;
    background: rgba(81,207,102,0.1);
  }
  
  .drop-zone.drop-forbidden {
    border-color: #ff6b6b;
    background: rgba(255,107,107,0.1);
  }
  
  .column-drag-handle {
    background: #3d3d3d;
    border-color: #404040;
    color: #e9ecef;
  }
  
  .column-drag-handle:hover {
    background: #404040;
    border-color: #495057;
  }
  
  .bulk-selection-bar {
    background: #4dabf7;
  }
  
  .undo-redo-buttons button {
    background: #2d2d2d;
    border-color: #404040;
    color: #e9ecef;
  }
  
  .undo-redo-buttons button:hover:not(:disabled) {
    background: #3d3d3d;
    border-color: #495057;
    color: #f8f9fa;
  }
  
  .conflict-resolution-content {
    background: #2d2d2d;
    color: #e9ecef;
  }
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.skip-link:focus {
    position: static;
    width: auto;
    height: auto;
    margin: .5rem;
}

/* Toast container positioning */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1080;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Legacy-style Search Form */
.search-form-container {
    margin-bottom: 20px;
}

.search-header {
    width: 100%;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-bottom: none;
}

.search-header td {
    padding: 8px 12px;
    border: none;
}

.header-left, .header-right {
    width: 20px;
    background-color: #e9ecef;
}

.header-title {
    background-color: #f8f9fa;
    font-weight: bold;
    text-align: center;
}

.search-form {
    width: 100%;
    border: 1px solid #dee2e6;
    background-color: white;
}

.search-form td {
    padding: 8px;
    vertical-align: top;
    border: none;
}

.field-label {
    font-weight: bold;
    white-space: nowrap;
    padding-right: 8px;
    vertical-align: middle;
}

.status-column {
    background-color: #f8f9fa;
    font-weight: bold;
    text-align: center;
    vertical-align: top;
    padding: 12px 8px;
    border-right: 1px solid #dee2e6;
}

.status-checkboxes {
    background-color: #f8f9fa;
    vertical-align: top;
    padding: 12px 8px;
    border-right: 1px solid #dee2e6;
}

.status-checkboxes div {
    margin-bottom: 4px;
}

.date-search-column {
    background-color: #f8f9fa;
    font-weight: bold;
    vertical-align: top;
    padding: 12px 8px;
    border-right: 1px solid #dee2e6;
}

.action-buttons {
    background-color: #f8f9fa;
    vertical-align: top;
    padding: 12px 8px;
}

.button-section {
    padding: 12px 8px;
    background-color: white;
}

/* Form controls styling to match legacy */
.search-form .form-select,
.search-form .form-control {
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.search-form .form-select {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 2.25rem !important;
}

.search-form .form-select:focus,
.search-form .form-control:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Checkbox styling */
.search-form input[type="checkbox"] {
    margin-right: 4px;
}

/* Button styling to match legacy */
.search-form .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
    border-radius: 0.25rem;
}

.search-form .btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.search-form .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

/* ========================================
   AUTOMATION & ANALYTICS COMPONENTS
   ======================================== */

/* Analytics Dashboard */
.analytics-dashboard {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

.dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.dashboard-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.dashboard-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.date-range-selector {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.date-range-selector label {
    font-weight: 500;
    font-size: 0.9rem;
}

.date-range-selector input {
    padding: 0.375rem 0.75rem;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 0.875rem;
}

.date-range-selector input::placeholder {
    color: rgba(255,255,255,0.7);
}

.view-options {
    display: flex;
    gap: 0.25rem;
}

.view-options .btn {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.view-options .btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

.view-options .btn.active {
    background: rgba(255,255,255,0.9);
    color: #333;
    border-color: white;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--brand-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

.no-data {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.dashboard-content {
    padding: 1.5rem;
}

/* Overview View */
.overview-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
}

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

.metric-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.metric-content h3 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 0.25rem;
}

.metric-trend {
    font-size: 0.8rem;
    font-weight: 500;
}

.metric-trend.positive {
    color: #28a745;
}

.metric-trend.negative {
    color: #dc3545;
}

.metric-trend.neutral {
    color: #6c757d;
}

.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.chart-container {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1.5rem;
}

.chart-container h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: #333;
}

.chart {
    height: 300px;
    background: #f8f9fa;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    font-style: italic;
}

/* Flow Analysis View */
.flow-analysis-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

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

.flow-metric {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.flow-metric h4 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.metric-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-color);
}

.flow-chart {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1.5rem;
}

.flow-table {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1.5rem;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.data-table .created {
    color: #28a745;
    font-weight: 500;
}

.data-table .completed {
    color: #007bff;
    font-weight: 500;
}

.data-table .in-progress {
    color: #ffc107;
    font-weight: 500;
}

.data-table .positive {
    color: #28a745;
    font-weight: 500;
}

.data-table .negative {
    color: #dc3545;
    font-weight: 500;
}

/* Velocity View */
.velocity-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.velocity-summary {
    display: flex;
    justify-content: center;
}

.velocity-metric {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    min-width: 200px;
}

.velocity-metric h3 {
    margin: 0 0 1rem 0;
    color: #666;
    font-weight: 500;
}

.metric-value.large {
    font-size: 3rem;
    font-weight: 700;
    color: var(--brand-color);
    margin-bottom: 0.5rem;
}

.velocity-charts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.team-performance {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1.5rem;
}

.team-performance h3 {
    margin: 0 0 1rem 0;
    color: #333;
}

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

.member-card {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    padding: 1rem;
    text-align: center;
}

.member-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
}

.member-velocity {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--brand-color);
    margin-bottom: 0.25rem;
}

.member-cards {
    font-size: 0.8rem;
    color: #666;
}

/* WIP Analysis View */
.wip-analysis-view {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.wip-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.wip-metric {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
}

.wip-metric h3 {
    margin: 0 0 1rem 0;
    color: #666;
    font-weight: 500;
}

.wip-limit {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

.utilization-bar {
    width: 100%;
    height: 8px;
    background: #e1e5e9;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.utilization-fill {
    height: 100%;
    background: linear-gradient(90deg, #28a745, #ffc107, #dc3545);
    transition: width 0.3s ease;
}

.bottleneck-analysis {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1.5rem;
}

.bottleneck-analysis h3 {
    margin: 0 0 1rem 0;
    color: #333;
}

.bottleneck-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.bottleneck-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.bottleneck-item.over-limit {
    background: #fff5f5;
    border-color: #fed7d7;
}

.bottleneck-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.column-name {
    font-weight: 600;
    color: #333;
}

.wip-count {
    font-size: 0.9rem;
    color: #666;
}

.utilization-percent {
    font-weight: 700;
    color: #333;
}

.wip-trend {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1.5rem;
}

.wip-trend h3 {
    margin: 0 0 1rem 0;
    color: #333;
}

/* Automation Rules Panel */
.automation-rules-panel {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
}

.panel-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.header-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.header-actions .btn {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.header-actions .btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

.header-actions .btn-primary {
    background: rgba(255,255,255,0.9);
    color: #333;
    border-color: white;
}

.header-actions .btn-primary:hover {
    background: white;
}

.panel-content {
    padding: 1.5rem;
}

.rules-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.summary-item .label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.summary-item .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--brand-color);
}

.rules-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.rule-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

.rule-card.enabled {
    border-left: 4px solid #28a745;
}

.rule-card.disabled {
    border-left: 4px solid #6c757d;
    opacity: 0.7;
}

.rule-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.rule-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.rule-info {
    flex: 1;
}

.rule-name {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.rule-description {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.rule-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.rule-toggle {
    display: flex;
    align-items: center;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #28a745;
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.rule-buttons {
    display: flex;
    gap: 0.25rem;
}

.rule-buttons .btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.8rem;
}

.rule-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    font-size: 0.9rem;
}

.rule-trigger,
.rule-conditions,
.rule-actions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rule-trigger .label,
.rule-conditions .label,
.rule-actions-list .label {
    font-weight: 600;
    color: #333;
}

.trigger-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.conditions-list,
.actions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.condition-badge,
.action-badge {
    background: #f8f9fa;
    color: #495057;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid #e1e5e9;
}

.rule-stats {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: #666;
}

.execution-count {
    font-weight: 500;
}

.last-executed {
    font-style: italic;
}

.no-rules {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.no-rules-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-rules h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
}

.no-rules p {
    margin: 0 0 1.5rem 0;
}

/* Card Templates Panel */
.card-templates-panel {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    overflow: hidden;
}

.templates-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 6px;
}

.templates-filter {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 150px;
}

.filter-group label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.template-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 1.5rem;
    transition: all 0.2s ease;
}

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

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.template-info {
    flex: 1;
}

.template-name {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.template-description {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.template-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}

.template-actions .btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.template-menu {
    display: flex;
    gap: 0.25rem;
}

.template-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.template-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.meta-badge {
    background: #f8f9fa;
    color: #495057;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid #e1e5e9;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.meta-badge.priority-low {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.meta-badge.priority-medium {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.meta-badge.priority-high {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.meta-badge.priority-critical {
    background: #f5c6cb;
    color: #721c24;
    border-color: #f1b0b7;
}

.meta-badge.type-bug {
    background: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.meta-badge.type-feature {
    background: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

.meta-badge.type-task {
    background: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.meta-badge.type-story {
    background: #e2e3e5;
    color: #383d41;
    border-color: #d6d8db;
}

.template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tag {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid #bbdefb;
}

.template-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.category-badge {
    background: #f3e5f5;
    color: #7b1fa2;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid #e1bee7;
}

.template-custom-fields {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    padding: 1rem;
}

.template-custom-fields h5 {
    margin: 0 0 0.5rem 0;
    font-size: 0.9rem;
    color: #333;
    font-weight: 600;
}

.custom-fields-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.custom-field {
    display: flex;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.field-name {
    font-weight: 500;
    color: #666;
    min-width: 80px;
}

.field-value {
    color: #333;
}

.no-templates {
    text-align: center;
    padding: 3rem;
    color: #666;
    grid-column: 1 / -1;
}

.no-templates-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.no-templates h4 {
    margin: 0 0 0.5rem 0;
    color: #333;
}

.no-templates p {
    margin: 0 0 1.5rem 0;
}

/* Modal Styles */
.modal-overlay {
    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;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.large {
    max-width: 800px;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e1e5e9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.btn-close {
    border: none;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.btn-close:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.08);
}

.btn-close:focus {
    opacity: 1;
    box-shadow: 0 0 0 0.25rem rgba(0, 0, 0, 0.1);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e1e5e9;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--brand-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(27, 110, 194, 0.25);
}

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

.conditions-section,
.actions-section,
.custom-fields-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.condition-row,
.action-row,
.custom-field-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.condition-row .form-control,
.action-row .form-control,
.custom-field-row .form-control {
    flex: 1;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
    margin: 0;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #ced4da;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: var(--brand-color);
    border-color: var(--brand-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: "✓";
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Dark mode support for automation and analytics */
@media (prefers-color-scheme: dark) {
    .analytics-dashboard,
    .automation-rules-panel,
    .card-templates-panel {
        background: #2d3748;
        border-color: #4a5568;
    }

    .dashboard-header {
        background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
    }

    .panel-header {
        background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    }

    .metric-card,
    .chart-container,
    .flow-metric,
    .flow-chart,
    .flow-table,
    .velocity-metric,
    .team-performance,
    .wip-metric,
    .bottleneck-analysis,
    .wip-trend,
    .rule-card,
    .template-card {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .rule-name,
    .template-name,
    .metric-content h3,
    .chart-container h3,
    .flow-chart h3,
    .flow-table h3,
    .team-performance h3,
    .bottleneck-analysis h3,
    .wip-trend h3 {
        color: #e2e8f0;
    }

    .metric-value,
    .metric-number,
    .metric-value.large,
    .member-name,
    .column-name,
    .utilization-percent {
        color: #e2e8f0;
    }

    .data-table th {
        background: #4a5568;
        color: #e2e8f0;
    }

    .data-table td {
        border-color: #4a5568;
        color: #e2e8f0;
    }

    .bottleneck-item {
        background: #4a5568;
        border-color: #718096;
    }

    .bottleneck-item.over-limit {
        background: #742a2a;
        border-color: #9b2c2c;
    }

    .member-card {
        background: #4a5568;
        border-color: #718096;
    }

    .rules-summary,
    .templates-summary {
        background: #4a5568;
    }

    .summary-item .value {
        color: #63b3ed;
    }

    .template-custom-fields {
        background: #4a5568;
        border-color: #718096;
    }

    .template-custom-fields h5 {
        color: #e2e8f0;
    }

    .modal-content {
        background: #2d3748;
        color: #e2e8f0;
    }

    .modal-header {
        border-color: #4a5568;
    }

    .modal-header h3 {
        color: #e2e8f0;
    }

    .modal-footer {
        border-color: #4a5568;
    }

    .form-control {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }

    .form-control:focus {
        border-color: #63b3ed;
        box-shadow: 0 0 0 0.2rem rgba(99, 179, 237, 0.25);
    }

    .form-group label {
        color: #e2e8f0;
    }

    .checkbox-label {
        color: #e2e8f0;
    }

    .checkmark {
        border-color: #718096;
    }

    .no-rules,
    .no-templates,
    .no-data {
        color: #a0aec0;
    }

    .no-rules h4,
    .no-templates h4 {
        color: #e2e8f0;
    }
}

/* ========================================
   TEXT FORMATTING
   ======================================== */

/* Preserve line breaks and whitespace in text content */
.whitespace-prewrap {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* ========================================
   KANBAN CONTROLS
   ======================================== */

.kanban-controls {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    border: 1px solid #e2e8f0;
}

.kanban-controls .form-label {
    color: #374151;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.kanban-controls .form-select {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kanban-controls .form-select:focus {
    border-color: var(--brand-color);
    box-shadow: 0 0 0 3px rgba(27, 110, 194, 0.1);
}

.kanban-controls .form-select-lg {
    font-size: 1rem;
    padding: 0.75rem 1rem;
}

.kanban-controls .btn-primary {
    background: linear-gradient(135deg, var(--brand-color) 0%, #258cfb 100%);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.kanban-controls .btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(27, 110, 194, 0.3);
}

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

.kanban-controls .btn-outline-secondary {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.kanban-controls .btn-outline-secondary:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.kanban-controls .alert-info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #93c5fd;
    border-radius: 8px;
    color: #1e40af;
}

.kanban-controls .badge {
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
}

/* Dark mode support for kanban controls */
@media (prefers-color-scheme: dark) {
    .kanban-controls {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .kanban-controls .form-label {
        color: #e2e8f0;
    }
    
    .kanban-controls .form-select {
        background-color: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .kanban-controls .form-select:focus {
        border-color: #63b3ed;
        box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.1);
    }
    
    .kanban-controls .alert-info {
        background: linear-gradient(135deg, #2b6cb0 0%, #3182ce 100%);
        border-color: #4299e1;
        color: #bee3f8;
    }
}