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

:root {
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --touch-min: 2.75rem;
  --warning-text: #b42318;
  --warning-bg: #fff4f2;
  --warning-border: #f4b4aa;

  /* Relay design tokens (Current Relay Plan — Phase 5B.2) */
  --relay-font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --relay-font-display: Newsreader, Georgia, "Times New Roman", serif;
  --relay-page-bg: #fbf6ee;
  --relay-surface: #fffdfc;
  --relay-surface-warm: #fff0ea;
  --relay-surface-insight: #dcefeb;
  --relay-surface-subtle: #faf7f3;
  --relay-ink: #302330;
  --relay-ink-soft: #594955;
  --relay-muted: #766a72;
  --relay-primary: #b84f5a;
  --relay-primary-hover: #a94450;
  --relay-primary-soft: #f5d9d8;
  --relay-secondary: #2f7c78;
  --relay-secondary-soft: #dcefeb;
  --relay-accent: #d9a64a;
  --relay-accent-rich: #c99232;
  --relay-accent-soft: #f8e9c8;
  --relay-border: #e3d7cf;
  --relay-border-strong: #cbb9ae;
  --relay-focus: #2f7c78;
  --relay-shadow-soft: 0 2px 8px rgba(48, 35, 48, 0.07);
  --relay-shadow-card: 0 6px 22px rgba(48, 35, 48, 0.09);
  --relay-shadow-primary: 0 2px 0 color-mix(in srgb, var(--relay-primary-hover) 75%, #000),
    0 4px 12px rgba(184, 79, 90, 0.22);
  --relay-radius-card: 10px;
  --relay-radius-control: 8px;
  /* Spacing rhythm (summary + future Relay screens) */
  --relay-space-section: 1.75rem;
  --relay-space-heading-card: 0.625rem;
  --relay-space-label-value: 0.25rem;
  --relay-space-field-stack: 0.875rem;
  --relay-space-note-label: 0.35rem;
  --relay-card-pad: 1rem;
  --relay-card-pad-loose: 1.25rem;
  --relay-muted-readable: #655a62;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  font-family: var(--relay-font-body);
  line-height: 1.5;
  color: var(--relay-ink);
  background: var(--relay-page-bg);
}

.app-shell {
  min-height: 100dvh;
  max-width: 28rem;
  margin: 0 auto;
  padding: var(--space-md);
  padding-bottom: var(--space-xl);
  min-width: 0;
}

.app-header {
  padding: var(--space-sm) 0 var(--space-md);
}

.app-kicker {
  margin: 0;
}

.app-brand-kicker {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--relay-muted);
}

.app-header .relay-motif--brand {
  color: var(--relay-accent-rich);
  flex-shrink: 0;
}

.app-main {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.screen--hidden {
  display: none !important;
}

.screen-title {
  margin: 0 0 var(--space-sm);
  font-family: var(--relay-font-display);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--relay-ink);
}

.lead {
  margin: 0 0 var(--relay-space-section);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--relay-muted-readable);
}

.welcome-restore-block {
  margin-top: var(--relay-space-section);
  padding-top: var(--space-md);
  border-top: 1px solid var(--relay-border);
}

.welcome-restore-prompt {
  margin: 0 0 var(--space-sm);
  font-size: 0.875rem;
  line-height: 1.45;
  text-align: center;
  color: var(--relay-muted-readable);
}

.welcome-restore-button {
  width: 100%;
}

.welcome-import-status {
  margin: var(--space-sm) 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.45;
  text-align: center;
  color: var(--relay-secondary);
}

.welcome-import-status:empty {
  display: none;
}

.supporting-copy {
  margin: 0 0 var(--space-md);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--relay-muted-readable);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  padding: var(--space-sm) var(--space-lg);
  font-family: var(--relay-font-body);
  font-size: inherit;
  font-weight: 600;
  border-radius: var(--relay-radius-control);
  border: 2px solid transparent;
  cursor: pointer;
}

.btn:focus-visible {
  outline: 2px solid var(--relay-focus);
  outline-offset: 2px;
}

.btn-primary {
  color: #ffffff;
  background: var(--relay-primary);
  border-color: var(--relay-primary);
  box-shadow: var(--relay-shadow-primary);
}

/* Primary elevation uses a bottom-only lip; outline follows the border box and looked uneven */
.btn-primary:focus-visible {
  box-shadow: none;
}

