:root {
  --ink: #15202b;
  --muted: #5b6773;
  --paper: #f3efe6;
  --card: #fffcf7;
  --line: rgba(21, 32, 43, 0.12);
  --navy: #1e3a4c;
  --teal: #1f6f5b;
  --teal-soft: #d8efe7;
  --amber: #8a5a12;
  --amber-soft: #f6e6c8;
  --red: #8b2e2e;
  --red-soft: #f3d6d6;
  --radius: 12px;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
}

body {
  background-image:
    radial-gradient(circle at 8% 0%, rgba(30, 58, 76, 0.08), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(31, 111, 91, 0.08), transparent 32%);
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  gap: 0.8rem;
  align-items: center;
}

.brand-mark {
  width: 2.4rem;
  height: 2.4rem;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: var(--paper);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  border-radius: 8px;
}

.brand-name {
  margin: 0;
  font-family: var(--display);
  font-size: 1.55rem;
  line-height: 1;
}

.brand-tag,
.lede,
.story,
.empty,
.hint,
.seal,
.pdf-link {
  color: var(--muted);
}

.brand-tag {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
}

.header-meta {
  display: flex;
  gap: 0.5rem;
}

.badge,
.path-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.75rem;
  background: var(--card);
}

.lede {
  margin: 1rem 1.5rem 0;
  max-width: 52rem;
  line-height: 1.45;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1rem;
  padding: 1.25rem 1.5rem 2rem;
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.15rem;
}

.audit-panel,
.viewer-panel {
  grid-column: 1 / -1;
}

#nutrient-viewer {
  width: 100%;
  height: 560px;
  margin-top: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1a222b;
}

h2 {
  margin: 0 0 0.7rem;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.cut-card {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.75rem 0.85rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.cut-card.active {
  border-color: var(--navy);
  box-shadow: inset 3px 0 0 var(--navy);
}

.cut-card h3 {
  margin: 0 0 0.3rem;
  font-size: 0.98rem;
}

.cut-card p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.run-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

#selected-title {
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  color: var(--ink);
  margin: 0;
}

.primary-btn {
  border: 0;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
}

.primary-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.story {
  margin: 0.4rem 0 0.7rem;
  line-height: 1.4;
}

.pdf-link a {
  color: var(--navy);
}

.result.hidden,
.review.hidden,
.clock.hidden,
.hidden {
  display: none;
}

.result-top {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.path-pill.facturx {
  background: var(--teal-soft);
  color: var(--teal);
}
.path-pill.sme_pdf {
  background: var(--amber-soft);
  color: var(--amber);
}
.path-pill.foreign {
  background: var(--red-soft);
  color: var(--red);
}

.summary {
  margin: 0 0 0.6rem;
  line-height: 1.4;
}

.clock {
  background: var(--amber-soft);
  color: var(--amber);
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.85rem;
  margin-bottom: 0.7rem;
}

.steps {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.fields table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.fields td {
  padding: 0.28rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.fields td:first-child {
  color: var(--muted);
  width: 38%;
}

.fail {
  color: var(--red);
  font-weight: 600;
}

.review {
  margin-top: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.review input {
  display: block;
  margin-top: 0.25rem;
  width: 100%;
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.output {
  margin: 0;
  background: #151e27;
  color: #e8efe9;
  padding: 0.8rem;
  border-radius: 8px;
  overflow: auto;
  max-height: 280px;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.45;
}

.seal {
  font-family: var(--mono);
  font-size: 0.75rem;
  margin: 0.5rem 0 0;
}

.audit-list {
  display: grid;
  gap: 0.35rem;
}

.audit-row {
  display: grid;
  grid-template-columns: 11rem 8rem 1fr;
  gap: 0.6rem;
  font-size: 0.82rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}

.audit-row span:first-child {
  font-family: var(--mono);
  color: var(--muted);
}

@media (max-width: 900px) {
  .layout,
  .audit-row {
    grid-template-columns: 1fr;
  }
}
