/*
 * Rowdy Engine - Stylesheet
 *
 * Usage in host app:
 * @import "rowdy/application";
 *
 * Override any color by redefining the CSS variables:
 * :root { --rowdy-primary: 220 90% 56%; }
 */

:root {
  --rowdy-color-primary: #3b82f6;
  --rowdy-color-primary-hover: #2563eb;
  --rowdy-border-color: #e5e7eb;
  --rowdy-bg: white;
  --rowdy-shadow: rgba(0, 0, 0, 0.05);
  --rowdy-button-text: white;
  --rowdy-text-muted: #6b7280;
  --rowdy-modal-overlay: rgba(0, 0, 0, 0.5);
  --rowdy-dropzone-border: #cbd5e1;
  --rowdy-dropzone-active-bg: #eff6ff;
  --rowdy-status-pending: #fbbf24;
  --rowdy-status-processing: var(--rowdy-color-primary);
  --rowdy-status-completed: #10b981;
  --rowdy-status-failed: #ef4444;
  /* Core palette (HSL values for composability) */
  --rowdy-primary: 221 83% 53%;
  --rowdy-primary-hover: 221 83% 46%;
  --rowdy-primary-foreground: 0 0% 100%;

  --rowdy-destructive: 0 84% 60%;
  --rowdy-destructive-foreground: 0 0% 100%;

  --rowdy-success: 160 84% 39%;
  --rowdy-warning: 38 92% 50%;

  --rowdy-background: 0 0% 100%;
  --rowdy-foreground: 224 71% 4%;
  --rowdy-card: 0 0% 100%;
  --rowdy-card-foreground: 224 71% 4%;

  --rowdy-muted: 220 14% 96%;
  --rowdy-muted-foreground: 220 9% 46%;

  --rowdy-accent: 220 14% 96%;
  --rowdy-accent-foreground: 220 9% 46%;

  --rowdy-border: 220 13% 91%;
  --rowdy-input: 220 13% 91%;
  --rowdy-ring: 221 83% 53%;

  --rowdy-radius: 0.5rem;
  --rowdy-radius-sm: 0.375rem;
  --rowdy-radius-lg: 0.75rem;

  --rowdy-font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rowdy-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --rowdy-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --rowdy-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --rowdy-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

  --rowdy-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Layout ────────────────────────────────────────────────── */

.rowdy-body {
  font-family: var(--rowdy-font-sans);
  margin: 0;
  padding: 2.5rem 1.5rem;
  background-color: hsl(var(--rowdy-muted));
  color: hsl(var(--rowdy-foreground));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.rowdy-container {
  max-width: 56rem;
  margin: 0 auto;
  background: hsl(var(--rowdy-card));
  border: 1px solid hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius-lg);
  padding: 2rem;
  box-shadow: var(--rowdy-shadow);
}

/* ─── Base ──────────────────────────────────────────────────── */

.rowdy-schemas {
  font-family: var(--rowdy-font-sans);
  color: hsl(var(--rowdy-foreground));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.rowdy-schemas-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.25rem;
}

/* ─── Schema Cards Grid ────────────────────────────────────── */

.rowdy-schemas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 0.75rem;
}

.rowdy-schema-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: hsl(var(--rowdy-card));
  border: 1px solid hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius-lg);
  padding: 1.25rem 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--rowdy-transition),
              box-shadow var(--rowdy-transition),
              background var(--rowdy-transition);
  cursor: pointer;
}

.rowdy-schema-card:hover {
  border-color: hsl(var(--rowdy-ring));
  box-shadow: var(--rowdy-shadow);
  background: hsl(var(--rowdy-ring) / 0.02);
}

.rowdy-schema-card-body {
  flex: 1;
  min-width: 0;
}

.rowdy-schema-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: hsl(var(--rowdy-foreground));
  letter-spacing: -0.015em;
  margin: 0 0 0.125rem 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rowdy-schema-card-name {
  font-size: 0.75rem;
  font-family: var(--rowdy-font-mono);
  color: hsl(var(--rowdy-muted-foreground));
}

.rowdy-schema-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.125rem;
  flex-shrink: 0;
}

