/* ===========================================================
   Snikus Help Center — flat, bordered, "official" design system.
   Deliberately NOT the main app's neumorphism — hairline borders
   and barely-there shadows instead of dual inset soft-UI shadows.
   =========================================================== */

:root {
  --blue: #2E7DFF;
  --blue-dark: #1a5fd9;
  --blue-tint: #eaf1ff;
  --ink: #1c1e21;
  --ink-soft: #4b4f56;
  --ink-faint: #8a8d91;
  --border: #e4e6eb;
  --bg: #f7f8fa;
  --card: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 4px 14px rgba(0, 0, 0, 0.08);
  --max: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { margin: 0 0 0 0; }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 12px; }
p { line-height: 1.7; margin: 0 0 16px; color: var(--ink-soft); }
.icon { flex-shrink: 0; }

/* ---------- layout helpers ---------- */
.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
}
.site-logo:hover { text-decoration: none; }
.site-logo img { border-radius: 8px; }
.site-logo em { font-style: normal; font-weight: 400; color: var(--ink-faint); }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 14.5px;
  padding: 9px 14px;
  border-radius: 8px;
}
.site-nav a:hover { background: var(--bg); text-decoration: none; }
.site-nav a.active { color: var(--blue); background: var(--blue-tint); }
.site-nav-cta {
  margin-left: 6px;
  color: #fff !important;
  background: var(--blue) !important;
  display: flex;
  align-items: center;
  gap: 6px;
}
.site-nav-cta:hover { background: var(--blue-dark) !important; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  cursor: pointer;
}

/* ---------- hero + search ---------- */
.hero {
  background: linear-gradient(180deg, #fff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 64px 20px 56px;
  text-align: center;
}
.hero-mascot { width: 84px; height: 84px; margin: 0 auto 18px; }
.hero h1 { font-size: 34px; margin-bottom: 10px; }
.hero p.hero-sub { font-size: 16.5px; color: var(--ink-soft); max-width: 520px; margin: 0 auto 28px; }

.search-box {
  max-width: 620px;
  margin: 0 auto;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 16px 20px 16px 50px;
  font-size: 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--ink);
}
.search-box input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
.search-box .icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); pointer-events: none; }
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  text-align: left;
  max-height: 340px;
  overflow-y: auto;
  display: none;
  z-index: 40;
}
.search-results.open { display: block; }
.search-results a {
  display: block;
  padding: 12px 18px;
  color: var(--ink);
  border-bottom: 1px solid var(--border);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--bg); text-decoration: none; }
