:root {
  --bg: #f6f6f6;
  --surface: #ffffff;
  --line: #d6dce2;
  --line-strong: #aab7c3;
  --text: #1d252d;
  --muted: #657381;
  --blue: #0070c9;
  --blue-dark: #005da8;
  --green: #16804a;
  --amber: #b95e00;
  --red: #b42318;
  --shadow: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

.topbar {
  height: 44px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar > .icon-button {
  justify-self: start;
  width: auto;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.topbar strong {
  color: var(--blue-dark);
  font-size: 16px;
}

.topbar-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
}

.avatar {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #f07b3f;
  color: #fff;
  font-weight: 700;
}

.app-shell {
  max-width: 1280px;
  width: calc(100% - 112px);
  margin: 0 0 0 56px;
  padding: 24px 0 56px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

body[data-view="schema"] .page-heading h1::after {
  content: "";
  display: block;
  width: 112px;
  height: 4px;
  margin-top: 12px;
  background: var(--blue);
}

.heading-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  font-weight: 700;
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 18px;
}

h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

p {
  color: var(--muted);
  line-height: 1.45;
}

.helper-text {
  margin-top: 12px;
  font-size: 12px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.filter,
.tab {
  border: 1px solid transparent;
  border-radius: 2px;
  min-height: 40px;
  padding: 0 18px;
  cursor: pointer;
  font-size: 14px;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.primary-button:hover {
  background: var(--blue-dark);
}

.primary-button:disabled {
  border-color: var(--line);
  background: #eef2f5;
  color: #98a4b0;
  cursor: not-allowed;
}

.primary-button:disabled:hover {
  background: #eef2f5;
}

.primary-button.visual-disabled {
  background: #9fb8cc;
}

.primary-button.visual-disabled:hover {
  background: #9fb8cc;
}

.secondary-button {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--text);
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.secondary-button:disabled,
.filter:disabled,
.icon-button:disabled {
  border-color: var(--line);
  background: #eef2f5;
  color: #98a4b0;
  cursor: not-allowed;
}

.ghost-button,
.icon-button {
  background: transparent;
  color: var(--muted);
}

.tabs {
  display: none;
  gap: 4px;
  margin-bottom: 10px;
}

.tab {
  min-height: 28px;
  background: #eef2f6;
  color: var(--muted);
}

.tab.active,
.filter.active {
  background: var(--blue);
  color: #fff;
}

.filter.active:disabled {
  border-color: var(--line);
  background: #eef2f5;
  color: #98a4b0;
  cursor: not-allowed;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.upload-panel,
.upload-complete-card,
.file-table-card,
.ingest-card,
.mapping-card,
.context-card,
.file-context-card,
.negative-card,
.schema-header {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.upload-panel {
  padding: 42px 38px 44px;
  margin-bottom: 52px;
  min-height: 540px;
}

.upload-panel.upload-panel-feedback {
  animation: upload-panel-feedback 1.25s ease-out;
}

@keyframes upload-panel-feedback {
  0% {
    border-color: var(--blue);
    box-shadow: 0 0 0 0 rgba(0, 112, 201, 0.35);
  }

  45% {
    border-color: var(--blue);
    box-shadow: 0 0 0 8px rgba(0, 112, 201, 0.16);
  }

  100% {
    border-color: var(--line);
    box-shadow: var(--shadow);
  }
}

.upload-complete-card {
  padding: 14px 28px 16px;
  margin-bottom: 24px;
  min-height: 0;
  box-shadow: 0 4px 10px rgba(31, 42, 55, 0.18);
}

.parsed-upload-card {
  width: min(280px, 100%);
  margin: 0 0 34px;
}

.parsed-file-toggle {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 3px 7px rgba(31, 42, 55, 0.24);
  color: var(--text);
  text-align: left;
}

.parsed-file-toggle .open-icon {
  display: grid;
  place-items: center;
  border: 1px solid var(--text);
  border-radius: 2px;
  font-weight: 700;
}

.parsed-progress {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #cfd6df;
}

.parsed-progress span {
  display: block;
  width: 48%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.parsed-file-panel {
  width: min(960px, calc(100vw - 112px));
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.complete-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.complete-meta {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin-top: 14px;
  border: 0;
}

.complete-meta span {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 14px;
  padding: 0 22px 0 0;
  border-right: 2px solid var(--blue);
}

.complete-meta span:last-child {
  border-right: 0;
}

.complete-meta strong {
  color: var(--text);
  font-size: 16px;
}

.complete-file {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 16px;
  font-size: 16px;
}

.complete-file > div:last-child {
  display: grid;
  gap: 8px;
}

.complete-file span {
  color: var(--text);
  font-weight: 700;
}

.line-file-icon {
  width: 36px;
  height: 44px;
  border: 2px solid #777;
  border-radius: 4px;
  position: relative;
}

.line-file-icon::after {
  content: "";
  position: absolute;
  right: -2px;
  top: -2px;
  width: 14px;
  height: 14px;
  border-left: 2px solid #777;
  border-bottom: 2px solid #777;
  background: white;
}

.check-dot {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border-radius: 50%;
  background: #4b9a3d;
  color: #fff;
}

.countdown-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  font-size: 18px;
}

.clock-dot {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  color: var(--blue);
}

.minimise-button {
  font-size: 16px;
  color: #111;
}

.minimise-button:disabled {
  color: #98a4b0;
  cursor: not-allowed;
}

.compact-actions {
  margin-top: 12px;
}

.upload-complete-card .panel-actions {
  justify-content: flex-start;
  margin-left: 64px;
}

.upload-complete-card .primary-button,
.upload-complete-card .secondary-button {
  min-width: 160px;
  border: 2px solid var(--blue);
  background: #fff;
  color: var(--text);
}

.panel-header,
.ingest-summary,
.schema-header,
.section-title,
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
}

.utility-reset {
  display: none;
}

.pill,
.warning-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef4fb;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 700;
}

.warning-pill {
  background: #fff4e5;
  color: var(--amber);
}

.mode-row {
  display: flex;
  gap: 42px;
  margin: 0 0 16px;
}

.configuration-panel {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin: 18px 0 34px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfcfd;
}

.configuration-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.configuration-summary div {
  display: grid;
  gap: 4px;
}

.configuration-summary dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.configuration-summary dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 38px 36px;
  margin-top: 34px;
}

#fileTypeSelect {
  width: 100%;
}

label {
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

select,
.multi-select-button,
.multi-select-search,
input[type="month"] {
  appearance: none;
  width: 100%;
  height: 44px;
  margin-top: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  padding: 0 34px 0 12px;
  background: #fff;
  color: var(--text);
  font-size: 16px;
}

select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 20px, calc(100% - 12px) 20px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.multi-select {
  position: relative;
}

.multi-select-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
}

.multi-select-button::after {
  content: "⌄";
  color: var(--muted);
}

.multi-select-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 6px 16px rgba(31, 42, 55, 0.18);
}

.multi-select-search {
  height: 38px;
  margin: 0 0 8px;
  padding: 0 10px;
  background: #f8fbfd;
}

.multi-select-menu label {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 400;
}

.type-panel {
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.type-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--blue);
  border-radius: 2px;
  background: #fff;
}

.type-options label {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 400;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

legend {
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 700;
}

.radio-group {
  display: flex;
  gap: 30px;
  align-items: center;
}

.radio-group legend {
  width: 100%;
}

.radio-group label,
.mode-row label {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 400;
}

input[type="radio"] {
  width: 18px;
  height: 18px;
}

.date-range-fields {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 240px) minmax(0, 240px) minmax(260px, 1fr);
  gap: 18px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fbfcfd;
}

.date-range-fields .disabled-reason {
  margin-bottom: 12px;
}

.file-field-title {
  margin-top: 34px;
}

.drop-zone {
  margin-top: 12px;
  min-height: 230px;
  border: 1px dashed var(--line-strong);
  border-radius: 2px;
  background: #fbfcfd;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: #c2c6cc;
  font-size: 18px;
  text-align: center;
}

.drop-zone.ready {
  border-color: var(--blue);
  background: #f1f8ff;
}

.upload-cloud,
.file-badge {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #e6f2ff;
  color: var(--blue-dark);
  font-weight: 800;
}

.panel-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 32px;
}