.rowdy-schema-card-columns,
.rowdy-schema-card-uploads {
  font-size: 0.6875rem;
  color: hsl(var(--rowdy-muted-foreground));
  white-space: nowrap;
}

.rowdy-schema-card-arrow {
  flex-shrink: 0;
  color: hsl(var(--rowdy-muted-foreground));
  transition: transform var(--rowdy-transition);
}

.rowdy-schema-card:hover .rowdy-schema-card-arrow {
  transform: translateX(2px);
  color: hsl(var(--rowdy-primary));
}

/* ─── Schemas Empty State ──────────────────────────────────── */

.rowdy-schemas-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: hsl(var(--rowdy-muted-foreground));
  font-size: 0.875rem;
}

.rowdy-schemas-empty-icon {
  color: hsl(var(--rowdy-border));
  margin-bottom: 0.75rem;
}

.rowdy-schemas-empty p {
  margin: 0;
}

/* ─── Schema Show Page ─────────────────────────────────────── */

.rowdy-schema-show-header {
  margin-bottom: 1.5rem;
}

.rowdy-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--rowdy-muted-foreground));
  text-decoration: none;
  margin-bottom: 0.75rem;
  transition: color var(--rowdy-transition);
}

.rowdy-back-link:hover {
  color: hsl(var(--rowdy-primary));
}

.rowdy-schema-show-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: hsl(var(--rowdy-foreground));
  letter-spacing: -0.025em;
  margin: 0;
}

/* ─── Template (legacy / inline) ───────────────────────────── */

.rowdy-template {
  background: hsl(var(--rowdy-card));
  border: 1px solid hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.rowdy-template-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: hsl(var(--rowdy-foreground));
  letter-spacing: -0.025em;
  margin: 0 0 1.25rem 0;
}

/* ─── Dropzone ──────────────────────────────────────────────── */

.rowdy-dropzone-area {
  position: relative;
  border: 1.5px dashed hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--rowdy-transition),
              background-color var(--rowdy-transition),
              box-shadow var(--rowdy-transition);
  background: hsl(var(--rowdy-muted) / 0.3);
}

.rowdy-dropzone-area:hover {
  border-color: hsl(var(--rowdy-ring));
  background: hsl(var(--rowdy-ring) / 0.04);
}

.rowdy-dropzone-area.dragover {
  border-color: hsl(var(--rowdy-ring));
  background: hsl(var(--rowdy-ring) / 0.06);
  box-shadow: 0 0 0 3px hsl(var(--rowdy-ring) / 0.08);
}

.rowdy-dropzone-area--uploading {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.7;
  background: hsl(var(--rowdy-muted) / 0.5);
}

.rowdy-dropzone-label-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.rowdy-dropzone-label-wrap > [data-rowdy-dropzone-target="dropzoneLabel"] {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
}

.rowdy-dropzone-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: hsl(var(--rowdy-muted-foreground));
}

.rowdy-dropzone-label-wrap > [data-rowdy-dropzone-target="dropzoneLabel"] > span {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--rowdy-foreground));
}

.rowdy-dropzone-hint {
  font-size: 0.75rem;
  color: hsl(var(--rowdy-muted-foreground));
}

.rowdy-dropzone-uploading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.rowdy-dropzone-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid hsl(var(--rowdy-border));
  border-top-color: hsl(var(--rowdy-primary));
  border-radius: 50%;
  animation: rowdy-spin 0.7s linear infinite;
}

.rowdy-dropzone-uploading-text {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--rowdy-muted-foreground));
}

@keyframes rowdy-spin {
  to { transform: rotate(360deg); }
}

/* ─── File List (in-dropzone progress) ──────────────────────── */

.rowdy-file-list--hidden {
  display: none;
}

.rowdy-file-list {
  margin-top: 0.75rem;
}

.rowdy-file-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  background: hsl(var(--rowdy-card));
  border: 1px solid hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius-sm);
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
}

.rowdy-file-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  color: hsl(var(--rowdy-muted-foreground));
}

