:root {
  scrollbar-gutter: stable;
  scroll-padding-top: 110px;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
  color: var(--text);
  background: var(--page);
  font-synthesis: none;
  font-size: 14px;
  line-height: 1.5;
  --accent: #246449;
  --line: #dde3da;
  --muted: #626e66;
  color-scheme: light;
  --text: #24312d;
  --page: #f6f7f3;
  --surface: #fff;
  --brand: #63986c;
  --primary: #246449;
  --on-primary: #fff;
  --hover: #eef2eb;
  --border-hover: #8aad91;
  --column: #ecefe8;
  --soft-line: #dfe5dc;
  --tag-bg: #eef3eb;
  --tag-text: #566950;
  --priority: #776746;
  --high: #91611e;
  --danger: #aa3434;
  --field-border: #ccd5ca;
  --focus: #65866c;
  --code-bg: #f0f3ed;
  --toast: #622d2d;
  --warning: #bb923f;
  --tab-bg: #f6f8f4;
  --conflict-bg: #faf9f4;
  --card-shadow: #24312d0a;
  --tab-shadow: #24312d1a;
  --dialog-shadow: #1d2e2433;
  --backdrop: #1d2e2460;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
header {
  min-height: 68px;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand {
  font-size: 25px;
  font-weight: 780;
  letter-spacing: -1px;
  color: var(--text);
  text-decoration: none;
}
.brand-dot {
  color: var(--brand);
}
#breadcrumbs {
  color: var(--muted);
  flex: 1;
  min-width: 0;
  font-size: 13px;
}
#breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}
#breadcrumbs li {
  display: inline;
  overflow-wrap: anywhere;
}
#breadcrumbs li + li::before {
  content: "›";
  margin-right: 8px;
  color: var(--muted);
}
#breadcrumbs a {
  color: var(--muted);
  text-underline-offset: 3px;
}
#breadcrumbs a:hover,
#breadcrumbs [aria-current="page"] {
  color: var(--text);
}
#principal {
  font-size: 12px;
  color: var(--muted);
}
main {
  max-width: 1600px;
  margin: auto;
  padding: 28px;
  min-width: 0;
}
h1 {
  font-size: 28px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  letter-spacing: -1px;
  margin: 0 0 12px;
}
h2 {
  font-size: 17px;
  margin: 0 0 18px;
}
h3 {
  font-size: 15px;
}
a {
  color: var(--accent);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
.button {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  flex-shrink: 0;
  font-weight: 550;
  line-height: 1.4;
}
button:hover,
.button:hover {
  background: var(--hover);
}
button.primary,
.button.primary {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.quiet {
  background: transparent;
  border-color: transparent;
}
kbd {
  margin-left: 22px;
  color: var(--muted);
  font-size: 11px;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.spread {
  justify-content: space-between;
}
.muted,
.eyebrow {
  color: var(--muted);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 11px;
  margin-bottom: 12px;
}
.subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 20px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  margin: 20px 0;
}
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 18px;
  margin-top: 28px;
}
.project {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
  text-decoration: none;
  color: inherit;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
}
.project:hover {
  border-color: var(--border-hover);
}
.project h2 {
  margin: 10px 0;
}
.project p {
  color: var(--muted);
  font-size: 13px;
}
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 18px;
  overflow-x: auto;
  padding-bottom: 8px;
  align-items: stretch;
  height: max(360px, calc(100dvh - 355px));
}
.column {
  background: var(--column);
  border-radius: 9px;
  padding: 12px;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.column h2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 4px 4px 12px;
  margin: 0;
  flex-shrink: 0;
  color: var(--muted);
}
.count {
  background: var(--soft-line);
  border-radius: 4px;
  padding: 3px 7px;
  font-size: 11px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--soft-line);
  border-radius: 7px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: 0 2px 3px var(--card-shadow);
  cursor: grab;
  overflow-wrap: anywhere;
}
.card a {
  display: block;
  text-decoration: none;
  color: inherit;
  font-size: 14px;
  font-weight: 550;
  line-height: 1.5;
  margin: 9px 0 14px;
}
.card-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}
.tag {
  display: inline-block;
  padding: 3px 7px;
  background: var(--tag-bg);
  color: var(--tag-text);
  border-radius: 4px;
  font-size: 11px;
  margin: 2px;
}
.priority {
  font-size: 11px;
  color: var(--priority);
}
.priority.urgent {
  color: var(--danger);
}
.priority.high {
  color: var(--high);
}
.filters {
  margin-top: 22px;
}
label {
  display: block;
  font-size: 13px;
  margin-bottom: 16px;
}
label input,
label select,
label textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
}
input,
select,
textarea {
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  border: 1px solid var(--field-border);
  border-radius: 6px;
  background: var(--surface);
  padding: 10px 12px;
  color: inherit;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
textarea {
  display: block;
  width: 100%;
  min-height: 150px;
  resize: vertical;
  line-height: 1.6;
}
.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.inline input {
  width: 16px;
  height: 16px;
  min-height: 0;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--accent);
}
.editor,
.detail {
  max-width: 960px;
  min-width: 0;
  margin: auto;
}
.editor textarea {
  min-height: 320px;
  font-family: ui-monospace, monospace;
  font-size: 13px;
}
.login {
  max-width: 430px;
  margin: 36px auto;
  padding: 32px;
}
.error {
  color: var(--danger);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.markdown {
  overflow-wrap: anywhere;
  line-height: 1.7;
  font-size: 14px;
}
.markdown pre {
  background: var(--code-bg);
  padding: 16px;
  overflow: auto;
  border-radius: 6px;
}
.markdown code {
  font-size: 12px;
}
.markdown table {
  border-collapse: collapse;
  display: block;
  overflow: auto;
}
.markdown td,
.markdown th {
  padding: 8px;
  border: 1px solid var(--line);
}
.markdown img {
  max-width: 100%;
}
.markdown input {
  width: auto;
  min-height: 0;
}
.comment {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}
.comment .muted {
  font-size: 12px;
}
.links {
  list-style: none;
  padding: 0;
}
.links li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
dialog {
  color: var(--text);
  background: var(--surface);
  width: min(700px, 95vw);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  max-height: 85dvh;
  box-shadow: 0 24px 80px var(--dialog-shadow);
}
dialog::backdrop {
  background: var(--backdrop);
}
#search-query {
  flex: 1;
  min-width: 0;
}
#search-results {
  margin-top: 20px;
  max-height: 55vh;
  overflow: auto;
}
.search-result {
  display: block;
  padding: 14px;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
}
.search-result.selected,
.search-result:hover {
  background: var(--hover);
}
.search-result small {
  display: block;
  color: var(--muted);
  margin-top: 5px;
}
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: min(540px, calc(100vw - 32px));
  overflow-wrap: anywhere;
  padding: 16px 22px;
  background: var(--toast);
  color: var(--on-primary);
  border-radius: 8px;
  z-index: 20;
}
.conflict {
  border-color: var(--warning);
}
.conflict pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}
.danger {
  color: var(--danger);
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}

