:root {
  --bg: #0d1117;
  --surface: rgba(14, 21, 31, 0.96);
  --surface-strong: #101a26;
  --border: rgba(118, 149, 181, 0.24);
  --border-strong: rgba(133, 173, 214, 0.42);
  --text: #e7eef7;
  --muted: #97a9bc;
  --accent: #f08a37;
  --accent-soft: rgba(240, 138, 55, 0.18);
  --ok: #7ed6a3;
  --warn: #f4c063;
  --bad: #ff7c7c;
  --shadow: none;
  --radius: 0;
  --radius-sm: 0;
  --ops-panel-height: 160px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  height: 100vh;
  font-family: "Archivo", sans-serif;
  color: var(--text);
  background:
    linear-gradient(rgba(86, 115, 148, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86, 115, 148, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #0a0f16 0%, #0d1117 100%);
  background-size: 20px 20px, 20px 20px, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(180deg, rgba(240, 138, 55, 0.08), transparent 22%),
    linear-gradient(90deg, rgba(82, 132, 188, 0.08), transparent 32%);
  mix-blend-mode: screen;
}

.page-shell {
  width: calc(100% - 32px);
  max-width: none;
  margin: 0 auto;
  padding: 12px 0 16px;
  min-height: 100vh;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.hero-lower {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  min-height: 0;
}

.hero-copy,
.panel {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 10px 12px;
  display: grid;
  gap: 6px;
  align-content: start;
  position: relative;
}

.hero-form-panel {
  padding: 10px 12px;
  display: grid;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
}

.eyebrow {
  margin: 0 0 2px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
h3,
strong {
  margin: 0;
}

h1 {
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.hero-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding-right: 42px;
}

.hero-title-row h1 {
  min-width: 0;
}

.title-icon-button {
  position: absolute;
  top: 10px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
}

.title-icon {
  width: 16px;
  height: 16px;
  display: block;
  filter: invert(94%) sepia(7%) saturate(432%) hue-rotate(173deg) brightness(99%) contrast(96%);
}

.hero-text,
.panel-heading p,
.form-message,
.log-message,
.excerpt-text,
.summary-content,
li {
  color: var(--muted);
}

.hero-text {
  margin: 0;
  line-height: 1.25;
  font-size: 0.78rem;
}

.hero-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(118, 149, 181, 0.14);
}

.hero-stat-inline {
  justify-content: flex-start;
}

.hero-stat > strong:not(.status-pill) {
  min-width: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.hero-stat-actions {
  justify-content: flex-end;
  border-bottom: 0;
  padding-bottom: 0;
}

.label,
.step-index,
.step-state,
.log-meta,
.excerpt-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.bill-source-row {
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.bill-url-inline,
.bill-id-inline {
  display: block;
  min-width: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.bill-url-inline {
  flex: 1 1 45%;
}

.bill-id-inline {
  flex: 0 1 20%;
  text-align: left;
}

.run-contact-links {
  flex: 0 0 auto;
  margin-left: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: right;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  padding: 3px 6px;
  border-radius: 0;
  font-size: 0.72rem;
  font-family: "IBM Plex Mono", monospace;
  text-transform: uppercase;
  background: rgba(231, 238, 247, 0.08);
}

.status-pill.idle,
.status-pill.pending {
  color: var(--muted);
}

.status-pill.running,
.status-pill.in_progress {
  color: var(--warn);
  background: rgba(183, 121, 31, 0.14);
}

.status-pill.completed,
.status-pill.succeeded {
  color: var(--ok);
  background: rgba(45, 106, 79, 0.15);
}

.status-pill.failed,
.status-pill.error {
  color: var(--bad);
  background: rgba(155, 34, 38, 0.12);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.28fr) minmax(260px, 0.72fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 10px;
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.panel {
  padding: 10px 12px;
}

.panel-summary {
  grid-column: 2;
  grid-row: 1;
  min-height: 460px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel-steps {
  grid-column: 1;
  grid-row: 1;
  min-height: 460px;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.panel-ops {
  min-width: 0;
  min-height: var(--ops-panel-height);
  height: var(--ops-panel-height);
  max-height: var(--ops-panel-height);
  flex: 0 0 var(--ops-panel-height);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.hero-lower.is-run-active .panel-ops {
  grid-column: 1;
}

body.workflow-fullscreen .hero-lower,
body.workflow-fullscreen .panel-summary {
  display: none;
}

body.workflow-fullscreen .page-shell {
  padding-bottom: 12px;
}

body.workflow-fullscreen .dashboard-grid {
  grid-template-columns: 1fr;
}

body.workflow-fullscreen .panel-steps {
  grid-column: 1;
  min-height: 0;
  height: 100%;
}

body.ops-fullscreen .panel-summary,
body.ops-fullscreen .panel-steps {
  display: none;
}

body.ops-fullscreen .page-shell {
  padding-bottom: 12px;
}

body.ops-fullscreen .hero {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  margin-bottom: 0;
}

body.ops-fullscreen .hero-copy {
  flex: 0 0 auto;
}

body.ops-fullscreen .hero-lower {
  flex: 1 1 auto;
  min-height: 0;
}

body.ops-fullscreen .dashboard-grid {
  display: none;
}

body.ops-fullscreen .panel-ops {
  min-height: 0;
  height: 100%;
  max-height: none;
  flex: 1 1 auto;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.panel-heading-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.panel-heading h2 {
  font-size: 0.86rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel-heading p {
  margin: 0;
  line-height: 1.2;
  font-size: 0.76rem;
}

.panel-heading-action {
  flex: 0 0 auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
}

.panel-heading-action-icon {
  width: 15px;
  height: 15px;
  display: block;
}

.panel-heading-action:hover .panel-heading-action-icon,
.panel-heading-action:focus-visible .panel-heading-action-icon {
}

.panel-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex: 0 0 auto;
}

.panel-tab {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid var(--border);
  background: rgba(16, 26, 38, 0.9);
  color: var(--muted);
}

.panel-tab-citizen-summary {
  flex: 1 1 auto;
}

.panel-tab.is-active {
  background: rgba(240, 138, 55, 0.14);
  color: var(--text);
  border-color: rgba(240, 138, 55, 0.35);
}

.panel-tab.is-current:not(.is-active) {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.45);
}

.hidden-panel {
  display: none;
}

.run-form.hidden-panel,
.panel.hidden-panel,
.panel-tab-panel.hidden-panel {
  display: none;
}

.panel-summary .panel-tab-panel {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 0;
  padding-right: 2px;
}

.panel-summary .panel-tab-panel,
.runtime-details,
.step-preview-output-body,
.event-log,
.source-text-body,
.markdown-code,
.markdown-table-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 138, 55, 0.7) rgba(10, 16, 24, 0.92);
}

.panel-summary .panel-tab-panel::-webkit-scrollbar,
.runtime-details::-webkit-scrollbar,
.step-preview-output-body::-webkit-scrollbar,
.event-log::-webkit-scrollbar,
.source-text-body::-webkit-scrollbar,
.markdown-code::-webkit-scrollbar,
.markdown-table-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.panel-summary .panel-tab-panel::-webkit-scrollbar-track,
.runtime-details::-webkit-scrollbar-track,
.step-preview-output-body::-webkit-scrollbar-track,
.event-log::-webkit-scrollbar-track,
.source-text-body::-webkit-scrollbar-track,
.markdown-code::-webkit-scrollbar-track,
.markdown-table-scroll::-webkit-scrollbar-track {
  background: rgba(10, 16, 24, 0.92);
  border: 1px solid rgba(118, 149, 181, 0.14);
}

.panel-summary .panel-tab-panel::-webkit-scrollbar-thumb,
.runtime-details::-webkit-scrollbar-thumb,
.step-preview-output-body::-webkit-scrollbar-thumb,
.event-log::-webkit-scrollbar-thumb,
.source-text-body::-webkit-scrollbar-thumb,
.markdown-code::-webkit-scrollbar-thumb,
.markdown-table-scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(240, 138, 55, 0.88), rgba(244, 192, 99, 0.82));
  border: 1px solid rgba(8, 14, 22, 0.96);
}

.panel-summary .panel-tab-panel::-webkit-scrollbar-thumb:hover,
.runtime-details::-webkit-scrollbar-thumb:hover,
.step-preview-output-body::-webkit-scrollbar-thumb:hover,
.event-log::-webkit-scrollbar-thumb:hover,
.source-text-body::-webkit-scrollbar-thumb:hover,
.markdown-code::-webkit-scrollbar-thumb:hover,
.markdown-table-scroll::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(244, 192, 99, 0.96), rgba(240, 138, 55, 0.9));
}

.panel-ops .panel-tab-panel:not(.hidden-panel) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.run-form {
  display: grid;
  gap: 6px;
}

.run-form label {
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.run-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: rgba(8, 14, 22, 0.96);
  color: var(--text);
}

input:focus,
select:focus,
button:focus {
  outline: 1px solid rgba(240, 138, 55, 0.6);
  outline-offset: 0;
}

button {
  padding: 8px 12px;
  border: 0;
  border-radius: 0;
  color: #08111a;
  background: linear-gradient(90deg, #f08a37, #f4c063);
  cursor: pointer;
  transition: filter 140ms ease;
  box-shadow: none;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
}

button:hover {
  filter: brightness(1.06);
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.form-message {
  min-height: 0.9rem;
  margin: 0;
  font-size: 0.74rem;
}

.summary-content {
  line-height: 1.25;
  display: grid;
  gap: 6px;
  font-size: 0.76rem;
}

.runtime-details {
  display: grid;
  gap: 6px;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  height: 100%;
}

.hero-stat-wide {
  grid-column: 1 / -1;
}

.runtime-row,
.inspector-list-block,
.inspector-log {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-strong);
}

.runtime-row {
  display: grid;
  gap: 2px;
}

.runtime-label,
.inspector-list-block h3,
.inspector-log-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
}

.runtime-value,
.inspector-list-block p,
.inspector-list-block li,
.inspector-log-message {
  line-height: 1.25;
  color: var(--muted);
  font-size: 0.78rem;
}

.inspector-list-block h3 {
  margin-bottom: 4px;
}

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

.inspector-log {
  display: grid;
  gap: 8px;
}

.inspector-log-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.inspector-log-message {
  margin: 0;
}

.summary-block h3 {
  margin-bottom: 3px;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.summary-block-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 3px;
}

.summary-block-header h3 {
  min-width: 0;
  margin-bottom: 0;
}

.summary-block ul {
  margin: 0;
  padding-left: 18px;
}

.summary-details-button {
  flex: 0 0 auto;
  margin-top: 0;
  padding: 5px 8px;
  font-size: 0.66rem;
}

.sponsor-card {
  padding: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(16, 26, 38, 0.76);
}

.sponsor-card-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.sponsor-card-body.no-photo {
  grid-template-columns: minmax(0, 1fr);
}

.sponsor-photo-frame {
  display: flex;
  width: 58px;
  min-height: 72px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.sponsor-photo {
  display: block;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 72px;
  object-fit: cover;
}

.sponsor-details {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.sponsor-name {
  font-size: 0.95rem;
  line-height: 1.1;
}

.sponsor-contact-heading {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sponsor-affiliation {
  margin: 0;
  color: var(--muted);
}

.sponsor-contact-list {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 3px 8px;
}

.sponsor-contact-list dt {
  color: var(--muted);
}

.sponsor-contact-list dd {
  margin: 0;
  min-width: 0;
}

.sponsor-raw-contact {
  color: var(--muted);
}

.sponsor-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sponsor-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(240, 138, 55, 0.45);
}

.sponsor-link:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

.representative-contact-links {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.2;
}

.representative-contact-link {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.representative-contact-link:hover,
.representative-contact-link:focus-visible {
  color: var(--accent);
}

.bill-claim-check {
  --bill-claim-misleading-scale: 1.25;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
}

.bill-claim-check.is-misleading {
  border-color: rgba(248, 113, 113, 0.78);
}

.bill-claim-check.is-misleading .bill-claim-status {
  font-size: calc(1em * var(--bill-claim-misleading-scale));
  font-weight: 700;
  text-transform: uppercase;
}

.bill-claim-check.is-not-misleading {
  border-color: rgba(74, 222, 128, 0.58);
}

.bill-claim-check.is-running,
.bill-claim-check.is-unavailable {
  border-color: rgba(244, 192, 99, 0.78);
}

.bill-claim-progress {
  height: 3px;
  margin-top: 8px;
  background: rgba(31, 26, 22, 0.12);
  overflow: hidden;
}

.bill-claim-progress-bar {
  height: 100%;
  width: 0;
  background: #c6922e;
  transition: width 220ms ease;
}

.steps-groups {
  display: grid;
  gap: 5px;
  flex: 0 0 auto;
  min-height: 0;
  overflow: hidden;
}

.step-preview {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  background: rgba(10, 16, 24, 0.92);
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.step-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
  flex: 0 0 auto;
}

.step-preview-title-wrap {
  display: grid;
  gap: 3px;
}

.step-preview-title {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.step-preview-description,
.step-preview-waiting,
.markdown-paragraph,
.markdown-list,
.markdown-output li {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.citizen-impact-summary {
  display: grid;
  gap: 10px;
}

.citizen-impact-section {
  display: grid;
  gap: 4px;
}

.citizen-impact-heading {
  margin: 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.citizen-impact-text {
  margin: 0;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.38;
}

.citizen-summary-stage {
  margin-top: 8px;
  padding: 34px 22px 24px;
  border: 1px solid rgba(180, 188, 198, 0.24);
  background: #000;
  color: rgba(210, 214, 220, 0.92);
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.citizen-summary-details-button {
  position: absolute;
  top: 8px;
  right: 10px;
  border-color: rgba(190, 196, 205, 0.36);
  background: transparent;
  color: rgba(190, 196, 205, 0.86);
}

.citizen-summary-details-button:hover:not(:disabled),
.citizen-summary-details-button:focus-visible:not(:disabled) {
  border-color: rgba(226, 232, 240, 0.7);
  color: rgba(236, 239, 244, 0.94);
  background: rgba(255, 255, 255, 0.06);
}

.citizen-summary-contact-links {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: rgba(210, 214, 220, 0.9);
}

.representative-contact-separator {
  color: rgba(210, 214, 220, 0.62);
}

.citizen-summary-body {
  width: min(100%, 920px);
}

.citizen-summary-content {
  display: grid;
  gap: 22px;
}

.citizen-summary-heading {
  --citizen-summary-heading-size: 1.55rem;
  --citizen-summary-heading-top-margin: 60px;
  position: absolute;
  top: var(--citizen-summary-heading-top-margin);
  left: 22px;
  right: 22px;
  color: rgba(236, 239, 244, 0.96);
  font-family: "IBM Plex Mono", monospace;
  font-size: var(--citizen-summary-heading-size);
  line-height: 1.18;
  text-align: center;
  overflow-wrap: anywhere;
}

.citizen-summary-section {
  display: grid;
  gap: 7px;
  text-align: center;
}

.citizen-summary-animated {
  color: rgba(210, 214, 220, 0.92);
}

.citizen-summary-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
  line-height: 1.25;
  text-transform: uppercase;
}

.citizen-summary-text {
  font-size: 1.18rem;
  line-height: 1.35;
}

.citizen-summary-word {
  opacity: 0;
  display: inline-block;
  white-space: pre;
  will-change: opacity, transform, filter;
  animation-name: citizenSummaryWordFadeIn, citizenSummaryWordSettle;
  animation-duration: 500ms, 520ms;
  animation-timing-function: ease-in, cubic-bezier(0.2, 0.8, 0.2, 1);
  animation-fill-mode: forwards, forwards;
}

.citizen-summary-stage.is-static .citizen-summary-word {
  opacity: 0.92;
  transform: none;
  filter: none;
  animation: none;
}

.step-preview-waiting {
  line-height: 1.1;
}

.step-preview-kicker,
.markdown-heading {
  margin: 0 0 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.step-preview-output {
  display: grid;
  gap: 4px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.step-preview-output-body {
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  justify-content: flex-start;
  align-items: flex-start;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.step-preview-output-body-wide {
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-gutter: stable;
}

.ellipsis::after {
  content: "...";
  display: inline-block;
  width: 1.2em;
  overflow: hidden;
  vertical-align: bottom;
  animation: ellipsisPulse 1.2s steps(4, end) infinite;
}

.step-group {
  padding: 5px 6px;
  border-radius: 0;
  border: 1px solid var(--border-strong);
  background: rgba(10, 16, 24, 0.92);
}

.step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 4px 6px;
  align-content: start;
}

.step-card {
  padding: 5px 6px 6px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 0;
  display: grid;
  gap: 3px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}

.step-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: rgba(31, 26, 22, 0.12);
}

.step-card[data-status="in_progress"]::before,
.step-card[data-status="running"]::before {
  background: var(--warn);
}

.step-card[data-status="completed"]::before,
.step-card[data-status="succeeded"]::before {
  background: var(--ok);
}

.step-card[data-status="failed"]::before,
.step-card[data-status="error"]::before {
  background: var(--bad);
}

.step-card:hover {
  border-color: rgba(240, 138, 55, 0.45);
  background: #132131;
}

.step-name {
  font-size: 0.7rem;
  line-height: 1.05;
  min-height: 0;
  text-transform: uppercase;
}

.step-progress {
  height: 2px;
  border-radius: 0;
  background: rgba(231, 238, 247, 0.08);
  overflow: hidden;
}

.step-progress-bar {
  height: 100%;
  width: 0;
  border-radius: 0;
  background: rgba(31, 26, 22, 0.16);
  transition: width 220ms ease;
}

.step-card[data-status="in_progress"] .step-progress-bar,
.step-card[data-status="running"] .step-progress-bar {
  background: linear-gradient(90deg, #c6922e, #e6bf62);
}

.step-card[data-status="completed"] .step-progress-bar,
.step-card[data-status="succeeded"] .step-progress-bar {
  background: linear-gradient(90deg, #2d6a4f, #4ea97c);
}

.step-card[data-status="failed"] .step-progress-bar,
.step-card[data-status="error"] .step-progress-bar {
  background: linear-gradient(90deg, #9b2226, #cb5c62);
}

.event-log,
.excerpt-list {
  display: grid;
  gap: 6px;
}

.event-log {
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.excerpt-list {
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.log-entry,
.excerpt-card {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-strong);
}

.log-meta,
.excerpt-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  color: var(--muted);
}

.log-message,
.excerpt-text {
  margin: 0;
  line-height: 1.25;
  font-size: 0.78rem;
}

.excerpt-text {
  padding-left: 8px;
  border-left: 2px solid var(--accent-soft);
}

.source-text-meta {
  display: block;
}

.source-text-meta-list {
  display: grid;
  gap: 4px;
}

.source-text-meta-line {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
  font-family: "IBM Plex Mono", monospace;
}

.external-link {
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-decoration: underline;
  text-underline-offset: 0.14em;
  overflow-wrap: anywhere;
}

.external-link:hover,
.external-link:focus-visible {
  color: var(--text);
}

.source-text-card {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.source-text-body {
  margin: 0;
  min-height: 0;
  height: 100%;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  font-size: 0.76rem;
  line-height: 1.3;
  font-family: "IBM Plex Mono", monospace;
}

.markdown-output {
  display: grid;
  gap: 6px;
  align-content: start;
}

.markdown-list {
  margin: 0;
  padding-left: 16px;
}

.markdown-list-ordered {
  padding-left: 18px;
}

.markdown-code {
  margin: 0;
  padding: 8px;
  overflow: auto;
  border: 1px solid rgba(118, 149, 181, 0.18);
  background: rgba(8, 14, 22, 0.96);
  color: var(--muted);
}

.markdown-inline-code {
  padding: 1px 4px;
  border: 1px solid rgba(118, 149, 181, 0.18);
  background: rgba(10, 18, 29, 0.92);
  color: var(--text);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.74rem;
}

.markdown-quote {
  margin: 0;
  padding-left: 8px;
  border-left: 2px solid rgba(224, 181, 86, 0.55);
  color: var(--muted);
}

.markdown-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.74rem;
}

.markdown-table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-gutter: stable;
}

.markdown-table-scroll-wide {
  align-self: stretch;
}

.step-preview-output-body-wide .markdown-table-scroll {
  width: max-content;
  max-width: none;
  overflow: visible;
  padding-bottom: 0;
  scrollbar-gutter: auto;
}

.markdown-table th,
.markdown-table td {
  padding: 5px 6px;
  border: 1px solid rgba(118, 149, 181, 0.18);
  text-align: left;
  vertical-align: top;
  word-break: break-word;
}

.markdown-table th {
  color: var(--text);
  background: rgba(20, 31, 45, 0.92);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.markdown-table td {
  color: var(--muted);
  background: rgba(10, 16, 25, 0.92);
}

.empty-state {
  padding: 8px 10px;
  border: 1px dashed rgba(118, 149, 181, 0.24);
  border-radius: 0;
  background: rgba(16, 26, 38, 0.64);
}

.ghost-button {
  padding: 6px 10px;
  border-radius: 0;
  border: 1px solid var(--border);
  background: rgba(16, 26, 38, 0.9);
  color: var(--text);
  box-shadow: none;
  font-size: 0.72rem;
}

.settings-panel {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  background:
    linear-gradient(rgba(86, 115, 148, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86, 115, 148, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, #0a0f16 0%, #0d1117 100%);
  background-size: 20px 20px, 20px 20px, auto;
}

.settings-panel.is-open {
  display: block;
}

.settings-form {
  height: 100vh;
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 14px 0 16px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.settings-header,
.settings-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
}

.settings-header h2 {
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.settings-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin: 10px 0;
  padding: 0 2px 0 0;
  display: grid;
  gap: 10px;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 138, 55, 0.7) rgba(10, 16, 24, 0.92);
}

.settings-section {
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  display: grid;
  gap: 10px;
}

.settings-section h3,
.settings-step-title {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-section p,
.settings-help {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.3;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.settings-field {
  display: grid;
  gap: 4px;
}

.settings-field label {
  display: grid;
  gap: 4px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.settings-field textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: rgba(8, 14, 22, 0.96);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
}

.settings-field textarea:focus {
  outline: 1px solid rgba(240, 138, 55, 0.6);
  outline-offset: 0;
}

.settings-step {
  border: 1px solid var(--border);
  background: rgba(10, 16, 24, 0.92);
}

.settings-step summary {
  cursor: pointer;
  padding: 8px 10px;
  color: var(--text);
}

.settings-step-fields {
  padding: 0 10px 10px;
}

.settings-action-buttons {
  display: flex;
  gap: 8px;
}

.step-inspector-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 14, 0.58);
  z-index: 40;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.step-inspector {
  position: fixed;
  top: 0;
  right: 0;
  width: min(720px, 92vw);
  height: 100vh;
  padding: 12px;
  background: #0f1823;
  border-left: 1px solid var(--border-strong);
  box-shadow: none;
  z-index: 50;
  overflow: auto;
  transform: translateX(100%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 220ms ease,
    visibility 220ms ease;
}

.step-inspector.is-open {
  transform: translateX(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.step-inspector-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.step-inspector-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.step-inspector-body {
  display: grid;
  gap: 8px;
}

.inspector-block {
  padding: 8px 10px;
  border-radius: 0;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.inspector-block h3 {
  margin-bottom: 6px;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.inspector-block pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--muted);
}

.inspector-block ul {
  margin: 0;
  padding-left: 18px;
}

.mono {
  font-family: "IBM Plex Mono", monospace;
}

@keyframes ellipsisPulse {
  0% {
    width: 0;
  }
  100% {
    width: 1.2em;
  }
}

@keyframes citizenSummaryWordFadeIn {
  from {
    opacity: 0;
    transform: translateY(1px);
    filter: blur(0.25px);
  }
  to {
    opacity: 0.78;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes citizenSummaryWordSettle {
  from {
    opacity: 0.78;
  }
  to {
    opacity: 0.92;
  }
}

@media (max-width: 1080px) {
  .hero-lower,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .panel-summary,
  .panel-steps,
  .panel-ops {
    grid-column: 1;
  }

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

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1380px);
    padding-top: 10px;
  }

  .hero-copy,
  .hero-form-panel,
  .panel {
    padding: 10px;
  }

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

  .bill-source-row {
    display: grid;
    gap: 5px;
  }

  .run-contact-links {
    margin-left: 0;
    text-align: left;
  }

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

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

  .step-inspector {
    width: 100vw;
  }
}
