:root {
  color-scheme: light;
  --paper: #f5f3e9;
  --paper-strong: #fffdf7;
  --surface: #fbfaf4;
  --surface-sage: #e9efe5;
  --surface-sage-strong: #dce7d8;
  --ink: #18221d;
  --ink-soft: #34413a;
  --muted: #68736c;
  --quiet: #89928c;
  --line: #d6ddd3;
  --line-strong: #bcc8bc;
  --accent: #b7f533;
  --accent-ink: #22330c;
  --focus: #2c6d52;
  --status-idle: #626d66;
  --status-idle-bg: #ecefeb;
  --status-progress: #275f9f;
  --status-progress-bg: #e6eef9;
  --status-review: #925a08;
  --status-review-bg: #fff0cf;
  --status-complete: #23714f;
  --status-complete-bg: #e3f2e9;
  --status-blocked: #a63d3d;
  --status-blocked-bg: #fae7e4;
  --shadow-soft: 0 10px 30px rgba(24, 34, 29, 0.08);
  --shadow-float: 0 22px 70px rgba(24, 34, 29, 0.18);
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 14px;
  --shell: 1360px;
  --header-offset: 112px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans: "Noto Sans SC", "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  overflow-x: clip;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(222, 232, 216, 0.72) 0, rgba(245, 243, 233, 0) 260px),
    var(--paper);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
}

body.drawer-open,
body.sheet-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  margin: 0;
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-strong);
  color: var(--ink-soft);
  font-weight: 700;
  line-height: 1.2;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

button:hover {
  border-color: #87988a;
  background: #f0f3eb;
}

button:active {
  transform: translateY(1px);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button.primary,
button.is-primary,
.button-primary,
.btn-primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

button.primary:hover,
button.is-primary:hover,
.button-primary:hover,
.btn-primary:hover {
  border-color: #304038;
  background: #304038;
}

button.accent,
.button-accent {
  border-color: #92c821;
  background: var(--accent);
  color: var(--accent-ink);
}

button.ghost,
button.is-quiet,
.button-quiet,
.icon-button {
  border-color: transparent;
  background: transparent;
}

button.danger,
.button-danger {
  border-color: #dca7a1;
  background: #fff8f7;
  color: var(--status-blocked);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: 0;
  background: var(--paper-strong);
}

input,
select {
  min-height: 42px;
  padding: 8px 11px;
}

textarea {
  min-height: 104px;
  padding: 10px 11px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--quiet);
}

