:root {
  color-scheme: light;
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  background: #f3f5f7;
  color: #1f2933;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid #d9e0e7;
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 650;
}

.topbar p {
  margin: 0;
  color: #5d6975;
  font-size: 13px;
}

.token-box {
  min-width: 260px;
}

label {
  display: block;
  margin: 12px 0 6px;
  color: #44515f;
  font-size: 13px;
  font-weight: 600;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid #c8d0d8;
  border-radius: 6px;
  padding: 9px 10px;
  background: #ffffff;
  color: #111827;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea {
  min-height: 260px;
  resize: vertical;
  line-height: 1.55;
  font-family: Consolas, "Microsoft YaHei UI", monospace;
}

button {
  border: 1px solid #9fb2c7;
  border-radius: 6px;
  padding: 8px 12px;
  background: #ffffff;
  color: #1f2933;
  cursor: pointer;
}

button:hover {
  background: #eef4fb;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.danger {
  border-color: #d48a8a;
  color: #a42121;
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: calc(100vh - 84px);
}

.sidebar {
  overflow: auto;
  border-right: 1px solid #d9e0e7;
  background: #ffffff;
  padding: 16px;
}

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

.toolbar button {
  flex: 1;
}

.document-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.document-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 11px;
  border-color: #d4dce5;
}

.document-item strong,
.document-item span {
  display: block;
}

.document-item span {
  margin-top: 4px;
  color: #66717e;
  font-size: 12px;
}

.document-item.active {
  border-color: #2563eb;
  background: #eef4ff;
}

.editor {
  overflow: auto;
  padding: 22px 24px 36px;
}

.editor-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.table-header label {
  margin: 0;
}

.table-header div {
  display: flex;
  gap: 8px;
}

.server-table-wrap {
  overflow: auto;
  max-height: 420px;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  background: #ffffff;
}

.server-table,
.preview-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.server-table th,
.server-table td,
.preview-table th,
.preview-table td {
  border-bottom: 1px solid #edf1f5;
  padding: 8px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.server-table th,
.preview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #44515f;
  font-weight: 700;
}

.server-table th:nth-child(1) { width: 130px; }
.server-table th:nth-child(2) { width: 110px; }
.server-table th:nth-child(3) { width: 170px; }
.server-table th:nth-child(4) { width: 80px; }
.server-table th:nth-child(5) { width: 150px; }
.server-table th:nth-child(6) { width: 160px; }
.server-table th:nth-child(8) { width: 72px; }

.server-table input {
  min-height: 28px;
  padding: 5px 7px;
  border-radius: 4px;
}

.link-button {
  border: 0;
  padding: 0;
  color: #b42318;
  background: transparent;
}

.link-button:hover {
  background: transparent;
  text-decoration: underline;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.status {
  color: #5d6975;
  font-size: 13px;
}

.publish-panel {
  display: grid;
  gap: 8px;
  margin-top: 18px;
  padding: 12px;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  background: #ffffff;
}

.publish-panel div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.publish-panel span {
  color: #5d6975;
  font-size: 13px;
}

code {
  padding: 3px 6px;
  border-radius: 4px;
  background: #edf1f5;
  color: #0f172a;
  overflow-wrap: anywhere;
}

.preview {
  margin-top: 20px;
}

.preview-title {
  margin-bottom: 10px;
  color: #44515f;
  font-size: 13px;
  font-weight: 700;
}

.preview-section {
  margin-bottom: 14px;
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  background: #ffffff;
}

.preview-section h3 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid #e5ebf1;
  font-size: 14px;
}

.warnings,
.empty {
  padding: 12px;
  color: #66717e;
  font-size: 13px;
}

dialog {
  width: min(760px, calc(100vw - 32px));
  border: 1px solid #d9e0e7;
  border-radius: 8px;
  padding: 0;
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.paste-dialog {
  padding: 18px;
}

.paste-dialog h2 {
  margin: 0 0 6px;
  font-size: 18px;
}

.paste-dialog p {
  margin: 0 0 12px;
  color: #66717e;
  font-size: 13px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.hidden {
  display: none;
}

@media (max-width: 900px) {
  .topbar,
  .shell,
  .editor-header {
    display: block;
  }

  .shell {
    height: auto;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid #d9e0e7;
  }

  .token-box {
    min-width: 0;
    margin-top: 12px;
  }

  .server-table-wrap {
    max-height: none;
  }
}
