* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: #f3f5f7;
  color: #112233;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(120deg, #0d2740 0%, #194f69 100%);
  color: #fff;
}

.top-help {
  margin: 0;
  padding: 0.45rem 1.25rem 0.65rem;
  font-size: 0.8rem;
  color: #43576a;
  background: #eef4f9;
  border-bottom: 1px solid #d8e3ee;
}

.topbar h1 {
  margin: 0;
  font-size: 1.2rem;
}

.live-controls {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  font-size: 0.9rem;
}

.topbar .live-controls label {
  color: #f2f8ff;
  font-weight: 600;
}

.topbar .live-controls input[type="checkbox"] {
  accent-color: #7fd0ff;
}

.live-controls input[type="number"] {
  width: 60px;
  color: #0f2a42;
  background: #ffffff;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.8rem;
  padding: 1rem 1.25rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field.full {
  grid-column: span 2;
}

.field.compact {
  justify-content: flex-end;
}

label {
  font-size: 0.8rem;
  color: #31465b;
}

input,
select,
button {
  border: 1px solid #c4ced8;
  border-radius: 6px;
  padding: 0.5rem 0.55rem;
  font-size: 0.9rem;
  background: #fff;
}

button {
  cursor: pointer;
  background: #0d5a8f;
  color: #fff;
  border-color: #0d5a8f;
}

button.ghost {
  background: #eef4fa;
  color: #1e486d;
  border-color: #bfd0e2;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
  padding: 0 1.25rem 0.8rem;
}

.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0 1.25rem 0.8rem;
}

.pager-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pager-controls input[type="number"] {
  width: 70px;
  text-align: center;
}

#page-info {
  margin: 0;
  font-size: 0.82rem;
  color: #42586e;
}

.stat {
  background: #fff;
  border: 1px solid #d8e0e8;
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
}

.stat span {
  display: block;
  font-size: 0.74rem;
  color: #506377;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.95rem;
}

.table-wrap {
  padding: 0 1.25rem 1rem;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #d8e0e8;
  table-layout: fixed;
}

thead th {
  position: sticky;
  top: 0;
  background: #eaf0f6;
  border-bottom: 1px solid #d1dae3;
  padding: 0.5rem;
  font-size: 0.8rem;
  text-align: left;
  color: #16324a;
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}

thead th.sortable {
  cursor: pointer;
  user-select: none;
}

thead th.sortable:hover {
  background: #dde9f3;
}

thead th.active-sort {
  background: #d3e3f1;
  color: #0d2f4b;
}

.sort-indicator {
  display: inline-block;
  min-width: 1em;
  margin-left: 0.2rem;
  color: #5a738b;
}

tbody td {
  border-bottom: 1px solid #eef2f6;
  padding: 0.45rem 0.5rem;
  font-size: 0.8rem;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

tbody tr:nth-child(odd) {
  background: #fbfdff;
}

tbody tr:hover {
  background: #eef5fb;
}

.status {
  padding: 0 1.25rem 1rem;
  margin: 0;
  font-size: 0.82rem;
  color: #42586e;
}

@media (max-width: 800px) {
  .field.full {
    grid-column: span 1;
  }

  .pagination {
    flex-direction: column;
    align-items: flex-start;
  }
}