input:hover,
select:hover,
textarea:hover {
  border-color: #97a398;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid rgba(44, 109, 82, 0.26);
  outline-offset: 2px;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 8px;
  left: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 140ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p,
li {
  text-wrap: pretty;
}

.hidden,
.is-hidden,
[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Compact academic masthead */
.app-header {
  position: sticky;
  z-index: 50;
  top: 0;
  border-bottom: 1px solid rgba(188, 200, 188, 0.86);
  background: rgba(250, 249, 242, 0.93);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(18px) saturate(125%);
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  width: min(100% - 40px, var(--shell));
  min-height: 66px;
  margin-inline: auto;
  gap: 22px;
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  grid-column: 1;
  grid-row: 1;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 48px;
  height: 36px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.brand-mark::after {
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--paper-strong);
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong,
.brand-copy b {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy span,
.brand-copy small {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-context {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 18px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  grid-column: 2;
  grid-row: 1;
}

.header-context strong,
.header-context b {
  color: var(--ink-soft);
  font-weight: 750;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  grid-column: 3;
  grid-row: 1;
}

.header-actions button {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 12px;
}

.mode-badge {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-sage);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.mode-badge::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-complete);
  content: "";
}

.mode-badge[data-mode="syncing"] {
  border-color: #dfbd77;
  background: var(--status-review-bg);
  color: var(--status-review);
}

.mode-badge[data-mode="syncing"]::before {
  background: var(--status-review);
}

.mode-badge[data-mode="offline"] {
  border-color: #e2aaa5;
  background: var(--status-blocked-bg);
  color: var(--status-blocked);
}

.mode-badge[data-mode="offline"]::before {
  background: var(--status-blocked);
}

.app-nav {
  display: flex;
  width: 100%;
  min-height: 42px;
  margin-inline: 0;
  align-items: end;
  gap: 28px;
  grid-column: 1 / -1;
  grid-row: 2;
}

.nav-link {
  position: relative;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 3px;
  background: transparent;
  content: "";
}

.nav-link:hover {
  color: var(--ink);
}

.nav-link.is-active,
.nav-link[aria-current="page"] {
  color: var(--ink);
}

.nav-link.is-active::after,
.nav-link[aria-current="page"]::after {
  background: var(--accent);
}

/* View shell */
.app-main {
  min-height: calc(100vh - var(--header-offset));
  padding: 30px 0 64px;
}

.app-footer {
  padding: 20px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.shell {
  width: min(100% - 40px, var(--shell));
  margin-inline: auto;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: view-enter 260ms var(--ease) both;
}

@keyframes view-enter {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.view-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 24px;
}

.view-heading h1,
.view-heading h2 {
  max-width: 860px;
  margin: 2px 0 0;
  font-family: var(--font-serif);
  font-size: clamp(25px, 2.3vw, 36px);
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.view-heading > p,
.view-heading .heading-note {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.eyebrow {
  margin: 0;
  color: var(--focus);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.12em;
  line-height: 1.3;
  text-transform: uppercase;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin: 34px 0 13px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-strong);
  gap: 20px;
}

.section-head h2,
.section-head h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.35;
}

.section-head p,
.section-head span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

/* Overview */
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(480px, 0.86fr);
  align-items: stretch;
  gap: 16px;
}

.current-card {
  position: relative;
  min-height: 240px;
  overflow: hidden;
  padding: clamp(22px, 3vw, 38px);
  border: 1px solid #aab9a8;
  border-top: 5px solid var(--accent);
  border-radius: var(--radius);
  background:
    linear-gradient(125deg, rgba(255, 255, 255, 0.88), rgba(233, 239, 229, 0.94)),
    var(--surface-sage);
}

.current-card::after {
  position: absolute;
  top: 24px;
  right: 28px;
  width: 96px;
  height: 96px;
  border: 1px solid rgba(44, 109, 82, 0.16);
  border-radius: 50%;
  box-shadow: inset 0 0 0 20px rgba(183, 245, 51, 0.08);
  content: "";
  pointer-events: none;
}

.current-card > * {
  position: relative;
  z-index: 1;
}

.current-card h2,
.current-card h3 {
  max-width: 650px;
  margin: 10px 0 8px;
  font-family: var(--font-serif);
  font-size: clamp(24px, 3vw, 40px);
  line-height: 1.18;
  letter-spacing: -0.04em;
}

.current-card p {
  max-width: 680px;
  margin-bottom: 16px;
  color: var(--ink-soft);
}

.current-card .current-progress,
.current-progress {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.current-card .current-progress strong,
.current-progress strong {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 27px;
  line-height: 1;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  background: var(--paper-strong);
}

.metric-card {
  min-width: 0;
  min-height: 112px;
  padding: 18px 20px;
  border-right: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line-strong);
  background: rgba(255, 253, 247, 0.78);
}

.metric-grid > .metric-card:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.metric-card .metric-label,
.metric-card > span:first-child,
.metric-card > small:first-child {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.metric-card .metric-value,
.metric-card > strong {
  display: block;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(24px, 2.4vw, 34px);
  font-weight: 800;
  line-height: 1.05;
}

.metric-card .metric-note,
.metric-card > small:last-child {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.focus-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  margin-top: 16px;
  padding: 13px 16px;
  border-block: 1px solid var(--line-strong);
  background: rgba(255, 253, 247, 0.58);
  gap: 14px;
}

.focus-note strong,
.focus-note b {
  color: var(--focus);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.focus-note p,
.focus-note span {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.workstream-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.workstream-card {
  display: flex;
  min-height: 150px;
  flex-direction: column;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 247, 0.74);
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.workstream-card:hover {
  border-color: #9cab9d;
  background: var(--paper-strong);
  transform: translateY(-2px);
}

.workstream-card h3 {
  margin: 8px 0 5px;
  font-size: 14px;
  line-height: 1.45;
}

.workstream-card p {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.workstream-card .workstream-progress,
.workstream-card footer {
  display: flex;
  margin-top: auto;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  gap: 10px;
}

.workstream-card .workstream-progress strong,
.workstream-card footer strong {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 17px;
}

.risk-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--line-strong);
}

.risk-card {
  min-width: 0;
  padding: 17px 18px;
  background: var(--paper-strong);
}

.risk-card header,
.risk-card .risk-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.risk-card h3 {
  margin: 0 0 7px;
  font-size: 14px;
}

.risk-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.risk-card .risk-action {
  margin-top: 10px;
  color: var(--ink-soft);
  font-size: 12px;
}

/* Current work */
.current-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.45fr);
  align-items: start;
  gap: 24px;
}

.current-layout > aside,
.current-layout .current-aside {
  position: sticky;
  top: calc(var(--header-offset) + 18px);
}

.next-task-list {
  display: grid;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line-strong);
  list-style: none;
}

.next-task-list > * {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.next-task-list .task-order,
.next-task-list > *::marker {
  color: var(--quiet);
  font-family: var(--font-serif);
  font-variant-numeric: tabular-nums;
}

/* Roadmap controls */
.toolbar {
  position: static;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(138px, auto)) auto;
  align-items: center;
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(250, 249, 242, 0.95);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  gap: 8px;
}

.search-field {
  position: relative;
  min-width: 0;
}

.search-field input {
  padding-left: 36px;
}

.search-field::before {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 13px;
  width: 13px;
  height: 13px;
  border: 1.7px solid var(--muted);
  border-radius: 50%;
  content: "";
  pointer-events: none;
  transform: translateY(-58%);
}

.search-field::after {
  position: absolute;
  z-index: 1;
  top: calc(50% + 5px);
  left: 25px;
  width: 6px;
  height: 1.7px;
  background: var(--muted);
  content: "";
  pointer-events: none;
  transform: rotate(45deg);
  transform-origin: left center;
}

.filter-select {
  width: auto;
  min-width: 138px;
  max-width: 190px;
  padding-right: 30px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 650;
}

.filter-button {
  display: none;
}

.active-filter-summary {
  min-height: 0;
  margin: -3px 0 12px;
  color: var(--muted);
  font-size: 11px;
}

.active-filter-summary:empty {
  display: none;
}

.empty-state {
  padding: 44px 20px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 253, 247, 0.62);
  color: var(--muted);
  text-align: center;
}

/* Phase and task audit list */
.phase-list {
  display: grid;
  gap: 10px;
}

.phase-card {
  overflow: clip;
  scroll-margin-top: calc(var(--header-offset) + 12px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: rgba(255, 253, 247, 0.8);
}

.phase-card.is-current,
.phase-card[data-current="true"] {
  border-color: #86aa47;
  box-shadow: inset 0 4px 0 var(--accent);
}

.phase-summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto 22px;
  min-height: 70px;
  align-items: center;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  gap: 14px;
  list-style: none;
}

.phase-summary::-webkit-details-marker {
  display: none;
}

.phase-summary:hover {
  background: var(--surface-sage);
}

.phase-summary h2,
.phase-summary h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
}

