/* Lawyerlly — forestgreen theme, minimal radii/margins, readable post font. */

:root {
  --forest: #228B22;
  --forest-dark: #1b6e1b;
  --forest-light: #e7f4e7;
  --ink: #1a1f1a;
  --ink-soft: #52605a;
  --border: #dfe6df;
  --bg: #fafcf9;
  --card: #ffffff;
  --danger: #b3261e;
  --radius: 3px;
  --gap: 10px;
  --header-h: 52px;
  --mobile-nav-h: 46px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-read: Georgia, Cambria, "Times New Roman", Times, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--forest-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; }
.icon-sm { width: 15px; height: 15px; }
.icon-tick-sm { width: 15px; height: 15px; vertical-align: -2px; }

/* --- Buttons / forms ---------------------------------------------------- */
.btn {
  display: inline-block; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--forest);
  background: var(--forest); color: #fff; font-size: 14px; font-weight: 600; text-align: center;
}
.btn:hover { background: var(--forest-dark); border-color: var(--forest-dark); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--forest-dark); }
.btn-ghost:hover { background: var(--forest-light); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-block { display: block; width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }

.stacked-form { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.stacked-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink-soft); }
.stacked-form input, .stacked-form textarea, .stacked-form select {
  font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
}
.stacked-form input:focus, .stacked-form textarea:focus { outline: 2px solid var(--forest); outline-offset: -1px; }
.checkbox-row { flex-direction: row !important; align-items: center; gap: 6px !important; }
.form-error { color: var(--danger); font-size: 13px; margin: 0; }
.demo-banner { background: var(--forest-light); border: 1px dashed var(--forest); border-radius: var(--radius); padding: 8px 10px; font-size: 13px; }

/* --- Header -------------------------------------------------------------- */
/* Mobile: the top row (logo/search/bell) scrolls away with the page; only the
   5-icon nav bar below it stays pinned. Desktop keeps the classic sticky bar
   since desktop-nav lives inline in the header row, not as a separate strip. */
.site-header { position: relative; z-index: 42; background: var(--forest); border-bottom: 1px solid var(--border); }
.header-row { display: flex; align-items: center; gap: var(--gap); height: var(--header-h); padding: 0 14px; }
.logo { display: flex; align-items: center; gap: 6px; color: #fff; font-weight: 800; font-size: 17px; flex-shrink: 0; }
.logo-icon { color: #fff; }

/* Thin nameplate that appears above the sticky mobile nav once the header row
   has scrolled out of view, so the site name is never fully gone. Height is
   set via the sticky offset .mobile-nav picks up when body.is-scrolled. */
.scroll-nameplate {
  display: none; align-items: center; justify-content: center;
  height: 30px; position: sticky; top: 0; z-index: 41;
  background: var(--forest-dark); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .2px;
}

.nav-icons { display: flex; align-items: center; gap: 4px; }
.desktop-nav { display: none; flex: 1; justify-content: center; }
.mobile-nav {
  display: flex; justify-content: space-around; border-top: 1px solid var(--border); height: var(--mobile-nav-h);
  position: sticky; top: 0; z-index: 40; background: var(--forest);
}
/* Once scrolled, the nameplate above takes the top:0 slot, so the nav shifts
   down by its height to stay directly beneath it. */
body.is-scrolled .mobile-nav { top: 30px; }

.mobile-nav .nav-link, .mobile-nav button.nav-link { color: #fff; }
.mobile-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.18); }
.mobile-nav button.nav-link { background: none; border: none; }
/* The profile icon swaps for a notifications bell while scrolled, since the
   real bell (in the header row) has scrolled out of view. */
#mobileNavNotifBtn { display: none; }
body.is-scrolled .mobile-nav a[title="Profile"] { display: none; }
body.is-scrolled #mobileNavNotifBtn { display: flex; }

.nav-link { display: flex; flex-direction: column; align-items: center; gap: 1px; color: var(--ink-soft); font-size: 10px; padding: 4px 10px; border-radius: var(--radius); }
.nav-link:hover { color: var(--forest-dark); text-decoration: none; background: var(--forest-light); }
.nav-icon-wrap { position: relative; }
.nav-dot { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 1.5px solid var(--card); }
.desktop-nav .nav-label { display: none; }
.desktop-nav .nav-link { flex-direction: row; gap: 5px; font-size: 13px; padding: 6px 12px; }
.desktop-nav .nav-link .nav-label { display: inline; }

.header-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; flex-shrink: 0; }
.icon-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; background: none; border: none; border-radius: var(--radius); color: var(--ink); position: relative; }
.icon-btn:hover { background: var(--forest-light); }

/* Solid forestgreen header: everything inside it switches to light. Scoped to
   .site-header because .icon-btn is also used on white surfaces elsewhere. */
