/*
 * Application shell: sidebar, top bar, project header, list view, task drawer.
 * Everything is desktop-first — the workday happens on a large screen — with
 * tablet and phone breakpoints at the bottom.
 */

/* ---- shell ------------------------------------------------------------ */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
  background: var(--background);
}

.app-shell.is-collapsed {
  grid-template-columns: var(--sidebar-width-collapsed) minmax(0, 1fr);
}

.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
}

.app-content {
  flex: 1;
  min-height: 0;
  /* Pages own their scroll regions; this only catches content that does not. */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ---- sidebar ---------------------------------------------------------- */

.sidebar {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--sidebar-background);
  color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  overflow: hidden;
}

.sidebar-top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--topbar-height);
  padding: 0 var(--space-3) 0 var(--space-4);
  border-bottom: 1px solid var(--sidebar-border);
  flex: 0 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  color: var(--sidebar-text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
}

.brand-name {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sidebar-toggle {
  margin-left: auto;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--sidebar-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: var(--sidebar-surface-hover);
  color: var(--sidebar-text);
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-3) var(--space-3) var(--space-6);
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: #3a3b3e;
  background-clip: content-box;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 30px;
  padding: 0 var(--space-3);
  border-radius: var(--radius);
  color: var(--sidebar-text);
  font-size: var(--text-base);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.nav-item:hover {
  background: var(--sidebar-surface-hover);
  text-decoration: none;
}

.nav-item.is-active {
  background: var(--sidebar-surface-active);
  font-weight: 600;
}

.nav-item svg {
  flex: 0 0 auto;
  color: var(--sidebar-text-muted);
}

.nav-item.is-active svg {
  color: var(--sidebar-text);
}

.nav-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-group {
  margin-top: var(--space-5);
}

.nav-group-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: none;
  background: transparent;
  color: var(--sidebar-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  cursor: pointer;
}

.nav-group-header:hover {
  color: var(--sidebar-text);
}

.nav-group-chevron {
  transition: transform var(--transition-fast);
}

.nav-group-chevron.is-collapsed {
  transform: rotate(-90deg);
}

.nav-group-action {
  margin-left: auto;
  display: flex;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.nav-group:hover .nav-group-action {
  opacity: 1;
}

.project-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.sidebar-divider {
  height: 1px;
  margin: var(--space-3) var(--space-3);
  background: var(--sidebar-border);
}

.sidebar-empty {
  padding: var(--space-2) var(--space-3);
  color: var(--sidebar-text-muted);
  font-size: var(--text-sm);
}

/* Collapsed sidebar keeps only the icon rail. */
.is-collapsed .brand-name,
.is-collapsed .nav-item-label,
.is-collapsed .nav-group-header span,
.is-collapsed .sidebar-empty,
.is-collapsed .nav-badge {
  display: none;
}

.is-collapsed .nav-item {
  justify-content: center;
  padding: 0;
}

.is-collapsed .nav-group-header {
  justify-content: center;
}

/* ---- top bar ---------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--topbar-height);
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex: 0 0 auto;
  z-index: 200;
}

.topbar-search {
  position: relative;
  flex: 0 1 460px;
}

.topbar-search svg {
  position: absolute;
  top: 50%;
  left: var(--space-3);
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.topbar-search input {
  width: 100%;
  height: 30px;
  padding: 0 var(--space-4) 0 30px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-sunken);
  color: var(--text-primary);
  font: inherit;
}

.topbar-search input:hover {
  background: var(--surface-hover);
}

.topbar-search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.topbar-search kbd {
  position: absolute;
  top: 50%;
  right: var(--space-3);
  transform: translateY(-50%);
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-size: 10px;
  pointer-events: none;
}

.topbar-spacer {
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 2px;
  border: none;
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
}

.topbar-user:hover {
  background: var(--surface-hover);
}

/* ---- page header ------------------------------------------------------ */

.page-header {
  padding: var(--space-5) var(--space-6) 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex: 0 0 auto;
}

.page-header-main {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.page-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: #ffffff;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.page-title {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.page-subtitle {
  margin-top: 1px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.tabs {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 34px;
  padding: 0 var(--space-4);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-base);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
}

.tab:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  text-decoration: none;
}

.tab.is-active {
  color: var(--text-primary);
  font-weight: 600;
}

.tab.is-active::after {
  content: "";
  position: absolute;
  right: var(--space-3);
  bottom: 0;
  left: var(--space-3);
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--text-primary);
}

.tab:disabled {
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.tab:disabled:hover {
  background: transparent;
  color: var(--text-tertiary);
}

/* ---- toolbar ---------------------------------------------------------- */

/*
 * Two rows, not one wrapping line: the controls stay put and the active
 * criteria appear underneath. A toolbar that rearranges itself as you use it is
 * worse than one line more.
 */
.toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex: 0 0 auto;
}

.toolbar-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

/* Separates what narrows the list from what arranges it. */
.toolbar-divider {
  flex: 0 0 auto;
  width: 1px;
  height: 18px;
  margin: 0 var(--space-1);
  background: var(--border);
}

.toolbar-spacer {
  flex: 1;
}

/* ---- scroll region ---------------------------------------------------- */

.page-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--background);
}

.page-body {
  max-width: var(--content-max-width);
  padding: var(--space-6);
}

/* ---- task list -------------------------------------------------------- */

.task-list {
  padding-bottom: var(--space-8);
}

