:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --ink: #1d1c1a;
  --ink-2: #3a3834;
  --muted: #6b675f;
  --line: #e6e2d9;
  --accent: #2f5d50;
  --accent-hover: #264d42;
  --accent-soft: #e4efe9;
  --accent-ink: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fdf3dc;
  --members: #6b3fa0;
  --members-soft: #f1eafa;
  --focus: #2f5d50;
  --shadow: 0 1px 2px rgba(29, 28, 26, 0.06), 0 4px 16px rgba(29, 28, 26, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --font-ui: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-read: 'Iowan Old Style', 'Charter', 'Bitstream Charter', 'Sitka Text', Cambria, Georgia, serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --surface: #1c1c1a;
    --surface-2: #242421;
    --ink: #ecebe6;
    --ink-2: #d4d2cb;
    --muted: #a19d93;
    --line: #2f2e2a;
    --accent: #7cc2ab;
    --accent-hover: #93d1bc;
    --accent-soft: #1f302a;
    --accent-ink: #0f1a16;
    --danger: #f28b82;
    --danger-soft: #3a1f1c;
    --warn: #f0c36b;
    --warn-soft: #3a2f16;
    --members: #c4a6f0;
    --members-soft: #2c2338;
    --focus: #7cc2ab;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font-ui);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main,
main:focus-visible {
  flex: 1;
  outline: none;
  min-width: 0;
}
img {
  max-width: 100%;
}
a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover {
  color: var(--accent-hover);
}
h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}
h1 {
  font-size: clamp(1.75rem, 3vw + 1rem, 2.5rem);
}
h2 {
  font-size: 1.25rem;
}
h3 {
  font-size: 1.05rem;
}
p {
  margin: 0 0 1em;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
.icon {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.125em;
  flex: none;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: 8px;
  top: 8px;
  transform: translateY(-200%);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus {
  transform: none;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.875rem;
}
.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 16px;
}
.container.narrow {
  max-width: 740px;
}
.page-pad {
  padding-top: 40px;
  padding-bottom: 64px;
}
.page-loading {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
}

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: 500 0.95rem/1.2 var(--font-ui);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-ink);
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
}
.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover {
  filter: brightness(0.95);
  background: var(--danger);
  color: #fff;
}
.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: var(--line);
}
.btn-danger-ghost:hover {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-sm {
  min-height: 34px;
  padding: 6px 12px;
  font-size: 0.875rem;
}
.btn-lg {
  min-height: 48px;
  padding: 12px 22px;
  font-size: 1rem;
}
.btn-block {
  width: 100%;
}

.field {
  margin: 0 0 16px;
  border: 0;
  padding: 0;
  min-width: 0;
}
.field label,
.field legend {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 6px;
}
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
.field input:not([type='radio']):not([type='checkbox']),
.field textarea,
.search-bar input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  min-height: 42px;
}
.field input:focus,
.field textarea:focus,
.search-bar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
[aria-invalid='true'] {
  border-color: var(--danger) !important;
}
.field-error,
.form-error {
  color: var(--danger);
  font-size: 0.875rem;
  margin: 6px 0 0;
}
.form-error {
  background: var(--danger-soft);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin: 0 0 16px;
}
.hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 6px 0 0;
  overflow-wrap: anywhere;
}

