:root {
  color-scheme: light;
  --bg: #f6f8f5;
  --ink: #17211a;
  --muted: #607067;
  --line: #d7dfd8;
  --panel: #ffffff;
  --accent: #126b5f;
  --accent-strong: #0c4f46;
  --accent-soft: #dcefeb;
  --warn: #9a5b00;
  --error: #a02525;
  --shadow: 0 18px 60px rgba(36, 55, 43, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

.app-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.is-hidden {
  display: none !important;
}

button,
input {
  font: inherit;
}

.auth-shell {
  width: min(760px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 42px 0 54px;
}

.auth-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.auth-topbar,
.auth-form,
.auth-legal {
  padding: 22px 24px;
}

.auth-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.auth-form {
  border-bottom: 1px solid var(--line);
}

.auth-form h2 {
  margin-bottom: 8px;
}

.auth-form p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.45;
}

.text-input {
  width: 100%;
  min-height: 42px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
}

.text-input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.auth-legal {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-legal h2 {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 17px;
}

.auth-legal p {
  margin: 10px 0 0;
}

.auth-copyright {
  margin: 0;
  padding: 16px 24px 18px;
  color: var(--muted);
  font-size: 13px;
}

.confirm-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: transparent;
}

.confirm-dialog::backdrop {
  background: rgba(23, 33, 26, 0.42);
}

.confirm-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.confirm-card h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.confirm-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.app-shell {
  flex: 1 0 auto;
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.language-switch {
  display: inline-flex;
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.lang-button {
  min-width: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.lang-button.is-active {
  background: var(--accent);
  color: #fff;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
  gap: 16px;
  margin-bottom: 16px;
}

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

.file-panel {
  display: flex;
  flex-direction: column;
  border-style: dashed;
  transition: border-color 140ms ease, background 140ms ease;
}

.file-panel.is-dragging {
  border-color: var(--accent);
  background: #eef8f5;
}

.file-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 132px;
  cursor: pointer;
  padding: 22px 24px;
  color: var(--ink);
}

.drop-label strong,
.drop-label small {
  display: block;
}

.drop-label small {
  margin-top: 4px;
  color: var(--muted);
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 27px;
  line-height: 1;
}

.mapping-panel {
  padding: 18px;
}

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

.panel-heading .field-label {
  margin-bottom: 0;
}

.field-label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.mapping-row,
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.partner-details {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fbf8;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.partner-details summary {
  color: var(--accent-strong);
  font-weight: 800;
  cursor: pointer;
}

.partner-details p {
  margin: 0;
}

.partner-details p:first-of-type {
  margin-top: 10px;
}

.partner-details p + p,
.partner-details .mapping-row {
  margin-top: 8px;
}

.mapping-row.compact {
  gap: 8px;
}

.mapping-editor {
  padding: 16px;
  margin-bottom: 16px;
}

.mapping-editor.is-hidden {
  display: none;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

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

h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.partner-table {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfb;
}

.partner-table-head,
.partner-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.5fr) minmax(220px, 1fr) minmax(220px, 0.8fr) minmax(100px, 0.3fr);
  gap: 10px;
  align-items: center;
  min-width: 820px;
}

.partner-table-head {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  background: #edf2ee;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.partner-row {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.partner-row.needs-registration {
  background: #fff8e8;
}

.partner-row.needs-details {
  background: #f7fbf8;
}

.partner-row.is-hidden-partner {
  color: var(--muted);
  background: #f3f5f3;
}

.partner-row.is-hidden-partner input {
  color: var(--muted);
  background: #f8faf8;
}

.partner-empty-row {
  min-width: 820px;
  padding: 18px 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.partner-row:last-child {
  border-bottom: 0;
}

.partner-row input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  color: var(--ink);
  background: #fff;
}

.partner-row input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.actions {
  min-height: 70px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
}

.primary-button,
.secondary-button,
.ghost-button,
.download-link {
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 9px 14px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

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

.primary-button:hover {
  background: var(--accent-strong);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.secondary-button,
.download-link {
  display: inline-flex;
  align-items: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.status-line {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 14px;
}

#lookupStatus {
  white-space: pre-line;
}

.help-note {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.actions .status-line {
  margin: 0 0 0 auto;
}

.file-list {
  overflow: hidden;
  border-top: 1px solid var(--line);
  background: #fff;
}

.table-head,
.file-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 0.45fr) minmax(150px, 0.4fr) minmax(110px, 0.3fr);
  gap: 16px;
  align-items: center;
}

.table-head {
  padding: 13px 16px;
  background: #edf2ee;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.rows.empty {
  padding: 28px 16px;
  color: var(--muted);
}

.file-row {
  min-height: 64px;
  padding: 13px 16px;
  border-top: 1px solid var(--line);
}

.file-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.file-error-message {
  max-width: 260px;
  color: var(--error);
  font-size: 13px;
  line-height: 1.35;
}

.badge {
  justify-self: start;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  background: #eef1ee;
  font-size: 13px;
  font-weight: 800;
}

.badge.ready,
.badge.done {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.badge.error {
  color: var(--error);
  background: #f8e5e3;
}

.badge.warn {
  color: var(--warn);
  background: #fff1d6;
}

.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  background: #eef3ef;
}

.footer-inner {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 34px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.disclaimer-grid h2 {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 17px;
}

.disclaimer-grid p {
  margin: 10px 0 0;
}

.copyright-line {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.footer-inner strong {
  color: var(--ink);
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 24px, 1120px);
    padding-top: 22px;
    padding-bottom: 32px;
  }

  .topbar,
  .workspace {
    display: block;
  }

  .header-tools {
    justify-content: flex-start;
    margin-top: 16px;
  }

  .file-panel {
    margin-bottom: 12px;
  }

  .drop-label {
    min-height: 128px;
  }

  .actions .status-line {
    width: 100%;
    margin-left: 0;
  }

  .table-head {
    display: none;
  }

  .file-row {
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
  }

  .partner-table-head,
  .partner-row {
    min-width: 760px;
  }

  .section-heading,
  .section-actions,
  .disclaimer-grid,
  .auth-topbar,
  .auth-legal {
    display: block;
  }

  .auth-topbar .language-switch {
    margin-top: 16px;
  }

  .section-heading .ghost-button,
  .section-actions .secondary-button {
    margin-top: 12px;
  }

  .disclaimer-grid section + section {
    margin-top: 22px;
  }
}
