/* Global navigation, typography, icons and theme come from Recipes. */
:root {
  --good: var(--success);
  --warn: var(--warning);
  --bad: var(--danger);
  --shadow: 0 20px 70px #17233824;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
}
a {
  color: var(--primary);
  text-decoration: none;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  outline-offset: 3px;
}
button {
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 15px;
  font-weight: 600;
  line-height: 1.2;
}
button:hover {
  background: var(--subtle);
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
button.danger {
  background: var(--bad);
  color: white;
  border-color: var(--bad);
}
button.icon {
  font-size: 22px;
  padding: 6px 10px;
  border: 0;
  background: transparent;
}
h1 {
  font-size: 29px;
  letter-spacing: -1px;
  margin: 10px 0;
}
h2 {
  font-size: 18px;
  letter-spacing: -0.35px;
  margin: 0 0 10px;
}
h3 {
  font-size: 15px;
  margin: 0 0 8px;
}
p {
  color: var(--muted);
  line-height: 1.6;
  margin: 8px 0;
}
.heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.heading > div > p {
  font-size: 13px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.3px;
  font-weight: 750;
  color: var(--primary);
}
.heading > button {
  margin-top: 20px;
}
.tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--border);
  margin: 25px 0;
}
.tabs button {
  border: 0;
  border-radius: 0;
  padding: 15px 0;
  background: none;
  color: var(--muted);
  font-size: 12px;
  position: relative;
}
.tabs button[aria-selected="true"] {
  color: var(--primary);
}
.tabs button[aria-selected="true"]:after {
  content: "";
  height: 2px;
  background: var(--primary);
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
}
.tabs span,
.count {
  font-size: 10px;
  padding: 3px 6px;
  background: var(--subtle);
  border-radius: 5px;
  margin-left: 5px;
  color: var(--muted);
}
.intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  align-items: center;
  padding: 25px;
  gap: 20px;
  margin-bottom: 29px;
}
.intro-icon {
  height: 58px;
  width: 58px;
  flex-shrink: 0;
  background: var(--soft);
  color: var(--primary);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 28px;
}
.intro h2 {
  margin: 9px 0 6px;
  font-size: 18px;
}
.intro p {
  font-size: 12px;
  margin: 0;
}
.intro-steps {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.intro-steps b {
  font-size: 10px;
  color: var(--primary);
  margin-right: 7px;
}
.section-heading {
  margin-bottom: 18px;
}
.section-heading h2 {
  margin: 0;
  font-size: 15px;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}
.card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 23px;
  min-width: 0;
}

