:root {
  --bg: #0b0f14;
  --panel: #10161e;
  --panel-2: #0e131a;
  --text: #e6edf3;
  --muted: #9fb3c8;
  --accent: #2ea043;
  --danger: #ff5d5d;
  --border: #1f2733;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial, sans-serif;
}

.app-header { padding: 24px 16px 8px; text-align: center; }
.app-header h1 { margin: 0; font-size: 24px; }
.subtitle { margin: 6px 0 0; color: var(--muted); }

.container {
  max-width: min(1200px, 100vw - 32px);
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 1000px) {
  .container { grid-template-columns: 1fr 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.panel-header h2 { margin: 0; font-size: 16px; }
.options { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.options > * { min-width: 0; }
.options .inline { color: var(--muted); font-size: 12px; }
.options select { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.drop-zone.dragover { border-color: var(--accent); color: var(--text); }

.code {
  width: 100%;
  max-width: 100%;
  min-height: 280px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
}

.actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.status { color: var(--muted); margin-left: 8px; }
.error { margin-top: 8px; color: #fff; background: #2c0f14; border: 1px solid #5b1a24; padding: 8px 10px; border-radius: 6px; }

button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}
button.primary { background: var(--accent); color: #031; border-color: #2a8a3a; }
button.ghost { background: transparent; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.footer { text-align: center; color: var(--muted); padding: 16px; }

/* CSV preview table */
.table-wrapper {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: auto;
  max-height: 320px;
  background: var(--panel-2);
}
.table-wrapper table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}
.table-wrapper thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}
.table-wrapper th, .table-wrapper td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}
.table-wrapper th:last-child, .table-wrapper td:last-child { border-right: none; }