.btn-secondary {
  color: var(--relay-ink);
  background: var(--relay-surface);
  border-color: var(--relay-border-strong);
}

.btn-quiet-summary {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--relay-ink-soft);
  background: var(--relay-surface);
  border: 2px solid var(--relay-border-strong);
}

.screen-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--relay-space-section);
}

.screen-actions .btn-primary {
  flex: 1 1 auto;
  min-width: 0;
}

.option-grid {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.option-tile {
  width: 100%;
  min-width: 0;
  min-height: var(--touch-min);
  padding: var(--space-md);
  text-align: left;
  font-family: var(--relay-font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--relay-ink);
  background: var(--relay-surface);
  border: 2px solid var(--relay-border);
  border-radius: var(--relay-radius-control);
  cursor: pointer;
  overflow-wrap: anywhere;
}

.option-tile[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--relay-primary) 42%, var(--relay-border-strong));
  background: color-mix(in srgb, var(--relay-primary-soft) 50%, var(--relay-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--relay-primary) 18%, transparent);
  font-weight: 600;
}

.option-tile:focus-visible {
  outline: 2px solid var(--relay-focus);
  outline-offset: 2px;
}

.status-message {
  min-height: 1.25rem;
  margin-bottom: var(--space-sm);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--relay-secondary);
}

.status-message:empty {
  display: none;
}

.validation-message {
  margin: var(--space-md) 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--warning-text);
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  padding: 0.75rem;
  border-radius: var(--relay-radius-control);
}

.validation-message:empty {
  display: none;
}

.reflection-list {
  display: flex;
  flex-direction: column;
  gap: var(--relay-space-section);
}

.reflection-card {
  padding: var(--relay-card-pad-loose) var(--relay-card-pad);
  border: 1px solid var(--relay-border);
  border-radius: var(--relay-radius-card);
  background: var(--relay-surface);
  box-shadow: var(--relay-shadow-soft);
}

.reflection-card h3 {
  margin: 0 0 var(--space-sm);
  font-family: var(--relay-font-body);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--relay-ink);
}

.reflection-insight {
  margin: 0 0 var(--space-md);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--relay-ink-soft);
}

.reflection-question {
  margin: 0 0 var(--space-sm);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--relay-ink);
  padding: 0;
}

.reflection-fieldset {
  margin: 0 0 var(--space-md);
  padding: 0;
  border: none;
  min-width: 0;
}

.reflection-action {
  margin-top: var(--space-md);
  padding: var(--space-md);
  border: 1px solid color-mix(in srgb, var(--relay-secondary) 28%, var(--relay-border));
  border-radius: var(--relay-radius-control);
  background: color-mix(in srgb, var(--relay-surface-insight) 55%, var(--relay-surface));
}

.reflection-action-heading {
  margin: 0 0 var(--space-xs);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--relay-muted);
}

.reflection-action-text {
  margin: 0 0 var(--space-xs);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--relay-ink-soft);
}

.reflection-action-text:last-child {
  margin-bottom: 0;
}

.relay-note-draft {
  margin-top: var(--space-sm);
  padding: 0.625rem var(--relay-card-pad) 0.75rem calc(var(--relay-card-pad) + 2px);
  background: var(--relay-surface);
  border: 1px solid var(--relay-border);
  border-radius: calc(var(--relay-radius-card) - 2px);
  box-shadow: inset 3px 0 0 var(--relay-accent-rich);
}

.relay-note-draft-label {
  display: block;
  margin: 0 0 var(--relay-space-note-label);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--relay-muted);
}

.relay-note-draft textarea {
  min-height: 3.25rem;
  margin: 0;
  background: var(--relay-surface);
}

.summary-labeled-row {
  margin-bottom: var(--space-sm);
}

.summary-labeled-row:last-child {
  margin-bottom: 0;
}

.summary-field-label {
  margin: 0 0 var(--space-xs);
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--relay-muted);
}

.summary-field-value {
  margin: 0 0 var(--space-sm);
  font-size: 0.9375rem;
}

.field-group {
  margin: 0 0 var(--relay-space-section);
  padding: 0 0 var(--relay-space-section);
  border: none;
  border-bottom: 1px solid var(--relay-border);
}

.field-group:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: var(--space-md);
}

.field-legend {
  display: block;
  margin-bottom: var(--space-sm);
  padding: 0;
  font-family: var(--relay-font-body);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--relay-ink);
}

