:root {
  color-scheme: light;
  --ink: #17283f;
  --muted: #65758b;
  --line: #dce4ed;
  --paper: #ffffff;
  --canvas: #f3f6fa;
  --navy: #12243b;
  --blue: #2368a2;
  --blue-soft: #e9f2fb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 2px 8px rgba(20, 43, 67, .035);
}

.topbar-inner {
  display: flex;
  height: 100%;
  align-items: center;
}

.brand {
  flex: 0 0 auto;
  color: var(--navy);
  font-size: 18px;
  font-weight: 750;
  letter-spacing: .02em;
  text-decoration: none;
}

.primary-nav {
  height: 100%;
  margin-left: 42px;
}

.nav-dropdown { position: relative; height: 100%; }
.nav-dropdown summary {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 10px;
  padding: 0 17px;
  border-bottom: 2px solid transparent;
  color: #354a61;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}

.nav-dropdown summary::-webkit-details-marker { display: none; }
.nav-dropdown summary:hover,
.nav-dropdown[open] summary { background: #f4f7fa; color: #174e79; }
.nav-dropdown[open] summary { border-bottom-color: var(--blue); }
.nav-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .16s ease;
}

.nav-dropdown[open] .nav-chevron { transform: translateY(2px) rotate(225deg); }
.submenu {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  display: grid;
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: white;
  box-shadow: 0 10px 24px rgba(20, 43, 67, .12);
}

.submenu a {
  display: block;
  padding: 10px 12px;
  border-radius: 5px;
  color: #3d5269;
  font-size: 13px;
  text-decoration: none;
}

.submenu a:hover,
.submenu a[aria-current="page"] {
  background: var(--blue-soft);
  color: #174e79;
}

.eyebrow {
  color: #7d91a6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
}

.main-content { min-height: calc(100vh - 112px); padding: 24px 0 40px; }

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--paper);
  box-shadow: 0 3px 14px rgba(20, 43, 67, .045);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 21px 22px 16px;
}

.dark-eyebrow { color: var(--blue); }
.panel-heading h1,
.panel-heading h2 { margin: 4px 0 3px; font-size: 21px; font-weight: 700; }
.panel-copy { margin: 0; color: var(--muted); font-size: 13px; }
.log-heading { align-items: center; }

.filters {
  display: grid;
  grid-template-columns: minmax(190px, 1.5fr) minmax(170px, 1.2fr) minmax(145px, 1fr) minmax(145px, 1fr) auto;
  align-items: end;
  gap: 11px;
  padding: 15px 22px 17px;
  border-top: 1px solid #edf1f5;
  border-bottom: 1px solid #edf1f5;
  background: #fbfcfe;
}