.phase-summary p,
.phase-summary small {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.phase-summary::after {
  width: 9px;
  height: 9px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  content: "";
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 180ms ease;
}

.phase-card[open] > .phase-summary::after,
.phase-card.is-open > .phase-summary::after {
  transform: rotate(225deg) translate(-2px, -2px);
}

.phase-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--paper-strong);
}

.phase-progress {
  position: relative;
  width: clamp(86px, 10vw, 150px);
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3e7e1;
}

.phase-progress > span,
.phase-progress > i,
.phase-progress .progress-value {
  display: block;
  width: var(--progress, 0%);
  max-width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--status-complete);
}

.phase-card.is-current .phase-progress > span,
.phase-card[data-current="true"] .phase-progress > span {
  background: #79ad19;
}

.task-group {
  padding-top: 16px;
}

.task-group + .task-group {
  margin-top: 10px;
  border-top: 1px dashed var(--line-strong);
}

.task-group > h3,
.task-group > header h3 {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.035em;
}

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

.task-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, auto) auto auto;
  min-width: 0;
  min-height: 56px;
  align-items: center;
  width: 100%;
  padding: 10px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink-soft);
  text-align: left;
  gap: 10px;
}

.task-row:hover {
  border-color: var(--line-strong);
  background: #f1f5ed;
  transform: none;
}

.task-row:last-child {
  border-bottom-color: transparent;
}

.task-title {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}

.task-title small,
.task-title span {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-meta {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-pill,
.status-pill,
.ai-pill {
  display: inline-flex;
  width: fit-content;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.owner-pill {
  border-color: #c9d2c8;
  background: #f2f4ef;
  color: #46534b;
}

.status-pill {
  border-color: #d1d6d1;
  background: var(--status-idle-bg);
  color: var(--status-idle);
}

.status-pill.status-not-started,
.status-pill.status-not_started,
.status-pill[data-status="not_started"] {
  border-color: #d1d6d1;
  background: var(--status-idle-bg);
  color: var(--status-idle);
}

.status-pill.status-in-progress,
.status-pill.status-in_progress,
.status-pill[data-status="in_progress"] {
  border-color: #b5cae3;
  background: var(--status-progress-bg);
  color: var(--status-progress);
}

.status-pill.status-needs-review,
.status-pill.status-needs_review,
.status-pill[data-status="needs_review"] {
  border-color: #e2c782;
  background: var(--status-review-bg);
  color: var(--status-review);
}

.status-pill.status-completed,
.status-pill[data-status="completed"] {
  border-color: #b8d8c4;
  background: var(--status-complete-bg);
  color: var(--status-complete);
}

.status-pill.status-blocked,
.status-pill[data-status="blocked"] {
  border-color: #e2b6b1;
  background: var(--status-blocked-bg);
  color: var(--status-blocked);
}

.task-row[data-status="completed"] .task-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: #83a28e;
}

.task-row[data-status="blocked"] {
  background: rgba(250, 231, 228, 0.34);
}

.ai-pill {
  border-color: #ced7c8;
  background: var(--surface-sage);
  color: #465f3e;
}

.ai-pill.ai-human,
.ai-pill[data-ai-mode="human"] {
  border-color: #d4cec1;
  background: #f2efe7;
  color: #655d50;
}

.ai-pill.ai-review,
.ai-pill[data-ai-mode="review"] {
  border-color: #e2c782;
  background: var(--status-review-bg);
  color: var(--status-review);
}

.ai-pill.ai-primary,
.ai-pill.ai-ai,
.ai-pill[data-ai-mode="ai"] {
  border-color: #bdd0e5;
  background: var(--status-progress-bg);
  color: var(--status-progress);
}

.ai-pill.ai-unset,
.ai-pill[data-ai-mode="unset"],
.ai-pill[data-ai-mode="none"] {
  border-color: #d8ddd8;
  background: #f1f2ef;
  color: var(--quiet);
}

/* Team */
.team-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.person-card {
  min-width: 0;
  padding: 20px;
  border-top: 3px solid var(--ink-soft);
  background: var(--paper-strong);
  box-shadow: 0 0 0 1px var(--line);
}

.person-card h2,
.person-card h3 {
  margin: 5px 0 4px;
  font-family: var(--font-serif);
  font-size: 21px;
}

.person-card p {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 12px;
}

.person-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  gap: 7px 12px;
  font-size: 12px;
}

.person-card dt {
  color: var(--muted);
}

.person-card dd {
  margin: 0;
  color: var(--ink-soft);
  text-align: right;
}

.mode-guide {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 26px;
  border: 1px solid var(--line-strong);
  background: var(--line);
  gap: 1px;
}

.mode-guide > * {
  min-width: 0;
  padding: 14px 16px;
  background: var(--paper-strong);
}

.mode-guide h3,
.mode-guide strong {
  display: block;
  margin: 0 0 5px;
  font-size: 12px;
}

.mode-guide p,
.mode-guide small {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

/* Task drawer */
.drawer-backdrop,
.sheet-backdrop,
.bottom-sheet-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  visibility: hidden;
  background: rgba(17, 25, 20, 0.46);
  opacity: 0;
  transition: opacity 220ms ease, visibility 220ms step-end;
}

.drawer-backdrop.is-open,
.sheet-backdrop.is-open,
.bottom-sheet-backdrop.is-open {
  visibility: visible;
  opacity: 1;
  transition: opacity 220ms ease, visibility 0ms step-start;
}

.drawer {
  position: fixed;
  z-index: 90;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  width: min(520px, 92vw);
  flex-direction: column;
  visibility: hidden;
  border-left: 1px solid var(--line-strong);
  background: var(--paper-strong);
  box-shadow: var(--shadow-float);
  transform: translateX(102%);
  transition: transform 280ms var(--ease), visibility 280ms step-end;
}

.drawer.is-open {
  visibility: visible;
  transform: translateX(0);
  transition: transform 280ms var(--ease), visibility 0ms step-start;
}

.drawer-header {
  display: flex;
  flex: 0 0 auto;
  align-items: start;
  justify-content: space-between;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line-strong);
  gap: 20px;
}

