:root {
  --venus-red: #ea0029;
  --venus-blue: #0047ba;
  --venus-green: #007960;
  --venus-orange: #ff8300;
  --ink: #142033;
  --muted: #5d6a7e;
  --paper: #f6f4ef;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(20, 32, 51, 0.12);
  --shadow: 0 24px 60px rgba(20, 32, 51, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(234, 0, 41, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(0, 71, 186, 0.14), transparent 26%),
    linear-gradient(180deg, #f8efe9 0%, #f8f7f3 35%, #eef4f3 100%);
}

.shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.hero {
  display: block;
  margin-bottom: 24px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.73rem;
  color: var(--venus-blue);
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(2.8rem, 4vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.hero-copy,
.hero-card-copy,
.subsection-head p,
.trace-item p,
.audit-item p,
.record-item p {
  color: var(--muted);
}

.hero-masthead,
.panel,
.canvas-card,
.trace-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(14px);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-masthead {
  padding: 20px 24px 24px;
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.95), rgba(234, 0, 41, 0.07) 46%, rgba(0, 71, 186, 0.08) 100%),
    var(--panel);
}

.hero-copy-block {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-logo-rail {
  width: 108px;
  height: 108px;
  border-radius: 32px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.6) 52%, rgba(234, 0, 41, 0.08) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 20px 44px rgba(20, 32, 51, 0.08);
}

.hero-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}

.hero-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 16px 30px rgba(234, 0, 41, 0.16));
}

.grid {
  display: grid;
  gap: 24px;
}

#workflow-view {
  display: grid;
  gap: 24px;
}

.page-nav {
  display: inline-flex;
  gap: 8px;
  padding: 8px;
  margin: 0 0 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(20, 32, 51, 0.08);
  box-shadow: var(--shadow);
}

.page-nav-button {
  background: transparent;
  color: var(--muted);
  padding: 10px 16px;
}

.page-nav-button.active {
  background: linear-gradient(135deg, rgba(0, 71, 186, 0.12), rgba(234, 0, 41, 0.12));
  color: var(--ink);
}

.page-nav-button[aria-selected="true"] {
  background: linear-gradient(135deg, rgba(0, 71, 186, 0.12), rgba(234, 0, 41, 0.12));
  color: var(--ink);
}

.panel {
  padding: 24px;
}

.panel-form {
  overflow: hidden;
}

.panel-head,
.subsection-head,
.status-stack,
.action-bar,
.history-grid,
.review-grid {
  display: flex;
  gap: 16px;
}

.panel-head,
.subsection-head {
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
}

.subsection {
  margin-top: 28px;
}

.helper-note {
  margin: 10px 0 20px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(0, 71, 186, 0.06);
  color: var(--muted);
  font-size: 0.88rem;
  border: 1px solid rgba(0, 71, 186, 0.08);
}

.guide-details {
  margin-top: 12px;
  border: 1px solid rgba(20, 32, 51, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.74);
  overflow: hidden;
}

.guide-details summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-weight: 600;
  color: var(--venus-blue);
}

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

.guide-steps {
  padding: 0 16px 14px;
}