.task-list-head {
  position: sticky;
  top: 0;
  z-index: 60;
  display: grid;
  align-items: center;
  height: 32px;
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
}

.task-list-head > div {
  padding: 0 var(--space-3);
}

/* Columns: title | assignee | due date | priority | status */
.task-grid {
  /* Set inline from the columns this person left switched on. The fallback is
     every column, which is what a page renders with before its preferences have
     been read out of the browser. */
  grid-template-columns: var(--task-grid-columns, minmax(240px, 1fr) 140px 120px 150px 130px 100px 120px);
}

.section-group {
  border-bottom: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 34px;
  padding: 0 var(--space-6);
  background: var(--background-subtle);
  position: sticky;
  top: 32px;
  z-index: 50;
}

.section-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}

.section-toggle:hover {
  background: var(--surface-active);
  color: var(--text-primary);
}

.section-toggle svg {
  transition: transform var(--transition-fast);
}

.section-toggle.is-collapsed svg {
  transform: rotate(-90deg);
}

.section-name {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 1px var(--space-2);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-base);
  font-weight: 600;
}

.section-name:hover {
  background: var(--surface-hover);
}

.section-name:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.section-count {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.section-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.section-header:hover .section-actions,
.section-header:focus-within .section-actions {
  opacity: 1;
}

/* ---- task row --------------------------------------------------------- */

.task-row {
  display: grid;
  align-items: center;
  min-height: var(--row-height);
  padding: 0 var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.task-row:hover {
  background: var(--surface-hover);
}

.task-row.is-selected {
  background: var(--accent-soft);
}

.task-row.is-completed .task-title {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.task-row.is-dragging {
  opacity: 0.4;
}

.task-row.is-drop-target {
  box-shadow: inset 0 2px 0 var(--accent);
}

.task-cell {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: 0 var(--space-3);
  height: 100%;
}

.task-cell-title {
  gap: var(--space-3);
  padding-left: 0;
}

.task-drag-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 20px;
  margin-left: -14px;
  color: var(--text-tertiary);
  opacity: 0;
  cursor: grab;
  transition: opacity var(--transition-fast);
}

.task-row:hover .task-drag-handle {
  opacity: 1;
}

/* The subtask twisty, and the gap it leaves behind on rows without one. Both
   are the same width so titles stay in a single column down the list. */
.task-twisty,
.task-twisty-spacer {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-right: calc(var(--space-3) * -1 + 2px);
}

.task-twisty {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}

.task-twisty:hover {
  background: var(--surface-active);
  color: var(--text-primary);
}

.task-twisty svg {
  transform: rotate(-90deg);
  transition: transform var(--transition-fast);
}

.task-twisty.is-open svg {
  transform: rotate(0deg);
}

/* Placeholder while a subtask list is on its way. */
.task-row-loading {
  display: flex;
  align-items: center;
  min-height: var(--row-height);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.task-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-base);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 0 0 auto;
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

.task-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.task-key {
  flex: 0 0 auto;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.task-row-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.task-row:hover .task-row-actions {
  opacity: 1;
}

.due-date {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  height: 22px;
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
}

.due-date:hover {
  background: var(--surface-active);
}

.due-date.is-overdue {
  color: var(--danger);
  font-weight: 500;
}

.due-date.is-today {
  color: var(--warning);
  font-weight: 500;
}

/* ---- due date panels -------------------------------------------------- */

/*
  The date popover is a form, not a list of options. The 340px cap that keeps a
  long list of projects or people scrollable is simply too short for it once the
  weekly repeat section opens, and a scrollbar through a form is a nuisance: the
  fields below the fold look like there is nothing there. It gets a cap tied to
  the window instead, so it scrolls only on a screen too short to hold it at all.
*/
.date-menu {
  min-width: 262px;
  max-height: min(620px, calc(100vh - 24px));
}

/* The time and repeat sections that fold out of the date popover. */
.date-extra {
  padding: var(--space-3) var(--space-3) var(--space-2);
  border-top: 1px solid var(--border);
}

.date-extra .label {
  display: block;
  margin-bottom: var(--space-2);
}

.date-footer {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-2) var(--space-1);
}

.date-footer .btn-icon.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.weekday-row {
  display: flex;
  gap: 4px;
}

.weekday {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.weekday:hover {
  background: var(--surface-hover);
}

.weekday.is-on {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.due-date.is-empty {
  color: var(--text-tertiary);
}

/* Rendered as a button when idle and as a wrapper around the input while
   typing, so both states line up with the task rows above them. */
.add-task-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  height: var(--row-height);
  padding: 0 var(--space-6);
  border: none;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-tertiary);
  font: inherit;
  font-size: var(--text-base);
  text-align: left;
  cursor: text;
}

.add-task-row:hover {
  background: var(--surface-hover);
  color: var(--text-secondary);
}

.add-task-row input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
}

.add-task-row input:focus {
  outline: none;
}

.add-section-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  color: var(--text-tertiary);
}

/* ---- project cards (Projects page) ------------------------------------ */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: var(--space-4);
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.project-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.project-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  color: #ffffff;
}

.project-card-name {
  font-size: var(--text-md);
  font-weight: 600;
}

.project-card-team {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.project-card-footer {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: auto;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.progress-track {
  flex: 1;
  height: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-sunken);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--success);
  transition: width var(--transition);
}