.field-wrap {
  margin-bottom: var(--relay-space-field-stack);
}

.field-wrap:last-child {
  margin-bottom: 0;
}

.field-wrap--nested {
  margin-top: var(--space-sm);
}

.field-hint {
  margin: var(--space-sm) 0 var(--space-xs);
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--relay-muted-readable);
}

label {
  display: block;
  margin-bottom: var(--relay-space-label-value);
  font-family: var(--relay-font-body);
  font-weight: 600;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--relay-ink-soft);
}

input[type="text"],
input[type="email"],
input[type="date"],
textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: var(--touch-min);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--relay-font-body);
  font-size: 1rem;
  line-height: 1.35;
  color: var(--relay-ink);
  border: 2px solid var(--relay-border);
  border-radius: var(--relay-radius-control);
  background: var(--relay-surface);
  overflow-wrap: anywhere;
}

textarea {
  min-height: 5rem;
  resize: vertical;
}

textarea.textarea-compact {
  min-height: 3.25rem;
}

input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--relay-focus);
  outline-offset: 1px;
  border-color: color-mix(in srgb, var(--relay-secondary) 45%, var(--relay-border-strong));
}

.radio-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.radio-option,
.checkbox-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  min-height: var(--touch-min);
  padding: var(--space-sm) var(--space-md);
  font-family: var(--relay-font-body);
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--relay-ink);
  background: var(--relay-surface);
  border: 2px solid var(--relay-border);
  border-radius: var(--relay-radius-control);
  cursor: pointer;
}

.radio-option:has(input:checked),
.checkbox-option:has(input:checked) {
  border-color: color-mix(in srgb, var(--relay-secondary) 48%, var(--relay-border-strong));
  background: color-mix(in srgb, var(--relay-secondary-soft) 65%, var(--relay-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--relay-secondary) 15%, transparent);
  font-weight: 600;
}

.radio-option input,
.checkbox-option input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.15rem;
  flex-shrink: 0;
  accent-color: var(--relay-primary);
}

.radio-option span,
.checkbox-option span {
  flex: 1;
  min-width: 0;
  padding-top: 0.1rem;
  overflow-wrap: anywhere;
}

.radio-option:focus-within,
.checkbox-option:focus-within {
  outline: 2px solid var(--relay-focus);
  outline-offset: 2px;
}

.user-text {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Summary layout — base structure (visuals scoped under #screen-summary) */
.summary {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  min-width: 0;
  max-width: 100%;
}

.summary-section {
  min-width: 0;
  max-width: 100%;
}

.summary-muted {
  font-size: 0.9375rem;
}

.next-date-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.next-date-actions .btn {
  width: 100%;
  text-decoration: none;
}

.next-date-roulette-handoff {
  margin: var(--space-md) 0;
  padding: var(--relay-card-pad);
  border: 1px solid color-mix(in srgb, var(--relay-secondary) 32%, var(--relay-border));
  border-left: 3px solid var(--relay-secondary);
  border-radius: var(--relay-radius-card);
  background: color-mix(in srgb, var(--relay-surface-insight) 70%, var(--relay-surface));
  box-shadow: var(--relay-shadow-soft);
}

.next-date-inspiration-copy {
  margin: 0 0 var(--space-sm);
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--relay-muted-readable);
}

.next-date-roulette-link {
  display: inline-flex;
  width: 100%;
  text-decoration: none;
}

#screen-plans-changed > .field-group {
  margin-bottom: var(--space-md);
  padding-bottom: 0;
  border-bottom: none;
}

.recovery-panel {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--relay-border);
}

.recovery-context {
  margin-bottom: var(--space-md);
  padding: var(--relay-card-pad);
  background: var(--relay-surface-subtle);
  border: 1px solid var(--relay-border);
  border-radius: var(--relay-radius-card);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
  box-shadow: var(--relay-shadow-soft);
}

.recovery-context .summary-field-label {
  margin: 0 0 var(--relay-space-label-value);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--relay-muted);
}

.recovery-context .summary-field-value {
  margin: 0 0 var(--relay-space-field-stack);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--relay-ink);
}

.recovery-context .summary-field-value:last-child {
  margin-bottom: 0;
}