.rowdy-file-name {
  font-weight: 500;
  color: hsl(var(--rowdy-foreground));
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rowdy-file-size {
  font-size: 0.75rem;
  color: hsl(var(--rowdy-muted-foreground));
  flex-shrink: 0;
}

.rowdy-file-status {
  display: none;
}

.rowdy-file-progress-bar {
  width: 100%;
  height: 0.1875rem;
  background: hsl(var(--rowdy-border));
  border-radius: 9999px;
  overflow: hidden;
  margin-top: 0.375rem;
}

.rowdy-file-progress-fill {
  height: 100%;
  background: hsl(var(--rowdy-primary));
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* ─── Resume Banner ─────────────────────────────────────────── */

.rowdy-resume-banner {
  margin-top: 0.75rem;
}

.rowdy-resume-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid hsl(var(--rowdy-warning) / 0.3);
  background: hsl(var(--rowdy-warning) / 0.06);
  border-radius: var(--rowdy-radius-sm);
  margin-bottom: 0.375rem;
}

.rowdy-resume-item:last-child {
  margin-bottom: 0;
}

.rowdy-resume-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.rowdy-resume-filename {
  font-weight: 500;
  font-size: 0.8125rem;
  color: hsl(var(--rowdy-foreground));
}

.rowdy-resume-progress {
  font-size: 0.75rem;
  color: hsl(var(--rowdy-muted-foreground));
}

.rowdy-resume-actions {
  display: flex;
  gap: 0.375rem;
  flex-shrink: 0;
}

.rowdy-resume-btn {
  padding: 0.375rem 0.75rem;
  background: hsl(var(--rowdy-primary));
  color: hsl(var(--rowdy-primary-foreground));
  border: none;
  border-radius: var(--rowdy-radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--rowdy-transition);
}

.rowdy-resume-btn:hover {
  background: hsl(var(--rowdy-primary-hover));
}

.rowdy-resume-dismiss-btn {
  padding: 0.375rem 0.75rem;
  background: transparent;
  border: 1px solid hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  color: hsl(var(--rowdy-muted-foreground));
  transition: background var(--rowdy-transition), color var(--rowdy-transition);
}

.rowdy-resume-dismiss-btn:hover {
  background: hsl(var(--rowdy-accent));
  color: hsl(var(--rowdy-foreground));
}

/* ─── Upload List ───────────────────────────────────────────── */

.rowdy-upload-list-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--rowdy-foreground));
  margin: 1.25rem 0 0.625rem 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rowdy-upload-list-scroll {
  max-height: 20rem;
  overflow-y: auto;
}

.rowdy-upload-list-scroll::-webkit-scrollbar {
  width: 0.375rem;
}

.rowdy-upload-list-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.rowdy-upload-list-scroll::-webkit-scrollbar-thumb {
  background: hsl(var(--rowdy-border));
  border-radius: 9999px;
}

/* ─── Upload Table ──────────────────────────────────────────── */

.rowdy-upload-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius);
  overflow: hidden;
  table-layout: fixed;
}

