:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --muted: #6b7280;
  --border: #d8dbe2;
  --text: #111827;
  --red: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

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

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.chip {
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab-btn {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}

.tab-btn.active {
  border-color: var(--text);
  font-weight: 600;
}

main {
  padding: 0 16px 16px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.split {
  display: grid;
  gap: 12px;
  grid-template-columns: 280px 1fr;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.card.soft {
  background: #fafafa;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 680px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.file-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
  display: grid;
  gap: 4px;
  max-height: 560px;
  overflow: auto;
}

.file-list button {
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
}

.file-list button.active {
  border-color: var(--text);
  background: #f7f7f7;
  font-weight: 600;
}

.blog-card-list {
  display: grid;
  gap: 8px;
  max-height: 620px;
  overflow: auto;
}

.blog-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  display: grid;
  gap: 4px;
  background: #fff;
}

.blog-card.active {
  border-color: var(--text);
  background: #f7f7f7;
}

.blog-card .title {
  font-size: 13px;
  font-weight: 600;
}

.blog-card .meta {
  font-size: 11px;
  color: var(--muted);
  word-break: break-word;
}

.blog-form-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.blog-form-grid .full {
  grid-column: 1 / -1;
}

.editor {
  display: grid;
  gap: 10px;
}

.editor-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row.between {
  justify-content: space-between;
}

.mt-8 {
  margin-top: 8px;
}

label {
  font-size: 12px;
  color: var(--muted);
}

textarea,
select,
input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  font: inherit;
}

textarea {
  min-height: 340px;
  font-family: Consolas, monospace;
  font-size: 12px;
  resize: vertical;
}

.small-editor {
  min-height: 160px;
}

.structured {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.hidden {
  display: none;
}

.btn {
  border: 1px solid var(--text);
  background: var(--text);
  color: #fff;
  border-radius: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
}

.btn-ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--border);
}

.btn-danger {
  background: #fff;
  color: var(--red);
  border-color: #f3b3b3;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 6px 0;
}

.media-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  max-height: 680px;
  overflow: auto;
}

.media-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.media-item img {
  width: 100%;
  height: 96px;
  object-fit: cover;
  display: block;
}

.media-item .meta {
  padding: 6px;
  display: grid;
  gap: 6px;
}

.media-item .name {
  font-size: 11px;
  word-break: break-all;
}

.publish-card {
  display: grid;
  gap: 8px;
}

.log {
  border: 1px solid var(--border);
  background: #f9fafb;
  padding: 8px;
  border-radius: 6px;
  min-height: 80px;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
}

@media (max-width: 980px) {
  .split {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }
}
