/* ==========================================================================
   Rakshith N Finance - design system
   Tokens -> base -> layout -> components -> pages -> responsive
   ========================================================================== */

/* Self-hosted fonts (SIL Open Font License, see static/fonts): the site loads nothing from third-party servers. */
@font-face { font-family: "IBM Plex Sans"; src: url("fonts/ibm-plex-sans-var.woff") format("woff"); font-weight: 400 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url("fonts/newsreader-var.woff") format("woff"); font-weight: 500 700; font-style: normal; font-display: swap; }

:root {
  --ink: #10202f;          /* header, hero, headings */
  --ink-2: #1c3144;
  --green: #0b6b57;        /* primary action, links, positive */
  --green-2: #095645;
  --green-tint: #e6f2ef;
  --brass: #b8892b;        /* single accent: pinned, portrait ring */
  --paper: #f3f5f8;        /* page background */
  --surface: #ffffff;
  --line: #dde3ea;
  --text: #1b2733;
  --muted: #5a6778;
  --danger: #b42318;
  --r-sm: 6px;             /* controls */
  --r-md: 12px;            /* cards, panels */
  --r-lg: 18px;            /* hero */
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;

  /* Bootstrap bridge */
  --bs-body-font-family: var(--font-sans);
  --bs-body-color: var(--text);
  --bs-body-bg: var(--paper);
  --bs-link-color: var(--green);
  --bs-link-color-rgb: 11, 107, 87;
  --bs-link-hover-color: var(--green-2);
  --bs-link-hover-color-rgb: 9, 86, 69;
  --bs-border-color: var(--line);
  --bs-border-radius: var(--r-sm);
  --bs-primary: var(--green);
  --bs-secondary-color: var(--muted);
}

/* ---------- base ---------- */
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body { background: var(--paper); color: var(--text); font-family: var(--font-sans); font-size: 1rem; line-height: 1.55;
       -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5 { font-family: var(--font-serif); color: var(--ink); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
h1 { font-size: clamp(2rem, 4.4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 2.6vw, 1.9rem); }
h3 { font-size: 1.25rem; }
a { text-underline-offset: 3px; }
body { display: flex; flex-direction: column; min-height: 100vh; }
.page { flex: 1 0 auto; width: 100%; }
.btn { white-space: nowrap; }
img, video { max-width: 100%; height: auto; }
.text-muted { color: var(--muted) !important; }
.i { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
     flex: none; vertical-align: -.2em; }
:focus-visible { outline: 3px solid rgba(11, 107, 87, .45); outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 2000;
             border-radius: 0 0 var(--r-sm) 0; }
.skip-link:focus { left: 0; }
.page { padding-top: 2rem; padding-bottom: 4rem; }
.nav-link, .btn { touch-action: manipulation; }

/* ---------- top strip + header ---------- */
.topbar { background: var(--ink); color: #c9d6e2; font-size: .8rem; }
.topbar .container { display: flex; justify-content: space-between; gap: 1rem; padding-top: .4rem; padding-bottom: .4rem; }
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); z-index: 1030; }
.site-header .navbar { padding: .55rem 0; }
.navbar-brand { display: flex; align-items: center; gap: .65rem; margin-right: 1.25rem; padding: 0; }
.nav-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; border: 2px solid var(--brass); }
.brand-name { font-family: var(--font-serif); font-weight: 700; font-size: 1.25rem; color: var(--ink); letter-spacing: -.01em; }
.site-header .nav-link { color: var(--text); font-weight: 500; font-size: .95rem; padding: .55rem .8rem; position: relative; }
.site-header .nav-link:hover { color: var(--green); }
.site-header .nav-link.active { color: var(--green); }
@media (min-width: 992px) {
  .site-header .navbar-nav:first-child .nav-link.active::after { content: ""; position: absolute; left: .8rem; right: .8rem; bottom: -.62rem;
                                                                height: 2px; background: var(--green); }
}
.navbar-toggler { border: 1px solid var(--line); border-radius: var(--r-sm); padding: .4rem .55rem; color: var(--ink); }
.navbar-toggler:focus { box-shadow: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--line);
            background: var(--surface); color: var(--ink); border-radius: var(--r-sm); }
.icon-btn:hover { background: var(--paper); }
.user-chip { display: flex; align-items: center; gap: .5rem; }
.avatar-initial { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-grid; place-items: center;
                  font-weight: 600; font-size: .85rem; }
