/* Contain overflow only. Do not stretch the workspace to fill the viewport.
   Grid items default to min-width:auto; long subject_ref / proof strings
   were pushing past the screen edge. */
.page-tool {
  overflow-x: clip;
}

.page-tool .tp-checks,
.page-tool .tp-check,
.page-tool .tp-result,
.page-tool .tp-metric,
.page-tool .ea-roster-wrap {
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 900px) {
  .page-tool .tp-checks {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.page-tool .tp-form input,
.page-tool .tp-form select,
.page-tool .tp-form textarea,
.page-tool .ea-filter-row select,
.page-tool .ea-filter-row input {
  max-width: 100%;
  box-sizing: border-box;
}

.page-tool .ea-filter-row {
  max-width: 100%;
}

.page-tool .ea-filter-row label {
  min-width: 0;
  max-width: 100%;
}

.page-tool .ea-filter-row select,
.page-tool .ea-filter-row input {
  min-width: 0;
}

.page-tool .tp-metric strong,
.page-tool .tp-note,
.page-tool .ea-mono,
.page-tool code {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.page-tool .ea-roster-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.page-tool .ea-agent-brief dl > div,
.page-tool .ea-schema-col,
.page-tool .ea-answer-card {
  min-width: 0;
}

@media (min-width: 720px) {
  .page-tool .ea-agent-brief dl > div {
    grid-template-columns: minmax(0, 160px) minmax(0, 1fr);
  }
}

.ea-schema-grid {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

@media (min-width: 800px) {
  .ea-schema-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.ea-schema-col {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 1px 3px var(--shadow-soft);
}

.ea-schema-col h3 {
  margin: 0 0 8px;
  font-size: 1.0625rem;
  font-weight: 600;
}

.ea-schema-col p {
  margin: 0 0 16px;
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.ea-field-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.ea-field-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: #faf9f7;
  font-size: 0.875rem;
}

.ea-field-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  color: var(--color-text);
}

.ea-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.ea-pill.is-held {
  background: #f3e8e8;
  color: #991b1b;
}

.ea-pill.is-edge {
  background: #e8f0e9;
  color: #166534;
}

.ea-roster {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.ea-roster th,
.ea-roster td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.ea-roster th {
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ea-roster code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
}

.ea-roster-wrap {
  overflow-x: auto;
  margin-top: 16px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
}

.ea-flow {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  counter-reset: ea-step;
}

@media (min-width: 900px) {
  .ea-flow {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.ea-flow-step {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 1px 3px var(--shadow-soft);
  position: relative;
}

.ea-flow-step::before {
  counter-increment: ea-step;
  content: counter(ea-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--color-accent, #1f4b7a);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.ea-flow-step h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 600;
}

.ea-flow-step p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

.ea-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  word-break: break-all;
}

.ea-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 8px;
}

.ea-filter-row label {
  display: grid;
  gap: 6px;
  font-size: 0.875rem;
  font-weight: 500;
}

.ea-filter-row select,
.ea-filter-row input {
  min-width: 0;
  width: 100%;
}

.ea-hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.ea-answer-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 800px) {
  .ea-answer-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.ea-answer-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 1px 3px var(--shadow-soft);
  border-left: 3px solid var(--color-accent, #1f4b7a);
}

.ea-answer-card h3 {
  margin: 0 0 10px;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--color-text);
}

.ea-answer-card p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.975rem;
  line-height: 1.6;
}

.ea-agent-brief {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 1px 3px var(--shadow-soft);
}

.ea-agent-brief dl {
  margin: 0;
  display: grid;
  gap: 14px;
}

.ea-agent-brief dl > div {
  display: grid;
  gap: 4px;
}

@media (min-width: 720px) {
  .ea-agent-brief dl > div {
    grid-template-columns: minmax(0, 160px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
  }
}

.ea-agent-brief dt {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text);
}

.ea-agent-brief dd {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.ea-agent-links {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

.ea-agent-links a {
  font-weight: 500;
}
