:root {
  --bg: #f2f2ef;
  --surface: #ffffff;
  --surface-soft: #eceff5;
  --line: #d2d4d8;
  --line-strong: #a9b0bb;
  --ink: #1d252e;
  --muted: #52606d;
  --faint: #79828c;
  --blue: #254c98;
  --blue-dark: #0a3a83;
  --blue-soft: #e9eef8;
  --amber: #8a651f;
  --red: #dc1f2e;
  --red-dark: #b81925;
  --ok-bg: #edf4ef;
  --warn-bg: #f8f0db;
  --err-bg: #f4e5e1;
  --shadow: none;
  color-scheme: light;
}

html {
  hyphens: auto;
}

body {
  hyphens: auto;
}

h1,
h2,
h3,
h4,
h5,
h6,
nav,
button,
input,
select,
textarea,
label,
abbr,
code,
pre,
[role="button"] {
  hyphens: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 78px;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, "Segoe UI", sans-serif;
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--ink);
  cursor: pointer;
  min-height: 2.35rem;
  padding: 0.45rem 0.75rem;
}

button:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(36, 85, 122, 0.25);
  outline-offset: 2px;
}

code {
  background: #f5f6f9;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--blue-dark);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.84em;
  padding: 0.08rem 0.25rem;
}

.topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 4px solid var(--blue);
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 58px;
  padding: 0.65rem 1rem 0.6rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.title-block {
  border-left: 8px solid var(--red);
  display: grid;
  gap: 0.1rem;
  min-width: 0;
  padding-left: 0.8rem;
}

.title-block strong {
  color: var(--blue-dark);
  font-size: 1rem;
  line-height: 1.2;
}

.title-block span,
.eyebrow {
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.03em;
  text-transform: none;
}

.demo-watermark {
  color: #718296;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 390px;
  min-height: calc(100vh - 64px);
}

.workflow-panel,
.review-panel {
  background: #f6f6f4;
  border-color: var(--line);
  border-style: solid;
  min-width: 0;
}

.workflow-panel {
  border-width: 0 1px 0 0;
  padding: 1rem;
}

.review-panel {
  border-width: 0 0 0 1px;
  padding: 1rem;
}

.case-head,
.source-box,
.review-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  box-shadow: var(--shadow);
}

.case-head,
.source-box {
  border-left: 5px solid var(--red);
}

.case-head {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
}

.case-head strong {
  font-size: 1rem;
  line-height: 1.25;
}

.case-head span:last-child {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.step-nav {
  display: grid;
  gap: 0.35rem;
  margin: 1rem 0;
}

.step-nav a {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--muted);
  display: grid;
  font-size: 0.88rem;
  gap: 0.6rem;
  grid-template-columns: 2rem 1fr;
  min-height: 2.45rem;
  padding: 0.3rem 0.45rem;
  text-decoration: none;
}

.step-nav a span {
  align-items: center;
  background: var(--red);
  border: 1px solid var(--red-dark);
  border-radius: 2px;
  color: #ffffff;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 800;
  height: 1.55rem;
  justify-content: center;
}

.step-nav a:hover,
.step-nav a.active {
  background: #f7f8fb;
  border-color: var(--blue);
  color: var(--ink);
}

.source-box {
  color: var(--muted);
  display: grid;
  font-size: 0.82rem;
  gap: 0.55rem;
  line-height: 1.5;
  padding: 1rem;
}

.source-box p {
  margin: 0;
}

.workspace {
  min-width: 0;
}

.workspace-head {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  min-height: 84px;
  padding: 1rem 1.25rem;
}

.workspace-head h1,
.review-head h2,
.form-band h2 {
  letter-spacing: 0;
  margin: 0;
}

.workspace-head h1 {
  font-size: 1.35rem;
  line-height: 1.2;
}

.toolbar,
.table-tools,
.actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.toolbar button:last-child,
.actions button:first-child {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
  font-weight: 700;
}

.form-band {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 1rem 1.25rem 1.2rem;
}

.band-title {
  align-items: start;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 2.35rem minmax(0, 1fr);
  margin-bottom: 1rem;
}

.band-title > span {
  align-items: center;
  background: var(--red);
  border: 1px solid var(--red-dark);
  border-radius: 2px;
  color: #ffffff;
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 800;
  height: 2.1rem;
  justify-content: center;
  width: 2.1rem;
}

.band-title h2 {
  color: var(--blue-dark);
  font-size: 0.98rem;
  line-height: 1.25;
}

.band-title p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
  margin: 0.25rem 0 0;
}

.field-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.numeric-grid {
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
}

label {
  color: var(--muted);
  display: grid;
  font-size: 0.78rem;
  gap: 0.32rem;
  min-width: 0;
}

label span {
  line-height: 1.25;
}

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--ink);
  min-height: 2.35rem;
  min-width: 0;
  padding: 0.45rem 0.55rem;
  width: 100%;
}

textarea {
  min-height: 5.2rem;
  resize: vertical;
}

.checkline {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  display: flex;
  gap: 0.55rem;
  min-height: 2.35rem;
  padding: 0.45rem 0.55rem;
}

.checkline input {
  height: 1rem;
  min-height: 1rem;
  width: 1rem;
}

.checkline span {
  color: var(--ink);
  font-size: 0.86rem;
}

.wide {
  grid-column: 1 / -1;
}

