:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #6d6a64;
  --line: #ded8ce;
  --paper: #f7f4ee;
  --panel: #ffffff;
  --accent: #1f6feb;
  --accent-dark: #174ea6;
  --danger: #b3261e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 18px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 28px;
  border-right: 1px solid var(--line);
  background: #ebe5db;
  padding: 28px 22px;
}

.brand {
  color: var(--ink);
  font-size: 22px;
  font-weight: 800;
  text-decoration: none;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  border-radius: 6px;
  color: var(--ink);
  padding: 10px 12px;
  text-decoration: none;
}

nav a.active,
nav a:hover {
  background: rgba(31, 111, 235, 0.12);
  color: var(--accent-dark);
}

.account-box {
  margin-top: auto;
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.ghost-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.ghost-button:hover {
  background: #fff;
  color: var(--ink);
}

.workspace {
  min-width: 0;
  padding: 34px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

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

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 18px;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.login-panel,
.post-list-panel,
.post-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.login-panel {
  max-width: 640px;
  display: grid;
  gap: 18px;
  padding: 24px;
}

.login-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
  line-height: 1.65;
}

.editor-panel {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 18px;
}

.post-list-panel {
  overflow: hidden;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.panel-title span {
  color: var(--muted);
}

.post-list {
  display: grid;
  max-height: calc(100vh - 170px);
  overflow: auto;
}

.post-item {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 14px 16px;
}

.post-item:hover,
.post-item.active {
  background: #f0f6ff;
  color: var(--ink);
}

.post-item strong {
  display: block;
  margin-bottom: 5px;
}

.post-item span {
  color: var(--muted);
  font-size: 13px;
}

.post-form {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.switch-row label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.switch-row input {
  width: 18px;
  height: 18px;
}

.danger-button {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--danger);
  color: var(--danger);
}

.danger-button:hover {
  background: var(--danger);
  color: #fff;
}

.message {
  min-height: 24px;
  margin: 18px 0 0;
  color: var(--accent-dark);
}

@media (max-width: 820px) {
  .admin-shell,
  .editor-panel {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 22px;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-actions,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    display: grid;
  }
}