.site-header .icon-btn { color: #fff; }
.site-header .icon-btn:hover { background: rgba(255,255,255,.18); }
.site-header .nav-link { color: #fff; }
.site-header .nav-link:hover { color: #fff; background: rgba(255,255,255,.18); }

.search-wrap { position: relative; z-index: 2; display: flex; align-items: center; }
/* min-width:0 matters: .search-wrap is a flex container, and a flex item's
   default min-width:auto resolves to the input's intrinsic size — so width:0
   alone never actually collapsed the bar, it just sat there at its default
   width. The slide-out only reads as a slide-out once it can reach zero. */
.quick-search-input {
  width: 0; min-width: 0; opacity: 0; padding: 0; border: none; overflow: hidden;
  transition: width .22s ease, opacity .18s ease, padding .22s ease;
  font: inherit; border-radius: var(--radius); background: var(--forest-light); height: 32px;
}
.quick-search-input::-webkit-search-cancel-button { display: none; }
/* Capped against the viewport so the expanded bar can't shove the header nav
   off the edge on a narrow phone. */
.search-wrap.open .quick-search-input { width: min(200px, 46vw); opacity: 1; padding: 0 10px; border: 1px solid var(--border); margin-right: 4px; }
.quick-search-results { position: absolute; z-index: 1; top: 40px; right: 0; width: 260px; max-height: 360px; overflow-y: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0,0,0,.12); }
.qs-group-label { font-size: 11px; text-transform: uppercase; color: var(--ink-soft); padding: 6px 10px 2px; }
.qs-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; }
.qs-item:hover { background: var(--forest-light); }
.qs-empty { padding: 10px; color: var(--ink-soft); font-size: 13px; }

.notif-btn { position: relative; }
.bell-stack { position: relative; display: flex; }
.halo { position: absolute; top: 2px; right: 2px; width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 0 2px var(--card); }
.halo-notif { background: var(--danger); }
.halo-dm { background: #2ecc71; box-shadow: 0 0 0 2px var(--card), 0 0 0 4px rgba(46,204,113,.35); }

/* --- Notification panel: drags down like a phone notification shade --- */
.notif-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.28); opacity: 0; visibility: hidden; transition: opacity .2s ease; z-index: 49; }
.notif-overlay.open { opacity: 1; visibility: visible; }
.notif-panel {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: var(--card); border-bottom: 1px solid var(--border);
  max-height: 82vh; transform: translateY(-100%); transition: transform .32s cubic-bezier(.2,.8,.3,1);
  box-shadow: 0 10px 24px rgba(0,0,0,.15);
  display: flex; flex-direction: column;
}
.notif-panel.open { transform: translateY(0); }
.notif-panel-inner { display: flex; flex-direction: column; max-height: 82vh; }
.notif-list { overflow-y: auto; padding: 4px 0; flex: 1; }
.notif-cta { padding: 22px 16px; text-align: center; }
.notif-cta p { color: var(--ink-soft); margin: 0 0 12px; }
.notif-cta .btn { margin: 0 4px; }
.notif-loading, .notif-empty { padding: 20px; text-align: center; color: var(--ink-soft); }
.notif-item { display: flex; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.notif-item.unseen { background: var(--forest-light); }
.notif-item .avatar { flex-shrink: 0; }
.notif-item-text { flex: 1; font-size: 13.5px; }
.notif-item-text a { font-weight: 700; }
.notif-item-time { color: var(--ink-soft); font-size: 12px; }
.notif-banner { margin: 8px 16px; padding: 8px 10px; border-radius: var(--radius); font-size: 13px; }
.notif-banner-ban { background: #fdecea; color: var(--danger); border: 1px solid #f3c2be; }
.notif-banner-newuser { background: var(--forest-light); border: 1px solid var(--forest); }
.notif-sections { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 14px; background: var(--forest-light); }
.notif-sections a { font-size: 12px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 8px; color: var(--ink); }

/* --- Layout ---------------------------------------------------------- */
.layout-shell { max-width: 1120px; margin: 0 auto; }
.page { max-width: 900px; margin: 0 auto; padding: 14px 14px calc(var(--mobile-nav-h) + 20px); }
@media (min-width: 900px) { .page { padding: 18px 14px 24px; } }

/* Persistent section sidebar: desktop only, every page except the admin panel. */
.section-sidebar { display: none; }
.section-sidebar-inner { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.section-sidebar-heading { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); font-weight: 700; padding: 4px 8px 8px; }
.section-sidebar-link { display: flex; align-items: center; gap: 9px; padding: 7px 8px; border-radius: var(--radius); color: var(--ink); font-size: 13.5px; }
.section-sidebar-link:hover { background: var(--forest-light); text-decoration: none; }
.section-sidebar-link.active { background: var(--forest-light); color: var(--forest-dark); font-weight: 700; }

/* --- Home / section --------------------------------------------------- */
.sections-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 18px; }
.section-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; color: var(--ink); }
.section-card:hover { border-color: var(--forest); text-decoration: none; }
.section-card-icon { color: var(--forest); }
.section-card-name { font-weight: 800; font-size: 12.5px; letter-spacing: .3px; }
.section-card-tagline { font-size: 11.5px; color: var(--ink-soft); }

