:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #edf2f7;
  --line: #d8dee8;
  --text: #16202e;
  --muted: #5b6878;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --green: #7fe092;
  --peach: #f6dfd1;
  --yellow: #f3f7bc;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1200px, calc(100vw - 32px));
  margin: 24px auto;
}

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

.topbar,
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

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

.status {
  min-height: 22px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

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

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.button,
.tab,
.file-row,
.file-remove {
  min-height: 38px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.button {
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 700;
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--blue-2);
}

.button.secondary:hover,
.tab:hover,
.file-row:hover,
.file-remove:hover {
  border-color: #a9b5c5;
}

.upload-zone {
  position: relative;
  border: 2px dashed #aab8ca;
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 120ms ease, background 120ms ease;
}

.upload-zone.dragging {
  border-color: var(--blue);
  background: #eef4ff;
}

.upload-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-zone label {
  display: grid;
  gap: 6px;
  min-height: 112px;
  place-items: center;
  padding: 20px;
  text-align: center;
  color: var(--muted);
}

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

.file-list-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.file-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.file-list-header span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.file-strip {
  display: grid;
  gap: 8px;
  max-height: 220px;
  overflow: auto;
  padding: 12px;
}

.file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  text-align: left;
}

.file-row.active {
  border-color: var(--blue);
  color: var(--blue);
}

.file-row.failed {
  border-color: #f4b4ad;
  color: var(--danger);
}

.file-main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.file-meta {
  color: var(--muted);
  font-size: 13px;
}

.file-status {
  font-size: 13px;
  font-weight: 800;
}

.file-remove {
  display: grid;
  width: 38px;
  padding: 0;
  place-items: center;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
}

.file-strip-empty {
  display: grid;
  min-height: 64px;
  place-items: center;
  color: var(--muted);
  font-size: 14px;
}

.result-area {
  display: grid;
  gap: 12px;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  padding: 0 22px;
  border-radius: 8px;
  font-size: 20px;
  font-weight: 800;
}

.tab.active {
  border-color: var(--blue);
  color: var(--blue);
}

.table-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.table-toolbar {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  min-height: 260px;
  max-height: calc(100vh - 360px);
  overflow: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 15px;
}

th,
td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
  user-select: none;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  font-weight: 800;
}

td.number,
th.number {
  text-align: right;
}

td.selected,
th.selected {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
  background: #dce9ff;
}

.summary-mouse {
  background: var(--green);
}

.summary-rat {
  background: var(--peach);
}

.summary-human {
  background: var(--yellow);
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 1200px);
    margin: 10px auto;
  }

  .topbar,
  .table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .button,
  .tab,
  .file-row,
  .file-remove {
    min-height: 42px;
  }

  .tab {
    flex: 1;
    padding-inline: 12px;
    font-size: 17px;
  }

  .tabs,
  .actions {
    width: 100%;
  }

  .actions .button {
    flex: 1;
  }
}
