:root {
  color-scheme: light;
  --ink: #18231f;
  --muted: #5a6862;
  --line: #d6ded9;
  --surface: #ffffff;
  --surface-soft: #f4f6f5;
  --brand: #1f6f63;
  --brand-dark: #164f47;
  --accent: #b6422c;
  --warning: #8a5a00;
  --success-bg: #e4f4ef;
  --error-bg: #fae9e5;
  --shadow: 0 16px 38px rgba(22, 35, 31, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 760;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
}

.topnav {
  display: flex;
  gap: 18px;
  color: var(--muted);
  font-size: 0.95rem;
}

.topnav a {
  text-decoration: none;
}

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  max-width: 1180px;
  min-height: auto;
  margin: 0 auto;
  padding: 34px 24px 52px;
  align-items: start;
}

.hero-copy {
  max-width: 780px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--brand);
  font-size: 0.88rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 4rem;
  line-height: 1;
  letter-spacing: 0;
}

.lead {
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.15rem;
}

.trust-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0;
  margin: 28px 0 0;
  list-style: none;
}

.trust-list li {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: #fff;
  color: #394841;
  font-size: 0.92rem;
}

.validator-shell {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: stretch;
}

.upload-panel,
.result-panel {
  min-height: 500px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.upload-panel {
  display: flex;
  flex-direction: column;
  padding: 18px;
}

.dropzone {
  display: grid;
  flex: 1;
  min-height: 300px;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 2px dashed #aab9b2;
  border-radius: 8px;
  padding: 26px;
  text-align: center;
  cursor: pointer;
  background: #fbfcfb;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.dropzone.is-dragging {
  border-color: var(--brand);
  background: #eef7f4;
  transform: translateY(-2px);
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dropzone-icon {
  position: relative;
  width: 58px;
  height: 72px;
  border: 2px solid var(--brand);
  border-radius: 7px;
  background: #fff;
}

.dropzone-icon::before {
  position: absolute;
  top: 11px;
  left: 12px;
  width: 30px;
  height: 8px;
  border-radius: 4px;
  background: var(--brand);
  content: "";
}

.dropzone-icon::after {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 22px;
  height: 22px;
  border-top: 2px solid var(--brand);
  border-left: 2px solid var(--brand);
  background: #e8f3f0;
  content: "";
}

.dropzone-title {
  display: block;
  max-width: 260px;
  font-size: 1.15rem;
  font-weight: 780;
}

.dropzone-help {
  display: block;
  max-width: 260px;
  color: var(--muted);
  font-size: 0.95rem;
}

.selected-file {
  min-height: 44px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: #324039;
  background: #f9faf9;
  overflow-wrap: anywhere;
}

.primary-action {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  background: var(--brand);
  font: inherit;
  font-weight: 760;
  cursor: pointer;
}

.primary-action:disabled {
  cursor: not-allowed;
  background: #9cadad;
}

.primary-action:not(:disabled):hover {
  background: var(--brand-dark);
}

.privacy-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.result-panel {
  display: grid;
  padding: 18px;
  overflow: hidden;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  color: var(--muted);
  text-align: center;
}

.empty-state img {
  width: min(100%, 280px);
  height: auto;
}

.result-state {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.status-card {
  border-radius: 8px;
  padding: 16px;
  background: var(--success-bg);
}

.status-card.is-invalid {
  background: var(--error-bg);
}

.status-label {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
}

.result-meta {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.meta-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  min-width: 0;
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.meta-item strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.message-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.message-list li {
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.message-list.warnings li {
  border-left-color: var(--warning);
}

.message-code {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 780;
}

.learning-box {
  border: 1px solid #c7d4ce;
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfb;
}

.learning-box h3,
.result-state h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.learning-box p {
  margin: 0;
  color: var(--muted);
}

.invoice-view {
  display: grid;
  gap: 12px;
}

.invoice-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.invoice-summary div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.invoice-summary dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.invoice-summary dd {
  margin: 3px 0 0;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.invoice-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.invoice-detail summary {
  min-height: 44px;
  padding: 11px 12px;
  cursor: pointer;
  font-weight: 760;
}

.invoice-frame {
  display: block;
  width: 100%;
  height: min(72vh, 760px);
  border: 0;
  border-top: 1px solid var(--line);
  background: #fff;
}

.xml-view {
  max-height: min(64vh, 680px);
  margin: 0;
  border-top: 1px solid var(--line);
  padding: 12px;
  overflow: auto;
  background: #0f1815;
  color: #ecf4ef;
  font: 0.82rem/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  white-space: pre;
}

.content-band {
  background: #fff;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 24px;
}

.content-grid article {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
  border-top: 1px solid var(--line);
  padding: 24px 0;
}

.content-grid article:first-child {
  border-top: 0;
}

.content-grid h2,
.faq-section h2 {
  margin: 0;
  font-size: 1.22rem;
}

.content-grid p,
.faq-section p {
  margin: 0;
  color: var(--muted);
}

.faq-section {
  max-width: 860px;
  margin: 0 auto;
  padding: 56px 24px 72px;
}

.faq-section details {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.faq-section details:last-child {
  border-bottom: 1px solid var(--line);
}

.faq-section summary {
  cursor: pointer;
  font-weight: 760;
}

.is-busy {
  position: relative;
}

.is-busy::after {
  display: inline-block;
  width: 1em;
  content: "...";
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .hero-copy {
    max-width: 760px;
  }

  h1 {
    font-size: 3rem;
  }

  .validator-shell {
    grid-template-columns: 1fr;
  }

  .upload-panel,
  .result-panel {
    min-height: auto;
  }

  .result-panel {
    min-height: 360px;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .hero {
    padding: 18px 16px 38px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .lead {
    font-size: 1rem;
  }

  .validator-shell {
    gap: 14px;
  }

  .result-meta {
    grid-template-columns: 1fr;
  }

  .invoice-summary {
    grid-template-columns: 1fr;
  }

  .content-grid,
  .faq-section {
    padding-left: 16px;
    padding-right: 16px;
  }
}