.rowdy-upload-table th {
  text-align: left;
  padding: 0.5rem 0.875rem;
  background: hsl(var(--rowdy-muted));
  font-size: 0.6875rem;
  font-weight: 600;
  color: hsl(var(--rowdy-muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid hsl(var(--rowdy-border));
}

.rowdy-upload-table th:last-child {
  width: 3.5rem;
}

.rowdy-upload-table td {
  padding: 0.5rem 0.875rem;
  border-bottom: 1px solid hsl(var(--rowdy-border));
  font-size: 0.8125rem;
  vertical-align: middle;
}

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

.rowdy-upload-table tbody tr {
  transition: background var(--rowdy-transition);
}

.rowdy-upload-table tbody tr:hover {
  background: hsl(var(--rowdy-muted) / 0.5);
}

/* ─── Upload Item (table row) ──────────────────────────────── */

.rowdy-upload-filename-cell {
  overflow: hidden;
}

.rowdy-upload-filename {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--rowdy-foreground));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rowdy-upload-status-cell {
  white-space: nowrap;
}

.rowdy-upload-status {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.rowdy-upload-item[data-upload-status="pending"] .rowdy-upload-status {
  background: hsl(var(--rowdy-warning) / 0.12);
  color: hsl(var(--rowdy-warning));
}

.rowdy-upload-item[data-upload-status="processing"] .rowdy-upload-status {
  background: hsl(var(--rowdy-primary) / 0.1);
  color: hsl(var(--rowdy-primary));
}

.rowdy-upload-item[data-upload-status="completed"] .rowdy-upload-status {
  background: hsl(var(--rowdy-success) / 0.1);
  color: hsl(var(--rowdy-success));
}

.rowdy-upload-item[data-upload-status="failed"] .rowdy-upload-status {
  background: hsl(var(--rowdy-destructive) / 0.1);
  color: hsl(var(--rowdy-destructive));
}

.rowdy-upload-action-cell {
  text-align: center;
}

/* Upload Progress */
.rowdy-upload-progress-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rowdy-upload-progress-bar progress {
  flex: 1;
  height: 0.375rem;
  border-radius: 9999px;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}

.rowdy-upload-progress-bar progress::-webkit-progress-bar {
  background: hsl(var(--rowdy-muted));
  border-radius: 9999px;
}

.rowdy-upload-progress-bar progress::-webkit-progress-value {
  background: hsl(var(--rowdy-primary));
  border-radius: 9999px;
  transition: width 0.3s ease;
}

.rowdy-upload-progress-bar progress::-moz-progress-bar {
  background: hsl(var(--rowdy-primary));
  border-radius: 9999px;
}

.rowdy-upload-progress-text {
  font-size: 0.75rem;
  font-weight: 500;
  color: hsl(var(--rowdy-muted-foreground));
  min-width: 2.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rowdy-upload-progress-bar--inline {
  margin-top: 0.375rem;
}

.rowdy-error-message {
  display: block;
  font-size: 0.75rem;
  color: hsl(var(--rowdy-destructive));
  margin-top: 0.25rem;
}

/* ─── Buttons ───────────────────────────────────────────────── */

.rowdy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25rem;
  border: 1px solid hsl(var(--rowdy-input));
  border-radius: var(--rowdy-radius-sm);
  background: hsl(var(--rowdy-background));
  color: hsl(var(--rowdy-foreground));
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--rowdy-transition),
              border-color var(--rowdy-transition),
              color var(--rowdy-transition),
              box-shadow var(--rowdy-transition);
  font-family: var(--rowdy-font-sans);
}

.rowdy-btn:hover {
  background: hsl(var(--rowdy-accent));
  color: hsl(var(--rowdy-accent-foreground));
}

.rowdy-btn:focus-visible {
  outline: 2px solid hsl(var(--rowdy-ring));
  outline-offset: 2px;
}

.rowdy-btn--primary {
  background: hsl(var(--rowdy-primary));
  color: hsl(var(--rowdy-primary-foreground));
  border-color: hsl(var(--rowdy-primary));
  box-shadow: var(--rowdy-shadow-sm);
}

.rowdy-btn--primary:hover {
  background: hsl(var(--rowdy-primary-hover));
  border-color: hsl(var(--rowdy-primary-hover));
  color: hsl(var(--rowdy-primary-foreground));
}

.rowdy-btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.rowdy-btn--alert {
  background: hsl(var(--rowdy-warning) / 0.1);
  border-color: hsl(var(--rowdy-warning) / 0.3);
  color: hsl(38 92% 35%);
}

.rowdy-btn--alert:hover {
  background: hsl(var(--rowdy-warning) / 0.18);
}

.rowdy-btn--ghost {
  border-color: transparent;
  background: transparent;
}

.rowdy-btn--ghost:hover {
  background: hsl(var(--rowdy-accent));
}

.rowdy-btn--sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.rowdy-btn--icon {
  padding: 0.375rem;
  line-height: 1;
}

.rowdy-btn--icon svg {
  display: block;
}

/* ─── Steps Indicator ───────────────────────────────────────── */

.rowdy-step-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 1.5rem 0;
  padding: 0;
}

.rowdy-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: hsl(var(--rowdy-muted-foreground));
  font-size: 0.8125rem;
  position: relative;
}

.rowdy-step + .rowdy-step {
  margin-left: 0.5rem;
  padding-left: 0.5rem;
}

.rowdy-step + .rowdy-step::before {
  content: "";
  position: absolute;
  left: -0.25rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.75rem;
  height: 1px;
  background: hsl(var(--rowdy-border));
}