.dropdown-menu { border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 8px 24px rgba(16, 32, 47, .12); padding: .4rem; min-width: 14rem; }
.dropdown-item { border-radius: var(--r-sm); padding: .5rem .7rem; display: flex; align-items: center; gap: .6rem; font-size: .95rem; }
.dropdown-item:active { background: var(--green); }
.dropdown-header { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
@media (max-width: 991.98px) {
  .navbar-collapse { padding: .75rem 0 .5rem; border-top: 1px solid var(--line); margin-top: .6rem; }
  .site-header .dropdown-menu { box-shadow: none; border: 0; padding-left: .8rem; }
}

/* ---------- buttons & forms ---------- */
.btn { border-radius: var(--r-sm); font-weight: 600; letter-spacing: .005em; display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn-lg { padding: .8rem 1.4rem; font-size: 1.02rem; }
.btn-brand { background: var(--green); color: #fff; border: 1px solid var(--green); }
.btn-brand:hover, .btn-brand:focus-visible { background: var(--green-2); border-color: var(--green-2); color: #fff; }
.btn-brand:disabled { opacity: .55; }
.btn-ghost { background: transparent; color: #fff; border: 1px solid rgba(255, 255, 255, .45); }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; border-color: #fff; }
.btn-outline-secondary { --bs-btn-color: var(--ink); --bs-btn-border-color: #c3ccd6; --bs-btn-hover-bg: var(--paper);
                         --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #9aa7b6; --bs-btn-active-bg: var(--paper);
                         --bs-btn-active-color: var(--ink); --bs-btn-active-border-color: #9aa7b6; }
.btn-outline-dark { --bs-btn-color: var(--ink); --bs-btn-border-color: #c3ccd6; --bs-btn-hover-bg: var(--ink); --bs-btn-hover-border-color: var(--ink); }
.btn-whatsapp { background: #1fa855; color: #fff; border: 1px solid #1fa855; }
.btn-whatsapp:hover { background: #178a45; color: #fff; }
.form-label { font-weight: 600; font-size: .9rem; color: var(--ink); margin-bottom: .35rem; }
.form-control, .form-select { border-color: #c3ccd6; border-radius: var(--r-sm); padding: .6rem .8rem; background-color: var(--surface); }
.form-control:focus, .form-select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(11, 107, 87, .18); }
.form-text { color: var(--muted); font-size: .82rem; }
.alert { border-radius: var(--r-md); border-width: 1px; font-size: .95rem; }
.badge { font-weight: 600; }

/* ---------- shared blocks ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; padding-bottom: 1.1rem;
             border-bottom: 1px solid var(--line); }
.page-head h1, .page-head h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); margin: 0; display: flex; align-items: center; gap: .6rem; }
.page-head h1 .i, .page-head h2 .i { color: var(--green); width: 1.1em; height: 1.1em; }
.page-head p { margin: .3rem 0 0; color: var(--muted); max-width: 60ch; }
.section-head { margin-bottom: 1.5rem; padding-bottom: 1.1rem; border-bottom: 1px solid var(--line); }
.block { margin-bottom: 3rem; }
.block-head { margin-bottom: 1.1rem; }
.block-head h2 { margin: 0; }
.block-head p { margin: .2rem 0 0; color: var(--muted); font-size: .95rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.25rem; margin-bottom: 1rem; }
.panel-title { font-family: var(--font-sans); font-size: .95rem; font-weight: 600; margin-bottom: .9rem; color: var(--ink); letter-spacing: 0; }
.panel-join { background: var(--green-tint); border-color: #c4e0d9; }
.empty { display: flex; flex-direction: column; align-items: center; gap: .3rem; text-align: center; padding: 3rem 1rem; background: var(--surface);
         border: 1px dashed #c3ccd6; border-radius: var(--r-md); color: var(--muted); }
.empty .i { width: 2rem; height: 2rem; color: #8896a6; margin-bottom: .4rem; }
.empty strong { color: var(--ink); }
.pager { display: flex; justify-content: center; gap: .6rem; margin-top: .5rem; }
.side-sticky { position: sticky; top: 5.5rem; }

/* ---------- home: hero, ledger, desks ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; align-items: center; gap: 2rem; background: var(--ink); color: #fff;
        border-radius: var(--r-lg); padding: clamp(1.75rem, 5vw, 3.5rem); margin-bottom: 1.25rem; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; pointer-events: none;
               background: radial-gradient(60% 90% at 100% 0%, rgba(11, 107, 87, .45), transparent 70%); }
.hero > * { position: relative; z-index: 1; }
.hero h1 { color: #fff; margin-bottom: 1rem; max-width: 18ch; }
.hero-eyebrow { font-size: clamp(1.25rem, 3.4vw, 1.75rem); letter-spacing: .16em; font-weight: 700; color: #f2c14e; margin: 0 0 .75rem; }
.hero-lead { font-size: 1.1rem; color: #cfdae5; max-width: 52ch; margin-bottom: 1.75rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero-portrait { margin: 0; justify-self: center; width: min(100%, 300px); }
.hero-portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--r-md); border: 3px solid var(--brass); display: block;
                     background: var(--ink-2); }
.hero-portrait figcaption { margin-top: .75rem; display: flex; flex-direction: column; line-height: 1.3; }
.hero-portrait figcaption span { color: #a9bacb; font-size: .88rem; }

.ledger { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 0 3rem; background: var(--surface); border: 1px solid var(--line);
          border-radius: var(--r-md); }
.ledger > div { padding: 1.1rem 1.25rem; border-left: 1px solid var(--line); }
.ledger > div:first-child { border-left: 0; }
.ledger dt { font-size: .82rem; font-weight: 500; color: var(--muted); }
.ledger dd { margin: .15rem 0 0; font-family: var(--font-serif); font-size: 1.6rem; font-weight: 600; color: var(--ink); line-height: 1.2; }

.desk { display: flex; flex-direction: column; gap: .5rem; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
        padding: 1.5rem; color: var(--text); text-decoration: none; transition: border-color .15s ease, box-shadow .15s ease; }
.desk:hover { border-color: var(--green); box-shadow: 0 6px 20px rgba(16, 32, 47, .08); color: var(--text); }
.desk-icon { width: 46px; height: 46px; border-radius: var(--r-sm); background: var(--green-tint); color: var(--green); display: grid; place-items: center; }
.desk-icon .i { width: 24px; height: 24px; }
.desk-title { font-family: var(--font-serif); font-size: 1.35rem; font-weight: 600; color: var(--ink); margin-top: .4rem; }
.desk-text { color: var(--muted); font-size: .94rem; }
.desk-latest { margin-top: .5rem; padding-top: .8rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: .15rem; font-size: .92rem;
               font-weight: 500; color: var(--ink); min-height: 4.4rem; }
.desk-latest small { color: var(--muted); font-weight: 400; }
.desk-latest span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.desk-go { margin-top: auto; padding-top: .6rem; color: var(--green); font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; font-size: .94rem; }
.desk:hover .desk-go .i { transform: translateX(3px); }
.desk-go .i { transition: transform .15s ease; }

.quick { list-style: none; margin: 0; padding: 0; }
.quick li + li { border-top: 1px solid var(--line); }
.quick a { display: flex; gap: .8rem; align-items: flex-start; padding: .75rem .25rem; color: var(--text); text-decoration: none; border-radius: var(--r-sm); }
.quick a:hover strong { color: var(--green); }
.quick .i { width: 1.4rem; height: 1.4rem; margin-top: .15rem; color: var(--green); }
.quick strong { display: block; font-weight: 600; font-size: .95rem; }
.quick small { display: block; color: var(--muted); font-size: .82rem; }
.promise { list-style: none; margin: 0; padding: 0; display: grid; gap: .65rem; font-size: .92rem; }
.promise li { display: flex; gap: .6rem; align-items: flex-start; }
.promise .i { color: var(--green); margin-top: .15rem; }

/* ---------- feed (post cards) ---------- */
.ig-feed { max-width: 640px; margin: 0; }
.ig-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 1.25rem; overflow: hidden; }
.ig-pinned { border-color: var(--brass); box-shadow: inset 3px 0 0 var(--brass); }
.ig-head { display: flex; align-items: center; gap: .75rem; padding: .85rem 1.1rem; }
.ig-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid var(--brass); flex: none; }
.ig-who { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.ig-who strong { font-size: .95rem; }
.ig-meta { font-size: .8rem; color: var(--muted); }
.ig-more { font-weight: 700; line-height: 1; border: 1px solid var(--line); background: var(--surface); }
.ig-media { background: #0b1520; overflow: hidden; }
.ig-media img { width: 100%; max-height: 620px; object-fit: cover; display: block; }
.ig-media video { width: 100%; max-height: 620px; object-fit: contain; display: block; background: #000; }
.ig-actions { display: flex; align-items: center; gap: .6rem; padding: .7rem 1.1rem .1rem; }
.ig-like { background: none; border: 0; padding: 0; line-height: 1; font-size: 1.7rem; color: var(--ink); text-decoration: none; min-height: 0 !important; }
.ig-like:hover .ig-heart { transform: scale(1.12); }
.ig-like.is-liked { color: #d92d4b; }
.ig-heart { display: inline-block; transition: transform .12s ease; }
.ig-count { font-weight: 600; font-size: .9rem; }
.ig-caption { padding: .4rem 1.1rem 1.1rem; overflow-wrap: anywhere; }
.ig-text { white-space: pre-wrap; }
.ig-text strong { font-family: var(--font-serif); font-size: 1.15rem; color: var(--ink); font-weight: 600; }
.ig-caption.clamped .ig-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ig-readmore { background: none; border: 0; padding: 0; color: var(--green); font-size: .9rem; font-weight: 600; min-height: 0 !important; }
.ig-file { padding: 0 1.1rem 1.1rem; }

/* ---------- auth pages ---------- */
.auth-wrap { max-width: 460px; margin: 1rem auto 0; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: clamp(1.4rem, 4vw, 2.25rem); }
.auth-card h1 { font-size: 1.75rem; margin-bottom: .4rem; }
.auth-sub { color: var(--muted); font-size: .95rem; margin-bottom: 1.5rem; }
.auth-foot { margin-top: 1.5rem; padding-top: 1.1rem; border-top: 1px solid var(--line); font-size: .92rem; display: grid; gap: .35rem; }

/* ---------- community chat ---------- */
.chat-box { background: var(--surface); border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
.chat-messages { background: #eef1f5; padding: 1rem; overflow-y: auto; overscroll-behavior: contain; height: 60vh; }
@supports (height: 100dvh) { .chat-messages { height: clamp(260px, calc(100dvh - 430px), 760px); } }
.msg { max-width: 78%; background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; padding: .55rem .85rem; margin-bottom: .6rem; }
.msg.mine { margin-left: auto; background: var(--green-tint); border-color: #c4e0d9; border-radius: 14px 14px 4px 14px; }
.day-sep { display: table; margin: .9rem auto .7rem; padding: .2rem .8rem; font-size: .75rem; font-weight: 600; color: #54606e;
            background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.msg-head { font-size: .8rem; }
.msg-body { white-space: pre-wrap; word-break: break-word; }
.msg-body, .msg-file, .msg-head { overflow-wrap: anywhere; }
.msg-img { max-width: min(260px, 100%); max-height: 260px; border-radius: var(--r-sm); margin-top: .4rem; display: block; }
.msg-video { display: block; width: 100%; max-width: 420px; max-height: 360px; margin-top: .35rem; border-radius: var(--r-sm); background: #000; }
.msg-file { display: inline-block; margin-top: .4rem; }
.chat-input { display: flex; gap: .5rem; padding: .75rem; border-top: 1px solid var(--line); background: var(--surface); padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); }
.channel-tabs { flex-wrap: nowrap; overflow-x: auto; gap: .25rem; -webkit-overflow-scrolling: touch; border-bottom: 1px solid var(--line); margin-bottom: 1rem !important; }
.channel-tabs .nav-link { white-space: nowrap; position: relative; padding: .6rem 1rem; color: var(--muted); font-weight: 600; border-radius: var(--r-sm) var(--r-sm) 0 0;
                          border-bottom: 2px solid transparent; }
.channel-tabs .nav-link:hover { color: var(--ink); }
.channel-tabs .nav-link.active { background: transparent; color: var(--green); border-bottom-color: var(--green); }
.channel-tabs .unread { position: absolute; top: 8px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.has-chat .wa-float, .has-chat .calc-float { display: none; }

/* ---------- documents library ---------- */
.doc-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line) !important; border-radius: var(--r-md) !important; box-shadow: none !important; }
.doc-thumb { aspect-ratio: 4 / 3; background: #0b1520; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.doc-thumb img, .doc-thumb video { width: 100%; height: 100%; object-fit: cover; }
.doc-thumb video { object-fit: contain; }
.doc-ext { display: flex; flex-direction: column; align-items: center; gap: .3rem; color: #fff; text-decoration: none; font-size: 2.2rem; }
.doc-ext span { font-size: .8rem; letter-spacing: .06em; opacity: .85; }

/* ---------- cards used by quizzes / polls / admin ---------- */
.card { border: 1px solid var(--line) !important; border-radius: var(--r-md) !important; box-shadow: none !important; background: var(--surface); }
.trust-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 1.1rem; height: 100%; text-align: left !important; box-shadow: none; }
.trust-number { font-family: var(--font-serif); font-size: 2rem; font-weight: 600; color: var(--ink); line-height: 1.1; }
.trust-label { font-size: .85rem; color: var(--muted); margin-top: .2rem; }
.progress { background: #e6ebf1; border-radius: 999px; }
.progress-bar.bg-warning { background-color: var(--green) !important; }
.table { --bs-table-bg: var(--surface); --bs-table-border-color: var(--line); }
.table thead th { font-size: .8rem; font-weight: 600; color: var(--muted); border-bottom-color: var(--line); background: #f8fafc; }
.table-responsive { -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.table-responsive .table { margin-bottom: 0; }

/* ---------- admin menu ---------- */
.offcanvas { border-right: 1px solid var(--line); }
.offcanvas-header { background: var(--ink); color: #fff; }
.offcanvas-title { font-family: var(--font-sans); font-size: 1rem; font-weight: 600; color: #fff; }
.admin-menu .list-group { gap: .15rem; }
.admin-menu .list-group-item { border: 0; border-radius: var(--r-sm); display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; font-weight: 500; color: var(--text); }
.admin-menu .list-group-item .i { color: var(--green); }
.admin-menu .list-group-item:hover { background: var(--paper); color: var(--green); }
.admin-menu .menu-title { font-size: .8rem; font-weight: 600; color: var(--muted); margin: 1.25rem 0 .4rem; padding: 0 .75rem; }

/* ---------- footer & floating button ---------- */
.site-footer { background: var(--ink); color: #b9c7d5; padding: 3rem 0 1.5rem; margin-top: 2rem; }
.footer-brand { font-family: var(--font-serif); font-size: 1.4rem; font-weight: 700; color: #fff; margin-bottom: .5rem; }
.footer-text { max-width: 44ch; font-size: .95rem; }
.footer-title { font-weight: 600; color: #fff; margin-bottom: .7rem; font-size: .95rem; }
.footer-links { list-style: none; padding: 0; margin: 0; display: grid; gap: .4rem; font-size: .93rem; }
.footer-links a { color: #b9c7d5; text-decoration: none; }
.footer-links a:hover { color: #fff; text-decoration: underline; }
.footer-legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 2rem; margin-top: 2rem; padding-top: 1.1rem;
                border-top: 1px solid rgba(255, 255, 255, .14); font-size: .82rem; color: #93a5b7; }
.wa-float { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); right: calc(16px + env(safe-area-inset-right)); z-index: 1040;
            background: #1fa855; color: #fff; width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
            box-shadow: 0 4px 14px rgba(16, 32, 47, .28); text-decoration: none; }
.wa-float:hover { background: #178a45; color: #fff; }
.calc-float { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); right: calc(16px + env(safe-area-inset-right)); z-index: 1040;
              background: var(--green, #0f6e4f); color: #fff; width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
              box-shadow: 0 4px 14px rgba(16, 32, 47, .28); text-decoration: none; }
.calc-float:hover { filter: brightness(.92); color: #fff; }
.sip-modes { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.sip-field { margin-bottom: 1.4rem; }
.sip-field .top { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.sip-field .num { width: 11rem; max-width: 50%; text-align: right; font-weight: 600; }
.sip-donut { width: 100%; max-width: 250px; display: block; margin: 0 auto; }
.sip-key { display: inline-block; width: 12px; height: 12px; border-radius: 2px; margin-right: .4rem; }
.sip-big { font-size: 1.6rem; font-weight: 700; }
.sip-result { background: #e3f3e6; border-radius: .75rem; padding: 1.25rem 1.5rem; }

/* ---------- responsive ---------- */
@media (max-width: 991.98px) {
  .hero { grid-template-columns: 1fr; }
  .hero-portrait { order: -1; width: 160px; justify-self: start; }
  .hero-portrait img { aspect-ratio: 1; }
  .hero-portrait figcaption { display: none; }
  .ledger { grid-template-columns: repeat(2, 1fr); }
  .ledger > div:nth-child(3) { border-left: 0; }
  .ledger > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .ledger > div:nth-child(3):last-child { grid-column: 1 / -1; }
  .side-sticky { position: static; }
}
@media (max-width: 767.98px) {
  .form-control, .form-select, textarea { font-size: 16px; }   /* stops iPhone zoom-on-focus */
  .btn { min-height: 42px; }
  .msg { max-width: 92%; }
  .page { padding-top: 1.25rem; }
  .brand-name { font-size: 1.05rem; }
  .topbar .container { justify-content: center; }
  body.has-chat .topbar, body.has-chat .site-footer { display: none; }
  body.has-chat .page { padding-top: .75rem; padding-bottom: .75rem; }
  body.has-chat .chat-messages { height: calc(100dvh - 300px); min-height: 200px; }
  /* tables turn into cards on phones (no sideways scrolling) */
  .table-responsive { border: 0; background: transparent; }
  .table-stack thead { display: none; }
  .table-stack, .table-stack tbody { display: block; }
  .table-stack tr { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: .8rem; padding: .5rem .8rem; }
  .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border: 0; padding: .3rem 0; text-align: right;
                    overflow-wrap: anywhere; background: transparent; }
  .table-stack td::before { content: attr(data-label); font-weight: 600; color: var(--muted); text-align: left; flex: none; }
  .table-stack td[data-label="Status"] { flex-wrap: wrap; justify-content: flex-end; }
  .channel-tabs .nav-link { padding: .6rem .75rem; }
  .table-stack td[data-label="Actions"] { display: block; text-align: left; }
  .table-stack td[data-label="Actions"]::before { display: block; margin-bottom: .3rem; }
}
@media (max-width: 575.98px) {
  main.container { padding-left: 14px; padding-right: 14px; }
  .hero { padding: 1.5rem 1.25rem; }
  .ledger dd { font-size: 1.3rem; }
  .ledger > div { padding: .9rem 1rem; }
  .msg-img { max-width: 100%; }
  .wa-float, .calc-float { width: 48px; height: 48px; bottom: 14px; right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.form-narrow { max-width: 760px; }
.q-card .btn { min-height: 0; }

/* ---------- password show/hide ---------- */
.pw-field { position: relative; }
.pw-field .form-control { padding-right: 2.9rem; }
.pw-toggle { position: absolute; top: 50%; right: .35rem; transform: translateY(-50%); width: 2.3rem; height: 2.3rem; display: grid; place-items: center;
             background: transparent; border: 0; border-radius: var(--r-sm); color: var(--muted); cursor: pointer; min-height: 0 !important; }
.pw-toggle:hover { color: var(--ink); background: var(--paper); }
.pw-toggle .i { width: 1.25rem; height: 1.25rem; }

/* ---------- admin analytics ---------- */
.chart-svg { width: 100%; max-width: 680px; height: auto; display: block; }
.chart-empty { color: var(--muted); font-size: .9rem; padding: 2rem 0; text-align: center; }
.chart-legend { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .85rem; color: var(--text); }
.chart-legend .sw { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: .4rem; vertical-align: -1px; }
.donut-wrap .chart-svg { max-width: 220px; }
.donut-wrap { display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 1rem; align-items: center; }
.donut-wrap .chart-legend { flex-direction: column; margin: 0; }
@media (max-width: 575.98px) { .donut-wrap { grid-template-columns: 1fr; justify-items: center; } }

/* Market update buttons + panel in the community chat */
.mu-panel{background:#fff;border:1px solid rgba(0,0,0,.12);border-radius:12px;padding:14px 16px;margin-bottom:10px;max-height:55vh;overflow:auto}
.mu-panel h2{font-size:1rem;margin:0 0 2px}
.mu-panel .mu-meta{font-size:.78rem;color:#6b7280;margin-bottom:8px}
.mu-panel .mu-head{font-weight:700;font-size:.8rem;letter-spacing:.04em;margin-top:10px}
.mu-panel ul{margin:2px 0 0;padding-left:1.1rem}
.mu-panel .mu-foot{font-size:.75rem;color:#6b7280;margin-top:10px;border-top:1px solid rgba(0,0,0,.08);padding-top:8px}
.mu-panel .mu-stale{font-size:.8rem}
.mu-pre{white-space:pre-wrap;font-family:inherit;font-size:.85rem;margin:6px 0 0}
.footer-legal a { color: inherit; text-decoration: underline; }

/* SWP calculator page */
.swp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.swp-chart { width: 100%; height: 190px; display: block; background: #f7f9fb; border-radius: var(--r-sm); }
.swp-table { max-height: 420px; overflow: auto; }
.swp-table thead th { position: sticky; top: 0; background: var(--surface); }
