.board-grid {
  width: 100%;
  gap: 0;
}

/* Horizontal viewport for the project board (Kanboard #46).
   Columns have a fixed width and the board shows ~7.5 columns at once,
   with a single shared horizontal scrollbar for all swimlanes. */
:root {
  --kanban-column-width: 200px;
  --kanban-visible-columns: 7.5;
}

.board-swimlanes-scroll {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  max-width: calc(var(--kanban-visible-columns) * var(--kanban-column-width));
}

.board-swimlanes-scroll::-webkit-scrollbar {
  height: 10px;
}

.board-swimlanes-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.swimlane-block {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  margin-bottom: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr;
  position: relative;
  width: fit-content;
}

/* Hide the vertical-resize handle when the swimlane is collapsed so the two
   interactions (collapse/expand vs. vertical resize) stay fully decoupled. */
.swimlane-block.is-collapsed .swimlane-resize-handle {
  display: none;
}

.swimlane-resize-handle {
  height: 8px;
  background: #e5e7eb;
  border-top: 1px solid #d1d5db;
  cursor: ns-resize;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  flex-shrink: 0;
}

.swimlane-resize-handle:hover,
.swimlane-resize-handle.resizing {
  background: #bfdbfe;
}

.swimlane-header {
  border: 1px solid #e5e7eb;
  background: #e5e7eb;
  min-height: 40px;
  padding: 0.35rem 0.7rem;
  box-sizing: border-box;
  /* Freeze the swimlane header bar on the left while the columns scroll
     horizontally inside the unified .board-swimlanes-scroll wrapper. */
  position: sticky;
  left: 0;
  z-index: 20;
  width: 100%;
}

