/* Board Page Styles */
:root {
  --card-collapse-height: 160px;
  --card-bg-color: white;
}

.board-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-color);
}

.board-header h3 {
  margin: 0;
  font-size: 28px;
  color: var(--text-bold);
}

.board-actions {
  display: flex;
  gap: 10px;
}

.board-assignee-filter-row {
  width: 100%;
  display: flex;
  justify-content: center;
}

.board-assignee-filter-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto;
  max-width: 100%;
  padding: 8px 10px;
  min-height: 44px;
  margin-bottom: 10px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--background-light);
}

.board-assignee-filter-users {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  padding: 2px 0;
  padding-bottom: 2px;
}

.assignee-filter-avatar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.assignee-filter-avatar-btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-color);
}

.assignee-filter-avatar-btn.selected {
  border: 2px solid var(--primary-color);
  box-shadow: none;
}

.assignee-filter-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.assignee-filter-avatar-unassigned {
  background: var(--secondary-color);
}

.assignee-filter-secondary-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 8px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  flex: 0 0 auto;
}

.assignee-filter-secondary-toggle input[type="checkbox"] {
  margin: 0;
}

/* Button Styles */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

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

.btn-secondary:hover {
  background-color: var(--text-muted);
}

.columns-container {
  display: flex;
  gap: 20px;
  overflow-x: auto;
  padding-bottom: 20px;
  min-height: calc(100vh - 190px);
  justify-content: safe center;
  color-scheme: light;
}

@media (max-width: 900px) {
  .board-assignee-filter-bar {
    gap: 8px;
    padding: 6px 8px;
  }

  .assignee-filter-secondary-toggle {
    font-size: 11px;
  }
}

.add-column-placeholder {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  align-self: flex-start;
  margin-top: 15px;
  padding: 15px;
  background: var(--background-light);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.add-column-placeholder .btn {
  width: auto;
  min-width: 220px;
  padding: 15px 20px;
  font-size: 16px;
  background-color: rgba(52, 152, 219, 0.1);
  color: var(--primary-color);
  border: 2px dashed var(--primary-color);
  transition: all 0.3s;
}

.add-column-placeholder .btn:hover {
  background-color: var(--primary-color);
  color: white;
  border-style: solid;
}

.column {
  flex: 0 0 300px;
  min-width: 300px;
  max-width: 300px;
  background: var(--background-light);
  border-radius: 8px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 250px);
  transition: opacity 0.2s;
}

.column.dragging-column {
  opacity: 0.5;
  cursor: grabbing;
}

.column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border-color);
}

.column-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.column-header h4 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-bold);
}

.card-count {
  font-size: 14px;
  font-weight: normal;
  color: var(--text-muted);
  margin-left: 4px;
}