.search-results .sr-cat { color: var(--ink-faint); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
.search-results .sr-empty { padding: 16px 18px; color: var(--ink-faint); font-size: 14px; }

/* ---------- section headings ---------- */
.section-head { text-align: center; margin: 56px 0 28px; }
.section-head h2 { font-size: 24px; }
.section-head p { color: var(--ink-faint); margin: 0; }

/* ---------- category grid ---------- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 0 0 48px;
}
.category-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  color: var(--ink);
  transition: box-shadow .15s ease, transform .15s ease;
}
.category-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); text-decoration: none; }
.category-card .cat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  background: var(--blue-tint);
  color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.category-card h3 { font-size: 16.5px; margin-bottom: 6px; }
.category-card p { font-size: 13.5px; margin-bottom: 10px; }
.category-card .cat-count { font-size: 12.5px; color: var(--ink-faint); font-weight: 600; }

/* ---------- article list (category page) ---------- */
.article-list { display: flex; flex-direction: column; gap: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.article-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}
.article-list-row:last-child { border-bottom: none; }
.article-list-row:hover { background: var(--bg); text-decoration: none; }
.article-list-row .ar-title { font-weight: 600; font-size: 15px; margin-bottom: 3px; }
.article-list-row .ar-summary { font-size: 13.5px; color: var(--ink-faint); }
.article-list-row .icon { color: var(--ink-faint); }
.empty-list-note { padding: 28px 20px; color: var(--ink-faint); font-size: 14.5px; text-align: center; }

/* ---------- breadcrumb ---------- */
.breadcrumb { font-size: 13.5px; color: var(--ink-faint); margin: 24px 0 18px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.breadcrumb a { color: var(--ink-faint); }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb .sep { color: #c7cad1; }
.breadcrumb .current { color: var(--ink); font-weight: 600; }

/* ---------- article page ---------- */
.article-layout { display: grid; grid-template-columns: 1fr 260px; gap: 40px; align-items: start; padding-bottom: 64px; }
.article-body { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px 40px; box-shadow: var(--shadow); }
.article-body .cat-pill {
  display: inline-block; font-size: 12.5px; font-weight: 700; color: var(--blue);
  background: var(--blue-tint); padding: 4px 10px; border-radius: 999px; margin-bottom: 14px;
}
.article-body h1 { font-size: 27px; margin-bottom: 20px; }
.article-body h2 { font-size: 19px; margin-top: 30px; }
.article-body ul, .article-body ol { margin: 0 0 16px 20px; color: var(--ink-soft); line-height: 1.7; }
.article-body li { margin-bottom: 6px; }
.article-body table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14.5px; }
.article-body th, .article-body td { text-align: left; padding: 10px 14px; border: 1px solid var(--border); }
.article-body th { background: var(--bg); font-weight: 700; }
.article-body strong { color: var(--ink); }

.helpful-strip {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.helpful-strip span { font-size: 14.5px; color: var(--ink-soft); font-weight: 600; }
.helpful-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border); background: var(--card);
  padding: 8px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft);
  cursor: pointer;
}
.helpful-btn:hover { border-color: var(--blue); color: var(--blue); }
.helpful-btn.chosen { border-color: var(--blue); color: var(--blue); background: var(--blue-tint); }
.helpful-thanks { font-size: 13.5px; color: var(--ink-faint); display: none; }
.helpful-thanks.show { display: inline; }

.article-sidebar { position: sticky; top: 84px; }
.sidebar-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.sidebar-box h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-faint); margin-bottom: 12px; }
.sidebar-box a.side-link { display: block; font-size: 14px; color: var(--ink); padding: 8px 0; border-bottom: 1px solid var(--border); }
.sidebar-box a.side-link:last-child { border-bottom: none; }
.sidebar-box a.side-link:hover { color: var(--blue); text-decoration: none; }