/* Shared form geometry keeps controls aligned without relying on their content. */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 16px;
}
.form-grid > *,
.row > *,
.task-actions > *,
.relation-form > * {
  min-width: 0;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.editor > .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  padding: 14px 0;
  background: var(--page);
  border-top: 1px solid var(--line);
}
.editor > .form-actions .quiet {
  margin-left: auto;
}
.editor-tabs {
  display: flex;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  background: var(--tab-bg);
}
.editor-tabs button {
  border: 0;
  background: transparent;
  min-height: 32px;
  padding: 6px 14px;
  color: var(--muted);
}
.editor-tabs button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 4px var(--tab-shadow);
}
.editor textarea {
  border-radius: 0 0 7px 7px;
  padding: 16px;
}
.editor-preview {
  border: 1px solid var(--line);
  border-radius: 0 0 7px 7px;
  padding: 16px;
  min-height: 320px;
}
.editor-preview:empty::before {
  content: "Nothing to preview yet.";
  color: var(--muted);
}
.task-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin: 24px 0 18px;
}
.task-actions label {
  margin: 0;
  flex: 0 1 160px;
}
.detail > .muted {
  font-size: 12px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
.detail > a,
.editor > a {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.relation-form {
  display: grid;
  grid-template-columns: 160px 110px minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  margin: 20px 0;
}
.relation-form label {
  margin: 0;
}
.links {
  margin: 0;
}
.links .row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 70px auto;
}
.links a,
.links small {
  overflow-wrap: anywhere;
}
.links .tag {
  justify-self: start;
}
.links li > small {
  display: block;
  margin-top: 6px;
}
.comment-form {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.comment-form .markdown {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  margin-bottom: 16px;
}
.comment .muted {
  overflow-wrap: anywhere;
}
.login > .primary {
  width: 100%;
  margin-top: 12px;
}
.login h1 {
  font-size: 26px;
}
.login .error:empty {
  display: none;
}
.stack {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
  padding: 0 3px 0 0;
  scrollbar-width: thin;
}
.stack:empty::after {
  content: "No tasks";
  display: block;
  padding: 26px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  border: 1px dashed var(--field-border);
  border-radius: 6px;
}
.card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 2px 8px var(--card-shadow);
}
.card > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 8px;
}
.card a {
  margin: 8px 0;
}
.project > .row:last-child {
  margin-top: auto;
  padding-top: 16px;
}
.filters {
  display: grid;
  grid-template-columns: minmax(160px, 280px) 180px auto;
  justify-content: start;
}
.filters > * {
  width: 100%;
}
.board-page > .muted,
.board-results > .muted {
  font-size: 12px;
  margin: 12px 0 0;
}
.markdown > :first-child {
  margin-top: 0;
}
.markdown > :last-child {
  margin-bottom: 0;
}
.markdown blockquote {
  border-left: 3px solid var(--line);
  margin-left: 0;
  padding-left: 16px;
  color: var(--muted);
}
.markdown pre {
  max-width: 100%;
}
.search-result {
  overflow-wrap: anywhere;
}
#search-dialog > .row {
  flex-wrap: nowrap;
}
dialog > button + button {
  margin-left: 8px;
}
.conflict details {
  margin: 16px 0;
  padding: 12px;
  background: var(--conflict-bg);
  border-radius: 6px;
}
.conflict pre {
  max-width: 100%;
}
.conflict > button {
  margin: 4px 8px 4px 0;
}
@media (max-width: 900px) {
  #principal {
    display: none;
  }
  header {
    gap: 12px;
    padding: 12px 20px;
  }
  .relation-form {
    grid-template-columns: 1fr 1fr;
  }
  .relation-form > button {
    justify-self: end;
  }
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .form-grid > :last-child {
    grid-column: 1 / -1;
  }
  .links .row {
    grid-template-columns: 100px minmax(0, 1fr) auto;
  }
  .links .row > small {
    display: none;
  }
}
@media (max-width: 600px) {
  header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 16px;
  }
  .brand {
    font-size: 22px;
    margin-right: auto;
  }
  #breadcrumbs {
    order: 4;
    flex-basis: 100%;
    font-size: 12px;
  }
  #breadcrumbs:empty {
    display: none;
  }
  header button {
    padding: 8px;
  }
  kbd {
    display: none;
  }
  main {
    padding: 22px 16px;
  }
  h1 {
    font-size: 24px;
  }
  .panel {
    padding: 18px;
    margin: 18px 0;
  }
  .board {
    grid-template-columns: repeat(4, minmax(260px, 80vw));
    height: max(360px, calc(100dvh - 350px));
    scroll-snap-type: x proximity;
  }
  .column {
    scroll-snap-align: start;
  }
  .filters {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .filters > input {
    grid-column: 1 / -1;
  }
  .task-actions {
    gap: 10px;
  }
  .task-actions label {
    flex: 1 1 calc(50% - 10px);
  }
  .task-actions > .button,
  .task-actions > button {
    flex: 1;
  }
  .links .row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .links .row > .tag {
    grid-column: 1 / -1;
  }
  .editor > .form-actions .quiet {
    margin-left: 0;
  }
  .editor > .form-actions {
    padding-bottom: 12px;
  }
  .editor textarea {
    min-height: 260px;
  }
  .login {
    margin: 12px auto;
    padding: 24px;
  }
  .project {
    padding: 20px;
  }
  dialog {
    color: var(--text);
    background: var(--surface);
    padding: 18px;
  }
  input,
  select,
  textarea {
    font-size: 16px;
  }
  #toast {
    bottom: 16px;
    right: 16px;
  }
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --text: #e1e9e3;
    --page: #151b18;
    --surface: #202823;
    --accent: #9cd5ae;
    --primary: #2b6848;
    --brand: #91c79e;
    --line: #3b4840;
    --muted: #acb9af;
    --hover: #303d33;
    --border-hover: #74967b;
    --column: #1b231e;
    --soft-line: #36443a;
    --tag-bg: #2e3f32;
    --tag-text: #b6d4b8;
    --priority: #d8c490;
    --high: #e2bb75;
    --danger: #f29a94;
    --field-border: #516055;
    --focus: #91c79e;
    --code-bg: #18201b;
    --toast: #763f3b;
    --warning: #b59b56;
    --tab-bg: #19211c;
    --conflict-bg: #302d21;
    --card-shadow: #00000020;
    --tab-shadow: #00000030;
    --dialog-shadow: #00000060;
    --backdrop: #00000090;
  }
}