/* ---- task drawer ------------------------------------------------------ */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 480;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: var(--drawer-width);
  max-width: 100vw;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-drawer);
  z-index: 500;
  animation: drawer-in 160ms ease;
}

@keyframes drawer-in {
  from {
    transform: translateX(16px);
    opacity: 0;
  }
}

.drawer-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 46px;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.drawer-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
}

.drawer-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: var(--space-5) var(--space-6) var(--space-8);
}

.drawer-title {
  width: 100%;
  margin-bottom: var(--space-5);
  padding: var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-primary);
  font-family: inherit;
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.3;
  resize: none;
  overflow: hidden;
}

.drawer-title:hover {
  background: var(--surface-hover);
}

.drawer-title:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.drawer-fields {
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-bottom: var(--space-6);
}

.drawer-field-label {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
}

.drawer-section {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
}

.drawer-section-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.drawer-footer-note {
  margin-top: var(--space-6);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

.subtask-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.subtask-row:last-child {
  border-bottom: none;
}

.subtask-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtask-row.is-completed .subtask-title {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

/* Value control that reads as text until hovered — used in the drawer. */
.value-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 28px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.value-button:hover {
  background: var(--surface-hover);
}

.value-button.is-empty {
  color: var(--text-tertiary);
}

.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

/* ---- home ------------------------------------------------------------- */

.home-greeting {
  padding: var(--space-8) var(--space-6) var(--space-6);
  text-align: center;
}

.home-date {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.home-title {
  margin-top: var(--space-2);
  font-size: var(--text-2xl);
  font-weight: 600;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: var(--space-5);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6) var(--space-8);
}

.panel {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: var(--text-md);
  font-weight: 600;
}

.panel-count {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

.panel-body {
  padding: var(--space-2) 0;
}

.panel-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-5);
  cursor: pointer;
}

.panel-row:hover {
  background: var(--surface-hover);
}

/* ---- responsive ------------------------------------------------------- */

@media (max-width: 1280px) {
  .task-grid {
    grid-template-columns: var(--task-grid-columns-md, minmax(200px, 1fr) 130px 115px 140px 120px 95px);
  }

  /* Dropped rather than squeezed. A project column at 60px shows nothing. */
  .task-col-status,
  .task-col-custom {
    display: none;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: var(--sidebar-width-collapsed) minmax(0, 1fr);
  }

  .drawer {
    width: 440px;
  }
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform var(--transition);
    z-index: 700;
  }

  .sidebar.is-open {
    transform: none;
  }

  .task-grid {
    grid-template-columns: var(--task-grid-columns-sm, minmax(0, 1fr) 110px);
  }

  .task-col-priority,
  .task-col-assignee,
  .task-col-collaborators,
  .task-col-projects {
    display: none;
  }

  .drawer {
    width: 100vw;
  }

  .page-body,
  .task-row,
  .section-header,
  .task-list-head,
  .add-task-row {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

/* ---- timeline (history + comments) ------------------------------------ */

.timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.timeline-comment {
  display: flex;
  gap: var(--space-3);
}

.timeline-comment-body {
  flex: 1;
  min-width: 0;
}

.timeline-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.timeline-author {
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: 600;
}

.timeline-time {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

.timeline-actions {
  display: flex;
  gap: var(--space-1);
  margin-left: auto;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.timeline-comment:hover .timeline-actions,
.timeline-comment:focus-within .timeline-actions {
  opacity: 1;
}

.timeline-text {
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: 1.55;
  /* Comments are plain text today; honour the line breaks people type. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.timeline-edit-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/* History lines sit quieter than comments: they are context, not conversation. */
.timeline-activity {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.timeline-activity-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline-activity .timeline-author {
  font-size: var(--text-sm);
  font-weight: 600;
}

.comment-composer {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.comment-composer-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-3);
}

/* ---- attachments ------------------------------------------------------ */

.file-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.file-row:last-of-type {
  border-bottom: none;
}

.file-name {
  flex: 1;
  min-width: 0;
  color: var(--text-primary);
}

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

.file-upload {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

/* The real input is hidden; the label is the button. */
.file-upload label {
  cursor: pointer;
}

/* ---- tags ------------------------------------------------------------- */

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
}

/* ---- project activity feed -------------------------------------------- */

.activity-feed {
  max-width: 760px;
  padding: var(--space-6);
}

.activity-day {
  margin-bottom: var(--space-6);
}

.activity-day-label {
  margin-bottom: var(--space-3);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.activity-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
}

.activity-row-text {
  flex: 1;
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--text-base);
}

/* ---- attachment previews ---------------------------------------------- */

.file-previews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.file-preview {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-sunken);
  overflow: hidden;
}

.file-preview img {
  display: block;
  width: 100%;
  height: 96px;
  /* Cover, not contain: a wall of thumbnails reads better when they line up. */
  object-fit: cover;
  background: var(--surface-sunken);
}

.file-preview figcaption {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.file-preview figcaption .truncate {
  flex: 1;
}

/* ---- toolbar filter state --------------------------------------------- */

/* An active filter has to look active, or people forget why the list is short. */
.btn-ghost.is-on {
  background: var(--accent-soft);
  color: var(--accent-text);
}

/* ---- mentions ---------------------------------------------------------- */

.mention {
  padding: 0 3px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 500;
}

/* ---- inbox ------------------------------------------------------------ */

.inbox {
  max-width: 860px;
}

.inbox-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.inbox-row:hover {
  background: var(--surface-hover);
}

/* Unread rows carry a filled dot and a heavier title; read ones recede. */
.inbox-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-top: 8px;
  border-radius: 50%;
  background: transparent;
}

.inbox-row.is-unread .inbox-dot {
  background: var(--accent);
}

.inbox-body {
  flex: 1;
  min-width: 0;
}

.inbox-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 2px;
}

.inbox-kind {
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.inbox-title {
  color: var(--text-primary);
  font-size: var(--text-base);
}

.inbox-row.is-unread .inbox-title {
  font-weight: 600;
}

.inbox-message {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.inbox-toggle {
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.inbox-row:hover .inbox-toggle,
.inbox-row:focus-within .inbox-toggle {
  opacity: 1;
}

.tab-count {
  margin-left: var(--space-2);
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
}

/* The top-bar bell carries the count as a corner dot rather than a pill. */
.topbar-inbox {
  position: relative;
}

.topbar-badge {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: #ffffff;
  font-size: 9px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ---- board view -------------------------------------------------------- */

/* Columns scroll horizontally as a group; each column scrolls its own cards,
   so a long column never pushes the others off the bottom of the screen. */
.board {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  height: 100%;
  padding: var(--space-5) var(--space-6);
  overflow-x: auto;
  overflow-y: hidden;
}

.board-column {
  display: flex;
  flex-direction: column;
  flex: 0 0 280px;
  max-height: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--background-subtle);
}

.board-column-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-3);
}

.board-column-name {
  color: var(--text-primary);
  font-size: var(--text-base);
  font-weight: 600;
}

.board-column-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 var(--space-3) var(--space-3);
  overflow-y: auto;
  /* Keeps a drop target below the last card in an otherwise short column. */
  min-height: 60px;
}

.board-add {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3);
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-tertiary);
  font: inherit;
  font-size: var(--text-base);
  text-align: left;
  cursor: pointer;
}

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