/* ---------- help hub ---------- */
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin: 0 0 48px; }
.help-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.help-card h3 { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.help-card h3 .icon { color: var(--blue); }
.help-card p { font-size: 14px; margin-bottom: 12px; }

.faq-list { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 48px; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-item:last-child { border-bottom: none; }
.faq-q {
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 20px; font-size: 15px; font-weight: 600; color: var(--ink);
}
.faq-q .icon { color: var(--ink-faint); transition: transform .15s ease; flex-shrink: 0; }
.faq-item.open .faq-q .icon { transform: rotate(90deg); }
.faq-a { max-height: 0; overflow: hidden; transition: max-height .2s ease; }
.faq-item.open .faq-a { max-height: 400px; }
.faq-a-inner { padding: 0 20px 18px; font-size: 14.5px; color: var(--ink-soft); line-height: 1.7; }

.contact-banner {
  background: var(--blue-tint);
  border: 1px solid #cfe1ff;
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  margin-bottom: 48px;
}
.contact-banner h3 { margin-bottom: 8px; }
.contact-banner p { margin-bottom: 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px;
  font-weight: 700; font-size: 14.5px; cursor: pointer; border: 1px solid transparent;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-outline { background: var(--card); color: var(--ink); border-color: var(--border); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- blog ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 48px; }
.blog-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); color: var(--ink); }
.blog-card:hover { box-shadow: var(--shadow-hover); text-decoration: none; }
.blog-card .blog-date { font-size: 12.5px; color: var(--ink-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 10px; }
.blog-card h3 { font-size: 18px; margin-bottom: 8px; }
.blog-card p { font-size: 14px; margin-bottom: 0; }

.blog-post-head { text-align: center; max-width: 680px; margin: 24px auto 32px; }
.blog-post-head .blog-date { font-size: 13px; color: var(--ink-faint); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 10px; }
.blog-post-head h1 { font-size: 30px; }
.blog-post-body { max-width: 680px; margin: 0 auto 64px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px 40px; box-shadow: var(--shadow); }
.blog-post-body h2 { font-size: 19px; margin-top: 28px; }

/* ---------- page hero (docs / help / blog listing top strips) ---------- */
.page-hero { text-align: center; padding: 48px 20px 8px; }
.page-hero h1 { font-size: 28px; margin-bottom: 8px; }
.page-hero p { color: var(--ink-faint); max-width: 560px; margin: 0 auto; }

/* ---------- empty state ---------- */
.empty-state { text-align: center; padding: 48px 20px; color: var(--ink-faint); }

/* ---------- footer ---------- */
.site-footer { background: var(--card); border-top: 1px solid var(--border); margin-top: 40px; }
.site-footer-inner { max-width: var(--max); margin: 0 auto; padding: 36px 20px; text-align: center; }
.site-footer-brand { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; margin-bottom: 16px; }
.site-footer-brand img { border-radius: 6px; }
.site-footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 18px; margin-bottom: 16px; }
.site-footer-links a { color: var(--ink-soft); font-size: 13.5px; font-weight: 600; }
.site-footer-links a:hover { color: var(--blue); }
.site-footer-copy { font-size: 12.5px; color: var(--ink-faint); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-sidebar { position: static; order: -1; }
  .article-body { padding: 26px 22px; }
}

@media (max-width: 720px) {
  .site-nav {
    display: none;
    position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 16px 16px;
    box-shadow: var(--shadow-hover);
  }
  .site-nav.open { display: flex; }
  .site-nav a { padding: 12px 10px; }
  .site-nav-cta { justify-content: center; margin-left: 0; margin-top: 6px; }
  .nav-toggle { display: flex; }

  .hero { padding: 40px 16px 40px; }
  .hero h1 { font-size: 26px; }
  .hero-mascot { width: 64px; height: 64px; }

  .blog-post-body, .article-body { padding: 24px 18px; }

  .stories-value-strip { gap: 14px 20px; margin-top: 16px; }
  .stories-value-item { font-size: 12px; }

  .story-grid { grid-template-columns: 1fr; }
  .story-card-cover { height: 140px; }

  .story-detail { padding: 24px 18px; margin-top: 16px; }
  .story-detail h1 { font-size: 22px; }
  .story-detail-author { padding: 10px 12px; gap: 10px; }
  .story-detail-body { font-size: 15px; }
  .story-detail-actions { display: flex; justify-content: center; }

  .story-write-cta { padding: 22px 18px; margin-top: 16px; }

  .story-comments { margin: 24px auto 48px; padding: 0 4px; }
  .comment-form .btn { align-self: stretch; }
}

/* ===========================================================
   Signed-in nav avatar (header.php, docs handoff session)
   =========================================================== */
.site-nav-user { display: inline-flex; margin-left: 10px; }
.site-nav-avatar, .site-nav-avatar-img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.site-nav-avatar { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 14px; }

/* ===========================================================
   Stories promo banner (index.php)
   =========================================================== */
.stories-promo-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 28px; box-shadow: var(--shadow); margin-bottom: 48px;
}
.stories-promo-banner h3 { margin-bottom: 4px; }
.stories-promo-banner p { margin-bottom: 0; max-width: 480px; }

/* ===========================================================
   Story cards (stories.php)
   =========================================================== */
