:root {
  --bg: #fff;
  --text: #1c1c1c;
  --muted: #8b8b8b;
  --faint: #b3b3b3;
  --line: #ececec;
  --orange: #e67e22;
  --green: #2f9e44;
  --red: #e03131;
  --comment: #fff6e8;
  --comment-line: #f3ddb3;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

[x-cloak] {
  display: none !important;
}

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

button, input, select {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.page {
  min-height: 100vh;
}

.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 32px;
  border-bottom: 1px solid var(--line);
}

.topnav-links {
  display: flex;
  gap: 18px;
}

.topnav-links a {
  color: var(--muted);
}

.topnav-links a.is-active {
  color: var(--text);
  font-weight: 600;
}

.topnav-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
}

.locale-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.locale-switch button {
  border: 0;
  background: #fff;
  color: var(--muted);
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
}

.locale-switch button.is-active {
  background: #111;
  color: #fff;
}

.login-locale {
  position: absolute;
  top: 18px;
  right: 24px;
}

.topnav-meta form {
  margin: 0;
}

.link-btn,
.text-btn,
.ghost-danger {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

.link-btn,
.ghost-danger {
  color: var(--muted);
}

.ghost-danger:hover {
  color: var(--red);
}

.page-main,
.board {
  width: min(980px, calc(100% - 64px));
  margin: 0 auto;
  padding: 48px 0 96px;
}

.page-title {
  margin: 0 0 24px;
  font-size: 28px;
}

.site-list {
  list-style: none;
  margin: 0 0 36px;
  padding: 0;
}

.site-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.site-card {
  flex: 1;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 12px;
  padding: 16px 4px;
}

.site-card strong {
  font-size: 15px;
}

.site-card span,
.site-card em {
  color: var(--muted);
  font-style: normal;
}

.panel-form {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.panel-form h2 {
  margin: 0 0 14px;
  font-size: 16px;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.panel-form input,
.panel-form select,
.login-card .field-input {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}

.form-row input,
.form-row select {
  width: auto;
  flex: 1;
  min-width: 140px;
}

.btn-primary {
  margin-top: 10px;
  border: 0;
  border-radius: 8px;
  background: #111;
  color: #fff;
  padding: 11px 20px;
  font-size: 15px;
  cursor: pointer;
}

.btn-secondary,
.btn-danger {
  border: 0;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 14px;
  cursor: pointer;
}

.btn-secondary {
  background: #f2f2f2;
  color: #333;
}

.btn-danger {
  background: #c0392b;
  color: #fff;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--red);
  background: #fff1f0;
}

.icon-trash {
  width: 18px;
  height: 18px;
  display: block;
}

.form-error {
  color: var(--red);
  margin: 8px 0 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
}

.data-table td {
  padding: 12px 6px;
  border-bottom: 1px solid var(--line);
}

.login-wrap {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-card {
  width: min(360px, calc(100% - 32px));
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.login-card h1 {
  margin: 0;
  font-size: 24px;
}

.login-sub {
  margin: 4px 0 20px;
  color: var(--muted);
}

.login-card label {
  display: block;
  margin-bottom: 12px;
}

.login-card label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.login-card .remember {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 2px 0 4px;
  cursor: pointer;
  user-select: none;
}

.login-card .remember-check {
  appearance: auto;
  width: 15px;
  height: 15px;
  margin: 0;
  flex: 0 0 15px;
  accent-color: #111;
  cursor: pointer;
}

.login-card .remember span {
  display: inline;
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 15px;
}

.toast {
  position: fixed;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  margin: 0;
  padding: 8px 14px;
  border-radius: 8px;
  background: #fff1f0;
  color: var(--red);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.site-head {
  margin-bottom: 52px;
}

.site-head-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  min-height: 36px;
}

.site-name-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.site-name-slot {
  height: 36px;
  width: max-content;
  max-width: 70%;
}

.site-name {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 36px;
  height: 36px;
  cursor: text;
}

.site-domain-slot {
  height: 36px;
  width: max-content;
  flex: 0 0 auto;
}

.site-domain {
  margin: 0;
  font-size: 13px;
  line-height: 36px;
  height: 36px;
  color: var(--muted);
  cursor: text;
}

.site-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.site-lang {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 36px;
  height: 36px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.site-lang .text-btn {
  display: inline;
  font-size: 13px;
  line-height: 36px;
  height: 36px;
  color: var(--muted);
}

.head-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.head-btn:hover {
  background: #f7f7f7;
}

.head-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.site-desc-slot {
  height: 22px;
  margin-top: 10px;
}

.site-desc {
  margin: 0;
  font-size: 13px;
  line-height: 22px;
  height: 22px;
  color: var(--muted);
  cursor: text;
}

.cluster {
  margin: 0 0 64px;
}

.cluster-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
}

.cluster-title-slot {
  height: 32px;
  min-width: 0;
  width: max-content;
  max-width: 100%;
}

.cluster-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 32px;
  height: 32px;
  cursor: text;
}

.cluster-del,
.row-del {
  opacity: 0;
}

.cluster:hover .cluster-del,
.page-row:hover .row-del {
  opacity: 1;
}

.cluster-kw {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 13px;
  min-height: 22px;
}

.kw-slot {
  height: 22px;
  flex: 1;
  min-width: 0;
}

.kw-slot .text-btn {
  display: inline;
  font-size: 13px;
  line-height: 22px;
  height: 22px;
  color: var(--muted);
}

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 20px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.step {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  cursor: pointer;
  user-select: none;
}

.step.is-done {
  color: var(--green);
}

.step.is-current {
  color: var(--orange);
  font-weight: 600;
}

.step-mark {
  font-size: 12px;
}

.page-list {
  display: flex;
  flex-direction: column;
}

.page-block {
  overflow: visible;
}

.page-row.is-menu {
  position: relative;
  z-index: 6;
}

.page-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 120px 96px 88px;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 14px 0;
  border-top: 1px solid #f0f0f0;
}

.page-row.is-draft {
  border-bottom: 1px solid #f3f3f3;
}

.page-type {
  color: var(--faint);
  font-size: 12px;
  line-height: 16px;
}

.page-row.is-main .page-type {
  color: var(--muted);
  font-weight: 600;
}

.page-row.is-supporting .page-type,
.page-row.is-draft .page-type {
  position: relative;
  padding-left: 12px;
}

.page-row.is-supporting .page-type::before,
.page-row.is-draft .page-type::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 8px;
  height: 8px;
  border-left: 1.5px solid #d8d8d8;
  border-bottom: 1.5px solid #d8d8d8;
}

.page-maincol {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.page-title-slot {
  height: 22px;
}

.page-path-slot {
  height: 18px;
  flex: 1;
  min-width: 0;
}

.page-path-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.ext-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  color: var(--faint);
}

.ext-link:hover {
  color: var(--text);
}

.page-title,
.page-path,
.text-btn {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: text;
}

.page-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
  height: 22px;
  width: 100%;
}

.page-row.is-main .page-title {
  font-size: 16px;
  font-weight: 700;
}

.page-row.is-supporting .page-title {
  font-size: 14px;
  font-weight: 500;
}

.page-path {
  color: var(--muted);
  font-size: 12px;
  line-height: 18px;
  height: 18px;
  width: 100%;
}

.page-status {
  position: relative;
  z-index: 2;
}

.status-btn {
  padding: 4px 0;
  cursor: pointer;
}

.status-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  min-width: 148px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.status-btn,
.status-menu button {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
}

.status-btn i,
.status-menu button i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.st-online {
  color: var(--green);
}

.st-writing,
.st-review {
  color: var(--orange);
}

.st-pending_confirm {
  color: var(--orange);
}

.st-pending_confirm i {
  background: transparent;
  border: 1.5px solid currentColor;
}

.st-planned {
  color: var(--faint);
}

.status-menu button {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 14px;
}

.status-menu button:hover {
  background: #f7f7f7;
}

.rank-fields {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.rank-slot {
  height: 20px;
  width: 40px;
}

.rank-num,
.rank-delta {
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  height: 20px;
  line-height: 20px;
  cursor: text;
  color: var(--text);
  width: 100%;
  text-align: right;
}

.rank-delta.is-up {
  color: var(--green);
}

.rank-delta.is-down {
  color: var(--red);
}

.page-rank {
  text-align: right;
}

.rank-dash {
  color: var(--faint);
  line-height: 20px;
}

.page-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.comment-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 32px;
  height: 32px;
  border: 0;
  background: none;
  color: var(--faint);
  cursor: pointer;
  padding: 0;
  border-radius: 6px;
}

.comment-btn.has-unread,
.comment-btn:hover {
  color: var(--orange);
}

.comment-btn span {
  font-size: 12px;
  font-weight: 600;
  min-width: 8px;
}

.comment-panel {
  margin: 4px 0 16px 86px;
}

.comment-card {
  background: var(--comment);
  border: 0;
  border-left: 3px solid #e0b45a;
  border-radius: 0;
  padding: 10px 14px;
  margin-bottom: 8px;
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.comment-meta strong {
  color: #8a6a2b;
  font-weight: 600;
}

.comment-del {
  margin-left: auto;
  width: 28px;
  height: 28px;
  opacity: 0;
}

.comment-card:hover .comment-del {
  opacity: 1;
}

.comment-card p {
  margin: 0;
  white-space: pre-wrap;
}

.comment-input,
.inline-input,
.draft-input,
.add-cluster-input {
  width: 100%;
  border: 0;
  padding: 0 4px;
  margin: 0;
  background: transparent;
  box-shadow: none;
}

.edit-slot {
  display: block;
  overflow: hidden;
}

.inline-input:focus,
.comment-input:focus,
.draft-input:focus,
.add-cluster-input:focus {
  outline: none;
  background: #fafafa;
  box-shadow: inset 0 0 0 1px #d8d8d8;
}

.site-name-slot .inline-input,
.title-input {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 36px;
  height: 36px;
  padding: 0 4px;
  min-width: 220px;
}

.cluster-title-slot .inline-input,
.cluster-title-input {
  font-size: 22px;
  font-weight: 700;
  line-height: 32px;
  height: 32px;
  min-width: 180px;
}

.site-domain-slot .inline-input {
  font-size: 13px;
  line-height: 36px;
  height: 36px;
  color: var(--muted);
  min-width: 140px;
}

.site-lang-slot {
  display: inline-block;
  height: 36px;
  min-width: 48px;
  vertical-align: top;
}

.lang-input {
  font-size: 13px;
  line-height: 36px;
  height: 36px;
  width: 88px;
  color: var(--muted);
}

.site-desc-slot .inline-input,
.desc-input {
  font-size: 13px;
  line-height: 22px;
  height: 22px;
  color: var(--muted);
}

.page-title-input {
  font-size: 15px;
  font-weight: 600;
  line-height: 22px;
  height: 22px;
}

.path-input {
  font-size: 12px;
  line-height: 18px;
  height: 18px;
  color: var(--muted);
}

.kw-input {
  font-size: 13px;
  line-height: 22px;
  height: 22px;
  color: var(--muted);
}

.rank-input {
  width: 100%;
  height: 20px;
  line-height: 20px;
  text-align: right;
  font-size: 13px;
}

.draft-input {
  height: 20px;
  line-height: 20px;
  font-size: 14px;
  color: var(--muted);
  padding: 0 4px;
}

.draft-input:focus {
  color: var(--text);
}

.comment-input {
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-left: 3px solid #e6e6e6;
  border-radius: 0;
  background: #fafafa;
  color: var(--text);
}

.comment-input:focus {
  background: #fff;
  border-left-color: #e0b45a;
  box-shadow: none;
}

.add-cluster {
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.add-cluster-input {
  height: 28px;
  font-size: 20px;
  font-weight: 700;
  color: var(--faint);
}

@media (max-width: 800px) {
  .page-row {
    grid-template-columns: 64px minmax(0, 1fr) 88px;
    grid-template-rows: auto auto;
  }

  .page-rank,
  .page-actions {
    grid-column: 3;
  }

  .site-card {
    grid-template-columns: 1fr;
  }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.4);
}

.modal-card {
  position: relative;
  width: min(400px, calc(100% - 40px));
  padding: 24px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-text {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