.board-composer {
  width: 100%;
}

/* ---- task card --------------------------------------------------------- */

.task-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.task-card:hover {
  box-shadow: var(--shadow);
}

.task-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.task-card.is-completed .task-card-title span {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.task-card.is-dragging {
  opacity: 0.4;
}

.task-card.is-drop-target {
  box-shadow: inset 0 2px 0 var(--accent);
}

.task-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.task-card-title {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: 1.4;
  /* Long names wrap onto a second line rather than being cut mid-word. */
  overflow-wrap: anywhere;
}

.task-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

/* The due date is a button in the list view; on a card it is only a label. */
.task-card-meta .due-date {
  height: auto;
  padding: 0;
}

/* ---- calendar view ----------------------------------------------------- */

.calendar {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-5) var(--space-6);
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.calendar-month {
  min-width: 150px;
  color: var(--text-primary);
  font-size: var(--text-lg);
  font-weight: 600;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--border);
  overflow: hidden;
}

.calendar-weekday {
  padding: var(--space-3) var(--space-4);
  background: var(--background-subtle);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calendar-day {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 108px;
  padding: var(--space-2);
  background: var(--surface);
}

/* Days spilling in from the neighbouring months stay visible but recede. */
.calendar-day.is-outside {
  background: var(--background-subtle);
}

.calendar-day.is-outside .calendar-day-number {
  color: var(--text-tertiary);
}

.calendar-day-number {
  padding: 0 var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
}

.calendar-day.is-today .calendar-day-number {
  align-self: flex-start;
  min-width: 20px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--text-inverse);
  text-align: center;
}

/* The day a task is about to land on. */
.calendar-day.is-drop-zone,
.calendar-unscheduled.is-drop-zone {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.calendar-task[draggable="true"],
.calendar-loose[draggable="true"] {
  cursor: grab;
}

.calendar-task.is-dragging,
.calendar-loose.is-dragging {
  opacity: 0.4;
}

.calendar-task {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: 3px var(--space-2);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-xs);
  text-align: left;
  cursor: pointer;
}

.calendar-task:hover {
  background: var(--surface-active);
}