.drawer-header h2,
.drawer-header h3 {
  margin: 4px 0 0;
  font-family: var(--font-serif);
  font-size: 22px;
  line-height: 1.35;
}

.drawer-header .icon-button {
  width: 38px;
  min-height: 38px;
  flex: 0 0 38px;
  padding: 0;
}

.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 22px 24px 40px;
  overscroll-behavior: contain;
}

.drawer-body section + section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.drawer-body h3 {
  margin-bottom: 7px;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.drawer-body p,
.drawer-body li {
  color: var(--ink-soft);
  font-size: 13px;
}

/* Mobile filters */
.bottom-sheet {
  position: fixed;
  z-index: 90;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  max-height: min(82dvh, 680px);
  flex-direction: column;
  visibility: hidden;
  border-top: 1px solid var(--line-strong);
  border-radius: 14px 14px 0 0;
  background: var(--paper-strong);
  box-shadow: var(--shadow-float);
  transform: translateY(102%);
  transition: transform 280ms var(--ease), visibility 280ms step-end;
}

.bottom-sheet.is-open,
.bottom-sheet[open] {
  visibility: visible;
  transform: translateY(0);
  transition: transform 280ms var(--ease), visibility 0ms step-start;
}

.sheet-handle {
  width: 42px;
  height: 4px;
  flex: 0 0 4px;
  margin: 9px auto 3px;
  border-radius: 999px;
  background: #c8cec8;
}

.bottom-sheet header,
.bottom-sheet .sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  gap: 16px;
}

.bottom-sheet header h2,
.bottom-sheet .sheet-header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
}

.bottom-sheet .sheet-body {
  overflow-y: auto;
  padding: 16px 18px calc(22px + env(safe-area-inset-bottom));
}

.bottom-sheet .filter-group + .filter-group {
  margin-top: 18px;
}

.bottom-sheet .filter-group > strong,
.bottom-sheet .filter-label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
}

.bottom-sheet .filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.bottom-sheet .filter-options button {
  min-height: 36px;
  font-size: 12px;
}

.bottom-sheet .filter-options button.is-active,
.bottom-sheet .filter-options button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

/* Real-time project status editor */
.draft-panel {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid #d6bc82;
  border-radius: var(--radius-sm);
  background: #fff9e9;
}

.draft-panel.drawer {
  margin: 0;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--paper-strong);
}

.panel-notice {
  margin-bottom: 18px;
  padding: 11px 12px;
  border-block: 1px solid #bfd2c3;
  background: rgba(225, 239, 225, 0.6);
  color: var(--focus);
  font-size: 12px;
}

.form-field {
  display: grid;
  margin-top: 14px;
  gap: 6px;
}

.form-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.conflict-list {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #e0a9a3;
  background: #fff5f3;
  color: var(--status-blocked);
  font-size: 12px;
}

.draft-panel header,
.draft-panel .draft-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.draft-panel h2,
.draft-panel h3 {
  margin: 0 0 5px;
  font-family: var(--font-serif);
  font-size: 18px;
}

.draft-panel p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.draft-panel .draft-actions {
  display: flex;
  flex-wrap: wrap;
  margin-top: 16px;
  gap: 8px;
}

.draft-panel .conflict-list {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #e0a9a3;
  background: #fff5f3;
  color: var(--status-blocked);
  font-size: 12px;
}

.mobile-nav {
  display: none;
}

.toast {
  position: fixed;
  z-index: 120;
  right: 22px;
  bottom: 22px;
  width: min(380px, calc(100vw - 32px));
  padding: 12px 15px;
  visibility: hidden;
  border: 1px solid #8ca590;
  border-radius: var(--radius-sm);
  background: var(--ink);
  box-shadow: var(--shadow-float);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms var(--ease), visibility 180ms step-end;
}

.toast.is-visible,
.toast.show {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms var(--ease), visibility 0ms step-start;
}