.rowdy-step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.625rem;
  height: 1.625rem;
  border-radius: 50%;
  border: 1.5px solid hsl(var(--rowdy-border));
  font-size: 0.6875rem;
  font-weight: 600;
  color: hsl(var(--rowdy-muted-foreground));
  background: hsl(var(--rowdy-background));
  transition: all var(--rowdy-transition);
  font-variant-numeric: tabular-nums;
}

.rowdy-step-label {
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.rowdy-step--active {
  color: hsl(var(--rowdy-primary));
}

.rowdy-step--active .rowdy-step-number {
  background: hsl(var(--rowdy-primary));
  border-color: hsl(var(--rowdy-primary));
  color: hsl(var(--rowdy-primary-foreground));
  box-shadow: 0 0 0 3px hsl(var(--rowdy-primary) / 0.15);
}

.rowdy-step--active .rowdy-step-label {
  font-weight: 600;
}

.rowdy-step--completed {
  color: hsl(var(--rowdy-success));
}

.rowdy-step--completed .rowdy-step-number {
  background: hsl(var(--rowdy-success));
  border-color: hsl(var(--rowdy-success));
  color: white;
}

.rowdy-step--completed + .rowdy-step::before {
  background: hsl(var(--rowdy-success));
}

/* ─── Column Mapping ────────────────────────────────────────── */

.rowdy-column-mapping {
  animation: rowdy-fade-in 0.2s ease;
}

.rowdy-mapping-errors {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: hsl(var(--rowdy-destructive) / 0.06);
  border: 1px solid hsl(var(--rowdy-destructive) / 0.2);
  border-radius: var(--rowdy-radius-sm);
}

.rowdy-mapping-error {
  color: hsl(var(--rowdy-destructive));
  font-size: 0.8125rem;
  margin: 0;
  line-height: 1.5;
}

.rowdy-mapping-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-bottom: 1.25rem;
  border: 1px solid hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius);
  overflow: hidden;
}

.rowdy-mapping-table th {
  text-align: left;
  padding: 0.625rem 0.875rem;
  background: hsl(var(--rowdy-muted));
  font-size: 0.6875rem;
  font-weight: 600;
  color: hsl(var(--rowdy-muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid hsl(var(--rowdy-border));
}

.rowdy-mapping-table td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid hsl(var(--rowdy-border));
  font-size: 0.8125rem;
  vertical-align: middle;
}

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

.rowdy-mapping-table tbody tr {
  transition: background var(--rowdy-transition);
}

.rowdy-mapping-table tbody tr:hover {
  background: hsl(var(--rowdy-muted) / 0.5);
}

.rowdy-mapping-uploaded-col {
  font-weight: 500;
  color: hsl(var(--rowdy-foreground));
  font-family: var(--rowdy-font-mono);
  font-size: 0.8125rem;
}

.rowdy-mapping-sample-value {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  background: hsl(var(--rowdy-muted));
  border: 1px solid hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius-sm);
  font-size: 0.6875rem;
  font-family: var(--rowdy-font-mono);
  margin-right: 0.25rem;
  margin-bottom: 0.125rem;
  color: hsl(var(--rowdy-muted-foreground));
}

.rowdy-mapping-select {
  width: 100%;
  padding: 0.4375rem 0.625rem;
  border: 1px solid hsl(var(--rowdy-input));
  border-radius: var(--rowdy-radius-sm);
  font-size: 0.8125rem;
  background: hsl(var(--rowdy-background));
  color: hsl(var(--rowdy-foreground));
  font-family: var(--rowdy-font-sans);
  transition: border-color var(--rowdy-transition), box-shadow var(--rowdy-transition);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.375rem center;
  background-repeat: no-repeat;
  background-size: 1.25rem 1.25rem;
  padding-right: 1.75rem;
}

.rowdy-mapping-select:focus {
  outline: none;
  border-color: hsl(var(--rowdy-ring));
  box-shadow: 0 0 0 2px hsl(var(--rowdy-ring) / 0.2);
}

.rowdy-mapping-remove-btn {
  background: none;
  border: none;
  font-size: 0;
  color: hsl(var(--rowdy-muted-foreground));
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--rowdy-radius-sm);
  transition: background var(--rowdy-transition), color var(--rowdy-transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
}