.stories-value-strip {
  display: flex; justify-content: center; gap: 28px; flex-wrap: wrap;
  margin: 22px auto 0; padding: 0 20px; max-width: 640px;
}
.stories-value-item { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.stories-value-item .icon { color: var(--blue); flex-shrink: 0; }

.story-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 56px; }
.story-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.story-card:hover { box-shadow: var(--shadow-hover); border-color: var(--blue); transform: translateY(-3px); }
.story-card-link { color: var(--ink); display: block; }
.story-card-link:hover { text-decoration: none; }
.story-card-cover { width: 100%; height: 160px; object-fit: cover; }
.story-card-body { padding: 18px 18px 8px; }
.story-card-body h3 { font-size: 16.5px; margin-bottom: 6px; line-height: 1.35; }
.story-card-body p { font-size: 13.5px; margin-bottom: 0; }
.story-card-readmore { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--blue); margin-top: 10px; }
.story-card:hover .story-card-readmore { text-decoration: underline; }
.story-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px 16px; }
.story-card-author { display: flex; align-items: center; gap: 8px; min-width: 0; }
.story-author-avatar, .story-author-avatar-fallback { width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.story-author-avatar-fallback { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; }
.story-author-info { min-width: 0; }
.story-author-name { font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-author-username { font-size: 11px; color: var(--ink-faint); }
.author-social-icons { display: flex; gap: 6px; flex-shrink: 0; }
.author-social-icon {
  color: var(--ink-soft); display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%; background: var(--bg); border: 1px solid var(--border);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.author-social-icon:hover { color: var(--blue); border-color: var(--blue); background: var(--blue-tint); }
.story-like-btn {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  border: 1px solid var(--border); background: var(--card); color: var(--ink-soft);
  padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 700; cursor: pointer;
}
.story-like-btn:hover { border-color: var(--blue); color: var(--blue); }
.story-like-btn.liked { background: var(--blue-tint); border-color: var(--blue); color: var(--blue); }
.story-like-btn-lg { padding: 10px 18px; font-size: 14px; }

/* ===========================================================
   Story detail page (story.php)
   =========================================================== */
.story-detail { max-width: 720px; margin: 24px auto 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px 40px; }
.story-detail-eyebrow {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  color: var(--blue); background: var(--blue-tint); padding: 5px 12px; border-radius: 999px; margin-bottom: 14px;
}
.story-detail h1 { font-size: 28px; margin-bottom: 20px; line-height: 1.3; }
.story-detail-author {
  display: flex; align-items: center; gap: 12px; margin-bottom: 26px;
  padding: 12px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
}
.story-detail-cover { width: 100%; border-radius: var(--radius); margin-bottom: 28px; box-shadow: var(--shadow-hover); }
.story-detail-body { font-size: 15.5px; line-height: 1.75; color: var(--ink-soft); margin-bottom: 24px; }
.story-detail-body h2 { font-size: 19px; margin-top: 26px; color: var(--ink); }
.story-detail-body p { margin-bottom: 16px; }
.story-detail-body img { max-width: 100%; border-radius: 8px; margin: 12px 0; }
.story-detail-body ul, .story-detail-body ol { margin: 0 0 16px 20px; }
.story-detail-actions { border-top: 1px solid var(--border); padding-top: 20px; }

.story-write-cta {
  max-width: 720px; margin: 24px auto 0; text-align: center;
  background: linear-gradient(135deg, var(--blue-tint), #fff); border: 1px solid #cfe1ff; border-radius: var(--radius);
  padding: 28px 24px;
}
.story-write-cta h3 { margin-bottom: 6px; }
.story-write-cta p { margin-bottom: 16px; }

/* ===========================================================
   Comments (story.php)
   =========================================================== */
.story-comments { max-width: 720px; margin: 32px auto 64px; }
.story-comments h3 { font-size: 17px; margin-bottom: 16px; }
.comment-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 28px; }
.comment-form textarea {
  width: 100%; min-height: 70px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px;
  font: inherit; font-size: 14px; resize: vertical; color: var(--ink);
}
.comment-form textarea:focus { outline: none; border-color: var(--blue); }
.comment-form .btn { align-self: flex-end; }
.comment-signin-prompt { font-size: 14px; color: var(--ink-faint); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; margin-bottom: 24px; }
.comment-list { display: flex; flex-direction: column; gap: 16px; }
.comment-row { display: flex; gap: 10px; }

/* ===========================================================
   Support Messenger — floating widget (help.php)
   Powered by Nexilant. Deliberately its own compact visual
   language (dark header, rounded bubble chrome) so it reads as
   a "real messenger" dropped onto the page, not another docs card.
   =========================================================== */
.sw-bubble {
  position: fixed; right: 22px; bottom: 22px; z-index: 200;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--blue); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(46, 125, 255, 0.35);
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.sw-bubble:hover { transform: scale(1.06); }
.sw-bubble.hidden-while-open { opacity: 0; pointer-events: none; transform: scale(0.8); }

.sw-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 201;
  width: 370px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 100px);
  background: #fff; border-radius: 16px; box-shadow: 0 12px 40px rgba(16,24,43,0.22);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(0.98); pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.sw-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.sw-panel-header {
  background: linear-gradient(135deg, #10182b, #1c2b4d);
  color: #fff; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.sw-panel-header-title { display: flex; align-items: center; gap: 10px; }
.sw-panel-header-title img { width: 30px; height: 30px; border-radius: 8px; }
.sw-panel-header-text { line-height: 1.25; }
.sw-panel-header-text strong { font-size: 14.5px; display: block; }
.sw-panel-header-text span { font-size: 10.5px; color: #9fb3d9; text-transform: uppercase; letter-spacing: 0.04em; }
.sw-panel-close { background: none; border: none; color: #fff; opacity: 0.75; cursor: pointer; padding: 4px; }
.sw-panel-close:hover { opacity: 1; }

.sw-panel-body { flex: 1; overflow-y: auto; padding: 18px; }

.sw-hero {
  text-align: center; padding: 4px 4px 18px; margin: -18px -18px 18px; border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--blue-tint), transparent);
}
.sw-hero-avatar { width: 64px; height: 64px; margin: 14px auto 8px; }
.sw-hero-avatar img { width: 100%; height: 100%; object-fit: contain; }
.sw-greeting { font-size: 16.5px; font-weight: 800; margin-bottom: 3px; }
.sw-subgreeting { font-size: 13px; color: var(--ink-faint); margin-bottom: 0; }
.sw-identify-link { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; margin-top: 12px; }
.sw-new-btn { width: 100%; justify-content: center; margin-bottom: 20px; }

.sw-section-label { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-faint); margin-bottom: 8px; }

.sw-quicklinks { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.sw-quicklink-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px; color: var(--ink);
  font-size: 13px; font-weight: 600;
}
.sw-quicklink-item:hover { border-color: var(--blue); background: var(--blue-tint); text-decoration: none; }
.sw-quicklink-icon { display: inline-flex; color: var(--blue); flex-shrink: 0; }
.sw-quicklink-text { flex: 1; }
.sw-quicklink-item > svg:last-child { color: var(--ink-faint); flex-shrink: 0; }

.sw-history-loading, .sw-history-empty { font-size: 13px; color: var(--ink-faint); text-align: center; padding: 12px 0; }
.sw-history-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; cursor: pointer;
}
.sw-history-row:hover { border-color: var(--blue); }
.sw-history-subject { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }

.sw-status-pill { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.02em; flex-shrink: 0; }
.sw-status-open { background: #dbeafe; color: #1d4ed8; }
.sw-status-pending { background: #fef3c7; color: #92400e; }
.sw-status-resolved { background: #dcfce7; color: #15803d; }
.sw-status-closed { background: #e5e7eb; color: #4b5563; }

.sw-back-btn { background: none; border: none; color: var(--blue); font-size: 13px; font-weight: 700; cursor: pointer; padding: 0 0 14px; }

.sw-compose h4 { margin-bottom: 12px; font-size: 15px; }
.sw-input, .sw-textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 13.5px; color: var(--ink); margin-bottom: 10px;
}
.sw-textarea { min-height: 90px; resize: vertical; }
.sw-input:focus, .sw-textarea:focus { outline: none; border-color: var(--blue); }
.sw-attach-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-faint); cursor: pointer; margin-bottom: 4px; }
.sw-attach-label input[type="file"] { display: none; }
.sw-attach-filename { display: block; font-size: 11.5px; color: var(--ink-faint); margin-bottom: 10px; }
.sw-error { color: #d92d20; font-size: 12.5px; margin-bottom: 8px; min-height: 0; }
.sw-submit-btn { width: 100%; justify-content: center; }

.sw-thread-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.sw-thread-subject { font-size: 14px; font-weight: 700; line-height: 1.3; }
.sw-thread-messages { display: flex; flex-direction: column; gap: 14px; margin-bottom: 14px; max-height: 300px; overflow-y: auto; padding: 2px; }
.sw-msg-row { display: flex; flex-direction: column; max-width: 88%; }
.sw-msg-row-user { align-self: flex-end; align-items: flex-end; }
.sw-msg-row-admin { align-self: flex-start; align-items: flex-start; }
.sw-msg-sender { font-size: 10.5px; font-weight: 700; color: var(--ink-faint); margin-bottom: 3px; padding: 0 2px; }
.sw-msg { padding: 9px 12px; border-radius: 14px; font-size: 13px; line-height: 1.5; }
.sw-msg-row-user .sw-msg { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.sw-msg-row-admin .sw-msg { background: var(--card); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.sw-msg-time { font-size: 10px; color: var(--ink-faint); margin-top: 3px; padding: 0 2px; }
.sw-msg-attachments { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.sw-attachment-link { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; text-decoration: underline; color: inherit; opacity: 0.9; }
.sw-reply-form { border-top: 1px solid var(--border); padding-top: 12px; }
.sw-reply-textarea { min-height: 56px; margin-bottom: 8px; }
.sw-reply-row { display: flex; align-items: center; gap: 8px; }
.sw-attach-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 8px; color: var(--ink-faint); cursor: pointer; flex-shrink: 0; }
.sw-attach-icon-btn input[type="file"] { display: none; }
.sw-reply-submit { flex: 1; justify-content: center; }
.sw-closed-note { font-size: 12.5px; color: var(--ink-faint); text-align: center; padding: 10px 0; }

.sw-footer { padding: 8px 18px; border-top: 1px solid var(--border); text-align: center; flex-shrink: 0; }
.sw-footer span { font-size: 10.5px; color: var(--ink-faint); }
.sw-footer strong { color: var(--ink-soft); }

@media (max-width: 480px) {
  .sw-panel { right: 10px; bottom: 10px; left: 10px; width: auto; height: calc(100vh - 90px); max-height: none; }
  .sw-bubble { right: 16px; bottom: 16px; }
}
.comment-avatar, .comment-avatar-fallback { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; object-fit: cover; }
.comment-avatar-fallback { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 13px; }
.comment-body { background: var(--bg); border-radius: 12px; padding: 10px 14px; flex: 1; }
.comment-meta { font-size: 13px; margin-bottom: 2px; }
.comment-meta span { color: var(--ink-faint); font-weight: 400; }
.comment-text { font-size: 14px; color: var(--ink-soft); line-height: 1.5; word-break: break-word; }

/* ===========================================================
   Write-story composer (write-story.php) + shared rich editor
   =========================================================== */
.write-story-form { padding: 8px 0 60px; }
.write-story-form .field { margin-bottom: 20px; }
.write-story-form label { display: block; font-size: 13.5px; font-weight: 700; margin-bottom: 8px; color: var(--ink); }
.write-story-form input[type="text"] {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 15px; color: var(--ink);
}
.write-story-form input[type="text"]:focus { outline: none; border-color: var(--blue); }
.alert-box { background: #fdecea; border: 1px solid #f5c2c0; color: #b3261e; padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 18px; }

.cover-upload {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px; text-align: center; cursor: pointer;
  color: var(--ink-faint); position: relative; overflow: hidden;
}
.cover-upload:hover { border-color: var(--blue); }
.cover-upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 13.5px; }
#coverPreview { width: 100%; max-height: 260px; object-fit: cover; border-radius: 8px; display: block; }

.editor-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.editor-toolbar button {
  border: 1px solid var(--border); background: var(--card); border-radius: 8px; padding: 7px 12px;
  font-size: 13px; cursor: pointer; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 4px;
}
.editor-toolbar button:hover { border-color: var(--blue); color: var(--blue); }
.rich-editor {
  min-height: 260px; border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px;
  font-size: 15px; line-height: 1.7; color: var(--ink);
}
.rich-editor:focus { outline: none; border-color: var(--blue); }
.rich-editor:empty::before { content: attr(data-placeholder); color: var(--ink-faint); }
.rich-editor img { max-width: 100%; border-radius: 8px; }
.rich-editor h2 { font-size: 19px; margin: 16px 0 8px; }
.rich-editor ul { margin-left: 20px; }
.btn-block { width: 100%; justify-content: center; }