.filter-control { display: grid; gap: 5px; min-width: 0; }
.filter-control span { color: #53647a; font-size: 12px; font-weight: 650; }
select, input[type="date"], input[type="number"] {
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid #cbd6e2;
  border-radius: 6px;
  padding: 0 9px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

select:focus, input:focus, button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(35, 104, 162, .22);
  outline-offset: 1px;
}

.secondary-button {
  height: 38px;
  border: 1px solid #cbd6e2;
  border-radius: 6px;
  padding: 0 12px;
  background: white;
  color: #344960;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.secondary-button:hover:not(:disabled) { border-color: #89a9c4; background: #f5f9fc; }
.secondary-button:disabled { cursor: not-allowed; opacity: .45; }

.field-multi { position: relative; }

.field-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 38px;
  border: 1px solid #cbd6e2;
  border-radius: 6px;
  padding: 0 10px;
  background: white;
  color: #344960;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}

.field-toggle::after {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-right: 3px;
  margin-bottom: 3px;
  border-right: 2px solid #7d91a6;
  border-bottom: 2px solid #7d91a6;
  transform: rotate(45deg);
}

.field-toggle:hover:not(:disabled) { border-color: #89a9c4; background: #f5f9fc; }
.field-toggle:disabled { cursor: not-allowed; opacity: .45; }
.field-toggle[aria-expanded="true"] { border-color: #89a9c4; }

.field-panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  display: grid;
  gap: 2px;
  max-height: 300px;
  min-width: 200px;
  overflow-y: auto;
  border: 1px solid #cbd6e2;
  border-radius: 8px;
  padding: 8px;
  background: white;
  box-shadow: 0 8px 22px rgba(20, 43, 67, .12);
}

.field-panel-actions {
  display: flex;
  gap: 6px;
  padding: 0 0 6px;
  border-bottom: 1px solid #edf1f5;
  margin-bottom: 4px;
}

.field-panel-actions button {
  border: 1px solid #cbd6e2;
  border-radius: 5px;
  padding: 3px 10px;
  background: white;
  color: #344960;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.field-panel-actions button:hover { background: #f5f9fc; border-color: #89a9c4; }

.field-panel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px;
  border-radius: 5px;
  color: #1f2937;
  font-size: 13px;
  cursor: pointer;
}

.field-panel-item:hover { background: #f5f9fc; }
.field-panel-item input { accent-color: var(--blue); }

.table-link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--blue);
  font: inherit;
  font-weight: 650;
  text-decoration: underline;
  cursor: pointer;
}

table { min-width: 920px; }

.source-links {
  display: flex;
  max-width: 360px;
  flex-wrap: wrap;
  gap: 5px;
}

.source-link {
  display: inline-block;
  border: 1px solid #d6e1ec;
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--blue);
  font-size: 11px;
  line-height: 1.45;
  text-decoration: none;
  white-space: normal;
}

.source-link:hover { background: #f4f8fc; text-decoration: underline; }
.source-details { margin-top: 5px; }
.source-details summary { color: var(--blue); font-size: 11px; cursor: pointer; }
.source-links-extra { margin-top: 5px; }

.table-scroll { position: relative; min-height: 170px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { position: sticky; top: 0; z-index: 1; }
th {
  border-top: 1px solid #dfe6ee;
  border-bottom: 1px solid #d5dee8;
  padding: 10px 12px;
  background: #eff4f8;
  color: #344b63;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
  white-space: nowrap;
}

td {
  border-bottom: 1px solid #edf1f5;
  padding: 8px 12px;
  color: #26384d;
  white-space: nowrap;
}

tbody tr:hover td { background: #f8fbfd; }
td.is-empty { background: #fafbfd; }
td:first-child { color: #4f6074; }

.empty-state {
  padding: 34px 20px;
  color: var(--muted);
  text-align: center;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px 18px;
}

.pagination span { min-width: 72px; color: var(--muted); font-size: 12px; text-align: center; }
.page-jump { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.page-jump span { min-width: 0; }
.page-jump input { width: 72px; padding: 0 7px; }
.page-jump input:disabled { background: #f3f5f7; }
.load-error { padding: 14px 22px; color: #9a2b22; }

.download-content { padding: 0 22px 24px; }
.download-content p { max-width: 720px; margin: 0 0 18px; color: #596d82; font-size: 14px; }
.primary-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  border: 1px solid #1a5c8c;
  border-radius: 6px;
  padding: 0 16px;
  background: #1f679b;
  color: white;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.primary-button:hover { background: #174f79; }
.primary-button span { font-size: 19px; line-height: 1; }
.log-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 22px 10px;
  color: var(--muted);
  font-size: 12px;
}

.log-table-scroll { min-height: 220px; }
.log-table-scroll table { min-width: 980px; }
.log-table-scroll td { white-space: normal; vertical-align: top; }
.log-field { min-width: 210px; }
.log-source { display: block; margin-top: 3px; color: #718196; font-size: 11px; }
.log-status {
  display: inline-block;
  border-radius: 99px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.log-status.success { background: #e9f5ed; color: #27633b; }
.log-status.partial { background: #fff4dd; color: #805719; }
.log-status.failed { background: #fbe9e8; color: #943c36; }
.log-status.unknown { background: #edf0f3; color: #5e6a78; }
.log-error-text { color: #963f38; }

.sources {
  margin: 4px 0 18px;
  padding: 14px 18px;
  border: 1px solid #d9e0e8;
  border-radius: 8px;
  background: #f5f7fa;
  color: #67707e;
  font-size: 12px;
  line-height: 1.7;
}

.sources h2 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #4a5462;
  letter-spacing: 0.04em;
}

.sources p { margin: 0 0 6px; }
.sources p:last-child { margin-bottom: 0; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 0 0 24px;
  color: #748196;
  font-size: 11px;
}

.footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

@media (max-width: 860px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .secondary-button { width: 100%; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 24px, 1180px); }
  .topbar { height: 58px; }
  .brand { font-size: 16px; }
  .primary-nav { margin-left: auto; }
  .nav-dropdown summary { padding: 0 10px; font-size: 13px; }
  .submenu { right: 0; left: auto; min-width: 205px; }
  .main-content { padding-top: 15px; }
  .panel-heading { padding: 17px 14px 13px; }
  .panel-heading h1,
  .panel-heading h2 { font-size: 19px; }
  .filters { gap: 9px; padding: 13px 14px; }
  .download-content { padding: 0 14px 18px; }
  .log-meta { padding-right: 14px; padding-left: 14px; }
  .pagination { gap: 7px; padding-right: 12px; padding-left: 12px; }
  .footer { flex-direction: column; gap: 4px; }
}
