:root {
  color-scheme: light;
  --bg: #f8faf6;
  --surface: #ffffff;
  --surface-2: #f1f6f0;
  --ink: #17201a;
  --muted: #5f6b62;
  --line: #dfe8dd;
  --brand: #236f4a;
  --brand-2: #0f8f7a;
  --accent: #b85c38;
  --warn: #8a5a00;
  --danger: #9c2f18;
  --radius: 8px;
  --shadow: 0 18px 44px rgba(31, 53, 37, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.58;
}

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 58px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 246, 0.94);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 136px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
}

.topnav a,
.sidebar a,
.button,
button {
  border-radius: var(--radius);
}

.topnav a {
  padding: 7px 9px;
  color: var(--muted);
  font-size: 13px;
}

.topnav a.active,
.topnav a:hover,
.sidebar a.active,
.sidebar a:hover {
  background: var(--surface-2);
  color: var(--brand);
}

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

.account-summary {
  display: grid;
  gap: 1px;
  min-width: 0;
  max-width: 180px;
  padding: 2px 4px;
  line-height: 1.2;
}

.account-summary strong,
.account-summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-summary strong {
  font-size: 13px;
}

.account-summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-weight: 650;
}

.button.primary,
button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.button.subtle,
button.subtle {
  background: var(--surface-2);
}

.button.danger,
button.danger {
  border-color: #d9b7ae;
  color: #9c2f18;
}

.layout {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 20px;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px 24px 48px;
}

.layout-wide {
  grid-template-columns: minmax(0, 1fr);
}

.admin-layout {
  width: min(1180px, 100%);
}

.sidebar {
  position: sticky;
  top: 78px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
}

.sidebar h3 {
  margin: 16px 8px 6px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.sidebar h3:first-child {
  margin-top: 0;
}

.sidebar a {
  display: block;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 13px;
}

.mobile-toggle {
  display: none;
}

main {
  min-width: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 28px;
  align-items: stretch;
  padding: 44px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(35, 111, 74, 0.14), rgba(15, 143, 122, 0.06)),
    var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-compact {
  grid-template-columns: minmax(0, 1fr);
  padding: 28px;
}

.hero-compact h1 {
  max-width: 820px;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.16;
}

.hero-compact p {
  max-width: 720px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(26px, 3.4vw, 38px);
  line-height: 1.16;
  letter-spacing: 0;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(23px, 2.6vw, 30px);
  line-height: 1.2;
  letter-spacing: 0;
}

.post-head h1 {
  font-size: clamp(22px, 2.3vw, 28px);
  line-height: 1.22;
}

.hero p,
.page-head p {
  max-width: 780px;
  color: var(--muted);
  font-size: 16px;
}

.post-head p {
  font-size: 15px;
}

.hero-panel {
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
}

.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.metric:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.metric strong {
  font-size: 28px;
  color: var(--brand);
}

.cta-row,
.toolbar,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.section {
  margin-top: 26px;
}

.section-head,
.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.section h2,
.page-head h1 {
  margin: 0;
}

.section h2 {
  font-size: 19px;
  line-height: 1.25;
}

.section-head p,
.muted {
  color: var(--muted);
}

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

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card,
.article,
.panel,
.admin-shell,
.form-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
}

.auth-card {
  max-width: 520px;
  margin: 40px auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  box-sizing: border-box;
}