.recovery-roulette-link {
  display: inline-flex;
  width: 100%;
  margin-top: var(--space-sm);
  margin-bottom: var(--space-md);
  text-decoration: none;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.recent-dates-toggle {
  width: 100%;
  margin-top: var(--space-md);
}

.check-in-context {
  margin-bottom: var(--space-lg);
}

.check-in-panel {
  margin-bottom: var(--space-md);
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

/* ===== Phase 5B.2 — Current Relay Plan visual system ===== */

body.is-summary-screen .app-header {
  display: none;
}

body.is-summary-screen .app-main {
  background: transparent;
  border: none;
  padding-top: var(--space-md);
}

#screen-summary .summary {
  gap: var(--relay-space-section);
}

#screen-summary .summary-page-header {
  margin-bottom: var(--relay-space-section);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--relay-border);
}

#screen-summary .summary-page-kicker {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: 0 0 var(--space-sm);
  font-family: var(--relay-font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--relay-muted);
}

#screen-summary .summary-page-title {
  margin: 0;
  font-family: var(--relay-font-display);
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: var(--relay-ink);
}

#screen-summary .relay-motif--brand {
  color: var(--relay-accent-rich);
  flex-shrink: 0;
}

#screen-summary .summary-brand-continuity {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  max-width: 12rem;
}

#screen-summary .summary-brand-continuity-line {
  flex: 1 1 auto;
  height: 1px;
  background: color-mix(in srgb, var(--relay-border-strong) 70%, transparent);
}

#screen-summary .relay-motif--continuity {
  color: color-mix(in srgb, var(--relay-secondary) 55%, var(--relay-accent));
  flex-shrink: 0;
}

#screen-summary .summary-section-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 var(--relay-space-heading-card);
  font-family: var(--relay-font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--relay-ink);
}

#screen-summary .relay-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 1.125rem;
  height: 1.125rem;
  color: var(--relay-primary);
}

#screen-summary .relay-icon svg {
  width: 1.125rem;
  height: 1.125rem;
  display: block;
}

#screen-summary .summary-section--insights .relay-icon {
  color: var(--relay-secondary);
}

#screen-summary .summary-section--history .relay-icon {
  color: var(--relay-muted);
}

#screen-summary .summary-muted {
  color: var(--relay-muted-readable);
  font-weight: 400;
  line-height: 1.45;
}

#screen-summary .summary-field-label {
  margin: 0 0 var(--relay-space-label-value);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--relay-muted);
}

#screen-summary .summary-field-value {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--relay-ink);
}

#screen-summary .relay-field-group {
  margin-bottom: var(--relay-space-field-stack);
}

#screen-summary .relay-field-group:last-child {
  margin-bottom: 0;
}

#screen-summary .summary-our-next-date .summary-field-value {
  font-weight: 700;
}

#screen-summary .summary-field-value--scheduling-detail {
  margin-top: 0.2rem;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--relay-ink);
}

#screen-summary .summary-labeled-row--keep-in-mind {
  margin-top: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--relay-border);
}

#screen-summary .summary-labeled-row--keep-in-mind .summary-field-value {
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--relay-ink-soft);
}

#screen-summary .relay-surface--hero {
  overflow: hidden;
  background: var(--relay-surface-warm);
  border-radius: var(--relay-radius-card);
  border: 1px solid color-mix(in srgb, var(--relay-primary) 14%, var(--relay-border));
  box-shadow: var(--relay-shadow-card);
}

#screen-summary .next-date-hero-details {
  padding: var(--relay-card-pad-loose) var(--relay-card-pad) var(--relay-card-pad);
}

#screen-summary .next-date-hero-actions {
  padding: var(--relay-card-pad);
  background: color-mix(in srgb, var(--relay-surface) 72%, var(--relay-surface-warm));
  border-top: 1px solid color-mix(in srgb, var(--relay-primary) 14%, var(--relay-border));
}

#screen-summary .next-date-hero-actions .next-date-actions {
  gap: 0.625rem;
}

#screen-summary .btn-tertiary-summary {
  font-weight: 600;
  color: var(--relay-ink-soft);
  background: color-mix(in srgb, var(--relay-surface) 88%, var(--relay-surface-warm));
  border: 2px solid color-mix(in srgb, var(--relay-border-strong) 70%, var(--relay-secondary) 30%);
}