/* Tablet */
@media (max-width: 1024px) {
  :root {
    --header-offset: 104px;
  }

  .header-inner {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .header-actions {
    grid-column: 2;
  }

  .brand-mark {
    width: 44px;
    flex-basis: 44px;
  }

  .header-context {
    display: none;
  }

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

  .current-card {
    min-height: 210px;
  }

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

  .metric-card {
    min-height: 104px;
    padding: 16px;
  }

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

  .toolbar {
    grid-template-columns: minmax(210px, 1fr) repeat(3, minmax(118px, auto));
  }

  .toolbar > button:not(.filter-button) {
    grid-column: auto;
  }

  .task-row {
    grid-template-columns: minmax(210px, 1fr) minmax(130px, auto) auto;
  }

  .task-row .ai-pill {
    display: none;
  }

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

@media (max-width: 820px) {
  :root {
    --header-offset: 98px;
  }

  .header-inner,
  .app-nav,
  .shell {
    width: min(100% - 28px, var(--shell));
  }

  .app-nav {
    gap: 20px;
  }

  .current-layout {
    grid-template-columns: 1fr;
  }

  .current-layout > aside,
  .current-layout .current-aside {
    position: static;
  }

  .risk-list {
    grid-template-columns: 1fr;
  }

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

  .team-grid > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .toolbar {
    grid-template-columns: minmax(190px, 1fr) repeat(2, minmax(120px, auto));
  }

  .filter-select:last-of-type {
    display: none;
  }

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

  .task-meta {
    display: none;
  }
}

/* Phones: compact first viewport and reliable in-page filters */
@media (max-width: 720px) {
  :root {
    --header-offset: 61px;
  }

  html {
    scroll-padding-bottom: 88px;
  }

  body {
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
    font-size: 14px;
  }

  .app-header {
    position: sticky;
  }

  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    width: calc(100% - 24px);
    min-height: 60px;
    gap: 8px;
  }

  .brand {
    gap: 9px;
  }

  .brand-mark {
    width: 42px;
    height: 32px;
    flex-basis: 42px;
    font-size: 8px;
  }

  .brand-copy strong,
  .brand-copy b {
    font-size: 14px;
  }

  .brand-copy span,
  .brand-copy small {
    font-size: 10px;
  }

  .header-actions {
    gap: 4px;
  }

  .header-actions button:not(.mode-badge):not(.icon-button),
  .header-actions .desktop-action {
    display: none;
  }

  .mode-badge {
    min-height: 25px;
    padding: 4px 7px;
    font-size: 10px;
  }

  .app-nav {
    display: none;
  }

  .app-main {
    min-height: calc(100vh - 60px);
    padding: 16px 0 34px;
  }

  .shell {
    width: calc(100% - 24px);
  }

  .view-heading {
    display: block;
    margin-bottom: 12px;
  }

  .view-heading h1,
  .view-heading h2 {
    margin-top: 1px;
    font-size: 23px;
  }

  .view-heading > p,
  .view-heading .heading-note {
    margin-top: 5px;
    overflow: hidden;
    font-size: 11px;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .eyebrow {
    font-size: 9px;
  }

  .overview-grid {
    gap: 9px;
  }

  .current-card {
    min-height: 128px;
    padding: 15px 16px;
    border-top-width: 4px;
  }

  .current-card::after {
    top: 16px;
    right: 16px;
    width: 62px;
    height: 62px;
    box-shadow: inset 0 0 0 13px rgba(183, 245, 51, 0.08);
  }

  .current-card h2,
  .current-card h3 {
    max-width: calc(100% - 52px);
    margin: 4px 0;
    font-size: 22px;
  }

  .current-card p {
    display: -webkit-box;
    max-width: calc(100% - 28px);
    margin-bottom: 7px;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .current-card .current-progress,
  .current-progress {
    font-size: 11px;
  }

  .current-card .current-progress strong,
  .current-progress strong {
    font-size: 21px;
  }

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

  .metric-card {
    min-height: 78px;
    padding: 10px 11px;
  }

  .metric-card .metric-label,
  .metric-card > span:first-child,
  .metric-card > small:first-child {
    margin-bottom: 4px;
    font-size: 9px;
  }

  .metric-card .metric-value,
  .metric-card > strong {
    font-size: 22px;
  }

  .metric-card .metric-note,
  .metric-card > small:last-child {
    margin-top: 3px;
    overflow: hidden;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .focus-note {
    grid-template-columns: 1fr;
    margin-top: 9px;
    padding: 9px 11px;
    gap: 2px;
  }

  .focus-note strong,
  .focus-note b {
    font-size: 9px;
  }

  .focus-note p,
  .focus-note span {
    font-size: 11px;
  }

  .section-head {
    margin-top: 25px;
  }

  .section-head h2,
  .section-head h3 {
    font-size: 16px;
  }

  .section-head p,
  .section-head span {
    font-size: 10px;
  }

  .workstream-grid,
  .risk-list,
  .team-grid,
  .mode-guide {
    grid-template-columns: 1fr;
  }

  .workstream-card {
    min-height: 0;
    padding: 14px;
  }

  .workstream-card p {
    margin-bottom: 9px;
  }

  .team-grid > :last-child:nth-child(odd) {
    grid-column: auto;
  }

  .person-card {
    padding: 16px;
  }

  .toolbar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 10px;
    padding: 6px;
    border: 1px solid rgba(188, 200, 188, 0.92);
    background: rgba(250, 249, 242, 0.96);
    box-shadow: 0 8px 22px rgba(24, 34, 29, 0.1);
    backdrop-filter: blur(14px) saturate(120%);
  }

  .toolbar .search-field {
    grid-column: 1;
  }

  .filter-select {
    display: none !important;
  }

  .filter-button {
    display: inline-flex;
    grid-column: 2;
    min-height: 42px;
    align-items: center;
    justify-content: center;
  }

  .toolbar > button:not(.filter-button),
  .toolbar .desktop-only {
    display: none;
  }

  .phase-list {
    gap: 7px;
  }

  .phase-summary {
    grid-template-columns: minmax(0, 1fr) auto 18px;
    min-height: 62px;
    padding: 11px 12px;
    gap: 8px;
  }

  .phase-summary h2,
  .phase-summary h3 {
    font-size: 13px;
  }

  .phase-summary > .phase-progress {
    display: none;
  }

  .phase-body {
    padding: 0 10px 10px;
  }

  .task-group {
    padding-top: 11px;
  }

  .task-row {
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 54px;
    padding: 9px 3px;
    gap: 7px;
  }

  .task-title {
    font-size: 12px;
  }

  .task-title small,
  .task-title span {
    font-size: 10px;
  }

  .task-row .owner-pill,
  .task-row .ai-pill,
  .task-meta {
    display: none;
  }

  .status-pill,
  .owner-pill,
  .ai-pill {
    min-height: 22px;
    padding: 3px 7px;
    font-size: 9px;
  }

  .drawer {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: min(88dvh, 760px);
    border-top: 1px solid var(--line-strong);
    border-left: 0;
    border-radius: 14px 14px 0 0;
    transform: translateY(102%);
  }

  .drawer.is-open {
    transform: translateY(0);
  }

  .drawer-header {
    padding: 17px 18px 14px;
  }

  .drawer-header h2,
  .drawer-header h3 {
    font-size: 18px;
  }

  .drawer-body {
    padding: 16px 18px calc(28px + env(safe-area-inset-bottom));
  }

  .draft-panel {
    padding: 15px;
  }

  .draft-panel.drawer {
    padding: 0;
    border-top: 1px solid #d6bc82;
    border-left: 0;
    border-radius: 14px 14px 0 0;
  }

  .draft-panel header,
  .draft-panel .draft-head {
    display: block;
  }

  .mobile-nav {
    position: fixed;
    z-index: 70;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: calc(58px + env(safe-area-inset-bottom));
    padding: 4px 5px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line-strong);
    background: rgba(250, 249, 242, 0.96);
    box-shadow: 0 -8px 24px rgba(24, 34, 29, 0.08);
    backdrop-filter: blur(18px) saturate(125%);
  }

  .mobile-nav .nav-link {
    display: flex;
    min-width: 0;
    min-height: 54px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px 2px;
    font-size: 10px;
    line-height: 1.2;
    gap: 3px;
  }

  .mobile-nav a {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 54px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 5px 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    line-height: 1.2;
    text-decoration: none;
    gap: 3px;
  }

  .mobile-nav a::after {
    position: absolute;
    top: 0;
    right: 18%;
    left: 18%;
    height: 3px;
    background: transparent;
    content: "";
  }

  .mobile-nav a.is-active,
  .mobile-nav a[aria-current="page"] {
    color: var(--ink);
  }

  .mobile-nav a.is-active::after,
  .mobile-nav a[aria-current="page"]::after {
    background: var(--accent);
  }

  .mobile-nav .nav-link::after {
    top: 0;
    right: 18%;
    bottom: auto;
    left: 18%;
    height: 3px;
  }

  .mobile-nav .nav-icon {
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    font-size: 14px;
  }

  .toast {
    right: 12px;
    bottom: calc(72px + env(safe-area-inset-bottom));
    width: calc(100vw - 24px);
  }

  .app-footer {
    padding-bottom: 26px;
  }
}

/* Dynamic application components — aligned with roadmap-app.js templates */
body.has-overlay {
  overflow: hidden;
}

.button-secondary {
  border-color: #9eac9f;
  background: var(--surface-sage);
  color: var(--ink);
}

.content-section {
  margin-top: 34px;
}

.card-kicker,
.current-card-footer,
.progress-label,
.workstream-top,
.workstream-meta,
.risk-card-head,
.person-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.card-kicker {
  color: var(--focus);
  font-size: 11px;
  font-weight: 850;
}

.progress-block {
  margin-top: 16px;
}

.progress-label {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
}

.progress-label strong {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 18px;
}

.progress-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe6dc;
}

.progress-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--status-complete), #84b72b);
}

