body[data-r06-route-closeout="front"] {
  overflow-x: clip;
  background: var(--ui-bg-page);
  color: var(--ui-text-primary);
  letter-spacing: 0;
}

.rfc-skip,
.frc-skip {
  position: fixed;
  z-index: 1000;
  top: max(8px, var(--ui-safe-top));
  left: max(8px, var(--ui-safe-left));
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: var(--ui-radius-control);
  color: var(--ui-text-on-brand);
  background: var(--ui-brand);
}

.rfc-skip:focus,
.frc-skip:focus { transform: translateY(0); }

body[data-r06-route-closeout="front"] .brand {
  overflow: hidden;
}

body[data-r06-route-closeout="front"] .brand-emblem::after {
  inset: 0;
}

.rfc-context {
  display: grid;
  gap: var(--ui-space-sm);
  width: min(1180px, calc(100% - 32px));
  margin: var(--ui-space-md) auto;
  padding-block: var(--ui-space-md);
  border-block: 1px solid var(--ui-border);
}

.rfc-context__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ui-space-lg);
}

.rfc-context__head :where(p, h2, span),
.rfc-priority,
.rfc-privacy { margin: 0; }

.rfc-context__head p {
  color: var(--ui-brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.rfc-context__head h2 {
  margin-block: 4px;
  color: var(--ui-text-primary);
  font-size: 26px;
  line-height: var(--ui-leading-tight);
  letter-spacing: 0;
}

.rfc-context__head span,
.rfc-priority,
.rfc-privacy {
  color: var(--ui-text-secondary);
  font-size: 14px;
}

.rfc-controls,
.rfc-segment {
  display: flex;
  align-items: center;
  gap: 4px;
}

.rfc-segment {
  padding: 3px;
  border: 1px solid var(--ui-border);
  background: var(--ui-bg-subtle);
}

.rfc-segment button,
.rfc-refresh {
  min-width: var(--ui-touch-target);
  min-height: var(--ui-touch-target);
  padding-inline: 12px;
  border: 0;
  border-radius: var(--ui-radius-control);
  color: var(--ui-text-secondary);
  background: transparent;
}

.rfc-segment button.is-active,
.rfc-segment button[aria-pressed="true"] {
  color: var(--ui-text-primary);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-panel);
}

.rfc-refresh {
  color: var(--ui-text-on-brand);
  background: var(--ui-brand);
}

.rfc-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ui-space-sm);
}

.rfc-facts > div {
  min-width: 0;
  padding: 8px;
  border-left: 3px solid var(--ui-brand);
  background: var(--ui-bg-subtle);
}

.rfc-facts :where(span, strong) { display: block; }

.rfc-facts span {
  color: var(--ui-text-secondary);
  font-size: 12px;
}

.rfc-facts strong {
  margin-top: 4px;
  color: var(--ui-text-primary);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.rfc-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rfc-statuses span {
  padding: 5px 8px;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-control);
  color: var(--ui-text-secondary);
  background: var(--ui-surface);
  font-size: 12px;
  font-weight: 700;
}

.rfc-statuses :is([data-r06-status*="ERROR"], [data-r06-status*="DENIED"], [data-r06-status*="RESTRICTED"]) {
  border-color: var(--ui-error);
  color: var(--ui-error);
}

.rfc-statuses :is([data-r06-status*="STALE"], [data-r06-status*="UNKNOWN"], [data-r06-status*="CONFIGURED"], [data-r06-status*="EXTERNAL"]) {
  border-color: var(--ui-warning);
  color: var(--ui-warning);
}

body[data-r06-route-closeout="front"] [data-r06-high-risk="true"] {
  min-height: var(--ui-touch-target);
  border: 1px solid var(--ui-error);
}

body[data-r06-route-closeout="front"] [data-r06-financial-value="complete"] {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

body[data-r06-route-closeout="front"] :focus-visible {
  outline: 3px solid var(--ui-focus);
  outline-offset: 2px;
}

.rfc-context[data-network-state="offline"]::after {
  padding: 8px;
  color: var(--ui-error);
  background: var(--ui-error-soft);
  content: "OFFLINE";
}

@media (max-width: 900px) {
  .rfc-context__head,
  .rfc-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .rfc-controls { width: 100%; }
  .rfc-segment { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rfc-segment:nth-child(2) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rfc-facts { grid-template-columns: 1fr; }

  body[data-r06-route-closeout="front"] .table-wrap {
    overflow: visible;
    border: 0;
  }

  body[data-r06-route-closeout="front"] :is(table, tbody) { display: block; }

  body[data-r06-route-closeout="front"] thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  body[data-r06-route-closeout="front"] tr[data-r06-responsive-card="true"] {
    display: grid;
    margin-bottom: var(--ui-space-sm);
    padding: var(--ui-space-sm);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius-panel);
    background: var(--ui-surface);
  }

  body[data-r06-route-closeout="front"] tr[data-r06-responsive-card="true"] td {
    display: grid;
    grid-template-columns: minmax(104px, 38%) minmax(0, 1fr);
    min-height: var(--ui-touch-target);
    padding: 10px 4px;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body[data-r06-route-closeout="front"] tr[data-r06-responsive-card="true"] td::before {
    padding-right: 8px;
    color: var(--ui-text-secondary);
    font-size: 12px;
    font-weight: 700;
    content: attr(data-label);
  }

  body[data-r06-route-closeout="front"] :where(button, a, input, select, textarea) {
    min-height: var(--ui-touch-target);
  }
}

@media (prefers-reduced-motion: reduce) {
  .rfc-context *,
  .frc-context * {
    scroll-behavior: auto;
    animation-duration: .01ms;
    animation-iteration-count: 1;
  }
}

@media (forced-colors: active) {
  .rfc-statuses span { border: 1px solid CanvasText; }
}
