/* The Projects board. Colors, type and spacing come from styles.css. */

/* The board uses the full window width, as phases are added side by side. */
.board-page {
  max-width: none;
}

.board-heading {
  align-items: flex-end;
  margin-bottom: var(--space-6);
}

.board-hint {
  margin: var(--space-2) 0 0;
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}

.board-message {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-bad-soft);
  color: var(--color-bad);
  font-size: var(--text-sm);
}

.board-message[hidden],
.dialog-text[hidden] {
  display: none;
}

/* Phases side by side; the board scrolls sideways inside its own area. */
.board {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  min-height: 60vh;
  padding-bottom: var(--space-4);
  overflow-x: auto;
}

.board-column {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: var(--space-2);
  width: 280px;
  max-width: 82vw;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  background: var(--color-board-column);
}

.board-column-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 32px;
  padding-left: var(--space-2);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.board-column-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: var(--text-md);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-count {
  min-width: 22px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  line-height: 20px;
  text-align: center;
}

.board-column-actions {
  display: flex;
  opacity: 0;
  transition: opacity var(--motion);
}

.board-column-head:hover .board-column-actions,
.board-column-head:focus-within .board-column-actions {
  opacity: 1;
}

@media (hover: none) {
  .board-column-actions {
    opacity: 1;
  }
}

.board-icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-ink-muted);
  cursor: pointer;
  transition: background-color var(--motion), color var(--motion);
}

.board-icon-button:hover {
  background: var(--color-surface);
  color: var(--color-ink);
}

.board-icon-button.is-danger:hover {
  background: var(--color-bad-soft);
  color: var(--color-bad);
}

.board-icon-button svg,
.board-add-card svg,
.board-add-phase svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Project cards */
.board-cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 4px;
}

.board-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-rest);
  color: var(--color-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: box-shadow var(--motion), border-color var(--motion);
}

.board-card:hover {
  border-color: var(--color-line-strong);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.board-card-name {
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.board-card-people {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: var(--space-2);
}

/* The department, under the dates */
.board-card-owner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--color-line);
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
}

.board-card-dept-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.board-card-dept {
  font-weight: 600;
}

.board-card-more {
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
}

.board-card-date {
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
}

.board-add-card {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 34px;
  padding: 0 var(--space-2);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-accent-text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--motion);
}

.board-add-card:hover {
  background: var(--color-surface);
}

.board-add-phase {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 280px;
  max-width: 82vw;
  min-height: 58px;
  border: 2px dashed var(--color-line-strong);
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--color-accent-text);
  font: inherit;
  font-size: var(--text-md);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--motion), border-color var(--motion);
}

.board-add-phase:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

/* Dragging: the card or phase follows the pointer, a dashed gap marks where
   it will land. */
.is-placeholder {
  border: 2px dashed var(--color-line-strong);
  background: transparent;
  box-shadow: none;
}

.is-placeholder > * {
  visibility: hidden;
}

.is-ghost {
  position: fixed;
  z-index: 50;
  margin: 0;
  box-shadow: var(--shadow-raised);
  pointer-events: none;
  transform: rotate(2deg);
}

body.is-board-dragging,
body.is-board-dragging * {
  cursor: grabbing;
  user-select: none;
  -webkit-user-select: none;
}

/* Dialog: deleting sits apart, on the left */
.board-dialog-delete {
  margin-right: auto;
  color: var(--color-bad);
}

.board-dialog-delete[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .is-ghost {
    transform: none;
  }
}

/* ---- Board and Timeline views ---- */
.board-views {
  width: fit-content;
  margin-bottom: var(--space-5);
}

.board[hidden],
.board-hint[hidden],
.timeline-card[hidden] {
  display: none;
}

.timeline-card {
  padding: var(--space-5);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-rest);
}

.timeline-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-5);
}

.timeline-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.timeline-note {
  margin: 2px 0 0;
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}