.feed-heading { font-size: 15px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); margin: 0 0 8px; }
.topic-list { display: flex; flex-direction: column; gap: 8px; }
.topic-card { display: flex; gap: 10px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.topic-card-media { flex-shrink: 0; width: 88px; height: 66px; overflow: hidden; border-radius: var(--radius); background: var(--forest-light); }
.topic-card-media img { width: 100%; height: 100%; object-fit: cover; }
.topic-card-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.topic-card-section { font-size: 10.5px; font-weight: 700; color: var(--forest-dark); text-transform: uppercase; }
.topic-card-title { font-weight: 700; color: var(--ink); font-size: 15px; }
.topic-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; color: var(--ink-soft); font-size: 12px; }
.meta-author { color: var(--ink-soft); font-weight: 600; }
.meta-views { display: inline-flex; align-items: center; gap: 3px; }
.meta-dot { opacity: .5; }

.section-header { display: flex; flex-direction: column; background: var(--forest-light); margin: 0 -14px 14px; }
.section-header-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.section-header-title-left { display: flex; align-items: center; gap: 10px; }
.section-header-sub { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.section-header-icon { width: 30px; height: 30px; color: var(--forest); }
.section-header h1 { margin: 0; font-size: 19px; }
.section-tagline { margin: 0; color: var(--ink-soft); font-size: 13px; }
.new-topic-btn { flex-shrink: 0; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px 0; font-size: 13px; }
.page-status { color: var(--ink-soft); }
.empty-note, .empty-state { color: var(--ink-soft); text-align: center; padding: 30px 10px; }

/* --- Listing toolbar: the Hot/Latest sort menu ------------------------- */
.listing-toolbar { display: flex; align-items: center; justify-content: flex-start; margin-bottom: 8px; }
.sort-menu { position: relative; }
.sort-toggle {
  display: flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--ink); background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 10px;
}
.sort-toggle:hover { border-color: var(--forest); color: var(--forest-dark); }
.sort-current { min-width: 42px; text-align: left; }
.icon-chevron { width: 12px; height: 8px; opacity: .6; transition: transform .18s ease; }
.sort-menu.open .icon-chevron, .actions-menu.open .icon-chevron { transform: rotate(180deg); }
.sort-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; min-width: 180px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0,0,0,.12); padding: 4px;
}
.sort-option {
  display: flex; align-items: center; gap: 8px; width: 100%; font: inherit; font-size: 13.5px;
  text-align: left; background: none; border: none; border-radius: var(--radius);
  padding: 8px 9px; color: var(--ink);
}
.sort-option:hover { background: var(--forest-light); }
.sort-option.active { color: var(--forest-dark); font-weight: 700; }
.sort-check { margin-left: auto; color: var(--forest); }
.sort-hint { font-size: 11px; color: var(--ink-soft); padding: 6px 9px 3px; border-top: 1px solid var(--border); margin-top: 4px; }

/* Featured cards on the front page: cover art and headline only. */
.topic-card-plain .topic-card-title { font-size: 16px; }
.topic-card-plain .topic-card-body { justify-content: center; }

