:root {
  --bg: #ffffff;
  --fg: #1f2328;
  --muted: #667085;
  --border: #d0d7de;
  --header-bg: #f6f8fa;
  --sticky-bg: #ffffff;
  --hover-bg: #f8fafc;
  --shadow: 2px 0 5px rgba(0,0,0,.08);

  --sticky-1-width: 180px;
  --sticky-2-width: 110px;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page { padding: 16px; }

.toolbar {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.toolbar-left h1 {
  margin: 0 0 4px;
  font-size: 20px;
}

.status {
  color: var(--muted);
  font-size: 14px;
}

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

.search-wrap input {
  width: min(360px, 70vw);
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

.button {
  display: inline-block;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--fg);
  background: var(--header-bg);
  white-space: nowrap;
}

.button:hover { border-color: #8c959f; }

.message {
  padding: 12px;
  border: 1px solid #e3b341;
  background: #fff8c5;
  border-radius: 6px;
  margin-bottom: 12px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  max-height: calc(100vh - 110px);
  border: 1px solid var(--border);
  border-radius: 6px;
}

table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: max-content;
  width: max-content;
  font-size: 14px;
}

th,
td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 7px 9px;
  vertical-align: top;
  background: var(--bg);
  white-space: nowrap;
}

th:last-child,
td:last-child { border-right: 0; }

tbody tr:last-child td { border-bottom: 0; }

thead th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--header-bg);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  user-select: none;
}

thead th:hover { background: #eef1f4; }
tbody tr:hover td { background: var(--hover-bg); }

th.sort-asc::after {
  content: " ▲";
  font-size: 10px;
}

th.sort-desc::after {
  content: " ▼";
  font-size: 10px;
}

th:nth-child(1),
td:nth-child(1) {
  position: sticky;
  left: 0;
  z-index: 3;
  width: var(--sticky-1-width);
  min-width: var(--sticky-1-width);
  max-width: var(--sticky-1-width);
  background: var(--sticky-bg);
  box-shadow: var(--shadow);
}

th:nth-child(2),
td:nth-child(2) {
  position: sticky;
  left: var(--sticky-1-width);
  z-index: 3;
  width: var(--sticky-2-width);
  min-width: var(--sticky-2-width);
  max-width: var(--sticky-2-width);
  overflow: hidden;
  text-overflow: ellipsis;
  background: var(--sticky-bg);
  box-shadow: var(--shadow);
}

thead th:nth-child(1),
thead th:nth-child(2) {
  z-index: 7;
  background: var(--header-bg);
}

tbody tr:hover td:nth-child(1),
tbody tr:hover td:nth-child(2) {
  background: var(--hover-bg);
}

.text-col {
  white-space: normal;
  min-width: 520px;
  max-width: 700px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.reason-col {
  white-space: normal;
  min-width: 260px;
  max-width: 350px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 700px) {
  :root {
    --sticky-1-width: 130px;
    --sticky-2-width: 100px;
  }

  .page { padding: 8px; }

  .table-wrap {
    max-height: calc(100vh - 150px);
  }

  .text-col {
    min-width: 360px;
    max-width: 480px;
  }

  .reason-col {
    min-width: 220px;
    max-width: 280px;
  }
}