.current-card-footer {
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid rgba(188, 200, 188, 0.78);
  color: var(--muted);
  font-size: 11px;
}

.text-link {
  color: var(--focus);
  font-weight: 800;
  text-decoration: none;
}

.focus-note h2 {
  margin: 2px 0 0;
  font-family: var(--font-serif);
  font-size: 16px;
}

.focus-dates {
  display: flex;
  flex-wrap: wrap;
  margin-top: 6px;
  gap: 6px 12px;
}

.focus-dates span {
  color: var(--focus);
  font-size: 10px;
  font-weight: 750;
}

.workstream-top {
  color: var(--muted);
  font-size: 11px;
}

.workstream-no {
  color: var(--focus);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 800;
}

.workstream-card > .progress-track {
  margin-top: auto;
}

.workstream-meta {
  margin-top: 9px;
  color: var(--muted);
  font-size: 10px;
}

.risk-card-head {
  align-items: flex-start;
  margin-bottom: 9px;
}

.risk-category {
  color: var(--focus);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.05em;
}

.risk-actions,
.status-actions,
.person-modes {
  display: flex;
  flex-wrap: wrap;
  margin-top: 12px;
  gap: 6px;
}

.chip-button,
.status-action {
  min-height: 34px;
  padding: 6px 10px;
  border-color: var(--line-strong);
  background: var(--paper-strong);
  font-size: 11px;
}

.chip-button.is-active,
.chip-button[aria-pressed="true"],
.status-action.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.risk-actions.is-saving,
.status-actions.is-saving,
.drawer-body.is-saving {
  cursor: progress;
}

.risk-actions.is-saving::after,
.status-actions.is-saving::after {
  align-self: center;
  color: var(--muted);
  content: "正在保存…";
  font-size: 11px;
}

.status-pill[data-risk-status="open"] {
  border-color: #e2b6b1;
  background: var(--status-blocked-bg);
  color: var(--status-blocked);
}

.status-pill[data-risk-status="monitoring"] {
  border-color: #e2c782;
  background: var(--status-review-bg);
  color: var(--status-review);
}

.status-pill[data-risk-status="resolved"] {
  border-color: #b8d8c4;
  background: var(--status-complete-bg);
  color: var(--status-complete);
}

