:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-muted: #eef1ed;
  --ink: #17201d;
  --muted: #66716d;
  --line: #d8ded9;
  --accent: #087f6b;
  --accent-dark: #056252;
  --accent-soft: #d9efe9;
  --amber: #a85f00;
  --amber-soft: #fff0d8;
  --focus: #006bd6;
  --shadow: 0 18px 45px rgba(26, 42, 36, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select {
  cursor: pointer;
}

a {
  color: inherit;
}

.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;
}

.site-header {
  border-bottom: 1px solid rgba(216, 222, 217, 0.85);
  background: rgba(244, 245, 242, 0.94);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.header-inner {
  width: min(1180px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
  font-size: 20px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.report-link {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
  text-underline-offset: 4px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}
.visitor-logout button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.visitor-logout button:hover { color: var(--ink); }

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

.intro {
  min-height: 286px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 56px;
  padding: 56px 0 42px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 16px;
  font-size: 42px;
  line-height: 1.14;
}

.intro-copy {
  max-width: 690px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.75;
}

.summary {
  min-width: 310px;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary div {
  padding: 20px 16px;
  text-align: center;
}

.summary div + div {
  border-left: 1px solid var(--line);
}

.summary dt {
  color: var(--muted);
  font-size: 12px;
}

.summary dd {
  margin: 7px 0 0;
  font-size: 19px;
  font-weight: 800;
  white-space: nowrap;
}

.browser {
  margin-bottom: 56px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.browser-heading {
  min-height: 80px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.browser-heading h2 {
  margin-bottom: 5px;
  font-size: 20px;
}

.browser-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  width: 38px;
  height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.search-row {
  padding: 22px 24px 14px;
}

.search-field {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid #aeb8b2;
  background: #fff;
}

.search-field:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(0, 107, 214, 0.12);
}

.search-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border: 2px solid var(--muted);
  border-radius: 50%;
  position: relative;
}

.search-icon::after {
  content: "";
  width: 7px;
  height: 2px;
  background: var(--muted);
  position: absolute;
  right: -6px;
  bottom: -3px;
  transform: rotate(45deg);
}

.search-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
}

kbd {
  padding: 2px 7px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
}

.filters {
  padding: 0 24px 18px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.filters label {
  min-width: 0;
}

.filters label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filters select {
  width: 100%;
  height: 40px;
  padding: 0 34px 0 11px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
}

.active-filters {
  min-height: 0;
  padding: 0 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.active-filters:not(:empty) {
  padding-bottom: 18px;
}

.filter-chip {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #b8d9d1;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.table-wrap {
  min-height: 400px;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

th {
  padding: 12px 14px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

th:first-child,
td:first-child {
  padding-left: 24px;
  width: 49%;
}

th:nth-child(2) {
  width: 18%;
}

th:nth-child(3) {
  width: 9%;
}

.size-column {
  width: 12%;
  text-align: right;
}

.action-column {
  width: 12%;
}

td {
  height: 67px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
  font-size: 13px;
}

tbody tr:hover {
  background: #fafcfb;
}

.file-cell {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.type-tile {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #b8d9d1;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 9px;
  font-weight: 900;
  overflow: hidden;
}

.file-copy {
  min-width: 0;
}

.file-name {
  max-width: 100%;
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name:hover {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.file-path {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-name {
  overflow: hidden;
  display: block;
  color: #43504b;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-type {
  display: inline-block;
  max-width: 100%;
  padding: 4px 7px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 10px;
  font-weight: 900;
  text-overflow: ellipsis;
}

.file-size {
  display: block;
  text-align: right;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.detail-button,
.download-button {
  min-width: 34px;
  height: 32px;
  padding: 0 9px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  text-decoration: none;
}

.download-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.detail-button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.download-button:hover {
  background: var(--accent-dark);
}

.empty-state {
  padding: 76px 24px;
  text-align: center;
}

.empty-state strong {
  font-size: 18px;
}

.empty-state p {
  margin: 9px 0 18px;
  color: var(--muted);
}

.empty-state button,
.dialog-actions button,
.dialog-actions a {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  font-weight: 700;
  text-decoration: none;
}

.pagination {
  min-height: 60px;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.pagination button {
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #fff;
  font-size: 20px;
}

.pagination button:disabled {
  cursor: default;
  opacity: 0.4;
}

.pagination span {
  min-width: 110px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

dialog {
  width: min(650px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(16, 30, 24, 0.24);
}

dialog::backdrop {
  background: rgba(14, 24, 20, 0.5);
}

.dialog-head {
  padding: 20px 22px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin: 9px 0 0;
  overflow-wrap: anywhere;
  font-size: 19px;
}

.file-details {
  margin: 0;
  padding: 8px 22px;
}

.file-details div {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.file-details dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.file-details dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.file-details code {
  color: #33413b;
  font-family: Consolas, monospace;
  font-size: 11px;
}

.dialog-actions {
  padding: 18px 22px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions .primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 0 0 36px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(0, 107, 214, 0.28);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .intro {
    min-height: 0;
    align-items: stretch;
    flex-direction: column;
    gap: 28px;
  }

  .summary {
    min-width: 0;
  }

  .filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  th:first-child,
  td:first-child {
    width: 58%;
  }

  th:nth-child(2),
  td:nth-child(2) {
    display: none;
  }

  th:nth-child(3) {
    width: 10%;
  }

  .size-column {
    width: 15%;
  }

  .action-column {
    width: 17%;
  }
}

@media (max-width: 640px) {
  .header-inner,
  main,
  footer {
    width: min(100% - 24px, 1180px);
  }

  .brand small {
    display: none;
  }

  .report-link {
    font-size: 12px;
  }

  .intro {
    padding: 38px 0 30px;
  }

  h1 {
    font-size: 31px;
  }

  .intro-copy {
    font-size: 14px;
  }

  .summary div {
    padding: 15px 8px;
  }

  .summary dd {
    font-size: 15px;
  }

  .browser {
    margin-left: -12px;
    margin-right: -12px;
    border-left: 0;
    border-right: 0;
  }

  .browser-heading,
  .search-row,
  .filters,
  .active-filters {
    padding-left: 14px;
    padding-right: 14px;
  }

  .filters {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  kbd {
    display: none;
  }

  thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tbody tr {
    padding: 14px;
    border-top: 1px solid var(--line);
    position: relative;
  }

  td {
    height: auto;
    padding: 0;
    border: 0;
  }

  td:first-child {
    width: 100%;
    padding: 0 86px 10px 0;
  }

  td:nth-child(2),
  td:nth-child(3),
  td:nth-child(4) {
    display: inline-block;
    width: auto;
    margin-right: 8px;
    color: var(--muted);
  }

  td:nth-child(3) .file-type {
    padding: 2px 6px;
  }

  .file-size {
    text-align: left;
  }

  td:last-child {
    width: auto;
    position: absolute;
    top: 14px;
    right: 14px;
  }

  .file-path {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .detail-button {
    display: none;
  }

  .pagination {
    justify-content: center;
  }

  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-actions button,
  .dialog-actions a {
    text-align: center;
  }
}

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