:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1f2933;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #176b87;
  --accent-dark: #0f5168;
  --soft: #edf6f8;
  --warn: #8a5a00;
  --bad: #9f2a2a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 28px;
}

.topbar,
.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
}

h2 {
  font-size: 18px;
  margin-bottom: 18px;
}

p,
.summary,
.status {
  color: var(--muted);
  margin-top: 8px;
}

.workspace {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  margin-top: 28px;
}

.panel,
.result {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

.upload-grid {
  display: grid;
  gap: 14px;
}

.filebox {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

input[type="file"] {
  width: 100%;
  border: 1px dashed var(--line);
  border-radius: 6px;
  background: #fafbfc;
  padding: 12px;
}

button,
.link-button {
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 650;
  text-decoration: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.primary {
  background: var(--accent);
  color: #ffffff;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  background: var(--soft);
  color: var(--accent-dark);
  margin-top: 16px;
}

.preview-button {
  margin-top: 0;
  width: max-content;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.doc-settings {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.doc-title,
.field-title {
  font-weight: 700;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 10px;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
}

.checkline input {
  width: 16px;
  height: 16px;
}

.option {
  margin-top: 18px;
}

.field-list {
  border: 1px solid var(--line);
  border-radius: 6px;
  max-height: 230px;
  overflow: auto;
  padding: 8px;
}

.field-list label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
  padding: 6px;
}

.field-list input {
  width: 15px;
  height: 15px;
}

.hidden {
  display: none;
}

.result {
  margin-top: 20px;
}

.table-wrap {
  margin-top: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  max-height: 520px;
}

table {
  border-collapse: collapse;
  min-width: 100%;
  background: #ffffff;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px 10px;
  vertical-align: top;
  white-space: nowrap;
}

th {
  background: #22384f;
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
}

.status.error {
  color: var(--bad);
}

.badge-exact {
  color: #23612f;
  font-weight: 700;
}

.badge-fuzzy {
  color: var(--warn);
  font-weight: 700;
}

.badge-missing {
  color: var(--bad);
  font-weight: 700;
}

@media (max-width: 900px) {
  .shell {
    padding: 18px;
  }

  .topbar,
  .result-head,
  .workspace,
  .settings-grid {
    grid-template-columns: 1fr;
    display: grid;
  }
}