.column-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.column-edit-btn {
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.column-edit-btn:hover {
  transform: scale(1.2);
  color: var(--primary-hover);
}

.column-move-left-btn,
.column-move-right-btn {
  background: none;
  border: none;
  color: var(--secondary-color);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.column-move-left-btn:hover,
.column-move-right-btn:hover {
  transform: scale(1.2);
  color: var(--text-bold);
}

.column-delete-cards-btn {
  background: none;
  border: none;
  color: var(--warning-color);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.column-delete-cards-btn:hover {
  transform: scale(1.2);
  color: var(--warning-color);
}

.column-add-card-btn {
  background: none;
  border: none;
  color: var(--success-color);
  font-size: 20px;
  font-weight: bold;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.column-add-card-btn:hover {
  transform: scale(1.2);
  color: var(--success-color);
}

/* Column Menu */
.column-menu-wrapper {
  position: relative;
}

.column-menu-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.column-menu-btn:hover {
  color: var(--text-bold);
  transform: scale(1.2);
}

.column-menu-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--page-panel-background);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  z-index: 1000;
  min-width: 180px;
  margin-top: 4px;
}

.column-menu-dropdown.show {
  display: block;
}

.column-menu-item {
  width: 100%;
  background: none;
  border: none;
  padding: 10px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-bold);
  transition: background-color 0.2s;
}

.column-menu-item:hover {
  background-color: var(--background-light);
}

.column-menu-item span:first-child {
  font-size: 16px;
  width: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Override any standalone button styles when buttons are in menu */
.column-menu-dropdown .column-delete-cards-btn,
.column-menu-dropdown .column-delete-btn {
  all: unset;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text-bold);
  transition: background-color 0.2s;
  box-sizing: border-box;
}

.column-menu-dropdown .column-delete-cards-btn:hover,
.column-menu-dropdown .column-delete-btn:hover {
  background-color: var(--background-light);
}

.column-menu-dropdown .column-delete-cards-btn span:first-child,
.column-menu-dropdown .column-delete-btn span:first-child {
  font-size: 16px;
  width: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.column-menu-item .icon-span {
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.column-menu-item .icon-span svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}

/* Delete column button - only applies when NOT in menu */
.column-header > .column-actions > .column-delete-btn {
  background: none;
  border: none;
  color: var(--error-color);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.column-header > .column-actions > .column-delete-btn:hover {
  transform: scale(1.3);
  color: var(--error-hover);
}

.column-cards {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color-scheme: light;
}

/* Column cards scrollbar styling */
.column-cards::-webkit-scrollbar {
  width: 8px;
}

.column-cards::-webkit-scrollbar-track {
  background: var(--background-light);
  border-radius: 4px;
}

.column-cards::-webkit-scrollbar-thumb {
  background: var(--secondary-color);
  border-radius: 4px;
  border: 2px solid var(--background-light);
}

.column-cards::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.column-cards .add-card-btn {
  width: 100%;
  padding: 10px;
  font-size: 14px;
  margin-top: 0;
}

/* Card Styles */
.card {
  background: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 12px;
  cursor: grab;
  transition: all 0.2s;
  position: relative;
}

.card.collapsed .card-content-wrapper {
  max-height: var(--card-collapse-height);
  overflow: hidden;
  position: relative;
}

.card.collapsed .card-content-wrapper::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--card-bg-color));
  pointer-events: none;
}

.card-expand-btn {
  width: 100%;
  margin-top: 8px;
  padding: 4px 8px;
  background: none;
  border: none;
  color: var(--primary-color);
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
  display: none;
}

.card.has-overflow .card-expand-btn {
  display: block;
}

.card-expand-btn:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.card-assignee-avatar {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  user-select: none;
  pointer-events: none;
  line-height: 1;
}

.card.card--has-assignee {
  padding-bottom: 38px;
}

.primary-assignee-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}

.secondary-assignee-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 2px;
}

.primary-assignee-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--page-panel-background);
  color: var(--text-color);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

.secondary-assignee-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--page-panel-background);
  color: var(--text-color);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

.primary-assignee-option:hover {
  border-color: var(--primary-color);
}

.primary-assignee-option:focus-visible {
  outline: 2px solid var(--text-bold);
  outline-offset: 2px;
}

.secondary-assignee-option:hover {
  border-color: var(--primary-color);
}

.secondary-assignee-option:focus-visible {
  outline: 2px solid var(--text-bold);
  outline-offset: 2px;
}

.primary-assignee-option:active {
  transform: translateY(1px);
}

.secondary-assignee-option:active {
  transform: translateY(1px);
}

.secondary-assignee-option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  border-color: var(--border-color);
}

.primary-assignee-option.selected {
  border: 2px solid var(--primary-color);
  background: color-mix(in srgb, var(--primary-color) 10%, var(--page-panel-background));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 45%, transparent);
}

.secondary-assignee-option.selected {
  border: 2px solid var(--primary-color);
  background: color-mix(in srgb, var(--primary-color) 10%, var(--page-panel-background));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 45%, transparent);
}

.user-avatar-chip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.unassigned-chip {
  background: var(--secondary-color);
}

.primary-assignee-name {
  font-size: 13px;
  line-height: 1.2;
  word-break: break-word;
}

.modal-content.assignee-modal-content {
  max-width: 480px;
}

.modal-content.board-owner-modal-content {
  max-width: 480px;
}

.board-owner-current {
  margin-bottom: 12px;
}

.assignee-modal-section {
  margin-top: 16px;
}