.rowdy-mapping-remove-btn::after {
  content: "";
  display: block;
  width: 1rem;
  height: 1rem;
  background: currentColor;
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cline x1='18' y1='6' x2='6' y2='18'/%3e%3cline x1='6' y1='6' x2='18' y2='18'/%3e%3c/svg%3e");
  -webkit-mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cline x1='18' y1='6' x2='6' y2='18'/%3e%3cline x1='6' y1='6' x2='18' y2='18'/%3e%3c/svg%3e");
  mask-size: contain;
  -webkit-mask-size: contain;
}

.rowdy-mapping-remove-btn:hover {
  background: hsl(var(--rowdy-destructive) / 0.1);
  color: hsl(var(--rowdy-destructive));
}

.rowdy-mapping-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

/* ─── Validation Result ─────────────────────────────────────── */

.rowdy-validation-result {
  animation: rowdy-fade-in 0.2s ease;
}

.rowdy-validation-progress {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.rowdy-validation-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: hsl(var(--rowdy-muted-foreground));
  margin: 0 auto 0.75rem;
}

.rowdy-validation-progress-bar {
  max-width: 20rem;
  margin: 0 auto;
}

.rowdy-validation-status {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--rowdy-muted-foreground));
  margin-bottom: 1rem;
}

.rowdy-validation-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.rowdy-validation-total,
.rowdy-validation-detail {
  margin: 0;
  padding: 0.875rem 1rem;
  border: 1px solid hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius);
  background: hsl(var(--rowdy-card));
}

.rowdy-validation-total {
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--rowdy-foreground));
}

.rowdy-validation-detail {
  font-size: 0.8125rem;
  color: hsl(var(--rowdy-muted-foreground));
}

/* Validation Tabs */
.rowdy-validation-tabs {
  margin-bottom: 1.25rem;
}

.rowdy-validation-tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid hsl(var(--rowdy-border));
  margin-bottom: 0;
}

.rowdy-validation-tab {
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: hsl(var(--rowdy-muted-foreground));
  cursor: pointer;
  transition: color var(--rowdy-transition), border-color var(--rowdy-transition);
  font-family: var(--rowdy-font-sans);
}

.rowdy-validation-tab:hover {
  color: hsl(var(--rowdy-foreground));
}

.rowdy-validation-tab--active {
  color: hsl(var(--rowdy-foreground));
  font-weight: 600;
  border-bottom-color: hsl(var(--rowdy-primary));
}

.rowdy-validation-tab-count {
  font-size: 0.6875rem;
  opacity: 0.7;
  margin-left: 0.125rem;
}

.rowdy-validation-tab-label {
  max-width: 12rem;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.rowdy-validation-tab-panel {
  display: none;
}

.rowdy-validation-tab-panel--active {
  display: block;
  animation: rowdy-fade-in 0.15s ease;
}

/* Validation Table */
.rowdy-validation-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0.75rem 0 1rem;
  border: 1px solid hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius);
  overflow: hidden;
}

.rowdy-validation-table th {
  text-align: left;
  padding: 0.5rem 0.875rem;
  background: hsl(var(--rowdy-muted));
  font-size: 0.6875rem;
  font-weight: 600;
  color: hsl(var(--rowdy-muted-foreground));
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid hsl(var(--rowdy-border));
}

.rowdy-validation-table td {
  padding: 0.5rem 0.875rem;
  border-bottom: 1px solid hsl(var(--rowdy-border));
  font-size: 0.8125rem;
}

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

.rowdy-validation-table tbody tr {
  transition: background var(--rowdy-transition);
}

.rowdy-validation-table tbody tr:hover {
  background: hsl(var(--rowdy-muted) / 0.5);
}

/* Pagination */
.rowdy-validation-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin: 1rem 0;
}

.rowdy-validation-page-info {
  font-size: 0.8125rem;
  font-weight: 500;
  color: hsl(var(--rowdy-muted-foreground));
  font-variant-numeric: tabular-nums;
}

/* Validation Actions */
.rowdy-validation-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid hsl(var(--rowdy-border));
}

.rowdy-validation-actions-right {
  display: flex;
  gap: 0.5rem;
}

.rowdy-validation-report {
  margin-top: 0.75rem;
}