.table-tools {
  justify-content: flex-end;
  margin-bottom: 0.7rem;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow-x: auto;
}

.parameter-table {
  border-collapse: collapse;
  min-width: 980px;
  table-layout: fixed;
  width: 100%;
}

.parameter-table th,
.parameter-table td {
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  padding: 0.45rem;
  text-align: left;
  vertical-align: top;
}

.parameter-table th {
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-weight: 800;
  white-space: nowrap;
}

.parameter-table tr:last-child td {
  border-bottom: none;
}

.parameter-table th:nth-child(1),
.parameter-table td:nth-child(1) {
  width: 95px;
}

.parameter-table th:nth-child(2),
.parameter-table td:nth-child(2) {
  width: 210px;
}

.parameter-table th:nth-child(3),
.parameter-table td:nth-child(3) {
  width: 150px;
}

.parameter-table th:nth-child(10),
.parameter-table td:nth-child(10) {
  width: 48px;
}

.parameter-table input,
.parameter-table select {
  min-height: 2rem;
  padding: 0.3rem 0.4rem;
}

.icon-button {
  align-items: center;
  border-radius: 3px;
  display: inline-flex;
  height: 2rem;
  justify-content: center;
  min-height: 2rem;
  padding: 0;
  width: 2rem;
}

.review-panel {
  display: grid;
  align-content: start;
  gap: 1rem;
  min-width: 0;
}

.review-section {
  min-width: 0;
  padding: 1rem;
}

.review-head,
.preview-head {
  align-items: start;
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  min-width: 0;
}

.review-head h2 {
  font-size: 1rem;
}

.score {
  align-items: center;
  background: var(--blue-soft);
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--blue-dark);
  display: inline-flex;
  font-size: 0.9rem;
  font-weight: 800;
  min-height: 2rem;
  padding: 0.25rem 0.55rem;
}

.status-grid {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: repeat(3, 1fr);
  margin: 0.85rem 0;
}

.status-grid div {
  background: #f8f9fb;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  display: grid;
  font-size: 0.72rem;
  gap: 0.15rem;
  min-height: 3.4rem;
  padding: 0.45rem;
}

.status-grid span {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 800;
}

.validation-list {
  display: grid;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  max-height: 15rem;
  overflow: auto;
  padding: 0;
}

.validation-list li {
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.4;
  padding: 0.55rem 0.65rem;
}

.validation-list li.error {
  background: var(--err-bg);
  border-color: rgba(166, 64, 50, 0.35);
}

.validation-list li.warn {
  background: var(--warn-bg);
  border-color: rgba(154, 99, 24, 0.35);
}

.validation-list li.ok {
  background: var(--ok-bg);
  border-color: rgba(37, 76, 152, 0.22);
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
}

.preview-head {
  align-items: center;
  margin-bottom: 0.6rem;
}

.output-list {
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  display: grid;
  margin: 0 0 0.85rem;
  padding: 0;
}

.output-list div {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 5.2rem minmax(0, 1fr);
  min-height: 2.2rem;
  padding: 0.45rem 0;
}

.output-list div + div {
  border-top: 1px solid var(--line);
}

.output-list dt,
.output-list dd {
  font-size: 0.82rem;
  line-height: 1.35;
  margin: 0;
}

.output-list dt {
  color: var(--muted);
}

.output-list dd {
  color: var(--ink);
  font-weight: 600;
  min-width: 0;
}

.xml-details {
  min-width: 0;
}

.xml-details summary {
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.84rem;
  min-height: 2.2rem;
  padding: 0.45rem 0.6rem;
}

.xml-details[open] summary {
  border-bottom-color: var(--line);
  border-radius: 3px 3px 0 0;
}

.xml-details:not([open]) #xmlPreview {
  display: none;
}

#xmlPreview {
  background: #fbfbfa;
  border: 1px solid var(--line);
  border-radius: 0 0 3px 3px;
  border-top: 0;
  color: #28302d;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.74rem;
  line-height: 1.45;
  margin: 0;
  max-height: 35rem;
  max-width: 100%;
  min-width: 0;
  overflow: auto;
  padding: 0.85rem;
  white-space: pre;
}

.site-footer {
  align-items: center;
  background: #ffffff;
  border-top: 3px solid var(--blue);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 0.8rem;
  gap: 0.9rem;
  padding: 0.7rem 1rem;
  text-align: left;
}

.site-footer a {
  color: inherit;
  font-weight: 400;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 1240px) {
  .app-shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .review-panel {
    border-top: 1px solid var(--line);
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #xmlPreview {
    max-height: 18rem;
  }
}

@media (max-width: 860px) {
  .topbar {
    gap: 0.6rem;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .demo-watermark {
    font-size: 1.55rem;
  }

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

  .workflow-panel {
    border-width: 0 0 1px;
  }

  .review-panel {
    border-left: 0;
    grid-column: auto;
    grid-template-columns: minmax(0, 1fr);
    max-width: 100%;
    width: 100%;
  }

  .step-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-head {
    align-items: stretch;
    flex-direction: column;
  }

  .field-grid,
  .field-grid.compact,
  .numeric-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .topbar,
  .workflow-panel,
  .toolbar,
  .table-tools,
  .actions {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .review-panel {
    border: 0;
  }

  .form-band,
  .review-section {
    border: 1px solid #cccccc;
    box-shadow: none;
    margin-bottom: 0.8rem;
  }
}