/* Discussion and dialogs share the same reading width and action hierarchy. */
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.section-heading h2 {
  margin: 0;
}
.activity .comment-form {
  border: 0;
  padding: 0 0 24px;
}
.comment-form > label {
  margin-bottom: 10px;
}
.comment-form textarea {
  border-radius: 0 0 7px 7px;
  padding: 14px;
  min-height: 140px;
}
.comment-form .comment-preview {
  margin: 0;
  border-radius: 0 0 7px 7px;
  min-height: 140px;
}
.comment-preview:empty::before {
  content: "Nothing to preview yet.";
  color: var(--muted);
}
.comment-form .form-actions {
  justify-content: space-between;
  margin-top: 12px;
}
.timeline {
  border-top: 1px solid var(--line);
}
.timeline .comment {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 14px;
  padding: 24px 0;
  border: 0;
}
.timeline .comment + .comment {
  border-top: 1px solid var(--line);
}
.comment-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-size: 12px;
  font-weight: 650;
}
.comment-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 4px 0 14px;
  font-size: 12px;
}
.comment-heading strong {
  overflow-wrap: anywhere;
}
.comment-heading time {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}
.comment-content {
  min-width: 0;
}
.comment-content .markdown h2 {
  font-size: 16px;
  margin-bottom: 12px;
}
.comment-content .markdown h1 {
  font-size: 20px;
}
.timeline .system-event {
  padding: 16px 0;
}
.system-event .comment-avatar {
  background: transparent;
  font-size: 18px;
  color: var(--muted);
}
.system-event .markdown {
  color: var(--muted);
  font-size: 12px;
}
.system-event .comment-heading {
  margin-bottom: 6px;
}
.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 20px;
  font-size: 13px;
}
.action-dialog {
  width: min(480px, calc(100vw - 32px));
  padding: 0;
}
.modal-form {
  padding: 24px;
}
.modal-heading {
  margin-bottom: 22px;
}
.modal-heading h2 {
  font-size: 20px;
  margin-bottom: 8px;
}
.modal-heading p {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}
.modal-content {
  display: grid;
  gap: 14px;
  overflow-wrap: anywhere;
}
.modal-content:empty {
  display: none;
}
.modal-content p {
  margin: 0 0 20px;
}
.modal-content label {
  margin: 0;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 24px;
}
.modal-error {
  margin: 16px 0 0;
  font-size: 13px;
}
button.destructive {
  background: var(--toast);
  border-color: var(--toast);
  color: var(--on-primary);
}
.conflict-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.conflict-values > div {
  min-width: 0;
  background: var(--surface);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.conflict-values strong {
  font-size: 12px;
  color: var(--muted);
}
.conflict-values pre {
  max-height: 240px;
  overflow: auto;
}
.conflict summary {
  font-weight: 600;
  cursor: pointer;
}
.search-kinds {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  border: 0;
  padding: 0;
  margin: 1rem 0 0.75rem;
  min-width: 0;
}
.search-kinds legend {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}
.search-kinds .inline {
  margin: 0;
}
#search-results h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 0 12px;
  margin: 20px 0 8px;
}
.search-result strong {
  font-weight: 550;
}
@media (max-width: 600px) {
  .timeline .comment {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 10px;
  }
  .comment-avatar {
    width: 26px;
    height: 26px;
  }
  .comment-heading {
    margin-top: 2px;
  }
  .comment-heading time {
    margin-left: 0;
    flex-basis: 100%;
  }
  .comment-form .form-actions > small {
    font-size: 11px;
  }
  .modal-form {
    padding: 20px;
  }
  .modal-actions > button {
    flex: 1;
  }
  .conflict-values {
    grid-template-columns: 1fr;
  }
}

