:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-soft: #eef5f2;
  --ink: #17212f;
  --muted: #647184;
  --line: #d9e2ea;
  --accent: #0f7b6c;
  --accent-dark: #0a5f55;
  --danger: #a51d3a;
  --shadow: 0 12px 30px rgba(24, 39, 59, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  background: #17212f;
  color: #fff;
  border-bottom: 4px solid var(--accent);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 17px;
}

.topbar span,
.tableHeader span {
  color: #cbd5df;
  font-size: 13px;
}

.workspace {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 18px 16px 34px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(140px, 1fr) minmax(170px, 1.2fr) auto auto auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
select,
button,
.filePicker span {
  min-height: 42px;
  font-size: 15px;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

select:focus {
  border-color: var(--accent);
}

button,
.filePicker span {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: .52;
}

.primary,
.filePicker span {
  background: var(--accent);
  color: #fff;
}

.primary:hover:not(:disabled),
.filePicker span:hover {
  background: var(--accent-dark);
}

.ghost {
  background: #dde6ee;
  color: var(--ink);
}

.ghost:hover {
  background: #cfdbe6;
}

.filePicker input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.check {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: nowrap;
}

.check input {
  min-height: 0;
  width: 16px;
  height: 16px;
}

.summaryGrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric,
.message,
.tableShell {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.metric strong {
  font-size: 28px;
}

.message {
  margin-bottom: 14px;
  padding: 14px 16px;
  color: var(--muted);
}

.message.error {
  color: var(--danger);
}

.tableShell {
  overflow: hidden;
}

.tableHeader {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 13px 14px;
  background: #202c3a;
  color: #fff;
}

.tableWrap,
.previewSections {
  overflow: auto;
  max-height: calc(100vh - 305px);
  min-height: 280px;
}

.previewSections {
  display: grid;
  align-content: start;
  background: var(--surface);
}

.previewGroup {
  border-bottom: 1px solid var(--line);
}

.previewGroupHeader {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  background: #202c3a;
  color: #fff;
}

.previewGroupHeader strong {
  font-size: 15px;
}

.previewGroupHeader span {
  color: #cbd5df;
  font-size: 13px;
}

.previewTableWrap {
  overflow: auto;
}

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

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-soft);
  color: #314254;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  background: var(--surface);
}

tr:hover td {
  background: #f7fbfa;
}

.empty {
  height: 180px;
  text-align: center;
  color: var(--muted);
}

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

  .summaryGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar .primary {
    width: 100%;
  }

  .toolbar,
  .summaryGrid {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding-inline: 10px;
  }
}