.timeline-empty {
  margin: 0;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-sunken);
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}

/* A wider names column: projects show their people beside the name */
.timeline-card .gantt {
  --label: 280px;
}

@media (max-width: 760px) {
  .timeline-card {
    padding: var(--space-4);
  }

  .timeline-card .gantt {
    --label: 120px;
  }
}

/* ---- List and Dashboard views ---- */
.other-view[hidden] {
  display: none;
}

.view-card {
  min-width: 0;
  padding: var(--space-5);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-rest);
}

.view-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}

.view-title {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.view-note {
  margin: 2px 0 0;
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}

.view-empty {
  margin: var(--space-3) 0 0;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-sunken);
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}

/* Shared marks: a subtask's color, a status dot, a thin meter, a warning flag */
.project-swatch {
  display: inline-block;
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.status-dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--color-ink-muted);
}

.status-dot.is-in-progress {
  background: var(--color-accent);
}

.status-dot.is-completed {
  background: var(--color-good);
}

.meter {
  display: block;
  flex: 1;
  min-width: 48px;
  height: 6px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: var(--color-control);
}

.meter-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
}

.flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: var(--space-2);
  padding: 1px var(--space-2);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}

.flag svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flag.is-bad {
  background: var(--color-bad-soft);
  color: var(--color-bad);
}

.flag.is-warn {
  background: var(--color-warn-soft);
  color: var(--color-warn);
}

/* The list of projects */
.plist-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.plist-search {
  width: 280px;
  max-width: 100%;
}

.plist-phase {
  width: 170px;
}

.plist-tools .plan-input {
  width: 100%;
  height: 34px;
  padding: 0 var(--space-3);
  border: 0;
  outline: none;
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-sm);
}

.plist-wrap {
  overflow-x: auto;
}

.plist {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.plist th {
  padding: 0 var(--space-2) var(--space-2);
  border-bottom: 1px solid var(--color-line-strong);
  text-align: left;
  white-space: nowrap;
}

.plist th.is-number,
.plist td.is-number {
  text-align: right;
}

.plist-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-ink-muted);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
}

.plist-sort:hover,
.plist th[aria-sort="ascending"] .plist-sort,
.plist th[aria-sort="descending"] .plist-sort {
  color: var(--color-ink);
}

.plist-arrow {
  color: var(--color-accent-text);
}

.plist td {
  padding: var(--space-2);
  border-bottom: 1px solid var(--color-line);
  vertical-align: middle;
  white-space: nowrap;
}