.calendar-task.is-completed {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.calendar-more {
  padding: 0 var(--space-2);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

.calendar-unscheduled {
  max-width: 520px;
}

/* ---- collaborators ----------------------------------------------------- */

.collaborators {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* The remove button sits on the avatar rather than beside it, so a row of
   eight people stays a row of eight avatars. */
.collaborator {
  position: relative;
  display: inline-flex;
}

.collaborator-remove {
  position: absolute;
  top: -3px;
  right: -3px;
  display: none;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
}

.collaborator:hover .collaborator-remove,
.collaborator:focus-within .collaborator-remove {
  display: inline-flex;
}

.collaborator-remove:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.collaborator-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.collaborator-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Faces overlap in a list cell, where a column is 130px wide and a row of
   separate avatars would not fit. */
.avatar-stack {
  display: inline-flex;
  align-items: center;
}

.avatar-stack > * + * {
  margin-left: -5px;
}

/* The ring keeps overlapping faces readable against each other. */
.avatar-stack > * {
  box-shadow: 0 0 0 1.5px var(--surface);
  border-radius: var(--radius-pill);
}

.task-row:hover .avatar-stack > * {
  box-shadow: 0 0 0 1.5px var(--surface-hover);
}

.task-row.is-selected .avatar-stack > * {
  box-shadow: 0 0 0 1.5px var(--accent-soft);
}

/* ---- project chips ----------------------------------------------------- */

.project-chips {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
}

.project-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 140px;
  padding: 1px var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  font-size: var(--text-xs);
  text-decoration: none;
}

.project-chip.is-link:hover {
  background: var(--surface-active);
  color: var(--text-primary);
}

/* Marks the project that named the task, which is the one it cannot leave. */
.project-chip-home {
  color: var(--text-tertiary);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* A project reads as a small tinted tile rather than a bare dot: at sidebar size
   a dot carries the colour but nothing else, and every row looks alike. */
.project-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: var(--radius-sm);
  color: #ffffff;
}

.project-icon svg {
  /* Beats the .nav-item svg rule, which greys icons out. */
  color: inherit;
}

/* Team names are group headers, so they get the same quiet treatment as the
   other headers rather than competing with the projects underneath. */
.nav-group-header .truncate {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Explains what a field does when the label alone cannot. */
.field-hint {
  margin-top: var(--space-2);
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  line-height: 1.4;
}

/* ---- board columns: renaming and adding -------------------------------- */

/* The name is an input when you may rename it, so editing is one click rather
   than a menu. It has to look like the plain heading until then. */
input.board-column-name {
  min-width: 0;
  flex: 1;
  height: 22px;
  padding: 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-base);
  font-weight: 600;
}

input.board-column-name:hover {
  background: var(--surface-hover);
}

input.board-column-name:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.board-column-actions {
  margin-left: auto;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

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

/* The trailing "add column" tile: same footprint, nothing in it but the button. */
.board-column.is-add {
  flex: 0 0 200px;
  border-style: dashed;
  background: transparent;
  padding: var(--space-3);
}

/* ---- project Files tab -------------------------------------------------- */

.file-list {
  max-width: var(--content-max-width);
  padding: var(--space-4) var(--space-6) var(--space-8);
}

/* The drawer reuses .file-row in a 520px panel; here there is room for a
   thumbnail and a second line, so the row is taller. */
.file-list .file-row {
  padding: var(--space-3) 0;
}

.file-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  object-fit: cover;
  background: var(--surface-sunken);
  color: var(--text-tertiary);
}

.file-row-main {
  flex: 1;
  min-width: 0;
}

.file-row-main .file-name {
  display: block;
  text-decoration: none;
}

.file-meta {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* A button that has to read as part of a sentence rather than as a control. */
.link-button {
  padding: 0;
  border: none;
  background: none;
  color: var(--text-secondary);
  font: inherit;
  cursor: pointer;
}

.link-button:hover {
  color: var(--accent-text);
  text-decoration: underline;
}

/* ---- project members ---------------------------------------------------- */

/* The stack of faces in the project header is a button, not decoration: it is
   how people are invited, and on a private project that is what makes it
   visible to them at all. */
.member-summary {
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}

.member-summary:hover {
  border-color: var(--border);
  background: var(--surface-hover);
}

.member-summary-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-left: var(--space-2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-pill);
  color: var(--text-tertiary);
}

.member-summary:hover .member-summary-add {
  border-color: var(--accent);
  color: var(--accent);
}

.member-list {
  display: flex;
  flex-direction: column;
}

.member-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.member-row:last-child {
  border-bottom: none;
}

.member-row-main {
  flex: 1;
  min-width: 0;
}

.member-role {
  width: auto;
  min-width: 104px;
}

/* ---- toasts ------------------------------------------------------------- */

/* Bottom-left, out of the way of the drawer on the right and the row the user
   just tried to edit. */
.toast-host {
  position: fixed;
  left: var(--space-6);
  bottom: var(--space-6);
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 420px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.toast {
  animation: toast-in 160ms ease-out;
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: var(--text-base);
}

.toast.is-error {
  border-color: var(--danger);
}

.toast.is-error > .wf-icon {
  color: var(--danger);
}

.toast-message {
  flex: 1;
  min-width: 0;
  line-height: 1.45;
}

/* Somebody who has turned motion down still gets the message, just without
   it sliding in from underneath. */
@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }
}

/* ---- admin ------------------------------------------------------------ */

.admin-grid {
  grid-template-columns: minmax(220px, 1fr) 150px minmax(180px, 1fr) 230px 120px 44px;
}

.admin-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 28px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-tertiary);
  min-width: 260px;
}

.admin-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  outline: none;
}

/* Templates are browsed as cards: a template is a shape, not a row of fields. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-4);
  padding: var(--space-6);
}

.template-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.template-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.template-card-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.template-section {
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background-subtle);
}

.template-section-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.template-task {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-2) 0 var(--space-2) var(--space-4);
  color: var(--text-tertiary);
}

.chip-success {
  background: var(--success-soft, var(--accent-soft));
  color: var(--success, var(--accent-text));
}

.chip-muted {
  background: var(--surface-active);
  color: var(--text-tertiary);
}

/* A choice in the copy dialog: a checkbox, a label, and why you would want it. */
.copy-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  cursor: pointer;
}

.copy-option input {
  margin-top: 3px;
  flex: 0 0 auto;
}

.copy-option-label {
  display: block;
  color: var(--text-primary);
}

.copy-option .field-hint {
  margin: 2px 0 0;
}

.copy-option input:disabled ~ span .copy-option-label {
  color: var(--text-tertiary);
}

/* ---- admin settings --------------------------------------------------- */

.settings-page {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-6);
}