.guide-steps ol {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.guide-steps li + li {
  margin-top: 8px;
}

.hero-accent-row {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.hero-accent {
  display: inline-block;
  height: 6px;
  border-radius: 999px;
}

.hero-accent-red {
  width: 148px;
  background: linear-gradient(90deg, var(--venus-red), rgba(234, 0, 41, 0.3));
}

.hero-accent-blue {
  width: 72px;
  background: linear-gradient(90deg, var(--venus-blue), rgba(0, 71, 186, 0.24));
}

.hero-accent-green {
  width: 48px;
  background: linear-gradient(90deg, var(--venus-green), rgba(0, 121, 96, 0.24));
}

.hero-accent-orange {
  width: 28px;
  background: linear-gradient(90deg, var(--venus-orange), rgba(255, 131, 0, 0.24));
}

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

.field-grid.compact {
  grid-template-columns: 1fr 1fr;
}

.field-span {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
}

input,
select,
button,
textarea {
  font: inherit;
}

input,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 3px solid rgba(0, 71, 186, 0.15);
  border-color: rgba(0, 71, 186, 0.35);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease;
}

button:focus-visible,
.guide-details summary:focus-visible,
.hash-toggle:focus-visible {
  outline: 3px solid rgba(0, 71, 186, 0.22);
  outline-offset: 2px;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.primary-button {
  background: linear-gradient(135deg, var(--venus-red), #ff5568);
  color: white;
}

.secondary-button {
  background: linear-gradient(135deg, var(--venus-blue), #3f7df7);
  color: white;
}

.ghost-button {
  background: rgba(20, 32, 51, 0.06);
  color: var(--ink);
}

.action-bar {
  margin-top: 26px;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
}

.action-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.action-group-primary {
  flex: 1;
}

.action-group-utility {
  justify-content: flex-end;
}

.action-guidance,
.action-feedback {
  margin-top: 16px;
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.action-guidance {
  background: rgba(0, 71, 186, 0.05);
  border: 1px solid rgba(0, 71, 186, 0.12);
  color: var(--muted);
}

.action-feedback {
  background: rgba(0, 121, 96, 0.08);
  border: 1px solid rgba(0, 121, 96, 0.18);
  color: var(--ink);
}

.action-feedback[data-tone="info"] {
  background: rgba(0, 71, 186, 0.06);
  border-color: rgba(0, 71, 186, 0.18);
}

.action-feedback[data-tone="warning"] {
  background: rgba(255, 131, 0, 0.08);
  border-color: rgba(255, 131, 0, 0.2);
}

.method-context-card {
  margin: 14px 0 20px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(0, 71, 186, 0.05));
  border: 1px solid rgba(20, 32, 51, 0.08);
}

.method-context-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.method-context-head strong {
  font-size: 0.98rem;
}

.method-context-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.context-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.context-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.context-chip-basis {
  background: rgba(0, 71, 186, 0.08);
  color: var(--venus-blue);
}

.context-chip-stage {
  background: rgba(0, 121, 96, 0.08);
  color: var(--venus-green);
}

.context-chip-control {
  background: rgba(255, 131, 0, 0.1);
  color: #8a5200;
}

.method-context-points {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--ink);
}

.method-context-points li + li {
  margin-top: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 18px;
}

#standard-table,
#test-table {
  margin-top: 12px;
}

.table-shell {
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid rgba(20, 32, 51, 0.08);
  background: rgba(255, 255, 255, 0.78);
}

thead th {
  text-align: left;
  padding: 14px 12px;
  background: rgba(0, 71, 186, 0.08);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

tbody td {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

tbody tr:nth-child(even) {
  background: rgba(20, 32, 51, 0.03);
}

.readonly {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin: 20px 0 24px;
  overflow: hidden;
}

.summary-card {
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(20, 32, 51, 0.08);
  min-width: 0;
}

.summary-card h3,
.list-title,
.hero-card-title {
  margin: 0 0 8px;
  font-size: 0.94rem;
}

.summary-card strong {
  display: block;
  font-size: 1.5rem;
  line-height: 1.2;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.summary-card .ci-sub {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.summary-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.87rem;
  line-height: 1.45;
}

.insight-card {
  padding: 18px 20px;
  border-radius: 24px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(0, 121, 96, 0.04));
  border: 1px solid rgba(20, 32, 51, 0.08);
}

.insight-card h3,
.trace-group-title {
  margin: 0 0 8px;
}

.insight-card p,
.trace-caption {
  margin: 0;
  color: var(--muted);
}

.understanding-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: start;
  gap: 14px;
  margin: 16px 0 24px;
}

.teaching-card {
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(20, 32, 51, 0.08);
  box-sizing: border-box;
}

#numbers-guide {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#numbers-guide .subsection-head {
  flex-shrink: 0;
}

#numbers-guide .numbers-scroll {
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(20, 32, 51, 0.15) transparent;
}

#numbers-guide .numbers-scroll::-webkit-scrollbar {
  width: 4px;
}

#numbers-guide .numbers-scroll::-webkit-scrollbar-track {
  background: transparent;
}

#numbers-guide .numbers-scroll::-webkit-scrollbar-thumb {
  background: rgba(20, 32, 51, 0.15);
  border-radius: 99px;
}

.checklist {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.checklist-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(20, 32, 51, 0.04);
  color: var(--ink);
  line-height: 1.5;
}

.plain-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.plain-card {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(20, 32, 51, 0.04);
}

.plain-card strong {
  display: block;
  margin-bottom: 6px;
}

.plain-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.plain-card .plain-why {
  margin-top: 6px;
  color: var(--ink);
}

.review-grid {
  flex-direction: column;
}

/* ── Residual section ─────────────────────────────────────────────────────── */

.residual-section {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  margin-top: 16px;
}

@media (max-width: 780px) {
  .residual-section {
    grid-template-columns: 1fr;
  }
}

