:root {
  --bg: #eef3f1;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(9, 33, 53, 0.12);
  --text: #143042;
  --text-soft: #5d7384;
  --brand: #0d6b68;
  --brand-strong: #0a4c57;
  --accent: #95c83d;
  --shadow: 0 24px 48px rgba(18, 42, 56, 0.12);
  --radius-lg: 20px;
  --max-width: 1240px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(149, 200, 61, 0.24), transparent 32%),
    radial-gradient(circle at top right, rgba(13, 107, 104, 0.14), transparent 28%),
    linear-gradient(180deg, #f6fbf9 0%, #ebf1ef 100%);
}

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

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

.shell {
  width: min(calc(100% - 32px), var(--max-width));
  margin: 0 auto;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.muted {
  color: var(--text-soft);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(13, 107, 104, 0.08);
  color: var(--brand-strong);
  font-size: 0.92rem;
  font-weight: 600;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  font-size: 1.1rem;
}

.section-title::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  box-shadow: 0 0 0 6px rgba(13, 107, 104, 0.1);
}

.btn-primary,
.btn-ghost,
.btn-danger {
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  border: 0;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: white;
}

.admin-button {
  background: var(--admin-button-bg);
}

.btn-ghost {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  color: var(--text);
}

.btn-danger {
  border: 0;
  background: rgba(220, 53, 69, 0.12);
  color: #b42335;
}

.delete-category,
.delete-link-compact {
  padding: 8px 10px;
  min-width: 0;
  font-size: 0.82rem;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
  gap: 6px;
  border-radius: 10px;
}

.input,
.textarea,
.select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
}

.textarea {
  min-height: 84px;
  resize: vertical;
}

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

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  white-space: nowrap;
  min-width: 64px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
}

.link-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  background: var(--surface-strong);
  border-radius: 16px;
  border: 1px solid var(--line);
}

.editor-card.is-collapsed {
  gap: 10px;
}

.card-preview {
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(20, 48, 66, 0.14);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  display: grid;
  gap: 6px;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.card-preview:hover {
  border-color: color-mix(in srgb, var(--brand) 38%, white 62%);
  box-shadow: 0 12px 24px rgba(18, 42, 56, 0.08);
  transform: translateY(-1px);
}

.card-preview.is-open {
  border-color: color-mix(in srgb, var(--brand) 42%, white 58%);
}

.card-preview-main {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-preview-meta {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-soft);
}

.editor-details {
  display: none;
  gap: 12px;
}

.editor-details.is-open {
  display: grid;
}

.draggable-card {
  position: relative;
}

.drop-before {
  box-shadow: inset 0 3px 0 color-mix(in srgb, var(--brand) 65%, white 35%);
}

.drop-after {
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--brand) 65%, white 35%);
}

.drop-inside {
  outline: 2px dashed color-mix(in srgb, var(--brand) 58%, white 42%);
  outline-offset: 2px;
}

.drop-left {
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--brand) 65%, white 35%);
}

.drop-right {
  box-shadow: inset -3px 0 0 color-mix(in srgb, var(--brand) 65%, white 35%);
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-header-title {
  font-size: 0.92rem;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--text-soft);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.drag-list {
  display: grid;
  gap: 12px;
}

.handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(13, 107, 104, 0.18);
  background: linear-gradient(180deg, rgba(13, 107, 104, 0.14), rgba(13, 107, 104, 0.08));
  color: var(--brand-strong);
  cursor: grab;
  flex-shrink: 0;
}

.handle-dots {
  display: grid;
  grid-template-columns: repeat(2, 4px);
  gap: 4px;
}

.handle-dots span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
}

.update-panel {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.update-panel-header,
.update-actions,
.snapshot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

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

.update-version-grid > div {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.update-notes {
  padding: 14px;
  border-left: 3px solid var(--brand);
  background: rgba(13, 107, 104, 0.06);
  line-height: 1.7;
  white-space: pre-wrap;
}

.update-progress {
  display: grid;
  gap: 8px;
}

.update-progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(20, 48, 66, 0.1);
}

.update-progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 240ms ease;
}

.snapshot-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.snapshot-row {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.snapshot-row > div {
  display: grid;
  gap: 4px;
}

@media (max-width: 1180px) {
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .admin-grid,
  .update-version-grid {
    grid-template-columns: 1fr;
  }
}
