* {
  box-sizing: border-box;
}

:root {
  --bg: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #f9f9f7;
  --text: #1a1a1a;
  --text-muted: #71717a;
  --border: #e4e4e0;
  --border-bright: #d0d0cc;

  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-dim: rgba(37, 99, 235, 0.08);

  --error: #dc2626;
  --error-bg: rgba(220, 38, 38, 0.06);
  --error-border: rgba(220, 38, 38, 0.2);

  --mock-text: #16a34a;
  --mock-bg: rgba(22, 163, 74, 0.06);
  --mock-border: rgba(22, 163, 74, 0.2);

  --radius: 8px;
  --radius-sm: 5px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Outfit', system-ui, sans-serif;
  margin: 0;
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.055) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent-dark);
}

code {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.8em;
  background: var(--surface-2);
  padding: 0.15em 0.45em;
  border-radius: 3px;
  border: 1px solid var(--border);
  color: var(--accent);
}

/* Step indicator */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.step-item.active {
  color: var(--accent);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}

.step-item.active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.step-item.done {
  color: var(--text-muted);
}

.step-item.done .step-num {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-muted);
  font-size: 0.6rem;
}

.step-sep {
  color: var(--border-bright);
  font-size: 0.75rem;
  user-select: none;
}

/* Hero */
.hero {
  margin-bottom: 2rem;
}

.hero-subtitle {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0.25rem 0 0;
}

/* File drop zone */
.file-drop-zone {
  position: relative;
  border: 1.5px dashed var(--border-bright);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  transition: var(--transition);
}

.file-drop-zone:hover,
.file-drop-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.file-drop-zone.has-file {
  border-color: var(--accent);
  border-style: solid;
}

.file-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.drop-zone-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.75rem 1rem;
  pointer-events: none;
  text-align: center;
}

.drop-zone-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.drop-zone-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.drop-zone-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Header */
.header {
  background: rgba(244, 244, 241, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-container {
  max-width: 68rem;
  margin: 0 auto;
  padding: 0.875rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Bebas Neue', system-ui, sans-serif;
  font-size: 1.45rem;
  letter-spacing: 0.06em;
  color: var(--text);
  text-decoration: none;
}

.logo:hover {
  color: var(--accent);
}

.logo-icon {
  color: var(--accent);
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.github-link {
  margin-left: auto;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: var(--transition);
}

.github-link:hover {
  color: var(--text);
}

.header-subtitle {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: 'DM Mono', monospace;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}

/* Main */
.main {
  max-width: 68rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-title {
  font-family: 'Bebas Neue', system-ui, sans-serif;
  font-size: 3rem;
  letter-spacing: 0.03em;
  margin: 0 0 1.75rem;
  color: var(--text);
  line-height: 1;
}

.back-link {
  margin: 0 0 1.75rem;
}

.back-link a {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.45rem 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.back-link a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.index-columns {
  display: flex;
  justify-content: center;
}

.index-col-form {
  width: 100%;
  max-width: 460px;
}

/* Panels / Cards */
.panel, .card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.panel::before, .card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, transparent 60%);
  opacity: 0;
  transition: var(--transition);
}

.panel:focus-within::before,
.panel:hover::before,
.card:hover::before {
  opacity: 1;
}

.panel:hover, .card:hover {
  border-color: var(--border-bright);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}

.panel-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

h2.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field input[type="text"],
.field input[type="password"],
.field select {
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--surface-2);
  color: var(--text);
  transition: var(--transition);
}

.field input[type="password"] {
  font-family: 'DM Mono', monospace;
  font-size: 0.875rem;
  letter-spacing: 0.03em;
}

.field input[type="file"] {
  font-size: 0.875rem;
  padding: 0.75rem;
  background: var(--surface-2);
  border: 1.5px dashed var(--border-bright);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-muted);
  transition: var(--transition);
}

.field input[type="file"]:hover {
  border-color: var(--accent);
  color: var(--text);
}

.field input[type="file"]::file-selector-button {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.35rem 0.75rem;
  margin-right: 0.875rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Outfit', system-ui, sans-serif;
}

.field input[type="file"]::file-selector-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--surface);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.field.checkbox {
  flex-direction: row;
  align-items: center;
  padding: 0.375rem 0;
  gap: 0.75rem;
}

.field.checkbox input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.field.checkbox label {
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  cursor: pointer;
}

.hint, .muted {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  padding: 0.75rem 1.75rem;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 700;
  font-family: 'Outfit', system-ui, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Alerts */
.alert {
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-sm);
  margin-bottom: 2rem;
  font-size: 0.875rem;
  border: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: slideUp 0.3s ease-out;
}

.alert svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error-border);
}

.alert-mock {
  background: var(--mock-bg);
  color: var(--mock-text);
  border-color: var(--mock-border);
}

.alert-warning {
  background: rgba(180, 120, 0, 0.06);
  color: #92400e;
  border-color: rgba(180, 120, 0, 0.2);
}

.alert-info {
  background: var(--accent-dim);
  color: var(--accent-dark);
  border-color: rgba(37, 99, 235, 0.18);
}