.risk-card[data-risk-status="resolved"] {
  opacity: 0.68;
}

.current-card-compact {
  min-height: 0;
}

.gate-stack {
  display: grid;
  gap: 9px;
}

.gate-card {
  padding: 13px 14px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
}

.gate-card > span {
  color: var(--focus);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.05em;
}

.gate-card p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.status-breakdown {
  display: flex;
  flex-wrap: wrap;
  margin-top: 12px;
  gap: 6px;
}

/* Phase summaries */
.phase-summary {
  width: 100%;
  grid-template-columns: 52px minmax(0, 1fr) minmax(190px, 240px) 22px;
  text-align: left;
}

.phase-summary::after {
  display: none;
}

.phase-number {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line-strong);
  color: var(--focus);
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 800;
}

.phase-copy {
  display: block;
  min-width: 0;
  text-align: left;
}

.phase-copy small,
.phase-copy strong,
.phase-copy em {
  display: block;
  min-width: 0;
}

.phase-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-copy strong {
  margin-top: 2px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.35;
}

.phase-copy em {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phase-progress {
  display: grid;
  width: 100%;
  height: auto;
  overflow: visible;
  grid-template-columns: max-content minmax(70px, 1fr);
  align-items: center;
  border-radius: 0;
  background: transparent;
  gap: 5px 8px;
}

.phase-progress > .status-pill {
  display: inline-flex;
  width: fit-content;
  max-width: none;
  height: auto;
}

.phase-progress > span:not(.status-pill) {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  border-radius: 0;
  background: transparent !important;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
}

.phase-progress .progress-track {
  width: 100%;
  height: 6px;
}

.blocked-count {
  justify-self: end;
  color: var(--status-blocked);
  font-size: 10px;
}

.phase-chevron {
  color: var(--muted);
  font-size: 24px;
  line-height: 1;
  transition: transform 180ms ease;
}

.phase-card.is-open .phase-chevron {
  transform: rotate(90deg);
}

.phase-brief {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 16px 0 4px;
  border: 1px solid var(--line);
  background: var(--line);
  gap: 1px;
}

.phase-brief article {
  min-width: 0;
  padding: 12px 14px;
  background: var(--surface);
}

.phase-brief article > span {
  color: var(--focus);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.phase-brief p {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.phase-card.is-current,
.phase-card[data-current="true"] {
  border-color: #86aa47;
  box-shadow: inset 4px 0 0 var(--accent);
}

/* Task rows */
.task-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-strong);
  gap: 12px;
}

.task-group-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
}

