:root {
  color-scheme: light;
  --primary: #1c81be;
  --primary-dark: #126ca3;
  --ink: #17364e;
  --text: #46677d;
  --muted: #718493;
  --line: #dbe6ed;
  --surface: #ffffff;
  --canvas: #f4f8fb;
  --soft-blue: #e8f4fa;
  --green: #168a5b;
  --green-soft: #e8f7f0;
  --red: #c23a48;
  --red-soft: #fff0f1;
  --amber: #a96808;
  --amber-soft: #fff7e8;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0;
}

button, input { font: inherit; letter-spacing: 0; }

.container {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-logo { width: 38px; height: 38px; object-fit: contain; }

.header-context {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #50697a;
  font-size: 13px;
  font-weight: 650;
}

.environment-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1cac72;
  box-shadow: 0 0 0 4px #dff6ec;
}

.main-content { padding-block: 46px 72px; }

.page-heading,
.section-heading,
.subsection-heading,
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.page-heading { align-items: flex-end; margin-bottom: 34px; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; max-width: 760px; color: var(--ink); font-size: 34px; line-height: 1.18; }
h2 { margin: 0; color: var(--ink); font-size: 20px; line-height: 1.3; }
h3 { margin-bottom: 0; color: var(--ink); font-size: 16px; }