.settings-card {
  margin-bottom: var(--space-5);
  padding: var(--space-5);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.settings-card h3 {
  margin: 0 0 var(--space-4);
  font-size: var(--text-md);
  font-weight: 600;
}

.settings-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.settings-identity {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.org-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background-subtle);
  color: var(--text-tertiary);
  overflow: hidden;
}

.org-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/*
 * The same logo in the sidebar, where it stands in the initials badge's place.
 * Contained rather than cropped: a wordmark is the usual upload, and cutting it
 * to a square would make it unreadable.
 */
.org-mark {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.settings-test {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.settings-ok {
  margin-top: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--text-sm);
}

.settings-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding-bottom: var(--space-8);
}

.audit-grid {
  grid-template-columns: 130px 180px minmax(280px, 1fr) 180px;
}

@media (max-width: 900px) {
  .settings-pair {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Lists of addresses on the security screen: an address, what it is, actions. */
.ip-list {
  margin-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.ip-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border);
}

.ip-address {
  flex: 0 0 auto;
  min-width: 130px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

.ip-detail {
  flex: 1;
  min-width: 0;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* ---- task dependencies ------------------------------------------------ */

.dependency-group + .dependency-group {
  margin-top: var(--space-5);
}

.dependency-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
}

.dependency-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  color: var(--text-tertiary);
}

/*
 * An unfinished predecessor is the only thing here that changes what somebody
 * can do next, so it is the only thing that gets a colour.
 */
.dependency-row.is-blocking {
  color: var(--warning, var(--danger));
}

.dependency-link {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dependency-link:hover {
  text-decoration: underline;
}

.dependency-link .is-completed {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

.chip-warning {
  background: var(--warning-soft, var(--danger-soft));
  color: var(--warning, var(--danger));
}

/* A settings card whose heading carries an action, e.g. "New field". */
.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.settings-card-head h3 {
  margin: 0 0 var(--space-1);
}

/* ---- custom fields ---------------------------------------------------- */

.project-field {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.project-field:last-child {
  border-bottom: none;
}

.project-field-main {
  flex: 1;
  min-width: 0;
}

.project-field-name {
  font-weight: 500;
}

.project-field-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  cursor: pointer;
  white-space: nowrap;
}

/* A required field nobody has filled in yet. */
.required-dot {
  margin-left: 2px;
  color: var(--danger);
}

.field-with-suffix {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

/* ---- search ----------------------------------------------------------- */

/* Results under the top-bar box. Above the scrim, which catches the click
   that should close them. */
.search-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 320;
  max-height: 60vh;
  overflow-y: auto;
  padding: var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg, var(--shadow));
}

.search-menu-all {
  margin-top: var(--space-1);
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
}

.search-scrim {
  position: fixed;
  inset: 0;
  z-index: 310;
}

.search-page {
  max-width: 780px;
  margin: 0 auto;
  padding: var(--space-6);
}

.search-box {
  margin-bottom: var(--space-6);
  height: 36px;
}

.search-group + .search-group {
  margin-top: var(--space-7);
}

.search-group-title {
  margin: 0 0 var(--space-2);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.search-result {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  border: none;
  border-radius: var(--radius);
  background: none;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.search-result:hover {
  background: var(--surface-hover);
  text-decoration: none;
}

.search-result-main {
  flex: 1;
  min-width: 0;
}

.search-result .is-completed {
  color: var(--text-tertiary);
  text-decoration: line-through;
}

/* Tags as search results: a chip you can press to see what carries it. */
.search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 3px var(--space-3);
  border: 1px solid var(--tag-color, var(--border));
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-sm);
  cursor: pointer;
}

.tag-chip:hover {
  background: var(--surface-hover);
}

.tag-chip.is-selected {
  background: var(--tag-color, var(--accent));
  border-color: var(--tag-color, var(--accent));
  color: #ffffff;
}

.tag-count {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
}

.tag-chip.is-selected .tag-count {
  color: inherit;
  opacity: 0.75;
}

.search-tag-tasks {
  padding-left: var(--space-2);
  border-left: 2px solid var(--border);
}

/*
 * The search box's own clear button.
 *
 * The browser's is drawn underneath the Ctrl K hint, where it cannot be pressed,
 * so it is suppressed and replaced by one that sits in the hint's place — the
 * hint is only useful while the box is empty anyway.
 */
.topbar-search input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

.topbar-search-clear {
  position: absolute;
  top: 50%;
  right: var(--space-2);
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
}

.topbar-search-clear:hover {
  background: var(--surface-active);
  color: var(--text-primary);
}

/* ---- filter bar -------------------------------------------------------- */

/* One line, never wrapping: the chips live on their own row. */
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.filter-search {
  position: relative;
  flex: 0 1 200px;
}

.filter-search svg {
  position: absolute;
  top: 50%;
  left: var(--space-2);
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

.filter-search input {
  width: 100%;
  height: 26px;
  padding: 0 var(--space-2) 0 26px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface-sunken);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-sm);
}

.filter-search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}