.assignee-modal-empty-state {
  margin: 0;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.card:active {
  cursor: grabbing;
}

.card.dragging {
  opacity: 0.5;
  transform: rotate(2deg);
  cursor: grabbing;
  max-width: 270px;
}

/* Card update states */
.card.updating {
  position: relative;
}

.card.updating::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: color-mix(in srgb, var(--card-bg-color) 85%, transparent);
  border-radius: 8px;
  z-index: 10;
}

.card.updating::before {
  content: "⏳";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 24px;
  z-index: 11;
  animation: pulse 1s ease-in-out infinite;
}

.card.update-success {
  animation: successFlash 0.5s ease-in-out;
}

.card.update-failed {
  animation: errorShake 0.5s ease-in-out;
  border: 2px solid var(--error-color, #e74c3c);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.6; transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes successFlash {
  0%, 100% { background-color: var(--card-bg-color, white); }
  50% { background-color: color-mix(in srgb, var(--success-color) 20%, var(--card-bg-color)); border-color: var(--success-color, #28a745); }
}

@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

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

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

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

.card.dragging:hover {
  box-shadow: none;
  transform: rotate(2deg);
}

.card.archived-card {
  opacity: 0.7;
  background: var(--background-light);
}

.card.no-schedule {
  border: 2px dashed var(--warning-color);
  background: color-mix(in srgb, var(--warning-color) 10%, var(--card-bg-color));
}

.card.no-schedule::before {
  content: "⚠️ No Schedule";
  position: absolute;
  top: 8px;
  right: 40px;
  font-size: 10px;
  font-weight: 600;
  color: var(--warning-color);
  background: var(--card-bg-color);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--warning-color);
}

.card-action-buttons {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 8px;
  opacity: 1 !important;
  transition: all 0.2s;
  pointer-events: auto;
  -webkit-user-drag: none;
  user-drag: none;
  z-index: 10;
}

.card-delete-btn,
.card-move-btn,
.card-archive-btn,
.card-unarchive-btn {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  opacity: 1 !important;
  visibility: visible !important;
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: auto;
  z-index: 10;
  position: relative;
}

.card-delete-btn {
  color: var(--error-color);
  font-size: 20px;
}

.card-move-btn {
  display: none;
  color: var(--secondary-color);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  align-items: center;
  justify-content: center;
  top: -1px;
}

.card-delete-btn:hover {
  transform: scale(1.2);
  color: var(--error-color);
  opacity: 0.8;
}

.card-move-btn:hover {
  transform: scale(1.2);
  color: var(--text-bold);
}

.card-archive-btn,
.card-unarchive-btn {
  color: var(--primary-color);
}

.card-archive-btn svg,
.card-unarchive-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--primary-color);
}

.card-archive-btn:hover,
.card-unarchive-btn:hover {
  transform: scale(1.2);
}

.card-archive-btn:hover svg,
.card-unarchive-btn:hover svg {
  stroke: var(--primary-hover);
}

.card-title {
  margin: 0 0 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-bold);
  padding-right: 60px; /* Space for archive + delete buttons */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.card-title a,
.card-description a,
.card-checklist-name a {
  color: var(--primary-color);
  text-decoration: underline;
  word-break: break-all;
}

