:root {
  --ink: #182129;
  --muted: #65717a;
  --line: #d5dde3;
  --surface: #ffffff;
  --soft: #f3f6f8;
  --blue: #0d477f;
  --blue-2: #1f6098;
  --steel: #566168;
  --steel-dark: #2d373c;
  --silver: #dbe2e6;
  --accent: #0d477f;
  --accent-dark: #083158;
  --warning: #9c5c12;
  --danger: #b33a3a;
  --shadow: 0 14px 34px rgba(13, 71, 127, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #f8fafb 0%, #e7edf1 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  padding: 24px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, #ffffff 0%, #eef3f6 48%, #dce5ea 100%);
  border: 1px solid #cbd6dd;
  color: #fff;
}

.hero h1,
.hero p,
.panel h2,
.panel p,
.eyebrow {
  margin: 0;
}

.hero h1 {
  margin-top: 5px;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.05;
  letter-spacing: 0;
  color: var(--blue);
}

.hero p:not(.eyebrow) {
  max-width: 760px;
  margin-top: 10px;
  color: #4e5c64;
}

.eyebrow {
  color: var(--steel-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
}

.hero-brand img {
  width: clamp(150px, 18vw, 250px);
  height: auto;
  flex: 0 0 auto;
  filter: drop-shadow(0 10px 18px rgba(24, 33, 41, 0.14));
}

.hero-actions,
.rule-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.workflow {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(360px, 1fr) minmax(420px, 1.3fr);
  gap: 16px;
  align-items: start;
}

.panel,
.results {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.step {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(180deg, #eaf1f6 0%, #d6e2ea 100%);
  color: var(--blue);
  font-weight: 850;
}

.panel h2 {
  font-size: 1.05rem;
  line-height: 1.25;
}

.panel p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.upload-grid,
.mapping-layout,
.settings-grid {
  display: grid;
  gap: 12px;
}

.drop-zone {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 16px;
  border: 1px dashed #9fb0b9;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfcfd 0%, var(--soft) 100%);
}

.drop-zone span,
label,
legend {
  color: #43515a;
  font-size: 0.84rem;
  font-weight: 750;
}

.drop-zone strong {
  overflow-wrap: anywhere;
  color: var(--ink);
}

.drop-zone input {
  align-self: end;
}

fieldset {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

legend {
  padding: 0 4px;
}

label {
  display: grid;
  gap: 6px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid #c8d2d8;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

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

.rule-row {
  margin: 14px 0;
}

.fixed-details {
  display: grid;
  gap: 6px;
  margin: 14px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.fixed-details div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
}

.fixed-details dt,
.fixed-details dd {
  margin: 0;
  font-size: 0.82rem;
}

.fixed-details dt {
  color: #43515a;
  font-weight: 800;
}

.fixed-details dd {
  color: var(--ink);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
}

.checkbox-label input {
  width: 16px;
  min-height: 16px;
}

.primary-button,
.secondary-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 7px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--accent-dark);
  background: linear-gradient(180deg, var(--blue-2) 0%, var(--blue) 100%);
  color: #fff;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary-button {
  border: 1px solid #b9c6ce;
  background: #fff;
  color: var(--blue);
}

.progress-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.progress-copy {
  display: grid;
  gap: 3px;
}

.progress-copy strong {
  font-size: 0.92rem;
}

.progress-copy span {
  color: var(--muted);
  font-size: 0.84rem;
}

progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: #dce4e8;
}

progress::-webkit-progress-bar {
  border-radius: 999px;
  background: #dce4e8;
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue) 0%, var(--blue-2) 100%);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--blue);
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: #fff;
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.download-link[hidden] {
  display: none;
}

.results {
  margin-top: 16px;
  overflow: hidden;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.summary-strip div {
  padding: 16px;
  border-right: 1px solid var(--line);
  background: #fbfcfd;
}

.summary-strip div:last-child {
  border-right: 0;
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.summary-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 1.4rem;
}

.table-shell {
  overflow: auto;
  max-height: 56vh;
}

table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e8eef2;
  color: #34424a;
  font-size: 0.76rem;
  text-transform: uppercase;
}

td {
  font-size: 0.9rem;
}

.empty-cell {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.status-ok {
  color: var(--blue);
  font-weight: 800;
}

.status-flag {
  color: var(--warning);
  font-weight: 800;
}

.status-stop {
  color: var(--danger);
  font-weight: 800;
}

.muted-cell {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

@media (max-width: 1160px) {
  .workflow {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .hero,
  .summary-strip {
    grid-template-columns: 1fr;
  }

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

  .hero-brand {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-brand img {
    width: min(220px, 70vw);
  }

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

  .summary-strip div {
    border-right: 0;
  }
}
