:root{
  --bg:#f7f5f0;            /* warm cream page bg */
  --panel:#ffffff;         /* white cards */
  --panel-soft:#fbfaf6;    /* slightly tinted panels for variety */
  --border:#e5e1d8;        /* soft warm grey borders */
  --text:#1a1f2e;          /* deep ink */
  --muted:#6b7280;         /* secondary text */
  --accent:#2563eb;        /* primary blue */
  --accent-hover:#1d4ed8;  /* darker blue on hover */
  --accent-soft:#dbeafe;   /* tint for highlights */
  --ok:#16a34a;            /* green */
  --bad:#dc2626;           /* red */
  --warn:#d97706;          /* amber */
  --shadow-sm:0 1px 2px rgba(15,20,40,.04), 0 1px 3px rgba(15,20,40,.06);
  --shadow-md:0 4px 12px rgba(15,20,40,.08);
  --radius:12px;
}
*{box-sizing:border-box}
html,body{
  margin:0;
  padding:0;
  width:100%;
  max-width:100%;
  background:var(--bg);
  color:var(--text);
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,sans-serif;
  line-height:1.55;
  overflow-x:hidden;
}
html{scroll-behavior:smooth}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}
::selection{background:var(--accent);color:#fff}

/* ============================================================
   HEADER + HAMBURGER + SIDE DRAWER
   ============================================================ */

.site-header{
  background:#ffffff;
  border-bottom:1px solid var(--border);
  padding:0;
  position:sticky;
  top:0;
  z-index:200;
  width:100%;
  box-shadow:var(--shadow-sm);
}
.site-header .wrap{
  max-width:1280px;
  margin:0 auto;
  display:flex;
  align-items:center;
  gap:16px;
  padding:14px 20px;
}

.brand{
  font-weight:700;
  font-size:1.3rem;
  color:var(--text);
  display:flex;
  align-items:center;
  text-decoration:none;
  line-height:0;
  gap:0;
  letter-spacing:-.01em;
}
.brand:hover{text-decoration:none;opacity:.85}
.brand-name{color:var(--text)}
.brand-dot{color:var(--accent)}

.brand-logo{
  height:42px;
  width:auto;
  display:block;
}

@media (max-width:760px){
  .brand-logo{height:36px}
}

/* Hamburger button (hidden on desktop) */
.hamburger{
  display:none;
  background:transparent;
  border:0;
  width:44px;
  height:44px;
  padding:8px;
  cursor:pointer;
  margin-left:auto;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap:5px;
  position:relative;
}
.hamburger span{
  display:block;
  width:24px;
  height:2px;
  background:var(--text);
  border-radius:2px;
  transition:opacity .2s;
}

/* Desktop nav */
.nav-desktop{
  margin-left:auto;
  display:flex;
  gap:6px;
  align-items:center;
  flex-wrap:wrap;
}
.nav-desktop a{
  color:var(--text);
  padding:8px 14px;
  border-radius:8px;
  font-size:.95rem;
  transition:background .15s;
}
.nav-desktop a:hover{background:#f3f1ec;text-decoration:none}
.nav-desktop .nav-cta{background:var(--accent);color:#fff;font-weight:600}
.nav-desktop .nav-cta:hover{background:var(--accent-hover)}
.nav-desktop .nav-user{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 10px 6px 6px;
  background:#f3f1ec;
}
.nav-desktop .nav-user-name{font-weight:600;font-size:.9rem}
.nav-desktop .nav-logout{color:var(--muted);font-size:.9rem}

/* Mobile drawer (hidden on desktop) */
.nav-mobile{
  display:none;
}
.nav-close{
  display:none;
  background:transparent;
  border:0;
  width:40px;
  height:40px;
  cursor:pointer;
  align-items:center;
  justify-content:center;
  border-radius:50%;
  margin-left:auto;
  color:var(--text);
}
.nav-close:hover{background:#f3f1ec}
.nav-close svg{width:22px;height:22px}

/* Backdrop (hidden on desktop) */
.nav-backdrop{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  z-index:9000;
  opacity:0;
  transition:opacity .25s;
}
.nav-backdrop.show{display:block;opacity:1}

/* Mobile: hamburger appears, drawer becomes available */
@media (max-width:760px){
  .hamburger{display:flex}
  .nav-desktop{display:none}

  .nav-mobile{
    display:flex;
    position:fixed;
    top:0;
    right:0;
    height:100vh;
    height:100dvh;
    width:min(85%, 340px);
    background:#ffffff;
    flex-direction:column;
    align-items:stretch;
    justify-content:flex-start;
    flex-wrap:nowrap;
    gap:8px;
    padding:0 18px 24px;
    margin:0;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    transform:translateX(100%);
    transition:transform .28s ease;
    z-index:9999;
    box-shadow:-12px 0 28px rgba(0,0,0,.4);
  }
  .nav-mobile.open{transform:translateX(0)}

  .nav-mobile .nav-header{
    display:flex;
    align-items:center;
    padding:14px 0 18px;
    margin:0 0 10px;
    border-bottom:1px solid var(--border);
    position:sticky;
    top:0;
    background:#ffffff;
    z-index:1;
  }
  .nav-mobile .nav-brand-mini{
    font-weight:700;
    font-size:1.1rem;
    color:var(--text);
  }
  .nav-mobile .nav-close{display:flex}

  .nav-mobile a{
    padding:14px 16px;
    border-radius:10px;
    font-size:1.05rem;
    border:1px solid var(--border);
    background:var(--panel-soft);
    color:var(--text);
    width:100%;
    display:block;
    text-align:left;
    text-decoration:none;
  }
  .nav-mobile a:hover{background:#f3f1ec}
  .nav-mobile .nav-cta{
    margin-top:6px;
    text-align:center;
    background:var(--accent);
    color:#fff;
    border-color:var(--accent);
    font-weight:600;
  }
  .nav-mobile .nav-user{
    background:var(--panel-soft);
    border:1px solid var(--border);
    padding:14px 16px;
    border-radius:10px;
    width:100%;
    color:var(--text);
  }

  body.nav-open{
    position:fixed;
    width:100%;
    overflow:hidden;
  }
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

/* Right-to-left language support */
.vora-body{
  unicode-bidi: plaintext;
  text-align:start;
}

.vora-body.rtl{
  direction:rtl;
  text-align:right;
}

.site-main{
  max-width:1100px;
  margin:0 auto;
  padding:28px 20px;
}

.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:22px;
  box-shadow:var(--shadow-sm);
}
.card + .card{margin-top:14px}
.card h2 a{color:var(--accent)}
.card h2 a:hover{color:var(--accent-hover);text-decoration:none}
h1{margin:0 0 6px}
.tag{color:var(--muted);margin:0 0 18px}

.field{display:block;margin-bottom:14px}
.field span{display:block;color:var(--muted);font-size:.9rem;margin-bottom:6px}
.field input,.field textarea,.field select{
  width:100%;padding:11px 13px;border-radius:9px;border:1px solid var(--border);
  background:var(--panel-soft);color:var(--text);font:inherit;outline:none;
  transition:border-color .15s, box-shadow .15s
}
.field input:focus,.field textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px #1f6feb33}

.btn{
  display:inline-block;background:var(--accent);color:#fff;border:0;
  padding:11px 18px;border-radius:9px;font:inherit;font-weight:600;cursor:pointer;
  box-shadow:var(--shadow-sm);
  transition:background .15s, transform .1s;
}
.btn:hover{background:var(--accent-hover)}
.btn:active{transform:translateY(1px)}
.btn.secondary{background:#ffffff;color:var(--text);border:1px solid var(--border)}
.btn.secondary:hover{background:var(--panel-soft)}

/* Flash messages */
.flash{padding:12px 14px;border-radius:9px;margin-bottom:16px;border:1px solid}
.flash.ok{background:#dcfce7;border-color:#86efac;color:#166534}
.flash.bad{background:#fee2e2;border-color:#fca5a5;color:#991b1b}
.flash.info{background:#dbeafe;border-color:#93c5fd;color:#1e40af}

.crumbs{color:var(--muted);font-size:.9rem;margin-bottom:14px}
.crumbs a{color:var(--muted)}
.crumbs a:hover{color:var(--text)}

/* Subject list */
.subject-list{margin-top:14px;display:flex;flex-direction:column;gap:1px;background:var(--border);border:1px solid var(--border);border-radius:9px;overflow:hidden}
.subject-row{display:flex;justify-content:space-between;gap:1rem;padding:14px 16px;background:var(--panel);color:var(--text)}
.subject-row:hover{background:#f3f1ec;text-decoration:none}
.subj-name{font-weight:600;margin-bottom:2px}
.subj-desc{color:var(--muted);font-size:.9rem}
.subj-stats{color:var(--muted);font-size:.85rem;text-align:right;display:flex;flex-direction:column;gap:2px;flex-shrink:0}

/* Recent activity */
.recent{list-style:none;padding:0;margin:0}
.recent li{padding:10px 0;border-bottom:1px solid var(--border)}
.recent li:last-child{border-bottom:0}
.recent-meta{color:var(--muted);font-size:.85rem;display:block;margin-top:2px}

/* Subject view: scroll table */
.row-between{display:flex;justify-content:space-between;align-items:flex-start;gap:14px;flex-wrap:wrap}
.scroll-table{width:100%;border-collapse:collapse;margin-top:18px}
.scroll-table th,.scroll-table td{text-align:left;padding:12px 10px;border-bottom:1px solid var(--border)}
.scroll-table th{color:var(--muted);font-weight:500;font-size:.85rem}
.scroll-table td.num,.scroll-table th.num{text-align:right;width:80px;color:var(--muted)}
.scroll-title{font-weight:600;color:var(--text)}
.scroll-meta{color:var(--muted);font-size:.85rem;margin-top:2px}

/* Pills */
.pill{display:inline-block;font-size:.7rem;padding:2px 8px;border-radius:999px;margin-right:6px;text-transform:uppercase;letter-spacing:.5px}
.pill.sticky{background:#fef3c7;color:#92400e}
.pill.announce{background:#dbeafe;color:#1e40af}
.pill.locked{background:#fee2e2;color:#991b1b}

/* Pagination */
.pager{display:flex;gap:6px;margin-top:18px;flex-wrap:wrap}
.pg{padding:6px 11px;border:1px solid var(--border);border-radius:7px;color:var(--text)}
.pg:hover{background:#f3f1ec;text-decoration:none}
.pg.current{background:var(--accent);border-color:var(--accent);color:#fff;font-weight:600}

/* Vora (Vo + Ra display) — using side panel layout from Slice 5 */
.vora{
  display:flex;
  gap:18px;
  align-items:flex-start;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:18px 20px;
  margin-bottom:14px;
}
.vora.vo{border-left:3px solid var(--accent)}
.vora.ra{border-left:3px solid #444b56}
.vora-side{flex-shrink:0;width:140px;display:flex;flex-direction:column;align-items:center;gap:6px;text-align:center;padding-right:14px;border-right:1px solid var(--border)}
.vora-avatar{width:64px;height:64px;border-radius:50%;border:2px solid var(--border);object-fit:cover;background:var(--panel-soft);}
.vora-author{font-weight:600;color:var(--text);font-size:.95rem;margin-top:4px}
.vora-side-stat{font-size:.75rem;color:var(--muted)}
.vora-main{flex:1;min-width:0}
.vora-head{display:flex;align-items:center;gap:10px;font-size:.9rem;margin-bottom:12px;flex-wrap:wrap}
.vora-tag{font-size:.7rem;padding:2px 7px;border-radius:999px;text-transform:uppercase;letter-spacing:.5px}
.vora-tag.vo{background:#dbeafe;color:#1e40af}
.vora-tag.ra{background:#f3f4f6;color:#4b5563}
.vora-time{color:var(--muted)}
.vora-edited{color:var(--muted);font-style:italic}
.vora-body{line-height:1.65}
.vora-body p{margin:0 0 .8em}
.vora-body p:last-child{margin-bottom:0}
.vora-body a{color:#79c0ff}
.vora-body code{background:var(--panel-soft);border:1px solid var(--border);padding:1px 6px;border-radius:5px;font-size:.92em}
.vora-body pre{background:var(--panel-soft);border:1px solid var(--border);padding:12px;border-radius:8px;overflow-x:auto}
.vora-body pre code{background:transparent;border:0;padding:0}
.vora-body blockquote{border-left:3px solid var(--accent);margin:8px 0;padding:4px 12px;color:var(--muted);background:var(--panel-soft);border-radius:0 8px 8px 0}
.vora-body ul,.vora-body ol{padding-left:1.4em}
.vora-sig{margin-top:14px;padding-top:10px;border-top:1px dashed var(--border);color:var(--muted);font-size:.85rem;font-style:italic;white-space:pre-wrap}
.vora-foot{margin-top:14px;padding-top:10px;border-top:1px solid var(--border);font-size:.85rem;display:flex;gap:14px}
.vora-action{color:var(--muted)}
.vora-action:hover{color:var(--text);text-decoration:none}

textarea{
  width:100%;padding:12px;border-radius:9px;border:1px solid var(--border);
  background:var(--panel-soft);color:var(--text);font:inherit;outline:none;resize:vertical;min-height:120px
}
textarea:focus{border-color:var(--accent);box-shadow:0 0 0 3px #1f6feb33}

/* Ufile (member profile) */
.ufile-head{display:flex;gap:22px;align-items:flex-start;flex-wrap:wrap}
.ufile-avatar{width:128px;height:128px;border-radius:50%;border:2px solid var(--border);object-fit:cover;background:var(--panel-soft);}
.ufile-meta{flex:1;min-width:240px}

/* Rank pills */
.rank-pill{display:inline-block;font-size:.7rem;padding:2px 9px;border-radius:999px;text-transform:uppercase;letter-spacing:.5px;margin-left:6px;font-weight:600}
.rank-pill.newbie{background:#dbeafe;color:#1e40af}
.rank-pill.member{background:#dcfce7;color:#166534}
.rank-pill.regular{background:#fef3c7;color:#92400e}
.rank-pill.veteran{background:#f3e8ff;color:#6b21a8}
.rank-pill.banned{background:#fee2e2;color:#991b1b}
.rank-pill.admin{background:#fef3c7;color:#92400e}

/* HAP tabs */
.hap-tabs{display:flex;gap:6px;margin-top:6px}
.hap-tab{padding:7px 14px;border-radius:7px 7px 0 0;color:var(--muted);background:var(--panel-soft);border:1px solid var(--border);border-bottom:0}
.hap-tab.active{background:var(--panel);color:#ffd97a}
.hap-tab:hover{text-decoration:none;color:var(--text)}

/* Search results */
.search-result{padding:14px 18px}
.search-meta{font-size:.85rem;color:var(--muted);margin-bottom:6px}
.search-snippet{margin:0;color:var(--text);line-height:1.5}

/* ============================================================
   FOOTER (full edge-to-edge dark bar)
   ============================================================ */

.site-footer{
  background:#0c0e12;
  border-top:1px solid var(--border);
  margin-top:60px;
  width:100%;
  color:#9ca3af;
  padding:0;
}
.footer-inner{
  max-width:1100px;
  margin:0 auto;
  padding:48px 20px 24px;
}
.footer-grid{
  display:grid;
  grid-template-columns:1.6fr 1fr 1fr 1.2fr;
  gap:40px;
  padding-bottom:32px;
  border-bottom:1px solid var(--border);
  border-bottom-color:#1f2937;
}
.footer-col{min-width:0}
.footer-brand-name{
  font-size:1.4rem;
  font-weight:700;
  color:#ffffff;
  margin-bottom:12px;
  letter-spacing:-.01em;
}
.footer-about{margin:0;line-height:1.6;color:#9ca3af;font-size:.9rem}
.footer-h{color:#f9fafb;font-size:.95rem;font-weight:600;margin:0 0 14px;letter-spacing:.01em}
.footer-links{list-style:none;margin:0;padding:0}
.footer-links li{margin-bottom:8px;font-size:.9rem}
.footer-links a{color:#9ca3af}
.footer-links a:hover{color:#ffffff;text-decoration:none}
.footer-contact a{color:#9ca3af}
.footer-contact a:hover{color:#93c5fd}
.footer-bottom{
  margin-top:24px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  gap:12px;
  font-size:.85rem;
  color:#9ca3af;
}
.footer-credit-line{font-size:.85rem}

@media (max-width:880px){
  .footer-grid{grid-template-columns:1fr 1fr;gap:32px}
  .footer-brand{grid-column:1 / -1}
}
@media (max-width:520px){
  .footer-inner{padding:36px 16px 20px}
  .footer-grid{grid-template-columns:1fr;gap:28px;text-align:center}
  .footer-h{text-align:center}
  .footer-bottom{flex-direction:column;text-align:center;gap:8px}
}

/* ============================================================
   MOBILE POLISH (no .nav rules — drawer is handled above!)
   ============================================================ */

@media (max-width:760px){
  .site-main{padding:18px 14px}
  .card{padding:16px}
  h1{font-size:1.5rem}
  h2{font-size:1.2rem}
  .ufile-head{gap:14px}
  .ufile-avatar{width:80px;height:80px}
  .scroll-table th,.scroll-table td{padding:8px 6px;font-size:.92rem}
  .scroll-table th.num,.scroll-table td.num{width:50px}
  .hap-grid{grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px}
  .hap-stat{padding:14px}
  .hap-stat .num{font-size:1.4rem}
  table.hap-table{font-size:.9rem}
  table.hap-table th,table.hap-table td{padding:8px 6px}
}

@media (max-width:640px){
  .vora{flex-direction:column}
  .vora-side{flex-direction:row;width:100%;border-right:0;border-bottom:1px solid var(--border);padding-right:0;padding-bottom:10px;justify-content:flex-start;gap:10px;text-align:left}
  .vora-avatar{width:48px;height:48px}
}

/* ============================================================
   RANK & STAFF BADGES
   ============================================================ */

.rank-badge{
  display:inline-block;
  vertical-align:middle;
  border-radius:8px;
  flex-shrink:0;
}

/* Tiny badges in compact spaces (recent activity, search results) */
.rank-badge[width="20"]{border-radius:4px}

/* ============================================================
   WHISPERS — 3-column messenger layout
   ============================================================ */

.whisper-shell{
  display:grid;
  grid-template-columns:240px 1fr;
  gap:14px;
  min-height:600px;
}
.whisper-sidebar{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow-sm);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  height:fit-content;
}
.whisper-main{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  box-shadow:var(--shadow-sm);
  overflow:hidden;
  display:flex;
  flex-direction:column;
  min-width:0;
}
.whisper-sidebar-head{
  padding:18px 18px 12px;
  border-bottom:1px solid var(--border);
}
.whisper-sidebar-head h2{
  margin:0;
  font-size:1.05rem;
  font-weight:700;
}
.whisper-tabs{
  display:flex;
  flex-direction:column;
  padding:8px;
  gap:2px;
}
.whisper-tab{
  display:flex;
  align-items:center;
  gap:10px;
  padding:9px 12px;
  border-radius:9px;
  color:var(--text);
  font-size:.93rem;
  font-weight:500;
  transition:background .15s;
}
.whisper-tab:hover{background:#f3f1ec;text-decoration:none}
.whisper-tab.active{background:var(--accent-soft);color:var(--accent)}
.whisper-tab.active .icon{color:var(--accent)}
.whisper-tab .icon{width:16px;height:16px;color:var(--muted)}

.whisper-safesafe{
  margin:auto 14px 14px;
  padding:12px;
  background:#fef3c7;
  border:1px solid #fcd34d;
  border-radius:10px;
  display:flex;
  gap:10px;
  font-size:.78rem;
  line-height:1.5;
  color:#78350f;
}
.whisper-safesafe .icon{width:18px;height:18px;color:#d97706;flex-shrink:0;margin-top:1px}
.whisper-safesafe strong{display:block;margin-bottom:2px}

/* --- Main area --- */
.whisper-main{
  display:flex;
  flex-direction:column;
  background:var(--panel);
  min-width:0;
}
.whisper-list-head{
  padding:14px 18px;
  border-bottom:1px solid var(--border);
  font-weight:600;
}

/* Inbox list */
.whisper-thread-list{list-style:none;margin:0;padding:0}
.whisper-thread-item{
  display:flex;
  align-items:center;
  border-bottom:1px solid var(--border);
}
.whisper-thread-item:last-child{border-bottom:0}
.whisper-thread-item:hover{background:var(--panel-soft)}
.whisper-thread-item.unread{background:#fef9c3}
.whisper-thread-item.unread:hover{background:#fef08a}

.thread-link{
  display:flex;
  gap:12px;
  padding:14px 18px;
  align-items:flex-start;
  color:var(--text);
  flex:1;
  min-width:0;
}
.thread-link:hover{text-decoration:none}
.thread-avatar{
  width:44px;height:44px;
  border-radius:50%;
  border:2px solid var(--border);
  object-fit:cover;
  background:var(--panel-soft);
  flex-shrink:0;
}
.thread-body{flex:1;min-width:0}
.thread-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.thread-name{font-weight:600;font-size:.98rem}
.unread-dot{
  display:inline-block;width:8px;height:8px;
  background:#dc2626;border-radius:50%;
}
.thread-time{margin-left:auto;color:var(--muted);font-size:.82rem}
.thread-preview{
  color:var(--muted);font-size:.88rem;margin-top:4px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.thread-you{color:var(--text);font-weight:600}

.thread-delete-form{padding:0 14px}
.thread-delete-btn{
  background:transparent;border:0;color:var(--muted);
  padding:8px;border-radius:8px;cursor:pointer;
  transition:background .15s, color .15s;
}
.thread-delete-btn:hover{background:#fee2e2;color:#dc2626}
.thread-delete-btn .icon{width:16px;height:16px}

/* Empty states */
.whisper-empty, .convo-empty{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:60px 24px;text-align:center;color:var(--muted);
}
.empty-icon{width:64px;height:64px;color:var(--border);margin-bottom:14px}
.whisper-empty h3{margin:0 0 6px;color:var(--text)}
.whisper-empty p{max-width:380px;margin:0 0 16px}

/* --- Conversation view --- */
.whisper-convo{height:calc(100vh - 240px);min-height:520px}

.convo-header{
  display:flex;align-items:center;gap:12px;
  padding:12px 18px;
  border-bottom:1px solid var(--border);
  background:var(--panel);
}
.convo-back{
  display:none;
  width:36px;height:36px;
  align-items:center;justify-content:center;
  border-radius:8px;color:var(--text);
}
.convo-back:hover{background:var(--panel-soft);text-decoration:none}
.convo-avatar{
  width:40px;height:40px;border-radius:50%;
  border:2px solid var(--border);object-fit:cover;
}
.convo-name{flex:1;min-width:0}
.convo-name-main{font-weight:700;font-size:1rem;line-height:1.2}
.convo-name-handle{color:var(--muted);font-size:.82rem;margin-top:2px}
.convo-actions{display:flex;gap:6px}
.convo-action-btn{
  width:36px;height:36px;
  display:flex;align-items:center;justify-content:center;
  background:transparent;border:1px solid var(--border);
  border-radius:8px;color:var(--text);
  cursor:pointer;transition:background .15s, color .15s;
}
.convo-action-btn:hover{background:var(--panel-soft);text-decoration:none}
.convo-action-btn.danger:hover{background:#fee2e2;color:#dc2626;border-color:#fca5a5}
.convo-action-btn .icon{width:18px;height:18px}

.convo-body{
  flex:1;overflow-y:auto;padding:16px 18px;
  background:#ffffff;
  display:flex;flex-direction:column;gap:4px;
}

.convo-divider{text-align:center;margin:14px 0 8px;position:relative}
.convo-divider::before{
  content:"";position:absolute;top:50%;left:0;right:0;height:1px;background:var(--border);
}
.convo-divider span{
  position:relative;background:var(--panel-soft);
  padding:0 12px;font-size:.78rem;color:var(--muted);
}

.convo-msg{display:flex;margin:2px 0}
.convo-msg.mine{justify-content:flex-end}
.convo-msg.theirs{justify-content:flex-start}
.convo-bubble{
  max-width:72%;
  padding:9px 13px;
  border-radius:16px;
  background:var(--panel);
  border:1px solid var(--border);
  box-shadow:var(--shadow-sm);
}
.convo-msg.mine .convo-bubble{
  background:var(--accent);
  border-color:var(--accent);
  color:#fff;
  border-bottom-right-radius:6px;
}
.convo-msg.theirs .convo-bubble{
  border-bottom-left-radius:6px;
}
.convo-msg-body{line-height:1.5;font-size:.95rem}
.convo-msg-body p{margin:0 0 .4em}
.convo-msg-body p:last-child{margin-bottom:0}
.convo-msg-body a{color:inherit;text-decoration:underline}
.convo-msg-meta{
  font-size:.7rem;
  margin-top:4px;
  display:flex;align-items:center;gap:8px;
  color:var(--muted);
}
.convo-msg.mine .convo-msg-meta{color:rgba(255,255,255,.8);justify-content:flex-end}
.msg-read{font-weight:600}
.msg-report{color:var(--muted);display:flex;align-items:center}
.msg-report:hover{color:#dc2626}
.msg-report .icon{width:14px;height:14px}

/* Composer */
.convo-composer{
  display:flex;
  align-items:flex-end;
  gap:8px;
  padding:12px 14px;
  border-top:1px solid var(--border);
  background:var(--panel);
}
.convo-composer.disabled{justify-content:center;padding:18px}
.convo-composer textarea{
  flex:1;
  resize:none;
  overflow-y:hidden;
  scrollbar-width:thin;
  padding:10px 14px;
  border:1px solid var(--border);
  border-radius:15px;
  font-family:inherit;
  font-size:.95rem;
  background:#ffffff;
  color:var(--text);
  min-height:40px;
  max-height:180px;
  outline:none;
  transition:border-color .15s;
}
/* Hide WebKit scrollbar arrows (Chrome, Safari, Edge) until needed */
.convo-composer textarea::-webkit-scrollbar{
  width:6px;
}
.convo-composer textarea::-webkit-scrollbar-thumb{
  background:var(--border);
  border-radius:3px;
}
.convo-composer textarea::-webkit-scrollbar-track{
  background:transparent;
}

.convo-composer textarea:focus{border-color:var(--accent)}
.composer-send{
  width:40px;height:40px;
  background:var(--accent);color:#fff;border:0;
  border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;transition:background .15s;
  flex-shrink:0;
}
.composer-send:hover{background:var(--accent-hover)}
.composer-send .icon{width:18px;height:18px}

/* Info panel */
.whisper-info-panel{padding:24px}
.whisper-info-panel h2{margin:0 0 10px}

/* --- Mobile FAB --- */
.whisper-fab{
  display:none;
  position:fixed;
  bottom:20px;
  right:20px;
  z-index:50;
}
.fab-button{
  width:56px;height:56px;
  background:var(--accent);color:#fff;border:0;
  border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  cursor:pointer;
  box-shadow:0 4px 14px rgba(37,99,235,.4);
  transition:transform .2s, background .15s;
}
.fab-button:hover{background:var(--accent-hover)}
.fab-button.open{transform:rotate(45deg)}
.fab-button .icon{width:24px;height:24px}
.fab-menu[hidden]{display:none !important}
.fab-menu{
  position:absolute;
  bottom:68px;right:0;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  padding:6px;
  min-width:180px;
  box-shadow:var(--shadow-md);
  display:flex;
  flex-direction:column;
  gap:2px;
}
.fab-item{
  display:flex;align-items:center;gap:10px;
  padding:10px 14px;
  border-radius:8px;
  color:var(--text);
  font-size:.93rem;
}
.fab-item:hover{background:var(--panel-soft);text-decoration:none}
.fab-item .icon{width:16px;height:16px;color:var(--muted)}

/* --- Responsive --- */
@media (max-width:880px){
  .whisper-shell{
    grid-template-columns:1fr;
    gap:0;
  }
  .whisper-sidebar{display:none}
  .whisper-fab{display:block}
  .convo-back{display:flex}
  .convo-body{padding:12px}
  .convo-bubble{max-width:85%}
}

/* Unread badge in main sidebar nav (carried over) */
.sidebar-badge{
  margin-left:auto;
  background:var(--bad);
  color:#fff;
  font-size:.7rem;
  font-weight:700;
  padding:1px 8px;
  border-radius:999px;
  min-width:20px;
  text-align:center;
}

/* ============================================================
   LAYOUT — main + right sidebar
   ============================================================ */

.layout-wrap{
  max-width:1280px;
  margin:0 auto;
  padding:28px 20px;
  display:grid;
  grid-template-columns:1fr 280px;
  gap:28px;
  align-items:start;
}

/* Override the old .site-main rule */
.layout-wrap .site-main{
  max-width:none;
  margin:0;
  padding:0;
  min-width:0;
}

/* Sidebar — sticky/fixed on scroll */
.site-sidebar{
  position:sticky;
  top:90px; /* below the sticky header */
  display:flex;
  flex-direction:column;
  gap:14px;
}

/* ============================================================
   USER CARD
   ============================================================ */

.user-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  box-shadow:var(--shadow-md);
}

.user-card-top{
  background:linear-gradient(165deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
  padding:22px 18px 18px;
  text-align:center;
  position:relative;
  color:#fff;
}
.user-card-top::before{
  /* subtle radial glow */
  content:"";
  position:absolute;
  inset:0;
  background:radial-gradient(circle at 50% 100%, rgba(147,197,253,.35), transparent 60%);
  pointer-events:none;
}
.user-card-avatar-wrap{
  display:inline-block;
  position:relative;
  margin-bottom:10px;
}
.user-card-avatar{
  width:80px;
  height:80px;
  border-radius:18px;
  border:2px solid rgba(255,255,255,.2);
  object-fit:cover;
  background:#1e3a8a;
  box-shadow:0 8px 22px rgba(0,0,0,.3);
}
.user-card-name{
  font-size:1.05rem;
  font-weight:700;
  color:#fff;
  margin-bottom:2px;
  position:relative;
}
.user-card-handle{
  font-size:.82rem;
  color:rgba(255,255,255,.7);
  margin-bottom:10px;
  position:relative;
}
.user-card-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  background:rgba(255,255,255,.15);
  backdrop-filter:blur(6px);
  padding:5px 12px 5px 8px;
  border-radius:999px;
  font-size:.78rem;
  font-weight:600;
  color:#fff;
  position:relative;
  border:1px solid rgba(255,255,255,.18);
}
.user-card-badge img{border-radius:5px}

.user-card-bottom{
  padding:14px 16px;
  background:var(--panel);
}
.user-card-row{
  display:flex;
  align-items:center;
  gap:12px;
  padding:8px 0;
  color:var(--text);
}
.user-card-row + .user-card-row{
  border-top:1px solid var(--border);
}
.user-card-link{cursor:pointer}
.user-card-link:hover{text-decoration:none}
.user-card-link:hover .user-card-row-value{color:var(--accent)}

.user-card-icon-pill{
  width:32px;
  height:32px;
  background:var(--panel-soft);
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  color:var(--muted);
}
.user-card-icon-pill .icon{width:16px;height:16px}

.user-card-row-label{
  font-size:.7rem;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.5px;
  font-weight:600;
}
.user-card-row-value{
  font-size:.95rem;
  font-weight:600;
  color:var(--text);
  transition:color .15s;
}

/* Guest card (logged out) */
.guest-top{
  padding:22px 18px;
  text-align:center;
}

/* ============================================================
   SIDEBAR NAV
   ============================================================ */

.sidebar-nav{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:8px;
  display:flex;
  flex-direction:column;
  gap:2px;
  box-shadow:var(--shadow-sm);
}
.sidebar-link{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 12px;
  border-radius:9px;
  color:var(--text);
  font-size:.95rem;
  font-weight:500;
  position:relative;
  transition:background .15s, color .15s;
}
.sidebar-link:hover{
  background:var(--panel-soft);
  text-decoration:none;
}
.sidebar-link .icon{
  width:18px;
  height:18px;
  color:var(--muted);
  transition:color .15s;
}
.sidebar-link:hover .icon{color:var(--accent)}
.sidebar-link-staff{
  color:#92400e;
}
.sidebar-link-staff .icon{color:#d97706}
.sidebar-link-staff:hover{background:#fef3c7}

.sidebar-badge{
  margin-left:auto;
  background:var(--bad);
  color:#fff;
  font-size:.7rem;
  font-weight:700;
  padding:1px 8px;
  border-radius:999px;
  min-width:20px;
  text-align:center;
}

/* ============================================================
   ICONS
   ============================================================ */

.icon{
  width:20px;
  height:20px;
  display:inline-block;
  vertical-align:middle;
  flex-shrink:0;
}

/* Header search (replaces old nav search) */
.header-search-form{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:8px;
  padding:7px 14px;
  border-radius:10px;
  background:var(--panel-soft);
  border:1px solid var(--border);
  transition:border-color .15s, box-shadow .15s, background .15s;
  width:280px;
  max-width:100%;
}
.header-search-form:focus-within{
  background:#ffffff;
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(37,99,235,.12);
}
.header-search-form .icon{
  width:16px;
  height:16px;
  color:var(--muted);
  flex-shrink:0;
}
.header-search-form input{
  flex:1;
  border:0;
  background:transparent;
  outline:none;
  font:inherit;
  font-size:.92rem;
  color:var(--text);
  min-width:0;
}
.header-search-form input::placeholder{color:var(--muted)}

@media (max-width:760px){
  .header-search-form{display:none}
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width:980px){
  .layout-wrap{
    grid-template-columns:1fr;
    gap:0;
    padding:18px 14px;
  }
  .site-sidebar{display:none} /* mobile uses the drawer instead */
}

@media (min-width:761px){
  .hamburger{display:none}
}

/* ============================================================
   NOTIFICATIONS (Information tab)
   ============================================================ */

.notification-list{
  list-style:none;
  margin:0;
  padding:0;
}

.notification-item{
  border-bottom:1px solid var(--border);
  transition:background .15s;
}
.notification-item:last-child{border-bottom:0}
.notification-item:hover{background:var(--panel-soft)}
.notification-item.unread{background:#fef9c3}
.notification-item.unread:hover{background:#fef08a}

.notification-link{
  display:flex;
  gap:14px;
  padding:16px 18px;
  color:var(--text);
  align-items:flex-start;
}
.notification-link:hover{text-decoration:none}

.notification-icon{
  width:40px;
  height:40px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  background:var(--panel-soft);
  flex-shrink:0;
}
.notification-icon .icon{
  width:20px;
  height:20px;
  color:var(--muted);
}

.notification-item.color-warn .notification-icon{background:#fef3c7}
.notification-item.color-warn .notification-icon .icon{color:#d97706}
.notification-item.color-info .notification-icon{background:var(--accent-soft)}
.notification-item.color-info .notification-icon .icon{color:var(--accent)}
.notification-item.color-ok   .notification-icon{background:#dcfce7}
.notification-item.color-ok   .notification-icon .icon{color:#16a34a}

.notification-body{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:4px;
}

.notification-head{
  display:flex;
  align-items:baseline;
  gap:10px;
}

.notification-title{
  font-size:.98rem;
  font-weight:600;
  line-height:1.3;
  flex:1;
  min-width:0;
}

.notification-time{
  color:var(--muted);
  font-size:.78rem;
  flex-shrink:0;
  white-space:nowrap;
}

.notification-text{
  color:var(--muted);
  font-size:.9rem;
  line-height:1.5;
}

.notification-actor{
  font-size:.8rem;
  color:var(--muted);
  margin-top:2px;
}
.notification-actor a{
  color:var(--accent);
  font-weight:600;
}
.notification-actor a:hover{
  text-decoration:underline;
}

.info-count{
  margin-left:auto;
  color:var(--muted);
  font-size:.82rem;
  font-weight:500;
}

.tab-badge{
  margin-left:auto;
  background:#dc2626;
  color:#fff;
  font-size:.7rem;
  font-weight:700;
  padding:1px 7px;
  border-radius:999px;
  min-width:18px;
  text-align:center;
}

/* ============================================================
   GO (LINK INTERSTITIAL)
   ============================================================ */

.go-shell{
  max-width:600px;
  margin:20px auto;
}

.go-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:28px;
  box-shadow:var(--shadow-md);
  text-align:center;
}

.go-icon{
  width:64px;
  height:64px;
  margin:0 auto 14px;
  background:#fef3c7;
  color:#d97706;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
}
.go-icon .icon{width:32px;height:32px}

.go-shell h1{
  margin:0 0 8px;
  font-size:1.4rem;
}
.go-lead{
  color:var(--muted);
  margin:0 0 22px;
}

.go-url-box{
  background:var(--panel-soft);
  border:1px solid var(--border);
  border-radius:10px;
  padding:14px 16px;
  margin:0 0 20px;
  text-align:left;
}
.go-url-label{
  font-size:.72rem;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.5px;
  font-weight:600;
  margin-bottom:6px;
}
.go-url-value{
  font-family:Menlo, Monaco, "Courier New", monospace;
  font-size:.88rem;
  word-break:break-all;
  color:var(--text);
  line-height:1.5;
}
.go-host{
  font-size:.82rem;
  color:var(--muted);
  margin-top:8px;
  padding-top:8px;
  border-top:1px dashed var(--border);
}
.go-host strong{color:var(--text)}

.go-safety{
  background:#fffbeb;
  border:1px solid #fcd34d;
  border-radius:10px;
  padding:14px 18px;
  text-align:left;
  color:#78350f;
  font-size:.92rem;
  line-height:1.55;
  margin:0 0 22px;
}
.go-safety ul{
  margin:8px 0;
  padding-left:22px;
}
.go-safety li{margin-bottom:4px}
.go-note{margin:8px 0 0;font-style:italic;font-size:.88rem}

.go-actions{
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
}
.go-actions .btn{min-width:140px}

@media (max-width:600px){
  .go-card{padding:22px 18px}
  .go-actions{flex-direction:column-reverse}
  .go-actions .btn{width:100%}
}

/* ============================================================
   BUTTON MINI (used everywhere — HAP actions, profile, inline)
   ============================================================ */

.btn-mini{
  display:inline-block;
  background:var(--panel);
  color:var(--text);
  border:1px solid var(--border);
  padding:5px 11px;
  border-radius:7px;
  font-size:.82rem;
  font-weight:500;
  font-family:inherit;
  cursor:pointer;
  text-decoration:none;
  transition:background .15s, border-color .15s, color .15s;
  margin-right:3px;
  margin-bottom:3px;
  vertical-align:middle;
}
.btn-mini:hover{
  background:var(--panel-soft);
  border-color:var(--accent);
  color:var(--accent);
  text-decoration:none;
}

.btn-mini.danger{
  background:#fee2e2;
  color:#991b1b;
  border-color:#fca5a5;
}
.btn-mini.danger:hover{
  background:#fecaca;
  color:#7f1d1d;
  border-color:#f87171;
}

.btn-mini.ok{
  background:#dcfce7;
  color:#166534;
  border-color:#86efac;
}
.btn-mini.ok:hover{
  background:#bbf7d0;
  color:#14532d;
  border-color:#4ade80;
}

/* ============================================================
   HAP NAVIGATION + TABLE
   ============================================================ */

.hap-nav{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  padding:10px 0 14px;
  border-bottom:1px solid var(--border);
  margin-bottom:18px;
}
.hap-nav a{
  padding:7px 14px;
  border-radius:7px;
  color:var(--text);
  font-size:.92rem;
  background:transparent;
  transition:background .15s, color .15s;
}
.hap-nav a:hover{background:var(--panel-soft);text-decoration:none}
.hap-nav a.active{
  background:var(--accent-soft);
  color:var(--accent);
  font-weight:600;
}

.hap-table{
  width:100%;
  border-collapse:collapse;
  margin-top:14px;
}
.hap-table th,
.hap-table td{
  padding:10px 8px;
  border-bottom:1px solid var(--border);
  text-align:left;
  vertical-align:top;
  font-size:.92rem;
}
.hap-table th{
  color:var(--muted);
  font-weight:600;
  font-size:.78rem;
  text-transform:uppercase;
  letter-spacing:.5px;
  background:var(--panel-soft);
}
.hap-table tr:hover{background:var(--panel-soft)}
.hap-table a{color:var(--accent)}

/* HAP-specific page title + tab styling */
.hap-tabs .hap-tab.active{
  background:var(--panel);
  color:var(--text);  /* override the old yellow #ffd97a */
  border-bottom:2px solid var(--accent);
}

/* Inline forms (action buttons that wrap in their own form) */
.inline-form{
  display:inline-block;
  margin:0;
}

/* HAP stat boxes (if used on dashboard) */
.hap-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(160px,1fr));
  gap:14px;
  margin-top:14px;
}
.hap-stat{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:10px;
  padding:18px;
  box-shadow:var(--shadow-sm);
}
.hap-stat .num{
  font-size:1.6rem;
  font-weight:700;
  color:var(--accent);
  line-height:1;
}
.hap-stat .label{
  color:var(--muted);
  font-size:.85rem;
  margin-top:4px;
}

/* ============================================================
   HAP — SIDEBAR ADMIN LAYOUT (replaces old top-nav HAP)
   ============================================================ */

.hap-body{
  background:var(--bg);
  min-height:100vh;
}

/* TOP BAR */
.hap-topbar{
  background:#ffffff;
  border-bottom:1px solid var(--border);
  box-shadow:var(--shadow-sm);
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:100;
  height:64px;
}
.hap-topbar-inner{
  max-width:none;
  margin:0;
  display:flex;
  align-items:center;
  gap:18px;
  padding:12px 22px;
  height:100%;
}
.hap-topbar-brand{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
}
.hap-topbar-brand:hover{text-decoration:none;opacity:.85}
.hap-topbar-logo{
  height:34px;
  width:auto;
  display:block;
}
.hap-topbar-name{
  font-weight:700;
  color:var(--text);
  font-size:1.05rem;
  letter-spacing:-.01em;
}
.hap-topbar-name-tag{
  display:inline-block;
  margin-left:6px;
  padding:2px 8px;
  background:var(--accent-soft);
  color:var(--accent);
  border-radius:6px;
  font-size:.7rem;
  letter-spacing:.5px;
  vertical-align:middle;
}

.hap-topbar-actions{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:6px;
}

.hap-topbar-icon{
  width:38px;
  height:38px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px solid var(--border);
  background:var(--panel);
  border-radius:9px;
  color:var(--text);
  cursor:pointer;
  text-decoration:none;
  transition:background .15s, color .15s, border-color .15s;
}
.hap-topbar-icon:hover{
  background:var(--panel-soft);
  border-color:var(--accent);
  color:var(--accent);
  text-decoration:none;
}
.hap-topbar-icon:disabled{
  opacity:.4;
  cursor:not-allowed;
}
.hap-topbar-icon:disabled:hover{
  background:var(--panel);
  border-color:var(--border);
  color:var(--text);
}
.hap-topbar-icon .icon{width:18px;height:18px}

.hap-topbar-user{
  display:flex;
  align-items:center;
  gap:8px;
  padding:5px 12px 5px 5px;
  border:1px solid var(--border);
  background:var(--panel);
  border-radius:999px;
  color:var(--text);
  font-weight:600;
  font-size:.92rem;
  text-decoration:none;
  transition:background .15s, border-color .15s;
}
.hap-topbar-user:hover{
  background:var(--panel-soft);
  border-color:var(--accent);
  text-decoration:none;
}
.hap-topbar-avatar{
  width:28px;
  height:28px;
  border-radius:50%;
  object-fit:cover;
  border:1px solid var(--border);
  background:var(--panel-soft);
}
.hap-topbar-username{
  white-space:nowrap;
}

/* Mobile toggle button (hidden on desktop) */
.hap-mobile-toggle{
  display:none;
  width:38px;
  height:38px;
  align-items:center;
  justify-content:center;
  background:transparent;
  border:1px solid var(--border);
  border-radius:9px;
  color:var(--text);
  cursor:pointer;
}
.hap-mobile-toggle .icon{width:20px;height:20px}

/* SHELL — sidebar + main */
.hap-shell{
  display:block;
  padding-top:64px;
  min-height:100vh;
}

/* SIDEBAR */
.hap-sidebar{
  position:fixed;
  top:64px;
  left:0;
  bottom:0;
  width:240px;
  background:var(--panel);
  border-right:1px solid var(--border);
  border-radius:0;
  box-shadow:none;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  z-index:50;
}

/* SIDEBAR NAV — scrollable if too tall */
.hap-side-nav{
  flex:1;
  overflow-y:auto;
  padding:18px 12px;
  display:flex;
  flex-direction:column;
  gap:18px;
}

.hap-side-group{
  display:flex;
  flex-direction:column;
  gap:2px;
}
.hap-side-group-admin{
  border-top:1px solid var(--border);
  padding-top:18px;
  margin-top:6px;
}

.hap-side-label{
  font-size:.7rem;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.6px;
  font-weight:700;
  padding:4px 12px;
  margin-bottom:4px;
}

.hap-side-link{
  display:flex;
  align-items:center;
  gap:10px;
  padding:9px 12px;
  border-radius:9px;
  color:var(--text);
  font-size:.93rem;
  font-weight:500;
  text-decoration:none;
  transition:background .15s, color .15s;
}
.hap-side-link:hover{
  background:var(--panel-soft);
  text-decoration:none;
}
.hap-side-link .icon{
  width:16px;
  height:16px;
  color:var(--muted);
  flex-shrink:0;
}
.hap-side-link.active{
  background:var(--accent-soft);
  color:var(--accent);
  font-weight:600;
}
.hap-side-link.active .icon{color:var(--accent)}
.hap-side-link-external{color:var(--muted)}
.hap-side-link-external .icon{color:var(--muted)}

.hap-side-badge{
  margin-left:auto;
  background:var(--bad);
  color:#fff;
  font-size:.7rem;
  font-weight:700;
  padding:1px 8px;
  border-radius:999px;
  min-width:20px;
  text-align:center;
}

.hap-side-foot{
  padding:14px 16px;
  font-size:.75rem;
  color:var(--muted);
  border-top:1px solid var(--border);
  background:var(--panel-soft);
  line-height:1.5;
  flex-shrink:0;
}
.hap-side-foot-credit{
  font-style:italic;
  color:var(--muted);
}

/* MAIN CONTENT */
.hap-main{
  margin-left:240px;
  padding:24px 28px;
  max-width:none;
  min-width:0;
  min-height:calc(100vh - 64px);
  background:var(--bg);
}
.hap-main .card{
  margin-bottom:14px;
}

/* RESPONSIVE — mobile collapse */
@media (max-width:880px){
  .hap-topbar-inner{padding:10px 16px;gap:10px}
  .hap-topbar-name{font-size:.95rem}
  .hap-mobile-toggle{display:flex}
  .hap-topbar-user .hap-topbar-username{display:none}

  .hap-shell{
    grid-template-columns:1fr;
  }
  .hap-sidebar{
    transform:translateX(-100%);
    transition:transform .25s ease;
    width:280px;
    max-width:85vw;
    box-shadow:8px 0 24px rgba(0,0,0,.15);
  }
  .hap-sidebar.open{
    transform:translateX(0);
  }
  .hap-main{
    margin-left:0;          /* full width on mobile */
    padding:16px;
  }
}

/* Hide old .hap-header / .hap-nav since we replaced them with .hap-topbar / .hap-sidebar */
.hap-header,
.hap-header .hap-nav{display:none}

/* ============================================================
   HAP — DASHBOARD HERO, STATS, CHARTS, VORAS FEED
   ============================================================ */

/* HERO */
.hap-hero{
  background:linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
  color:#fff;
  border-radius:14px;
  padding:24px 28px;
  margin-bottom:18px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:24px;
  box-shadow:var(--shadow-md);
  flex-wrap:wrap;
}
.hap-hero-greet{
  margin:0 0 4px;
  font-size:1.6rem;
  font-weight:700;
  letter-spacing:-.01em;
}
.hap-hero-sub{
  margin:0;
  color:rgba(255,255,255,.75);
  font-size:.95rem;
}

.hap-hero-weather{
  display:flex;
  align-items:center;
  gap:14px;
  background:rgba(255,255,255,.12);
  backdrop-filter:blur(6px);
  border:1px solid rgba(255,255,255,.18);
  border-radius:14px;
  padding:14px 20px;
  min-width:240px;
}
.hap-weather-icon{font-size:2.4rem;line-height:1}
.hap-weather-temp{font-size:1.6rem;font-weight:700;line-height:1}
.hap-weather-desc{font-size:.85rem;color:rgba(255,255,255,.92);line-height:1.4}
.hap-weather-place{color:rgba(255,255,255,.7);font-size:.78rem}

/* STAT CARDS */
.hap-stats-grid{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:14px;
  margin-bottom:18px;
}
.hap-stat-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-left:4px solid;
  border-radius:12px;
  padding:18px 20px;
  box-shadow:var(--shadow-sm);
  position:relative;
  overflow:hidden;
}
.hap-stat-card .stat-icon{
  position:absolute;
  top:14px;
  right:14px;
  width:36px;
  height:36px;
  border-radius:10px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.hap-stat-card .stat-icon .icon{width:20px;height:20px}
.hap-stat-card .stat-label{
  color:var(--muted);
  font-size:.82rem;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.5px;
  margin-bottom:6px;
}
.hap-stat-card .stat-number{
  font-size:2rem;
  font-weight:700;
  color:var(--text);
  line-height:1;
  margin-bottom:6px;
}
.hap-stat-card .stat-delta{
  font-size:.82rem;
  color:var(--muted);
}

.stat-blue       { border-left-color:#2563eb }
.stat-blue       .stat-icon{ background:#dbeafe; color:#1e40af }
.stat-orange     { border-left-color:#f97316 }
.stat-orange     .stat-icon{ background:#ffedd5; color:#c2410c }
.stat-green      { border-left-color:#16a34a }
.stat-green      .stat-icon{ background:#dcfce7; color:#15803d }
.stat-turquoise  { border-left-color:#87CEEB }
.stat-turquoise  .stat-icon{ background:#ccfbf1; color:#87CEEB }

/* CHART HEADER */
.hap-chart-head{
  height:48px;
  min-height:48px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:14px;
}

/* Chart wrappers */
.hap-chart-wrap{
  position:relative;
  height:290px;
  flex:0 0 290px;
  width:100%;
}

.hap-chart-wrap canvas{
  width:100% !important;
  height:100% !important;
}

/* Charts row */
.hap-charts-row{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
  margin-bottom:14px;
  align-items:stretch;
}

.hap-charts-row .card{
  height:390px;
  min-height:390px;
  overflow:hidden;
}
.visitor-chart-card .hap-chart-wrap{
  padding-top:18px;
}
.hap-charts-row .card + .card{
  margin-top:0;
}

@media (max-width:1100px){
  .hap-charts-row{
    grid-template-columns:1fr;
  }
}

/* Range toggle buttons (1D / 1W / 1M / 6M) */
.hap-range-toggle{
  display:flex;
  gap:4px;
  background:var(--panel-soft);
  padding:3px;
  border-radius:8px;
  border:1px solid var(--border);
}
.range-btn{
  background:transparent;
  border:0;
  padding:5px 11px;
  border-radius:6px;
  font-size:.78rem;
  font-weight:600;
  color:var(--muted);
  cursor:pointer;
  font-family:inherit;
  transition:background .15s, color .15s;
}
.range-btn:hover{color:var(--text)}
.range-btn.active{
  background:var(--panel);
  color:var(--accent);
  box-shadow:var(--shadow-sm);
}

/* LATEST VORAS FEED */
.hap-voras-feed{
  display:flex;
  flex-direction:column;
  gap:1px;
  background:var(--border);
  border:1px solid var(--border);
  border-radius:10px;
  overflow:hidden;
}
.hap-vora-row{
  display:flex;
  align-items:flex-start;
  gap:14px;
  padding:14px 18px;
  background:var(--panel);
  transition:background .15s;
}
.hap-vora-row:hover{background:var(--panel-soft)}
.hap-vora-avatar{
  width:44px;
  height:44px;
  border-radius:50%;
  border:2px solid var(--border);
  object-fit:cover;
  flex-shrink:0;
  background:var(--panel-soft);
}
.hap-vora-body{flex:1;min-width:0}
.hap-vora-head{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:4px;
}
.hap-vora-name{
  font-weight:600;
  color:var(--text);
  font-size:.95rem;
}
.hap-vora-type{
  display:inline-block;
  font-size:.65rem;
  padding:1px 6px;
  background:var(--panel-soft);
  color:var(--muted);
  border-radius:999px;
  text-transform:uppercase;
  letter-spacing:.5px;
  font-weight:600;
}
.hap-vora-time{color:var(--muted);font-size:.82rem}
.hap-vora-snippet{
  color:var(--muted);
  font-size:.9rem;
  line-height:1.5;
  overflow:hidden;
  text-overflow:ellipsis;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
}

/* Stacked identity: name bold + rank below in small text */
.hap-vora-identity{
  display:flex;
  flex-direction:column;
  gap:1px;
  min-width:0;
}
.hap-vora-rank{
  font-size:.74rem;
  color:var(--muted);
  font-weight:500;
  line-height:1.2;
  letter-spacing:.2px;
}

/* RESPONSIVE */
@media (max-width:1100px){
  .hap-stats-grid{grid-template-columns:repeat(2, 1fr)}
}
@media (max-width:600px){
  .hap-hero{flex-direction:column;align-items:stretch;text-align:center}
  .hap-hero-weather{justify-content:center}
  .hap-stats-grid{grid-template-columns:1fr}
}

/* ============================================================
   HAP — MY PROFILE PAGE
   ============================================================ */

.hap-profile-shell{
  display:grid;
  grid-template-columns:280px 1fr;
  gap:18px;
  align-items:start;
}

/* LEFT — identity card */
.hap-profile-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  box-shadow:var(--shadow-sm);
}
.hap-profile-card-top{
  background:linear-gradient(165deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
  padding:26px 18px 22px;
  text-align:center;
  color:#fff;
  position:relative;
}
.hap-profile-card-top::before{
  content:"";
  position:absolute;
  inset:0;
  background:radial-gradient(circle at 50% 100%, rgba(147,197,253,.35), transparent 60%);
  pointer-events:none;
}
.hap-profile-avatar{
  width:96px;
  height:96px;
  border-radius:18px;
  border:2px solid rgba(255,255,255,.25);
  object-fit:cover;
  background:#1e3a8a;
  box-shadow:0 8px 22px rgba(0,0,0,.3);
  margin-bottom:12px;
  position:relative;
}
.hap-profile-name{
  font-size:1.1rem;
  font-weight:700;
  color:#fff;
  position:relative;
}
.hap-profile-rank{
  font-size:.82rem;
  color:rgba(255,255,255,.78);
  margin-top:2px;
  position:relative;
}
.hap-profile-card-bottom{
  padding:16px;
}
.hap-profile-row{
  display:flex;
  align-items:center;
  gap:12px;
}
.hap-profile-icon-pill{
  width:36px;
  height:36px;
  background:var(--panel-soft);
  border-radius:9px;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
  color:var(--muted);
}
.hap-profile-icon-pill .icon{width:18px;height:18px}
.hap-profile-label{
  font-size:.7rem;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.5px;
  font-weight:600;
  margin-bottom:2px;
}
.hap-profile-value{
  font-size:.92rem;
  color:var(--text);
  font-weight:600;
}

/* RIGHT — details + form */
.hap-profile-main{
  display:flex;
  flex-direction:column;
  gap:14px;
  min-width:0;
}

.hap-profile-section-head{
  display:flex;
  align-items:flex-start;
  gap:12px;
  margin-bottom:18px;
  padding-bottom:14px;
  border-bottom:1px solid var(--border);
}
.hap-profile-section-head .icon{
  width:22px;
  height:22px;
  color:var(--accent);
  margin-top:2px;
  flex-shrink:0;
}
.hap-profile-section-head h2{
  font-size:1.1rem;
}

.hap-profile-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:14px;
}
@media (max-width:760px){
  .hap-profile-grid{grid-template-columns:1fr}
}

/* Read-only fields */
.hap-readonly-field label{
  display:block;
  color:var(--muted);
  font-size:.85rem;
  margin-bottom:5px;
  font-weight:500;
}
.hap-readonly-value{
  padding:11px 13px;
  background:var(--panel-soft);
  border:1px solid var(--border);
  border-radius:9px;
  color:var(--text);
  font-size:.95rem;
  word-break:break-word;
}
.hap-locked{
  font-size:.75rem;
  margin-left:4px;
  cursor:help;
}

/* Form sections */
.hap-form-section{
  padding:18px 0;
  border-bottom:1px solid var(--border);
}
.hap-form-section:last-of-type{border-bottom:0}
.hap-form-section-label{
  font-weight:600;
  color:var(--text);
  font-size:.95rem;
  margin-bottom:12px;
}

/* Password input with toggle */
.hap-pw-wrap{
  position:relative;
}
.hap-pw-wrap input{
  padding-right:42px !important;
}
.hap-pw-toggle{
  position:absolute;
  right:6px;
  top:50%;
  transform:translateY(-50%);
  width:32px;
  height:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:transparent;
  border:0;
  color:var(--muted);
  border-radius:6px;
  cursor:pointer;
  transition:background .15s, color .15s;
}
.hap-pw-toggle:hover{
  background:var(--panel-soft);
  color:var(--accent);
}
.hap-pw-toggle .icon{width:16px;height:16px}

.hap-form-confirm{
  background:#fffbeb;
  border:1px solid #fcd34d;
  border-radius:10px;
  padding:14px 16px;
  margin-top:10px;
}
.hap-form-confirm label span{color:#78350f;font-weight:600}

.hap-profile-actions{
  margin-top:18px;
  display:flex;
  justify-content:flex-end;
}

/* Responsive */
@media (max-width:880px){
  .hap-profile-shell{
    grid-template-columns:1fr;
  }
}

/* ============================================================
   HAP — MEMBERS LIST (Sketch 1)
   ============================================================ */

.hap-page-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:18px;
  gap:14px;
  flex-wrap:wrap;
}

.hap-search{
  display:flex;
  align-items:center;
  gap:8px;
  padding:7px 14px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--panel-soft);
  width:340px;
  max-width:100%;
  transition:border-color .15s, background .15s;
}
.hap-search:focus-within{
  background:var(--panel);
  border-color:var(--accent);
}
.hap-search .icon{width:16px;height:16px;color:var(--muted);flex-shrink:0}
.hap-search input{
  flex:1;
  border:0;
  background:transparent;
  outline:none;
  font:inherit;
  font-size:.93rem;
  color:var(--text);
  min-width:0;
}
.hap-search-clear{
  color:var(--muted);
  font-size:.85rem;
  padding:2px 6px;
  border-radius:6px;
}
.hap-search-clear:hover{
  background:var(--border);
  color:var(--text);
  text-decoration:none;
}

/* PAGINATION */
.hap-pager{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  margin:14px 0;
}
.hap-pg-btn{
  display:flex;
  align-items:center;
  justify-content:center;
  min-width:34px;
  height:34px;
  padding:0 10px;
  border:1px solid var(--border);
  background:var(--panel);
  color:var(--text);
  border-radius:8px;
  font-weight:600;
  font-size:.92rem;
  text-decoration:none;
  transition:background .15s, border-color .15s, color .15s;
}
.hap-pg-btn:hover{
  background:var(--panel-soft);
  border-color:var(--accent);
  color:var(--accent);
  text-decoration:none;
}
.hap-pg-btn.disabled{
  opacity:.35;
  pointer-events:none;
}
.hap-pg-current{
  padding:0 10px;
  color:var(--muted);
  font-size:.92rem;
  font-weight:600;
}

/* MEMBERS LIST */
.hap-members-list{
  display:flex;
  flex-direction:column;
}
.hap-member-row{
  display:grid;
  grid-template-columns:56px 1fr 180px 90px 40px 80px;
  align-items:center;
  gap:14px;
  padding:14px 12px;
  border-bottom:1px solid var(--border);
  transition:background .15s;
}
.hap-member-row:hover{background:var(--panel-soft)}
.hap-member-row:last-child{border-bottom:0}

.hap-member-avatar-link{
  display:block;
  width:48px;
  height:48px;
}
.hap-member-avatar{
  width:48px;
  height:48px;
  border-radius:20%;
  border:2px solid var(--border);
  object-fit:cover;
  background:var(--panel-soft);
}

.hap-member-identity{min-width:0}
.hap-member-name-line{
  display:flex;
  align-items:center;
  gap:8px;
  margin-bottom:2px;
  flex-wrap:wrap;
}
.hap-member-name{
  font-weight:700;
  color:var(--text);
  font-size:1rem;
}
.hap-member-name:hover{text-decoration:none;color:var(--accent)}
.hap-member-rank-text{
  font-size:.78rem;
  color:var(--muted);
  font-weight:500;
}
.hap-member-slug{
  font-size:.85rem;
  color:var(--muted);
}

/* Status */
.hap-member-status{
  display:flex;
  align-items:center;
  gap:8px;
}
.status-dot{
  width:9px;
  height:9px;
  border-radius:50%;
  flex-shrink:0;
}
.status-active  { background:#16a34a; box-shadow:0 0 0 3px rgba(22,163,74,.15) }
.status-pending { background:#eab308; box-shadow:0 0 0 3px rgba(234,179,8,.15) }
.status-banned  { background:#dc2626; box-shadow:0 0 0 3px rgba(220,38,38,.15) }

.hap-member-status-text{
  display:flex;
  flex-direction:column;
  gap:1px;
  line-height:1.25;
}
.hap-status-label{
  font-size:.83rem;
  font-weight:600;
  color:var(--text);
}
.hap-status-date{
  font-size:.75rem;
  color:var(--muted);
}

/* Stats */
.hap-member-stats{
  font-size:.95rem;
  color:var(--muted);
  font-weight:600;
  white-space:nowrap;
}
.hap-stat-sep{
  margin:0 6px;
  color:var(--border);
  font-weight:400;
}

/* Warning icon */
.hap-member-warn{
  display:flex;
  justify-content:center;
}
.warn-icon{
  display:flex;
  align-items:center;
  justify-content:center;
  width:32px;
  height:32px;
  border-radius:8px;
  cursor:default;
}
.warn-icon .icon{width:18px;height:18px}
.warn-idle{
  background:var(--panel-soft);
  color:#9ca3af;
}
.warn-active{
  background:#fee2e2;
  color:#dc2626;
}

/* Responsive: smaller widths shrink some columns */
@media (max-width:1100px){
  .hap-member-row{
    grid-template-columns:48px 1fr 130px 70px 32px 70px;
    gap:10px;
    padding:12px 8px;
  }
  .hap-status-date{display:none}
}
@media (max-width:780px){
  .hap-member-row{
    grid-template-columns:44px 1fr auto;
    gap:10px;
  }
  .hap-member-status,
  .hap-member-stats,
  .hap-member-warn{display:none}
}

/* ============================================================
   HAP — MEMBER VIEW (Sketch 2)
   ============================================================ */

.hap-back-link{
  font-size:.88rem;
  color:var(--muted);
  text-decoration:none;
}
.hap-back-link:hover{color:var(--accent)}

.hap-memberview-shell{
  display:grid;
  grid-template-columns:300px 1fr;
  gap:18px;
  align-items:start;
}

/* LEFT — identity card */
.hap-mv-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  overflow:hidden;
  box-shadow:var(--shadow-sm);
}
.hap-mv-card-top{
  background:linear-gradient(165deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
  padding:24px 18px 20px;
  text-align:center;
  color:#fff;
  position:relative;
}
.hap-mv-card-top::before{
  content:"";
  position:absolute;
  inset:0;
  background:radial-gradient(circle at 50% 100%, rgba(147,197,253,.35), transparent 60%);
  pointer-events:none;
}
.hap-mv-avatar{
  width:88px;
  height:88px;
  border-radius:18px;
  border:2px solid rgba(255,255,255,.25);
  object-fit:cover;
  background:#1e3a8a;
  box-shadow:0 8px 22px rgba(0,0,0,.3);
  margin-bottom:10px;
  position:relative;
}
.hap-mv-name{
  font-size:1.05rem;
  font-weight:700;
  color:#fff;
  position:relative;
}
.hap-mv-slug{
  font-size:.82rem;
  color:rgba(255,255,255,.78);
  margin-top:2px;
  position:relative;
}
.hap-mv-rank{
  display:inline-block;
  margin-top:10px;
  padding:4px 12px;
  background:rgba(255,255,255,.15);
  border:1px solid rgba(255,255,255,.18);
  border-radius:999px;
  font-size:.78rem;
  font-weight:600;
  position:relative;
}

/* Stat grid (Active / Created / Ras / Vos) */
.hap-mv-card-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
}
.hap-mv-cell{
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  border-right:1px solid var(--border);
}
.hap-mv-cell:nth-child(2n){border-right:0}
.hap-mv-cell:nth-last-child(-n+2){border-bottom:0}
.hap-mv-cell-label{
  font-size:.7rem;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.5px;
  font-weight:600;
  margin-bottom:4px;
}
.hap-mv-cell-value{font-size:1.4rem;font-weight:700;line-height:1.1}
.hap-mv-cell-value-text{font-size:.92rem;font-weight:600;color:var(--text)}

.check-yes{color:#16a34a}
.check-no{color:#dc2626}

/* Warned / Banned icon flags */
.hap-mv-flags{
  display:grid;
  grid-template-columns:1fr 1fr;
  border-top:1px solid var(--border);
}
.hap-mv-flag-form{margin:0}
.hap-mv-flag{
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  padding:14px;
  border:0;
  background:transparent;
  font:inherit;
  cursor:default;
  color:var(--muted);
  transition:background .15s, color .15s;
}
.hap-mv-flag.is-active{cursor:pointer}
.hap-mv-flag-form .hap-mv-flag{cursor:pointer}
.hap-mv-flag:hover{background:var(--panel-soft)}
.hap-mv-flag .icon{width:24px;height:24px}
.hap-mv-flag-label{
  font-size:.78rem;
  font-weight:600;
  text-transform:uppercase;
  letter-spacing:.4px;
}
.hap-mv-flag-count{
  font-size:.7rem;
  background:var(--border);
  color:var(--text);
  padding:1px 7px;
  border-radius:999px;
  font-weight:700;
}

.hap-mv-flag.is-active.warn{color:#dc2626}
.hap-mv-flag.is-active.warn .hap-mv-flag-count{background:#fee2e2;color:#991b1b}
.hap-mv-flag.is-active.ban{color:#dc2626}

.hap-mv-flag-form:not(:first-child) .hap-mv-flag,
.hap-mv-flag:not(:first-child){border-left:1px solid var(--border)}

/* RIGHT — form */
.hap-mv-form{
  min-width:0;
}

.hap-checkrow{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:8px 0;
  cursor:pointer;
}
.hap-checkrow input[type="checkbox"]{
  margin-top:4px;
  width:18px;
  height:18px;
  cursor:pointer;
  accent-color:var(--accent);
}
.hap-checkrow span{
  flex:1;
  font-size:.95rem;
  color:var(--text);
}

.hap-select{
  width:100%;
  padding:11px 13px;
  border-radius:9px;
  border:1px solid var(--border);
  background:var(--panel-soft);
  color:var(--text);
  font:inherit;
  outline:none;
  cursor:pointer;
}
.hap-select:focus{border-color:var(--accent)}

.hap-profile-actions{
  margin-top:18px;
  display:flex;
  justify-content:flex-end;
  gap:10px;
}

@media (max-width:880px){
  .hap-memberview-shell{grid-template-columns:1fr}
}

/* ============================================================
   HAP — SETTINGS / EDITABLE PAGES (collapsible cards)
   ============================================================ */

.hap-page-editor{
  margin-bottom:12px;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--panel-soft);
  overflow:hidden;
  transition:border-color .15s, background .15s;
}
.hap-page-editor:hover{
  border-color:#cdd5e0;
}
.hap-page-editor[open]{
  background:var(--panel);
  border-color:var(--accent);
  box-shadow:var(--shadow-sm);
}

.hap-page-editor-summary{
  cursor:pointer;
  font-weight:600;
  color:var(--text);
  padding:12px 16px;
  list-style:none;
  display:flex;
  align-items:center;
  gap:8px;
  user-select:none;
  transition:background .15s;
}
.hap-page-editor-summary:hover{
  background:rgba(37,99,235,.05);
}
.hap-page-editor-summary::-webkit-details-marker{display:none}
.hap-page-editor-summary::marker{display:none;content:''}
.hap-page-editor-summary::before{
  content:'▸';
  display:inline-block;
  color:var(--muted);
  transition:transform .2s;
  font-size:.85rem;
  width:14px;
  flex-shrink:0;
}
.hap-page-editor[open] .hap-page-editor-summary::before{
  transform:rotate(90deg);
}
.hap-page-editor-summary a{
  color:var(--accent);
  font-weight:500;
}
.hap-page-editor-summary a:hover{
  text-decoration:underline;
}

.hap-page-editor-textarea{
  width:calc(100% - 32px);
  margin:0 16px 16px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:8px;
  background:#ffffff;
  color:var(--text);
  font-family:ui-monospace, Menlo, Consolas, monospace;
  font-size:.9rem;
  line-height:1.5;
  resize:vertical;
  min-height:280px;
  outline:none;
  transition:border-color .15s, box-shadow .15s;
}
.hap-page-editor-textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(37,99,235,.12);
}

/* ============================================================
   HAP — REALMS / SUBJECTS / SCROLLS (admin pages)
   ============================================================ */

.hap-admin-shell{
  display:grid;
  grid-template-columns:340px 1fr;
  gap:18px;
  align-items:start;
}

.hap-admin-create{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  padding:18px;
  box-shadow:var(--shadow-sm);
  position:sticky;
  top:84px;
}
.hap-admin-create h2{
  margin:0 0 14px;
  font-size:1.05rem;
}

.hap-admin-list{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  padding:18px;
  box-shadow:var(--shadow-sm);
  position:sticky;
  top:84px;
}

.hap-admin-list-header{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  margin-bottom:8px;
  padding:0 4px;
}
.hap-admin-list-header h2{margin:0;font-size:1.05rem}
.hap-admin-list-header .count{color:var(--muted);font-size:.9rem}

.hap-admin-item{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:10px;
  overflow:hidden;
  transition:border-color .15s, background .15s;
  margin-bottom:12px;
}
.hap-admin-item:hover{border-color:#cdd5e0}
.hap-admin-item[open]{
  border-color:var(--accent);
  box-shadow:var(--shadow-sm);
}
.hap-admin-item-summary{
  cursor:pointer;
  font-weight:600;
  padding:12px 16px;
  color:var(--text);
  list-style:none;
  display:flex;
  align-items:center;
  gap:8px;
  user-select:none;
  transition:background .15s;
}
.hap-admin-item-summary:hover{background:rgba(37,99,235,.05)}
.hap-admin-item-summary::-webkit-details-marker{display:none}
.hap-admin-item-summary::marker{display:none;content:''}
.hap-admin-item-summary::before{
  content:'▸';
  display:inline-block;
  color:var(--muted);
  transition:transform .2s;
  font-size:.85rem;
  width:14px;
  flex-shrink:0;
}
.hap-admin-item[open] .hap-admin-item-summary::before{
  transform:rotate(90deg);
}
.hap-admin-item-summary .slug-tag{
  font-family:ui-monospace, Menlo, Consolas, monospace;
  font-size:.78rem;
  color:var(--muted);
  font-weight:500;
  background:var(--panel-soft);
  padding:2px 8px;
  border-radius:4px;
}
.hap-admin-item-summary .meta{
  margin-left:auto;
  color:var(--muted);
  font-size:.82rem;
  font-weight:500;
}

.hap-admin-item-form{
  padding:16px;
  display:flex;
  flex-direction:column;
  gap:12px;
  border-top:1px solid var(--border);
  background:#ffffff;
}

.hap-admin-item-actions{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-top:8px;
}

.btn-danger-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:38px;
  height:38px;
  border:1px solid var(--border);
  background:var(--panel);
  color:#dc2626;
  border-radius:8px;
  cursor:pointer;
  transition:background .15s, border-color .15s;
}
.btn-danger-icon:hover{
  background:#fee2e2;
  border-color:#dc2626;
}
.btn-danger-icon .icon{width:18px;height:18px}

@media (max-width:880px){
  .hap-admin-shell{grid-template-columns:1fr}
  .hap-admin-create{position:static}
}

/* ============================================================
   HAP — SUBJECTS — Realm group headers
   ============================================================ */

.hap-realm-group-header{
  display:flex;
  align-items:baseline;
  gap:10px;
  padding:14px 4px 6px;
  border-bottom:1px solid var(--border);
  margin-top:18px;
  margin-bottom:4px;
}
.hap-realm-group-header:first-of-type{margin-top:0}

.hap-realm-group-header .realm-name{
  font-weight:700;
  font-size:1rem;
  color:var(--text);
}
.hap-realm-group-header .realm-slug{
  font-family:ui-monospace, Menlo, Consolas, monospace;
  font-size:.78rem;
  color:var(--muted);
  background:var(--panel-soft);
  padding:2px 8px;
  border-radius:4px;
}
.hap-realm-group-header .realm-count{
  margin-left:auto;
  color:var(--muted);
  font-size:.85rem;
  font-weight:500;
}

.hap-realm-empty{
  padding:14px 16px;
  color:var(--muted);
  font-size:.9rem;
  font-style:italic;
  background:var(--panel-soft);
  border:1px dashed var(--border);
  border-radius:8px;
  text-align:center;
}

/* Slight indent for subjects so they visually nest under their realm header */
.hap-subject-item{
  margin-left:0;
}

/* ============================================================
   MOBILE FIX — force single column on small screens
   ============================================================ */

/* Remove accidental sticky on admin list */
.hap-admin-list{
  position:static !important;
  top:auto !important;
}

/* Force all HAP shells to collapse on mobile */
@media (max-width:880px){
  .hap-profile-shell,
  .hap-memberview-shell,
  .hap-admin-shell,
  .whisper-shell{
    grid-template-columns:1fr !important;
  }
  
  .hap-admin-create,
  .hap-profile-card,
  .hap-mv-card{
    position:static !important;
    top:auto !important;
  }
  
  /* Stats grid: 1 column on phones */
  .hap-stats-grid{
    grid-template-columns:1fr !important;
  }
  
  /* Charts: stack vertically */
  .hap-charts-row{
    grid-template-columns:1fr !important;
  }
}

/* Smaller screens */
@media (max-width:600px){
  .hap-main{padding:14px !important}
  .hap-profile-grid{grid-template-columns:1fr !important}
  .hap-mv-card-grid{grid-template-columns:1fr !important}
  .hap-mv-flags{grid-template-columns:1fr !important}
  
  .hap-mv-cell{
    border-right:0 !important;
  }
}

/* ============================================================
   HAP — STAFF PAGE
   ============================================================ */

.hap-staff-form-row{
  display:flex;
  gap:14px;
  align-items:flex-end;
  flex-wrap:wrap;
}

.hap-staff-group{
  margin-top:22px;
}
.hap-staff-group-title{
  font-size:1rem;
  font-weight:700;
  color:var(--text);
  margin:0 0 12px;
  padding-bottom:8px;
  border-bottom:1px solid var(--border);
}

.hap-staff-grid{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(280px, 1fr));
  gap:14px;
}

.hap-staff-card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:12px;
  padding:14px;
  box-shadow:var(--shadow-sm);
  display:flex;
  flex-direction:column;
  gap:12px;
  transition:border-color .15s, box-shadow .15s;
}
.hap-staff-card:hover{
  border-color:#cdd5e0;
  box-shadow:var(--shadow-md);
}

.hap-staff-card-top{
  display:flex;
  align-items:center;
  gap:12px;
}

.hap-staff-avatar-wrap{
  position:relative;
  flex-shrink:0;
}
.hap-staff-avatar{
  width:48px;
  height:48px;
  border-radius:20%;
  border:2px solid var(--border);
  object-fit:cover;
  background:var(--panel-soft);
  display:block;
}
.hap-staff-online{
  position:absolute;
  bottom:-2px;
  right:-2px;
  width:14px;
  height:14px;
  border-radius:50%;
  border:2px solid var(--panel);
}
.hap-staff-online.is-online  { background:#16a34a; box-shadow:0 0 0 2px rgba(22,163,74,.18) }
.hap-staff-online.is-offline { background:#9ca3af }

.hap-staff-identity{
  flex:1;
  min-width:0;
}
.hap-staff-name{
  font-weight:700;
  color:var(--text);
  font-size:.98rem;
  line-height:1.2;
}
.hap-staff-slug{
  font-size:.82rem;
  color:var(--muted);
  margin-top:2px;
}

.hap-staff-edit-btn{
  width:32px;
  height:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:var(--panel-soft);
  border:1px solid var(--border);
  border-radius:8px;
  color:var(--muted);
  cursor:pointer;
  transition:background .15s, color .15s, border-color .15s;
}
.hap-staff-edit-btn:hover{
  background:var(--accent-soft);
  border-color:var(--accent);
  color:var(--accent);
}
.hap-staff-edit-btn .icon{width:16px;height:16px}

.hap-staff-meta{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:10px 0;
  border-top:1px solid var(--border);
  border-bottom:1px solid var(--border);
}
.hap-staff-meta-row{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:.85rem;
  color:var(--muted);
}
.hap-staff-meta-row .icon{
  width:14px;
  height:14px;
  color:var(--muted);
  flex-shrink:0;
}
.hap-staff-stat-pair strong{
  color:var(--text);
  font-weight:700;
}

.hap-staff-actions{
  display:flex;
  gap:8px;
}
.hap-staff-actions .btn-mini{
  flex:1;
  text-align:center;
  margin:0;
}

@media (max-width:600px){
  .hap-staff-grid{grid-template-columns:1fr}
}