.book-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.card-top {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.document-icon {
  width: 36px;
  height: 40px;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: 19px;
}
.badge {
  font-size: 10px;
  font-weight: 650;
  border-radius: 5px;
  padding: 5px 7px;
  background: var(--subtle);
  color: var(--muted);
  display: inline-block;
}
.badge.good {
  color: var(--good);
  background: color-mix(in srgb, var(--good) 9%, var(--surface));
}
.badge.warn {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 9%, var(--surface));
}
.badge.primary {
  background: var(--soft);
  color: var(--primary);
}
.book-card h3 {
  font-size: 18px;
  line-height: 1.4;
}
.book-card p {
  font-size: 12px;
}
.book-meta {
  display: flex;
  gap: 15px;
  margin: 14px 0 22px;
  color: var(--muted);
  font-size: 11px;
}
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 15px;
  width: 100%;
  margin-top: auto;
}
.card-footer button {
  padding: 8px 12px;
  font-size: 11px;
}
.empty {
  grid-column: 1/-1;
  text-align: center;
  padding: 55px 25px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.empty .empty-icon {
  font-size: 32px;
  color: var(--primary);
  margin-bottom: 18px;
}
.empty p {
  max-width: 460px;
  margin: 10px auto 20px;
  font-size: 13px;
}
footer {
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  margin-top: 38px;
  padding: 18px 0;
  display: flex;
  gap: 10px;
}
dialog {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  width: min(530px, calc(100vw - 30px));
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}
dialog.wide {
  width: min(780px, calc(100vw - 30px));
}
dialog::backdrop {
  background: #0b13266b;
  backdrop-filter: blur(3px);
}
.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
.dialog-heading h2 {
  font-size: 22px;
  margin: 8px 0 0;
}
.dialog-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-top: 25px;
}
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 20px;
}
input,
select,
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  background: var(--canvas);
  border-radius: 8px;
  color: var(--text);
  font-weight: 400;
  min-width: 0;
}
/* Safari's native popup button ignores padding unless appearance is reset. */
select {
  -webkit-appearance: none;
  appearance: none;
  min-height: 44px;
  line-height: 1.4;
  padding: 11px 40px 11px 12px;
  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='%23768196' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  text-overflow: ellipsis;
}
textarea {
  resize: vertical;
  line-height: 1.5;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--primary);
  background-color: var(--surface);
}
.fine {
  font-size: 11px;
  line-height: 1.6;
}
.model-tag {
  font-size: 11px;
  color: var(--primary);
  font-weight: 650;
}
.notice,
#notice {
  padding: 13px 17px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  background: var(--surface);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.7;
  margin: 15px 0;
}
.notice.info {
  border-left-color: var(--primary);
  background: var(--soft);
}
#notice {
  color: var(--bad);
  border-left-color: var(--bad);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 22px 0;
}
.metric {
  padding: 17px 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
}
.metric > span {
  color: var(--muted);
  font-size: 11px;
}
.metric b {
  display: block;
  font-size: 25px;
  margin: 8px 0 4px;
  letter-spacing: -1px;
}
.metric small {
  font-size: 10px;
  color: var(--muted);
}
.detail-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}
.detail-top > div:last-child {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-top h2 {
  font-size: 24px;
  margin-top: 12px;
}
.back {
  border: 0;
  background: none;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}
.sidebar-stack {
  display: grid;
  gap: 18px;
}
.system {
  margin-bottom: 16px;
  padding: 0;
  overflow: hidden;
}
.system-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 19px 22px;
  border-bottom: 1px solid var(--border);
}
.system-number {
  height: 30px;
  width: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--primary);
  font-weight: 700;
  flex-shrink: 0;
}
.system-heading h3 {
  margin: 0 0 5px;
}
.system-heading .badge {
  margin-left: auto;
}
.system-body {
  padding: 18px 22px;
}
.system-body p {
  font-size: 12px;
}
.system-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  font-size: 11px;
  padding: 16px;
  background: var(--canvas);
  border-radius: 8px;
  margin-bottom: 15px;
}
.system-facts span {
  color: var(--muted);
  display: block;
  margin-bottom: 5px;
}
.check-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.check-list > li {
  position: relative;
  padding: 13px 0 13px 25px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.check-list > li:last-child {
  border: 0;
}
.check-list > li:before {
  content: "□";
  position: absolute;
  left: 0;
  color: var(--primary);
}
.check-list p {
  font-size: 11px;
  margin: 5px 0;
}
.check-list small {
  font-size: 11px;
  color: var(--muted);
}
.evidence-link {
  border: 0;
  background: none;
  color: var(--primary);
  padding: 4px 0;
  font-size: 11px;
  text-align: left;
}
.unknown {
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.unknown:last-child {
  border: 0;
}
.unknown strong {
  font-size: 12px;
  line-height: 1.5;
  display: block;
}
.unknown p {
  font-size: 11px;
}
.run-row {
  display: flex;
  gap: 20px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 12px;
}
.run-row > div {
  flex: 1;
}
.run-row p {
  font-size: 11px;
}
.execution-list {
  padding: 0;
  list-style: none;
}
.execution-list li {
  display: flex;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.execution-list .step-dot {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  flex-shrink: 0;
}
.execution-list .complete .step-dot {
  background: var(--good);
  border-color: var(--good);
  color: var(--surface);
}
.execution-list .current .step-dot {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--soft);
}
.execution-list b {
  display: block;
  font-size: 11px;
  line-height: 1.5;
}
.execution-list small {
  font-size: 10px;
  color: var(--muted);
}
.execution-layout {
  grid-template-columns: 310px minmax(0, 1fr);
}
.execution-work h2 {
  font-size: 20px;
}
.progress-track {
  height: 5px;
  background: var(--subtle);
  border-radius: 9px;
  overflow: hidden;
  margin: 15px 0;
}
.progress-track i {
  display: block;
  height: 100%;
  background: var(--primary);
  width: 40%;
  animation: loading 2s ease-in-out infinite alternate;
}
#generation-progress {
  padding: 18px 0;
}
#generation-progress strong {
  font-size: 13px;
}
#generation-progress p {
  font-size: 11px;
}
.progress-track.determinate > i {
  animation: none;
  width: var(--progress, 0%);
}
@keyframes loading {
  to {
    transform: translateX(150%);
  }
}
.mono,
pre {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  overflow-wrap: anywhere;
}
pre {
  white-space: pre-wrap;
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 15px;
  max-height: 420px;
  overflow: auto;
  line-height: 1.65;
}
.action-body {
  margin: 18px 0;
}
.execution-actions {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: center;
  margin-top: 22px;
}
.event {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 15px;
  padding: 10px 0;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
}
.event time {
  color: var(--muted);
}
.resource {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.resource p {
  font-size: 11px;
}
.resource button {
  font-size: 10px;
  padding: 7px;
}
.selection {
  background: var(--canvas);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}
.selection label {
  margin-top: 12px;
}
.selection select {
  background-color: var(--surface);
  font-size: 11px;
}
.skip {
  position: fixed;
  top: -60px;
  background: var(--primary);
  color: var(--primary-ink);
  padding: 12px;
  z-index: 99;
}
.skip:focus {
  top: 0;
}
[hidden] {
  display: none !important;
}
@media (max-width: 1150px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 270px;
  }
  .intro-steps {
    display: none;
  }
  .execution-layout {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}
@media (max-width: 950px) {
  .layout,
  .execution-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-stack {
    grid-template-columns: 1fr 1fr;
  }
  .execution-list {
    max-height: 250px;
    overflow: auto;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 650px) {
  .heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0;
  }
  .heading > button {
    margin-top: 10px;
    width: 100%;
  }
  .heading h1 {
    font-size: 27px;
  }
  .intro {
    padding: 18px;
    gap: 12px;
  }
  .intro-icon {
    display: none;
  }
  .intro h2 {
    font-size: 17px;
  }
  .metrics {
    gap: 10px;
  }
  .metric {
    padding: 15px;
  }
  .sidebar-stack {
    grid-template-columns: 1fr;
  }
  .detail-top {
    align-items: flex-start;
    flex-direction: column;
  }
  .detail-top h2 {
    font-size: 22px;
  }
  .system-heading,
  .system-body {
    padding: 16px;
  }
  .system-facts {
    grid-template-columns: 1fr;
  }
  .section-heading > .muted {
    display: none;
  }
  .book-grid {
    grid-template-columns: 1fr;
  }
  .status {
    font-size: 10px;
  }
  .run-row {
    flex-wrap: wrap;
  }
  .run-row > div {
    min-width: 200px;
  }
  .event {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .execution-actions {
    align-items: stretch;
    flex-direction: column;
  }
  dialog {
    padding: 22px;
  }
  footer {
    font-size: 9px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
.spaced,
.handover {
  margin-top: 18px;
}
.approval-check {
  flex-direction: row;
  align-items: flex-start;
  line-height: 1.6;
}
.approval-check input {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin: 2px 0 0;
}
.checkbox-help {
  display: block;
  margin-top: 4px;
  font-weight: 400;
  color: var(--muted);
}
.placement-picker {
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 24px 0 16px;
  padding: 16px;
  min-width: 0;
}
.placement-picker legend {
  font-weight: 600;
  font-size: 13px;
  padding: 0 6px;
}
.placement-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.placement-options button {
  flex: 1 1 150px;
  min-height: 44px;
}
.placement-options button[aria-pressed="true"] {
  background: var(--soft);
  color: var(--primary);
  border-color: var(--primary);
}
.task-progress.needs-input {
  border-left: 4px solid var(--primary);
}
.task-progress > button {
  justify-self: start;
}
.current-task-name {
  color: var(--muted);
  font-size: 13px;
  margin: 10px 0 0;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.task-action-panel {
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  background: var(--soft);
  padding: 16px;
  margin: 18px 0;
  scroll-margin-top: 100px;
}
.task-action-panel h3 {
  margin: 0;
  font-size: 14px;
}
.task-action-panel label {
  margin-top: 12px;
}
#simulate-remaining {
  width: 100%;
  margin-top: 10px;
}
#execution-plan {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 24px;
  scroll-margin-top: 20px;
}
#start-form.reviewing-plan > :not(.dialog-heading):not(#execution-plan):not(.dialog-actions) {
  display: none;
}
#start-dialog .dialog-actions {
  position: sticky;
  bottom: -30px;
  padding: 16px 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  z-index: 1;
}
#start-dialog .dialog-actions > button {
  width: 100%;
}
#recovery-resources,
#target-review {
  margin-top: 18px;
}
.api-plan-list {
  padding-left: 22px;
  line-height: 1.6;
}
.api-plan-list li {
  margin: 12px 0;
  overflow-wrap: anywhere;
}
.checkpoint-instructions section + section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
progress {
  width: 100%;
  height: 6px;
  border: 0;
  border-radius: 8px;
  appearance: none;
  background: var(--subtle);
  margin-top: 12px;
}
progress::-webkit-progress-bar {
  background: var(--subtle);
  border-radius: 8px;
}
progress::-webkit-progress-value {
  background: var(--primary);
  border-radius: 8px;
}