/* --- Topic / post page ------------------------------------------------- */
.post-main { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 4px; }
.post-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.post-author { display: flex; align-items: center; gap: 7px; color: var(--ink); font-weight: 700; }
.avatar { border-radius: 50%; object-fit: cover; background: var(--forest-light); }
.avatar-md { width: 32px; height: 32px; }
.avatar-sm { width: 24px; height: 24px; }
.post-date, .post-views { color: var(--ink-soft); font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; }
.post-section-badge { display: inline-block; margin-top: 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--forest-dark); }
.post-title { font-size: 22px; margin: 4px 0 12px; }
.post-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 6px; margin-bottom: 12px; }
.post-gallery-main { grid-column: 1 / -1; max-height: 420px; width: 100%; object-fit: cover; border-radius: var(--radius); }
.post-gallery img:not(.post-gallery-main) { border-radius: var(--radius); height: 130px; width: 100%; object-fit: cover; }
.post-body { font-family: var(--font-read); font-size: 17px; line-height: 1.7; color: #1c231c; }
.post-body p { margin: 0 0 1em; }
.post-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.post-actions-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
#followTopicBtn { font-size: 13px; }
.featured-badge {
  display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .3px; color: var(--forest-dark);
  background: var(--forest-light); border-radius: var(--radius); padding: 4px 8px;
}

/* --- Admin "Actions" dropdown on a post --------------------------------- */
.actions-menu { position: relative; }
.actions-toggle { display: flex; align-items: center; gap: 6px; padding: 6px 10px; font-size: 13px; }
.actions-dropdown {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 25; min-width: 230px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0,0,0,.14); padding: 4px;
}
.action-item {
  display: flex; align-items: flex-start; gap: 9px; width: 100%; font: inherit; font-size: 13.5px;
  text-align: left; background: none; border: none; border-radius: var(--radius);
  padding: 9px; color: var(--ink);
}
.action-item .icon { flex-shrink: 0; margin-top: 2px; }
.action-item:hover:not(.action-item-locked) { background: var(--forest-light); }
.action-item-danger { color: var(--danger); }
.action-item-danger:hover { background: #fdecea; }
.action-item-locked { color: var(--ink-soft); cursor: default; }
.action-item-text { display: flex; flex-direction: column; gap: 2px; }
.action-item-text small { font-size: 11.5px; color: var(--ink-soft); line-height: 1.35; }
.action-item[disabled] { opacity: .55; cursor: default; }

/* --- Polls --------------------------------------------------------------- */
.poll-tag {
  display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .9px;
  text-transform: uppercase; color: var(--forest-dark); background: var(--forest-light);
  border: 1px solid #bdd4bd; border-radius: 999px; padding: 2px 8px;
  vertical-align: middle;
}
.topic-card-body > .poll-tag { align-self: flex-start; }
.post-poll-tag { margin-left: 8px; }
.section-poll-link { font-weight: 700; }
.section-poll-link:hover { text-decoration: underline; }

.poll-box {
  margin: 12px 0 18px; padding: 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: linear-gradient(160deg, #fff, #f4faf3);
}
.poll-options { display: flex; flex-direction: column; gap: 8px; }
.poll-option {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 10px 12px; border: 1px solid #c9dac9; border-radius: var(--radius);
  background: #fff; font-weight: 600; font-size: 14.5px; line-height: 1.35;
  transition: background .15s ease, border-color .15s ease;
}
.poll-option:hover { background: var(--forest-light); border-color: var(--forest); }
.poll-option:has(input:checked) { background: var(--forest-light); border-color: var(--forest); box-shadow: inset 0 0 0 1px var(--forest); }
.poll-option input { width: 17px; height: 17px; accent-color: var(--forest); flex-shrink: 0; }
.poll-option-label { min-width: 0; word-break: break-word; }
.poll-note { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-soft); }
.poll-vote-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.poll-vote-foot .btn { padding: 8px 20px; }
.poll-meta { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-soft); }
.poll-vote-foot .poll-meta { margin: 0; }
.poll-results { display: flex; flex-direction: column; gap: 11px; }
.poll-result-row { display: grid; grid-template-columns: 40px 1fr; align-items: center; gap: 10px; }
.poll-result-pct { font-size: 13px; font-weight: 800; color: var(--forest-dark); text-align: right; font-variant-numeric: tabular-nums; }
.poll-result-label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.poll-bar { height: 10px; background: #e1ebe0; border-radius: 999px; overflow: hidden; }
.poll-bar-fill { display: block; height: 100%; background: linear-gradient(90deg, #58ad58, var(--forest)); border-radius: inherit; }

/* --- Create poll page ---------------------------------------------------- */
.poll-create { max-width: 620px; margin: 0 auto; }
.poll-create-crumb { margin: 0 0 10px; font-size: 13px; }
.poll-create-title { font-family: var(--font-read); font-size: clamp(25px, 4vw, 32px); margin: 0 0 6px; letter-spacing: -.4px; }
.poll-create-sub { margin: 0 0 20px; color: var(--ink-soft); font-size: 14px; }
.poll-create .poll-input {
  width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #bdcebd;
  border-radius: var(--radius); background: #fff;
}
.poll-create .poll-input:focus { outline: 2px solid var(--forest); outline-offset: -1px; }
.poll-fieldset {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px;
  margin: 0 0 16px; background: var(--card); box-shadow: 0 2px 3px rgba(24,54,24,.03);
}
.poll-fieldset legend { padding: 0 6px; font-size: 12.5px; font-weight: 800; color: var(--forest-dark); }
.poll-option-list { display: flex; flex-direction: column; gap: 8px; }
.poll-option-row { display: flex; }
.poll-option-row .poll-input { flex: 1; }
.poll-option-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.poll-option-actions .btn { padding: 6px 12px; font-size: 13px; }
.poll-option-row .poll-option-remove { padding: 6px 10px; font-size: 12.5px; flex-shrink: 0; }
.poll-create-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; margin-bottom: 16px; }
.poll-create-grid .field-row { margin-bottom: 0; }
.poll-scope-fieldset { margin: 0; }
.poll-radio { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 8px; }
.poll-radio input { accent-color: var(--forest); width: 16px; height: 16px; }
@media (max-width: 639.98px) {
  .poll-create-grid { grid-template-columns: 1fr; }
}

/* --- "More like this" suggestions under the comment box ----------------- */
.similar-posts { margin-top: 18px; }
.similar-heading { font-size: 13px; text-transform: uppercase; letter-spacing: .4px; color: var(--ink-soft); margin: 0 0 8px; }
.similar-list { display: flex; flex-direction: column; gap: 6px; }
.similar-card {
  display: flex; align-items: center; gap: 10px; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; color: var(--ink);
}
.similar-card:hover { border-color: var(--forest); text-decoration: none; }
.similar-card:hover .similar-title { color: var(--forest-dark); }
.similar-thumb { flex-shrink: 0; width: 64px; height: 48px; overflow: hidden; border-radius: var(--radius); background: var(--forest-light); }
.similar-thumb img { width: 100%; height: 100%; object-fit: cover; }
.similar-title { font-size: 14px; font-weight: 600; line-height: 1.35; }
@media (min-width: 640px) {
  .similar-list { flex-direction: row; }
  .similar-card { flex: 1; flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; }
  .similar-thumb { width: 100%; height: 92px; }
}

/* --- Comments ----------------------------------------------------------- */
.comments-section { margin-top: 4px; }
.comments-heading { font-size: 14px; text-transform: uppercase; color: var(--ink-soft); margin: 16px 0 8px; }
.comments-list { display: flex; flex-direction: column; gap: 8px; }
.comment { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 11px; scroll-margin-top: 70px; }
.comment.nested { margin-left: 22px; }
.comment.flash { animation: commentFlash 1.4s ease; }
@keyframes commentFlash { 0% { background: var(--forest-light); } 100% { background: var(--card); } }
.comment-head { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.comment-author { font-weight: 700; font-size: 13.5px; color: var(--ink); }
.comment-time { color: var(--ink-soft); font-size: 11.5px; }
.comment-body { font-size: 15.5px; white-space: pre-wrap; word-break: break-word; }
.comment-body.deleted { color: var(--ink-soft); font-style: italic; }
.comment-actions { margin-top: 4px; }
.comment-reply-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-soft); background: none; border: none; padding: 2px 0; }
.comment-reply-btn:hover { color: var(--forest-dark); }

/* Yanked quote: thin top/bottom borders only, no radius. */
.quote-yank {
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); border-radius: 0;
  background: var(--forest-light);
  padding: 4px 8px; margin-bottom: 6px; font-size: 12.5px; cursor: pointer;
}
.quote-yank-author { font-weight: 700; color: var(--forest-dark); display: block; }
.quote-yank-text { color: var(--ink-soft); }
.quote-yank.deleted .quote-yank-text { color: var(--ink-soft); font-style: italic; }