#screen-summary .insight-card {
  padding: var(--relay-card-pad-loose) var(--relay-card-pad) var(--relay-card-pad-loose);
  padding-left: calc(var(--relay-card-pad) + 4px);
  background: var(--relay-surface-insight);
  border: 1px solid color-mix(in srgb, var(--relay-secondary) 32%, var(--relay-border));
  border-left: 3px solid var(--relay-secondary);
  border-radius: var(--relay-radius-card);
  box-shadow: var(--relay-shadow-soft);
}

#screen-summary .pattern-insights-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

#screen-summary .pattern-insights-list li {
  position: relative;
  padding-left: 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--relay-ink);
}

#screen-summary .pattern-insights-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--relay-secondary);
}

#screen-summary .pattern-supporting-line {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid color-mix(in srgb, var(--relay-secondary) 15%, transparent);
  font-size: 0.8125rem;
  color: var(--relay-muted-readable);
  line-height: 1.45;
}

#screen-summary .relay-surface--baseline {
  background: var(--relay-surface-subtle);
  border: 1px solid var(--relay-border);
  border-radius: var(--relay-radius-card);
  box-shadow: var(--relay-shadow-soft);
}

#screen-summary .baseline-summary {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: var(--relay-card-pad);
  cursor: pointer;
  list-style: none;
  min-width: 0;
}

#screen-summary .baseline-summary::-webkit-details-marker {
  display: none;
}

#screen-summary .baseline-summary:focus {
  outline: none;
}

#screen-summary .baseline-summary:focus-visible {
  outline: 2px solid var(--relay-focus);
  outline-offset: -2px;
  border-radius: var(--relay-radius-card);
}

#screen-summary .baseline-summary-title {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--relay-muted);
}

#screen-summary .relay-motif--baseline {
  color: color-mix(in srgb, var(--relay-secondary) 70%, var(--relay-accent));
}

#screen-summary .baseline-details[open] .relay-motif--baseline {
  color: var(--relay-secondary);
}

#screen-summary .baseline-summary-meta {
  margin-top: 0.1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--relay-ink);
}

#screen-summary .baseline-summary-support {
  margin-top: 0.05rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--relay-muted-readable);
}

#screen-summary .baseline-summary-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--relay-ink-soft);
}

#screen-summary .baseline-summary-toggle .relay-icon {
  color: var(--relay-secondary);
  margin-top: 0.05rem;
}

#screen-summary .baseline-details:not([open]) .baseline-summary-toggle--close {
  display: none;
}

#screen-summary .baseline-details[open] .baseline-summary-toggle--open {
  display: none;
}

#screen-summary .baseline-details-content {
  padding: 0 var(--relay-card-pad) var(--relay-card-pad);
}

#screen-summary .baseline-panel-section {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--relay-border);
}

#screen-summary .baseline-panel-section:first-child {
  margin-top: 0.35rem;
  padding-top: 0;
  border-top: none;
}

#screen-summary .baseline-panel-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--relay-muted);
}

#screen-summary .baseline-compact-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: var(--space-xs) 0 0;
  padding-left: 1.125rem;
  color: var(--relay-ink-soft);
  font-size: 0.9375rem;
  line-height: 1.45;
  list-style: disc;
  list-style-position: outside;
}

#screen-summary .baseline-compact-list li {
  display: list-item;
}

#screen-summary .baseline-noticed-item {
  margin-bottom: var(--space-md);
}

#screen-summary .baseline-noticed-item:last-child {
  margin-bottom: 0;
}

#screen-summary .baseline-noticed-item > .relay-field-group > .summary-field-label {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--relay-muted-readable);
}

#screen-summary .baseline-noticed-item > .relay-field-group > .summary-field-value {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--relay-ink);
}

#screen-summary .baseline-panel-section > p:not(.summary-field-label) {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--relay-ink);
}

#screen-summary .baseline-revisit-actions {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--relay-border);
}

#screen-summary .baseline-revisit-actions .btn {
  width: 100%;
  max-width: 100%;
  margin: 0;
}

#screen-summary .relay-note-block {
  margin-top: var(--space-sm);
  padding: 0.625rem var(--relay-card-pad) 0.625rem
    calc(var(--relay-card-pad) + 2px);
  background: var(--relay-surface);
  border: 1px solid var(--relay-border);
  border-left: none;
  border-radius: calc(var(--relay-radius-card) - 2px);
  box-shadow: inset 3px 0 0 var(--relay-accent-rich);
}

#screen-summary .relay-note-block .summary-field-label {
  margin-bottom: var(--relay-space-note-label);
}

#screen-summary .relay-note-text {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--relay-ink-soft);
}