.residual-stats {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.residual-stat {
  display: grid;
  gap: 2px;
}

.residual-stat-label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.residual-stat-value {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  word-break: break-word;
}

.residual-stat-note {
  font-size: 0.82rem;
  color: var(--muted);
}

.canvas-card,
.trace-card {
  padding: 20px;
}

.chart-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 10px;
}

.chart-button {
  padding: 9px 14px;
}

.chart-stage {
  position: relative;
  min-height: 420px;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(234, 0, 41, 0.04));
}

#curve-svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-tooltip {
  position: absolute;
  pointer-events: none;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(20, 32, 51, 0.92);
  color: white;
  font-size: 0.82rem;
  box-shadow: 0 12px 24px rgba(20, 32, 51, 0.18);
  transform: translate(12px, 12px);
  max-width: 220px;
}

.chart-axis-label {
  fill: rgba(20, 32, 51, 0.76);
  font-size: 13px;
}

.chart-grid-line {
  stroke: rgba(20, 32, 51, 0.12);
  stroke-width: 1;
}

.chart-fit-line {
  stroke: var(--venus-blue);
  stroke-width: 2.5;
  fill: none;
}

.chart-standard-link {
  stroke: rgba(0, 71, 186, 0.55);
  stroke-width: 2;
  fill: none;
  stroke-dasharray: 6 6;
}

.chart-point-standard {
  fill: var(--venus-blue);
}

.chart-point-test {
  fill: var(--venus-red);
}

.chart-point-standard,
.chart-point-test {
  cursor: pointer;
  transition: opacity 120ms ease, filter 120ms ease;
}

.chart-point-standard:hover,
.chart-point-test:hover {
  opacity: 0.88;
  filter: drop-shadow(0 0 8px rgba(20, 32, 51, 0.18));
}

.trace-list,
.audit-list,
.record-list {
  display: grid;
  gap: 12px;
  max-height: 560px;
  overflow: auto;
  padding-right: 4px;
}

.trace-item,
.audit-item,
.record-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(20, 32, 51, 0.08);
}

.trace-item header,
.audit-item header,
.record-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.trace-item code,
.audit-item code,
.record-item code {
  font-size: 0.8rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.trace-block,
.audit-block {
  margin-top: 14px;
}

.plain-language-note {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,0.98), rgba(0, 121, 96, 0.05));
  border: 1px solid rgba(20, 32, 51, 0.08);
}

.plain-language-note strong {
  display: block;
  margin-bottom: 6px;
}

.plain-language-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.plain-language-note p + p {
  margin-top: 6px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.detail-card {
  padding: 12px 13px;
  border-radius: 14px;
  background: rgba(20, 32, 51, 0.04);
}

.detail-card dt {
  margin: 0 0 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(20, 32, 51, 0.54);
}

.detail-card dd {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.35;
}

.detail-table {
  width: 100%;
  margin-top: 10px;
  font-size: 0.86rem;
}

.detail-table th,
.detail-table td {
  padding: 10px 8px;
}

.detail-table th {
  background: rgba(20, 32, 51, 0.05);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(234, 0, 41, 0.09);
  color: var(--venus-red);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-chip.subtle {
  background: rgba(0, 71, 186, 0.08);
  color: var(--venus-blue);
}

.status-draft {
  background: rgba(255, 131, 0, 0.12);
  color: var(--venus-orange);
}

.status-reviewed {
  background: rgba(0, 71, 186, 0.12);
  color: var(--venus-blue);
}

.status-final {
  background: rgba(0, 121, 96, 0.12);
  color: var(--venus-green);
}

.pass {
  color: var(--venus-green);
}

.fail {
  color: var(--venus-red);
}

.history-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 20px;
}

.record-item.active {
  border-color: rgba(234, 0, 41, 0.34);
  box-shadow: inset 0 0 0 1px rgba(234, 0, 41, 0.12);
}

.inline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
}

.app-footer {
  margin-top: 28px;
  padding: 0 4px;
}

.app-footer-line {
  height: 1px;
  background: linear-gradient(90deg, rgba(20, 32, 51, 0.06), rgba(20, 32, 51, 0.16), rgba(20, 32, 51, 0.06));
  margin-bottom: 10px;
}

.app-footer-credit {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: rgba(20, 32, 51, 0.38);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.footer-credit-logo {
  height: 18px;
  width: auto;
  opacity: 0.55;
  display: block;
}

.app-footer-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  color: rgba(20, 32, 51, 0.52);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#app-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(20, 32, 51, 0.08);
  background: rgba(255, 255, 255, 0.72);
  color: rgba(20, 32, 51, 0.78);
  letter-spacing: 0.02em;
}