.google-btn:hover {
  background: var(--surface-2);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-card h1 {
  margin: 0;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 146px;
  padding: 15px;
}

.card h3,
.article h2,
.article h3 {
  margin: 0;
  line-height: 1.28;
}

.article h2 {
  font-size: 19px;
}

.card h3,
.article h3,
.panel h3 {
  font-size: 16px;
}

.card p {
  margin: 0;
  color: var(--muted);
}

.tagline,
.pill,
.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.tagline {
  padding: 4px 9px;
  background: #e7f3ed;
  color: var(--brand);
}

.pill,
.status {
  padding: 3px 8px;
  background: var(--surface-2);
  color: var(--muted);
}

.status.published {
  background: #e1f3e9;
  color: #14613b;
}

.status.draft {
  background: #fff5d8;
  color: var(--warn);
}

.list {
  display: grid;
  gap: 14px;
}

.article {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.article-cover {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.article-cover img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.article p {
  margin: 0;
  color: var(--muted);
}

.content-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 24px;
}

.post-cover {
  overflow: hidden;
  margin: 0 0 20px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius);
}

.post-cover img {
  display: block;
  width: 100%;
  max-height: 460px;
  object-fit: cover;
}

.prose {
  padding: 26px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 16px;
  line-height: 1.75;
}

.prose h1,
.prose h2,
.prose h3 {
  margin: 28px 0 12px;
  line-height: 1.24;
}

.prose h1:first-child,
.prose h2:first-child,
.prose h3:first-child,
.prose p:first-child {
  margin-top: 0;
}

.prose h1 {
  font-size: 26px;
}

.prose h2 {
  font-size: 22px;
}

.prose h3 {
  font-size: 19px;
}

.prose p,
.prose ul,
.prose ol,
.prose blockquote {
  margin: 0 0 18px;
}

.prose ul,
.prose ol {
  padding-left: 24px;
}

.prose li {
  margin: 6px 0;
}

.prose blockquote {
  padding: 12px 16px;
  border-left: 4px solid var(--brand);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: var(--radius);
}

.prose hr {
  margin: 28px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.prose pre {
  overflow: auto;
  margin: 0 0 20px;
  padding: 14px;
  background: #17201a;
  color: #f8faf6;
  border-radius: var(--radius);
}

.prose code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.prose :not(pre) > code {
  padding: 2px 5px;
  background: var(--surface-2);
  border-radius: 5px;
  font-size: 0.92em;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 20px 0;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius);
}

.aside {
  position: sticky;
  top: 88px;
  align-self: start;
  display: grid;
  gap: 14px;
}

.panel {
  padding: 18px;
}

.panel h3 {
  margin-top: 0;
}

.search-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 18px;
}

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

textarea {
  min-height: 220px;
  resize: vertical;
}

.markdown-field {
  gap: 8px;
}

.markdown-editor {
  min-height: 460px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.72;
  tab-size: 2;
  white-space: pre-wrap;
}

.image-insert-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(220px, 1.4fr) auto minmax(120px, 1fr);
  gap: 10px;
  align-items: center;
}

.upload-status {
  color: var(--muted);
  font-size: 13px;
}

.upload-status.error {
  color: var(--danger);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 620px;
  overflow: hidden;
}

.admin-nav {
  padding: 18px;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}

.admin-nav a {
  display: block;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: var(--muted);
}

.admin-nav a.active,
.admin-nav a:hover {
  background: var(--surface);
  color: var(--brand);
}

.admin-main {
  min-width: 0;
  padding: 28px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.admin-stat {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
}

.admin-stat strong {
  display: block;
  font-size: 30px;
  line-height: 1.15;
}

.admin-stat p {
  margin: 0;
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  background: var(--surface);
}

.table th,
.table td {
  padding: 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table th {
  background: var(--surface-2);
  color: var(--muted);
  font-size: 13px;
}

.admin-post-table th:last-child,
.admin-post-table td:last-child {
  width: 150px;
}

.admin-title-cell {
  min-width: 240px;
  max-width: 360px;
}

.admin-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  white-space: nowrap;
}

.admin-row-actions .button,
.admin-row-actions button {
  min-width: 58px;
  min-height: 34px;
  padding: 6px 10px;
}

.admin-user-table td:first-child {
  min-width: 220px;
}

.compact-input {
  min-width: 220px;
  padding: 8px 10px;
}

.compact-select {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  min-width: 90px;
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

.settings-group {
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.settings-group:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.settings-group h2 {
  margin: 0;
  font-size: 18px;
}

.notice {
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: var(--radius);
  color: var(--muted);
}

.footer {
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 1080px) {
  .layout,
  .hero,
  .content-shell {
    grid-template-columns: 1fr;
  }

  .admin-shell {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .sidebar,
  .aside {
    position: static;
  }

  .grid,
  .grid.two,
  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 54px;
    padding: 0 14px;
  }

  .brand {
    min-width: auto;
  }

  .actions {
    display: none;
  }

  .layout {
    padding: 12px 14px 34px;
    gap: 12px;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-nav a,
  .admin-nav button {
    flex: 0 0 auto;
  }

  .mobile-toggle {
    display: inline-flex;
    width: 100%;
    margin-bottom: 10px;
  }

  .sidebar {
    display: none;
  }

  .sidebar.open {
    display: block;
  }

  .hero,
  .prose,
  .admin-main {
    padding: 18px;
  }

  .hero-compact h1 {
    font-size: 23px;
    line-height: 1.18;
  }

  .hero p,
  .page-head p {
    font-size: 15px;
  }

  .section h2,
  .article h2 {
    font-size: 18px;
  }

  .grid,
  .grid.two,
  .admin-stats,
  .form-grid,
  .image-insert-row {
    grid-template-columns: 1fr;
  }

  .section-head,
  .page-head,
  .search-box {
    display: grid;
    grid-template-columns: 1fr;
  }

  .table-wrap,
  .table {
    display: block;
    overflow-x: auto;
  }
}
