:root {
  color-scheme: dark;
  --ink: #eef3f5;
  --muted: #a8b3ba;
  --paper: #0c1116;
  --panel: #141b22;
  --panel-raised: #19222b;
  --line: #34414c;
  --line-subtle: #27333d;
  --accent: #73c8bc;
  --accent-strong: #9ae2d8;
  --accent-soft: #173b39;
  --ochre: #e5b66c;
  --red: #ff9189;
  --red-soft: #3e2223;
  --blue: #83c9f4;
  --radius: 6px;
  --shadow: 0 8px 24px rgb(0 0 0 / 18%);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a {
  color: var(--accent-strong);
  text-underline-offset: 3px;
}

a:hover {
  color: #c1f3ed;
  text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #ffd078;
  outline-offset: 3px;
}

textarea:focus-visible {
  outline: 3px solid #ffd078;
  outline-offset: 3px;
}

.flash,
.warning,
.form-error {
  margin: 0 0 22px;
  padding: 13px 16px;
  border: 1px solid #39756f;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
}

.warning { border-color: #6b512d; border-left-color: var(--ochre); background: #2d251a; }
.form-error { border-color: #754347; border-left-color: var(--red); background: var(--red-soft); }
.form-heading, .error-page { max-width: 820px; margin-bottom: 28px; }
.form-heading h1, .error-page h1 { margin: 5px 0 10px; font: 700 clamp(32px, 4vw, 48px) / 1.08 Georgia, serif; }
.title-tags, .task-controls, .form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.title-tags { margin: 10px 0 4px; }
.task-controls { margin-top: 22px; }
.task-controls form { margin: 0; }
.button, .task-controls button, .form-actions button { display: inline-flex; align-items: center; min-height: 40px; border: 1px solid #6ec4b8; border-radius: 3px; padding: 8px 15px; background: #23645e; color: #fff; font: 700 14px ui-sans-serif, system-ui; text-decoration: none; cursor: pointer; }
.button.secondary { background: #25333d; border-color: #61727c; }
.task-controls .danger, .form-actions .danger, .danger-link { background: #663238; border-color: #a65a61; }
.edit-form { max-width: 900px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.create-form { max-width: 1020px; }
.edit-form fieldset { margin: 0 0 24px; padding: 18px; border: 1px solid var(--line); }
.edit-form legend { padding: 0 8px; color: var(--ochre); font-weight: 800; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.edit-form label { display: block; }
.edit-form label > span { display: block; margin-bottom: 6px; font-weight: 750; }
.edit-form label small { display: block; margin-top: 5px; color: var(--muted); }
.edit-form .wide { grid-column: 1 / -1; }
.edit-form input, .edit-form select, .edit-form textarea { width: 100%; border: 1px solid #596873; border-radius: 3px; background: #0f161c; color: var(--ink); padding: 10px; font: inherit; }
.edit-form textarea { resize: vertical; }
.edit-form .checkbox { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 10px; }
.edit-form .checkbox input { width: auto; grid-row: 1 / span 2; }
.edit-form .checkbox > span, .edit-form .checkbox small { margin: 0; }
.heading-actions { display: flex; align-items: center; gap: 14px; }
.form-actions { margin-top: 24px; }
.error-page { padding: 50px 0; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 10;
  border: 1px solid var(--line);
  background: var(--panel-raised);
  color: var(--ink);
  padding: 8px 12px;
}

.skip-link:focus {
  left: 8px;
}

.site-header {
  background: #10171d;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 5px 18px rgb(0 0 0 / 22%);
}

.header-inner {
  max-width: 1240px;
  min-height: 66px;
  margin: auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  color: #f7fafb;
  font: 21px Georgia, serif;
  text-decoration: none;
  white-space: nowrap;
}

.brand span {
  color: #9fafb7;
  font: 13px ui-sans-serif, system-ui;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.site-header nav {
  display: flex;
  align-self: stretch;
}

.site-header nav a {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: #c3ced3;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.site-header nav a:hover,
.site-header nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--accent);
}

.read-only {
  margin-left: auto;
  border: 1px solid #61727c;
  border-radius: 99px;
  padding: 4px 10px;
  color: #dce5e8;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.page-shell,
footer {
  max-width: 1240px;
  margin: auto;
}

.page-shell {
  padding: 42px 24px 70px;
}

footer {
  padding: 24px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.page-heading,
.detail-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 32px;
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.page-heading h1,
.detail-heading h1 {
  margin: 4px 0 10px;
  color: #f8fafb;
  font: 700 clamp(34px, 4vw, 52px) / 1.05 Georgia, serif;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 740px;
  margin: 0;
  color: #c0cbd0;
  font: 18px/1.5 Georgia, serif;
}

.eyebrow {
  margin: 0;
  color: var(--ochre);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.revision,
.record-id {
  color: var(--muted);
  font-size: 12px;
}

.revision {
  white-space: nowrap;
}

.revision code,
.record-id {
  font-family: ui-monospace, monospace;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 48px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metrics div {
  padding: 20px 24px;
  border-right: 1px solid var(--line);
}

.metrics div:last-child {
  border: 0;
}

.metrics strong {
  display: block;
  color: #fff;
  font: 700 32px Georgia, serif;
}

.metrics span,
.project-card > p,
.completion-panel p,
.task-row p {
  color: var(--muted);
}

.metrics span {
  font-size: 13px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 42px 0 18px;
}

.section-heading h2,
.completion-panel h2 {
  margin: 2px 0;
  color: #f4f8f9;
  font: 700 26px Georgia, serif;
}

.section-heading > a {
  font-weight: 700;
  white-space: nowrap;
}

.queue-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.queue {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.queue.alert {
  border-left-color: var(--red);
}

.queue > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 42px;
  padding: 9px 15px;
  border-bottom: 1px solid var(--line-subtle);
  background: var(--panel-raised);
}

.queue h3 {
  margin: 0;
  font-size: 14px;
}

.queue header span,
.side-panel h2 span {
  min-width: 25px;
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 2px 7px;
  background: #202a33;
  color: #d2dce0;
  font: 12px ui-sans-serif, system-ui;
  text-align: center;
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.task-list li {
  display: grid;
  grid-template-columns: 230px minmax(240px, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding: 9px 15px;
  border-bottom: 1px solid var(--line-subtle);
}

.task-list li:last-child {
  border: 0;
}

.task-list a {
  min-width: 0;
  color: #e8f5f3;
  font-weight: 680;
  line-height: 1.35;
  text-decoration: none;
}

.meta,
.card-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-top {
  margin-top: 8px;
}

.task-list .meta {
  margin: 0;
}

.task-list .queue-tags {
  justify-content: flex-start;
}

.task-list .queue-timing {
  justify-content: flex-end;
}

.role,
.status,
.project-tag {
  display: inline-flex;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.35;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.role.isp {
  background: #392d18;
  color: #f3ca83;
  border-color: #69502a;
}

.role.epic {
  background: #162f40;
  color: #9bd7fa;
  border-color: #285673;
}

.role.general {
  background: #2d263b;
  color: #d8c1f2;
  border-color: #504369;
}

.status {
  background: #252f37;
  color: #c8d2d7;
  border-color: #3e4b55;
}

.status.active,
.status.next,
.status.in_progress {
  background: var(--accent-soft);
  color: #9ee3da;
  border-color: #28625d;
}

.status.on-hold,
.status.waiting {
  background: #382d1d;
  color: #edc681;
  border-color: #66502d;
}

.status.done {
  background: #28323a;
  color: #bac5cb;
  border-color: #46535d;
}

.status.scheduled {
  background: #1d3042;
  color: #9ecff2;
  border-color: #345875;
}

.status.cancelled {
  background: #382426;
  color: #e8a7aa;
  border-color: #684044;
}

.project-palette-0 { background: #173b39; color: #9be2d8; border-color: #2b6b65; }
.project-palette-1 { background: #302947; color: #d2c4ff; border-color: #584b83; }
.project-palette-2 { background: #3b2b19; color: #f0ca8a; border-color: #6d4e29; }
.project-palette-3 { background: #173449; color: #a7d8f5; border-color: #2d5d7b; }
.project-palette-4 { background: #3b242f; color: #f1b2ca; border-color: #6e4052; }
.project-palette-5 { background: #263718; color: #bde48f; border-color: #49662f; }
.project-palette-6 { background: #3c2922; color: #f1b39d; border-color: #704a3c; }
.project-palette-7 { background: #26343a; color: #b6d7df; border-color: #49636d; }
.project-palette-general { background: #2d3035; color: #d0d5d9; border-color: #51575e; }

.empty {
  margin: 0;
  padding: 9px 15px;
  color: var(--muted);
  font-style: italic;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.project-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.project-card h2,
.project-card h3 {
  margin: 14px 0 8px;
  color: #f2f7f8;
  font: 700 22px Georgia, serif;
}

.project-card h2 a,
.project-card h3 a {
  text-decoration: none;
}

.compact-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(75px, 1fr));
  margin: 20px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.compact-stats div {
  padding: 0 10px;
  border-right: 1px solid var(--line);
}

.compact-stats div:first-child {
  padding-left: 0;
}

.compact-stats div:last-child {
  border: 0;
}

.compact-stats dt,
.metadata dt,
.task-row dt,
.stacked dt {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.compact-stats dd,
.metadata dd,
.task-row dd,
.stacked dd {
  margin: 2px 0 0;
  color: #e7edef;
  font-weight: 650;
}

.compact-stats dd {
  white-space: nowrap;
}

.completion-panel {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  margin-top: 48px;
  padding: 26px;
  border: 1px solid var(--line);
  border-left: 4px solid #788d96;
  background: var(--panel);
}

.completion-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.completion-panel li {
  display: grid;
  grid-template-columns: 75px 1fr;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-subtle);
}

.completion-panel time {
  color: var(--muted);
  font-size: 12px;
}

.breadcrumbs {
  display: flex;
  gap: 8px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 13px;
}

.detail-heading {
  align-items: flex-start;
}

.detail-heading > div {
  max-width: 760px;
}

.metadata {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-width: 350px;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--panel);
}

.metadata div {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.metadata div:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(270px, 1fr);
  align-items: start;
  gap: 48px;
}

.narrative {
  margin-bottom: 30px;
  padding: 0 0 30px;
  border-bottom: 1px solid var(--line);
}

.narrative h2,
.blocker-callout h2,
.side-panel h2 {
  margin: 0 0 13px;
  color: #f1f5f6;
  font: 700 21px Georgia, serif;
}

.prose {
  max-width: 75ch;
  overflow-wrap: anywhere;
}

.prose p {
  margin: 0 0 15px;
}

.prose ul {
  padding-left: 20px;
}

.blocker-callout {
  margin: 0 0 28px;
  padding: 18px 22px;
  border: 1px solid #6b512d;
  border-left: 4px solid var(--ochre);
  background: #2d251a;
}

.blocker-callout ul {
  margin-bottom: 0;
}

.side-panel {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-top: 3px solid #71838c;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.side-panel h2 {
  display: flex;
  justify-content: space-between;
}

.side-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.side-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 0;
  border-top: 1px solid var(--line-subtle);
}

.side-list li:first-child {
  border-top: 0;
}

.side-list a {
  font-weight: 650;
  text-decoration: none;
}

.side-list small {
  color: var(--muted);
}

.side-list em {
  color: var(--red);
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.subdued {
  opacity: 0.82;
}

.filters {
  display: grid;
  grid-template-columns: 2fr repeat(4, 1fr) auto auto;
  align-items: end;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.filters label span {
  display: block;
  margin-bottom: 5px;
  color: #bbc6cb;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.filters input,
.filters select {
  width: 100%;
  height: 40px;
  border: 1px solid #596873;
  border-radius: 3px;
  background: #0f161c;
  color: var(--ink);
  padding: 0 9px;
}

.filters input::placeholder {
  color: #7f8d95;
  opacity: 1;
}

.filters button {
  height: 40px;
  border: 1px solid #6ec4b8;
  border-radius: 3px;
  padding: 0 16px;
  background: #23645e;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.filters button:hover {
  background: #2c7770;
}

.filters .clear {
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 5px;
}

.result-count {
  margin: 22px 0 10px;
  color: var(--muted);
}

.task-cards {
  border-top: 1px solid var(--line);
}

.task-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 24px;
  padding: 21px 16px;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--panel);
}

.task-row h2 {
  margin: 7px 0 5px;
  color: #f1f6f7;
  font: 700 19px Georgia, serif;
}

.task-row h2 a {
  text-decoration: none;
}

.task-row dl {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  align-content: center;
  margin: 0;
}

.task-row dl div {
  min-width: 0;
  padding: 0 12px;
  border-left: 1px solid var(--line);
}

.task-row dd {
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 60px;
  border: 1px solid var(--line);
  background: var(--panel);
  text-align: center;
}

.task-detail-heading h1 {
  font-size: clamp(30px, 4vw, 46px);
}

.stacked {
  margin: 0;
}

.stacked dd {
  margin: 0 0 12px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

.record-id {
  margin-top: 18px;
}

.comment {
  padding-left: 16px;
  border-left: 3px solid var(--line);
}

.comment header {
  color: var(--muted);
  font-size: 12px;
}

.not-found {
  max-width: 600px;
  padding: 80px 0;
}

.not-found h1 {
  font: 700 45px Georgia, serif;
}

@media (max-width: 950px) {
  .project-grid {
    grid-template-columns: 1fr 1fr;
  }

  .filters {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .filters .search {
    grid-column: span 2;
  }

  .detail-layout {
    gap: 24px;
  }

  .task-row {
    grid-template-columns: 1fr;
  }

  .task-row dl {
    max-width: 560px;
  }

  .header-inner {
    gap: 12px;
  }

  .brand span {
    display: none;
  }
}

@media (max-width: 650px) {
  .form-grid { grid-template-columns: 1fr; }
  .edit-form { padding: 18px 14px; }
  .edit-form .wide { grid-column: auto; }
  .task-controls { align-items: stretch; }
  .task-controls > * { flex: 1 1 auto; justify-content: center; }
  .task-controls form button { width: 100%; justify-content: center; }

  .header-inner {
    min-height: 58px;
    padding: 0 14px;
    flex-wrap: wrap;
  }

  .brand {
    font-size: 18px;
  }

  .site-header nav {
    order: 3;
    width: 100%;
    height: 45px;
  }

  .site-header nav a {
    flex: 1;
    justify-content: center;
    padding: 0 7px;
  }

  .read-only {
    font-size: 9px;
  }

  .page-shell {
    padding: 28px 14px 50px;
  }

  .page-heading,
  .detail-heading {
    display: block;
    margin-bottom: 24px;
  }

  .revision {
    margin-top: 15px;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .metrics div:nth-child(2) {
    border-right: 0;
  }

  .metrics div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .metrics strong {
    font-size: 26px;
  }

  .task-list li {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 11px 13px;
  }

  .task-list .meta {
    justify-content: flex-start;
  }

  .project-grid,
  .completion-panel,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .completion-panel {
    gap: 10px;
  }

  .metadata {
    min-width: 0;
    margin-top: 22px;
    grid-template-columns: 1fr 1fr;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
  }

  .filters .search {
    grid-column: span 2;
  }

  .filters button {
    grid-column: span 1;
  }

  .task-row {
    padding: 18px 14px;
  }

  .task-row dl {
    grid-template-columns: 1fr 1fr;
  }

  .task-row dl div {
    padding: 9px 0;
    border: 0;
    border-top: 1px solid var(--line);
  }

  .task-row dl div:last-child {
    grid-column: span 2;
  }

  .compact-stats dd {
    font-size: 13px;
  }

  .compact-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .compact-stats div {
    min-width: 0;
    padding: 0 10px;
    border-right: 0;
  }

  .compact-stats div:nth-child(odd) {
    padding-left: 0;
    border-right: 1px solid var(--line);
  }

  .compact-stats div:nth-child(even) {
    padding-right: 0;
  }

  .compact-stats div:nth-child(n + 3) {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
  }

  .section-heading {
    align-items: start;
  }

  .section-heading > a {
    font-size: 13px;
  }

  .page-heading h1,
  .detail-heading h1 {
    font-size: 36px;
  }
}

@media (max-width: 420px) {
  .filters {
    grid-template-columns: 1fr;
  }

  .filters .search,
  .filters button {
    grid-column: auto;
  }

  .filters .clear {
    justify-content: center;
  }

  .metadata {
    grid-template-columns: 1fr;
  }

  .metadata div:nth-last-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .metadata div:last-child {
    border-bottom: 0;
  }
}
