/* Compact project workspace (/Projects and every page with the shared task board): the page is for working
   on tasks, so the header takes one slim row. The title stands on its own (no greeting or intro), "Add task"
   and the project/board action stay in view, every other action sits in the "More" menu, the project's
   sections are tabs (workspace-sections.js) and the drag hint goes. Below 640px the board is built for a phone: flat
   containers, the board's lists as tabs (board-list-tabs.js) and denser task cards. Every action stays
   reachable; touch targets on phones keep 44px. */

/* ── Header, all widths ──────────────────────────────────────────────────────────────── */
.dashboard-taskflow__eyebrow,
.dashboard-taskflow__lede,
.dashboard-taskflow__mark,
.dashboard-board-toolbar__hint { display: none; }

.dashboard-taskflow .dashboard-board-shell__header.dashboard-taskflow__topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .5rem 1rem; margin: 0; padding: .55rem .9rem;
}
.dashboard-taskflow .dashboard-taskflow__brand { gap: 0; min-width: 0; }
.dashboard-taskflow .dashboard-section-title { margin: 0; font-size: 1.2rem; line-height: 1.2; }

.dashboard-taskflow .dashboard-board-shell__actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end;
  gap: .35rem; flex: 0 1 auto; width: auto; max-width: none;
}
.dashboard-taskflow .dashboard-board-shell__actions .dashboard-taskflow__button {
  width: auto; min-height: 36px; padding: .35rem .8rem; white-space: nowrap;
}
.dashboard-taskflow .dashboard-board-shell__actions > .dashboard-taskflow__button--primary { order: -1; }

/* "More": a dropdown under its button; gone when nothing in it applies to the current view. */
.dashboard-board-shell__more { position: relative; }
.dashboard-board-shell__more:not(:has(.dashboard-board-shell__menu > :not([hidden]))) { display: none; }
.dashboard-board-shell__more > summary { list-style: none; cursor: pointer; }
.dashboard-board-shell__more > summary::-webkit-details-marker { display: none; }
.dashboard-board-shell__more > summary::after {
  content: ""; display: inline-block; width: .4em; height: .4em; margin-left: .5rem;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-.15em) rotate(45deg);
}
.dashboard-board-shell__more[open] > summary::after { transform: translateY(.1em) rotate(225deg); }
.dashboard-board-shell__menu {
  position: absolute; top: calc(100% + .3rem); right: 0; z-index: 40;
  display: grid; gap: .25rem; min-width: 15rem; max-width: min(20rem, 90vw); padding: .4rem;
  background: var(--tf-surface, var(--surface)); border: 1px solid var(--tf-border, var(--border));
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.dashboard-taskflow .dashboard-board-shell__menu > .dashboard-taskflow__button {
  justify-content: flex-start; width: 100%; min-height: 40px; text-align: left; white-space: normal;
}

/* Section tabs (workspace-sections.js): Board, Tasks, Ideas, Decisions, Diagrams, Plans, Guides. */
.workspace-sections { display: flex; gap: .3rem; overflow-x: auto; padding: .45rem .9rem; scrollbar-width: none; }
.workspace-sections::-webkit-scrollbar { display: none; }
.workspace-sections > button {
  display: inline-flex; align-items: baseline; gap: .35rem; flex: 0 0 auto; min-height: 36px; padding: .3rem .85rem;
  border: 1px solid var(--tf-border, var(--border)); border-radius: 999px; background: transparent;
  color: inherit; font: inherit; font-size: .85rem; font-weight: 700; white-space: nowrap; cursor: pointer;
}
.workspace-sections > button[aria-current="page"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); }
.workspace-sections > button:disabled { opacity: .45; cursor: not-allowed; }
.workspace-sections > button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.workspace-sections strong { font-variant-numeric: tabular-nums; }
.workspace-sections strong:empty { display: none; }
/* The tabs open these pages, so their header buttons would only repeat them. */
.dashboard-board-shell__actions :is([data-dashboard-decisions], [data-dashboard-plans], [data-dashboard-guides], [data-dashboard-idea-archive]) { display: none !important; }