.scroll-track-arrows { position: fixed; right: 14px; bottom: 130px; display: flex; flex-direction: column; gap: 8px; z-index: 30; }
.track-arrow { width: 38px; height: 38px; border-radius: 50%; background: var(--forest); color: #fff; border: none; box-shadow: 0 3px 10px rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; }
.track-arrow:hover { background: var(--forest-dark); }

.comment-box { position: sticky; bottom: 8px; display: flex; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; margin-top: 10px; }
.comment-box input { flex: 1; border: none; padding: 8px; font: inherit; }
.comment-box input:focus { outline: none; }

/* --- Reply modal --------------------------------------------------------- */
.modal { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal { align-items: center; } }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.35); }
.modal-panel { position: relative; background: var(--card); width: 100%; max-width: 480px; border-radius: var(--radius) var(--radius) 0 0; padding: 12px 14px 16px; z-index: 1; }
@media (min-width: 640px) { .modal-panel { border-radius: var(--radius); } }
.modal-header { display: flex; align-items: center; justify-content: space-between; font-weight: 700; margin-bottom: 8px; }
.reply-textarea { width: 100%; min-height: 90px; margin: 8px 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; font: inherit; resize: vertical; }

/* --- Auth ----------------------------------------------------------------- */
.auth-page { display: flex; justify-content: center; padding: 30px 10px; }
.auth-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 19px; margin: 0 0 14px; }
.auth-switch { margin-top: 14px; font-size: 13px; color: var(--ink-soft); }

