:root {
  --bg: #f2f3f5;
  --surface: #ffffff;
  --border: #c8ccd4;
  --text: #1a1d24;
  --muted: #5c6370;
  --header-bg: #e6e8ed;
  --focus: #1a5fb4;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  z-index: 100;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto;
}

.site-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.header-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.control-label {
  font-weight: 500;
}

select {
  min-height: 44px;
  padding: 0.35rem 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
  color: var(--text);
}

select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.header-meta {
  max-width: 1400px;
  margin: 0.5rem auto 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.layout {
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  min-height: calc(100dvh - 120px);
}

.sidebar {
  flex: 0 0 11rem;
  padding: 1rem 0.75rem;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar li {
  margin-bottom: 0.35rem;
}

.sidebar a {
  display: block;
  padding: 0.45rem 0.5rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 2px;
  border: 1px solid transparent;
}

.sidebar a:hover {
  background: var(--bg);
}

.sidebar a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.main {
  flex: 1;
  padding: 1rem;
  min-width: 0;
}

.panel {
  margin-bottom: 2rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 2px;
}

.panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
  font-size: 0.9375rem;
}

.overview-item {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  background: var(--bg);
}

.overview-item dt {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.overview-item dd {
  margin: 0.25rem 0 0;
}

.filter-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.table-filter {
  flex: 1;
  max-width: 20rem;
  min-height: 44px;
  padding: 0.35rem 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 2px;
}

.table-filter:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: var(--header-bg);
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.data-table th:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.data-table tbody tr:nth-child(even) {
  background: #fafbfc;
}

.empty-row td {
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 768px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
  }

  .sidebar li {
    margin: 0;
  }
}