.upload-action-group {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.file-table-card {
  padding: 0;
  border: 0;
  background: transparent;
}

.table-title {
  margin-bottom: 12px;
}

.table-note {
  max-width: 760px;
  margin-bottom: 16px;
  font-size: 13px;
}

.filter-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter {
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--blue);
  background: white;
  color: var(--text);
}

.table-wrap {
  overflow-x: visible;
  margin-top: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 10px;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

th {
  color: var(--text);
  background: #fff;
  border-bottom: 2px solid var(--blue);
  font-size: 14px;
}

td {
  font-size: 14px;
  font-weight: 700;
}

th:nth-child(1),
td:nth-child(1) {
  width: 21%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 18%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 18%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 11%;
}

th:nth-child(5),
td:nth-child(5) {
  width: 16%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 8%;
}

th:nth-child(7),
td:nth-child(7) {
  width: 124px;
  overflow-wrap: normal;
}

.action-head {
  background: #e8eef9;
  border-left: 2px solid var(--blue);
  width: 124px;
}

td:last-child {
  border-left: 2px solid var(--blue);
  background: #fff;
}

.details-button {
  min-height: 32px;
  min-width: 86px;
  padding: 0 12px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  background: white;
  color: var(--blue);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.details-button:hover {
  background: #eef5ff;
}

.empty-table-cell {
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  white-space: normal;
}

.file-detail-panel {
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 20px;
}

.fake-scroll {
  height: 12px;
  margin: 34px 16px 0;
  border-radius: 999px;
  background: #dfe3e6;
}

.fake-scroll span {
  display: block;
  width: 34%;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.pagination {
  display: flex;
  justify-content: center;
  margin-top: 82px;
}

.pagination button {
  min-width: 44px;
  min-height: 36px;
  border: 1px solid var(--blue);
  background: white;
  color: var(--blue);
  font-size: 16px;
}

.pagination .active-page {
  background: var(--blue);
  color: white;
}

.ingest-card {
  padding: 34px 42px 72px;
  min-height: 690px;
  margin-top: 18px;
  box-shadow: 0 4px 10px rgba(31, 42, 55, 0.18);
}

.ingest-title {
  display: flex;
  align-items: center;
  gap: 18px;
}

.spinner-dot {
  color: var(--blue);
}

.ingest-meta-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin: 48px 0 64px;
}

.ingest-meta-row span {
  display: grid;
  gap: 6px;
  padding-right: 28px;
  border-right: 3px solid var(--blue);
  font-size: 17px;
}

.ingest-meta-row strong {
  font-size: 18px;
}

.ingest-summary {
  display: none;
}

.ingest-summary .ghost-button {
  margin-left: auto;
  color: var(--red);
}

.progress-meter {
  height: 12px;
  background: #e7edf3;
  border-radius: 999px;
  margin: 24px 0 18px;
  overflow: hidden;
}

.progress-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
  transition: width 280ms ease;
}

.step-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.step-list li {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 0;
  font-size: 18px;
  font-weight: 700;
}

.step-dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #e7edf3;
  color: var(--muted);
  font-size: 14px;
}

