/* Document Extraction Prompt Builder: step cards, field chips, rules, the prompt and the example answer. Builds on ../tools.css. */
.ex-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1.25rem; margin-top: 1.25rem; align-items: start; }
.ex-col { display: grid; gap: 1.25rem; min-width: 0; }
.ex-card { padding: 1.35rem; border: 1px solid var(--border-line); border-radius: 16px; background: var(--bg-paper); min-width: 0; }
.ex-col + .ex-col .ex-card { position: sticky; top: 5rem; }
.ex-h { display: flex; align-items: center; gap: 0.6rem; margin: 0 0 0.85rem; font-family: var(--font-display); font-size: 1.05rem; font-weight: 700; color: var(--ink-primary); }
.ex-n { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--ink-primary); color: var(--bg-paper); font-size: 0.8rem; font-weight: 800; }
.ex-h small { margin-left: auto; font-family: var(--font-body, inherit); font-size: 0.78rem; font-weight: 600; color: var(--ink-muted); }
.ex-hint { margin: 0; font-size: 0.86rem; line-height: 1.5; color: var(--ink-muted); }

.ex-presets, .ex-fields { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.ex-opt, .ex-field { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.8rem; border: 1px solid var(--border-line); border-radius: 999px; background: var(--bg-paper); font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--ink-secondary); cursor: pointer; }
.ex-opt:hover, .ex-field:hover { border-color: var(--ink-secondary); }
.ex-opt.is-on { border-color: var(--ink-primary); background: var(--ink-primary); color: var(--bg-paper); }
.ex-field.is-on { border-color: var(--ink-primary); color: var(--ink-primary); background: var(--bg-band); }
.ex-opt:focus-visible, .ex-field:focus-visible, .ex-copy:focus-visible { outline: 3px solid var(--cat-photo-accent); outline-offset: 2px; }
.ex-tick { flex: none; width: 0.95rem; height: 0.95rem; border: 1.5px solid var(--ink-muted); border-radius: 4px; position: relative; }
.ex-field.is-on .ex-tick { border-color: var(--ink-primary); background: var(--ink-primary); }
.ex-field.is-on .ex-tick::after { content: ""; position: absolute; left: 0.27rem; top: 0.07rem; width: 0.25rem; height: 0.5rem; border: solid var(--bg-paper); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ex-x { font-size: 1rem; line-height: 1; color: var(--ink-muted); }
.ex-add { display: flex; gap: 0.5rem; margin-top: 0.85rem; }
.ex-add input { flex: 1 1 auto; min-width: 0; padding: 0.5rem 0.75rem; border: 1px solid var(--border-line); border-radius: 10px; background: var(--bg-paper); font: inherit; font-size: 0.9rem; color: var(--ink-primary); }
.ex-add input:focus-visible { outline: 3px solid var(--cat-photo-accent); outline-offset: 1px; }
.ex-add .btn { flex: none; }

.ex-rules { display: grid; gap: 0.5rem; }
.ex-rule { display: flex; align-items: flex-start; gap: 0.55rem; font-size: 0.9rem; line-height: 1.45; color: var(--ink-primary); cursor: pointer; }
.ex-rule input { flex: none; margin-top: 0.2rem; width: 1rem; height: 1rem; accent-color: var(--ink-primary); }
.ex-radios { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; margin: 0 0 0.9rem; padding: 0; border: 0; }
.ex-radios legend { padding: 0; margin-bottom: 0.4rem; font-size: 0.82rem; font-weight: 700; color: var(--ink-muted); }
.ex-radios label { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.9rem; font-weight: 600; color: var(--ink-primary); cursor: pointer; }
.ex-radios input { accent-color: var(--ink-primary); }

.ex-prompt-top { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.7rem; }
.ex-prompt-top .ex-h { margin: 0; }
.ex-pre { margin: 0; max-height: 26rem; overflow: auto; padding: 0.9rem 1rem; border-radius: 12px; background: var(--bg-band); font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace); font-size: 0.8rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-primary); }
.ex-pre.is-empty { color: var(--ink-muted); font-family: inherit; font-size: 0.9rem; }
.ex-copy:disabled { opacity: 0.5; cursor: not-allowed; }
.ex-steps { margin: 0.9rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; font-size: 0.88rem; line-height: 1.5; color: var(--ink-secondary); }

.ex-example { grid-column: 1 / -1; }
.ex-tag { display: inline-block; margin-left: 0.5rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: #FDEBB3; color: #6B4A00; font-family: var(--font-body, inherit); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.02em; vertical-align: middle; }
[data-theme="dark"] .ex-tag { background: #5A4310; color: #FFE39A; }
.ex-table-wrap { overflow-x: auto; border: 1px solid var(--border-line); border-radius: 12px; }
.ex-table { width: 100%; min-width: 44rem; border-collapse: collapse; font-size: 0.84rem; line-height: 1.45; }
.ex-table th, .ex-table td { padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--border-line); text-align: left; vertical-align: top; color: var(--ink-primary); }
.ex-table th { background: var(--bg-band); font-size: 0.76rem; letter-spacing: 0.03em; text-transform: uppercase; color: var(--ink-muted); }
.ex-table tr:last-child td { border-bottom: 0; }
.ex-table .ex-f { font-weight: 700; white-space: nowrap; }
.ex-pill { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.72rem; font-weight: 800; white-space: nowrap; }
.ex-pill-found { background: #CDEFDD; color: #0B5B3A; }
.ex-pill-notfound { background: var(--bg-band); color: var(--ink-secondary); }
.ex-pill-conflict { background: #FBD5D5; color: #8A1F1F; }
.ex-pill-review { background: #FDEBB3; color: #6B4A00; }
[data-theme="dark"] .ex-pill-found { background: #134B34; color: #BDF1D6; }
[data-theme="dark"] .ex-pill-conflict { background: #5C2323; color: #FFC9C9; }
[data-theme="dark"] .ex-pill-review { background: #5A4310; color: #FFE39A; }
.ex-example-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; margin-top: 0.8rem; }
.ex-example-foot p { margin: 0; font-size: 0.82rem; color: var(--ink-muted); }

@media (max-width: 900px) {
  .ex-grid { grid-template-columns: minmax(0, 1fr); }
  .ex-col + .ex-col .ex-card { position: static; }
}
@media (max-width: 700px) {
  /* 44px touch targets on a phone */
  .ex-opt, .ex-field, .ex-add input, .ex-add .btn, .ex-card .btn { min-height: 44px; }
  .ex-rule, .ex-radios label { min-height: 44px; align-items: center; }
  .ex-rule input, .ex-radios input { width: 1.15rem; height: 1.15rem; margin-top: 0; }
}
@media (max-width: 480px) {
  .ex-card { padding: 1.1rem; }
  .ex-add { flex-direction: column; }
}
