:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #16202f;
  --muted: #647084;
  --line: #d9e0ec;
  --accent: #126c5f;
  --accent-strong: #0a4f46;
  --warn-bg: #fff7df;
  --warn-line: #e3b84f;
  --danger: #a33131;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

h1 {
  margin: 0 0 5px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.05;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: var(--muted);
}

#refreshButton {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

#refreshButton:hover {
  background: var(--accent-strong);
}

#refreshButton:disabled {
  cursor: progress;
  opacity: 0.7;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(120px, 160px) minmax(220px, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

select,
input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 8px;
}

.tab {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

.tab.active {
  border-color: var(--accent);
  background: #e8f4f1;
  color: var(--accent-strong);
}

.status {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--warn-line);
  border-radius: 6px;
  background: var(--warn-bg);
  color: #6c4d05;
}

.status.error {
  border-color: #e0a4a4;
  background: #fff0f0;
  color: var(--danger);
}

.tableWrap {
  overflow: auto;
  max-height: calc(100vh - 235px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

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

thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f9;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}

th {
  color: #3a4556;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

th.columnFilterHeader {
  cursor: default;
  min-width: 170px;
  overflow: visible;
  position: relative;
}

.columnFilter {
  display: inline-block;
  position: relative;
}

.columnFilterButton {
  min-height: 30px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #3a4556;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 4px 7px;
}

.columnFilterButton:hover,
.columnFilterButton[aria-expanded="true"] {
  background: #dfe8f4;
}

.columnFilterMenu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 10;
  width: 260px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: 0 16px 34px rgba(22, 32, 47, 0.16);
  padding: 6px;
}

.columnFilterOption {
  display: block;
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
  padding: 6px 8px;
  text-align: left;
}

.columnFilterOption:hover,
.columnFilterOption.selected {
  background: #e8f4f1;
  color: var(--accent-strong);
}

td.rank,
th.rank {
  text-align: center;
}

tbody tr:hover {
  background: #f6faf9;
}

.muted {
  color: var(--muted);
}

.vacation {
  color: #7a4b00;
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 20px, 1480px);
    padding-top: 14px;
  }

  .topbar {
    display: block;
  }

  #refreshButton {
    width: 100%;
    margin-top: 14px;
  }

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

  .tableWrap {
    max-height: calc(100vh - 360px);
  }
}
