:root {
  --bg: #0f172a;
  --card: #111827;
  --card-2: #162033;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: #253044;
  --primary: #38bdf8;
  --primary-dark: #0284c7;
  --success: #22c55e;
  --error: #ef4444;
  --warn: #f59e0b;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 0%, rgba(56, 189, 248, 0.16), transparent 34rem),
    radial-gradient(circle at 80% 10%, rgba(34, 197, 94, 0.12), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: var(--primary);
}

.container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.narrow {
  width: min(720px, calc(100% - 32px));
}

.wide {
  width: min(1280px, calc(100% - 32px));
}

.card {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(15, 23, 42, 0.96));
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.hero {
  margin-top: 56px;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  margin-top: 8px;
  font-size: clamp(34px, 5vw, 56px);
}

h2 {
  font-size: 22px;
}

.muted {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.92);
  color: var(--text);
  font: inherit;
  outline: none;
  padding: 13px 14px;
}

textarea,
pre {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
}

input:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

button,
.as-button {
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  min-height: 46px;
  padding: 0 18px;
  text-decoration: none;
  white-space: nowrap;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.secondary {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  border: 1px solid var(--border);
}

.message {
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 12px 14px;
  background: rgba(148, 163, 184, 0.12);
}

.message.success {
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.12);
}

.message.error {
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.12);
}

.message.info {
  color: #bae6fd;
  border-color: rgba(56, 189, 248, 0.45);
  background: rgba(56, 189, 248, 0.12);
}

.hidden {
  display: none !important;
}

.result,
.result-head {
  margin-top: 20px;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.result-head.no-margin {
  margin-top: 0;
}

.download-only {
  width: 100%;
  min-height: 58px;
  font-size: 18px;
}

pre {
  overflow: auto;
  max-height: 520px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(2, 6, 23, 0.72);
  padding: 16px;
}

.small-pre {
  min-height: 260px;
  white-space: pre-wrap;
}

.foot-link {
  margin-top: 18px;
  text-align: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stats-grid,
.grid.two {
  display: grid;
  gap: 18px;
}

.stats-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stat {
  background: rgba(17, 24, 39, 0.72);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
}

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

.stat .value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 800;
}

.grid.two {
  grid-template-columns: 1.15fr 0.85fr;
  align-items: start;
  margin-bottom: 18px;
}

.import-card {
  margin-bottom: 18px;
}

.drop-zone {
  position: relative;
  display: grid;
  gap: 8px;
  place-items: center;
  min-height: 150px;
  border: 2px dashed rgba(56, 189, 248, 0.45);
  border-radius: 20px;
  background: rgba(56, 189, 248, 0.08);
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.drop-zone strong {
  color: var(--text);
  font-size: 18px;
}

.drop-zone.dragging {
  border-color: var(--primary);
  background: rgba(56, 189, 248, 0.16);
}

.drop-zone input {
  display: none;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.table-wrap {
  overflow: auto;
}

.batch-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
}

.checkline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  cursor: pointer;
}

.checkline input,
.select-col input {
  width: 18px;
  height: 18px;
}

.select-col {
  width: 58px;
  text-align: center;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

td.code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-weight: 700;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 12px;
}

.payload-list {
  display: grid;
  gap: 10px;
}

.payload-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.badge {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 9px;
}

.badge.active {
  background: rgba(34, 197, 94, 0.14);
  color: #bbf7d0;
}

.badge.disabled {
  background: rgba(239, 68, 68, 0.14);
  color: #fecaca;
}

@media (max-width: 920px) {
  .stats-grid,
  .grid.two,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .result-head {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    flex-direction: column;
    align-items: stretch;
  }
}
