:root {
  --ink: #1e293b;
  --muted: #475569;
  --bg: #f8fafc;
  --blue: #2563eb;
  --border: #cbd5e1;
  --soft: #e9eff8;
  --orange: #9a3412;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    16px/1.6 system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}
header {
  background: #17283b;
  color: white;
  padding: 18px max(24px, calc((100vw - 1120px) / 2));
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
header span,
.eyebrow {
  font:
    700 12px/1.6 ui-monospace,
    monospace;
  letter-spacing: 0.1em;
}
.brand {
  font-weight: 750;
}
main {
  max-width: 1120px;
  padding: 28px 24px 0;
  margin: auto;
}
.intro {
  max-width: 850px;
  padding: 20px 0 30px;
}
h1 {
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.08;
  letter-spacing: -0.04em;
  margin: 12px 0 20px;
}
h2 {
  font-size: 22px;
  line-height: 1.3;
  margin: 0 0 12px;
}
h3 {
  font-size: 17px;
  margin: 0;
}
.lead {
  font-size: 22px;
  line-height: 1.5;
}
.eyebrow {
  color: var(--muted);
}
p {
  margin: 10px 0 18px;
}
.panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 26px;
  margin-bottom: 22px;
  min-width: 0;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin: 18px 0;
}
.two > * {
  min-width: 0;
}
label {
  display: block;
  font-weight: 600;
  margin: 12px 0;
}
input[type="file"],
select,
textarea {
  display: block;
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border: 1px solid #94a3b8;
  border-radius: 6px;
  padding: 11px;
  font: inherit;
  color: var(--ink);
  background: white;
}
input[type="file"] {
  font-size: 14px;
}
textarea {
  resize: vertical;
}
input[type="checkbox"] {
  width: 22px;
  height: 22px;
  vertical-align: middle;
  margin: 0 10px 0 0;
}
button,
a#download {
  font-weight: 600;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 17px;
  border-radius: 6px;
  border: 1px solid #94a3b8;
  background: white;
  color: var(--ink);
  cursor: pointer;
  margin: 4px 8px 4px 0;
  text-decoration: none;
}
#apply,
#save,
#prepare,
#demo,
a#download {
  background: var(--blue);
  color: white;
  border-color: var(--blue);
}
button:hover {
  filter: brightness(0.94);
}
button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}
details {
  margin: 20px 0 0;
}
summary {
  cursor: pointer;
  min-height: 44px;
  line-height: 44px;
  font-weight: 600;
}
#preview {
  background: #fff7ed;
  border: 1px solid #c2410c;
  padding: 22px;
  border-radius: 8px;
  margin-top: 16px;
}
#replace-warning {
  font-weight: 500;
  color: var(--orange);
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 18px;
}
.metric {
  border-left: 3px solid var(--blue);
  padding: 6px 14px;
  background: var(--bg);
  min-width: 0;
}
.metric strong {
  font-size: 28px;
  display: block;
}
.metric span {
  font-size: 14px;
  color: var(--muted);
}
.badge {
  border: 1px solid #94a3b8;
  border-radius: 6px;
  font-size: 14px;
  padding: 5px 10px;
  overflow-wrap: anywhere;
}
.callout {
  padding: 14px;
  background: var(--soft);
  border-radius: 6px;
}
.source-card {
  background: var(--soft);
  padding: 16px;
  border-radius: 6px;
}
blockquote {
  font-size: 22px;
  padding: 20px;
  margin: 20px 0;
  border-left: 4px solid var(--blue);
  background: var(--bg);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#item-meta,
#state-a,
#state-b,
#current-decision,
#preview-text,
#source-message {
  overflow-wrap: anywhere;
}
.table-wrap {
  max-width: 100%;
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
}
th,
td {
  border: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  overflow-wrap: anywhere;
}
caption {
  text-align: left;
  color: var(--muted);
  padding: 10px 0;
}
footer {
  padding: 18px 0 40px;
  color: var(--muted);
}
a {
  color: #1d4ed8;
}
[hidden] {
  display: none !important;
}
.error {
  color: #b91c1c;
}
#bucket-counts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
#bucket-counts span {
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 5px;
}
button,
select,
input,
textarea {
  font-family: inherit;
}
button {
  font-size: 16px;
  line-height: 1.4;
}
@media (max-width: 700px) {
  main {
    padding: 16px;
  }
  .panel {
    padding: 20px;
  }
  .two {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .metrics {
    grid-template-columns: 1fr 1fr;
  }
  .section-head {
    align-items: flex-start;
  }
  .lead {
    font-size: 20px;
  }
  blockquote {
    font-size: 20px;
    padding: 16px;
  }
  .actions button {
    width: 100%;
  }
  header {
    padding: 16px;
  }
  .panel h2 {
    font-size: 20px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition: filter 0.15s;
  }
}