#app-status[data-tone="success"] {
  color: var(--venus-green);
  border-color: rgba(0, 121, 96, 0.2);
  background: rgba(0, 121, 96, 0.08);
}

#app-status[data-tone="error"] {
  color: var(--venus-red);
  border-color: rgba(234, 0, 41, 0.2);
  background: rgba(234, 0, 41, 0.08);
}

#app-status[data-tone="info"] {
  color: var(--venus-blue);
  border-color: rgba(0, 71, 186, 0.2);
  background: rgba(0, 71, 186, 0.08);
}

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

  .hero-masthead {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .hero-logo-rail {
    width: 88px;
    height: 88px;
    border-radius: 24px;
  }

  .hero-logo {
    width: 58px;
    height: 58px;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 18px 12px 36px;
  }

  .field-grid,
  .field-grid.compact,
  .summary-cards,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .hero-masthead {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px;
  }

  .hero-logo-rail {
    width: 84px;
    height: 84px;
  }

  .hero-accent-red {
    width: 88px;
  }

  .app-footer-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .panel,
  .canvas-card,
  .trace-card {
    border-radius: 22px;
  }
}

/* ── Hash masking ─────────────────────────────────────────────────────────── */

.hash-value {
  font-family: "SF Mono", "Fira Code", "Consolas", monospace;
  font-size: 0.82em;
  letter-spacing: 0.04em;
  color: var(--text-secondary, #6b7280);
  vertical-align: middle;
}

.hash-value.masked {
  color: var(--text-tertiary, #9ca3af);
  letter-spacing: 0.12em;
}

.hash-value.revealed {
  color: var(--text-secondary, #6b7280);
  word-break: break-all;
}

.hash-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 3px;
  font-size: 0.85em;
  opacity: 0.5;
  vertical-align: middle;
  transition: opacity 0.15s;
}

.hash-toggle:hover {
  opacity: 1;
}

@media print {
  body {
    background: white;
  }

  .shell {
    max-width: none;
    padding: 0;
  }

  .panel-form,
  .hero,
  .page-nav,
  .record-list,
  .audit-list,
  .action-bar,
  #new-record-button,
  .hash-toggle {
    display: none !important;
  }

  .hash-value.masked {
    color: inherit;
    letter-spacing: inherit;
  }

  .panel,
  .canvas-card,
  .trace-card {
    box-shadow: none;
    border: 0;
    background: white;
  }
}

/* ── Phase 2 Auth UI ───────────────────────────────────────────────────────── */

.page-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.page-nav-spacer {
  flex: 1;
}

.user-info-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
}

.user-role-chip {
  background: rgba(0, 71, 186, 0.1);
  color: var(--venus-blue);
  border: 1px solid rgba(0, 71, 186, 0.2);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.user-name {
  color: var(--muted);
  font-weight: 600;
}

.nav-logout-button {
  font-size: 0.78rem;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.status-submitted {
  background: rgba(255, 131, 0, 0.12);
  color: var(--venus-orange);
  border-color: rgba(255, 131, 0, 0.3);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--venus-red);
  color: #fff;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  margin-left: 4px;
  vertical-align: middle;
  line-height: 1;
}

.list-section-label {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 10px 16px 4px;
}

.queue-item {
  border-left: 3px solid var(--venus-orange) !important;
}

/* ── Audit trail improvements ─────────────────────────────────────────────── */

.audit-item-highlighted {
  border-left: 3px solid var(--venus-blue) !important;
}

.audit-item-highlighted.audit-item[class*="RETURNED"],
article.audit-item-highlighted:has(.audit-comment) {
  border-left-color: var(--venus-orange) !important;
}

.audit-actor {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink);
  margin: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.audit-role-chip {
  background: rgba(0, 71, 186, 0.08);
  color: var(--venus-blue);
  border: 1px solid rgba(0, 71, 186, 0.18);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.audit-comment {
  margin: 8px 0 6px;
  padding: 8px 12px;
  background: rgba(0, 71, 186, 0.05);
  border-left: 3px solid var(--venus-blue);
  border-radius: 0 8px 8px 0;
  font-size: 0.88rem;
  color: var(--ink);
  font-style: italic;
}

.audit-detail-toggle {
  margin-top: 8px;
  font-size: 0.8rem;
}

.audit-detail-toggle summary {
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

/* ── Comment field ────────────────────────────────────────────────────────── */

.field-required {
  color: var(--venus-red);
  font-weight: 700;
}

input.field-error {
  border-color: var(--venus-red) !important;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ── No-draft lock state ──────────────────────────────────────────────────── */

#record-form.no-draft .subsection,
#record-form.no-draft .action-bar {
  opacity: 0.22;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.25s ease;
}

/* ── New-draft prompt banner ─────────────────────────────────────────────── */

#form-start-prompt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(0, 71, 186, 0.05);
  border: 1.5px solid rgba(0, 71, 186, 0.18);
  border-radius: 10px;
  margin: 4px 0 20px;
}

.form-start-prompt-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1.5;
}

#form-start-prompt p {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary, #5d6a7e);
  line-height: 1.5;
}

#form-start-prompt strong {
  color: var(--venus-blue);
  font-weight: 600;
}