.mobile-footer {
  display: none;
}
@media (max-width: 600px) {
  header .connect-agent {
    display: none;
  }
  .mobile-footer {
    display: block;
    padding: 16px;
    border-top: 1px solid var(--line);
    font-size: 13px;
  }
  .mobile-footer a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--muted);
    text-underline-offset: 3px;
  }
}

.task-picker {
  position: relative;
  min-width: 0;
}
.completion-popup {
  position: absolute;
  z-index: 20;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: var(--surface);
  border: 1px solid var(--field-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px var(--dialog-shadow);
  overflow: hidden;
}
.modal-content .completion-message {
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  background: var(--tab-bg);
}
.completion-list {
  position: relative;
  max-height: 240px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.completion-option {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  cursor: pointer;
}
.completion-option:hover,
.completion-option[aria-selected="true"] {
  background: var(--hover);
}
.completion-option[aria-selected="true"] {
  box-shadow: inset 3px 0 var(--accent);
}
.completion-id {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}
.completion-text {
  min-width: 0;
}
.completion-text strong {
  display: block;
  font-size: 13px;
  font-weight: 550;
  overflow-wrap: anywhere;
}
.completion-text small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
  margin-top: 4px;
}
.modal-content .completion-selection {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--accent);
}
#search-results {
  position: relative;
  overscroll-behavior: contain;
}
.search-state {
  padding: 20px 12px;
  color: var(--muted);
}
.search-result {
  border: 1px solid transparent;
  margin-bottom: 4px;
}
.search-result.selected {
  border-color: var(--border-hover);
}
.search-result > small:last-child {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
@media (max-width: 600px) {
  .completion-option {
    padding: 10px;
    gap: 6px;
    grid-template-columns: 42px minmax(0, 1fr);
  }
}

select {
  -webkit-appearance: none;
  appearance: none;
  min-height: 42px;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%237c8d80' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
}
.completion-list {
  max-height: min(210px, 30dvh);
}

.completion-text strong {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
button,
.button {
  min-height: 42px;
}

.board-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 0;
}
.board-page .filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}
.board-page .filters > * {
  width: auto;
}
.board-page .filters > input {
  width: min(100%, 280px);
}
.board-page .filters > select {
  width: 180px;
}
.board-page .filters > .board-toolbar {
  flex: 1 1 auto;
}
.board-toolbar > .muted {
  font-size: 12px;
}
.view-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.view-switch button,
.view-switch .button {
  border-color: transparent;
  min-height: 34px;
  padding: 6px 16px;
}
.view-switch [aria-pressed="true"],
.view-switch [aria-current="page"] {
  background: var(--primary);
  color: var(--on-primary);
}
.table-scroll-hint {
  margin-left: auto;
}
.task-table-region {
  margin-top: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.task-table-region:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.task-table {
  width: 100%;
  min-width: 1000px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.task-table th,
.task-table td {
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.task-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--tab-bg);
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  font-weight: 600;
}
.task-table th:nth-child(1) {
  width: 32%;
}
.task-table th:nth-child(2),
.task-table th:nth-child(3) {
  width: 10%;
}
.task-table th:nth-child(4) {
  width: 17%;
}
.task-table th:nth-child(5) {
  width: 15%;
}
.task-table th:nth-child(6) {
  width: 16%;
}
.task-table tbody tr:last-child > * {
  border-bottom: 0;
}
.task-table tbody tr:hover {
  background: var(--hover);
}
.task-table-title {
  font-weight: 550;
}
.task-table-title a {
  display: block;
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.task-table-title a:hover {
  text-decoration: underline;
}
.task-table-id {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  margin-bottom: 5px;
}
.task-table-assigned,
.task-table-updated {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.task-table-tags .tag {
  margin: 0 4px 4px 0;
  overflow-wrap: anywhere;
}
.task-status {
  display: inline-block;
  font-size: 12px;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--tag-bg);
  color: var(--tag-text);
}
.status-doing {
  color: var(--accent);
  background: var(--hover);
}
.status-blocked {
  color: var(--danger);
}
.status-done {
  color: var(--muted);
}
.table-empty {
  text-align: center;
  padding: 48px 24px;
}
.table-empty p {
  margin-bottom: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 600px) {
  .board-toolbar {
    gap: 10px;
  }
  .table-scroll-hint {
    margin-left: 0;
    flex-basis: 100%;
  }
  .task-table {
    min-width: 900px;
  }
  .task-table th,
  .task-table td {
    padding: 12px;
  }
}

body:has(.task-table-region) {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
body:has(.task-table-region) > header,
body:has(.task-table-region) > footer {
  flex-shrink: 0;
}
main:has(.task-table-region) {
  width: 100%;
  padding-bottom: 12px;
  margin: 0 auto;
}
main:has(.task-table-region),
.board-page:has(.task-table-region),
.board-results:has(.task-table-region) {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: auto;
}
.board-page:has(.task-table-region) > :not(.board-results),
.board-results:has(.task-table-region) > :not(.task-table-region) {
  flex-shrink: 0;
}
.task-table-region {
  flex: 1;
  min-height: 200px;
  contain: size;
}

.table-scroll-hint {
  display: none;
}
@media (max-width: 1100px) {
  .table-scroll-hint {
    display: block;
  }
}

.memory-filters {
  display: grid;
  grid-template-columns: minmax(180px, 2fr) minmax(150px, 1fr) minmax(120px, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin: 24px 0;
}
.memory-filters label {
  margin: 0;
}
.memory-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.memory-sidebar {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
}
.memory-list {
  max-height: 62dvh;
  overflow-y: auto;
}
.memory-item {
  display: block;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.memory-item:hover,
.memory-item[aria-current="page"] {
  background: var(--hover);
}
.memory-item[aria-current="page"] {
  box-shadow: inset 3px 0 var(--accent);
}
.memory-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 8px;
}
.memory-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 600;
}
.memory-item p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
  overflow-wrap: anywhere;
}
.memory-item small {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.memory-pagination {
  display: flex;
  flex-wrap: wrap;
  overflow-wrap: anywhere;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.memory-pagination button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}
.memory-pagination span {
  font-size: 11px;
}
.memory-detail.panel {
  margin: 0;
  min-width: 0;
}
.memory-detail h2 {
  font-size: 25px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.memory-title {
  align-items: flex-start;
}
.memory-title h2 {
  flex: 1 1 200px;
  min-width: 0;
}
.memory-title > .button {
  flex-shrink: 0;
  margin-left: auto;
}
.memory-detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.memory-detail-meta a {
  overflow-wrap: anywhere;
}
.memory-tags {
  margin-top: 12px;
}
.memory-body {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.memory-audit {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 16px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin: 24px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.memory-audit dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.memory-placeholder,
.memory-empty {
  text-align: center;
  padding: 40px 16px;
}
.memory-back {
  display: inline-block;
  margin-bottom: 20px;
  font-size: 13px;
}
#section-switch {
  flex-shrink: 0;
}
@media (max-width: 600px) {
  #section-switch {
    order: 3;
    width: 100%;
  }
  #section-switch .button {
    flex: 1;
  }
}
@media (max-width: 760px) {
  .memory-filters {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .memory-filters > :first-child {
    grid-column: 1 / -1;
  }
  .memory-filters > button {
    grid-column: 1 / -1;
  }
  .memory-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .memory-page:not(.has-selection) .memory-detail {
    display: none;
  }
  .memory-page.has-selection .memory-sidebar {
    display: none;
  }
  .memory-page.has-selection .memory-filters {
    display: none;
  }
  .memory-list {
    max-height: none;
  }
  .memory-detail h2 {
    font-size: 22px;
  }
  .memory-audit {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .memory-audit dt:not(:first-child) {
    margin-top: 10px;
  }
}

.task-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 8px;
  font-size: 12px;
  text-align: center;
}

.board-page > [role="status"]:empty {
  display: none;
}

.board.single-status {
  grid-template-columns: minmax(250px, 600px);
}
.task-status.status-deleted {
  background: var(--column);
  color: var(--muted);
}

.relations .section-heading:last-child {
  margin-bottom: 0;
}
.comment-composer {
  margin-top: 16px;
}
.comment-composer > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  padding: 10px 0;
}
.comment-composer > summary:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}
.comment-composer .form-actions small {
  display: block;
}
.comment-composer [role="status"]:empty {
  display: none;
}

#page-loading {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: 0 2px 8px var(--card-shadow);
  pointer-events: none;
}

/* Keep the first paint the same size as the authenticated page shell. */
main {
  min-height: calc(100dvh - 69px);
}
[data-starting] #section-switch {
  display: flex !important;
  opacity: 0.5;
}
[data-starting] #logout {
  display: inline-block !important;
  visibility: hidden;
}
[data-starting] #breadcrumbs {
  display: block !important;
  min-height: 1.5em;
  visibility: hidden;
}
[data-starting] #principal {
  visibility: hidden;
}
[data-starting] #page-loading {
  display: none !important;
}
.initial-loading > p {
  color: var(--muted);
  margin: 0 0 20px;
}
.initial-placeholder > div {
  background: var(--column);
  border-radius: 8px;
}
.placeholder-title {
  height: 36px;
  width: min(380px, 70%);
  margin-bottom: 20px;
}
.placeholder-line {
  height: 40px;
  width: min(680px, 100%);
  margin-bottom: 24px;
}
.placeholder-panel {
  height: 52dvh;
  min-height: 240px;
}
@media (max-width: 600px) {
  main {
    min-height: calc(100dvh - 220px);
  }
}