.ingest-body {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 260px;
  gap: 64px;
  align-items: start;
}

.ingest-file-card {
  width: 200px;
  min-height: 200px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 22px;
  border: 3px solid #d5d5d5;
  border-radius: 12px;
  text-align: center;
  font-size: 18px;
}

.ingest-steps h3 {
  margin-bottom: 22px;
}

.files-switch {
  margin-top: 150px;
}

.cancel-inline {
  align-self: start;
  justify-self: start;
  margin-top: 28px;
  color: var(--red);
  font-size: 20px;
}

.files-switch > div {
  display: flex;
  gap: 20px;
  margin-top: 30px;
}

.done .step-dot {
  background: #dcf5e7;
  color: var(--green);
}

.active-step .step-dot {
  background: #e6f2ff;
  color: var(--blue);
}

.schema-header {
  display: none;
}

.branch-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.branch-label {
  align-self: center;
  margin-right: 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.branch-tab {
  min-height: 44px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 16px;
  cursor: pointer;
  font-size: 16px;
}

.branch-tab.active {
  border-color: var(--blue);
  background: transparent;
  color: var(--blue);
}

.schema-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.context-card,
.mapping-card {
  padding: 14px;
  min-width: 0;
}

.context-card {
  border: 0;
  background: transparent;
  padding: 0;
}

.context-card dl {
  display: flex;
  gap: 84px;
  margin: 0;
}

.context-card div {
  border-bottom: 2px solid var(--blue);
  padding: 0 0 8px;
}

.mapping-card {
  overflow-x: auto;
  border: 0;
  background: transparent;
  padding: 0;
}

.mapping-table {
  min-width: 0;
  width: 100%;
  margin-top: 42px;
  background: white;
}

dl {
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 4px;
}

dd {
  margin: 0;
  font-weight: 700;
  font-size: 15px;
}

.file-context-card {
  margin-bottom: 38px;
  padding: 0;
  border: 0;
  background: transparent;
}

.file-context-card dl {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-top: 26px;
}

.file-context-card div {
  min-height: 44px;
  padding: 0 28px 0 0;
  border-right: 3px solid var(--blue);
}

.file-context-card div:last-child {
  border-right: 0;
}

.schema-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 38px 0;
  color: var(--green);
  font-size: 20px;
  font-weight: 700;
}