.status-badge {
  flex: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-working { color: var(--primary-dark); border-color: #b9ddec; background: #edf8fc; }
.status-success { color: var(--green); border-color: #b9e5cf; background: var(--green-soft); }
.status-warning { color: var(--amber); border-color: #efd59f; background: var(--amber-soft); }
.status-error { color: var(--red); border-color: #f0c5cb; background: var(--red-soft); }

.upload-section,
.process-section,
.log-section {
  border-top: 1px solid var(--line);
  padding-top: 26px;
  margin-top: 34px;
}

.section-heading > div:first-child { display: flex; align-items: center; gap: 12px; min-width: 0; }
.step-number { color: var(--primary); font-size: 11px; font-weight: 800; }
.file-name { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.drop-zone {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 190px;
  margin-top: 18px;
  border: 1px dashed #9cc8dd;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 160ms, background-color 160ms;
}

.drop-zone:hover,
.drop-zone.is-dragging { border-color: var(--primary); background: #f8fcfe; }
.drop-zone strong { color: var(--ink); font-size: 16px; }
.drop-zone span:last-child { font-size: 13px; }

.upload-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--soft-blue);
  color: var(--primary-dark);
  font-size: 24px;
  line-height: 1;
}

.progress-area { margin-top: 20px; }
.progress-copy { display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 12px; }
.progress-copy strong { color: var(--ink); font-size: 13px; }
.progress-track { height: 10px; margin-top: 8px; border-radius: 5px; background: #dce6eb; overflow: hidden; }
.progress-bar { display: block; width: 0; height: 100%; background: var(--primary); transition: width 350ms ease, background-color 160ms; }
.progress-bar.is-working { animation: progress-pulse 1.25s ease-in-out infinite; }
.progress-bar.is-success { background: var(--green); }
.progress-bar.is-warning { background: var(--amber); }
.progress-bar.is-error { background: var(--red); }

@keyframes progress-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.58; }
}

@media (prefers-reduced-motion: reduce) {
  .progress-bar { transition: none; }
  .progress-bar.is-working { animation: none; }
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 1px;
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  overflow: hidden;
}

.metric { min-width: 0; min-height: 104px; padding: 18px; background: var(--surface); }
.metric span { display: block; min-height: 36px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.metric strong { display: block; margin-top: 8px; color: var(--ink); font-size: 27px; line-height: 1; }
.metric-success strong { color: var(--green); }
.metric-danger strong { color: var(--red); }
.metric-warning strong { color: var(--amber); }

.timeline {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.timeline li { position: relative; min-width: 0; padding-right: 16px; }
.timeline li::before { content: ""; position: absolute; top: 8px; left: 16px; right: 0; height: 2px; background: #d8e3e9; }
.timeline li:last-child::before { display: none; }
.timeline li > span { position: relative; z-index: 1; display: block; width: 18px; height: 18px; border: 4px solid var(--canvas); border-radius: 50%; background: #c4d1d9; }
.timeline li div { margin-top: 10px; padding-right: 8px; }
.timeline strong, .timeline small { display: block; overflow-wrap: anywhere; }
.timeline strong { color: #637b8b; font-size: 12px; }
.timeline small { margin-top: 3px; color: #8a9aa5; font-size: 10px; }
.timeline li.is-active > span { background: var(--primary); box-shadow: 0 0 0 3px #d8edf7; }
.timeline li.is-done > span { background: var(--green); }
.timeline li.is-done::before { background: #8ed0b1; }
.timeline li.is-active strong, .timeline li.is-done strong { color: var(--ink); }
.timeline li.is-error > span { background: var(--red); }
.timeline li.is-warning > span { background: var(--amber); }

.error-panel { margin-top: 28px; border: 1px solid #efcbd0; border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.subsection-heading { padding: 16px 18px; border-bottom: 1px solid #f0d8db; background: var(--red-soft); }
.subsection-heading span { color: var(--red); font-size: 12px; font-weight: 700; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 11px 14px; border-bottom: 1px solid #edf1f4; font-size: 12px; vertical-align: top; }
th { color: #607786; background: #fafcfd; font-weight: 700; }
td { color: #3e5d71; }
tbody tr:last-child td { border-bottom: 0; }

.technical-details { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 15px; }
.technical-details summary { width: max-content; color: var(--primary-dark); cursor: pointer; font-size: 12px; font-weight: 700; }
.technical-details dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 16px 0 0; }
.technical-details dl div { min-width: 0; }
.technical-details dt { color: var(--muted); font-size: 11px; }
.technical-details dd { margin: 5px 0 0; color: var(--ink); font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }

.connection-state { color: var(--muted); font-size: 12px; }
.connection-state.is-online { color: var(--green); }
.event-log { min-height: 230px; max-height: 420px; margin-top: 18px; padding: 8px 0; border: 1px solid #213a4a; border-radius: var(--radius); background: #102532; overflow: auto; }
.log-row { display: grid; grid-template-columns: 82px 88px minmax(0, 1fr); gap: 12px; padding: 8px 14px; border-bottom: 1px solid #1c394a; color: #d6e5ed; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; }
.log-row:last-child { border-bottom: 0; }
.log-time { color: #7e9aaa; }
.log-stage { color: #73c7ef; text-transform: uppercase; }
.log-row.is-success .log-stage { color: #77d5a8; }
.log-row.is-warning .log-stage { color: #f0c570; }
.log-row.is-error .log-stage { color: #f08d98; }

footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { min-height: 64px; color: #718493; font-size: 12px; }
.is-hidden { display: none; }

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .timeline { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 24px; }
  .technical-details dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .container { width: min(100% - 28px, 1180px); }
  .brand-logo { width: 38px; height: 38px; object-fit: contain; }
  .header-context { font-size: 11px; }
  .main-content { padding-block: 32px 50px; }
  .page-heading, .section-heading { align-items: flex-start; flex-direction: column; gap: 14px; }
  h1 { font-size: 27px; }
  .status-badge { align-self: flex-start; }
  .drop-zone { min-height: 160px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { min-height: 94px; padding: 15px; }
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .technical-details dl { grid-template-columns: 1fr; }
  .log-row { grid-template-columns: 64px minmax(0, 1fr); gap: 8px; }
  .log-stage { grid-column: 2; grid-row: 1; }
  .log-message { grid-column: 1 / -1; }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; gap: 3px; }
}

/* Keep the original upload control accessible to keyboard users. */
.drop-zone { position: relative; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.drop-zone:focus-within { outline: 3px solid var(--primary); outline-offset: 3px; }
