.board-page {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  height: 100%;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  background-color: var(--color-surface);
}

.board-page__header {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.board-page__exit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  margin-left: -0.25rem;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

.board-page__exit:hover {
  background-color: var(--color-bg);
  color: var(--color-text);
}

.board-page__meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.board-page__title-line {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.board-page__title {
  font-size: 1.375rem;
  font-weight: 700;
}

.board-page__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.board-page__settings-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.board-page__settings-link:hover {
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

.board-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0 calc(var(--space-md) * -1);
}

.board {
  display: flex;
  gap: var(--space-md);
  overflow-x: auto;
  height: 100%;
  align-items: stretch;
  padding: var(--space-md);
}

.board-wrap__fade {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 56px;
  background: linear-gradient(to right, transparent, var(--color-surface));
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.board-wrap__fade--hidden {
  opacity: 0;
}

.kcol {
  flex: 0 0 280px;
  display: flex;
  flex-direction: column;
  max-height: 100%;
}

.kcol__header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0 var(--space-xs);
  margin-bottom: var(--space-sm);
}

.kcol__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.kcol__title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--color-text);
}

.kcol__count {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.kcol__body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.kcol__list {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-sm);
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 40px;
}

.kcard {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  transition: transform 0.15s ease;
}

.kcard:hover {
  transform: translateY(-1px);
}

.kcard--dragging {
  cursor: grabbing;
  z-index: 300;
  pointer-events: none;
  border-color: var(--color-brand);
  transform: rotate(1.5deg) scale(1.03);
}

.kcard-placeholder {
  border: 2px dashed var(--color-brand);
  border-radius: var(--radius-sm);
  background-color: color-mix(in srgb, var(--color-brand) 8%, transparent);
}

body.board-dragging {
  cursor: grabbing;
}

body.board-dragging * {
  user-select: none;
}

.kcard__id-group {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.kcard__priority {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.kcard__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.kcard__reference {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.kcard__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
}

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

.kcard__meta {
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.kcard__assignee {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-brand), var(--color-brand-hover));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.625rem;
  flex-shrink: 0;
  overflow: hidden;
  margin-left: auto;
}

.kcard__assignee-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-page {
  min-height: 100%;
  padding: var(--space-md) var(--space-lg) var(--space-xl);
  background-color: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.card-panel {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.card-panel__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.card-panel__topbar--end {
  justify-content: flex-end;
}

.card-panel__reference {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-text-muted);
}

.card-panel__body {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: var(--space-xl);
  align-items: start;
}

@media (max-width: 991px) {
  .card-panel__body {
    grid-template-columns: 1fr;
  }
}

.card-panel__body > .bottom-sheet {
  min-width: 0;
}

.card-panel__main {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-width: 0;
}

.card-panel__sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  background-color: var(--color-bg);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}

.bottom-sheet__sheet .card-panel__sidebar {
  background-color: transparent;
  border-radius: 0;
  padding: 0;
}

.card-panel__field {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--color-border);
}

.card-panel__field:first-of-type {
  padding-top: 0;
}

.card-panel__field:last-of-type {
  border-bottom: none;
}

.card-panel__sidebar--form .card-panel__field {
  border-bottom: none;
}

.card-panel__submit[hidden] {
  display: none;
}

.card-panel__submit {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-lg);
}

.card-panel__section-title {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-sm);
}

.card-panel__title-input {
  width: 100%;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.25rem 0;
  font-size: 1.625rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--color-text);
  background: none;
}

.card-panel__title-input:hover {
  border-bottom-color: var(--color-border);
}

.card-panel__title-input:focus {
  outline: none;
  border-bottom-color: var(--color-brand);
}

.card-panel__section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}

.card-panel__section-header .card-panel__section-title {
  margin-bottom: 0;
}

.card-panel__edit-toggle {
  border: none;
  background: none;
  padding: 0;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.card-panel__edit-toggle:hover {
  color: var(--color-brand);
}

.card-panel__edit-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.field__input--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
}

.card-panel__subtasks-count {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 600;
}

.subtasks-progress {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.subtasks-progress__bar {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background-color: var(--color-bg);
  overflow: hidden;
}

.subtasks-progress__fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background-color: var(--color-map-green);
  transition: width 0.25s ease;
}

.subtasks-progress__pct {
  font-size: 0.71875rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  min-width: 32px;
  text-align: right;
}

.subtask-list {
  position: relative;
}

.subtask-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.375rem 0.375rem;
  margin: 0 -0.375rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.subtask-row:hover {
  background-color: var(--color-bg);
}

.subtask-row--dragging {
  border-color: var(--color-brand);
  background-color: var(--color-surface);
  cursor: grabbing;
}

.subtask-row-placeholder {
  border: 2px dashed var(--color-brand);
  border-radius: var(--radius-sm);
  background-color: color-mix(in srgb, var(--color-brand) 8%, transparent);
  margin: 0 -0.375rem;
}

.subtask-row__grip {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 12px;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  letter-spacing: -2px;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
}

body.subtasks-dragging {
  cursor: grabbing;
}

body.subtasks-dragging * {
  user-select: none;
}

.subtask-row__box {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: none;
  color: #ffffff;
  cursor: pointer;
  padding: 0;
}

.subtask-row__box svg {
  width: 12px;
  height: 12px;
}

.subtask-row__box--done {
  background-color: var(--color-map-green);
  border-color: var(--color-map-green);
}

.subtask-row__title {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  color: var(--color-text);
}

.subtask-row__title--done {
  color: var(--color-text-muted);
  text-decoration: line-through;
}

.subtask-row__delete {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  padding: 0;
  color: var(--color-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.subtask-row:hover .subtask-row__delete {
  opacity: 1;
}

.subtask-row__delete svg {
  width: 14px;
  height: 14px;
}

.subtask-row__delete:hover {
  color: var(--color-danger-text);
}

.subtask-new-form {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.subtask-new-form .field__input {
  flex: 1;
  border-bottom-width: 1px;
}

.card-panel__reporter {
  padding-top: var(--space-sm);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
}

/* Chip row (priority) */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-row__item-form {
  display: contents;
}

.chip-row__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.3125rem 0.6875rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background-color: var(--color-surface);
  color: var(--color-text-muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.chip-row__item:hover {
  border-color: var(--color-text-muted);
}

.chip-row__item--on,
.chip-row__item--on:hover {
  border-color: var(--chip-color);
  color: var(--color-text);
  background-color: color-mix(in srgb, var(--chip-color) 16%, var(--color-surface));
}

.chip-row__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--chip-color);
  flex-shrink: 0;
}