.task-group-head span {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.task-group.is-collapsed-complete {
  padding: 12px 0;
  opacity: 0.72;
}

.task-row {
  grid-template-columns: 30px minmax(0, 1fr) 18px;
  align-items: start;
  cursor: pointer;
}

.task-status-dot {
  width: 9px;
  height: 9px;
  margin: 6px auto 0;
  border: 2px solid var(--quiet);
  border-radius: 50%;
  background: var(--paper-strong);
}

.task-row[data-status="in_progress"] .task-status-dot {
  border-color: var(--status-progress);
  background: var(--status-progress);
}

.task-row[data-status="needs_review"] .task-status-dot {
  border-color: var(--status-review);
  background: var(--status-review);
}

.task-row[data-status="completed"] .task-status-dot {
  border-color: var(--status-complete);
  background: var(--status-complete);
}

.task-row[data-status="blocked"] .task-status-dot {
  border-color: var(--status-blocked);
  background: var(--status-blocked);
}

.task-sequence {
  margin-top: 1px;
  color: var(--focus);
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.task-copy {
  min-width: 0;
}

.task-title-line {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.task-title {
  margin: 0;
}

.critical-mark {
  display: inline-flex;
  margin-right: 6px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--status-blocked-bg);
  color: var(--status-blocked);
  font-size: 9px;
  vertical-align: 2px;
}

.task-inline-detail {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-meta {
  display: flex;
  overflow: visible;
  flex-wrap: wrap;
  margin-top: 6px;
  align-items: center;
  color: var(--muted);
  white-space: normal;
  gap: 5px 8px;
}

.task-open-mark {
  align-self: center;
  color: var(--quiet);
  font-size: 20px;
}

.ai-pill[data-ai="human"] {
  border-color: #d4cec1;
  background: #f2efe7;
  color: #655d50;
}

.ai-pill[data-ai="review_required"] {
  border-color: #e2c782;
  background: var(--status-review-bg);
  color: var(--status-review);
}

.ai-pill[data-ai="ai_led"] {
  border-color: #bdd0e5;
  background: var(--status-progress-bg);
  color: var(--status-progress);
}

.ai-pill[data-ai="not_applicable"] {
  border-color: #d8ddd8;
  background: #f1f2ef;
  color: var(--quiet);
}

/* Team cards */
.person-card-head {
  align-items: flex-start;
}

.person-card-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.person-index {
  color: var(--focus);
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 800;
}

.person-workload {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 14px 0 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  gap: 10px;
}

.person-workload strong {
  font-family: var(--font-serif);
  font-size: 20px;
}

.muted-note {
  color: var(--muted);
  font-size: 11px;
}

/* Task details and local draft tools */
.task-detail-heading,
.task-detail-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.task-detail-heading {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.task-detail-status {
  margin-top: 12px;
}

.detail-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.detail-section h3 {
  color: var(--focus);
}

.task-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 20px 0 0;
  border: 1px solid var(--line);
}

.task-facts > div {
  min-width: 0;
  padding: 11px 12px;
  border-right: 1px solid var(--line);
}

.task-facts > div:last-child {
  border-right: 0;
}

.task-facts dt {
  color: var(--muted);
  font-size: 10px;
}

.task-facts dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.filter-choice-group {
  min-inline-size: 0;
  margin: 0;
  padding: 0 0 16px;
  border: 0;
}

.filter-choice-group + .filter-choice-group {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.filter-choice-group legend {
  margin-bottom: 8px;
  padding: 0;
  color: var(--focus);
  font-size: 11px;
  font-weight: 850;
}

.filter-choice-group > div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.sheet-actions {
  position: sticky;
  bottom: calc(-40px - env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  margin-top: 4px;
  padding: 14px 0 calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--paper-strong);
  gap: 8px;
}

.draft-actions .button {
  flex: 1 1 180px;
}

.conflict-list h3 {
  margin: 0 0 6px;
}

.conflict-list ul {
  margin: 0;
  padding-left: 18px;
}

.conflict-list li + li {
  margin-top: 10px;
}

.conflict-values {
  display: grid;
  margin: 6px 0 3px;
  color: var(--ink-soft);
  gap: 2px;
}

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

.fatal-state {
  margin-top: 40px;
  padding: 24px;
  border: 1px solid var(--status-blocked);
  background: var(--status-blocked-bg);
}

@media (max-width: 720px) {
  .content-section {
    margin-top: 25px;
  }

  .metric-grid > .metric-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .phase-summary {
    min-height: 92px;
    grid-template-columns: 34px minmax(0, 1fr) 16px;
    align-items: start;
  }

  .phase-number {
    width: 30px;
    height: 30px;
    font-size: 14px;
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .phase-copy {
    grid-column: 2;
    grid-row: 1;
  }

  .phase-copy strong {
    font-size: 14px;
  }

  .phase-copy em {
    display: -webkit-box;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  .phase-progress,
  .phase-summary > .phase-progress {
    display: grid;
    width: 100%;
    margin-top: 6px;
    grid-column: 2;
    grid-row: 2;
  }

  .phase-chevron {
    align-self: center;
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  .phase-brief,
  .gate-stack,
  .task-facts {
    grid-template-columns: 1fr;
  }

  .task-row {
    grid-template-columns: 22px minmax(0, 1fr) 14px;
    padding: 10px 2px;
  }

  .task-title-line {
    gap: 6px;
  }

  .task-title-line > .status-pill {
    flex: 0 0 auto;
  }

  .task-row .owner-pill,
  .task-row .ai-pill,
  .task-meta {
    display: flex;
  }

  .task-facts > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .task-facts > div:last-child {
    border-bottom: 0;
  }

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

  .draft-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
  }

  .draft-actions .button {
    width: 100%;
    min-width: 0;
  }

  .header-actions #projectToolsButton {
    display: inline-grid !important;
    width: 32px;
    min-height: 32px;
    padding: 0;
    place-items: center;
    font-size: 0;
  }

  .header-actions #projectToolsButton::before {
    content: "✎";
    font-size: 15px;
  }
}

@media (max-width: 380px) {
  .brand-copy span,
  .brand-copy small {
    display: none;
  }

  .mode-badge {
    max-width: 116px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .current-card {
    padding-inline: 13px;
  }

  .metric-card {
    padding-inline: 9px;
  }

  .phase-summary {
    padding-inline: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  :root {
    --paper: #fff;
    --paper-strong: #fff;
    --surface: #fff;
    --surface-sage: #f4f6f2;
    --line: #d4d4d4;
    --line-strong: #aaa;
  }

  html,
  body {
    min-width: 0;
    background: #fff !important;
    color: #111;
    font-size: 9pt;
  }

  body {
    padding: 0 !important;
  }

  .app-header,
  .app-footer,
  .mobile-nav,
  .toolbar,
  .drawer,
  .drawer-backdrop,
  .bottom-sheet,
  .bottom-sheet-backdrop,
  .sheet-backdrop,
  .draft-panel,
  .toast,
  .no-print {
    display: none !important;
  }

  .app-main {
    min-height: 0;
    padding: 0;
  }

  .shell {
    width: 100%;
  }

  .view {
    display: none !important;
    animation: none !important;
  }

  #roadmap.view,
  #view-roadmap.view,
  .view[data-view="roadmap"] {
    display: block !important;
  }

  .view-heading {
    margin-bottom: 8mm;
  }

  .view-heading h1,
  .view-heading h2 {
    font-size: 20pt;
  }

  .phase-list {
    gap: 4mm;
  }

  .phase-card {
    overflow: visible;
    break-inside: auto;
    border-color: #aaa;
    box-shadow: none !important;
  }

  .phase-summary {
    min-height: 0;
    padding: 3mm;
  }

  .phase-summary::after {
    display: none;
  }

  .phase-body,
  .phase-body[hidden],
  .phase-card:not([open]) > .phase-body {
    display: block !important;
    padding: 0 3mm 3mm;
  }

  .phase-summary,
  .task-group-head,
  .task-row {
    break-inside: avoid;
  }

  .task-group {
    break-inside: auto;
  }

  .task-row,
  .task-row.hidden,
  .task-row.is-hidden,
  .task-row[hidden] {
    display: grid !important;
    grid-template-columns: 18px minmax(0, 1fr) 12px;
    min-height: 0;
    padding: 2mm 1mm;
  }

  .task-row .owner-pill,
  .task-row .ai-pill,
  .task-meta {
    display: inline-flex;
  }

  .owner-pill,
  .status-pill,
  .ai-pill {
    border-color: #999 !important;
    background: #fff !important;
    color: #222 !important;
  }

  button,
  a {
    color: #111;
  }
}