.card-title a:hover,
.card-description a:hover,
.card-checklist-name a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.card-description {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  /* Truncate to max 1 line */
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
  max-height: 1.4em; /* 1 line * 1.4 line-height */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Card Checklist Styles */
.card-checklist {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.card-checklist-summary {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.card-description:not(:empty) + .card-meta-row {
  margin-top: 10px;
}

/* Card meta row - contains timestamp and comments */
.card-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.card-comments-indicator {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.card-checklist-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  font-size: 12px;
}

.card-checklist-checkbox {
  width: 14px;
  height: 14px;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}

.card-checklist-name {
  color: var(--text-bold);
  line-height: 1.3;
  overflow-wrap: break-word;
}

.card-checklist-name.checked {
  text-decoration: line-through;
  color: var(--text-muted);
}

/* Card timestamp display */
.card-timestamp {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  cursor: help;
  font-weight: 500;
  margin-left: auto;
}

.card-timestamp:hover {
  color: var(--text-bold);
}

.add-card-empty-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
}

/* Textarea for description in modals */
.form-group textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-size: 16px;
  font-family: inherit;
  box-sizing: border-box;
  resize: vertical;
  word-wrap: break-word;
  overflow-wrap: break-word;
  background-color: var(--card-bg-color);
  color: var(--text-color);
}

.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.empty-board-panel {
  background-color: var(--page-panel-background);
  border-radius: 8px;
  padding: 80px 30px;
  margin: 20px auto;
  max-width: 800px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.empty-board {
  text-align: center;
  padding: 0;
  color: var(--text-muted);
}

.empty-board-icon {
  font-size: 72px;
  margin-bottom: 20px;
}

.empty-board h3 {
  color: var(--secondary-color);
  font-weight: 400;
  margin-bottom: 10px;
}

.empty-board p {
  margin-bottom: 25px;
  font-size: 16px;
}

.loading-board {
  text-align: center;
  padding: 60px;
  color: var(--text-muted);
  font-size: 18px;
}

/* Scrollbar styling */
.columns-container::-webkit-scrollbar {
  height: 10px;
}

.columns-container::-webkit-scrollbar-track {
  background: var(--background-light);
  border-radius: 4px;
}

.columns-container::-webkit-scrollbar-thumb {
  background: var(--secondary-color);
  border-radius: 4px;
  border: 2px solid var(--background-light);
}

.columns-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Modal Styles */
.modal {
  display: flex;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  align-items: center;
  justify-content: center;
}

.modal-content {
  background-color: var(--page-panel-background);
  padding: 30px;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 20px;
  color: var(--text-bold);
}

.modal-description {
  color: var(--text-color);
  margin: 0 0 20px;
  line-height: 1.5;
}

.archive-after-input-row {
  display: flex;
  gap: 10px;
}

.archive-after-input-row input,
.archive-after-input-row select {
  flex: 1;
}

.archive-after-preview {
  margin-top: 20px;
  padding: 15px;
  background: var(--background-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.archive-after-preview-title {
  margin: 0 0 10px;
  font-size: 0.9em;
  color: var(--text-secondary);
}

.archive-after-preview-empty {
  margin: 0;
  color: var(--text-secondary);
  font-style: italic;
}

.archive-after-preview-card {
  padding: 10px;
  background: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--primary-color);
  border-radius: 4px;
}

.archive-after-preview-card-title {
  margin-bottom: 5px;
  font-weight: 600;
  color: var(--text-bold);
}

.archive-after-preview-card-meta {
  font-size: 0.85em;
  color: var(--text-secondary);
}

.archive-after-preview-card-summary {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
  font-size: 0.85em;
  color: var(--text-color);
}

.modal-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-color);
  gap: 15px;
}

.modal-header h2 {
  margin: 0;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 .card-ref-number {
  font-size: 0.6em;
  font-weight: normal;
  color: var(--text-muted);
  margin-left: 10px;
  white-space: nowrap;
}

.modal-header-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  width: 100%;
  justify-content: flex-end;
  align-items: center;
}

.modal-header-actions .btn {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  opacity: 1 !important;
  visibility: visible !important;
}

.form-group {
  margin-bottom: 20px;
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-bold);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-size: 16px;
  box-sizing: border-box;
  background-color: var(--card-bg-color);
  color: var(--text-color);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group select:hover {
  border-color: var(--text-muted);
}

.form-group label input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  cursor: pointer;
}

.form-group label {
  cursor: pointer;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 25px;
}

/* Checklist Styles */
.card-modal-content {
  max-width: 600px;
}

.schedule-section {
  margin: 15px 0;
  padding: 15px;
  background-color: var(--background-light);
  border-radius: 8px;
}

.schedule-section .btn {
  display: inline-flex;
  align-items: center;
}

/* Schedule Modal Styles */
.schedule-modal-content {
  max-width: 650px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 10px;
  background-color: var(--background-light);
  border-radius: 5px;
  transition: background-color 0.2s;
}

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

.checkbox-label input[type="checkbox"] {
  width: auto;
  margin: 0 10px 0 0;
  cursor: pointer;
}

