*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface2: #f5f5f5;
  --border: #e0e0e0;
  --border-dark: #aaaaaa;
  --text: #111111;
  --text-muted: #666666;
  --text-dim: #aaaaaa;
  --sans: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono: 'Courier New', Courier, monospace;
  --radius: 4px;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
}

.shell {
  width: 100%;
  max-width: 560px;
}

/* Header */
.header {
  margin-bottom: 32px;
}

.header h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 6px;
}

.header-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Card */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card-body {
  padding: 24px;
}

/* Schema */
.schema-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.schema-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.schema-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.schema-tag {
  font-family: var(--mono);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 2px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.schema-tag.required {
  background: var(--text);
  border-color: var(--text);
  color: #ffffff;
}

/* Drop zone */
.drop-zone {
  border: 1px dashed var(--border-dark);
  border-radius: var(--radius);
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
  background: var(--surface2);
}

.drop-zone:hover,
.drop-zone.dragover {
  background: #eeeeee;
}

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

.drop-icon {
  margin: 0 auto 10px;
  color: var(--text-muted);
}

.drop-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
}

.drop-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}

.file-chosen {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
  min-height: 18px;
}

/* Button */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 16px;
  margin-top: 16px;
  border: 1px solid var(--text);
  border-radius: var(--radius);
  background: var(--text);
  color: #ffffff;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:hover:not(:disabled) { opacity: 0.8; }
.btn:active:not(:disabled) { opacity: 0.7; }

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn .spinner {
  width: 14px;
  height: 14px;
  border: 1.5px solid rgba(255,255,255,0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.btn.loading .spinner { display: block; }

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

/* Result */
.result {
  margin-top: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: none;
}

.result.visible { display: block; }

.result-header {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.result-body {
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

.result.success .result-header { color: var(--text); }
.result.error   .result-header { color: var(--text); }

/* Card footer */
.card-footer {
  padding: 12px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.db-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}

.db-badge .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text);
}

.table-badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
}