:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1d2430;
  background: #f4f5f7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f4f5f7;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1280px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 16px 18px;
  border: 1px solid #d8dce3;
  border-radius: 8px;
  background: #ffffff;
}

h1,
h2,
h3,
p,
dl,
dd {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
  line-height: 1.3;
}

h3 {
  margin: 16px 0 8px;
  font-size: 13px;
}

.status-line,
.muted,
.file-status {
  color: #657083;
  font-size: 13px;
}

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.control-panel,
.main-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.control-panel {
  position: sticky;
  top: 14px;
}

.panel {
  min-width: 0;
  border: 1px solid #d8dce3;
  border-radius: 8px;
  background: #ffffff;
  padding: 16px;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 10px;
  background: #e9f6ef;
  color: #167246;
  font-size: 12px;
  font-weight: 600;
}

button {
  min-height: 38px;
  border: 1px solid #bfc6d1;
  border-radius: 6px;
  padding: 0 14px;
  background: #ffffff;
  color: #1d2430;
  cursor: pointer;
}

button:hover {
  border-color: #8894a7;
  background: #f8fafc;
}

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

button.danger {
  border-color: #b64a55;
  background: #b73545;
  color: #ffffff;
}

button.danger:hover {
  background: #9f2d3b;
}

.file-picker,
.side-inputs label {
  display: grid;
  gap: 8px;
  color: #3a4352;
  font-size: 13px;
}

.config-actions {
  display: grid;
  gap: 8px;
  margin: 12px 0 14px;
}

input[type="file"],
input[type="number"] {
  width: 100%;
  min-width: 0;
  border: 1px solid #cbd1db;
  border-radius: 6px;
  background: #ffffff;
  color: #1d2430;
}

input[type="file"] {
  padding: 9px;
}

input[type="number"] {
  height: 38px;
  padding: 0 10px;
}

.file-status {
  margin-top: 10px;
  overflow-wrap: anywhere;
}

.schema-note {
  margin-top: 10px;
  border: 1px solid #e1e5eb;
  border-radius: 6px;
  padding: 9px 10px;
  background: #fbfcfd;
  color: #657083;
  font-size: 12px;
  line-height: 1.45;
}

code {
  border-radius: 4px;
  padding: 1px 4px;
  background: #edf0f4;
  color: #273142;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.side-inputs {
  display: grid;
  gap: 12px;
}

.button-stack {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.match-panel {
  border-left: 4px solid #16a36a;
}

.match-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 18px;
  align-items: start;
}

.match-code {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.15;
}

.options {
  margin-top: 8px;
  color: #3a4352;
  line-height: 1.45;
}

.match-facts {
  display: grid;
  gap: 8px;
}

.match-facts div {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 8px;
  min-height: 28px;
  align-items: center;
  border-bottom: 1px solid #edf0f4;
}

dt {
  color: #657083;
  font-size: 12px;
}

dd {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
  font-size: 13px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid #e4e8ee;
  padding: 10px 9px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #4b5567;
  background: #f7f8fa;
  font-weight: 650;
}

td {
  overflow-wrap: anywhere;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
}

.badge.ok {
  background: #e9f6ef;
  color: #167246;
}

.badge.muted-badge {
  background: #edf0f4;
  color: #657083;
}

.option-strip {
  margin-bottom: 12px;
  border: 1px solid #d8dce3;
  border-radius: 6px;
  padding: 10px 12px;
  background: #fbfcfd;
  color: #273142;
  line-height: 1.45;
}

.empty-state {
  color: #657083;
  font-size: 13px;
}

pre {
  min-height: 132px;
  max-height: 360px;
  overflow: auto;
  margin: 0;
  border: 1px solid #e1e5eb;
  border-radius: 6px;
  padding: 12px;
  background: #fbfcfd;
  color: #273142;
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .app-shell {
    width: min(100vw - 18px, 1280px);
    padding-top: 10px;
  }

  .topbar,
  .match-card,
  .control-panel {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar {
    align-items: start;
  }

  .match-facts div {
    grid-template-columns: 84px minmax(0, 1fr);
  }
}