/* Mapping panel */
.mapping-table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.mapping-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.mapping-table th,
.mapping-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.mapping-table th {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  background: var(--surface-2);
}

.mapping-table tr:last-child td {
  border-bottom: none;
}

.mapping-table tbody tr:hover {
  background: var(--surface-2);
}

/* Resolve form */
.resolve-intro {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1.75rem;
  max-width: 52rem;
  line-height: 1.6;
}

.resolve-form {
  display: block;
}

.resolve-submit {
  margin-top: 2.5rem;
}

.unmapped-row {
  background: rgba(180, 120, 0, 0.025);
}

.unmapped-row:hover {
  background: rgba(180, 120, 0, 0.06) !important;
}

.unmapped-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: rgba(180, 120, 0, 0.1);
  border: 1px solid rgba(180, 120, 0, 0.3);
  color: #92400e;
  font-size: 0.6rem;
  font-weight: 800;
  margin-right: 0.5rem;
  flex-shrink: 0;
  vertical-align: middle;
}


/* Dedup warning */
.dedup-warning {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.125rem;
  border: 1px solid rgba(180, 120, 0, 0.2);
  border-radius: var(--radius-sm);
  background: rgba(180, 120, 0, 0.06);
  font-size: 0.875rem;
}

.dedup-warning-icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: #92400e;
}

.dedup-warning-body {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  color: #92400e;
}

.dedup-warning-body strong {
  font-size: 0.875rem;
}

.dedup-warning-body p {
  margin: 0;
  font-size: 0.8125rem;
  opacity: 0.85;
}

.preview-review-heading {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 0.875rem;
}

/* Preview */
.preview-card {
  max-width: 60rem;
}

.preview-intro {
  font-size: 0.9375rem;
  margin: 0 0 2rem;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  letter-spacing: 0.01em;
}

.preview-intro strong {
  color: var(--accent);
  font-size: 1.15rem;
}

.workout-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.workout-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.workout-card::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: var(--transition);
}

.workout-card:hover {
  border-color: var(--border-bright);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.workout-card:hover::after {
  opacity: 1;
}

.workout-card-date {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.date-pill {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(37, 99, 235, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
}

.workout-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  line-height: 1.3;
}

.workout-card-exercises {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: auto 0 0 0;
  line-height: 1.6;
  font-family: 'DM Mono', monospace;
}

.preview-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 0.875rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.preview-pagination a {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: var(--transition);
}

.preview-pagination a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.preview-skipped {
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

.preview-skipped ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.preview-actions {
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dedup-confirm {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1.5;
}

.dedup-confirm input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin-top: 0.15rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.privacy-note {
  font-size: 0.775rem;
  color: var(--text-muted);
  margin: 1rem 0 0;
  line-height: 1.55;
  text-align: center;
}

/* Result */
.result-card {
  max-width: 30rem;
  padding: 3rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.result-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1.5px solid rgba(37, 99, 235, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.result-number {
  font-family: 'Bebas Neue', system-ui, sans-serif;
  font-size: 5.5rem;
  letter-spacing: 0.03em;
  color: var(--accent);
  line-height: 1;
  margin: 0;
}

.result-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: -0.5rem 0 0;
  font-family: 'DM Mono', monospace;
}

.result-message {
  font-size: 0.9375rem;
  margin: 0.5rem 0 0;
  color: var(--text-muted);
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.result-actions a {
  display: inline-flex;
  align-items: center;
  padding: 0.625rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: var(--transition);
}

.result-actions a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.result-actions a.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.result-actions a.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}


/* Custom autocomplete */
.ac-input {
  display: block;
  width: 100%;
  padding: 0.45rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--surface-2);
  color: var(--text);
  transition: var(--transition);
}

.ac-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  background: var(--surface);
}

.ac-dropdown {
  position: fixed;
  z-index: 999;
  list-style: none;
  margin: 0;
  padding: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1), 0 2px 6px rgba(0, 0, 0, 0.06);
  max-height: 15rem;
  overflow-y: auto;
  animation: acFadeIn 0.1s ease-out;
}

@keyframes acFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ac-item {
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--text);
  transition: background 0.1s, color 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ac-item:hover,
.ac-item[aria-selected="true"] {
  background: var(--accent-dim);
  color: var(--accent-dark);
}

.ac-item mark {
  background: none;
  color: var(--accent);
  font-weight: 700;
}

/* Pre-mapped table */
.resolve-section {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.resolve-section-header {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.mapping-arrow {
  color: var(--text-muted);
  font-size: 0.875rem;
  width: 1.5rem;
  text-align: center;
  user-select: none;
}

.mapping-source {
  font-size: 0.875rem;
  color: var(--text);
  white-space: nowrap;
}

.mapping-target {
  width: 22rem;
}


.mapping-row {
  transition: background 0.15s;
}

.pre-mapped-modified {
  background: var(--accent-dim);
}

.pre-mapped-modified .ac-input {
  border-color: var(--accent);
}

@media (max-width: 768px) {
  .page-title {
    font-size: 2.25rem;
  }

  .main {
    padding: 2rem 1rem 4rem;
  }
}