.checkbox-label span {
  flex: 1;
}

.next-runs-section {
  margin: 25px 0;
  padding: 20px;
  background-color: var(--background-light);
  border-radius: 8px;
  border: 2px solid var(--border-color);
}

.next-runs-section h3 {
  margin: 0 0 15px 0;
  color: var(--text-bold);
  font-size: 18px;
}

.next-runs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.next-run-item {
  padding: 12px;
  background-color: var(--page-panel-background);
  color: var(--text-color);
  border-radius: 5px;
  border-left: 4px solid var(--primary-color);
  font-weight: 500;
}

.next-runs-loading,
.next-runs-empty,
.next-runs-error {
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

.next-runs-error {
  color: var(--error-color);
}

.btn-danger {
  background-color: var(--error-color);
  color: white;
}

.btn-danger:hover {
  background-color: color-mix(in srgb, var(--error-color) 80%, black);
}

.checklist-section {
  margin: 25px 0;
  padding: 20px;
  background-color: var(--background-light);
  border-radius: 8px;
}

.checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.checklist-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text-bold);
}

.checklist-summary {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: normal;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 14px;
}

#add-checklist-item-top-btn {
  margin-bottom: 10px;
}

.checklist-items {
  margin: 15px 0;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background-color: var(--card-bg-color);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  margin-bottom: 8px;
  transition: all 0.2s;
  cursor: default;
}

.checklist-item:hover {
  border-color: var(--primary-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.checklist-item.dragging {
  opacity: 0.5;
  cursor: move;
}

.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 18px;
  padding: 0 5px;
  user-select: none;
  flex-shrink: 0;
}

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

.checklist-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  flex-shrink: 0;
}

.checklist-item-name {
  flex-grow: 1;
  color: var(--text-bold);
  overflow-wrap: break-word;
}

.checklist-item-name a {
  color: var(--primary-color);
  text-decoration: underline;
  word-break: break-all;
}

.checklist-item-name a:hover {
  color: var(--primary-hover);
}

.checklist-item-input {
  flex-grow: 1;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 5px 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  background-color: var(--card-bg-color);
  color: var(--text-color);
}

.checklist-item-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.checklist-item input:checked + .checklist-item-name {
  text-decoration: line-through;
  color: var(--text-muted);
}

.checklist-item-actions {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.checklist-edit-btn,
.checklist-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 5px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.checklist-edit-btn:hover,
.checklist-delete-btn:hover {
  opacity: 1;
}

.checklist-edit-btn {
  color: var(--primary-color);
}

.checklist-delete-btn {
  color: var(--error-color);
}

/* Card Metadata Section (in modal) */
.card-metadata {
  margin-top: 20px;
  padding: 12px;
  background-color: var(--background-light);
  border-radius: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.card-metadata-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-metadata-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 13px;
}

.card-metadata-value {
  color: var(--text-bold);
  font-size: 13px;
  cursor: help;
}

.card-metadata-value:hover {
  text-decoration: underline;
}

/* Comments Section */
.comments-section {
  margin-top: 30px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

.comments-header {
  margin-bottom: 15px;
}

.comments-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text-bold);
}

.comment-input-container {
  margin-bottom: 20px;
}

#new-comment-input {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 10px;
  outline: none;
  background-color: var(--card-bg-color);
  color: var(--text-color);
}

#new-comment-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

#post-comment-btn {
  display: block;
  margin-left: auto;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.comment-item {
  background-color: var(--background-light);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 12px;
}

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

.comment-date {
  font-size: 12px;
  color: var(--text-muted);
}

.comment-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  opacity: 0.6;
  transition: opacity 0.2s;
  color: var(--error-color);
}

.comment-delete-btn:hover {
  opacity: 1;
}

.comment-text {
  color: var(--text-bold);
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.comment-text a {
  color: var(--primary-color);
  text-decoration: underline;
  word-break: break-all;
}

.comment-text a:hover {
  color: var(--primary-hover);
}

.comment-text.collapsed {
  max-height: 10em; /* ~10 lines */
  overflow: hidden;
  position: relative;
}

.comment-text.collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2em;
  background: linear-gradient(transparent, var(--page-panel-background));
}