.ok-dot {
  width: 24px;
  height: 24px;
  background: var(--green);
}

.context-card dd {
  color: var(--blue);
  font-size: 28px;
}

.context-card dt {
  color: var(--text);
  font-size: 16px;
}

.mapping-card > .section-title {
  margin-bottom: 8px;
}

.mapping-card > .helper-text {
  margin-bottom: 14px;
}

.mapping-table th {
  padding: 20px 34px;
}

.mapping-table td {
  padding: 22px 34px;
}

.mapping-table th,
.mapping-table td {
  width: 50%;
}

.mapping-table select {
  height: 46px;
  width: 340px;
  margin: 0;
  font-size: 16px;
}

.saved-mapping-rules {
  margin-top: 18px;
}

.latest-mapping-rules,
.reused-mapping-rules {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.latest-mapping-rules .section-title,
.reused-mapping-rules .section-title {
  margin-bottom: 6px;
}

.mapping-rule-table {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
}

.mapping-rule-table th,
.mapping-rule-table td {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.mapping-rule-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.mapping-rule-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.mapping-rule-actions .secondary-button,
.mapping-rule-actions .ghost-button {
  min-height: 32px;
  padding: 0 12px;
}

.mapping-edit-select {
  width: min(320px, 100%);
  height: 36px;
  margin-top: 0;
  font-size: 14px;
}

.detail-mapping-rules .mapping-rule-table th:last-child,
.detail-mapping-rules .mapping-rule-table td:last-child {
  width: 190px;
}

#mappingStatus {
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

#exceptionPanel .panel-actions {
  justify-content: flex-start;
  margin-top: 26px;
}

.save-action-group {
  display: grid;
  gap: 12px;
  align-items: start;
}

#saveMapping {
  min-width: 210px;
  background: #fff;
  border: 1px solid var(--line);
  color: #d8dde2;
}

#saveMapping:not(:disabled) {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.disabled-reason {
  max-width: 520px;
  color: var(--muted);
  font-size: 14px;
}

.full-width {
  width: 100%;
}

.registration-actions {
  margin-top: 16px;
}

.comparison-card {
  display: none;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.comparison-grid strong {
  display: block;
  margin-bottom: 8px;
}

.comparison-grid ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.6;
}

.summary-text {
  margin-top: 14px;
  color: var(--text);
}

.result-card {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 14px;
  background: #f8fbfd;
}

.evidence-card {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}

.evidence-card.result-feedback {
  animation: result-feedback 1.4s ease-out;
}

@keyframes result-feedback {
  0% {
    border-color: var(--blue);
    box-shadow: 0 0 0 0 rgba(0, 112, 201, 0.28);
  }

  45% {
    border-color: var(--blue);
    box-shadow: 0 0 0 8px rgba(0, 112, 201, 0.14);
  }

  100% {
    border-color: var(--line);
    box-shadow: none;
  }
}

.db-state-panel {
  margin-top: 28px;
}

.metadata-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 14px 0 0;
}

.parsed-file-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: 16px;
  margin-top: 16px;
}

.parsed-file-grid > div {
  min-width: 0;
}

.parsed-table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
}

.parsed-file-table th,
.parsed-file-table td,
.parsed-file-table th:nth-child(n),
.parsed-file-table td:nth-child(n) {
  width: auto;
  border-left: 0;
  padding: 8px;
  font-size: 12px;
}

.parsed-file-table th {
  background: #f7fafd;
}

.parsed-sample-table {
  min-width: 620px;
}

.negative-card {
  display: none;
  margin-top: 16px;
  padding: 18px;
}

.scenario-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.negative-result {
  margin-top: 14px;
  border-left: 4px solid var(--amber);
  background: #fff8ed;
  padding: 12px 14px;
  border-radius: 2px;
}

.negative-result p {
  margin-top: 6px;
}

.retry-button {
  margin-top: 12px;
}

.mapping-table select {
  margin: 0;
  min-width: 210px;
}

.status-chip {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 700;
}

.status-chip.ok {
  background: #dcf5e7;
  color: var(--green);
}

.status-chip.warn {
  background: #fff4e5;
  color: var(--amber);
}

.schema-dialog {
  width: min(960px, calc(100vw - 32px));
  border: 0;
  border-radius: 2px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(31, 42, 55, 0.28);
}

.schema-dialog::backdrop {
  background: rgba(12, 24, 36, 0.36);
}

.schema-dialog form {
  padding: 22px;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dialog-header .icon-button {
  font-size: 24px;
}

.preview-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 16px;
}