/* Task workspace */
.heading {
  margin-bottom: 22px;
  align-items: center;
}
.heading h1 {
  margin: 0;
}
.heading-actions,
.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.detail-top {
  gap: 24px;
}
.detail-top h2 {
  font-size: 24px;
  line-height: 1.25;
  max-width: 760px;
}
.detail-top p {
  max-width: 760px;
}
.detail-actions {
  flex-shrink: 0;
  align-self: flex-start;
}
.task-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 26px;
  margin: 20px 0;
}
.task-progress h3 {
  margin: 5px 0 0;
  font-size: 19px;
}
.task-progress progress {
  grid-column: 1/-1;
  width: 100%;
  height: 7px;
  margin: 0;
}
.task-totals {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.task-totals strong {
  font-size: 27px;
  letter-spacing: -1px;
}
.task-totals strong span {
  color: var(--muted);
  font-size: 20px;
  font-weight: 400;
}
.task-totals small {
  color: var(--muted);
}
.text-link {
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  color: var(--primary);
  justify-self: start;
}
.task-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.task-list {
  min-width: 0;
}
.task-group {
  margin-bottom: 22px;
}
.task-group-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 12px;
}
.phase-number {
  font-size: 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px;
  color: var(--muted);
}
.task-group-heading h3 {
  flex: 1;
  margin: 0;
  font-size: 14px;
}
.task-group-heading > span:last-child {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.task-rows {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.task-rows li + li {
  border-top: 1px solid var(--border);
}
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  border: 0;
  border-radius: 0;
  padding: 18px 16px;
  background: transparent;
  min-height: 80px;
  font-weight: 400;
}
.task-row.selected {
  background: var(--soft);
  box-shadow: inset 3px 0 0 var(--primary);
}
.task-row.complete .task-copy > strong {
  color: var(--muted);
}
.task-check {
  width: 21px;
  height: 21px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--good);
}
.complete .task-check {
  background: color-mix(in srgb, var(--good) 12%, var(--surface));
  border-color: var(--good);
}
.running .task-check {
  border-color: var(--primary);
  border-top-color: transparent;
  animation: task-spin 1s linear infinite;
}
.ready .task-check {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 5px var(--surface);
  background: var(--primary);
}
.blocked .task-check,
.unknown .task-check {
  border-color: var(--warn);
  color: var(--warn);
}
.task-copy {
  flex: 1;
  min-width: 0;
}
.task-copy > strong {
  display: block;
  font-weight: 600;
  line-height: 1.4;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.task-copy > span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.task-state {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  border-radius: 5px;
  padding: 4px 6px;
  background: var(--subtle);
  max-width: 105px;
  text-align: center;
  line-height: 1.3;
}
.task-state.ready,
.task-state.running {
  color: var(--primary);
  background: var(--soft);
}
.task-state.complete {
  color: var(--good);
  background: color-mix(in srgb, var(--good) 10%, var(--surface));
}
.task-state.blocked,
.task-state.unknown {
  color: var(--warn);
}
.task-chevron {
  color: var(--muted);
  font-size: 20px;
}
.task-detail {
  position: sticky;
  top: 90px;
  padding: 26px;
  min-width: 0;
  max-height: calc(100vh - 112px);
  overflow: auto;
  scroll-margin-top: 90px;
}
.task-detail h2 {
  font-size: 20px;
  line-height: 1.4;
  margin: 16px 0;
}
.task-target {
  color: var(--primary);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.task-detail .check-list {
  padding: 0;
}
.task-detail .check-list li {
  padding: 0 0 18px;
  border: 0;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.task-detail .check-list li:before {
  display: none;
}
.task-detail .check-list p {
  margin: 14px 0 8px;
  padding: 12px;
  border-radius: 6px;
  background: var(--subtle);
  font-size: 13px;
  white-space: pre-wrap;
}
.task-detail .check-list small {
  display: block;
  color: var(--warn);
  line-height: 1.6;
  font-size: 12px;
}
.task-detail fieldset {
  padding: 0;
  border: 0;
  margin: 0;
  min-width: 0;
}
.task-detail textarea {
  min-height: 110px;
}
.task-detail .execution-actions {
  justify-content: flex-start;
}
.task-detail .execution-actions button {
  width: 100%;
}
.task-detail .section-heading {
  gap: 8px;
  flex-wrap: wrap;
}
.task-detail-footer {
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 20px;
}
.source-passage,
.target-details {
  margin: 14px 0;
  font-size: 12px;
}
summary {
  cursor: pointer;
  font-weight: 600;
  line-height: 1.5;
}
summary > span {
  margin-left: 12px;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.source-passage blockquote {
  white-space: pre-wrap;
  border-left: 3px solid var(--border);
  padding-left: 15px;
  margin: 15px 0;
  color: var(--muted);
  line-height: 1.65;
}
.task-result {
  padding: 16px;
  background: var(--subtle);
  border-radius: 8px;
  margin: 18px 0;
}
.task-result h3 {
  font-size: 13px;
  margin: 0 0 10px;
}
.task-result .recorded-notes {
  white-space: pre-wrap;
  font-size: 13px;
  line-height: 1.65;
}
.task-result dl {
  margin: 0;
  display: grid;
  gap: 10px;
}
.task-result dl > div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 8px;
  font-size: 12px;
}
.task-result dt {
  color: var(--muted);
}
.task-result dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.rehearsal-banner {
  background: var(--soft);
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.rehearsal-banner strong {
  color: var(--primary);
  margin-right: 10px;
}
.completion-mark {
  color: var(--good);
  font-size: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--subtle);
}
.plan-evidence {
  margin-top: 24px;
}
.plan-evidence > button {
  margin-right: 8px;
}
.run-support {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: 24px;
  align-items: start;
}
.upload-zone {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: var(--subtle);
}
.upload-zone input {
  border: 0;
  padding: 10px 0;
  background: transparent;
}
#document-text {
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
}
#point-age-label[hidden] {
  display: none;
}
@keyframes task-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (min-width: 1300px) {
  .task-workspace {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }
}
@media (max-width: 1100px) {
  .task-row {
    gap: 9px;
    padding: 15px 12px;
  }
  .task-chevron {
    display: none;
  }
  .task-state {
    max-width: 75px;
  }
  .task-detail {
    padding: 20px;
  }
  .detail-top {
    flex-wrap: wrap;
  }
}
@media (max-width: 899px) {
  .task-workspace {
    grid-template-columns: 1fr;
  }
  .task-detail {
    position: static;
    max-height: none;
    grid-row: 1;
  }
  .task-list {
    grid-row: 2;
  }
  .run-support {
    grid-template-columns: 1fr;
  }
  .task-copy > strong {
    font-size: 14px;
  }
  .task-state {
    max-width: none;
  }
}
@media (max-width: 600px) {
  .heading {
    align-items: flex-start;
    gap: 16px;
  }
  .heading-actions {
    width: 100%;
  }
  .heading-actions button {
    flex: 1;
    padding: 11px 8px;
    font-size: 12px;
  }
  .task-progress {
    padding: 18px;
    gap: 12px;
  }
  .detail-top h2 {
    font-size: 21px;
  }
  .detail-actions {
    width: 100%;
  }
  .task-state {
    max-width: 82px;
  }
  .task-row {
    padding: 15px 12px;
  }
  .task-copy > strong {
    font-size: 12px;
  }
  .task-detail {
    padding: 20px;
  }
  .task-detail h2 {
    font-size: 18px;
  }
  .task-result dl > div {
    grid-template-columns: 100px minmax(0, 1fr);
  }
  .task-progress h3 {
    font-size: 17px;
  }
  .task-totals strong {
    font-size: 23px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .running .task-check {
    animation: none;
  }
}

.global-bar .icon-button {
  padding: 0;
}
.navigation .eyebrow {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.09em;
}
#connect-notice {
  margin-bottom: 20px;
}

/* Runbook lifecycle and document downloads */
.card-top .badge {
  margin-left: auto;
}
.delete-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 7px;
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  flex: 0 0 auto;
}
.delete-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.delete-icon:hover {
  color: var(--bad);
  background: var(--subtle);
}
.card-top {
  gap: 8px;
}
#open-trash {
  color: var(--muted);
  display: flex;
  gap: 7px;
  align-items: center;
}
#trash-count {
  font-size: 11px;
  background: var(--subtle);
  padding: 2px 6px;
  border-radius: 5px;
}
.trash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
}
.trash-row h3 {
  font-size: 15px;
  margin: 0 0 6px;
}
.trash-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
#delete-title,
#download-title {
  line-height: 1.4;
  overflow-wrap: anywhere;
}
#download-dialog {
  width: min(540px, calc(100vw - 32px));
}
.download-options {
  display: grid;
  gap: 10px;
  margin: 22px 0;
}
.download-choice {
  display: flex;
  gap: 15px;
  align-items: center;
  text-align: left;
  padding: 18px;
  width: 100%;
  border-radius: 12px;
}
.download-choice strong {
  display: block;
  font-size: 14px;
  margin-bottom: 5px;
}
.download-choice small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  display: block;
}
.download-choice.preferred {
  background: var(--soft);
  border-color: var(--primary);
  color: var(--primary);
}
.format-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 9px;
  letter-spacing: 0.04em;
  background: var(--surface);
}
.download-arrow {
  margin-left: auto;
  font-size: 22px;
}
.download-sources {
  flex-direction: row;
  align-items: center;
  font-size: 12px;
  gap: 9px;
  color: var(--muted);
}
.download-sources input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}
.other-formats {
  border-top: 1px solid var(--border);
  padding-top: 15px;
  font-size: 12px;
  color: var(--muted);
}
.other-formats summary {
  cursor: pointer;
}
.other-formats > div {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.other-formats button {
  font-size: 12px;
}

.download-choice {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.download-choice:hover {
  text-decoration: none;
  background: var(--subtle);
}
.other-formats a {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
}

.camera-upload {
  display: inline-flex;
  position: relative;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  margin: 0 0 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-weight: 600;
  cursor: pointer;
  overflow: hidden;
}
.camera-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.camera-upload:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.photo-match {
  padding: 20px;
  margin: 0 0 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.photo-match h3 {
  margin: 8px 0;
}
.photo-match p {
  margin: 8px 0 12px;
}

#import-form.has-photo-match #import-client-label,
#import-form.has-photo-match #import-text-label,
#import-form.has-photo-match > .fine,
#import-form.has-photo-match .dialog-actions {
  display: none;
}

/* Build stages advance only on recorded server events. */
#generation-progress {
  padding: 4px 0 10px;
}
.build-status-heading {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  margin: 10px 0 24px;
}
.build-status-heading strong {
  font-size: 16px !important;
}
.build-current {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 12px !important;
}
.build-working,
.build-complete,
.build-failed {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--primary);
}
.build-working {
  border: 2px solid var(--subtle);
  border-top-color: var(--primary);
  animation: build-spin 1s linear infinite;
}
.build-stages {
  list-style: none;
  margin: 0;
  padding: 0;
}
.build-stages li {
  display: flex;
  gap: 13px;
  padding: 0 0 21px;
  position: relative;
  color: var(--muted);
}
.build-stages li:last-child {
  padding-bottom: 0;
}
.build-stages li:not(:last-child)::after {
  content: "";
  position: absolute;
  width: 1px;
  background: var(--border);
  top: 23px;
  bottom: 3px;
  left: 10px;
}
.build-stage-mark {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  background: var(--surface);
}
.build-stages strong {
  font-weight: 500;
  line-height: 22px;
}
.build-stages small {
  display: block;
  font-size: 11px;
  line-height: 1.6;
  margin-top: 3px;
  color: var(--muted);
}
.build-stages .complete .build-stage-mark {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--soft);
}
.build-stages .active {
  color: var(--text);
}
.build-stages .active strong {
  font-weight: 700;
}
.build-stages .active .build-stage-mark::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}
.build-stages .active .build-stage-mark {
  border-color: var(--primary);
}
.build-stages .failed,
.build-failed {
  color: var(--danger, #b42318);
}
@keyframes build-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .build-working {
    animation: none;
  }
}