.filter-count {
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Tall enough to hold every criterion, scrolled rather than cut off. */
.filter-menu {
  min-width: 260px;
  max-height: 70vh;
  overflow-y: auto;
}

.filter-dates {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
}

.filter-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.filter-date input {
  height: 26px;
  font-size: var(--text-sm);
}

.filter-quick {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: 0 var(--space-3) var(--space-2);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  max-width: 220px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: var(--text-xs);
}

.filter-chip button {
  display: flex;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
}

.filter-chip button:hover {
  opacity: 1;
}

/* A project's own column in the List view. Read here, edited in the drawer. */
.task-col-custom {
  min-width: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

@media (max-width: 1400px) {
  .task-col-custom {
    display: none;
  }
}

/* Custom fields on a board card. */
.task-card-fields {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-top: var(--space-2);
}

/* ---- saved views ------------------------------------------------------- */

.saved-view-row {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-1);
  border-radius: var(--radius);
}

.saved-view-row:hover,
.saved-view-row.is-selected {
  background: var(--surface-hover);
}

.saved-view-apply {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  flex: 1;
  min-width: 0;
  padding: var(--space-2) var(--space-2);
  border: none;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.saved-view-form {
  padding: var(--space-2) var(--space-3) var(--space-3);
}

.saved-view-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

/* The chip row: only there when something is on, and flush with the controls. */
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.filter-clear {
  padding: 0;
  border: none;
  background: none;
  color: var(--text-tertiary);
  font: inherit;
  font-size: var(--text-xs);
  text-decoration: underline;
  cursor: pointer;
}

.filter-clear:hover {
  color: var(--text-primary);
}

/* Who can see the project at all, above the list of what people may do in it. */
.access-summary {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background-subtle);
}

.access-summary svg {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--text-secondary);
}

.access-summary-title {
  margin-bottom: 2px;
  font-weight: 500;
}

/* A link out of the application, with a line saying where it goes. */
.settings-linkout {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.settings-linkout .field-hint {
  margin-top: var(--space-2);
}

/* ---- comment composer -------------------------------------------------- */

/*
 * A drop target the size of the whole composer, not just the textarea: somebody
 * dropping a screenshot aims at the box, not at the input inside it.
 */
.comment-composer.is-dropping {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}

.composer-pending {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.pending-file {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 220px;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-sunken);
  font-size: var(--text-sm);
}

.pending-file img {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  object-fit: cover;
}

.pending-file button {
  display: flex;
  padding: 0;
  border: none;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
}

.pending-file button:hover {
  color: var(--text-primary);
}

/* ---- files inside a comment ------------------------------------------- */

.comment-files {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

/*
 * Capped rather than full width. A screenshot pasted into a conversation is
 * usually a whole desktop, and at full size it buries the remark it belongs to.
 *
 * The width is definite, not left to the picture. As a flex item sized by its
 * content, the box would take its width from an image that has not loaded — and
 * an image in a zero-sized box never loads. The two waited for each other and
 * nothing appeared.
 */
.comment-image {
  display: block;
  flex: 0 0 auto;
  width: 320px;
  max-width: 100%;
  min-height: 60px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-sunken);
  overflow: hidden;
}

.comment-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: cover;
}

.comment-file {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 280px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: var(--text-sm);
  text-decoration: none;
}

.comment-file:hover {
  background: var(--surface-hover);
  text-decoration: none;
}

/* The @mention list, anchored under the composer. */
.mention-menu {
  position: absolute;
  z-index: 320;
  right: 0;
  left: 0;
  max-height: 240px;
  overflow-y: auto;
  margin-top: var(--space-1);
  padding: var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg, var(--shadow));
}

/* So the menu above hangs off the composer and not off the page. */
.comment-composer {
  position: relative;
}

/* A row's dependency mark. Coloured only when something is actually in the way. */
.task-meta-item.is-blocking {
  color: var(--warning, var(--danger));
}

/* ---- the formatted-text editor ------------------------------------------
 *
 * One box with a rule across it: the tools above, the writing below. The whole
 * thing takes the focus ring, not the writing area alone, so that pressing bold
 * does not look like leaving the field.
 */

.rte {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.rte:hover {
  border-color: var(--text-tertiary);
}

.rte:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.rte.is-disabled {
  background: var(--surface-sunken, var(--surface));
  opacity: 0.7;
}

.rte-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px var(--space-2);
  border-bottom: 1px solid var(--border);
}

.rte-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.rte-tool:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* Lit while the caret is inside text this button applied. */
.rte-tool.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.rte-tool-divider {
  width: 1px;
  height: 16px;
  margin: 0 var(--space-1);
  background: var(--border);
}

.rte-input {
  min-height: 76px;
  max-height: 340px;
  overflow-y: auto;
  padding: var(--space-2) var(--space-3);
  line-height: 1.55;
  outline: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* A contenteditable has no placeholder of its own. :empty is not enough on its
   own — a browser leaves a <br> behind in an emptied box, and the box would
   then never look empty again — so the emptied state is written back as "" and
   the extra check keeps a lone <br> from counting as content. */
.rte-input:empty::before,
.rte-input:has(> br:only-child)::before {
  content: attr(data-placeholder);
  color: var(--text-tertiary);
  pointer-events: none;
}

/* ---- formatted text, as written and as read -----------------------------
 *
 * The same rules for the editor and for a posted comment, so that what somebody
 * types looks like what everybody else will see.
 */

.rte-input > :first-child,
.rich-text > :first-child {
  margin-top: 0;
}

.rte-input > :last-child,
.rich-text > :last-child {
  margin-bottom: 0;
}

.rte-input p,
.rich-text p {
  margin: 0 0 var(--space-2);
}

.rte-input ul,
.rte-input ol,
.rich-text ul,
.rich-text ol {
  margin: 0 0 var(--space-2);
  padding-left: var(--space-6);
}

.rte-input li,
.rich-text li {
  margin: 2px 0;
}

.rte-input blockquote,
.rich-text blockquote {
  margin: 0 0 var(--space-2);
  padding-left: var(--space-3);
  border-left: 2px solid var(--border-strong);
  color: var(--text-secondary);
}

.rte-input code,
.rich-text code {
  padding: 1px 4px;
  border-radius: var(--radius-sm);
  background: var(--surface-hover);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.92em;
}

.rte-input pre,
.rich-text pre {
  margin: 0 0 var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--surface-hover);
  overflow-x: auto;
}