#screen-summary .relay-surface--history {
  background: var(--relay-surface);
  border: 1px solid var(--relay-border);
  border-radius: var(--relay-radius-card);
  box-shadow: var(--relay-shadow-soft);
}

#screen-summary .history-item[open].relay-surface--history {
  border-color: color-mix(in srgb, var(--relay-secondary) 45%, var(--relay-border));
}

#screen-summary .history-item-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 0.75rem var(--relay-card-pad);
  cursor: pointer;
  list-style: none;
}

#screen-summary .history-item-summary-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

#screen-summary .history-item > summary::-webkit-details-marker {
  display: none;
}

#screen-summary .history-item-summary:focus-visible {
  outline: 2px solid var(--relay-focus);
  outline-offset: -2px;
}

#screen-summary .history-item-summary-primary {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--relay-ink);
}

#screen-summary .history-item-summary-outcome {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--relay-muted-readable);
}

#screen-summary .history-item-chevron {
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 0.125rem;
  color: color-mix(in srgb, var(--relay-secondary) 70%, var(--relay-muted));
}

#screen-summary .history-item[open] .history-item-chevron {
  transform: rotate(180deg);
}

#screen-summary .history-item-body {
  padding: var(--space-sm) var(--relay-card-pad) var(--relay-card-pad);
  border-top: 1px solid var(--relay-border);
}

#screen-summary .history-item-body .relay-field-group {
  margin-bottom: var(--space-md);
}

#screen-summary .history-item-body .relay-field-group:last-child {
  margin-bottom: 0;
}

#screen-summary .history-item-body .summary-field-value {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--relay-ink);
}

#screen-summary .history-list {
  gap: 0.625rem;
}

#screen-summary .relay-icon--chevron-up {
  transform: rotate(180deg);
}

/* ===== Phase 5B.3 — pointer-fine hover enhancements only ===== */

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    background: var(--relay-primary-hover);
    border-color: var(--relay-primary-hover);
  }

  .btn-secondary:hover {
    background: color-mix(in srgb, var(--relay-primary-soft) 45%, var(--relay-surface));
    border-color: color-mix(in srgb, var(--relay-primary) 35%, var(--relay-border-strong));
  }

  .btn-quiet-summary:hover {
    color: var(--relay-ink);
    background: color-mix(in srgb, var(--relay-surface) 85%, var(--relay-primary-soft));
    border-color: color-mix(in srgb, var(--relay-primary) 25%, var(--relay-border-strong));
  }

  .option-tile:hover:not([aria-pressed="true"]) {
    border-color: color-mix(in srgb, var(--relay-secondary) 35%, var(--relay-border-strong));
  }

  .radio-option:hover:not(:has(input:checked)),
  .checkbox-option:hover:not(:has(input:checked)) {
    border-color: color-mix(in srgb, var(--relay-secondary) 30%, var(--relay-border-strong));
  }

  #screen-summary .btn-tertiary-summary:hover {
    color: var(--relay-ink);
    background: var(--relay-surface);
    border-color: color-mix(in srgb, var(--relay-secondary) 35%, var(--relay-border-strong));
  }

  #screen-summary .baseline-summary:hover .baseline-summary-toggle {
    color: var(--relay-ink);
  }

  #screen-summary .history-item-summary:hover {
    background: color-mix(in srgb, var(--relay-secondary-soft) 35%, transparent);
  }

  #screen-summary .history-item-summary:hover .history-item-chevron {
    color: var(--relay-secondary);
  }
}

.btn-primary:active {
  background: var(--relay-primary-hover);
  border-color: var(--relay-primary-hover);
}

.option-tile:active {
  border-color: color-mix(in srgb, var(--relay-secondary) 40%, var(--relay-border));
}

/* ===== History delete dialog (Phase 5C.1) ===== */

.relay-dialog {
  margin: auto;
  padding: var(--relay-card-pad-loose) var(--relay-card-pad);
  max-width: min(22rem, calc(100vw - 2 * var(--space-md)));
  width: 100%;
  border: 1px solid var(--relay-border);
  border-radius: var(--relay-radius-card);
  background: var(--relay-surface);
  color: var(--relay-ink);
  font-family: var(--relay-font-body);
  box-shadow: var(--relay-shadow-card);
}

.relay-dialog::backdrop {
  background: rgba(48, 35, 48, 0.42);
}