.plist-project td {
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.plist-task td {
  background: var(--color-sunken);
}

.plist-name {
  width: 30%;
  white-space: normal;
}

.plist-name-box {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.plist-name-box.is-child {
  padding-left: calc(22px + var(--space-2));
}

.plist-name-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.plist-link {
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.plist-task .plist-link {
  font-weight: 500;
}

.plist-link:hover {
  color: var(--color-accent-text);
}

.plist-sub,
.plist-muted {
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
}

.plist-toggle,
.plist-toggle-space {
  flex: none;
  width: 22px;
  height: 22px;
}

.plist-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-ink-muted);
  cursor: pointer;
  transition: transform var(--motion), background-color var(--motion);
}

.plist-toggle:hover {
  background: var(--color-control);
  color: var(--color-ink);
}

.plist-toggle.is-open {
  transform: rotate(90deg);
}

.plist-toggle svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.plist-progress {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: 112px;
}

.plist-percent {
  min-width: 34px;
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.plist-hours,
.plist-date {
  font-variant-numeric: tabular-nums;
}

.plist-status {
  color: var(--color-ink-muted);
}

.plist-people {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.plist-more {
  margin-left: 2px;
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
}

/* The dashboard */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.dash-stats .stat {
  border: 1px solid var(--color-card-border);
  background: var(--color-surface);
  box-shadow: var(--shadow-rest);
}

.dash-stats .stat + .stat {
  margin-top: 0;
}

.dash-stats .stat-value {
  font-size: 21px;
  white-space: nowrap;
}

.stat.is-warn {
  border-color: transparent;
  background: var(--color-warn-soft);
  color: var(--color-warn);
}

.stat.is-bad {
  border-color: transparent;
  background: var(--color-bad-soft);
  color: var(--color-bad);
}

.stat.is-warn .stat-label,
.stat.is-bad .stat-label {
  color: inherit;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
  align-items: start;
}

.dash-panel .view-note {
  margin-bottom: var(--space-4);
}

.dash-bars,
.dash-due,
.dash-progress {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dash-bars {
  gap: var(--space-3);
}

.dash-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 140px) minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.dash-bar-label {
  overflow: hidden;
  color: var(--color-ink);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-bar-track {
  display: block;
  height: 16px;
}

/* Bars: 4px rounded at the end, square at the start */
.dash-bar-fill {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--color-accent);
}

.dash-bar-fill.is-muted {
  background: var(--color-chart-other);
}

.dash-bar-value {
  min-width: 48px;
  color: var(--color-ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.dash-due-row,
.dash-progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  font-size: var(--text-sm);
}

.dash-due-row + .dash-due-row,
.dash-progress-row + .dash-progress-row {
  border-top: 1px solid var(--color-line);
}

.dash-due-date {
  flex: none;
  min-width: 56px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-sunken);
  font-size: var(--text-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.dash-due-date.is-late {
  background: var(--color-bad-soft);
  color: var(--color-bad);
}

.dash-due-text,
.dash-progress-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.dash-due-name {
  overflow: hidden;
  color: var(--color-ink);
  font-weight: 600;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-due-name:hover {
  color: var(--color-accent-text);
}

.dash-due-where {
  overflow: hidden;
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-due-when {
  flex: none;
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
}

.dash-due-row .flag,
.dash-progress-figure .flag {
  margin-left: 0;
}

.dash-progress-figure {
  display: flex;
  flex: none;
  align-items: center;
  gap: var(--space-2);
  width: 220px;
}

.dash-more {
  margin-top: var(--space-2);
}

@media (max-width: 900px) {
  .dash-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .view-card {
    padding: var(--space-4);
  }

  .plist-search,
  .plist-phase {
    width: 100%;
  }

  .dash-progress-figure {
    width: 140px;
  }
}

/* Search and phase filter: soft blue, as fields you can change */
.plist-tools .plan-field-box {
  display: flex;
  align-items: center;
  min-height: 34px;
  border-radius: var(--radius-sm);
  background: var(--color-editable);
  transition: background-color var(--motion);
}

.plist-tools .plan-field-box:hover {
  background: var(--color-editable-hover);
}

.plist-tools .plan-field-box:focus-within {
  box-shadow: inset 0 0 0 2px var(--color-accent);
}

.plist-tools select.plan-input {
  cursor: pointer;
}

/* A Late or Low flag goes under the date or hours instead of widening the table */
.plist td.plist-date,
.plist td.plist-hours {
  white-space: normal;
}

.plist td.plist-date .flag,
.plist td.plist-hours .flag {
  display: flex;
  width: fit-content;
  margin: 2px 0 0;
}

.plist td.plist-hours .flag {
  margin-left: auto;
}

.plist-nowrap {
  white-space: nowrap;
}

@media (max-width: 900px) {
  /* A tile left without a partner takes the whole row */
  .dash-stats .stat:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .dash-stats .stat-value {
    font-size: 19px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* How many messages the project's chat has; blue with a dot when unread */
.board-card-chat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: var(--space-2);
  color: var(--color-ink-muted);
  font-size: var(--text-xs);
  font-weight: 600;
}

.board-card-chat svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
}

.board-card-chat.is-unread {
  color: var(--color-accent-text);
}

.board-card-chat.is-unread::after {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
}