/* ── Live replicate agreement ─────────────────────────────────────────────── */

tr.row-cv-warn td {
  background: rgba(255, 131, 0, 0.06);
}

tr.row-cv-warn td input {
  border-color: var(--venus-orange, #ff8300);
}

tr.row-cv-warn td.readonly {
  color: var(--venus-orange, #ff8300);
  font-weight: 600;
}

/* ── Pre-flight banner ────────────────────────────────────────────────────── */

.preflight-banner {
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}

.preflight-banner-error {
  background: rgba(234, 0, 41, 0.06);
  border: 1.5px solid rgba(234, 0, 41, 0.25);
}

.preflight-banner-warning {
  background: rgba(255, 131, 0, 0.06);
  border: 1.5px solid rgba(255, 131, 0, 0.25);
}

.preflight-heading {
  font-weight: 600;
  margin-bottom: 8px;
}

.preflight-banner-error .preflight-heading { color: var(--venus-red); }
.preflight-banner-warning .preflight-heading { color: var(--venus-orange, #ff8300); }

.preflight-list {
  margin: 0 0 4px;
  padding: 0 0 0 16px;
}

.preflight-item {
  margin-bottom: 5px;
  color: #142033;
}

.preflight-item-error::marker { color: var(--venus-red); }
.preflight-item-warn::marker  { color: var(--venus-orange, #ff8300); }

.preflight-footer {
  margin: 8px 0 0;
  font-size: 11px;
  color: rgba(20, 32, 51, 0.55);
}

/* ── Electronic Signature Modal ────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
  animation: esig-backdrop-in 0.2s ease-out;
}

@keyframes esig-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--panel, #fff);
  border-radius: 10px;
  padding: 1.75rem 1.75rem 1.25rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  animation: esig-modal-in 0.25s ease-out;
}

@keyframes esig-modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Header with lock icon */
.esig-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.esig-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.esig-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink, #142033);
}

.esig-description {
  font-size: 0.88rem;
  color: var(--muted, #6b7280);
  margin: 0.15rem 0 1.1rem;
  line-height: 1.4;
}

/* Signer identity (read-only) */
.esig-signer {
  margin-bottom: 0.9rem;
}

.esig-signer label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
  color: var(--muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.esig-signer input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 5px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink, #142033);
  background: #f9fafb;
  cursor: default;
}

/* Form fields */
.modal .field {
  margin-bottom: 0.9rem;
}

.modal .field label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  font-weight: 600;
  color: var(--ink, #142033);
}

.modal .field input {
  width: 100%;
  padding: 0.55rem 0.6rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 5px;
  font-size: 0.95rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.modal .field textarea {
  width: 100%;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--line, #ccc);
  border-radius: 8px;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  resize: vertical;
  min-height: 110px;
}

.modal .field input:focus,
.modal .field textarea:focus {
  outline: none;
  border-color: var(--venus-blue, #1a3f8b);
  box-shadow: 0 0 0 3px rgba(26, 63, 139, 0.12);
}

/* Error banner (compassionate, not alarming) */
.esig-error-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  color: #991b1b;
  line-height: 1.4;
  margin: 0.25rem 0 0.5rem;
}

@keyframes esig-shake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-6px); }
  30% { transform: translateX(6px); }
  45% { transform: translateX(-4px); }
  60% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
  90% { transform: translateX(2px); }
}

.esig-error-banner.shake {
  animation: esig-shake 0.5s ease-out;
}

/* Action buttons */
.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--line, #e5e7eb);
}

.modal-actions .primary-button:disabled {
  opacity: 0.65;
  cursor: wait;
}

@media (max-width: 760px) {
  .action-bar,
  .action-group,
  .method-context-head {
    flex-direction: column;
    align-items: stretch;
  }

  .action-group-utility {
    justify-content: flex-start;
  }
}