.build-stage-state {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#recovery-consoles, #run-cleanup { margin-top: 24px; }
#console-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; }
.console-card { overflow: hidden; border: 1px solid var(--border, #dce3ee); border-radius: 12px; background: var(--surface, #fff); min-width: 0; }
.console-card header { padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; }
.console-card header span { font-size: 12px; color: var(--muted, #64748b); }
.console-card.has-control { border-color: var(--primary, #353fae); box-shadow: 0 0 0 2px var(--primary, #353fae); }
.console-controls .control[aria-pressed="true"] { color: #fff; background: var(--primary, #353fae); }
.vnc-screen { height: 310px; min-height: 0; min-width: 0; background: #111827; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; }
.console-controls { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; }
.console-controls button { padding: 7px 10px; font-size: 12px; }
.console-shortcut-help { display: none; align-self: center; font-size: 12px; color: var(--muted, #64748b); }
.console-card.is-expanded { display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; max-width: none; max-height: none; border: 0; border-radius: 0; box-shadow: none; }
.console-card.is-expanded .vnc-screen { flex: 1 1 0%; height: 0; }
.console-card.is-expanded header, .console-card.is-expanded .console-controls { flex: 0 0 auto; }
.console-card.is-expanded .console-shortcut-help { display: inline; }
.console-card.is-window-expanded { position: fixed; inset: 0; z-index: 10000; height: 100vh; height: 100dvh; }
body.console-expanded { overflow: hidden; }
#network-settings { margin-block: 16px; }
#run-cleanup .danger { min-height: 44px; }
