:root {
  --fg: #111;
  --muted: #6b6b6b;
  --bg: #fff;
  --bg-alt: #fafafa;
  --line: #e5e5e5;
  --accent: #1a8917;
  --danger: #c0392b;
  --radius: 6px;
  --serif: Charter, Georgia, 'Iowan Old Style', 'Apple Garamond', 'Baskerville', 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* Single vertical-rhythm unit reused across the public layout */
  --rhythm: 40px;
}
@media (max-width: 780px) { :root { --rhythm: 28px; } }

/* Defensive: visited links inherit non-visited color throughout the public
   layouts. We never differentiate visited links — the default browser purple
   isn't useful on a self-published site and creates ugly post-card states.
   Specific accent-color rules above (post-body, bio links, etc.) override this
   via their own :visited duplicates. */
body.public a:visited,
body.post-page a:visited,
body.admin a:visited,
body.learn a:visited { color: inherit; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--sans); color: var(--fg); background: var(--bg); line-height: 1.55; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* Header / Footer */
.site-header {
  background: rgba(255,255,255,0.92);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  position: sticky; top: 0; z-index: 10;
  /* Single hairline shadow instead of a hard border — softer, no double-line */
  box-shadow: 0 1px 0 rgba(17,17,17,0.06);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.site-header .brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-weight: 700; font-size: 22px;
  color: var(--fg); text-decoration: none; letter-spacing: -.015em;
}
.brand-mark {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
  /* Subtle inner highlight makes the dot feel jewel-like rather than flat */
  box-shadow: inset 0 -1px 1px rgba(0,0,0,0.15);
}
.brand-text { line-height: 1; }
.site-header nav { display: flex; align-items: center; gap: 24px; }
.site-header nav a, .site-header nav a:visited { color: var(--fg); text-decoration: none; font-size: 14.5px; font-weight: 500; }
.site-header nav a:hover { color: var(--accent); }

/* Burger toggle — hidden on desktop, visible on mobile */
.nav-toggle { display: none; }
.nav-burger {
  display: none;
  width: 38px; height: 38px; cursor: pointer;
  flex-direction: column; justify-content: center; align-items: center; gap: 4px;
  border-radius: 6px;
}
.nav-burger:hover { background: var(--bg-alt); }
.nav-burger span { display: block; width: 22px; height: 2px; background: var(--fg); border-radius: 2px; transition: transform .2s, opacity .2s; }

/* Admin install button (public header no longer has one) */
.pwa-install {
  background: var(--accent); color: #fff; border: 0;
  padding: 6px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 600; cursor: pointer;
}
.pwa-install:hover { opacity: .9; }
.pwa-install.side { margin-top: 16px; width: 100%; padding: 8px 12px; }

.site-footer { margin-top: 80px; padding: 24px 0; color: var(--muted); font-size: 13px; }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-credit .heart {
  color: #d11a2a;
  display: inline-block;
  font-size: 14px;
  margin: 0 1px;
  transform-origin: center;
  animation: heart-beat 2.4s ease-in-out infinite;
}
@keyframes heart-beat {
  0%, 60%, 100% { transform: scale(1); }
  10%           { transform: scale(1.18); }
  20%           { transform: scale(0.95); }
  30%           { transform: scale(1.12); }
  40%           { transform: scale(1); }
}
@media (max-width: 600px) {
  .site-footer .wrap { flex-direction: column; gap: 6px; text-align: center; }
}

/* Public — hero. Tagline is the H1 on the home page (real subject matter); the
   site name lives in the header. On category pages the H1 is the category name. */
.hero { text-align: center; padding: calc(var(--rhythm) * 1.4) 0 var(--rhythm); }
.hero h1 {
  font-family: var(--serif);
  font-size: 44px; line-height: 1.15; letter-spacing: -.02em; font-weight: 700;
  margin: 0 auto;
  max-width: 18ch;        /* keep the line short — looks composed */
  color: var(--fg);
}
.hero .tagline { color: var(--muted); font-size: 17px; margin: 14px auto 0; max-width: 580px; line-height: 1.5; }

/* Combined search + category in a single elegant shell */
.filter-bar { margin-top: var(--rhythm); display: flex; justify-content: center; }
.search-shell {
  display: flex; align-items: center;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  height: 48px;
  width: 100%; max-width: 560px;
  padding: 0 6px 0 18px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-shell:focus-within { border-color: var(--fg); box-shadow: 0 0 0 3px rgba(17,17,17,0.06); background: #fff; }
.search-icon { color: var(--muted); display: inline-flex; flex-shrink: 0; }
.search-shell input[type=search] {
  border: 0; background: transparent; outline: none;
  font-size: 15px; font-family: inherit; color: var(--fg);
  flex: 1; min-width: 0; height: 100%; padding: 0 12px;
}
.search-shell input[type=search]::placeholder { color: var(--muted); }
.search-divider { width: 1px; height: 22px; background: var(--line); flex-shrink: 0; }
.cat-trigger { position: relative; display: flex; align-items: center; height: 100%; padding: 0 8px 0 14px; }
.cat-trigger select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  border: 0; background: transparent; outline: none;
  font-size: 14px; font-family: inherit; color: var(--muted);
  cursor: pointer; padding-right: 22px;
  /* Native select hover/focus inherits from .search-shell:focus-within */
}
.cat-trigger select:focus, .cat-trigger select:hover { color: var(--fg); }
.cat-trigger .chevron {
  position: absolute; right: 8px; pointer-events: none;
  color: var(--muted); display: inline-flex;
}

/* Active-filters chips */
.active-filters {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin: 24px 0 8px; padding: 0 4px;
}
.fchip {
  font-size: 13px; background: var(--bg-alt); border: 1px solid var(--line);
  padding: 5px 12px; border-radius: 999px; color: #333;
}
.active-filters .clear { font-size: 13px; color: var(--muted); text-decoration: none; }
.active-filters .clear:hover { color: var(--fg); text-decoration: underline; }

.empty { padding: 60px 0; text-align: center; color: var(--muted); }

/* Section headings — quiet eyebrow style replaces the old chunky H2 */
.section-eyebrow {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted);
  /* Hero's bottom padding already provides one rhythm-step;
     eyebrow only needs 0.5 + 0.4 to feel composed against it. */
  margin: calc(var(--rhythm) * 0.5) 0 calc(var(--rhythm) * 0.4);
  display: flex; align-items: center; gap: 12px;
}
.section-eyebrow + .featured-card,
.section-eyebrow + .latest-grid { margin-top: 0; }
.section-eyebrow::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

/* Old class kept for any internal admin pages still using it */
.section-title {
  font-family: var(--serif); font-size: 22px; font-weight: 700;
  margin: 32px 0 14px; letter-spacing: -.01em;
}

