:root {
  --bg: #050816;
  --bg-elevated: #0b1020;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.12);
  --accent-strong: rgba(59, 130, 246, 0.35);
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --border-subtle: rgba(148, 163, 184, 0.3);
  --danger: #f97373;
  --radius-lg: 18px;
  --radius-sm: 10px;
  --shadow-soft: 0 22px 45px rgba(15, 23, 42, 0.55);
  --shadow-subtle: 0 0 0 1px rgba(148, 163, 184, 0.2);
  --transition-fast: 150ms ease-out;
  --transition-med: 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #1e293b 0, #020617 50%, #000 100%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1120px;
  margin: 32px auto;
  padding: 0 20px 32px;
}

.app-header {
  text-align: left;
  margin-bottom: 24px;
}

.app-header h1 {
  font-size: 32px;
  letter-spacing: -0.03em;
  margin: 0 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.app-header h1::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 8px;
  background: conic-gradient(from 180deg, #3b82f6, #22c55e, #eab308, #3b82f6);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.9);
}

.app-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.app-main {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.1fr);
  gap: 20px;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .app-main {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card {
  background: radial-gradient(circle at top, rgba(59, 130, 246, 0.18), transparent 55%),
    linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.98));
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow-soft), var(--shadow-subtle);
  border: 1px solid rgba(148, 163, 184, 0.4);
  backdrop-filter: blur(20px) saturate(150%);
}

.card h2 {
  font-size: 17px;
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card h2::before {
  content: "";
  width: 5px;
  height: 18px;
  border-radius: 999px;
  background: linear-gradient(180deg, #3b82f6, #22c55e);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.field-group label {
  font-size: 13px;
  color: var(--text-muted);
}

.field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

@media (max-width: 640px) {
  .field-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: radial-gradient(circle at top left, rgba(30, 64, 175, 0.2), transparent 60%),
    #020617;
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast), transform 120ms ease-out;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.6), 0 0 0 12px rgba(37, 99, 235, 0.16);
  background: radial-gradient(circle at top left, rgba(30, 64, 175, 0.32), transparent 70%),
    #020617;
}

input[type="file"] {
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  border: 1px dashed rgba(148, 163, 184, 0.7);
  background: linear-gradient(
      135deg,
      rgba(30, 64, 175, 0.35),
      rgba(37, 99, 235, 0.22),
      rgba(15, 23, 42, 0.95)
    ),
    #020617;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
  transition: border-color var(--transition-fast), background var(--transition-fast),
    transform 120ms ease-out, box-shadow var(--transition-fast);
}

input[type="file"]:hover {
  border-color: rgba(59, 130, 246, 0.95);
  background: linear-gradient(
      135deg,
      rgba(30, 64, 175, 0.5),
      rgba(37, 99, 235, 0.38),
      rgba(15, 23, 42, 0.96)
    ),
    #020617;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.8);
  transform: translateY(-1px);
}

input[type="file"]::-webkit-file-upload-button {
  padding: 6px 12px;
  margin-right: 6px;
  border-radius: 999px;
  border: none;
  background: rgba(15, 23, 42, 0.96);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.checkbox-group {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.checkbox-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.checkbox-group label {
  margin: 0;
}

.primary-btn,
.ghost-btn {
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  outline: none;
  transition: background var(--transition-med), color var(--transition-med),
    box-shadow var(--transition-med), transform 120ms ease-out, border-color var(--transition-med);
}

.primary-btn {
  background: radial-gradient(circle at 10% 0, #60a5fa, #2563eb);
  color: white;
  margin-top: 4px;
  box-shadow: 0 16px 32px rgba(37, 99, 235, 0.65);
}

.primary-btn:hover:not(:disabled) {
  background: radial-gradient(circle at 10% 0, #93c5fd, #2563eb);
  box-shadow: 0 22px 40px rgba(37, 99, 235, 0.9);
  transform: translateY(-1px);
}

.primary-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.7);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.ghost-btn {
  background: rgba(15, 23, 42, 0.9);
  color: var(--text-muted);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.ghost-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: rgba(148, 163, 184, 0.9);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.9);
  transform: translateY(-1px);
}

.results-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

textarea {
  resize: vertical;
  min-height: 230px;
  font-family: ui-monospace, Menlo, Monaco, "SF Mono", "Roboto Mono", monospace;
  line-height: 1.5;
}

.status {
  font-size: 12px;
  color: var(--text-muted);
  min-height: 16px;
  margin-top: 6px;
}

.status--error {
  color: var(--danger);
}

.status--success {
  color: #4ade80;
}

.preview-section {
  margin-top: 12px;
}

.preview-header-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.preview-header-row h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.preview-info {
  font-size: 11px;
  color: var(--text-muted);
}

.preview-table-wrapper {
  max-height: 200px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: radial-gradient(circle at top left, rgba(30, 64, 175, 0.17), transparent 70%),
    rgba(15, 23, 42, 0.96);
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.preview-table thead {
  background: rgba(15, 23, 42, 0.95);
  position: sticky;
  top: 0;
  z-index: 1;
}

.preview-table th,
.preview-table td {
  padding: 4px 8px;
  border-bottom: 1px solid rgba(30, 64, 175, 0.45);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.preview-table th {
  text-align: left;
  font-weight: 500;
  color: #e5e7eb;
}

.preview-table td {
  color: #cbd5f5;
}

.preview-table tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.85);
}

.preview-table tr:hover td {
  background: rgba(30, 64, 175, 0.6);
}

.column-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.column-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.5);
  font-size: 11px;
  color: var(--text-muted);
}

.column-pill input[type="checkbox"] {
  width: 13px;
  height: 13px;
}

.column-pill span {
  max-width: 120px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.db-result {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.96);
  color: var(--text-muted);
  font-size: 11px;
  max-height: 220px;
  overflow: auto;
  font-family: ui-monospace, Menlo, Monaco, "SF Mono", "Roboto Mono", monospace;
}

.app-footer {
  margin-top: 20px;
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-footer::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.7);
}