.rte-input pre code,
.rich-text pre code {
  padding: 0;
  background: none;
}

.rich-text a {
  color: var(--accent);
  text-decoration: underline;
  overflow-wrap: anywhere;
}

/* ---- colour palette -----------------------------------------------------
 *
 * Eight swatches rather than a colour input: colours that read against both
 * themes, and a row of tags that goes together rather than one in whatever
 * sixteen million shades somebody picked.
 */

.colour-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.colour-swatch {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.colour-swatch:hover {
  transform: scale(1.1);
}

/* A ring outside the colour, not a tick on top of it — a tick has to be light
   on some of these and dark on others, and the ring is legible on all eight. */
.colour-swatch.is-selected {
  border-color: var(--surface);
  box-shadow: 0 0 0 2px var(--text-primary);
}

/* ---- notification preferences -------------------------------------------
 *
 * A matrix: one row per kind of event, one column per channel. Read down a
 * column to see everything that reaches you one way, across a row to see where
 * one kind of event goes.
 */

.pref-table {
  display: flex;
  flex-direction: column;
}

.pref-head,
.pref-row {
  display: grid;
  grid-template-columns: 1fr 72px 72px;
  align-items: center;
  gap: var(--space-3);
}

.pref-head {
  padding: 0 0 var(--space-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pref-head > span + span,
.pref-check {
  justify-self: center;
}

.pref-row {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.pref-row:last-child {
  border-bottom: none;
}

.pref-name {
  color: var(--text-primary);
  font-weight: 500;
}

/* The whole cell is the target, not the 13 pixels of the box itself. */
.pref-check {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2);
  cursor: pointer;
}

.pref-check:has(input:disabled) {
  cursor: default;
  opacity: 0.4;
}

@media (max-width: 640px) {
  .pref-head,
  .pref-row {
    grid-template-columns: 1fr 56px 56px;
    gap: var(--space-2);
  }
}

/* ---- release notes ------------------------------------------------------- */

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

.release-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.release-version {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
}

.release-current {
  color: var(--success);
  background: var(--success-soft, var(--surface-hover));
}

.release-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* The word, not a coloured pill: three pills down a page read as decoration,
   and what matters is telling "New" from "Fixed" at a glance. */
.release-group-label {
  color: var(--text-tertiary);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.release-group-label.is-added {
  color: var(--success);
}

.release-group-label.is-fixed {
  color: var(--warning);
}

.release-list {
  margin: 0;
  padding-left: var(--space-5);
  color: var(--text-secondary);
  line-height: 1.6;
}

.release-list li {
  margin: 2px 0;
}

/* ---- keyboard shortcuts -------------------------------------------------- */

.shortcut-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
}

.shortcut-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-1) 0;
  color: var(--text-secondary);
}

.shortcut-keys {
  display: flex;
  gap: 4px;
}

kbd {
  min-width: 22px;
  padding: 2px 6px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: var(--text-xs);
  text-align: center;
}

/* ---- the "something is new" dot ------------------------------------------ */

.topbar-help {
  position: relative;
}

.topbar-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--surface);
  border-radius: 50%;
  background: var(--accent);
}

/* ---- reported problems --------------------------------------------------
 *
 * A queue: one line per report, opened in place. A separate detail page would
 * mean losing your position in the list every time you looked at one, which is
 * the whole activity.
 */

.report-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.report + .report {
  border-top: 1px solid var(--border);
}

.report.is-open {
  background: var(--surface-hover);
}

.report-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  border: none;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.report-head:hover {
  background: var(--surface-hover);
}

.report-title {
  flex: 1;
  min-width: 0;
  color: var(--text-primary);
  font-weight: 500;
}

.report-who {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  max-width: 180px;
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.report.is-open .report-head .wf-icon:last-child {
  transform: rotate(180deg);
}

.report-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 var(--space-3) var(--space-3);
}

.report-detail {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* Label and value, so the eye can run down the labels rather than reading
   sentences to find the address. */
.report-context {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: var(--text-xs);
}

.report-fact {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: var(--space-2);
}

.report-fact-label {
  color: var(--text-tertiary);
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

/* Removing a report is not one of the decisions beside it, so it does not look
   like one until you go near it. */
.report-actions .btn.is-danger {
  color: var(--text-tertiary);
}

.report-actions .btn.is-danger:hover:not(:disabled) {
  color: var(--danger);
  background: var(--danger-soft, var(--surface-hover));
}

/* The five states, coloured by what they mean rather than by a palette:
   nothing decided, going to happen, being looked at, done, not happening. */
.badge.is-new {
  color: var(--accent);
  background: var(--accent-soft);
}

.badge.is-accepted,
.badge.is-fixed {
  color: var(--success);
}

.badge.is-investigating {
  color: var(--warning);
}

.badge.is-rejected {
  color: var(--text-tertiary);
}

@media (max-width: 768px) {
  .report-who,
  .report-head .text-xs {
    display: none;
  }
}