[data-starting] #breadcrumbs::before {
  content: "";
  display: block;
  visibility: visible;
  width: min(220px, 75%);
  height: 12px;
  margin: 3px 0;
  border-radius: 4px;
  background: var(--column);
}

.project-settings > .view-switch {
  display: inline-flex;
  margin-top: 12px;
}
.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.member-row strong {
  overflow-wrap: anywhere;
  min-width: 0;
}
.member-row button {
  margin-left: auto;
}
.binding-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) minmax(100px, 1fr) minmax(0, 3fr);
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.binding-row > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-wrap: anywhere;
  min-width: 0;
}
.binding-row .muted {
  font-size: 12px;
}
.member-row:last-child,
.binding-row:last-child {
  border-bottom: 0;
}
@media (max-width: 600px) {
  .binding-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .binding-row > div:last-child {
    grid-column: 1 / -1;
  }
}

.assignment-label { overflow-wrap: anywhere; font-family: monospace; }

.board-summaries { display: flex; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.board-summary { flex: 1 1 260px; min-width: 0; padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; }
.board-summary summary { cursor: pointer; font-weight: 600; }
.board-summary li { margin: 8px 0; overflow-wrap: anywhere; }

.scope-controls { display: flex; flex-wrap: wrap; gap: 12px; min-width: 0; }
.scope-controls label { min-width: 0; }
.scope-controls select, .scope-controls input { max-width: 100%; }
.stats-totals, .stats-groups { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stats-totals .panel { margin: 0; }
.stats-totals strong { display: block; font-size: 32px; }
.stats-breakdown { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.stats-breakdown dd { margin: 0; }
@media (max-width: 600px) { .stats-groups { grid-template-columns: 1fr; } }

.task-browser-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.task-browser-filters label { margin-bottom: 0; }
.task-browser .task-table-title small { display: block; margin-top: 6px; overflow-wrap: anywhere; }

.projects-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.projects-heading h1 { margin-bottom: 4px; }
.projects-heading p { margin: 0; }
.projects-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin: 22px 0; }
.workspace-nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.workspace-nav > * { display: flex; align-items: center; min-height: 40px; padding: 8px 12px; border-radius: 5px; color: var(--text); text-decoration: none; font-weight: 550; }
.workspace-nav [aria-current] { background: var(--primary); color: var(--on-primary); }
.workspace-nav a:hover { background: var(--hover); }
.project-scope-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.project-scope-form label { margin: 0; }
.project-scope-form .inline { min-height: 40px; }
.project-scope-form .scope-controls > label:first-child select { margin: 0; }
@media (max-width: 600px) {
  .projects-toolbar, .project-scope-form { gap: 12px; }
  .workspace-nav { width: 100%; }
  .workspace-nav > * { flex: 1; justify-content: center; padding: 8px; font-size: 13px; }
  .projects-heading .primary { flex-shrink: 0; }
}

.search-advanced { padding: 12px 20px; border-bottom: 1px solid var(--line); }
.search-advanced summary { cursor: pointer; font-weight: 550; }
.search-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.search-options label { margin: 0; min-width: 0; }
.search-options input, .search-options select { width: 100%; }
.search-advanced p { font-size: 12px; margin-bottom: 0; }

.search-help { margin-top: 10px; font-size: 13px; }
.search-help summary { cursor: pointer; display: inline-block; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; list-style: none; padding: 4px 0; }
.search-help summary::-webkit-details-marker { display: none; }
.search-help summary:hover { color: var(--text); }
.search-help-content { max-height: 40dvh; overflow: auto; overscroll-behavior: contain; }
.search-help-content table { font-size: 13px; }
.search-help-content td, .search-help-content th { white-space: normal; overflow-wrap: anywhere; }
.search-help-content code { white-space: normal; }
.search-help p { color: var(--muted); line-height: 1.5; }

.conflict-markdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.conflict-markdown textarea { width: 100%; min-height: 260px; }
.conflict-markdown section { min-width: 0; }
.conflict-markdown .markdown { max-height: 420px; overflow: auto; }
@media (max-width: 640px) { .conflict-markdown { grid-template-columns: 1fr; } }

.editor:has(.conflict:not([hidden])) .form-actions { position: static; margin-top: 16px; }


.search-history { margin: 8px 0; font-size: 13px; }
.search-history summary { cursor: pointer; color: var(--muted); }
#search-history-list { display: grid; max-height: 25dvh; overflow: auto; margin-top: 8px; }
#search-history-list button { text-align: left; white-space: normal; overflow-wrap: anywhere; }