/* The page of the chosen section slides in below the tabs. */
.workspace-section-panel { padding: .3rem .9rem 1rem; }
.workspace-section-panel iframe { display: block; width: 100%; min-height: 60vh; border: 0; border-radius: var(--radius); background: transparent; }
.workspace-section-panel.is-entering { animation: workspace-section-slide .28s ease-out; }
@keyframes workspace-section-slide { from { opacity: 0; transform: translateX(2.5rem); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .workspace-section-panel.is-entering { animation: none; } }

/* A page inside that panel (_Layout.cshtml sets is-embedded for frame requests): only its content. */
body.is-embedded > :not(main) { display: none !important; }
body.is-embedded > main { margin: 0; padding-block: .25rem; }

/* The count line repeats the "tasks" chip; it stays for screen readers (aria-live) only. */
.dashboard-taskflow .dashboard-board-toolbar { margin: 0; padding: 0; }
.dashboard-taskflow .dashboard-board-toolbar > [data-dashboard-count] {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── Filters and project header, wider screens ─────────────────────────────────────────── */
@media (min-width: 641px) {
  /* The five filters in one row with small captions; "mine", reset, display options and the count below. */
  .board-workspace-tools { display: flex; flex-wrap: wrap; align-items: end; gap: .4rem .6rem; padding: .5rem .7rem; margin-block: .5rem; }
  .board-workspace-tools > label { flex: 1 1 9rem; gap: .1rem; font-size: .72rem; color: var(--text-muted); }
  .board-workspace-tools > label:nth-of-type(2) { flex: 2 1 14rem; }
  .board-workspace-tools > .board-workspace-tools__own { flex: 0 0 auto; font-size: .85rem; color: var(--text); }
  .board-workspace-tools > button { flex: 0 0 auto; }
  .board-workspace-tools > .board-display-options { flex: 0 0 auto; border-top: 0; padding-top: 0; }
  .board-workspace-tools > .board-display-options[open] { flex: 1 1 100%; }
  .board-workspace-tools > p { flex: 1 1 auto; width: auto; align-self: center; text-align: right; font-size: .8rem; }

  /* Project name, its counts as chips, members and scope on one line; the description in one line below. */
  .shared-task-board .dashboard-project-section__name-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; }
  .shared-task-board .dashboard-project-section__description {
    flex: 1 1 100%; order: 9; margin: 0; font-size: .85rem;
    display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  }
  .shared-task-board .dashboard-project-section__summary { display: flex; gap: .3rem; margin: 0; }
  .shared-task-board .dashboard-project-section__summary-item {
    display: inline-flex; align-items: baseline; gap: .25rem; min-height: 0; padding: .1rem .5rem; border-radius: 999px;
  }
  .shared-task-board .dashboard-project-section__summary-item strong { font-size: .85rem; }
  .shared-task-board .dashboard-project-section__summary-item small { font-size: .65rem; }
  .shared-task-board .dashboard-project-section__member-badge,
  .shared-task-board .dashboard-project-section__scope { margin: 0; }
}
/* With a mouse the filter controls can be smaller than the 44px touch size. */
@media (min-width: 641px) and (pointer: fine) {
  .board-workspace-tools input,
  .board-workspace-tools select,
  .board-workspace-tools button,
  .board-workspace-tools .board-workspace-tools__own { height: auto; min-height: 34px; padding-block: .2rem; font-size: .85rem; }
  .board-display-options summary { min-height: 34px; padding-block: .45rem; font-size: .85rem; }
}

@media (max-width: 640px) {
  /* ── Page shell: one frame, full width ───────────────────────────────────────────── */
  .dashboard-page-container { padding-inline: .5rem; }
  .dashboard-taskflow.dashboard-board-shell { padding: .6rem; border-radius: var(--radius); }

  /* ── Header: title, then "Add task" across the width, then the other actions ──────── */
  .dashboard-taskflow .dashboard-board-shell__header.dashboard-taskflow__topbar { padding: 0 0 .5rem; }
  .dashboard-taskflow .dashboard-section-title { font-size: 1.15rem; }
  .dashboard-taskflow .dashboard-board-shell__actions { width: 100%; justify-content: flex-start; }
  .dashboard-taskflow .dashboard-board-shell__actions .dashboard-taskflow__button { min-height: 44px; font-size: .85rem; }
  .dashboard-taskflow .dashboard-board-shell__actions > .dashboard-taskflow__button--primary { flex: 1 1 100%; }
  .dashboard-taskflow .dashboard-board-shell__actions > .dashboard-board-shell__more { margin-left: auto; }
  .dashboard-taskflow .dashboard-board-shell__menu > .dashboard-taskflow__button { min-height: 44px; }
  .workspace-sections { padding: 0 0 .4rem; }
  .workspace-sections > button { min-height: 44px; }
  .workspace-section-panel { padding-inline: 0; }

  /* ── Filters: view + search, then board / list / status, then own + reset ─────────── */
  .board-workspace-tools {
    display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .4rem;
    margin-block: .4rem .6rem; padding: .5rem;
  }
  .board-workspace-tools > label { flex: none; gap: .15rem; font-size: .72rem; color: var(--text-muted); min-width: 0; }
  .board-workspace-tools > label:nth-of-type(1) { grid-column: span 2; }
  .board-workspace-tools > label:nth-of-type(2) { grid-column: span 4; }
  .board-workspace-tools > label:nth-of-type(3),
  .board-workspace-tools > label:nth-of-type(4),
  .board-workspace-tools > label:nth-of-type(5) { grid-column: span 2; }
  .board-workspace-tools > .board-workspace-tools__own { grid-column: span 3; font-size: .82rem; color: var(--text); }
  .board-workspace-tools > button { grid-column: span 3; padding-inline: .5rem; font-size: .82rem; }
  .board-workspace-tools select, .board-workspace-tools input[type="search"] { padding-inline: .5rem; font-size: .85rem; }
  .board-workspace-tools > p { grid-column: 1 / -1; font-size: .78rem; }
  .board-workspace-tools > p:empty { display: none; }

  /* ── Board: flat containers, the cards get the width ──────────────────────────────── */
  .shared-task-board__canvas,
  .shared-task-board .project-task-boards { padding: 0; }
  .shared-task-board .dashboard-project-section { padding: 0; border: 0; background: none; box-shadow: none; }
  .shared-task-board .dashboard-project-section__header { padding: 0 0 .5rem; gap: .35rem; }
  .shared-task-board .dashboard-project-section__name { font-size: 1rem; }
  /* The page header already counts boards and tasks, and the description is in "Edit project". */
  .shared-task-board .dashboard-project-section__description,
  .shared-task-board .dashboard-project-section__summary,
  .shared-task-board .dashboard-project-section__scope { display: none; }
  .shared-task-board .dashboard-project-section__actions {
    flex-wrap: nowrap; overflow-x: auto; gap: .35rem; width: 100%; padding-bottom: .15rem;
  }
  .shared-task-board .dashboard-project-section__actions > * { flex: 0 0 auto; white-space: nowrap; font-size: .8rem; }

  .shared-task-board .project-task-board { border-radius: var(--radius); }
  .shared-task-board .project-task-board__header { padding: .45rem .55rem; gap: .4rem; }
  /* Add task gets its own full row; auto-move and remove share the row under it. */
  .shared-task-board .project-task-board__actions { flex-wrap: wrap; justify-content: flex-start; gap: .4rem; }
  .shared-task-board .project-task-board__add-task { order: -1; flex: 1 1 100%; justify-content: center; font-size: .8rem; }
  .shared-task-board .project-task-board__auto-shift { flex: 1 1 auto; }
  .shared-task-board .dashboard-board-scroll { min-height: 0; padding: .4rem; }
  .shared-task-board .dashboard-board-column { width: 100%; min-width: 0; max-width: none; flex: 1 0 100%; max-height: none; }

  /* Lists as tabs (board-list-tabs.js): the row of list names with counts, one list below it. */
  .board-list-tabs {
    display: flex; gap: .35rem; overflow-x: auto; overscroll-behavior-x: contain;
    margin: 0; padding: .45rem .4rem .15rem; scrollbar-width: none;
  }
  .board-list-tabs::-webkit-scrollbar { display: none; }
  .board-list-tabs__tab {
    display: inline-flex; align-items: center; gap: .4rem; flex: 0 0 auto; min-height: 44px; padding: 0 .8rem;
    border: 1px solid var(--tb-border, var(--border)); border-radius: 999px;
    background: var(--tb-surface-2, var(--bg-subtle)); color: var(--tb-text, var(--text));
    font: inherit; font-size: .82rem; font-weight: 700; white-space: nowrap; cursor: pointer;
  }
  .board-list-tabs__tab[aria-selected="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, var(--bg)); }
  .board-list-tabs__tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .board-list-tabs__count {
    min-width: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: rgba(0, 0, 0, .25);
    font-size: .72rem; font-variant-numeric: tabular-nums; text-align: center;
  }
  .has-list-tabs > .dashboard-board-column.is-tab-hidden { display: none; }
  .has-list-tabs > .dashboard-board-column > .dashboard-board-column__header { display: none; }

  /* Add task and apply template share one row under the list. */
  .shared-task-board .dashboard-board-column { display: flex; flex-wrap: wrap; }
  .shared-task-board .dashboard-board-column > .dashboard-board-column__header,
  .shared-task-board .dashboard-board-column > .dashboard-board-column__cards { flex: 1 0 100%; }
  .shared-task-board .dashboard-board-column > .dashboard-board-column__add { flex: 1 1 0; min-height: 44px; margin: .4rem .2rem 0; font-size: .8rem; }

  /* ── Task cards: denser, two lines of description, actions in one row at the bottom ── */
  .shared-task-board .dashboard-board-column__cards { gap: .45rem; padding: .3rem 0; }
  .shared-task-board .dashboard-task-card { gap: .3rem; padding: .6rem .65rem .55rem; }
  .shared-task-board .dashboard-task-card__title { font-size: .95rem; line-height: 1.25; }
  .shared-task-board .dashboard-task-card__description {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .82rem;
  }
  .shared-task-board .dashboard-task-card__actions { display: flex; gap: .35rem; }
  .shared-task-board .dashboard-task-card__actions .dashboard-icon-button { flex: 1 1 0; min-height: 44px; padding: 0 .4rem; font-size: .78rem; }

  /* ── Task dialog: the format bar is one swipeable row ─────────────────────────────── */
  .task-text-editor__toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .task-text-editor__toolbar::-webkit-scrollbar { display: none; }
  .task-text-editor__toolbar > button { flex: 0 0 auto; }
}