.comment-read-more {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  font-size: 14px;
  padding: 5px 0;
  margin-top: 5px;
  text-decoration: underline;
}

.comment-read-more:hover {
  color: var(--primary-hover);
}

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

/* Board Loading Overlay */
.board-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

.board-loading-content {
  background: var(--page-panel-background);
  padding: 22px 32px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: block;
  text-align: center;
}

.board-loading-text {
  font-size: 18px;
  color: var(--text-bold);
  font-weight: 500;
  margin: 0;
  padding: 0;
}
/* Read-only board styles */
.board-readonly-indicator {
  position: fixed;
  top: 70px;
  right: 20px;
  background-color: var(--secondary-color);
  color: white;
  padding: 8px 16px;
  border-radius: 5px;
  font-size: 14px;
  font-weight: 500;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-readonly-indicator::before {
  content: '🔒';
  font-size: 16px;
}

/* Disabled/read-only buttons and controls */
button.readonly-disabled,
.readonly-disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Hide certain elements in read-only mode */
.readonly-hidden {
  display: none !important;
}

/* Grey out cards in read-only mode but keep them clickable for viewing */
.board-readonly .card {
  opacity: 0.95;
}

.board-readonly .card-action-buttons {
  opacity: 0.4;
  pointer-events: none;
}

/* Prevent drag and drop in read-only mode */
.board-readonly .card[draggable="true"] {
  cursor: default;
}

.board-readonly .column[draggable="true"] {
  cursor: default;
}

#board-container {
  min-width: 0;
}

.board-page {
  --mobile-column-width: min(66vw, 248px);
  --mobile-column-width-tight: calc(100vw - 64px);
  --board-mobile-available-height: calc(100dvh - 154px);
}