/* --- Profile --------------------------------------------------------- */
.profile-header { display: flex; flex-direction: column; gap: 12px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.profile-header-main { display: flex; gap: 14px; align-items: flex-start; }
.avatar-lg { width: 56px; height: 56px; flex-shrink: 0; }
.profile-name-row { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 18px; }
.profile-stats { display: flex; gap: 14px; font-size: 13px; color: var(--ink-soft); margin-top: 4px; }
.profile-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.verified-sample { display: inline-flex; align-items: center; gap: 6px; background: var(--forest-light); border: 1px dashed var(--forest); border-radius: var(--radius); padding: 8px 10px; margin-top: 10px; font-size: 13px; }

/* --- DM ------------------------------------------------------------------- */
.dm-thread-header { display: flex; align-items: center; gap: 8px; padding: 8px 0 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.dm-list-item { display: flex; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); margin-bottom: 6px; align-items: center; }
.dm-list-item .unseen-badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 10px; font-size: 11px; padding: 1px 7px; }
.dm-messages { display: flex; flex-direction: column; gap: 6px; padding: 8px 0 90px; }
.dm-bubble { max-width: 78%; padding: 7px 10px; border-radius: 10px; font-size: 14px; }
.dm-bubble.mine { align-self: flex-end; background: var(--forest); color: #fff; border-bottom-right-radius: 2px; }
.dm-bubble.theirs { align-self: flex-start; background: #eef1ee; border-bottom-left-radius: 2px; }
.dm-composer { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 1px solid var(--border); padding: 8px 12px; display: flex; gap: 8px; max-width: 900px; margin: 0 auto; }
.dm-composer input { flex: 1; border: 1px solid var(--border); border-radius: 16px; padding: 8px 14px; font: inherit; }

/* --- Search page ------------------------------------------------------ */
.search-form { display: flex; gap: 8px; margin-bottom: 14px; }
.search-form input { flex: 1; padding: 9px 10px; border: 1px solid var(--border); border-radius: var(--radius); font: inherit; }
.search-scope { display: flex; gap: 6px; margin-bottom: 12px; }
.scope-btn { padding: 5px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; font-size: 13px; }
.scope-btn.active { background: var(--forest); color: #fff; border-color: var(--forest); }
.user-result { display: flex; align-items: center; gap: 8px; padding: 9px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 6px; background: var(--card); }

/* --- Modals (settings/verify/composer share this) ----------------------- */
.sheet-modal .modal-panel { max-width: 520px; max-height: 88vh; overflow-y: auto; }
.field-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field-row label { font-size: 12.5px; color: var(--ink-soft); font-weight: 600; }
.hint { font-size: 12px; color: var(--ink-soft); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.image-picker { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.image-picker-thumb { width: 64px; height: 64px; border-radius: var(--radius); object-fit: cover; border: 1px solid var(--border); position: relative; }
.image-picker-add { width: 64px; height: 64px; border: 1px dashed var(--border); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: var(--ink-soft); background: none; }

/* --- Admin panel ------------------------------------------------------ */
.admin-shell { display: flex; gap: 16px; align-items: flex-start; }
.admin-side { width: 180px; flex-shrink: 0; display: flex; flex-direction: column; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.admin-side a { padding: 8px 9px; border-radius: var(--radius); color: var(--ink); font-size: 13.5px; }
.admin-side a:hover, .admin-side a.active { background: var(--forest-light); text-decoration: none; }
.admin-main { flex: 1; min-width: 0; }
.admin-stats { display: grid; grid-template-columns: repeat(auto-fit,minmax(120px,1fr)); gap: 8px; margin-bottom: 16px; }
.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.stat-num { font-size: 22px; font-weight: 800; color: var(--forest-dark); }
.stat-label { font-size: 12px; color: var(--ink-soft); }
.admin-table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; font-size: 13.5px; }
.admin-table th, .admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.admin-table th { background: var(--forest-light); font-size: 11.5px; text-transform: uppercase; }
.tag { display: inline-block; padding: 2px 7px; border-radius: var(--radius); font-size: 11px; font-weight: 700; }
.tag-super { background: #fde9d0; color: #925c00; }
.tag-global { background: var(--forest-light); color: var(--forest-dark); }
.tag-section { background: #e6eefc; color: #24518c; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions .btn { padding: 4px 9px; font-size: 12px; }
@media (max-width: 720px) { .admin-shell { flex-direction: column; } .admin-side { width: 100%; flex-direction: row; overflow-x: auto; } }

/* --- Toast ------------------------------------------------------------ */
.toast { position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%) translateY(10px); background: var(--ink); color: #fff; padding: 8px 14px; border-radius: var(--radius); font-size: 13px; opacity: 0; transition: opacity .2s, transform .2s; z-index: 100; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --- Footer --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 30px; margin-bottom: var(--mobile-nav-h); }
.footer-inner { max-width: 900px; margin: 0 auto; padding: 14px; text-align: center; color: var(--ink-soft); font-size: 12px; }
.footer-inner p { margin: 3px 0; }
.footer-disclaimer { font-weight: 600; }

body.signed-in { }
@media (max-width: 779.98px) {
  body.is-scrolled .scroll-nameplate { display: flex; }
}
@media (min-width: 780px) {
  .site-header { position: sticky; top: 0; }
  .desktop-nav { display: flex; }
  .mobile-nav { display: none; }
  .scroll-nameplate { display: none !important; }
  .site-footer { margin-bottom: 0; }
  .page { padding-bottom: 24px; }

  .layout-shell:not(.no-sidebar) { display: flex; align-items: flex-start; gap: 20px; padding: 0 14px; }
  .layout-shell:not(.no-sidebar) .section-sidebar { display: block; width: 200px; flex-shrink: 0; position: sticky; top: calc(var(--header-h) + 14px); }
  .layout-shell:not(.no-sidebar) .page { max-width: none; margin: 0; padding-left: 0; padding-right: 0; flex: 1; min-width: 0; }
  .layout-shell:not(.no-sidebar) .sections-grid { display: none; }
}

/* Polished forest chrome: retain the original #228B22 brand. */
:root {
  --radius: 8px;
  --header-h: 66px;
  --mobile-nav-h: 58px;
  --border: #d2dfd2;
  --bg: #f2f6f1;
  --chrome: linear-gradient(180deg, #58ad58 0%, #329732 42%, #228B22 43%, #1b6e1b 100%);
  --chrome-edge: inset 0 1px 0 rgba(255,255,255,.55), inset 0 -2px 0 rgba(0,45,0,.24), 0 3px 7px rgba(20,70,20,.16);
}
body { background: radial-gradient(ellipse at top, #ffffff 0, var(--bg) 75%); }
.icon { flex-shrink: 0; stroke-linecap: round; stroke-linejoin: round; }
.site-header, .mobile-nav, .scroll-nameplate {
  background: var(--chrome);
  border-color: #145714;
  box-shadow: var(--chrome-edge);
}
.header-row { max-width: 1200px; margin: 0 auto; gap: 16px; }
.logo { font-size: 21px; letter-spacing: -.6px; gap: 10px; text-shadow: 0 2px 1px #165516; }
.logo:hover { text-decoration: none; }
.logo-icon { width: 32px; height: 32px; filter: drop-shadow(0 1px 1px #125012); }
.site-header .nav-link { font-weight: 700; min-height: 42px; }
.site-header .icon-btn { border: 1px solid rgba(255,255,255,.24); box-shadow: inset 0 1px 0 rgba(255,255,255,.18); width: 38px; height: 38px; }
.header-actions { gap: 6px; }
.site-header .icon, .mobile-nav .icon { filter: drop-shadow(0 1px 0 rgba(0,45,0,.45)); }
.btn, .scope-btn.active {
  background: var(--chrome); color: #fff; border: 1px solid #175d17;
  box-shadow: var(--chrome-edge);
  padding: 10px 18px; font-weight: 750; text-shadow: 0 1px 1px #145714;
  transition: box-shadow .16s ease, filter .16s ease, transform .16s ease;
}
.btn:hover, .scope-btn.active:hover { background: var(--chrome); border-color: #125012; filter: brightness(1.07); }
.btn:active { transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0,45,0,.25); }
.btn-ghost { background: linear-gradient(#fff, #e7f4e7); color: var(--forest-dark); text-shadow: 0 1px #fff; border-color: #99bb99; }
.btn-ghost:hover { background: linear-gradient(#fff, #d6ebd6); }
.btn-danger { background: linear-gradient(#ce554e, #b3261e 48%, #8e1e18); border-color: #7d211b; text-shadow: 0 1px #721b16; }
.btn-danger:hover { background: linear-gradient(#ce554e, #b3261e 48%, #8e1e18); border-color: #7d211b; }
.btn:disabled { filter: none; transform: none; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--forest); outline-offset: 3px;
}
.site-header :focus-visible, .mobile-nav :focus-visible { outline-color: #fff; }
.layout-shell { max-width: 1200px; }
.page { padding-top: 24px; }
.section-sidebar-inner, .topic-card, .post-main, .similar-card, .user-result, .stat-tile, .admin-side {
  border: 1px solid var(--border); box-shadow: 0 2px 3px rgba(24,54,24,.04), 0 8px 24px rgba(24,54,24,.035);
}
.section-sidebar-inner { padding: 10px; }
.section-sidebar-heading { color: var(--forest-dark); letter-spacing: 1.5px; padding: 10px 10px 14px; }
.section-sidebar-link { padding: 11px 10px; margin-bottom: 3px; font-weight: 600; gap: 11px; }
.section-sidebar-link .icon { width: 19px; height: 19px; color: var(--forest-dark); }
.section-sidebar-link.active { background: var(--chrome); color: #fff; box-shadow: var(--chrome-edge); }
.section-sidebar-link.active .icon { color: #fff; }
.home-intro { margin-bottom: 24px; padding: 26px; border: 1px solid #bdd4bd; border-radius: 10px; background: linear-gradient(120deg, #fff 30%, #e7f4e7); box-shadow: 0 5px 20px rgba(24,54,24,.05); }
.home-eyebrow { margin: 0 0 10px; font-size: 11px; font-weight: 800; letter-spacing: 1.8px; text-transform: uppercase; color: var(--forest-dark); }
.home-intro h1 { font-family: var(--font-read); font-size: clamp(26px, 4vw, 38px); line-height: 1.15; letter-spacing: -.7px; margin: 0 0 12px; }
.home-intro p:last-child { margin: 0; max-width: 540px; color: var(--ink-soft); line-height: 1.65; }
.sections-grid { gap: 10px; }
.section-card { padding: 16px 12px; background: linear-gradient(150deg, #fff, #f0f7ef); box-shadow: 0 3px 8px rgba(24,54,24,.05); gap: 7px; }
.section-card-icon { width: 26px; height: 26px; }
.section-card:hover { background: #e7f4e7; box-shadow: 0 5px 14px rgba(24,54,24,.12); }
.feed-heading { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 800; letter-spacing: 1.5px; color: var(--forest-dark); margin-bottom: 14px; }
.feed-heading::after { content: ''; height: 1px; flex: 1; background: var(--border); }
.topic-list { gap: 12px; }
.topic-card { padding: 16px; gap: 16px; }
.topic-card:hover { border-color: #90b790; }
.topic-card-body { gap: 7px; }
.topic-card-title, .topic-card-plain .topic-card-title { font-size: 18px; line-height: 1.4; letter-spacing: -.2px; }
.topic-card-title:hover { color: var(--forest-dark); }
.topic-card-media { width: 110px; height: 84px; }
.topic-card-section { letter-spacing: .8px; }
.section-header { border: 1px solid #bdd4bd; border-radius: var(--radius); margin: 0 0 20px; background: linear-gradient(120deg, #fff, #e7f4e7); }
.section-header-title { padding: 18px; }
.section-header-sub { padding: 12px 18px; }
.post-main { padding: 22px; }
.post-title { font-family: var(--font-read); font-size: clamp(25px, 4vw, 34px); line-height: 1.25; letter-spacing: -.5px; }
.sort-toggle, .scope-btn:not(.active) { background: linear-gradient(#fff, #edf3ec); border: 1px solid #b9cdb9; padding: 9px 13px; font-weight: 700; box-shadow: inset 0 1px #fff; }
.stacked-form input, .stacked-form textarea, .stacked-form select, .field-input, .reply-textarea, .search-form input {
  border-color: #bdcebd; box-shadow: inset 0 2px 3px rgba(24,54,24,.04); padding: 11px 12px;
}
.modal-panel { border: 1px solid #bdd4bd; box-shadow: 0 20px 70px rgba(0,30,0,.22); }
.site-footer { background: linear-gradient(#e7f0e5, #f8fbf7); }
.footer-inner { padding: 24px 14px; }
@media (min-width: 780px) {
  .layout-shell:not(.no-sidebar) { gap: 26px; }
  .layout-shell:not(.no-sidebar) .section-sidebar { width: 218px; margin-top: 24px; top: calc(var(--header-h) + 24px); }
}
@media (max-width: 779.98px) {
  .header-row { gap: 8px; padding: 0 14px; }
  .logo { font-size: 20px; }
  .mobile-nav { align-items: center; }
  .mobile-nav .nav-link { min-width: 44px; padding: 6px 12px; gap: 3px; font-weight: 700; }
  .home-intro { padding: 22px 18px; margin-bottom: 18px; }
  .topic-card { padding: 12px; gap: 12px; }
  .topic-card-media { width: 88px; height: 76px; }
  .topic-card-title, .topic-card-plain .topic-card-title { font-size: 16px; }
  /* Phones: the post runs edge-to-edge, so cancel the .page gutter and square
     off the corners. The comments below keep their normal inset. */
  .post-main {
    padding: 16px;
    margin-left: -14px;
    margin-right: -14px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Keep the reply composer inside the area visible above the keyboard. */
#replyModal {
  top: var(--reply-viewport-top, 0px);
  bottom: auto;
  height: var(--reply-viewport-height, 100dvh);
  align-items: center;
  padding: 16px;
}
#replyModal .modal-panel {
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius);
}
#replyModal .reply-quote { max-height: 72px; overflow-y: auto; }
#replyModal .reply-textarea { min-height: 90px; max-height: 30dvh; font-size: 16px; }

/* Place replies slightly below center while retaining keyboard clearance. */
#replyModal { padding-top: 48px; }
@media (max-width: 639.98px) {
  #replyModal { padding-left: 0; padding-right: 0; }
  #replyModal .modal-panel { max-width: none; }
}

.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 6px 12px; flex-shrink: 0;
  background: var(--card);
}
.notif-panel-header .logo {
  color: var(--forest); font-size: 17px; letter-spacing: 0;
  text-shadow: none;
}
.notif-panel-header .icon-btn {
  color: #fff; background: var(--danger); border-radius: 50%;
  width: 28px; height: 28px;
}
.notif-panel-header .icon-btn .icon { width: 16px; height: 16px; }
.notif-panel-header .icon-btn:hover { background: #8e1e18; }

.search-checkboxes { border: 0; padding: 0; margin: 0 0 20px; gap: 18px; flex-wrap: wrap; }
.search-scope-label { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.search-checkboxes label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; }
.search-checkboxes input { width: 17px; height: 17px; margin: 0; accent-color: var(--forest); }
.search-checkboxes .search-scope-locked { color: #8b918b; cursor: not-allowed; }
.search-checkboxes .search-scope-locked input { pointer-events: none; accent-color: #aeb5ae; }
.search-login-note { flex-basis: 100%; margin: 0; color: var(--ink-soft); font-size: 12px; }

.search-result-heading { display: flex; align-items: center; gap: 10px; }
.search-result-tag { display: inline-block; padding: 2px 8px; border: 1px solid #bdd4bd; border-radius: 4px; background: var(--forest-light); color: var(--forest-dark); font-size: 11px; font-weight: 700; }
.search-result-date { margin-left: auto; color: var(--ink-soft); font-size: 12px; }
.search-results .user-result { margin-bottom: 0; padding: 14px 16px; }

.profile-header-main > .avatar-lg { width: 68px; height: 68px; }

.comment-op { color: var(--forest-dark); font-size: 12px; font-weight: 700; }

.site-logo-image { width: 42px; height: 42px; object-fit: contain; flex-shrink: 0; }

.home-intro { display: flex; align-items: center; gap: 20px; }
.welcome-logo { width: 128px; height: 128px; object-fit: contain; flex-shrink: 0; }
.welcome-copy { min-width: 0; }
@media (max-width: 639.98px) {
  .home-intro { align-items: flex-start; gap: 12px; }
  .welcome-logo { width: 88px; height: 88px; }
  .home-intro h1 { font-size: clamp(22px, 5vw, 28px); }
}
/* Share targets shown on phones when the browser cannot open its native sheet. */
.share-options-backdrop{position:fixed;inset:0;z-index:10000;background:rgba(0,0,0,.48);display:flex;align-items:flex-end;justify-content:center;padding:16px}
.share-options{width:min(100%,440px);background:var(--surface,#fff);color:var(--text,#222);border-radius:18px;padding:16px;box-shadow:0 12px 40px rgba(0,0,0,.24);display:grid;gap:8px}
.share-options-heading{display:flex;align-items:center;justify-content:space-between;padding:2px 4px 8px}
.share-options a,.share-options button{font:inherit;text-align:left;text-decoration:none;color:inherit;background:transparent;border:0;border-radius:10px;padding:13px 12px;cursor:pointer}
.share-options a:hover,.share-options button:hover{background:rgba(127,127,127,.12)}
.share-options-close{font-size:24px!important;line-height:1;padding:2px 8px!important}
