:root {
  color-scheme: light;
  --bg: #f5f6f4;
  --surface: #ffffff;
  --surface-2: #eef3f0;
  --ink: #202420;
  --muted: #66716b;
  --line: #d9dfda;
  --line-strong: #b9c4bd;
  --accent: #146b5f;
  --accent-strong: #0f564c;
  --accent-soft: #dcebe6;
  --warm: #bb5a30;
  --danger: #a7372d;
  --shadow: 0 18px 60px rgba(32, 36, 32, 0.10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(20, 107, 95, 0.12), transparent 36%),
    linear-gradient(300deg, rgba(187, 90, 48, 0.11), transparent 34%),
    var(--bg);
}

.login-shell {
  width: min(100%, 480px);
}

.login-panel,
.settings-panel,
.export-panel,
.upload-panel,
.table-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-panel {
  padding: 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1;
}

h2 {
  margin-bottom: 6px;
  font-size: 1.45rem;
}

h3 {
  margin-bottom: 18px;
  font-size: 1.05rem;
}

.muted,
.section-heading p,
.file-drop small {
  color: var(--muted);
}

.login-form,
.settings-panel,
.mapping-controls,
.upload-panel,
.export-panel {
  display: grid;
  gap: 16px;
}

.login-form {
  margin-top: 28px;
}

label {
  display: grid;
  gap: 7px;
  color: #38413c;
  font-size: 0.92rem;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 107, 95, 0.14);
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 7px;
  padding: 10px 16px;
  font-weight: 750;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border 0.15s ease;
}

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

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

.secondary-button {
  background: #fff;
  color: var(--accent-strong);
  border-color: var(--accent);
}

.secondary-button:hover {
  background: var(--accent-soft);
}

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

.large {
  min-height: 52px;
  font-size: 1rem;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.form-message {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.warning-message {
  margin: 18px 0 0;
  padding: 12px;
  border-left: 4px solid var(--warm);
  background: #fff5ee;
  color: #6d321d;
  border-radius: 6px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 18px 28px;
  background: rgba(245, 246, 244, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.app-header h1 {
  margin: 0;
  font-size: 1.65rem;
}

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

.status-pill,
.secret-status span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #ecefed;
  color: #48504b;
  font-size: 0.82rem;
  font-weight: 750;
  white-space: nowrap;
}

.status-pill.ok,
.secret-status .ok {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-pill.warn,
.secret-status .warn {
  background: #fff0e8;
  color: #873f24;
}

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

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 18px;
}

.tab-button {
  min-width: max-content;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #39413c;
  padding: 9px 14px;
  font-weight: 750;
}

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

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: grid;
  gap: 18px;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.section-heading p {
  margin-bottom: 0;
  max-width: 760px;
}

.upload-panel {
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  padding: 18px;
}

.file-drop {
  min-height: 86px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 16px;
  background: var(--surface-2);
  justify-content: center;
}

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

.file-drop span {
  color: var(--ink);
  font-size: 1rem;
}

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

.summary-item {
  min-height: 78px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-item strong {
  display: block;
  margin-top: 6px;
  font-size: 1.25rem;
}

.table-shell {
  overflow: auto;
  max-height: 440px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  background: #fff;
}

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

th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  color: #28312c;
  font-weight: 800;
}

td {
  color: #3f4943;
  max-width: 300px;
  overflow-wrap: anywhere;
}

.mapping-controls {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.columns-list {
  display: grid;
  gap: 10px;
}

.column-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(110px, 140px) minmax(260px, 2fr);
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.column-name {
  min-width: 0;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.switch-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.switch-line input,
.checkbox-row input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.settings-panel {
  padding: 18px;
}

.two-column,
.range-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.secret-status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.export-panel {
  padding: 18px;
  max-width: 760px;
}

.checklist {
  display: grid;
  gap: 9px;
}

.check-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.check-item span:last-child {
  font-weight: 800;
  color: var(--muted);
}

.check-item.ok span:last-child {
  color: var(--accent);
}

.check-item.warn span:last-child {
  color: var(--warm);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: min(380px, calc(100vw - 44px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

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

@media (max-width: 900px) {
  .app-header,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .upload-panel,
  .settings-grid,
  .mapping-controls,
  .two-column,
  .range-row,
  .column-row,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .app-layout,
  .app-header {
    padding-left: 16px;
    padding-right: 16px;
  }
}