.relay-dialog-title {
  margin: 0 0 var(--space-sm);
  font-family: var(--relay-font-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.25;
  color: var(--relay-ink);
}

.relay-dialog-body {
  margin: 0 0 var(--space-md);
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--relay-ink-soft);
}

.history-delete-dialog-context {
  margin-bottom: var(--space-md);
  padding: var(--space-sm) var(--relay-card-pad);
  background: var(--relay-surface-subtle);
  border: 1px solid var(--relay-border);
  border-radius: var(--relay-radius-control);
}

.history-delete-dialog-date {
  margin: 0 0 0.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--relay-ink);
}

.history-delete-dialog-activity {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--relay-muted-readable);
}

.history-delete-dialog-warning {
  margin: 0 0 var(--space-md);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--warning-text);
}

.relay-dialog-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.relay-dialog-actions .btn {
  width: 100%;
}

.history-delete-confirm {
  font-weight: 600;
  color: var(--relay-primary);
  border-color: color-mix(in srgb, var(--relay-primary) 45%, var(--relay-border-strong));
}

#screen-summary .history-item-delete {
  width: 100%;
  margin-top: var(--space-md);
}

.relay-import-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.relay-import-dialog-exported {
  margin: 0 0 var(--space-sm);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--relay-ink-soft);
}

#screen-summary .relay-surface--data {
  background: var(--relay-surface-subtle);
  border: 1px solid var(--relay-border);
  border-radius: var(--relay-radius-card);
  box-shadow: var(--relay-shadow-soft);
}

#screen-summary .relay-data-summary {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: var(--relay-card-pad);
  cursor: pointer;
  list-style: none;
  min-width: 0;
}

#screen-summary .relay-data-summary::-webkit-details-marker {
  display: none;
}

#screen-summary .relay-data-summary:focus {
  outline: none;
}

#screen-summary .relay-data-summary:focus-visible {
  outline: 2px solid var(--relay-focus);
  outline-offset: -2px;
  border-radius: var(--relay-radius-card);
}

#screen-summary .relay-data-summary-title {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--relay-muted);
}

#screen-summary .relay-data-summary-support {
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--relay-muted-readable);
}

#screen-summary .relay-data-summary-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--relay-ink-soft);
}

#screen-summary .relay-data-summary-toggle .relay-icon {
  color: var(--relay-muted);
  margin-top: 0.05rem;
}

#screen-summary .relay-data-details[open] .relay-data-summary-toggle .relay-icon {
  transform: rotate(180deg);
}

#screen-summary .relay-data-content {
  padding: 0 var(--relay-card-pad) var(--relay-card-pad);
}

#screen-summary .relay-data-backup-block {
  padding-top: 0.35rem;
}

#screen-summary .relay-data-reset-block {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--relay-border);
}

#screen-summary .relay-data-reset-btn {
  width: 100%;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--warning-text);
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.relay-reset-confirm {
  font-weight: 600;
  color: var(--warning-text);
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

#screen-summary .relay-data-subheading {
  margin: 0 0 var(--space-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--relay-muted);
}

#screen-summary .relay-data-action {
  width: 100%;
  margin-bottom: 0.5rem;
}

#screen-summary .relay-data-supporting {
  margin: var(--space-sm) 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--relay-muted-readable);
}

#screen-summary .relay-data-import-status {
  margin: var(--space-sm) 0 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--relay-secondary);
}

#screen-summary .relay-data-import-status:empty {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  #screen-summary .relay-data-summary:hover .relay-data-summary-toggle {
    color: var(--relay-ink);
  }
}

.license-gate .license-screen {
  min-width: 0;
  max-width: 100%;
}

.license-form {
  margin-bottom: var(--relay-space-section);
}

.license-form .field-wrap {
  margin-bottom: var(--relay-space-field-stack);
}

.license-form .btn-primary {
  width: 100%;
}

.license-error-message {
  margin: 0 0 var(--space-sm);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--warning-text);
}

.license-error-message:empty {
  display: none;
}

.license-status-message {
  margin: 0 0 var(--space-sm);
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--relay-muted-readable);
}

.license-status-message:empty {
  display: none;
}

.license-support-copy {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  text-align: center;
  color: var(--relay-muted-readable);
}

#screen-license-checking .btn,
#screen-license-activation .btn-primary {
  margin-top: var(--space-sm);
}

#btn-license-retry {
  width: 100%;
}