/* Inline Edit */
.rowdy-inline-edit-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--rowdy-radius-sm);
  padding: 0.3125rem 0.4375rem;
  font-size: 0.8125rem;
  font-family: var(--rowdy-font-mono);
  width: 100%;
  cursor: pointer;
  color: hsl(var(--rowdy-foreground));
  transition: border-color var(--rowdy-transition),
              background var(--rowdy-transition),
              box-shadow var(--rowdy-transition);
}

.rowdy-inline-edit-input:hover {
  border-color: hsl(var(--rowdy-input));
  background: hsl(var(--rowdy-muted) / 0.5);
}

.rowdy-inline-edit-input:focus {
  background: hsl(var(--rowdy-background));
  border-color: hsl(var(--rowdy-ring));
  box-shadow: 0 0 0 2px hsl(var(--rowdy-ring) / 0.2);
  outline: none;
  cursor: text;
}

/* ─── Import Result ─────────────────────────────────────────── */

.rowdy-import-result {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border: 1px solid hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius);
  background: hsl(var(--rowdy-muted) / 0.3);
}

.rowdy-import-result-icon {
  width: 2.5rem;
  height: 2.5rem;
  color: hsl(var(--rowdy-muted-foreground));
  margin-bottom: 0.75rem;
}

.rowdy-import-result-placeholder {
  color: hsl(var(--rowdy-muted-foreground));
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

/* ─── Animation ─────────────────────────────────────────────── */

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

/* ─── Schema Builder Dialog ────────────────────────────────── */

.rowdy-schema-dialog {
  border: none;
  border-radius: var(--rowdy-radius-lg);
  padding: 0;
  max-width: 52rem;
  width: calc(100vw - 2rem);
  max-height: calc(100vh - 4rem);
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  animation: rowdy-fade-in 0.15s ease;
}

.rowdy-schema-dialog::backdrop {
  background: rgb(0 0 0 / 0.5);
  backdrop-filter: blur(2px);
}

.rowdy-schema-dialog-content {
  padding: 1.5rem;
  overflow-y: auto;
  max-height: calc(100vh - 4rem);
}

.rowdy-schema-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.rowdy-schema-dialog-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: hsl(var(--rowdy-foreground));
  margin: 0;
}

.rowdy-schema-dialog-close {
  background: none;
  border: none;
  color: hsl(var(--rowdy-muted-foreground));
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--rowdy-radius-sm);
  display: inline-flex;
  transition: background var(--rowdy-transition), color var(--rowdy-transition);
}

.rowdy-schema-dialog-close:hover {
  background: hsl(var(--rowdy-accent));
  color: hsl(var(--rowdy-foreground));
}

.rowdy-schema-meta-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.rowdy-schema-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.rowdy-schema-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: hsl(var(--rowdy-foreground));
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rowdy-schema-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: hsl(var(--rowdy-muted-foreground));
}

.rowdy-schema-input {
  padding: 0.4375rem 0.625rem;
  border: 1px solid hsl(var(--rowdy-input));
  border-radius: var(--rowdy-radius-sm);
  font-size: 0.8125rem;
  background: hsl(var(--rowdy-background));
  color: hsl(var(--rowdy-foreground));
  font-family: var(--rowdy-font-sans);
  transition: border-color var(--rowdy-transition), box-shadow var(--rowdy-transition);
  width: 100%;
  box-sizing: border-box;
}

.rowdy-schema-input:focus {
  outline: none;
  border-color: hsl(var(--rowdy-ring));
  box-shadow: 0 0 0 2px hsl(var(--rowdy-ring) / 0.2);
}

.rowdy-schema-input::placeholder {
  color: hsl(var(--rowdy-muted-foreground) / 0.6);
}

.rowdy-schema-select {
  padding: 0.4375rem 0.625rem;
  border: 1px solid hsl(var(--rowdy-input));
  border-radius: var(--rowdy-radius-sm);
  font-size: 0.8125rem;
  background: hsl(var(--rowdy-background));
  color: hsl(var(--rowdy-foreground));
  font-family: var(--rowdy-font-sans);
  transition: border-color var(--rowdy-transition), box-shadow var(--rowdy-transition);
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
}

