:root {
  --page-bg: #f1f1f1;
  --paper: #ffffff;
  --ink: #111111;
  --border: #222222;
  --muted: #555555;
  --soft: #f2f2f2;
  --head: #eeeeee;
  --stripe: #fafafa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: var(--ink);
}

button {
  border: 1.5px solid var(--ink);
  background: var(--paper);
  padding: 7px 11px;
  cursor: pointer;
}

button:hover,
button:focus-visible,
a:focus-visible,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

button[disabled] {
  color: var(--muted);
  cursor: not-allowed;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--paper);
  padding: 7px 8px;
  border-radius: 0;
}

textarea {
  min-height: 86px;
  resize: vertical;
}

.page {
  width: min(1080px, calc(100% - 28px));
  margin: 22px auto;
  background: var(--paper);
  border: 2px solid var(--ink);
}

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: end;
  padding: 24px 28px 18px;
  border-bottom: 2px solid var(--ink);
}

h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  margin: 24px 0 12px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--ink);
  font-size: 20px;
}

h3 {
  margin: 18px 0 10px;
  font-size: 16px;
}

p {
  margin: 8px 0;
}

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

.subtitle {
  margin: 7px 0 0;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.nav a,
.tabs button {
  display: inline-block;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  padding: 6px 10px;
  text-decoration: none;
}

.nav a[aria-current="page"],
.tabs button[aria-selected="true"] {
  background: var(--ink);
  color: var(--paper);
}

main {
  padding: 22px 28px 28px;
}

.summary {
  border: 1.5px solid var(--ink);
  padding: 16px;
  background: var(--soft);
}

.box {
  border: 1.5px solid var(--ink);
  padding: 12px 14px;
  background: var(--paper);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.metric {
  border: 1.5px solid var(--ink);
  padding: 12px 14px;
  background: var(--paper);
}

.metric .label {
  color: var(--muted);
  font-size: 13px;
}

.metric .value {
  font-size: 30px;
  font-weight: 800;
  margin-top: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 14px;
  table-layout: fixed;
  font-size: 14px;
}

th,
td {
  border: 1px solid var(--border);
  padding: 8px 9px;
  vertical-align: top;
  word-break: break-word;
}

th {
  background: var(--head);
  text-align: left;
  font-weight: 800;
}

tbody tr:nth-child(even) td {
  background: var(--stripe);
}

.tag {
  display: inline-block;
  border: 1px solid var(--ink);
  padding: 1px 6px;
  margin: 1px 4px 1px 0;
  font-size: 12px;
  background: var(--paper);
  white-space: nowrap;
}

.toolbar,
.row-actions,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.toolbar {
  justify-content: space-between;
  margin: 12px 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field-full {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 5px;
  font-weight: 700;
}

label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.notice {
  border: 1.5px solid var(--ink);
  background: var(--soft);
  padding: 10px 12px;
  margin: 12px 0;
}

.error {
  border: 1.5px solid var(--ink);
  background: var(--head);
  padding: 10px 12px;
  margin: 12px 0;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.nowrap {
  white-space: nowrap;
}

.admin-panel {
  display: grid;
  gap: 16px;
}

.file-note {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 760px) {
  .page {
    width: calc(100% - 12px);
    margin: 8px auto;
  }

  .site-header {
    grid-template-columns: 1fr;
    align-items: start;
    padding-left: 14px;
    padding-right: 14px;
  }

  .nav {
    justify-content: flex-start;
  }

  main {
    padding-left: 14px;
    padding-right: 14px;
  }

  h1 {
    font-size: 28px;
  }

  .metrics,
  .form-grid {
    grid-template-columns: 1fr;
  }

  table {
    font-size: 12px;
  }

  th,
  td {
    padding: 7px;
  }

  .wide-table {
    display: block;
    overflow-x: auto;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  body {
    background: #fff;
  }

  .page {
    width: auto;
    margin: 0;
    border: 0;
  }

  .nav,
  .tabs,
  .toolbar,
  .form-actions,
  button,
  input,
  textarea,
  select {
    display: none !important;
  }

  section,
  table,
  .box,
  .metric {
    break-inside: avoid;
  }
}
