:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #17141f;
  --muted: #6f6a78;
  --border: #e4e7ef;
  --accent: #7107e7;
  --accent-dark: #5103aa;
  --danger: #b42318;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

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

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

h1, h2, p { margin-top: 0; }
h1 { font-size: clamp(32px, 5vw, 56px); line-height: 1; margin-bottom: 10px; }
h2 { font-size: 22px; margin-bottom: 16px; }
.eyebrow { color: var(--accent); font-weight: 900; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(26, 22, 36, .06);
  padding: 22px;
  margin-bottom: 18px;
}

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

.form-grid.compact {
  grid-template-columns: minmax(0, 360px) auto;
  justify-content: start;
}

label {
  display: grid;
  gap: 7px;
  font-weight: 800;
  font-size: 13px;
}

input, select {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.checkbox-label input {
  min-height: auto;
  width: 18px;
  height: 18px;
}

textarea.code-output {
  width: 100%;
  min-height: 300px;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  color: var(--text);
  background: #fbfcff;
  resize: vertical;
}

button {
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 0 18px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-dark); }
.secondary { background: #f0e7ff; color: var(--accent-dark); }
.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.message { color: var(--danger); font-weight: 700; min-height: 20px; }

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

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th, td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 13px; vertical-align: top; }
th { background: #fafbfe; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #fbf8ff; }

.pager { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.history {
  display: grid;
  gap: 10px;
}
.history-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fbfcff;
}

@media (max-width: 820px) {
  .shell { width: min(100% - 20px, 1180px); padding: 18px 0; }
  .topbar { display: grid; }
  .form-grid, .form-grid.compact { grid-template-columns: 1fr; }
  .panel { padding: 16px; border-radius: 14px; }
}