/* Featured Post — refined: whole card is one click target, no fake button */
.featured-card {
  position: relative;                         /* anchor for the .card-link overlay */
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.featured-card:hover { border-color: #cfcfcf; box-shadow: 0 6px 24px rgba(17,17,17,0.04); transform: translateY(-1px); }
.featured-card .featured-body { padding: 24px 28px 26px; display: flex; flex-direction: column; gap: 12px; }
.featured-cover { display: block; aspect-ratio: 21 / 9; background: #eee; overflow: hidden; }
.featured-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.featured-card:hover .featured-cover img { transform: scale(1.025); }
.featured-card .meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; align-items: center; }
.featured-card .meta .dot { color: #bbb; }
.featured-title { font-family: var(--serif); font-size: 28px; margin: 0; letter-spacing: -.015em; line-height: 1.18; font-weight: 700; }
.featured-title a, .featured-title a:visited { color: var(--fg); text-decoration: none; }
.featured-sub { color: #4a4a4a; margin: 0; font-size: 16px; line-height: 1.5; }

/* Whole-card click target. The pseudo-element overlays the entire card so
   clicking anywhere navigates to the post. Sits below the chip (which has
   higher z-index) so the chip remains independently clickable. */
/* Whole-card link — applied to the title <a> inside any card.
   Defines color/decoration directly so it doesn't depend on which heading
   element wraps it (h2/h3/etc.) and covers visited state explicitly. */
.card-link, .card-link:visited {
  position: static;
  color: var(--fg);
  text-decoration: none;
}
.card-link:hover { color: var(--accent); }
.card-link::after {
  content: ''; position: absolute; inset: 0; z-index: 1;
}
.featured-card .category-chip,
.latest-card .category-chip { position: relative; z-index: 2; align-self: flex-start; }

/* Latest posts grid */
.latest-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.latest { margin-top: calc(var(--rhythm) * 0.4); }

/* Load more button — sits below the latest grid */
.load-more-wrap { display: flex; justify-content: center; margin: calc(var(--rhythm) * 0.8) 0 var(--rhythm); transition: opacity .4s; }
.load-more-wrap.done { opacity: 0.6; }
.load-more-btn {
  display: inline-flex; align-items: center; gap: 10px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 22px;
  color: var(--fg); font-size: 14px; font-weight: 500; cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.load-more-btn:hover:not(:disabled) { border-color: var(--fg); background: var(--bg-alt); transform: translateY(-1px); }
.load-more-btn:disabled { cursor: default; opacity: 0.7; }
.lm-spin {
  animation: lm-spin 0.8s linear infinite;
  stroke-dasharray: 40 60;
}
@keyframes lm-spin { to { transform: rotate(360deg); } }
.latest-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.latest-card:hover { border-color: #cfcfcf; box-shadow: 0 6px 20px rgba(17,17,17,0.04); transform: translateY(-1px); }
.latest-card .latest-body { padding: 18px 22px 20px; display: flex; flex-direction: column; gap: 8px; }
.latest-card.has-cover .latest-body { padding-top: 16px; }
.latest-card:not(.has-cover) .latest-body { padding-top: 22px; }
.latest-cover { display: block; aspect-ratio: 16/9; background: #eee; overflow: hidden; }
.latest-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .5s ease; }
.latest-card:hover .latest-cover img { transform: scale(1.035); }
.latest-card:hover { border-color: #cfcfcf; transform: translateY(-1px); }
.latest-card .category-chip { align-self: flex-start; margin-bottom: 4px; }
.latest-card h3, .latest-card .card-h { font-family: var(--serif); font-size: 22px; margin: 2px 0; letter-spacing: -.01em; line-height: 1.25; font-weight: 700; }
.latest-card h3 a, .latest-card .card-h a, .latest-card h3 a:visited, .latest-card .card-h a:visited { color: var(--fg); text-decoration: none; }
.latest-card h3 a:hover, .latest-card .card-h a:hover { color: var(--accent); }
.latest-card .sub { color: #4a4a4a; font-size: 15px; margin: 0; }
.latest-card .excerpt { color: var(--muted); font-size: 14px; margin: 2px 0 6px; line-height: 1.5; }
.latest-card .meta.small { color: var(--muted); font-size: 13px; display: flex; gap: 6px; align-items: center; }
.latest-card .meta.small .dot { color: #bbb; }

/* Mobile */
@media (max-width: 780px) {
  .wrap { padding: 0 18px; }
  .site-header .wrap { height: 64px; position: relative; }
  .site-header .brand { font-size: 22px; }

  /* Show the burger */
  .nav-burger { display: inline-flex; }

  /* Drawer: hidden by default, slides down when checkbox is checked */
  .site-header nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 8px 24px rgba(0,0,0,0.05);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
    pointer-events: none;
  }
  .site-header nav a {
    padding: 12px 22px;
    border-bottom: 1px solid var(--bg-alt);
    font-size: 16px;
  }
  .site-header nav a:last-child { border-bottom: 0; }

  /* Drawer-open state */
  .nav-toggle:checked ~ nav {
    max-height: calc(100vh - 64px);
    overflow-y: auto;
    pointer-events: auto;
  }

  /* Animate burger → X */
  .nav-toggle:checked ~ .nav-burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav-toggle:checked ~ .nav-burger span:nth-child(2) { opacity: 0; }
  .nav-toggle:checked ~ .nav-burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

  .hero { padding: calc(var(--rhythm) * 1.2) 0 calc(var(--rhythm) * 0.8); }
  .hero h1 { font-size: 32px; max-width: 16ch; }
  .hero .tagline { font-size: 15px; }

  .search-shell { height: 46px; padding: 0 4px 0 14px; }
  .cat-trigger { padding: 0 6px 0 10px; }
  .cat-trigger select { font-size: 13px; max-width: 110px; }

  .section-eyebrow { font-size: 10px; letter-spacing: .12em; margin: calc(var(--rhythm) * 0.5) 0 calc(var(--rhythm) * 0.3); }

  .featured-card .featured-body { padding: 18px 18px 20px; gap: 10px; }
  .featured-title { font-size: 22px; }
  .featured-sub { font-size: 15px; }

  .latest-grid { grid-template-columns: 1fr; gap: 14px; }
  .latest-card .latest-body { padding: 16px 18px 18px; }
  .latest-card h3, .latest-card .card-h { font-size: 20px; }
}

@media (max-width: 420px) {
  .hero h1 { font-size: 28px; }
  .cat-trigger select { max-width: 84px; }
}
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.tag { font-size: 12px; background: var(--bg-alt); border: 1px solid var(--line); color: var(--muted); padding: 4px 10px; border-radius: 999px; text-decoration: none; }
.tag:hover { color: var(--fg); }

.category-chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .01em;
  color: var(--accent);
  background: transparent;
  border: 1px solid rgba(26, 137, 23, 0.35);
  padding: 3px 11px 4px;
  border-radius: 999px;
  text-decoration: none;
  transition: background-color .15s, border-color .15s;
}
.category-chip:hover { background: rgba(26, 137, 23, 0.06); border-color: rgba(26, 137, 23, 0.55); }
.post-head .category-chip { margin-bottom: 14px; }

/* Breadcrumb */
.breadcrumb { font-size: 13px; color: var(--muted); margin: 20px 0 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.breadcrumb a, .breadcrumb a:visited { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--fg); }
.breadcrumb span[aria-current] { color: var(--fg); font-weight: 500; }
.breadcrumb span[aria-hidden] { color: #bbb; }

/* Single post */
.post { padding: 20px 0 60px; }
.post-head h1 { font-family: var(--serif); font-size: 44px; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 10px; }
.post-head .subtitle { color: var(--muted); font-size: 20px; margin: 0 0 14px; }
.post-cover img { width: 100%; max-height: 500px; object-fit: cover; border-radius: var(--radius); margin: 24px 0; }
.post-body { font-family: var(--serif); font-size: 20px; line-height: 1.72; color: #1a1a1a; }
.post-body h1 { font-size: 34px; margin-top: 1.5em; }
.post-body h2 { font-size: 28px; margin-top: 1.4em; }
.post-body h3 { font-size: 22px; margin-top: 1.3em; }
.post-body p { margin: 1em 0; }
.post-body a, .post-body a:visited { color: var(--accent); }
.post-body blockquote { border-left: 3px solid var(--fg); margin: 1em 0; padding: 6px 16px; color: #333; font-style: italic; }
.post-body code { background: #f4f4f4; padding: 2px 6px; border-radius: 4px; font-size: .85em; }
.post-body pre { background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: var(--radius); overflow-x: auto; font-size: 14px; }
.post-body pre code { background: transparent; padding: 0; color: inherit; }
.post-body img { max-width: 100%; border-radius: var(--radius); }
.post .back { margin-top: 40px; }
.post .back a, .post .back a:visited { color: var(--muted); text-decoration: none; }
.post .back a:hover { color: var(--fg); }

/* Auth */
.auth-card { max-width: 380px; margin: 60px auto; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.auth-card h1 { margin: 0 0 12px; font-family: var(--serif); }
.auth-card label { display: block; margin: 14px 0; font-size: 14px; color: #333; }
.auth-card input { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; margin-top: 4px; }
.auth-card input:focus { outline: none; border-color: var(--fg); }
.auth-card button { width: 100%; padding: 11px; background: var(--fg); color: #fff; border: 0; border-radius: var(--radius); font-size: 15px; cursor: pointer; margin-top: 8px; }
.auth-card .muted { color: var(--muted); font-size: 13px; margin: 0 0 8px; }
.error { background: #fef2f2; color: #991b1b; padding: 10px 12px; border-radius: var(--radius); margin: 10px 0; font-size: 14px; }
.flash { background: #ecfdf5; color: #065f46; padding: 10px 12px; border-radius: var(--radius); margin: 10px 0; font-size: 14px; }

/* Admin shell */
body.admin .wrap { max-width: 1120px; }
.admin-shell {
  position: relative;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 30px; padding: 30px 0;
  transition: grid-template-columns .25s ease;
}
.admin-shell.collapsed { grid-template-columns: 0 1fr; gap: 0; }
.admin-side {
  border-right: 1px solid var(--line); padding-right: 20px;
  overflow: hidden;
  transition: opacity .2s, padding .25s, border .25s;
}
.admin-shell.collapsed .admin-side { opacity: 0; pointer-events: none; padding-right: 0; border-right: 0; }
.admin-side .who { font-size: 13px; color: var(--muted); margin-bottom: 16px; padding-left: 6px; }
.admin-side nav { display: flex; flex-direction: column; gap: 2px; }
.admin-side .nav-link {
  display: flex; align-items: center; gap: 10px;
  color: #333; text-decoration: none; padding: 8px 10px;
  border-radius: var(--radius); font-size: 14px;
  white-space: nowrap;
}
.admin-side .nav-link.active { background: var(--bg-alt); color: var(--fg); font-weight: 600; }
.admin-side .nav-link:hover { background: var(--bg-alt); }
.admin-side .nav-link.logout { margin-top: 20px; color: var(--danger); }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.nav-icon svg { width: 16px; height: 16px; }
.nav-label { font-size: 14px; line-height: 1.2; }

/* Floating collapse toggle — sits at the sidebar's right edge when expanded,
   slides to the left edge of the main area when collapsed. Always visible. */
.admin-collapse-toggle {
  position: absolute; top: 26px; left: 198px;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); cursor: pointer;
  transition: background .15s, color .15s, transform .25s ease, left .25s ease;
  z-index: 5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.admin-collapse-toggle:hover { background: var(--bg-alt); color: var(--fg); }
.admin-shell.collapsed .admin-collapse-toggle { left: -10px; transform: rotate(90deg); }
.admin-main h1 { font-family: var(--serif); margin: 0 0 20px; }

.row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.row-head h1 { margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 30px; }
.card { background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; }
.card .num { font-size: 32px; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 13px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
@media (max-width: 800px) {
  .two-col { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-shell.collapsed { grid-template-columns: 1fr; gap: 30px; }
  .admin-shell.collapsed .admin-side { opacity: 1; pointer-events: auto; padding-right: 0; }
  .admin-side { border-right: 0; border-bottom: 1px solid var(--line); padding-right: 0; padding-bottom: 16px; }
  .admin-collapse-toggle { display: none; }   /* mobile already stacks; toggle is irrelevant */
}

.simple-list { list-style: none; padding: 0; margin: 0; }
.simple-list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; font-size: 14px; }
.simple-list li a { color: var(--fg); text-decoration: none; flex: 1; }
.simple-list li a:hover { color: var(--accent); }
.muted { color: var(--muted); font-size: 13px; }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.pill-published { background: #dcfce7; color: #166534; }
.pill-draft { background: #fef3c7; color: #854d0e; }

.pri { font-size: 11px; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; font-weight: 600; }
.pri-low    { background: #e0f2fe; color: #075985; }
.pri-medium { background: #fef3c7; color: #854d0e; }
.pri-high   { background: #fee2e2; color: #991b1b; }

/* Buttons */
.btn { background: var(--fg); color: #fff; border: 0; padding: 9px 16px; border-radius: var(--radius); font-size: 14px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { opacity: .9; }
.btn-ghost { background: transparent; color: var(--fg); padding: 9px 16px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; cursor: pointer; text-decoration: none; display: inline-block; }
.btn-sm { font-size: 12px; padding: 4px 10px; background: var(--fg); color: #fff; border-radius: var(--radius); text-decoration: none; margin-left: 10px; }
.btn-danger-sm { background: transparent; border: 1px solid var(--line); color: var(--danger); padding: 3px 9px; border-radius: var(--radius); font-size: 12px; cursor: pointer; }
.btn-danger-sm:hover { background: #fef2f2; }
.link-sm { font-size: 12px; color: var(--muted); margin-left: 8px; text-decoration: none; }
.link-sm:hover { color: var(--fg); }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 8px 14px; text-decoration: none; color: var(--muted); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--fg); border-color: var(--fg); font-weight: 600; }

/* Tables */
.data { width: 100%; border-collapse: collapse; }
.data th, .data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.data th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.data td a { color: var(--fg); text-decoration: none; font-weight: 500; }
.data td a:hover { color: var(--accent); }

/* Legacy post-form (still used by other forms — keeping it minimal) */
label.inline { display: inline-flex; align-items: center; gap: 6px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--fg); font-size: 14px; margin: 0 10px 0 0; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.preview { background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-height: 400px; overflow: auto; font-size: 16px; }

/* ============================================================ */
/* Post editor — Notion/Ghost-style two-column with sticky bar  */
/* ============================================================ */

body.admin-editor .admin-main { padding-top: 0; } /* sticky bar provides top space */

.pe-form { display: block; }

/* === Sticky top bar ====================================================== */
.pe-topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 18px;
  margin: 0 -18px 18px;                   /* extend to edges of admin-main */
  background: rgba(255,255,255,0.94);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.pe-topbar-left, .pe-topbar-right { display: flex; align-items: center; gap: 12px; }
.pe-back {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px; color: var(--fg); text-decoration: none; font-size: 18px;
}
.pe-back:hover { background: var(--bg-alt); }
.pe-context { display: flex; align-items: center; gap: 10px; }
.pe-mode { font-size: 13px; color: var(--muted); }
.status-pill { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .05em; }
.status-pill-draft     { background: #fef3c7; color: #854d0e; }
.status-pill-scheduled { background: #ede9fe; color: #5b21b6; }
.status-pill-published { background: #dcfce7; color: #166534; }
.pill-scheduled        { background: #ede9fe; color: #5b21b6; }
.pe-saved { font-size: 12px; color: var(--muted); white-space: nowrap; }
.btn-ghost-sm { font-size: 13px; color: var(--fg); text-decoration: none; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; }
.btn-ghost-sm:hover { background: var(--bg-alt); }

/* === Two-column grid ===================================================== */
.pe-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}

/* === Main editing column ================================================= */
/* min-width:0 + max-width:100% + overflow-x:hidden together prevent the
   column blowing out under the sidebar when an input/textarea has a long
   value or its UA-default intrinsic size kicks in. */
.pe-main { min-width: 0; max-width: 100%; overflow-x: hidden; }
.pe-title-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-width: 0;
}
.pe-title-row .pe-title { flex: 1; min-width: 0; }
.ai-gen-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: linear-gradient(135deg, #f0e5ff 0%, #e0f0ff 100%);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 999px;
  color: #6d28d9; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.ai-gen-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(139, 92, 246, 0.2); }
.ai-gen-btn:disabled { opacity: .5; cursor: not-allowed; }
.ai-spin {
  display: inline-block; width: 12px; height: 12px;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: ai-spin 0.7s linear infinite;
  vertical-align: -2px; margin-right: 4px;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

/* Inline AI generate panel — appears below the title row when ✨ AI write is clicked */
.ai-gen-panel {
  margin: 8px 0 14px;
  padding: 14px 16px;
  background: linear-gradient(135deg,#f5f3ff 0%,#eff6ff 100%);
  border: 1px solid #ddd6fe;
  border-radius: 10px;
}
.ai-gen-panel[hidden] { display: none !important; }
.ai-gen-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ai-gen-row label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: #5b21b6; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
}
.ai-gen-row select {
  padding: 6px 10px; border: 1px solid #ddd6fe; border-radius: 6px;
  background: #fff; font-family: inherit; font-size: 13px;
  text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--fg);
}
.ai-go-btn { background: linear-gradient(135deg,#7c3aed 0%,#6d28d9 100%); border: 0; color: #fff; padding: 8px 18px; border-radius: 6px; font-weight: 600; cursor: pointer; }
.ai-go-btn:hover:not(:disabled) { opacity: .92; }
.ai-go-btn:disabled { opacity: .6; cursor: wait; }
.ai-gen-msg { margin: 10px 0 0; font-size: 13px; padding: 8px 12px; border-radius: 6px; }
.ai-gen-msg.warn    { background: #fef3c7; color: #854d0e; }
.ai-gen-msg.err     { background: #fef2f2; color: #991b1b; }
.ai-gen-msg.ok      { background: #ecfdf5; color: #065f46; }
.ai-gen-msg.working { background: #eff6ff; color: #1e40af; }

/* Input shake when title is required */
.input-shake { animation: input-shake .4s; }
@keyframes input-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-3px); }
  40%, 80% { transform: translateX(3px); }
}

.pe-title, .pe-subtitle {
  display: block;
  width: 100%; max-width: 100%; min-width: 0;
  box-sizing: border-box;
  border: 0; outline: none; background: transparent;
  font-family: var(--serif); color: var(--fg);
  padding: 6px 0; margin: 0;
}

/* Sidebar status block — datetime input below the radios */
.sb-pubat-label { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--bg-alt); }
.sb-sublabel { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.sb-input[type=datetime-local] { font-family: inherit; }
.pe-title {
  font-size: 38px; font-weight: 700; letter-spacing: -.025em; line-height: 1.15;
}
.pe-title::placeholder { color: #ccc; font-weight: 400; }
.pe-subtitle {
  font-size: 19px; color: var(--muted); padding: 0 0 18px; border-bottom: 1px solid var(--line);
}
.pe-subtitle::placeholder { color: #ccc; }

.pe-writetabs {
  display: flex; align-items: center; gap: 4px;
  border-bottom: 1px solid var(--line);
  margin: 16px 0 14px;
}
.pe-tab {
  background: 0; border: 0; cursor: pointer;
  padding: 8px 14px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.pe-tab:hover { color: var(--fg); }
.pe-tab.active { color: var(--fg); font-weight: 600; border-color: var(--fg); }
.pe-tab-flex { flex: 1; }
.pe-stats { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

.pe-pane { min-height: 480px; }
.pe-pane[hidden] { display: none; }
.pe-pane-write textarea {
  width: 100%; min-height: 600px;
  border: 0; outline: none; background: transparent;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 15px; line-height: 1.65; color: var(--fg);
  resize: vertical;
  padding: 4px 0;
}
.pe-pane-preview .preview {
  background: transparent; border: 0; padding: 0; min-height: 600px; font-size: 17px;
}

/* === Sidebar ============================================================= */
.pe-side {
  position: sticky; top: 78px;       /* below the topbar */
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.sb {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 8px;
}
.sb:last-child { border-bottom: 0; }
.sb-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600;
}
.sb-input {
  width: 100%;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  font-family: inherit; font-size: 14px; color: var(--fg); background: #fff;
}
.sb-input:focus { outline: none; border-color: var(--fg); }
.sb-link { font-size: 12px; color: var(--accent); text-decoration: none; }
.sb-link:hover { text-decoration: underline; }
.sb-hint { font-size: 12px; color: var(--muted); }
.sb-hint code, .sb-hint span { color: var(--fg); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; }
.sb-radio-row { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--fg); }
.sb-radio-row label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.sb-checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 6px; cursor: pointer; }

/* Cover dropzone */
.cover-dropzone { display: flex; flex-direction: column; gap: 8px; }
.cover-dropzone.dragging .cover-pick { border-color: var(--accent); background: rgba(26,137,23,0.05); }
.cover-pick {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; width: 100%; min-height: 70px;
  background: var(--bg-alt); border: 2px dashed var(--line); border-radius: 8px;
  padding: 14px 12px; cursor: pointer;
  font-size: 13px; color: var(--muted);
  text-align: center;
}
.cover-pick small { font-size: 11px; }
.cover-pick:hover { border-color: var(--fg); color: var(--fg); }
.cover-preview img { width: 100%; max-height: 140px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.cover-preview[hidden] { display: none; }

/* === Mobile / narrow screens ============================================= */
@media (max-width: 1080px) {
  .pe-grid { grid-template-columns: 1fr; }
  .pe-side { position: static; }
}
@media (max-width: 700px) {
  .pe-topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; margin: 0 -14px 14px; }
  .pe-topbar-left, .pe-topbar-right { gap: 8px; }
  .pe-saved { display: none; }                 /* save space */
  .pe-title { font-size: 28px; }
  .pe-subtitle { font-size: 17px; }
  .pe-pane-write textarea { min-height: 400px; font-size: 14px; }
  .pe-title-row { flex-wrap: wrap; }
  .ai-gen-btn { width: 100%; justify-content: center; }
}

/* === Schedule page styles === */
.schedule-block { margin: 24px 0 36px; }
.schedule-block .section-h { font-family: var(--serif); font-size: 20px; margin: 0 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); display: inline-block; }
.schedule-form { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 10px; padding: 18px 22px; }
.schedule-form .row-3 { display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 14px; }
.schedule-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 16px; }
.schedule-form input[type=text], .schedule-form input[type=number], .schedule-form input[type=date] { padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; font-family: inherit; font-size: 14px; }
@media (max-width: 700px) { .schedule-form .row-3 { grid-template-columns: 1fr; } }
.draft-pick { list-style: none; padding: 0; margin: 0 0 14px; max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.draft-pick li { padding: 8px 12px; border-bottom: 1px solid var(--bg-alt); }
.draft-pick li:last-child { border-bottom: 0; }
.draft-pick label { display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: center; cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--fg); margin: 0; }
.draft-pick .when { font-size: 12px; }

/* Todos */
.todo-add { display: grid; grid-template-columns: 1fr 120px 150px auto; gap: 8px; margin-bottom: 16px; }
.todo-add input[type=text], .todo-add input[type=date], .todo-add select, .todo-add textarea {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; font-family: inherit;
}
.todo-add .title-row { grid-column: 1 / -1; display: flex; gap: 6px; align-items: stretch; }
.todo-add .title-row input[type=text] { flex: 1; }
.todo-add .notes-row { grid-column: 1 / -1; }
.todo-add .notes-row textarea { width: 100%; resize: vertical; }
.mic-btn, .parse-btn {
  border: 1px solid var(--line); background: #fff; border-radius: var(--radius);
  padding: 0 12px; font-size: 16px; cursor: pointer;
}
.mic-btn { width: 40px; padding: 0; }
.mic-btn:hover, .parse-btn:hover { background: var(--bg-alt); }
.mic-btn.recording { background: #fee2e2; border-color: #dc2626; color: #991b1b; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.5); } 50% { box-shadow: 0 0 0 6px rgba(220,38,38,0); } }
.ai-status { grid-column: 1 / -1; font-size: 13px; padding: 6px 10px; border-radius: var(--radius); }
.ai-status.working { background: #eff6ff; color: #1e40af; }
.ai-status.ok      { background: #ecfdf5; color: #065f46; }
.ai-status.err     { background: #fef2f2; color: #991b1b; }
@media (max-width: 700px) { .todo-add { grid-template-columns: 1fr 1fr; } .todo-add .title-row { flex-wrap: wrap; } .parse-btn { width: 100%; } }

.todo-edit { background: var(--bg-alt); border: 1px solid var(--line); padding: 16px; border-radius: var(--radius); margin-bottom: 20px; }
.todo-edit label { display: block; margin: 8px 0; font-size: 13px; color: var(--muted); }
.todo-edit input[type=text], .todo-edit input[type=date], .todo-edit select, .todo-edit textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); font-family: inherit; font-size: 14px;
}
.todo-edit .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.todo-list { list-style: none; padding: 0; margin: 0; }
.todo { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.todo.done .title { text-decoration: line-through; color: var(--muted); }
.todo .check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); background: #fff; cursor: pointer; font-size: 14px; color: var(--accent); }
.todo.done .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.todo .body .title { font-size: 15px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.todo .body .notes { margin-top: 4px; font-size: 13px; color: #555; }
.todo .due { font-size: 12px; color: var(--muted); }
.todo .actions { display: flex; gap: 8px; align-items: center; }
.inline-form { display: inline; }

/* Engagement row — like + view stats above the share row */
.engagement-row {
  display: flex; align-items: center; gap: 16px;
  margin: 32px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
}
.like-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; cursor: pointer;
  color: var(--muted); font-size: 14px; font-weight: 500;
  transition: color .2s, border-color .2s, background .2s, transform .15s;
}
.like-btn:hover { color: #d11a2a; border-color: rgba(209, 26, 42, 0.4); }
.like-btn .heart { transition: fill .2s, transform .2s; }
.like-btn.liked { color: #d11a2a; border-color: rgba(209, 26, 42, 0.4); background: rgba(209, 26, 42, 0.06); }
.like-btn.liked .heart { fill: #d11a2a; }
.like-btn.bumping .heart { animation: heart-bump .5s ease; }
.like-btn .like-count { font-variant-numeric: tabular-nums; min-width: 1ch; text-align: left; }
@keyframes heart-bump {
  0% { transform: scale(1); }
  30% { transform: scale(1.35); }
  60% { transform: scale(0.92); }
  100% { transform: scale(1); }
}
.view-stat {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: 14px;
}
.view-stat .view-count { font-variant-numeric: tabular-nums; color: var(--fg); font-weight: 500; }
.view-stat .view-label { color: var(--muted); }

@media (max-width: 600px) {
  .engagement-row { gap: 10px; }
  .view-stat .view-label { display: none; }   /* keep just "1,234" on tight screens */
}

/* Share row */
.share-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin: 14px 0 16px; padding: 14px 0 18px; border-bottom: 1px solid var(--line);
}
/* When the engagement row is right above, drop its bottom border so we don't
   double up the divider. */
.engagement-row + .share-row { border-top: 0; padding-top: 14px; }
.share-row .share-label { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-right: 6px; }
.share-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; color: #333; font-size: 13px; font-weight: 500; text-decoration: none;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
}
.share-btn:hover { background: var(--bg-alt); border-color: #cfcfcf; color: var(--fg); }
.share-btn svg { flex-shrink: 0; }
.share-btn.x:hover        { background: #000; color: #fff; border-color: #000; }
.share-btn.linkedin:hover { background: #0a66c2; color: #fff; border-color: #0a66c2; }
.share-btn.reddit:hover   { background: #ff4500; color: #fff; border-color: #ff4500; }
.share-btn.hn:hover       { background: #ff6600; color: #fff; border-color: #ff6600; }
.share-btn.whatsapp:hover { background: #25D366; color: #fff; border-color: #25D366; }
.share-btn.email:hover    { background: #555; color: #fff; border-color: #555; }
.share-btn.copy.copied    { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Read next — three-up grid that exactly matches the 3 related posts we fetch */
.read-next { padding: 0 0 60px; }
.read-next .section-title { margin-top: 24px; }
.read-next .latest-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.read-next .latest-card h3, .read-next .latest-card .card-h { font-size: 18px; line-height: 1.25; }
.read-next .latest-card .latest-body { padding: 16px 18px 18px; gap: 6px; }
.read-next .latest-card .sub { display: none; }      /* keep the cards short */
.read-next .latest-card .excerpt { font-size: 13px; }

@media (max-width: 900px) {
  .read-next .latest-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .read-next .latest-grid { grid-template-columns: 1fr; }
}

/* Contact */
.contact-form {
  max-width: 640px; margin: 32px auto; display: flex; flex-direction: column; gap: 18px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 28px 32px;
}
.contact-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.contact-form input[type=text], .contact-form input[type=email], .contact-form textarea {
  padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; font-family: inherit; color: var(--fg);
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px rgba(17,17,17,0.06); }
.contact-form textarea { resize: vertical; min-height: 140px; line-height: 1.5; }
.contact-form .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.contact-form .small { font-size: 12px; }
.contact-form .form-actions { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 0; }
.contact-form .hp { position: absolute; left: -9999px; top: -9999px; height: 0; overflow: hidden; }

/* "Replying to" context banner above the contact form */
.contact-context {
  max-width: 640px; margin: 0 auto 18px; padding: 14px 20px;
  background: rgba(26,137,23,0.06); border-left: 4px solid var(--accent); border-radius: 6px;
}
.contact-context .ctx-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 600; margin-bottom: 4px; }
.contact-context .ctx-title { font-family: var(--serif); font-size: 18px; color: var(--fg); font-weight: 600; }
.contact-context .ctx-link  { font-size: 12px; color: var(--muted); text-decoration: none; word-break: break-all; }
.contact-context .ctx-link:hover { color: var(--fg); }

/* Admin: analytics row + per-message ref banner */
.msg-analytics { display: flex; flex-direction: column; gap: 12px; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; margin: 12px 0 18px; }
.msg-analytics-block { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg-analytics .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; min-width: 200px; }
.src-chip { display: inline-flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); padding: 4px 10px; border-radius: 999px; font-size: 12px; color: #333; text-decoration: none; }
.src-chip strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.src-chip.linkish:hover { border-color: #cfcfcf; }
.msg-ref { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.msg-ref a { color: var(--muted); text-decoration: none; word-break: break-all; }
.msg-ref a:hover { color: var(--fg); }

/* === Data overview (admin dashboard) === */
.data-overview { margin-top: 50px; }
.data-overview .section-h { font-family: var(--serif); font-size: 22px; margin: 0 0 6px; }
.data-group { margin: 22px 0; }
.dg-title { font-family: var(--serif); font-size: 18px; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); display: inline-block; }
.dg-table { width: 100%; }
.dg-table td, .dg-table th { padding: 9px 10px; vertical-align: top; }
.dg-table .num-col { text-align: right; font-variant-numeric: tabular-nums; }
.dg-table code { background: #f4f4f4; padding: 1px 6px; border-radius: 3px; font-size: 12.5px; }
.dg-desc { color: #4a4a4a; font-size: 13px; max-width: 460px; line-height: 1.45; }
.schema-toggle { margin-top: 4px; font-size: 12px; }
.schema-toggle summary { cursor: pointer; color: var(--muted); list-style: none; }
.schema-toggle summary::-webkit-details-marker { display: none; }
.schema-toggle summary::before { content: '▸ '; }
.schema-toggle[open] summary::before { content: '▾ '; }
.schema-table { width: auto; margin-top: 8px; font-size: 12px; border-collapse: collapse; }
.schema-table th, .schema-table td { padding: 4px 10px; border-bottom: 1px solid var(--bg-alt); }
.schema-table th { color: var(--muted); font-weight: 600; text-align: left; }
.schema-table code { background: var(--bg-alt); padding: 1px 5px; border-radius: 3px; }
.contact-success {
  max-width: 640px; margin: 60px auto; padding: 40px 32px; text-align: center;
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: 12px;
}
.contact-success h2 { font-family: var(--serif); margin: 0 0 8px; }
@media (max-width: 600px) { .contact-form .row-2 { grid-template-columns: 1fr; } .contact-form { padding: 22px 20px; border-radius: 10px; } }

/* Admin messages */
.badge { display: inline-block; background: var(--accent); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; vertical-align: middle; margin-left: 8px; }
.msg-list { list-style: none; padding: 0; margin: 0; }
.msg { padding: 16px 0; border-bottom: 1px solid var(--line); }
.msg.unread { border-left: 3px solid var(--accent); padding-left: 12px; margin-left: -12px; background: rgba(26,137,23,0.03); }
.msg.spam { opacity: 0.65; }
.msg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.msg .who strong { font-size: 15px; }
.msg .who a { margin-left: 6px; font-size: 13px; }
.msg .when { font-size: 13px; }
.msg .subj { font-weight: 600; margin: 6px 0; }
.msg .body { color: #333; font-size: 14px; line-height: 1.55; white-space: pre-wrap; margin: 8px 0; }
.msg .spam-meta { font-size: 12px; color: var(--muted); background: var(--bg-alt); padding: 6px 10px; border-radius: 6px; margin: 8px 0; }
.msg .actions { display: flex; gap: 16px; align-items: center; margin-top: 10px; }
.link-btn { background: none; border: 0; color: var(--accent); font-size: 13px; cursor: pointer; padding: 0; font-family: inherit; text-decoration: none; }
.link-btn:hover { text-decoration: underline; }
.card-alert { background: #fef3c7 !important; border-color: #fbbf24 !important; }

/* Dashboard greeting + streak */
.dash-greeting { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin: 0 0 14px; }
.dash-greeting h1 { margin: 0; font-family: var(--serif); font-size: 28px; }
.dash-streak { font-size: 13px; color: #b25700; background: #fff7ed; padding: 4px 12px; border-radius: 999px; border: 1px solid #fed7aa; font-weight: 500; }

/* Onboarding checklist */
.onboarding { background: linear-gradient(135deg,#f5f3ff 0%,#eff6ff 100%); border: 1px solid #ddd6fe; border-radius: 10px; padding: 16px 22px; margin: 0 0 24px; }
.onboarding .ob-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.onboarding .ob-progress { font-size: 12px; color: var(--muted); }
.onboarding .ob-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 4px 16px; }
.onboarding .ob-list li { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 4px 0; }
.onboarding .ob-list li.done { color: var(--muted); text-decoration: line-through; }
.onboarding .ob-list li.done .ob-check { color: var(--accent); }
.onboarding .ob-check { font-weight: 700; width: 16px; text-align: center; color: #c4b5fd; }
.onboarding .ob-list li a { color: inherit; text-decoration: none; }
.onboarding .ob-list li a:hover { color: var(--fg); text-decoration: underline; }

/* Empty-state CTA wrapper */
.empty-state { text-align: center; padding: 50px 20px; background: var(--bg-alt); border-radius: 10px; margin: 20px 0; }
.empty-state .btn, .empty-state .btn-ghost { margin-top: 16px; }

/* Bulk-action bar on posts list */
.data-sel .sel-col { width: 32px; text-align: center; }
.bulk-bar { display: flex; align-items: center; gap: 16px; padding: 10px 14px; margin: 0 0 14px; background: #fef3c7; border: 1px solid #fbbf24; border-radius: 8px; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.bulk-bar .bulk-count { font-weight: 600; font-size: 13px; }
.bulk-bar .link-btn.danger { color: var(--danger); }
.bulk-menu { position: relative; }
.bulk-menu summary { cursor: pointer; list-style: none; }
.bulk-menu summary::-webkit-details-marker { display: none; }
.bulk-cat-pop, .bulk-sched-pop { position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); margin-top: 6px; display: flex; gap: 10px; align-items: center; min-width: 280px; z-index: 10; }
.bulk-cat-pop select, .bulk-sched-pop input, .bulk-sched-pop select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; font-family: inherit; font-size: 13px; }
.bulk-sched-pop label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: 0; text-transform: none; letter-spacing: 0; font-weight: 400; }

/* Admin nav grouping */
.nav-group-label { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: #999; margin: 14px 10px 4px; font-weight: 600; }
.nav-group-label:first-child { margin-top: 0; }
.admin-shell.collapsed .nav-group-label { display: none; }

/* AI mini buttons in editor sidebar */
.sb-mini-ai { background: 0; border: 0; cursor: pointer; padding: 0 0 0 6px; opacity: .5; transition: opacity .15s; font-size: 12px; vertical-align: middle; }
.sb-mini-ai:hover { opacity: 1; }
.sb-ai .ai-actions { display: flex; flex-direction: column; gap: 6px; }
.ai-mini-btn { background: linear-gradient(135deg, #f0e5ff 0%, #e0f0ff 100%); border: 1px solid rgba(139, 92, 246, 0.2); color: #5b21b6; border-radius: 6px; padding: 7px 10px; font-size: 12px; font-weight: 500; cursor: pointer; text-align: left; transition: transform .1s; }
.ai-mini-btn:hover:not(:disabled) { transform: translateY(-1px); }
.ai-mini-btn:disabled { opacity: .5; cursor: wait; }
.ai-output { margin-top: 10px; padding: 10px 12px; background: var(--bg-alt); border-left: 3px solid var(--accent); border-radius: 4px; font-size: 12.5px; line-height: 1.5; color: #333; }
.ai-output ul { margin: 6px 0 0; padding-left: 16px; }
.ai-output.ai-warn { border-left-color: #c0392b; background: #fef2f2; }
.ai-output.ai-ok   { border-left-color: var(--accent); background: rgba(26,137,23,0.05); }

/* Word-count goal indicator */
.pe-stats.goal-light { color: #b25700; }
.pe-stats.goal-met   { color: var(--accent); font-weight: 600; }
.pe-stats.goal-deep  { color: #166534; font-weight: 700; }

/* TL;DR block on public post */
.post-tldr { background: linear-gradient(135deg,rgba(26,137,23,0.04) 0%,rgba(26,137,23,0.08) 100%); border-left: 4px solid var(--accent); border-radius: 6px; padding: 16px 22px; margin: 24px 0; font-family: var(--sans); }
.post-tldr .tldr-label { font-size: 11px; font-weight: 700; letter-spacing: .15em; color: var(--accent); margin-bottom: 4px; }
.post-tldr .tldr-body p, .post-tldr .tldr-body ul { margin: 6px 0; font-size: 16px; color: #333; }
.post-tldr .tldr-body ul { padding-left: 20px; }

/* Author bio block at end of post */
.author-bio { display: flex; gap: 18px; align-items: flex-start; padding: 24px; margin: 40px 0 20px; background: var(--bg-alt); border: 1px solid var(--line); border-radius: 12px; }
.author-bio .bio-avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid var(--line); }
.author-bio .bio-name { font-family: var(--serif); font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.author-bio .bio-name a, .author-bio .bio-name a:visited { color: var(--fg); text-decoration: none; }
.author-bio .bio-name a:hover { color: var(--accent); }
.author-bio .bio-text { color: #333; line-height: 1.55; margin: 0 0 10px; font-size: 15px; }
.author-bio .bio-links { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }
.author-bio .bio-links a, .author-bio .bio-links a:visited { color: var(--accent); text-decoration: none; }
.author-bio .bio-links a:hover { text-decoration: underline; }
@media (max-width: 600px) {
  .author-bio { flex-direction: column; gap: 14px; padding: 18px; }
  .author-bio .bio-avatar { width: 56px; height: 56px; }
}

/* === Bookmarks === */
.bookmarklet-help summary { cursor: pointer; font-size: 13px; color: var(--muted); list-style: none; }
.bookmarklet-help summary::-webkit-details-marker { display: none; }
.bookmarklet-help[open] summary { color: var(--fg); }
.bookmarklet-card { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-top: 8px; max-width: 360px; }
.bookmarklet-card p { margin: 0 0 10px; font-size: 13px; }
.bookmarklet-card .small { font-size: 11px; }
.bookmarklet { display: inline-block; background: var(--accent); color: #fff !important; padding: 6px 14px; border-radius: 999px; text-decoration: none; font-size: 13px; font-weight: 600; cursor: grab; }

.bk-quick { display: flex; gap: 10px; margin: 12px 0 8px; }
.bk-quick input[type=url] { flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; font-family: inherit; }
.bk-quick input[type=url]:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px rgba(17,17,17,0.06); }

.bk-filter { display: flex; gap: 10px; align-items: center; margin: 12px 0 16px; flex-wrap: wrap; }
.bk-filter input[type=search], .bk-filter select { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; }
.bk-filter input[type=search] { flex: 1; min-width: 200px; }

.bk-list { list-style: none; padding: 0; margin: 0; }
.bk-item { display: grid; grid-template-columns: 160px 1fr; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.bk-item.fav { background: linear-gradient(to right, rgba(255,193,7,0.06), transparent 30%); }
.bk-item.arch { opacity: 0.6; }
.bk-thumb { display: block; border-radius: 8px; overflow: hidden; background: var(--bg-alt); aspect-ratio: 16/9; }
.bk-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bk-thumb.placeholder { display: flex; align-items: center; justify-content: center; color: var(--muted); font-family: var(--serif); font-size: 38px; font-weight: 700; border: 1px solid var(--line); }
.bk-body { min-width: 0; }
.bk-meta { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.bk-source { padding: 2px 8px; border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: 10px; background: var(--bg-alt); color: #555; border: 1px solid var(--line); }
.bk-source-youtube_video, .bk-source-youtube_short { background: rgba(255,0,0,0.08); color: #c00; border-color: rgba(255,0,0,0.15); }
.bk-source-instagram_post, .bk-source-instagram_reel, .bk-source-instagram { background: rgba(228,64,95,0.08); color: #c13584; border-color: rgba(228,64,95,0.15); }
.bk-source-twitter { background: #f1f5f9; color: #000; border-color: #e2e8f0; }
.bk-source-github  { background: #f6f8fa; color: #24292f; border-color: #d0d7de; }
.bk-source-tiktok  { background: #000; color: #fff; border-color: #000; }
.bk-source-linkedin { background: rgba(10,102,194,0.08); color: #0a66c2; border-color: rgba(10,102,194,0.15); }
.bk-source-reddit { background: rgba(255,69,0,0.08); color: #ff4500; border-color: rgba(255,69,0,0.15); }
.bk-source-article, .bk-source-vimeo { background: var(--bg-alt); color: var(--fg); border-color: var(--line); }
.bk-title { font-family: var(--serif); font-size: 19px; margin: 2px 0 6px; line-height: 1.3; }
.bk-title a { color: var(--fg); text-decoration: none; }
.bk-title a:hover { color: var(--accent); }
.bk-desc { color: #4a4a4a; font-size: 14px; margin: 4px 0 8px; line-height: 1.5; }
.bk-notes { background: #fffbeb; border-left: 3px solid #fbbf24; padding: 8px 12px; border-radius: 4px; font-size: 13px; color: #5a4a1a; margin: 8px 0; }
.bk-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.bk-actions { display: flex; gap: 14px; align-items: center; margin-top: 8px; flex-wrap: wrap; }

.bk-edit-wrap { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; margin-top: 20px; }
.bk-edit-thumb img { width: 100%; border-radius: 10px; border: 1px solid var(--line); }
.bk-edit { display: flex; flex-direction: column; gap: 14px; }
.bk-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.bk-edit input[type=url], .bk-edit input[type=text], .bk-edit input[type=number], .bk-edit textarea, .bk-edit select {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; color: var(--fg);
}
.bk-edit input:focus, .bk-edit textarea:focus, .bk-edit select:focus { outline: none; border-color: var(--fg); }
.bk-edit textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.bk-edit .row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

@media (max-width: 700px) {
  .bk-item { grid-template-columns: 100px 1fr; gap: 12px; }
  .bk-edit-wrap { grid-template-columns: 1fr; }
  .bk-edit .row-2 { grid-template-columns: 1fr; }
}

/* === Courses (admin editor) === */
.course-form { display: flex; flex-direction: column; gap: 14px; max-width: 720px; }
.course-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.course-form input[type=text], .course-form textarea, .course-form input[type=file] { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; }
.course-form input:focus, .course-form textarea:focus { outline: none; border-color: var(--fg); }
.course-form textarea { resize: vertical; min-height: 80px; line-height: 1.55; }

.course-add-section { display: flex; gap: 10px; margin: 12px 0 18px; }
.course-add-section input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }

.course-section { border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px; margin-bottom: 14px; background: #fff; }
.cs-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.cs-rename { display: flex; gap: 8px; flex: 1; align-items: center; }
.cs-rename input { flex: 1; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; font-weight: 600; }
.cs-actions { display: flex; gap: 10px; align-items: center; }

.lesson-list { list-style: none; padding: 0; margin: 0 0 8px; }
.lesson { border-bottom: 1px dashed var(--line); padding: 8px 0; }
.lesson summary { cursor: pointer; padding: 4px 6px; border-radius: 4px; }
.lesson summary:hover { background: var(--bg-alt); }
.lesson summary::-webkit-details-marker { display: none; }
.lesson-meta { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lesson-num { color: var(--muted); font-variant-numeric: tabular-nums; }
.lesson-title { font-weight: 500; }
.lesson-tags { display: inline-flex; gap: 6px; }
.tag-embed { background: rgba(26,137,23,0.08); color: var(--accent); font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tag-link  { background: var(--bg-alt); color: var(--muted); font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tag-min   { background: var(--bg-alt); color: #555; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.lesson-edit { padding: 12px 6px 6px; display: flex; flex-direction: column; gap: 10px; }
.lesson-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.lesson-edit input[type=text], .lesson-edit input[type=url], .lesson-edit input[type=number], .lesson-edit textarea, .lesson-edit select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; font-family: inherit; }
.lesson-edit .row-2 { display: grid; grid-template-columns: 1fr 200px; gap: 10px; }
.lesson-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.lesson-add { display: flex; gap: 8px; align-items: center; padding: 8px 0 0; flex-wrap: wrap; }
.lesson-add input[type=text], .lesson-add input[type=url], .lesson-add input[type=number], .lesson-add select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-family: inherit; }
.lesson-add input[type=text] { flex: 1; min-width: 160px; }
.lesson-add input[type=url]  { flex: 2; min-width: 240px; }

/* === Course landing (public) === */
.course-landing { padding: 20px 0 60px; max-width: 760px; margin: 0 auto; }
.course-head { text-align: center; margin-bottom: 20px; }
.course-head h1 { font-family: var(--serif); font-size: 44px; margin: 12px 0 8px; letter-spacing: -.02em; }
.course-subtitle { color: var(--muted); font-size: 19px; margin: 0 0 14px; }
.course-meta { color: var(--muted); font-size: 14px; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.course-meta .dot { color: #bbb; }
.course-cover img { width: 100%; max-height: 420px; object-fit: cover; border-radius: 12px; margin: 18px 0; }
.course-desc { margin: 24px 0; }
.course-toc { margin: 32px 0; }
.toc-section { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 10px; padding: 16px 22px; margin-bottom: 12px; }
.toc-section h3 { font-family: var(--serif); margin: 0 0 8px; font-size: 19px; }
.toc-lessons { list-style: decimal; padding-left: 22px; margin: 0; }
.toc-lessons li { padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.toc-lesson-min { font-variant-numeric: tabular-nums; flex-shrink: 0; }
.course-cta { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 12px; padding: 28px 32px; text-align: center; margin: 28px 0; }
.course-cta h2 { font-family: var(--serif); margin: 0 0 8px; font-size: 26px; }
.course-subscribe { display: flex; gap: 10px; max-width: 460px; margin: 16px auto 0; flex-wrap: wrap; }
.course-subscribe input { flex: 1; min-width: 160px; padding: 11px 14px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; font-family: inherit; }
.course-subscribe input[type=email] { flex: 2; }
@media (max-width: 600px) { .course-subscribe { flex-direction: column; } .course-subscribe input { width: 100%; } }

/* === LMS viewer === */
body.learn .wrap { max-width: 1240px; }
.learn-shell { display: grid; grid-template-columns: 320px 1fr; gap: 28px; padding: 24px 0 60px; }
.learn-side { border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: #fff; max-height: calc(100vh - 120px); overflow-y: auto; position: sticky; top: 90px; }
.learn-side-head { padding-bottom: 14px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.learn-side-head .back { font-size: 13px; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 10px; }
.learn-side-head .back:hover { color: var(--fg); }
.progress-bar { background: var(--bg-alt); height: 6px; border-radius: 999px; overflow: hidden; margin: 6px 0; }
.progress-bar span { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }
.progress-text { font-size: 12px; }

.learn-nav details { margin-bottom: 8px; }
.learn-nav summary { cursor: pointer; padding: 6px 4px; font-size: 13px; font-weight: 600; text-transform: uppercase; color: var(--muted); letter-spacing: .04em; }
.learn-nav summary::-webkit-details-marker { display: none; }
.learn-nav summary::before { content: '▸'; margin-right: 6px; transition: transform .15s; display: inline-block; }
.learn-nav details[open] summary::before { transform: rotate(90deg); }
.learn-nav ol { list-style: none; padding: 0 0 6px 0; margin: 0; }
.learn-nav li { padding: 0; }
.learn-nav li a { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 7px 8px; border-radius: 6px; color: #333; text-decoration: none; font-size: 13px; line-height: 1.35; }
.learn-nav li a:hover { background: var(--bg-alt); }
.learn-nav li.current a { background: rgba(26,137,23,0.08); color: var(--fg); font-weight: 600; }
.learn-nav li.done a { color: var(--muted); }
.learn-nav li.done a .t { text-decoration: line-through; }
.learn-nav .check { color: var(--accent); font-weight: 700; text-align: center; }
.learn-nav li:not(.done):not(.current) .check { color: #ccc; }
.learn-nav .m { font-variant-numeric: tabular-nums; }

.learn-main { min-width: 0; }
.learn-lesson-head { margin-bottom: 18px; }
.learn-lesson-head .small { font-size: 13px; }
.learn-lesson-head h1 { font-family: var(--serif); font-size: 32px; margin: 6px 0 0; line-height: 1.2; letter-spacing: -.01em; }
.learn-player { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 12px; overflow: hidden; }
.learn-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.learn-link-card { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 12px; padding: 32px; text-align: center; }
.learn-link-card .btn { margin: 8px 0; }
.learn-notes { margin: 20px 0; }
.learn-controls { display: flex; flex-direction: column; gap: 12px; padding: 18px 0; border-top: 1px solid var(--line); margin-top: 24px; }
.learn-prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.learn-prevnext .btn-ghost { text-align: center; }

@media (max-width: 900px) {
  .learn-shell { grid-template-columns: 1fr; }
  .learn-side { position: static; max-height: none; }
  .learn-lesson-head h1 { font-size: 24px; }
}

/* Settings */
.settings-preview { background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px; display: flex; gap: 14px; align-items: baseline; }
.settings-preview .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.settings-preview .val { font-family: var(--serif); font-size: 18px; color: var(--fg); }
.settings-form fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px 4px; margin: 0 0 20px; }
.settings-form legend { padding: 0 8px; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .06em; font-weight: 600; }
.settings-form label { display: block; margin: 0 0 16px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.settings-form input[type=text], .settings-form select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; font-family: inherit; margin-top: 6px; color: var(--fg); }
.settings-form input:focus, .settings-form select:focus { outline: none; border-color: var(--fg); }
.settings-form small.muted { display: block; margin-top: 6px; text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 12px; }
.settings-form small.muted code { background: #f4f4f4; padding: 1px 5px; border-radius: 3px; font-size: 12px; }
.settings-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 6px; }
.settings-form textarea:focus { outline: none; border-color: var(--fg); }

/* Bot policy grid */
.bot-cat { margin: 12px 0 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-alt); }
.bot-cat-title { font-family: var(--serif); font-size: 16px; margin: 0 0 4px; text-transform: none; letter-spacing: 0; font-weight: 700; color: var(--fg); }
.bot-cat-desc { margin: 0 0 12px; font-size: 12px; }
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 18px; }
.bot-row { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--fg); font-size: 13px; margin: 0; }
.bot-row input[type=checkbox] { margin: 0; }
.bot-name { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px; }
.bot-state { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.bot-row input:checked ~ .bot-state { color: var(--accent); }

/* Categories admin */
.cat-form { background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 24px; }
.cat-form label { display: block; margin: 0 0 12px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.cat-form input[type=text] { width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius); font-family: inherit; font-size: 14px; margin-top: 6px; }
.cat-form input:focus { outline: none; border-color: var(--fg); }
.cat-form .row { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
@media (max-width: 600px) { .cat-form .row { grid-template-columns: 1fr; } }
.section-h { font-family: var(--serif); font-size: 20px; margin: 24px 0 12px; }