/* ---------- Header / footer ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover {
  color: var(--ink);
}
.brand-mark {
  width: 30px;
  height: 30px;
}
.brand-mark rect {
  fill: var(--accent);
}
.brand-mark path,
.brand-mark circle {
  fill: var(--bg);
}
.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.main-nav > a:not(.btn) {
  color: var(--ink-2);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.main-nav > a:not(.btn):hover,
.main-nav > a[aria-current='page'] {
  background: var(--surface-2);
  color: var(--ink);
}
.user-menu {
  position: relative;
  margin-left: 4px;
}
.user-menu-btn {
  border: 0;
  background: none;
  padding: 2px;
  border-radius: 50%;
  cursor: pointer;
}
.user-menu-list,
.share-menu,
.more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 210px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 30;
  display: flex;
  flex-direction: column;
}
.user-menu-list[hidden],
.more-menu[hidden] {
  display: none;
}
.user-menu-head {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  font-size: 0.875rem;
}
.user-menu-head span {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-menu-list a,
.user-menu-list button,
.share-menu a,
.share-menu button,
.more-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: 0;
  background: none;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.user-menu-list a:hover,
.user-menu-list button:hover,
.share-menu a:hover,
.share-menu button:hover,
.more-menu button:hover {
  background: var(--surface-2);
}
.more-menu .danger {
  color: var(--danger);
}
.share-note {
  font-size: 0.8rem;
  color: var(--members);
  background: var(--members-soft);
  padding: 8px 10px;
  border-radius: 6px;
  margin: 0 0 4px;
}
.site-footer {
  border-top: 1px solid var(--line);
  padding: 24px 0;
  color: var(--muted);
  font-size: 0.875rem;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.footer-inner nav {
  display: flex;
  gap: 16px;
}
.footer-inner a {
  color: var(--muted);
}

/* ---------- Avatars, badges, chips ---------- */
.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  object-fit: cover;
  flex: none;
}
.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 0.7rem;
}
.avatar-md {
  width: 40px;
  height: 40px;
  font-size: 0.9rem;
}
.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 1.1rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.badge-draft {
  background: var(--warn-soft);
  color: var(--warn);
}
.badge-published {
  background: var(--accent-soft);
  color: var(--accent);
}
.badge-members {
  background: var(--members-soft);
  color: var(--members);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.875rem;
  text-decoration: none;
  white-space: nowrap;
}
a.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.chip-sm {
  padding: 2px 9px;
  font-size: 0.78rem;
}
.chip-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
a.chip-active:hover {
  color: var(--accent-ink);
}
.chip-count {
  opacity: 0.65;
  font-size: 0.8em;
}
.chip-removable {
  padding: 3px 4px 3px 10px;
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}
.chip-removable button {
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0 6px;
  border-radius: 50%;
}

/* ---------- Landing ---------- */
.hero {
  padding: 72px 0 48px;
  background: radial-gradient(1200px 400px at 50% -10%, var(--accent-soft), transparent 70%);
}
.hero-inner {
  max-width: 820px;
  text-align: center;
}
.hero h1 {
  font-family: var(--font-read);
  font-weight: 600;
  font-size: clamp(2rem, 4vw + 1rem, 3.25rem);
  letter-spacing: -0.02em;
}
.eyebrow {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
}
.lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto 28px;
}
.hero-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.feature p {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}
.section {
  padding-top: 48px;
  padding-bottom: 64px;
}
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.section-head h2 {
  margin: 0;
}

/* ---------- Blog listing ---------- */
.page-head {
  margin-bottom: 20px;
}
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  margin-bottom: 16px;
}
.search-bar > .icon {
  position: absolute;
  left: 12px;
  color: var(--muted);
}
.search-bar input {
  padding-left: 36px;
  flex: 1;
}
.search-bar-sm input {
  padding-left: 12px;
}
.tag-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 20px;
  scrollbar-width: thin;
}
.result-summary {
  color: var(--muted);
}
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 20px;
}
.post-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
}
.post-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.post-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.post-card-tags a,
.post-card-tags .badge {
  position: relative;
  z-index: 2;
}
.post-card-cover {
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
}
.post-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.post-card-cover-empty {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
}
.post-card-cover-empty span {
  font: 600 3rem var(--font-read);
  color: var(--accent);
  opacity: 0.5;
}
.post-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 22px;
}
.post-card-title {
  font: 600 1.2rem/1.3 var(--font-read);
  margin: 0;
}
.post-card-excerpt {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.byline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  flex-wrap: wrap;
  margin-top: auto;
}
.byline strong {
  color: var(--ink);
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  gap: 8px;
}
.empty-state {
  text-align: center;
  padding: 40px 16px;
  color: var(--muted);
}
.skeleton .post-card-body {
  gap: 10px;
}
.sk-line {
  height: 14px;
  border-radius: 6px;
  background: var(--surface-2);
  margin: 10px 0;
  animation: pulse 1.4s ease-in-out infinite;
}
.sk-short {
  width: 60%;
}
.sk-title {
  height: 36px;
  width: 80%;
}
@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}

