@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/plex-sans.ttf") format("truetype");
  font-weight: 100 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/plex-mono.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
:root {
  --ground: #f4f7f8;
  --surface: #fff;
  --active: #e7ecee;
  --border: #e8eaec;
  --rule: #f0f1f2;
  --control: #cdced1;
  --text: #131416;
  --muted: #5d5f60;
  --accent: #1b6c80;
  --negative: #a02b2f;
  --gap: 24px;
  font-family: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--ground);
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button,
a,
input,
textarea,
select {
  outline-offset: 3px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
}
button {
  min-height: 36px;
  padding: 6px 14px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--control);
  border-radius: 6px;
}
button:hover {
  border-color: #666;
}
button:disabled {
  color: #62666a;
  background: #f0f1f2;
  cursor: wait;
}
.primary {
  background: #1d1f20;
  color: #fff;
  border-color: #1d1f20;
}
.ghost {
  background: transparent;
  border-color: transparent;
}
.danger {
  color: var(--negative);
}
input,
select,
textarea {
  border: 1px solid var(--control);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff;
  color: var(--text);
  min-width: 0;
}
input::placeholder,
textarea::placeholder {
  color: #6b6b6b;
}
textarea {
  min-height: 90px;
  resize: vertical;
}
h1 {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
}
h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}
p {
  margin: 8px 0;
  color: var(--muted);
}
.muted,
small {
  color: var(--muted);
}
small {
  font-size: 12px;
}
.mono {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
}
.shell {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  grid-template-rows: 48px 1fr;
  min-height: 100vh;
}
.sidebar {
  grid-row: 1/3;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  font-weight: 600;
  font-size: 16px;
}
.mark {
  width: 25px;
  height: 25px;
  color: var(--accent);
  flex: none;
}
.scope {
  padding: 8px 12px 0;
  font-size: 12px;
  color: var(--muted);
}
nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
nav button {
  border: 0;
  text-align: left;
  background: transparent;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
nav .active {
  background: var(--active);
  font-weight: 600;
}
.nav-icon {
  width: 18px;
  color: #666;
}
.nav-section {
  margin: 16px 12px 8px;
  color: var(--muted);
  font-size: 12px;
}
.sidebar-bottom {
  margin-top: auto;
  padding: 12px;
}
.topbar {
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}
.menu {
  display: none;
}
.canvas {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin: 0 8px 8px 0;
  padding: 32px 32px 24px;
  min-height: calc(100vh - 56px);
}
.title-row {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.title-row p {
  font-size: 13px;
  margin: 8px 0 0;
}
.stats {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  gap: 40px;
  padding-bottom: 20px;
}
.stat {
  display: flex;
  gap: 12px;
  align-items: baseline;
}
.stat strong {
  font-size: 24px;
  font-weight: 400;
}
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar input {
  width: 300px;
  height: 36px;
}
.toolbar .count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
.table-frame {
  overflow: auto;
  max-height: calc(100vh - 325px);
  min-height: 120px;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
}
th {
  position: sticky;
  top: 0;
  background: #fff;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  height: 38px;
  z-index: 1;
  white-space: nowrap;
}
td {
  height: 64px;
  border-bottom: 1px solid var(--rule);
  padding: 10px 16px 10px 0;
  vertical-align: middle;
  font-size: 13px;
}
th {
  padding: 0 16px 0 0;
}
th:first-child,
td:first-child {
  min-width: 210px;
}
td:last-child,
th:last-child {
  text-align: right;
  padding-right: 0;
  white-space: nowrap;
}
td small {
  display: block;
  margin-top: 4px;
}
td .identity {
  font-weight: 500;
  font-size: 14px;
}
.num {
  text-align: right;
}
.pill {
  display: inline-block;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 12px;
  background: #ebedee;
  color: #353736;
  white-space: nowrap;
}
.pill.good {
  background: #e4f2e9;
  color: #225438;
}
.pill.warn {
  background: #fff5da;
  color: #805c13;
}
.pill.bad {
  background: #ffedea;
  color: #831c1e;
}
.row-edit {
  background: transparent;
  border: 0;
  color: var(--accent);
  padding-right: 0;
}
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
}
.pager div {
  display: flex;
  gap: 8px;
}
.empty {
  padding: 40px 16px;
  color: var(--muted);
  border: 1px dashed var(--border);
  text-align: center;
}
.error {
  color: var(--negative);
  padding: 16px 0;
}
.login {
  width: 400px;
  margin: 15vh auto 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}
.login .brand {
  padding: 0;
  margin-bottom: 24px;
}
.login h1 {
  margin-bottom: 8px;
}
.login label {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}
.login button {
  width: 100%;
  margin-top: 24px;
}
.login small {
  display: block;
  margin-top: 24px;
}
.loading {
  padding: 48px;
}
#notice {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1d1f20;
  color: #fff;
  border-radius: 6px;
  padding: 12px 20px;
  z-index: 10;
  max-width: 90vw;
  display: none;
}
#notice.visible {
  display: block;
}
dialog {
  margin: 0 0 0 auto;
  height: 100dvh;
  max-height: 100dvh;
  width: 650px;
  max-width: 100vw;
  border: 0;
  border-left: 1px solid var(--border);
  padding: 0;
  background: #fff;
  color: var(--text);
}
dialog::backdrop {
  background: #0004;
}
.editor-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  padding: 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.editor-head p {
  font-size: 12px;
}
.editor-body {
  padding: 24px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form-grid label.wide {
  grid-column: 1/-1;
}
.form-grid input,
.form-grid select {
  width: 100%;
  min-height: 40px;
}
.form-grid select[multiple] {
  height: 110px;
}
.form-grid label.changed > span {
  color: var(--accent);
}
.form-grid label.changed > span::after {
  content: " · 已修改";
  font-size: 12px;
}
.editor-section {
  margin: 28px 0 16px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.editor-section:first-child {
  margin-top: 0;
  border: 0;
  padding-top: 0;
}
.editor-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.relation {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.relation button {
  font-size: 12px;
}
.check {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 24px;
}
.audit-entry {
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}
.audit-entry small {
  display: block;
  margin-top: 6px;
}
.migration {
  max-width: 780px;
}
.migration dl {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
}
.migration dt {
  color: var(--muted);
}
.migration dd {
  margin: 0;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
}
.help {
  padding: 16px;
  background: #f4f6f8;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}
.inline-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
/* 1440 = 228 navigation + 8 inset + 1204 sheet; sheet content = 1204 - 64 padding. */
@media (max-width: 1100px) {
  .shell {
    display: block;
  }
  .sidebar {
    display: none;
  }
  .sidebar.open {
    display: flex;
    position: fixed;
    inset: 48px 0 0;
    background: var(--ground);
    z-index: 8;
  }
  .topbar {
    height: 48px;
  }
  .menu {
    display: block;
  }
  .canvas {
    margin: 0 8px 8px;
    padding: 24px;
  }
  .table-frame {
    max-height: calc(100vh - 325px);
  }
}
@media (max-width: 640px) {
  button {
    min-height: 44px;
  }
  .topbar {
    padding: 0 16px;
  }
  .canvas {
    border-radius: 0;
    margin: 0;
    border: 0;
    padding: 24px 16px;
    min-height: calc(100vh - 48px);
  }
  h1 {
    font-size: 22px;
  }
  .title-row {
    gap: 12px;
    margin-bottom: 20px;
  }
  .title-row p {
    max-width: 230px;
  }
  .stats {
    gap: 24px;
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
  .stat {
    gap: 6px;
  }
  .stat strong {
    font-size: 20px;
  }
  .toolbar {
    gap: 8px;
  }
  .toolbar input {
    width: 100%;
    flex-basis: 100%;
    height: 44px;
  }
  .toolbar select {
    max-width: 45%;
    height: 44px;
  }
  .toolbar .count {
    margin-left: auto;
  }
  .table-frame {
    max-height: none;
    overflow: visible;
  }
  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }
  thead {
    display: none;
  }
  tr {
    border-bottom: 1px solid var(--rule);
    padding: 16px 0;
    position: relative;
  }
  td {
    border: 0;
    height: auto;
    padding: 3px 70px 3px 0;
    min-width: 0 !important;
  }
  td:first-child {
    padding-bottom: 7px;
  }
  td:last-child {
    position: absolute;
    top: 15px;
    right: 0;
    width: auto;
    padding: 0;
  }
  td small {
    display: inline;
    margin-left: 8px;
  }
  td .identity + small {
    display: block;
    margin-left: 0;
  }
  .pager {
    align-items: flex-start;
    gap: 12px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .login {
    width: calc(100% - 32px);
    margin-top: 12vh;
    padding: 24px;
  }
  .editor-head,
  .editor-body {
    padding: 20px;
  }
  .editor-head h2 {
    font-size: 18px;
  }
  .migration dl {
    grid-template-columns: 110px 1fr;
  }
  .help {
    padding: 12px;
  }
}

@media (max-width: 640px) {
  td {
    font-size: 14px;
  }
}