.columns-container {
  scroll-snap-type: x proximity;
  scroll-padding-inline: 20px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.column,
.add-column-placeholder {
  scroll-snap-align: start;
}

@media (max-width: 900px) {
  .board-page .canvas {
    padding: 10px 8px 2px;
    min-height: calc(100dvh - 68px);
  }

  .board-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    align-items: flex-start;
    gap: 12px;
  }

  .board-header h3 {
    font-size: 22px;
  }

  .board-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .columns-container {
    gap: 12px;
    padding: 4px 0 4px;
    min-height: 0;
    justify-content: flex-start;
    align-items: flex-start;
    scroll-snap-type: none;
    scroll-padding-inline: 0;
    touch-action: none;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--primary-color) 65%, transparent) transparent;
  }

  .column,
  .add-column-placeholder {
    flex: 0 0 var(--mobile-column-width);
    scroll-snap-align: none;
  }

  .column {
    min-width: var(--mobile-column-width);
    max-width: var(--mobile-column-width);
    min-height: var(--board-mobile-available-height, calc(100dvh - 154px));
    padding: 10px;
    max-height: var(--board-mobile-available-height, calc(100dvh - 154px));
    border-radius: 12px;
    align-self: flex-start;
  }

  .add-column-placeholder {
    min-width: var(--mobile-column-width);
    margin-top: 0;
    padding: 8px;
    min-height: 0;
    height: auto;
    align-self: flex-start;
  }

  .add-column-placeholder .btn {
    min-width: 100%;
    min-height: 76px;
    padding: 12px 14px;
  }

  .column-header {
    gap: 10px;
    align-items: flex-start;
  }

  .column-title-group {
    min-width: 0;
    flex: 1;
    flex-wrap: wrap;
  }

  .column-header h4 {
    font-size: 13px;
    overflow-wrap: anywhere;
  }

  .column-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
  }

  .column-cards {
    touch-action: none;
  }

  .column-menu-dropdown {
    max-width: min(80vw, 300px);
  }

  .card {
    padding: 9px 8px;
  }

  .card.dragging {
    max-width: none;
  }

  .card-title {
    font-size: 11px;
    padding-right: 58px;
  }

  .card-description,
  .card-checklist-item,
  .card-checklist-summary,
  .card-comments-indicator,
  .card-timestamp {
    font-size: 10px;
  }

  .card-meta-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .card-action-buttons {
    top: 6px;
    right: 6px;
    gap: 4px;
  }

  .card-delete-btn,
  .card-move-btn,
  .card-archive-btn,
  .card-unarchive-btn {
    width: 24px;
    height: 24px;
    padding: 2px;
  }

  .card-delete-btn {
    font-size: 17px;
    display: none;
  }

  .card-move-btn {
    display: flex;
    font-size: 17px;
  }

  .card-archive-btn {
    display: none;
  }

  .card-archive-btn svg,
  .card-unarchive-btn svg {
    width: 16px;
    height: 16px;
  }

  .columns-container::-webkit-scrollbar {
    height: 4px;
  }

  .columns-container::-webkit-scrollbar-track {
    background: transparent;
  }

  .columns-container::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--primary-color) 65%, transparent);
    border-radius: 999px;
    border: none;
  }

  .columns-container::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--primary-color) 78%, transparent);
  }

  .empty-board-panel {
    padding: 40px 18px;
    margin: 0 auto;
  }

  .board-readonly-indicator {
    position: static;
    width: fit-content;
    max-width: 100%;
    margin: 0 0 10px auto;
  }

  .modal {
    align-items: center;
    justify-content: center;
    padding: max(12px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom));
  }

  .modal-content,
  .card-modal-content,
  .schedule-modal-content {
    width: min(94vw, 620px);
    max-width: min(94vw, 620px);
    min-height: auto;
    max-height: min(84dvh, 760px);
    margin: 0 auto;
    padding: 16px 14px;
    border-radius: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  }

  .modal-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    gap: 12px;
  }

  .modal-header h2 {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    font-size: 20px;
  }

  .modal-header h2 .card-ref-number {
    margin-left: 0;
  }

  .modal-header-actions {
    justify-content: stretch;
    flex-wrap: wrap;
    gap: 8px;
  }

  .modal-header-actions .btn {
    flex: 1 1 120px;
    min-height: 38px;
  }

  .archive-after-input-row,
  .modal-actions {
    flex-direction: column;
  }

  .modal-actions .btn,
  .schedule-section .btn,
  .checklist-section > .btn,
  #add-checklist-item-top-btn,
  #add-checklist-item-bottom-btn,
  #add-checklist-item-initial-btn {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 16px;
  }

  .schedule-section,
  .checklist-section,
  .next-runs-section {
    padding: 16px;
    margin: 18px 0;
  }

  .checklist-header,
  .comment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .checklist-item {
    padding: 10px;
    align-items: flex-start;
  }

  .checklist-item-actions {
    margin-left: auto;
  }

  .card-metadata {
    flex-direction: column;
    gap: 10px;
  }
}

@media (max-width: 640px) {
  .board-page .canvas {
    padding: 8px 4px 1px;
  }

  .columns-container {
    gap: 10px;
    scroll-padding-inline: 0;
    padding-bottom: 1px;
    min-height: 0;
  }

  .column,
  .add-column-placeholder {
    flex-basis: var(--mobile-column-width-tight);
  }

  .column {
    min-width: var(--mobile-column-width-tight);
    max-width: var(--mobile-column-width-tight);
    min-height: var(--board-mobile-available-height, calc(100dvh - 138px));
    max-height: var(--board-mobile-available-height, calc(100dvh - 138px));
  }

  .add-column-placeholder {
    min-width: var(--mobile-column-width-tight);
  }

  .add-column-placeholder .btn {
    min-height: 68px;
  }


@media (max-width: 640px) and (orientation: portrait) {
  .board-page {
    --mobile-column-width-tight: min(58vw, 212px);
  }

  .columns-container {
    gap: 8px;
  }
}
  .modal-content,
  .card-modal-content,
  .schedule-modal-content {
    width: calc(100vw - 14px);
    max-width: calc(100vw - 14px);
    min-height: auto;
    max-height: calc(100dvh - 14px);
    padding: 14px 12px;
    border-radius: 16px;
  }

  .modal-header-actions .btn {
    flex: 1 1 calc(50% - 4px);
    width: auto;
  }

  .form-group input,
  .form-group select,
  .form-group textarea,
  #new-comment-input {
    font-size: 16px;
  }
}