/* ---------- Post page ---------- */
.owner-bar {
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 0.9rem;
}
.owner-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  padding-bottom: 10px;
}
.post-head {
  padding-top: 48px;
}
.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.post-title {
  font-family: var(--font-read);
  font-weight: 600;
  font-size: clamp(2rem, 3vw + 1.2rem, 3rem);
  letter-spacing: -0.02em;
}
.post-excerpt {
  font-size: 1.2rem;
  color: var(--muted);
  font-family: var(--font-read);
}
.post-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 24px 0 32px;
  flex-wrap: wrap;
}
.post-meta .byline {
  margin: 0;
}
.post-cover {
  max-width: 1000px;
  margin: 0 auto 32px;
}
.post-cover img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
  max-height: 520px;
  object-fit: cover;
}
.post-foot {
  padding-top: 32px;
  padding-bottom: 64px;
}
.author-box {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.author-box h3 {
  margin: 0 0 4px;
}
.author-box p {
  margin: 0;
}
.post-foot-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  gap: 8px;
  flex-wrap: wrap;
}
.share {
  position: relative;
  display: inline-block;
}
.post-foot-actions .share-menu {
  right: auto;
  left: 0;
  top: auto;
  bottom: calc(100% + 6px);
}
.gate {
  text-align: center;
  padding: 40px 24px;
  margin: 24px 0 64px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.gate-icon {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--members-soft);
  color: var(--members);
  font-size: 1.5rem;
  margin-bottom: 12px;
}
.gate-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---------- Rendered Markdown ---------- */
.prose {
  font-family: var(--font-read);
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--ink-2);
  overflow-wrap: break-word;
}
.prose > :first-child {
  margin-top: 0;
}
.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  font-family: var(--font-ui);
  color: var(--ink);
  margin: 1.8em 0 0.6em;
}
.prose h1 {
  font-size: 1.8rem;
}
.prose h2 {
  font-size: 1.45rem;
}
.prose h3 {
  font-size: 1.2rem;
}
.prose p,
.prose ul,
.prose ol,
.prose blockquote,
.prose pre,
.prose table {
  margin: 0 0 1.25em;
}
.prose ul,
.prose ol {
  padding-left: 1.4em;
}
.prose li {
  margin: 0.3em 0;
}
.prose img {
  border-radius: var(--radius-sm);
  display: block;
  margin: 1.5em auto;
  height: auto;
}
.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.2em 0 0.2em 1em;
  color: var(--muted);
  font-style: italic;
  margin-left: 0;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface-2);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}
.prose pre {
  background: #1d1f21;
  color: #e6e6e6;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.55;
}
.prose pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}
.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.5em 0;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  display: block;
  overflow-x: auto;
  font-family: var(--font-ui);
  font-size: 0.95rem;
}
.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: 8px 12px;
  text-align: left;
}