.swimlane-columns {
    padding: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.swimlane-columns > .swimlane-columns-inner,
.swimlane-columns-inner {
    display: flex;
    gap: 0;
    align-items: stretch;
    flex-wrap: nowrap;
    width: fit-content;
    justify-content: flex-start;
    height: 100%;
}



.swimlane-column-card {
  flex: 0 0 auto;
  width: var(--kanban-column-width);
  min-width: var(--kanban-column-width);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: default;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.column-card-header {
  min-height: 20px;
  height: auto;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  margin: 0;
  gap: 0.4rem;
  padding: 0.1rem;
}

.column-card-header:active {
  cursor: grabbing;
}

.column-drag-handle .fw-semibold {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-cell {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  border: none;
  border-radius: 0;
  padding: 0;
  background: #ffffff;
  display: flex;
  flex-direction: column;
}

.kanban-cell.over-limit {
  border-color: #f59e0b;
}

.card-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 auto;
  min-height: 40px;
  max-height: 100%;
  overflow-y: auto;
  padding: 0;
}

.kanban-card {
  background: var(--card-accent, #ffffff);
  border: 2px solid var(--card-border, #9ca3af);
  border-radius: 4px;
  padding: 0.1rem 0.35rem;
  box-shadow: 0 1px 1px rgba(15, 23, 42, 0.04);
  display: flex;
  align-items: center;
  min-height: 26px;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.kanban-card a,
.kanban-card .card-title-text,
.kanban-card .card-id-link,
.kanban-card .card-id-arrow {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.kanban-card[data-color-name="gray"] { --card-accent: #e2e8f0; --card-border: #64748b; }
.kanban-card[data-color-name="red"] { --card-accent: #fecaca; --card-border: #dc2626; }
.kanban-card[data-color-name="orange"] { --card-accent: #fed7aa; --card-border: #ea580c; }
.kanban-card[data-color-name="yellow"] { --card-accent: #fef08a; --card-border: #ca8a04; }
.kanban-card[data-color-name="green"] { --card-accent: #bbf7d0; --card-border: #16a34a; }
.kanban-card[data-color-name="blue"] { --card-accent: #bfdbfe; --card-border: #2563eb; }
.kanban-card[data-color-name="purple"] { --card-accent: #e9d5ff; --card-border: #9333ea; }

.kanban-card[data-position-color-name="gray"] { --card-accent: #e2e8f0; --card-border: #64748b; }
.kanban-card[data-position-color-name="red"] { --card-accent: #fecaca; --card-border: #dc2626; }
.kanban-card[data-position-color-name="orange"] { --card-accent: #fed7aa; --card-border: #ea580c; }
.kanban-card[data-position-color-name="yellow"] { --card-accent: #fef08a; --card-border: #ca8a04; }
.kanban-card[data-position-color-name="green"] { --card-accent: #bbf7d0; --card-border: #16a34a; }
.kanban-card[data-position-color-name="blue"] { --card-accent: #bfdbfe; --card-border: #2563eb; }
.kanban-card[data-position-color-name="purple"] { --card-accent: #e9d5ff; --card-border: #9333ea; }

.card-color-option[data-color-name="gray"] { background-color: #e2e8f0; }
.card-color-option[data-color-name="red"] { background-color: #fecaca; }
.card-color-option[data-color-name="orange"] { background-color: #fed7aa; }
.card-color-option[data-color-name="yellow"] { background-color: #fef08a; }
.card-color-option[data-color-name="green"] { background-color: #bbf7d0; }
.card-color-option[data-color-name="blue"] { background-color: #bfdbfe; }
.card-color-option[data-color-name="purple"] { background-color: #e9d5ff; }

.card-position-color-option[data-position-color-name="gray"] { background-color: #e2e8f0; }
.card-position-color-option[data-position-color-name="red"] { background-color: #fecaca; }
.card-position-color-option[data-position-color-name="orange"] { background-color: #fed7aa; }
.card-position-color-option[data-position-color-name="yellow"] { background-color: #fef08a; }
.card-position-color-option[data-position-color-name="green"] { background-color: #bbf7d0; }
.card-position-color-option[data-position-color-name="blue"] { background-color: #bfdbfe; }
.card-position-color-option[data-position-color-name="purple"] { background-color: #e9d5ff; }

.board-tab-color-option[data-color=""] { background-color: #ffffff; }
.board-tab-color-option[data-color="#e2e8f0"] { background-color: #e2e8f0; }
.board-tab-color-option[data-color="#fecaca"] { background-color: #fecaca; }
.board-tab-color-option[data-color="#fed7aa"] { background-color: #fed7aa; }
.board-tab-color-option[data-color="#fef08a"] { background-color: #fef08a; }
.board-tab-color-option[data-color="#bbf7d0"] { background-color: #bbf7d0; }
.board-tab-color-option[data-color="#bfdbfe"] { background-color: #bfdbfe; }
.board-tab-color-option[data-color="#e9d5ff"] { background-color: #e9d5ff; }

.kanban-card.is-selected {
  background: #fff8b5;
  border-color: #fbbf24;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.18);
}

.kanban-card.is-bulk-move-peer {
  opacity: 0.6;
  pointer-events: none;
}

.app-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.kanban-card-body{
    display:flex;
    align-items:baseline;
    width:100%;
    min-width:0;
}

.card-left{
    margin-right:10px;   /* 8-12px là đẹp */
}

.card-left,
.card-actions {
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
  flex: 0 0 auto;
}

.card-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.2rem 0.25rem;
  min-width: 22px;
  min-height: 22px;
  line-height: 1;
  vertical-align: baseline;
}

.card-title{
    flex:1;
    min-width:0;
    overflow:hidden;
}

.card-title-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-actions{
    display:flex;
    align-items:center;
    gap:.45rem;

    margin-left:auto;
    flex-shrink:0;
}

.card-actions > * {
  flex: 0 0 auto;
}

.card-select-checkbox,
.column-select-checkbox {
  display: none;
  flex: 0 0 auto;
  margin-top: 0.12rem;
}

.select-mode-enabled .card-select-checkbox,
.select-mode-enabled .column-select-checkbox {
  display: inline-block;
}

.card-select-checkbox {
  margin-right: 0.15rem;
}

.column-select-checkbox {
  margin-right: 0.1rem;
}

.column-drag-handle {
  display: flex;
  flex-direction: column;
}

.column-drag-handle .fw-semibold,
.column-drag-handle .small {
  line-height: 1.1;
}

.kanban-card .card-id-link {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 700;
  color: #1f2937;
}

.kanban-card .card-id-arrow {
  display: inline-block;
  flex: 0 0 auto;
  font-size: 0.85rem;
  line-height: 1;
  color: #6b7280;
}

.kanban-card .card-title-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 400;
  color: #111827;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-card-body.has-prefix-title .card-left {
  flex: 1 1 auto;
  min-width: 0;
}

.kanban-card-body.has-prefix-title .card-title {
  display: none;
}

.kanban-card-body.has-prefix-title .card-id-link {
  display: none;
}

.kanban-card .card-prefix-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.88rem;
  font-weight: 400;
  color: #111827;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-card .edit-card-icon {
  flex: 0 0 auto;
  color: #6b7280;
}

.drag-handle {
  cursor: grab;
  user-select: none;
}

.drag-handle:active {
  cursor: grabbing;
}

.add-card-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 0.6rem;
  flex-shrink: 0;
}

.column-menu-btn{
    width:32px;
    height:32px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:none;
    background:transparent;
    border-radius:6px;
}

.column-menu-btn:hover{
    background:#f3f4f6;
}

.column-menu-btn i{
    font-size:1.15rem;
}

.dropdown-menu[data-reparented="true"] {
  position: absolute !important;
  z-index: 9999 !important;
  min-width: 12rem;
}

.column-drag-handle {
    cursor: grab;
    user-select: none;
    flex: 1 1 auto;
    touch-action: none;
    padding: 0.1rem 0;
    min-width: 0;
}

.column-drag-handle:active {
    cursor: grabbing;
}

.attachment-row {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.attachment-row .btn {
  min-width: 86px;
}

#dependencyGraph {
  min-height: 420px;
}

#dependencyGraph canvas {
  border-radius: 8px;
}

#dependencyTabs .nav-link {
  color: #4b5563;
}

#dependencyTabs .nav-link.active {
  color: #0d6efd;
  font-weight: 600;
}

.attachment-dropzone {
  display: flex;
  min-height: 220px;
  border: 2px dashed #cbd5e1;
  border-radius: 1rem;
  background: #f8fafc;
  padding: 1.5rem;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
  cursor: pointer;
}

.attachment-dropzone:hover,
.attachment-dropzone.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
  transform: translateY(-1px);
}

.attachment-dropzone-icon {
  font-size: 2.2rem;
  color: #2563eb;
}

.attachment-dropzone .btn-outline-primary {
  border-radius: 999px;
}

.last-child-border-0 > :last-child {
  border-bottom: 0 !important;
}

/* Board tab bar styles */
.board-tabs-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.board-tabs-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem;
}
.board-tabs {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
}
.board-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.35rem 0.6rem 0.35rem 0.35rem;
  border-radius: 8px 8px 0 0;
  background: #f3f4f6;
  color: #374151;
  font-size: 0.9rem;
  white-space: nowrap;
}
.board-tab.active {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-bottom: 1px solid transparent;
  font-weight: 600;
}
.board-tab.has-color.active {
  filter: brightness(0.92);
}
.board-tab-link {
  color: inherit;
  text-decoration: none;
}
.board-tab-link:hover {
  color: inherit;
  text-decoration: none;
}
.board-tab {
  cursor: grab;
}
.board-tab:active {
  cursor: grabbing;
}
.board-tab .board-tab-link,
.board-tab .board-menu-btn,
.board-tab .dropdown {
  cursor: pointer;
}
.board-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  width: 20px;
  height: 20px;
  border: none;
  background: transparent;
  color: #6b7280;
  line-height: 1;
  cursor: pointer;
}
.board-menu-btn:hover {
  color: #111827;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}
.board-tab.add-tab-btn {
  background: transparent;
  border: none;
  font-weight: 700;
  font-size: 1.15rem;
  width: 36px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.board-tabs::-webkit-scrollbar { height: 8px; }
.board-tabs::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 999px; }

/* Header project switcher pills */
.project-tab {
  min-width: 150px;
  text-align: center;
}

/* Drag-over highlight for board/project tabs */
.board-tab.drag-over,
.project-tab.drag-over {
  background-color: #dc2626 !important;
  color: #ffffff !important;
  border-color: #dc2626 !important;
}
.board-tab.drag-over .board-tab-link,
.project-tab.drag-over {
  color: #ffffff !important;
}
.board-tab.drag-over .board-menu-btn {
  color: #ffffff !important;
}

/* SortableJS inserts a placeholder element into the tab bar while a card is
   being dragged over it. Without Sortable's default CSS loaded, that placeholder
   is fully opaque and looks like an extra tab. Hide it. */
#projectTabs .sortable-ghost.kanban-card,
#boardTabs .sortable-ghost.kanban-card {
  display: none !important;
}

/* Journey step badges on card detail */
.journey-display-badge .journey-dot {
  display: inline-block;
}