.rowdy-schema-select:focus {
  outline: none;
  border-color: hsl(var(--rowdy-ring));
  box-shadow: 0 0 0 2px hsl(var(--rowdy-ring) / 0.2);
}

.rowdy-schema-columns-section {
  margin-bottom: 1.5rem;
}

.rowdy-schema-columns-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.rowdy-schema-columns-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: hsl(var(--rowdy-foreground));
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0;
}

.rowdy-schema-column-row {
  background: hsl(var(--rowdy-muted) / 0.4);
  border: 1px solid hsl(var(--rowdy-border));
  border-radius: var(--rowdy-radius);
  padding: 0.875rem;
  margin-bottom: 0.5rem;
  animation: rowdy-fade-in 0.15s ease;
}

.rowdy-schema-column-fields {
  display: grid;
  grid-template-columns: 1fr 8rem auto auto 6rem 6rem auto;
  gap: 0.625rem;
  align-items: end;
}

.rowdy-schema-field--checkbox {
  justify-content: end;
  padding-bottom: 0.375rem;
}

.rowdy-schema-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: hsl(var(--rowdy-foreground));
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.rowdy-schema-checkbox-label input[type="checkbox"] {
  accent-color: hsl(var(--rowdy-primary));
  width: 0.9375rem;
  height: 0.9375rem;
  cursor: pointer;
}

.rowdy-schema-field--remove {
  display: flex;
  align-items: end;
  padding-bottom: 0.1875rem;
  grid-column: 7;
}

.rowdy-schema-remove-col-btn {
  background: none;
  border: none;
  color: hsl(var(--rowdy-muted-foreground));
  cursor: pointer;
  padding: 0.3125rem;
  border-radius: var(--rowdy-radius-sm);
  display: inline-flex;
  transition: background var(--rowdy-transition), color var(--rowdy-transition);
}

.rowdy-schema-remove-col-btn:hover {
  background: hsl(var(--rowdy-destructive) / 0.1);
  color: hsl(var(--rowdy-destructive));
}

.rowdy-schema-remove-col-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.rowdy-schema-inclusion-group {
  margin-top: 0.5rem;
}

.rowdy-schema-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid hsl(var(--rowdy-border));
}

.rowdy-schema-error-container {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: hsl(var(--rowdy-destructive) / 0.06);
  border: 1px solid hsl(var(--rowdy-destructive) / 0.2);
  border-radius: var(--rowdy-radius-sm);
}

.rowdy-schema-error-container:empty {
  display: none;
}

.rowdy-schema-error-msg {
  color: hsl(var(--rowdy-destructive));
  font-size: 0.8125rem;
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 48rem) {
  .rowdy-schema-column-fields {
    grid-template-columns: 1fr 1fr;
  }

  .rowdy-schema-field--remove {
    grid-column: -1;
    justify-content: end;
  }

  .rowdy-schema-meta-fields {
    grid-template-columns: 1fr;
  }
}

/* ─── Utility ───────────────────────────────────────────────── */

.hidden {
  display: none !important;
}

/* Find & Replace Dialog */
.rowdy-find-replace-dialog {
  border: 0.0625rem solid var(--rowdy-border-color);
  border-radius: 0.5rem;
  padding: 1.5rem;
  background: var(--rowdy-bg);
  box-shadow: 0 0.5rem 1.5rem var(--rowdy-shadow);
  width: 28rem;
  max-width: 90vw;
}

.rowdy-find-replace-dialog::backdrop {
  background: var(--rowdy-modal-overlay);
}

.rowdy-find-replace-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
}

.rowdy-find-replace-field {
  margin-bottom: 1rem;
}

.rowdy-find-replace-field--toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.rowdy-find-replace-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.rowdy-find-replace-label--inline {
  font-size: 0.875rem;
  cursor: pointer;
}

.rowdy-find-replace-input,
.rowdy-find-replace-select {
  width: 100%;
  padding: 0.375rem 0.5rem;
  border: 0.0625rem solid var(--rowdy-border-color);
  border-radius: 0.25rem;
  font-size: 0.875rem;
  background: var(--rowdy-bg);
}

.rowdy-find-replace-input:disabled {
  background: #f3f4f6;
  color: var(--rowdy-text-muted);
  cursor: not-allowed;
}

.rowdy-find-replace-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