/* ---------- Auth ---------- */
.auth-wrap {
  display: grid;
  place-items: center;
  padding-left: 16px;
  padding-right: 16px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.auth-card h1 {
  font-size: 1.75rem;
}
.auth-foot {
  text-align: center;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Dashboard ---------- */
.dash {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  padding-top: 32px;
  padding-bottom: 64px;
}
.dash-nav nav {
  position: sticky;
  top: 88px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dash-nav a {
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
}
.dash-nav a:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.dash-nav a[aria-current='page'] {
  background: var(--accent-soft);
  color: var(--accent);
}
.dash-nav .dash-nav-new {
  color: var(--accent);
}
.dash-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.dash-head h1 {
  font-size: 1.75rem;
  margin-bottom: 4px;
}
.dash-head p {
  margin: 0;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.stat {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  color: var(--ink);
  text-decoration: none;
}
a.stat:hover {
  border-color: var(--accent);
  color: var(--ink);
}
.stat-num {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
}
.stat-label {
  color: var(--muted);
  font-size: 0.875rem;
}
.post-rows {
  list-style: none;
  margin: 0;
  padding: 0;
}
.post-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.post-row:first-child {
  border-top: 0;
}
.post-row-main {
  min-width: 0;
}
.post-row-title {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.post-row-title:hover {
  color: var(--accent);
}
.post-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.post-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}
.more {
  position: relative;
}
.list-count {
  margin: 0 0 4px;
}
.profile-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.radio-card {
  display: flex !important;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  cursor: pointer;
  font-weight: 400 !important;
}
.radio-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.radio-card input {
  margin-top: 4px;
  accent-color: var(--accent);
}
.radio-card span {
  display: flex;
  flex-direction: column;
}
.radio-card small {
  color: var(--muted);
}

.dash > * {
  min-width: 0;
}

/* ---------- Editor ---------- */
.editor-bar {
  position: sticky;
  top: 64px;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg);
  padding: 10px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.editor-status {
  display: flex;
  align-items: center;
  gap: 10px;
}
.editor-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}
.title-input {
  font: 600 clamp(1.5rem, 2vw + 1rem, 2.1rem) / 1.25 var(--font-read) !important;
  border: 0 !important;
  background: transparent !important;
  padding: 4px 0 !important;
  box-shadow: none !important;
}
.excerpt-input {
  resize: vertical;
  font-family: var(--font-read) !important;
  font-size: 1.05rem !important;
  color: var(--muted);
}
.side-card {
  padding: 0;
}
.side-card summary {
  padding: 14px 18px;
  font-weight: 600;
  cursor: pointer;
}
.side-card[open] summary {
  border-bottom: 1px solid var(--line);
}
.side-card > .field {
  padding: 0 18px;
}
.side-card > .field:first-of-type {
  padding-top: 16px;
}
.slug-input {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}
.slug-input span {
  padding: 10px 0 10px 10px;
  color: var(--muted);
  font-size: 0.9rem;
  align-self: center;
}
.slug-input input {
  border: 0 !important;
  padding-left: 2px !important;
  box-shadow: none !important;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}
.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: text;
}
.tag-input input {
  border: 0 !important;
  min-height: 30px !important;
  padding: 4px !important;
  flex: 1;
  min-width: 100px;
  box-shadow: none !important;
  width: auto !important;
}
.cover-preview img {
  margin-top: 10px;
  border-radius: var(--radius-sm);
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
  display: block;
}

.md-editor {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.md-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  flex-wrap: wrap;
}
.md-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
}
.md-tool {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.05rem;
}
.md-tool:hover {
  background: var(--surface);
  color: var(--ink);
}
.md-tool-text {
  font: 700 0.78rem var(--font-ui);
}
.md-sep {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 4px;
}
.md-modes {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.md-modes button {
  border: 0;
  background: none;
  padding: 5px 12px;
  border-radius: 6px;
  font: 500 0.85rem var(--font-ui);
  color: var(--muted);
  cursor: pointer;
}
.md-modes button[aria-selected='true'] {
  background: var(--accent-soft);
  color: var(--accent);
}
.md-panes {
  display: grid;
  min-height: 460px;
}
.md-input {
  width: 100%;
  min-height: 460px;
  border: 0;
  resize: vertical;
  padding: 18px;
  font: 0.95rem/1.7 var(--font-mono);
  background: var(--surface);
  color: var(--ink);
  tab-size: 2;
}
.md-input:focus {
  outline: none;
}
.md-preview {
  padding: 18px 22px;
  overflow: auto;
  max-height: 72vh;
  font-size: 1.05rem;
}
.md-editor[data-mode='write'] .md-preview,
.md-editor[data-mode='preview'] .md-input {
  display: none;
}
.md-editor[data-mode='split'] .md-panes {
  grid-template-columns: 1fr 1fr;
}
.md-editor[data-mode='split'] .md-preview {
  border-left: 1px solid var(--line);
  max-height: none;
}
.md-footer {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}

/* ---------- Dialog & toasts ---------- */
.dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 24px;
  width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}
.dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}
.dialog h2 {
  margin-bottom: 8px;
}
.dialog p {
  color: var(--muted);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}
.toasts {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 0.9rem;
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.3s, transform 0.3s;
}
.toast-success {
  background: var(--accent);
  color: var(--accent-ink);
}
.toast-error {
  background: var(--danger);
  color: #fff;
}
.toast-out {
  opacity: 0;
  transform: translateY(8px);
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .md-mode-split {
    display: none;
  }
  .editor-grid {
    grid-template-columns: 1fr;
  }
  .side-card:not([open]) {
    margin-bottom: 12px;
  }
}
@media (max-width: 900px) {
  .dash {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding-top: 16px;
  }
  .dash-nav nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .dash-nav a {
    white-space: nowrap;
    border: 1px solid var(--line);
    font-size: 0.9rem;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .features {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .hide-sm {
    display: none !important;
  }
  .hero {
    padding: 48px 0 32px;
  }
  .page-pad {
    padding-top: 24px;
  }
  .card {
    padding: 18px;
  }
  .auth-card {
    padding: 24px 20px;
  }
  .post-row {
    flex-direction: column;
    align-items: stretch;
  }
  .post-row-actions {
    justify-content: flex-start;
  }
  .post-row-title {
    white-space: normal;
  }
  .post-head {
    padding-top: 28px;
  }
  .prose {
    font-size: 1.07rem;
  }
  .search-bar .btn {
    padding: 8px 12px;
  }
  .editor-bar {
    top: 64px;
  }
  .md-input {
    min-height: 360px;
  }
  .more-menu {
    right: auto;
    left: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