.preview-card {
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.preview-card h3 {
  padding: 12px;
  background: #f7f9fb;
  border-bottom: 1px solid var(--line);
}

.confirm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  color: var(--text);
  font-size: 13px;
}

.toast {
  display: none;
  position: fixed;
  right: 24px;
  bottom: 24px;
  min-width: 240px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 2px;
  background: #17212b;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 840px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
    padding: 0 14px;
  }

  .app-shell {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 18px;
  }

  .page-heading,
  .panel-header,
  .schema-header,
  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-actions {
    justify-content: stretch;
  }

  .heading-actions button,
  .panel-actions button {
    flex: 1;
    justify-content: center;
  }

  .form-grid,
  .configuration-panel,
  .configuration-summary,
  .complete-meta,
  .comparison-grid,
    .metadata-grid,
    .parsed-file-grid,
    .date-range-fields,
  .schema-layout,
  .preview-grid,
  .file-context-card dl,
  .ingest-meta-row,
  .ingest-body {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 30px;
  }

  h2 {
    font-size: 24px;
  }

body,
label,
select,
.multi-select-button,
.multi-select-search,
.radio-group label,
.mode-row label,
.type-options label {
    font-size: 16px;
  }

  .upload-panel,
  .upload-complete-card,
  .ingest-card {
    padding: 24px 18px;
  }

  .upload-complete-card .panel-actions {
    flex-direction: column;
    align-items: stretch;
    margin-left: 0;
  }

  .upload-complete-card .primary-button,
  .upload-complete-card .secondary-button {
    min-width: 0;
    width: 100%;
  }

  .parsed-file-panel {
    width: 100%;
  }

  .parsed-upload-card {
    width: 100%;
  }

  .multi-select-menu {
    position: static;
    margin-top: 4px;
  }

  .mode-row,
  .radio-group,
  .files-switch > div,
  .complete-summary,
  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .file-table-card .table-wrap {
    overflow-x: hidden;
  }

  .file-table-card table,
  .file-table-card tbody,
  .file-table-card tr {
    width: 100%;
    max-width: 100%;
  }

  .file-table-card table {
    table-layout: fixed;
  }

  .file-table-card thead {
    display: none;
  }

  .file-table-card tr {
    display: grid;
    gap: 0;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }

  .file-table-card th,
  .file-table-card td {
    display: grid;
    grid-template-columns: minmax(96px, 38%) minmax(0, 1fr);
    align-items: center;
    white-space: normal;
    overflow-wrap: anywhere;
    padding: 14px 8px;
    font-size: 12px;
    border-bottom: 0;
    width: auto !important;
  }

  .file-table-card td::before {
    color: var(--muted);
    font-weight: 700;
  }

  .file-table-card td:nth-child(1)::before {
    content: "Filename";
  }

  .file-table-card td:nth-child(2)::before {
    content: "Cedent";
  }

  .file-table-card td:nth-child(3)::before {
    content: "Config";
  }

  .file-table-card td:nth-child(4)::before {
    content: "Type";
  }

  .file-table-card td:nth-child(5)::before {
    content: "Treaty";
  }

  .file-table-card td:nth-child(6)::before {
    content: "Format";
  }

  .file-table-card td:nth-child(7)::before {
    content: "Action";
  }

  .file-table-card td:last-child {
    border-left: 0;
    background: transparent;
  }

  .details-button {
    justify-self: start;
    min-width: 104px;
    white-space: nowrap;
  }

  .mapping-table {
    min-width: 0;
  }

  .mapping-table select {
    width: 100%;
    min-width: 0;
  }

  .ingest-file-card {
    width: 100%;
    min-height: 180px;
  }

  .complete-file,
  .countdown-row {
    font-size: 18px;
  }

  .file-context-card div,
  .complete-meta span {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .branch-tabs {
    flex-direction: column;
  }
}

.panel-header-actions,
.sample-file-actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.validation-panel {
  margin-bottom: 18px;
}

.upload-progress {
  margin: 12px 0;
}

.step-success .step-dot { background: var(--green); color: #fff; }
.step-running .step-dot { background: var(--blue); color: #fff; }
.step-failed .step-dot,
.step-needs-edit .step-dot { background: var(--amber); color: #fff; }
.step-skipped .step-dot { background: var(--muted); color: #fff; }

.rules-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 16px;
}

.rule-card {
  display: grid;
  gap: 4px;
  width: 100%;
  margin-bottom: 8px;
  padding: 10px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
}

.rule-card.active {
  border-color: var(--blue);
}

