
{"id":11894,"date":"2025-09-08T00:37:57","date_gmt":"2025-09-08T00:37:57","guid":{"rendered":"https:\/\/indianbrahmins.com\/?page_id=11894"},"modified":"2026-03-14T11:45:21","modified_gmt":"2026-03-14T06:15:21","slug":"br-students","status":"publish","type":"page","link":"https:\/\/indianbrahmins.com\/index.php\/br-students\/","title":{"rendered":"BR STUDENTS"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-page\" data-elementor-id=\"11894\" class=\"elementor elementor-11894\" data-elementor-post-type=\"page\">\n\t\t\t\t<div class=\"elementor-element elementor-element-3b4a8534 e-flex e-con-boxed wpr-particle-no wpr-jarallax-no wpr-parallax-no wpr-sticky-section-no wpr-column-slider-no wpr-equal-height-no e-con e-parent\" data-id=\"3b4a8534\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-3bc7610e elementor-widget elementor-widget-text-editor\" data-id=\"3bc7610e\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t<div class=\"elementor-element elementor-element-e5fcc35 e-flex e-con-boxed wpr-particle-no wpr-jarallax-no wpr-parallax-no wpr-sticky-section-no wpr-column-slider-no wpr-equal-height-no e-con e-parent\" data-id=\"e5fcc35\" data-element_type=\"container\" data-e-type=\"container\">\n\t\t\t\t\t<div class=\"e-con-inner\">\n\t\t\t\t<div class=\"elementor-element elementor-element-92fb689 elementor-widget elementor-widget-shortcode\" data-id=\"92fb689\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-shortcode\">    <!-- ===================== STYLES ===================== -->\n    <style>\n    #hbm-app *{box-sizing:border-box}\n    #hbm-app{font-family:Arial,Helvetica,sans-serif;color:#1b1b1b;font-weight:700;max-width:1180px;margin:0 auto;padding:16px}\n    #hbm-app :root,#hbm-app{--hbm-yellow:#fff7cc;--hbm-line:linear-gradient(90deg,#d60f2a,#245dff);--hbm-shadow:0 12px 35px rgba(24,39,75,.12);--hbm-radius:18px}\n\n    .hbm-hero{background:#fff;border-radius:24px;padding:22px;box-shadow:var(--hbm-shadow,0 12px 35px rgba(24,39,75,.12));position:relative;overflow:hidden;margin-bottom:20px}\n    .hbm-hero::before{content:\"\";position:absolute;inset:0 0 auto 0;height:8px;background:linear-gradient(90deg,#d60f2a,#245dff)}\n    .hbm-hero h1{margin:10px 0 8px;font-size:clamp(22px,4vw,34px);line-height:1.15;color:#102a6b}\n    .hbm-hero p{margin:6px 0;color:#6a6a6a;font-size:15px;font-weight:700}\n\n    .hbm-grid{display:grid;grid-template-columns:1.15fr 0.85fr;gap:20px}\n    @media(max-width:960px){.hbm-grid{grid-template-columns:1fr}}\n\n    .hbm-card{background:#fff;border-radius:18px;box-shadow:0 12px 35px rgba(24,39,75,.12);position:relative;overflow:hidden;margin-bottom:20px}\n    .hbm-card::before{content:\"\";position:absolute;top:0;left:0;right:0;height:6px;background:linear-gradient(90deg,#d60f2a,#245dff)}\n    .hbm-card-body{padding:22px}\n\n    .hbm-title{margin:0 0 14px;color:#183a93;font-size:24px}\n    .hbm-subtext{color:#6a6a6a;font-size:13px;margin-bottom:14px;font-weight:700}\n\n    .hbm-form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}\n    @media(max-width:960px){.hbm-form-grid{grid-template-columns:1fr}}\n    .hbm-full{grid-column:1\/-1}\n\n    .hbm-app label{display:block;margin-bottom:6px;font-size:14px;color:#222}\n    .hbm-field,.hbm-select,.hbm-textarea{width:100%;padding:13px 14px;border:2px solid transparent;border-radius:14px;background:linear-gradient(#fff7cc,#fff7cc) padding-box,linear-gradient(90deg,#d60f2a,#245dff) border-box;font-size:15px;font-weight:700;color:#111;outline:none;appearance:none;-webkit-appearance:none}\n    .hbm-field::placeholder,.hbm-textarea::placeholder{color:#7c7045;font-weight:700}\n    .hbm-textarea{min-height:120px;resize:vertical}\n    .hbm-hint{margin-top:6px;color:#6a5a19;font-size:12px;font-weight:700}\n\n    .hbm-btn-row{display:flex;gap:12px;flex-wrap:wrap;margin-top:18px}\n    .hbm-btn{border:none;border-radius:999px;padding:12px 20px;cursor:pointer;font-size:15px;font-weight:900;box-shadow:0 8px 18px rgba(0,0,0,.08)}\n    .hbm-btn-primary{color:#fff;background:linear-gradient(90deg,#d60f2a,#245dff)}\n    .hbm-btn-secondary{background:#fff3cf;color:#5a3a00;border:2px solid #f0ce72}\n    .hbm-btn-danger{background:#fff0f0;color:#c62828;border:2px solid #efb9b9}\n    .hbm-btn-success{background:#eefbf3;color:#157347;border:2px solid #b7e4c7}\n    .hbm-btn-small{padding:9px 13px;font-size:13px;border-radius:12px}\n\n    .hbm-kv{display:grid;grid-template-columns:170px 1fr;gap:10px;margin-bottom:8px;font-size:14px}\n    @media(max-width:600px){.hbm-kv{grid-template-columns:1fr;gap:3px}}\n\n    .hbm-badge{display:inline-block;padding:7px 12px;border-radius:999px;font-size:12px;font-weight:900}\n    .hbm-badge-pending{background:#fff1cc;color:#8a5a00}\n    .hbm-badge-approved{background:#eaf9ef;color:#16753f}\n    .hbm-badge-replied{background:#edf3ff;color:#204fc7}\n    .hbm-badge-rejected{background:#ffe7e7;color:#b42318}\n    .hbm-badge-closed{background:#eaf9ef;color:#16753f}\n\n    .hbm-table-wrap{max-height:420px;overflow:auto;border:1px solid #ececec;border-radius:14px}\n    .hbm-table{width:100%;border-collapse:collapse;background:#fff;border-radius:14px;overflow:hidden}\n    .hbm-table th,.hbm-table td{border-bottom:1px solid #ececec;text-align:left;padding:12px 10px;font-size:13px;vertical-align:top}\n    .hbm-table th{background:#fff7db;color:#0d2d7b;position:sticky;top:0;z-index:1}\n\n    .hbm-thumb{width:70px;height:70px;border-radius:12px;object-fit:cover;border:2px solid #e6e6e6;background:#fafafa}\n    .hbm-pill{display:inline-block;padding:8px 12px;border-radius:999px;background:#fff7db;color:#7a5300;font-size:12px;margin:3px 4px 3px 0}\n    .hbm-note{background:#fff8d9;border:2px solid #f0cf6e;color:#6d5100;padding:14px;border-radius:14px;font-size:13px;margin-top:12px}\n    .hbm-divider{height:1px;background:linear-gradient(90deg,transparent,#c8d5ff,transparent);margin:18px 0}\n    .hbm-hidden{display:none!important}\n\n    .hbm-status-line{padding:12px 14px;border-radius:14px;margin-bottom:16px;font-size:13px}\n    .hbm-ok{background:#eefbf3;color:#115c36;border:2px solid #bfe3cb}\n    .hbm-warn{background:#fff4de;color:#8b5800;border:2px solid #f1d294}\n    .hbm-err{background:#fff0f0;color:#aa1d1d;border:2px solid #efc0c0}\n\n    .hbm-popup{position:fixed;inset:0;background:rgba(0,0,0,.38);display:none;align-items:center;justify-content:center;z-index:99999;padding:16px}\n    .hbm-popup-box{width:100%;max-width:700px;background:#fff;border-radius:22px;box-shadow:0 20px 55px rgba(0,0,0,.22);overflow:hidden;position:relative}\n    .hbm-popup-box::before{content:\"\";display:block;height:8px;background:linear-gradient(90deg,#d60f2a,#245dff)}\n    .hbm-popup-content{padding:20px;max-height:80vh;overflow:auto}\n    .hbm-popup-title{font-size:24px;margin:0 0 12px;color:#163889}\n    .hbm-small{font-size:12px;color:#6a6a6a}\n\n    \/* ---- Admin table layout ---- *\/\n    .hbm-table{table-layout:fixed;width:100%}\n    .hbm-table th:nth-child(1){width:80px}   \/* Photo *\/\n    .hbm-table th:nth-child(2){width:90px}   \/* Student ID *\/\n    .hbm-table th:nth-child(3){width:120px}  \/* Name *\/\n    .hbm-table th:nth-child(4){width:90px}   \/* DOB\/Age *\/\n    .hbm-table th:nth-child(5){width:90px}   \/* Education *\/\n    .hbm-table th:nth-child(6){width:110px}  \/* Institution *\/\n    .hbm-table th:nth-child(7){width:90px}   \/* PIN\/Mandal *\/\n    .hbm-table th:nth-child(8){width:110px}  \/* Mobiles *\/\n    .hbm-table th:nth-child(9){width:90px}   \/* Gotram\/Saakha *\/\n    .hbm-table th:nth-child(10){width:80px}  \/* Status *\/\n    .hbm-table th:nth-child(11){width:160px} \/* Actions *\/\n    .hbm-table td{word-break:break-word;vertical-align:middle;padding:10px 8px}\n    .hbm-table th{white-space:nowrap;padding:10px 8px}\n\n    \/* Truncate long text *\/\n    .hbm-trunc{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;max-height:3em}\n    .hbm-readmore{color:#245dff;cursor:pointer;font-size:11px;font-weight:900;white-space:nowrap;border:none;background:none;padding:2px 0;display:block;margin-top:2px}\n    .hbm-readmore:hover{text-decoration:underline}\n\n    \/* Photo thumb clickable *\/\n    .hbm-thumb{cursor:pointer;transition:transform .15s;display:block}\n    .hbm-thumb:hover{transform:scale(1.08)}\n\n    \/* Photo popup overlay *\/\n    .hbm-photo-popup{position:fixed;inset:0;background:rgba(0,0,0,.82);display:none;align-items:center;justify-content:center;z-index:999999;cursor:zoom-out}\n    .hbm-photo-popup img{max-width:90vw;max-height:88vh;border-radius:14px;box-shadow:0 8px 40px rgba(0,0,0,.6)}\n\n    \/* Action buttons stack neatly *\/\n    .hbm-action-col{display:flex;flex-direction:column;gap:5px;align-items:flex-start}\n\n    \/* Admin ticket table \u2014 min-width forces horizontal scroll on mobile *\/\n    .hbm-ttable{min-width:680px}\n    .hbm-ttable th:nth-child(1){width:110px}\n    .hbm-ttable th:nth-child(2){width:80px}\n    .hbm-ttable th:nth-child(3){width:90px}\n    .hbm-ttable th:nth-child(4){width:22%}\n    .hbm-ttable th:nth-child(5){width:22%}\n    .hbm-ttable th:nth-child(6){width:75px}\n    .hbm-ttable th:nth-child(7){width:130px}\n    \/* Admin members table \u2014 force scroll on mobile *\/\n    .hbm-table{min-width:700px}\n    \/* Scroll hint on mobile *\/\n    .hbm-table-wrap{-webkit-overflow-scrolling:touch;position:relative}\n    .hbm-scroll-hint{display:none;text-align:center;font-size:11px;color:#888;padding:4px 0 2px;font-style:italic}\n    @media(max-width:760px){.hbm-scroll-hint{display:block}}\n\n    \/* ---- Student profile card ---- *\/\n    .hbm-profile-card{display:flex;gap:20px;align-items:flex-start;flex-wrap:wrap}\n    .hbm-profile-photo-wrap{flex-shrink:0;text-align:center}\n    .hbm-profile-photo{width:110px;height:110px;border-radius:16px;object-fit:cover;border:3px solid #e0e0e0;display:block}\n    .hbm-profile-photo-placeholder{width:110px;height:110px;border-radius:16px;background:#f0f0f0;display:flex;align-items:center;justify-content:center;font-size:12px;color:#999;border:2px dashed #ccc}\n    .hbm-profile-details{flex:1;min-width:200px}\n    .hbm-profile-name{font-size:22px;font-weight:900;color:#102a6b;margin-bottom:2px}\n    .hbm-profile-id{font-size:13px;color:#6a6a6a;margin-bottom:10px}\n    .hbm-profile-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px 16px}\n    @media(max-width:600px){.hbm-profile-grid{grid-template-columns:1fr}.hbm-profile-card{flex-direction:column}}\n    .hbm-prow{display:flex;flex-direction:column;padding:6px 10px;background:#fafafa;border-radius:8px;border:1px solid #efefef}\n    .hbm-plabel{font-size:11px;color:#888;font-weight:700;text-transform:uppercase;letter-spacing:.4px;margin-bottom:2px}\n    .hbm-pval{font-size:13px;color:#1b1b1b;font-weight:700;word-break:break-word}\n\n    \/* ---- My tickets \u2014 card layout on all screens ---- *\/\n    .hbm-tickets-list{display:flex;flex-direction:column;gap:12px;margin-top:4px}\n    .hbm-ticket-card{background:#fff;border:2px solid #ececec;border-radius:14px;overflow:hidden;box-shadow:0 2px 10px rgba(0,0,0,.06)}\n    .hbm-ticket-card-header{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;background:#fff7db;border-bottom:1px solid #f0e4a0;flex-wrap:wrap;gap:6px}\n    .hbm-ticket-card-no{font-size:13px;font-weight:900;color:#0d2d7b}\n    .hbm-ticket-card-date{font-size:11px;color:#888}\n    .hbm-ticket-card-body{padding:12px 14px;display:flex;flex-direction:column;gap:10px}\n    .hbm-ticket-section{display:flex;flex-direction:column;gap:3px}\n    .hbm-ticket-label{font-size:10px;font-weight:900;text-transform:uppercase;letter-spacing:.5px;color:#888}\n    .hbm-ticket-text{font-size:13px;color:#1b1b1b;font-weight:700;line-height:1.5;word-break:break-word}\n    .hbm-ticket-reply{background:#f0f7ff;border-left:3px solid #245dff;padding:8px 12px;border-radius:0 8px 8px 0}\n    .hbm-ticket-reply .hbm-ticket-text{color:#163889}\n    .hbm-ticket-no-reply{color:#aaa;font-style:italic;font-size:12px}\n    <\/style>\n\n    <!-- ===================== HTML ===================== -->\n    <div id=\"hbm-app\" class=\"hbm-app\">\n      <div class=\"hbm-hero\">\n        <h1>Hyderabad Brahmins Student Membership<\/h1>\n        <p>Online student membership application, secure student login, request ticket system, and admin control panel.<\/p>\n      <\/div>\n      <!-- Debug panel - hidden by default, shown by URL param ?hbm_debug=1 -->\n      <div id=\"hbm-debugPanel\" class=\"hbm-hidden\" style=\"background:#1a1a2e;color:#00ff88;padding:16px;border-radius:12px;margin-bottom:16px;font-family:monospace;font-size:12px;white-space:pre-wrap;word-break:break-all\">\n        <b>HBM Debug Panel<\/b> (add ?hbm_debug=1 to URL to show)<br>\n        <button onclick=\"HBM_runDebug()\" style=\"margin-top:8px;padding:6px 14px;background:#00ff88;color:#000;border:none;border-radius:6px;cursor:pointer;font-weight:bold\">Run Connection Test<\/button>\n        <div id=\"hbm-debugOut\" style=\"margin-top:10px\"><\/div>\n      <\/div>\n\n      <div class=\"hbm-grid\">\n        <!-- LEFT COLUMN: Membership Form -->\n        <div>\n          <div class=\"hbm-card\">\n            <div class=\"hbm-card-body\">\n              <h2 class=\"hbm-title\">Student Membership Form<\/h2>\n              <div id=\"hbm-memberMsg\"><\/div>\n              <div class=\"hbm-subtext\">Please enter correct student details. Age must be below 20 years only.<\/div>\n\n              <div class=\"hbm-form-grid\">\n                <div>\n                  <label>Student ID No. (Auto Generate)<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-studentId\" type=\"text\" readonly placeholder=\"Auto generated after submit\" \/>\n                <\/div>\n                <div>\n                  <label>Password (Auto: Student Mobile Last 5 Digits)<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-autoPassword\" type=\"text\" readonly placeholder=\"Auto from student mobile\" \/>\n                <\/div>\n                <div>\n                  <label>Name<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-name\" type=\"text\" required placeholder=\"Enter student full name\" \/>\n                <\/div>\n                <div>\n                  <label>Father's Name<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-fatherName\" type=\"text\" required placeholder=\"Enter father's name\" \/>\n                <\/div>\n                <div>\n                  <label>Mother Name<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-motherName\" type=\"text\" required placeholder=\"Enter mother's name\" \/>\n                <\/div>\n                <div>\n                  <label>Date of Birth<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-dob\" type=\"text\" maxlength=\"10\" required placeholder=\"DDMMYYYY \/ DD\/MM\/YYYY \/ DD-MM-YYYY\" \/>\n                  <div class=\"hbm-hint\">Accepted: DDMMYYYY or DD\/MM\/YYYY or DD-MM-YYYY<\/div>\n                <\/div>\n                <div>\n                  <label>Auto Age<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-age\" type=\"text\" readonly placeholder=\"Age will appear automatically\" \/>\n                <\/div>\n                <div>\n                  <label>Present Education<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-education\" type=\"text\" required placeholder=\"Example: Inter 1st Year \/ Degree 1st Year\" \/>\n                <\/div>\n                <div>\n                  <label>School \/ College Name<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-institution\" type=\"text\" required placeholder=\"Enter school or college name\" \/>\n                <\/div>\n                <div>\n                  <label>Residential PIN Code<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-pincode\" type=\"text\" maxlength=\"6\" required placeholder=\"Enter 6 digit PIN code\" \/>\n                <\/div>\n                <div>\n                  <label>Auto Mandal<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-mandal\" type=\"text\" readonly placeholder=\"Auto detected mandal\" \/>\n                <\/div>\n                <div>\n                  <label>Father or Mother's Mobile No.<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-parentMobile\" type=\"text\" maxlength=\"10\" required placeholder=\"Enter 10 digit parent mobile number\" \/>\n                <\/div>\n                <div>\n                  <label>Student Mobile No.<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-studentMobile\" type=\"text\" maxlength=\"10\" required placeholder=\"Enter 10 digit student mobile number\" \/>\n                <\/div>\n                <div>\n                  <label>Gotram<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-gotram\" type=\"text\" required placeholder=\"Enter gotram\" \/>\n                <\/div>\n                <div class=\"hbm-full\">\n                  <label>Saakha<\/label>\n                  <select class=\"hbm-select\" id=\"hbm-saakha\" required>\n                    <option value=\"\">Select Saakha<\/option>\n                    <option value=\"Madhva\">Madhva<\/option>\n                    <option value=\"Vydiki\">Vydiki<\/option>\n                    <option value=\"Niyogi\">Niyogi<\/option>\n                    <option value=\"Sree Vyshnava\">Sree Vyshnava<\/option>\n                  <\/select>\n                <\/div>\n                <div class=\"hbm-full\">\n                  <label>Upload Photo<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-photo\" type=\"file\" accept=\"image\/*\" \/>\n                  <div class=\"hbm-hint\">Any image size allowed. System will compress automatically.<\/div>\n                <\/div>\n              <\/div>\n\n              <div class=\"hbm-btn-row\">\n                <button class=\"hbm-btn hbm-btn-primary\" id=\"hbm-submitMemberBtn\" type=\"button\">Submit Membership<\/button>\n                <button class=\"hbm-btn hbm-btn-secondary\" id=\"hbm-resetFormBtn\" type=\"button\">Clear Form<\/button>\n              <\/div>\n\n              <div class=\"hbm-note\">\n                Important: Once submitted, student cannot modify or delete membership details directly.\n                Modify \/ Delete \/ Approval is available only after admin lock is opened.\n              <\/div>\n            <\/div>\n          <\/div>\n        <\/div>\n\n        <!-- RIGHT COLUMN -->\n        <div>\n          <!-- Student Login -->\n          <div class=\"hbm-card\">\n            <div class=\"hbm-card-body\">\n              <h2 class=\"hbm-title\">Student Login<\/h2>\n              <div id=\"hbm-loginMsg\"><\/div>\n              <div id=\"hbm-loginFields\">\n              <div class=\"hbm-subtext\">Login with your Student ID. Password = last 5 digits of your student mobile number.<\/div>\n              <div class=\"hbm-form-grid\">\n                <div>\n                  <label>Student ID<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-loginStudentId\" type=\"text\" placeholder=\"Enter Student ID\" \/>\n                <\/div>\n                <div>\n                  <label>Password<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-loginPassword\" type=\"password\" placeholder=\"Enter mobile last 5 digits\" \/>\n                <\/div>\n              <\/div>\n              <div class=\"hbm-btn-row\" id=\"hbm-loginBtnRow\">\n                <button class=\"hbm-btn hbm-btn-primary\" id=\"hbm-studentLoginBtn\" type=\"button\">Student Login<\/button>\n              <\/div>\n              <\/div>\n              <div class=\"hbm-btn-row\">\n                <button class=\"hbm-btn hbm-btn-secondary\" id=\"hbm-studentLogoutBtn\" type=\"button\">Logout<\/button>\n              <\/div>\n            <\/div>\n          <\/div>\n\n          <!-- Student Dashboard -->\n          <div class=\"hbm-card hbm-hidden\" id=\"hbm-studentDashboard\">\n            <div class=\"hbm-card-body\">\n              <h2 class=\"hbm-title\">Student Dashboard<\/h2>\n              <div id=\"hbm-studentInfo\"><\/div>\n              <div class=\"hbm-divider\"><\/div>\n\n              <h3 class=\"hbm-title\" style=\"font-size:20px;\">Raise Request Ticket<\/h3>\n              <div id=\"hbm-ticketMsg\"><\/div>\n              <div class=\"hbm-form-grid\">\n                <div>\n                  <label>Request Ticket No.<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-ticketNo\" type=\"text\" readonly placeholder=\"Auto number\" \/>\n                <\/div>\n                <div>\n                  <label>Status<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-ticketStatusPreview\" type=\"text\" readonly value=\"Pending\" \/>\n                <\/div>\n                <div class=\"hbm-full\">\n                  <label>Request Body<\/label>\n                  <textarea class=\"hbm-textarea\" id=\"hbm-requestBody\" placeholder=\"Write your request clearly here\"><\/textarea>\n                  <div class=\"hbm-hint\">Student can submit any number of request tickets after login.<\/div>\n                <\/div>\n              <\/div>\n              <div class=\"hbm-btn-row\">\n                <button class=\"hbm-btn hbm-btn-primary\" id=\"hbm-submitTicketBtn\" type=\"button\">Submit Request Ticket<\/button>\n              <\/div>\n\n              <div class=\"hbm-divider\"><\/div>\n              <h3 class=\"hbm-title\" style=\"font-size:20px;\">My Request Tickets<\/h3>\n              <div id=\"hbm-myTicketsWrap\"><\/div>\n            <\/div>\n          <\/div>\n\n          <!-- Admin Lock -->\n          <div class=\"hbm-card\">\n            <div class=\"hbm-card-body\">\n              <h2 class=\"hbm-title\">Admin Lock<\/h2>\n              <div id=\"hbm-adminMsg\"><\/div>\n              <div class=\"hbm-subtext\">Enter admin lock to view private membership list and reply to request tickets.<\/div>\n              <div class=\"hbm-form-grid\">\n                <div>\n                  <label>Admin Lock Password<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-adminLockInput\" type=\"password\" placeholder=\"Enter admin lock\" \/>\n                <\/div>\n                <div>\n                  <label>Admin Status<\/label>\n                  <input class=\"hbm-field\" id=\"hbm-adminState\" type=\"text\" readonly value=\"Locked\" \/>\n                <\/div>\n              <\/div>\n              <div class=\"hbm-btn-row\">\n                <button class=\"hbm-btn hbm-btn-primary\" id=\"hbm-openAdminBtn\" type=\"button\">Open Admin<\/button>\n                <button class=\"hbm-btn hbm-btn-danger\" id=\"hbm-closeAdminBtn\" type=\"button\">Close Admin<\/button>\n              <\/div>\n            <\/div>\n          <\/div>\n        <\/div>\n      <\/div>\n\n      <!-- Admin Panel -->\n      <div class=\"hbm-card hbm-hidden\" id=\"hbm-adminPanel\">\n        <div class=\"hbm-card-body\">\n          <h2 class=\"hbm-title\">Admin Control Panel<\/h2>\n          <span class=\"hbm-pill\">Private membership records only<\/span>\n          <span class=\"hbm-pill\">Student requests and replies<\/span>\n          <span class=\"hbm-pill\">Approval \/ Edit \/ Delete controls<\/span>\n\n          <div class=\"hbm-divider\"><\/div>\n          <h3 class=\"hbm-title\" style=\"font-size:20px;\">Membership List<\/h3>\n          <div id=\"hbm-adminMembersCount\" class=\"hbm-subtext\"><\/div>\n          <div class=\"hbm-scroll-hint\">\u2190 Swipe to scroll \u2192<\/div>\n          <div class=\"hbm-table-wrap\">\n            <table class=\"hbm-table\">\n              <thead>\n                <tr>\n                  <th>Photo<\/th><th>Student ID<\/th><th>Name<\/th><th>DOB \/ Age<\/th>\n                  <th>Education<\/th><th>Institution<\/th><th>PIN \/ Mandal<\/th>\n                  <th>Mobiles<\/th><th>Gotram \/ Saakha<\/th><th>Status<\/th><th>Actions<\/th>\n                <\/tr>\n              <\/thead>\n              <tbody id=\"hbm-membersTableBody\"><\/tbody>\n            <\/table>\n          <\/div>\n\n          <div class=\"hbm-divider\"><\/div>\n          <h3 class=\"hbm-title\" style=\"font-size:20px;\">Request Tickets<\/h3>\n          <div class=\"hbm-scroll-hint\">\u2190 Swipe to scroll \u2192<\/div>\n          <div class=\"hbm-table-wrap\">\n            <table class=\"hbm-table hbm-ttable\">\n              <thead>\n                <tr>\n                  <th>Ticket No.<\/th><th>Student ID<\/th><th>Name<\/th>\n                  <th>Request<\/th><th>Admin Reply<\/th><th>Status<\/th><th>Actions<\/th>\n                <\/tr>\n              <\/thead>\n              <tbody id=\"hbm-ticketsTableBody\"><\/tbody>\n            <\/table>\n          <\/div>\n        <\/div>\n      <\/div>\n    <\/div><!-- #hbm-app -->\n\n    <!-- Full-size photo popup -->\n    <div class=\"hbm-photo-popup\" id=\"hbm-photoPopup\">\n      <img decoding=\"async\" id=\"hbm-photoPopupImg\" src=\"\" alt=\"Student Photo\" \/>\n    <\/div>\n\n    <!-- Popup Modal -->\n    <div class=\"hbm-popup\" id=\"hbm-popup\">\n      <div class=\"hbm-popup-box\">\n        <div class=\"hbm-popup-content\">\n          <h3 class=\"hbm-popup-title\" id=\"hbm-popupTitle\">Information<\/h3>\n          <div id=\"hbm-popupBody\"><\/div>\n          <div class=\"hbm-btn-row\">\n            <button class=\"hbm-btn hbm-btn-primary\" id=\"hbm-popupOkBtn\" type=\"button\">OK<\/button>\n          <\/div>\n        <\/div>\n      <\/div>\n    <\/div>\n\n    <!-- ===================== SCRIPT ===================== -->\n    <script>\n(function(){\n  'use strict';\n\n  \/* PHP-injected values *\/\n  var AJAX    = \"https:\\\/\\\/indianbrahmins.com\\\/wp-admin\\\/admin-ajax.php\";\n  var NONCE   = \"e3fd454228\";\n  var PIN_MAP = {\"500001\":\"Hyderabad\",\"500002\":\"Charminar\",\"500003\":\"Secunderabad\",\"500004\":\"Khairatabad\",\"500005\":\"Nampally\",\"500006\":\"Karwan\",\"500007\":\"Amberpet\",\"500008\":\"Shaikpet\",\"500009\":\"Tirumalagiri\",\"500010\":\"Balanagar\",\"500011\":\"Bowenpally\",\"500012\":\"Bahadurpura\",\"500013\":\"Amberpet\",\"500014\":\"Hakimpet\",\"500015\":\"Tirumalagiri\",\"500016\":\"Ameerpet\",\"500017\":\"Lalaguda\",\"500018\":\"Sanathnagar\",\"500019\":\"Lingampally\",\"500020\":\"Musheerabad\",\"500023\":\"Yakutpura\",\"500024\":\"Saidabad\",\"500025\":\"Secunderabad\",\"500026\":\"Marredpally\",\"500027\":\"Himayatnagar\",\"500028\":\"Asifnagar\",\"500029\":\"Himayatnagar\",\"500030\":\"Rajendranagar\",\"500031\":\"Jubilee Hills\",\"500032\":\"Gachibowli\",\"500033\":\"Jubilee Hills\",\"500034\":\"Banjara Hills\",\"500035\":\"Saroornagar\",\"500036\":\"Malakpet\",\"500037\":\"Balanagar\",\"500038\":\"Serilingampally\",\"500039\":\"Uppal\",\"500040\":\"Malkajgiri\",\"500041\":\"Quthbullapur\",\"500042\":\"Tirumalagiri\",\"500043\":\"Hayathnagar\",\"500044\":\"Musheerabad\",\"500045\":\"Yousufguda\",\"500046\":\"Secunderabad\",\"500047\":\"Malkajgiri\",\"500048\":\"Rajendranagar\",\"500049\":\"Serilingampally\",\"500050\":\"Miyapur\",\"500051\":\"Balanagar\",\"500052\":\"Kukatpally\",\"500053\":\"Bahadurpura\",\"500054\":\"Quthbullapur\",\"500055\":\"Quthbullapur\",\"500056\":\"Malkajgiri\",\"500057\":\"Malkajgiri\",\"500058\":\"Golconda\",\"500059\":\"Bandlaguda\",\"500060\":\"Saroornagar\",\"500061\":\"Malkajgiri\",\"500062\":\"Kapra\",\"500063\":\"Golkonda\",\"500064\":\"Shamshabad\",\"500065\":\"Charminar\",\"500066\":\"Bahadurpura\",\"500067\":\"Serilingampally\",\"500068\":\"Uppal\",\"500069\":\"Serilingampally\",\"500070\":\"Hayathnagar\",\"500072\":\"Kukatpally\",\"500073\":\"Kukatpally\",\"500074\":\"Hayathnagar\",\"500075\":\"Rajendranagar\",\"500076\":\"Shaikpet\",\"500077\":\"Medchal \\\/ Kapra\",\"500078\":\"Rajendranagar\",\"500079\":\"Rajendranagar\",\"500080\":\"Shaikpet\",\"500081\":\"Serilingampally\",\"500082\":\"Nampally\",\"500083\":\"Shaikpet\",\"500084\":\"Serilingampally\",\"500085\":\"Shaikpet\",\"500086\":\"Tarnaka \\\/ Malkajgiri\",\"500087\":\"Medchal \\\/ Kapra\",\"500088\":\"Malkajgiri\",\"500089\":\"Rajendranagar\",\"500090\":\"Quthbullapur\",\"500091\":\"Kukatpally\",\"500092\":\"Shaikpet\",\"500093\":\"Uppal\",\"500094\":\"Alwal\",\"500095\":\"Nampally\",\"500096\":\"Shaikpet\",\"500097\":\"Malkajgiri\",\"500098\":\"Serilingampally\"};\n\n  \/* ------------------------------------------------------------------\n     Safe element helper \u2013 never throws, returns null if missing\n  ------------------------------------------------------------------ *\/\n  function g(id){ return document.getElementById(id); }\n\n  \/* ------------------------------------------------------------------\n     AJAX \u2013 plain FormData POST to wp-admin\/admin-ajax.php\n  ------------------------------------------------------------------ *\/\n  function hxr(action, payload, cb){\n    var fd = new FormData();\n    fd.append('action',     'hbm_action');\n    fd.append('hbm_action', action);\n    fd.append('nonce',      NONCE);\n    Object.keys(payload).forEach(function(k){ fd.append(k, payload[k]); });\n    fetch(AJAX, {method:'POST', body:fd})\n      .then(function(r){ return r.text(); })\n      .then(function(txt){\n        var j;\n        try{ j = JSON.parse(txt); }\n        catch(e){ cb('Bad server response: ' + txt.slice(0,120)); return; }\n        if(j.success) cb(null, j.data);\n        else          cb((typeof j.data === 'string' ? j.data : JSON.stringify(j.data)) || 'Server error');\n      })\n      .catch(function(e){ cb(e.message || 'Network error'); });\n  }\n\n  \/* ------------------------------------------------------------------\n     UI helpers\n  ------------------------------------------------------------------ *\/\n  function setMsg(id, type, text){\n    var e=g(id);\n    if(e) e.innerHTML = '<div class=\"hbm-status-line hbm-'+type+'\">'+text+'<\/div>';\n  }\n  function clearMsg(id){ var e=g(id); if(e) e.innerHTML=''; }\n\n  function showPopup(title, body){\n    var pt=g('hbm-popupTitle'), pb=g('hbm-popupBody'), pp=g('hbm-popup');\n    if(pt) pt.innerHTML = title;\n    if(pb) pb.innerHTML = body;\n    if(pp) pp.style.display = 'flex';\n  }\n  function hidePopup(){ var pp=g('hbm-popup'); if(pp) pp.style.display='none'; }\n\n  function esc(s){\n    return String(s==null?'':s)\n      .replace(\/&\/g,'&amp;').replace(\/<\/g,'&lt;')\n      .replace(\/>\/g,'&gt;').replace(\/\"\/g,'&quot;').replace(\/'\/g,'&#39;');\n  }\n  function fmtDT(dt){\n    if(!dt) return '';\n    var d=new Date(dt); return isNaN(d.getTime())?dt:d.toLocaleString();\n  }\n  function badgeClass(s){\n    return 'hbm-badge hbm-badge-'+({Pending:'pending',Approved:'approved',Replied:'replied',Rejected:'rejected',Closed:'closed'}[s]||'pending');\n  }\n  function on(id, ev, fn){\n    var e=g(id); if(e) e.addEventListener(ev, fn);\n  }\n\n  \/* ------------------------------------------------------------------\n     DOB parser\n  ------------------------------------------------------------------ *\/\n  function parseDOB(v){\n    v=(v||'').trim();\n    var dd,mm,yyyy;\n    if(\/^\\d{8}$\/.test(v)){\n      dd=+v.slice(0,2); mm=+v.slice(2,4); yyyy=+v.slice(4,8);\n    } else {\n      var p=v.match(\/^(\\d{2})[\\\/\\-](\\d{2})[\\\/\\-](\\d{4})$\/);\n      if(!p) return null;\n      dd=+p[1]; mm=+p[2]; yyyy=+p[3];\n    }\n    var d=new Date(yyyy,mm-1,dd);\n    if(d.getFullYear()!==yyyy||d.getMonth()!==mm-1||d.getDate()!==dd) return null;\n    var now=new Date(), age=now.getFullYear()-yyyy,\n        dm=now.getMonth()-(mm-1);\n    if(dm<0||(dm===0&&now.getDate()<dd)) age--;\n    return {age:age};\n  }\n\n  \/* ------------------------------------------------------------------\n     Compress photo to base64\n  ------------------------------------------------------------------ *\/\n  function compressImage(file, cb){\n    if(!file) return cb('');\n    var reader=new FileReader();\n    reader.onload=function(ev){\n      var img=new Image();\n      img.onload=function(){\n        \/\/ Keep compressing until base64 is under 800KB to avoid\n        \/\/ hitting PHP post_max_size limits on shared hosting\n        var maxW=400, q=0.65, w=img.width, h=img.height;\n        if(w>maxW){h=Math.round(h*maxW\/w);w=maxW;}\n        var c=document.createElement('canvas');\n        c.width=w; c.height=h;\n        c.getContext('2d').drawImage(img,0,0,w,h);\n        var data=c.toDataURL('image\/jpeg',q);\n        \/\/ If still too big, compress more aggressively\n        if(data.length > 800000){\n          c.width=200; c.height=Math.round(h*200\/w);\n          c.getContext('2d').drawImage(img,0,0,c.width,c.height);\n          data=c.toDataURL('image\/jpeg',0.5);\n        }\n        \/\/ If somehow still too big, skip photo\n        if(data.length > 800000){ cb(''); return; }\n        cb(data);\n      };\n      img.onerror=function(){cb('');};\n      img.src=ev.target.result;\n    };\n    reader.onerror=function(){cb('');};\n    reader.readAsDataURL(file);\n  }\n\n  \/* ------------------------------------------------------------------\n     Live auto-fill: age \/ mandal \/ password preview\n  ------------------------------------------------------------------ *\/\n  function refreshComputed(){\n    \/* age *\/\n    var dobEl=g('hbm-dob');\n    if(dobEl){\n      var info=parseDOB(dobEl.value);\n      var ageEl=g('hbm-age'); if(ageEl) ageEl.value=info?info.age:'';\n    }\n    \/* mandal *\/\n    var pinEl=g('hbm-pincode');\n    if(pinEl){\n      var pin=pinEl.value.replace(\/\\D\/g,'').slice(0,6);\n      pinEl.value=pin;\n      var mEl=g('hbm-mandal');\n      if(mEl) mEl.value=pin.length===6?(PIN_MAP[pin]||'Hyderabad \/ Please verify manually'):'';\n    }\n    \/* password preview *\/\n    var smEl=g('hbm-studentMobile');\n    if(smEl){\n      var sm=smEl.value.replace(\/\\D\/g,'').slice(0,10);\n      smEl.value=sm;\n      var pwEl=g('hbm-autoPassword'); if(pwEl) pwEl.value=sm.length===10?sm.slice(-5):'';\n    }\n  }\n\n  \/* ------------------------------------------------------------------\n     Student dashboard renderer\n  ------------------------------------------------------------------ *\/\n  function renderDashboard(s){\n    var dash=g('hbm-studentDashboard'); if(!dash) return;\n    dash.classList.remove('hbm-hidden');\n    \/\/ Hide login form fields since user is now logged in\n    var lf=g('hbm-loginFields'); if(lf) lf.classList.add('hbm-hidden');\n    var info=g('hbm-studentInfo');\n    if(info) info.innerHTML=\n      \/\/ Profile card layout\n      '<div class=\"hbm-profile-card\">'+\n        \/\/ Left: photo\n        '<div class=\"hbm-profile-photo-wrap\">'+\n          (s.photo_data\n            ? '<img decoding=\"async\" src=\"'+s.photo_data+'\" class=\"hbm-profile-photo hbm-thumb\" title=\"Click to enlarge\" \/>'\n            : '<div class=\"hbm-profile-photo-placeholder\">No Photo<\/div>')+\n          '<div style=\"margin-top:8px;text-align:center\">'+\n            '<span class=\"'+badgeClass(s.status)+'\">'+esc(s.status)+'<\/span>'+\n          '<\/div>'+\n        '<\/div>'+\n        \/\/ Right: details grid\n        '<div class=\"hbm-profile-details\">'+\n          '<div class=\"hbm-profile-name\">'+esc(s.name)+'<\/div>'+\n          '<div class=\"hbm-profile-id\">ID: <b>'+esc(s.student_id)+'<\/b><\/div>'+\n          '<div class=\"hbm-profile-grid\">'+\n            '<div class=\"hbm-prow\"><span class=\"hbm-plabel\">Father<\/span><span class=\"hbm-pval\">'+esc(s.father_name||'\u2014')+'<\/span><\/div>'+\n            '<div class=\"hbm-prow\"><span class=\"hbm-plabel\">Mother<\/span><span class=\"hbm-pval\">'+esc(s.mother_name||'\u2014')+'<\/span><\/div>'+\n            '<div class=\"hbm-prow\"><span class=\"hbm-plabel\">Date of Birth<\/span><span class=\"hbm-pval\">'+esc(s.dob)+' &nbsp;<b>(Age '+esc(s.age)+')<\/b><\/span><\/div>'+\n            '<div class=\"hbm-prow\"><span class=\"hbm-plabel\">Education<\/span><span class=\"hbm-pval\">'+esc(s.education)+'<\/span><\/div>'+\n            '<div class=\"hbm-prow\"><span class=\"hbm-plabel\">Institution<\/span><span class=\"hbm-pval\">'+esc(s.institution)+'<\/span><\/div>'+\n            '<div class=\"hbm-prow\"><span class=\"hbm-plabel\">PIN \/ Mandal<\/span><span class=\"hbm-pval\">'+esc(s.pincode)+' \/ '+esc(s.mandal)+'<\/span><\/div>'+\n            '<div class=\"hbm-prow\"><span class=\"hbm-plabel\">Gotram<\/span><span class=\"hbm-pval\">'+esc(s.gotram)+'<\/span><\/div>'+\n            '<div class=\"hbm-prow\"><span class=\"hbm-plabel\">Saakha<\/span><span class=\"hbm-pval\">'+esc(s.saakha)+'<\/span><\/div>'+\n            '<div class=\"hbm-prow\"><span class=\"hbm-plabel\">Student Mobile<\/span><span class=\"hbm-pval\">'+esc(s.student_mobile)+'<\/span><\/div>'+\n            '<div class=\"hbm-prow\"><span class=\"hbm-plabel\">Parent Mobile<\/span><span class=\"hbm-pval\">'+esc(s.parent_mobile||'\u2014')+'<\/span><\/div>'+\n          '<\/div>'+\n        '<\/div>'+\n      '<\/div>';\n    loadMyTickets();\n  }\n\n  function loadMyTickets(){\n    hxr('get_my_tickets',{}, function(err,tickets){\n      var wrap=g('hbm-myTicketsWrap'); if(!wrap) return;\n      if(err){wrap.innerHTML='<div class=\"hbm-note\">'+esc(err)+'<\/div>';return;}\n      if(!tickets||!tickets.length){wrap.innerHTML='<div class=\"hbm-note\">No request tickets submitted yet.<\/div>';return;}\n      var h='<div class=\"hbm-tickets-list\">';\n      tickets.forEach(function(t){\n        var replyHtml = t.admin_reply\n          ? '<div class=\"hbm-ticket-section hbm-ticket-reply\">'+\n              '<div class=\"hbm-ticket-label\">Admin Reply<\/div>'+\n              '<div class=\"hbm-ticket-text\">'+truncCell(t.admin_reply, 200)+'<\/div>'+\n            '<\/div>'\n          : '<div class=\"hbm-ticket-section\">'+\n              '<div class=\"hbm-ticket-label\">Admin Reply<\/div>'+\n              '<div class=\"hbm-ticket-no-reply\">No reply yet<\/div>'+\n            '<\/div>';\n        h+=\n          '<div class=\"hbm-ticket-card\">'+\n            '<div class=\"hbm-ticket-card-header\">'+\n              '<div>'+\n                '<div class=\"hbm-ticket-card-no\">'+esc(t.ticket_no)+'<\/div>'+\n                '<div class=\"hbm-ticket-card-date\">'+fmtDT(t.created_at)+'<\/div>'+\n              '<\/div>'+\n              '<span class=\"'+badgeClass(t.status)+'\">'+esc(t.status)+'<\/span>'+\n            '<\/div>'+\n            '<div class=\"hbm-ticket-card-body\">'+\n              '<div class=\"hbm-ticket-section\">'+\n                '<div class=\"hbm-ticket-label\">My Request<\/div>'+\n                '<div class=\"hbm-ticket-text\">'+truncCell(t.request_body, 200)+'<\/div>'+\n              '<\/div>'+\n              replyHtml+\n            '<\/div>'+\n          '<\/div>';\n      });\n      wrap.innerHTML=h+'<\/div>';\n    });\n  }\n\n  \/* Auto-refresh my tickets every 20s when dashboard is visible *\/\n  setInterval(function(){\n    var dash=g('hbm-studentDashboard');\n    if(dash && !dash.classList.contains('hbm-hidden')){\n      loadMyTickets();\n    }\n  }, 20000);\n\n  \/* ------------------------------------------------------------------\n     Admin tables\n  ------------------------------------------------------------------ *\/\n  var adminOpen=false;\n\n  \/* ---- Truncation helpers ---- *\/\n  function trunc(str, max){\n    str = String(str==null?'':str);\n    if(str.length<=max) return esc(str);\n    return esc(str.slice(0,max))+'<span class=\"hbm-small\" style=\"color:#aaa\">\u2026<\/span>';\n  }\n\n  function truncCell(str, max){\n    str = String(str==null?'':str);\n    if(str.length<=max) return '<span>'+esc(str)+'<\/span>';\n    \/\/ Show truncated + Read More button\n    var short = esc(str.slice(0,max));\n    var full  = esc(str);\n    return '<span>'+\n      '<span class=\"hbm-trunc\">'+short+'\u2026<\/span>'+\n      '<button class=\"hbm-readmore hbm-readmore-btn\" data-full=\"'+full+'\">Read more \u25bc<\/button>'+\n      '<\/span>';\n  }\n\n  \/* Read-more click \u2014 opens full text in popup *\/\n  document.addEventListener('click', function(ev){\n    var btn = ev.target.closest('.hbm-readmore-btn');\n    if(btn){\n      var full = btn.getAttribute('data-full') || '';\n      showPopup('Full Text',\n        '<div style=\"white-space:pre-wrap;word-break:break-word;font-size:14px;line-height:1.7\">'+full+'<\/div>'\n      );\n    }\n  });\n\n  function loadAdminMembers(){\n    hxr('get_all_members',{},function(err,rows){\n      if(err) return;\n      var cnt=g('hbm-adminMembersCount'); if(cnt) cnt.innerHTML='Total Records: <b>'+rows.length+'<\/b>';\n      var tb=g('hbm-membersTableBody'); if(!tb) return;\n      if(!rows.length){tb.innerHTML='<tr><td colspan=\"11\">No records.<\/td><\/tr>';return;}\n      tb.innerHTML='';\n      rows.forEach(function(m){\n        var tr=document.createElement('tr');\n        tr.innerHTML=\n          \/\/ Photo - clickable\n          '<td style=\"text-align:center\">'+(m.photo_data\n            ?'<img decoding=\"async\" src=\"'+m.photo_data+'\" class=\"hbm-thumb\" title=\"Click to enlarge\" style=\"margin:auto\">'\n            :'<div style=\"width:60px;height:60px;border-radius:10px;background:#f0f0f0;display:flex;align-items:center;justify-content:center;margin:auto;font-size:10px;color:#999\">No<br>Photo<\/div>')+'<\/td>'+\n          \/\/ Student ID\n          '<td><b style=\"font-size:12px\">'+esc(m.student_id)+'<\/b><\/td>'+\n          \/\/ Name \/ Father \/ Mother - truncated\n          '<td>'+\n            '<div style=\"font-weight:900;font-size:13px\">'+trunc(m.name,30)+'<\/div>'+\n            '<div class=\"hbm-small\" style=\"margin-top:2px\">F: '+trunc(m.father_name,25)+'<\/div>'+\n            '<div class=\"hbm-small\">M: '+trunc(m.mother_name,25)+'<\/div>'+\n          '<\/td>'+\n          \/\/ DOB \/ Age\n          '<td>'+\n            '<div style=\"font-size:12px\">'+esc(m.dob)+'<\/div>'+\n            '<div class=\"hbm-small\">Age: <b>'+esc(m.age)+'<\/b><\/div>'+\n          '<\/td>'+\n          \/\/ Education\n          '<td>'+truncCell(m.education,40)+'<\/td>'+\n          \/\/ Institution\n          '<td>'+truncCell(m.institution,50)+'<\/td>'+\n          \/\/ PIN \/ Mandal\n          '<td>'+\n            '<div style=\"font-weight:900;font-size:12px\">'+esc(m.pincode)+'<\/div>'+\n            '<div class=\"hbm-small\">'+esc(m.mandal)+'<\/div>'+\n          '<\/td>'+\n          \/\/ Mobiles\n          '<td>'+\n            '<div class=\"hbm-small\"><b>Parent:<\/b><br>'+esc(m.parent_mobile)+'<\/div>'+\n            '<div class=\"hbm-small\" style=\"margin-top:3px\"><b>Student:<\/b><br>'+esc(m.student_mobile)+'<\/div>'+\n          '<\/td>'+\n          \/\/ Gotram \/ Saakha\n          '<td>'+\n            '<div style=\"font-size:12px\">'+esc(m.gotram)+'<\/div>'+\n            '<div class=\"hbm-small\">'+esc(m.saakha)+'<\/div>'+\n          '<\/td>'+\n          \/\/ Status\n          '<td style=\"text-align:center\"><span class=\"'+badgeClass(m.status)+'\">'+esc(m.status)+'<\/span><\/td>'+\n          \/\/ Actions - stacked vertically\n          '<td>'+\n            '<div class=\"hbm-action-col\">'+\n              '<div style=\"display:flex;gap:4px\">'+\n                '<button class=\"hbm-btn hbm-btn-small hbm-btn-success hbm-approve-btn\" data-sid=\"'+esc(m.student_id)+'\">Approve<\/button>'+\n                '<button class=\"hbm-btn hbm-btn-small hbm-btn-danger hbm-reject-btn\" data-sid=\"'+esc(m.student_id)+'\">Reject<\/button>'+\n              '<\/div>'+\n              '<div style=\"display:flex;gap:4px\">'+\n                '<button class=\"hbm-btn hbm-btn-small hbm-btn-secondary hbm-edit-btn\" data-sid=\"'+esc(m.student_id)+'\">Edit<\/button>'+\n                '<button class=\"hbm-btn hbm-btn-small hbm-btn-danger hbm-del-member-btn\" data-sid=\"'+esc(m.student_id)+'\">Delete<\/button>'+\n              '<\/div>'+\n            '<\/div>'+\n          '<\/td>';\n        tb.appendChild(tr);\n      });\n    });\n  }\n\n  function loadAdminTickets(){\n    hxr('get_all_tickets',{},function(err,rows){\n      var tb=g('hbm-ticketsTableBody'); if(!tb) return;\n      if(err||!rows||!rows.length){tb.innerHTML='<tr><td colspan=\"7\">'+(err?esc(err):'No tickets.')+'<\/td><\/tr>';return;}\n      tb.innerHTML='';\n      rows.forEach(function(t){\n        var tr=document.createElement('tr');\n        tr.innerHTML=\n          '<td>'+\n            '<b style=\"font-size:12px\">'+esc(t.ticket_no)+'<\/b>'+\n            '<div class=\"hbm-small\">'+fmtDT(t.created_at)+'<\/div>'+\n          '<\/td>'+\n          '<td style=\"font-size:12px\">'+esc(t.student_id)+'<\/td>'+\n          '<td>'+truncCell(t.student_name,30)+'<\/td>'+\n          '<td>'+truncCell(t.request_body,120)+'<\/td>'+\n          '<td>'+(t.admin_reply?truncCell(t.admin_reply,120):'<span class=\"hbm-small\" style=\"color:#aaa\">No reply yet<\/span>')+'<\/td>'+\n          '<td style=\"text-align:center\"><span class=\"'+badgeClass(t.status)+'\">'+esc(t.status)+'<\/span><\/td>'+\n          '<td>'+\n            '<div class=\"hbm-action-col\">'+\n              '<button class=\"hbm-btn hbm-btn-small hbm-btn-primary hbm-reply-btn\"'+\n                ' data-no=\"'+esc(t.ticket_no)+'\"'+\n                ' data-req=\"'+esc(t.request_body)+'\"'+\n                ' data-reply=\"'+esc(t.admin_reply||'')+'\"'+\n                '>Reply<\/button>'+\n              '<button class=\"hbm-btn hbm-btn-small hbm-btn-success hbm-close-ticket-btn\" data-no=\"'+esc(t.ticket_no)+'\">Close<\/button>'+\n              '<button class=\"hbm-btn hbm-btn-small hbm-btn-danger hbm-del-ticket-btn\" data-no=\"'+esc(t.ticket_no)+'\">Delete<\/button>'+\n            '<\/div>'+\n          '<\/td>';\n        tb.appendChild(tr);\n      });\n    });\n  }\n\n  \/* ------------------------------------------------------------------\n     Event delegation for dynamically created table buttons\n     (avoids broken onclick strings with escaped data)\n  ------------------------------------------------------------------ *\/\n  document.addEventListener('click', function(ev){\n    var btn;\n    \/\/ Reply ticket\n    btn = ev.target.closest('.hbm-reply-btn');\n    if(btn){ HBM.replyT(btn.getAttribute('data-no'), btn.getAttribute('data-req'), btn.getAttribute('data-reply')); return; }\n    \/\/ Close ticket\n    btn = ev.target.closest('.hbm-close-ticket-btn');\n    if(btn){ HBM.closeT(btn.getAttribute('data-no')); return; }\n    \/\/ Delete ticket\n    btn = ev.target.closest('.hbm-del-ticket-btn');\n    if(btn){ HBM.delT(btn.getAttribute('data-no')); return; }\n    \/\/ Approve member\n    btn = ev.target.closest('.hbm-approve-btn');\n    if(btn){ HBM.approve(btn.getAttribute('data-sid')); return; }\n    \/\/ Reject member\n    btn = ev.target.closest('.hbm-reject-btn');\n    if(btn){ HBM.reject(btn.getAttribute('data-sid')); return; }\n    \/\/ Edit member\n    btn = ev.target.closest('.hbm-edit-btn');\n    if(btn){ HBM.editMById(btn.getAttribute('data-sid')); return; }\n    \/\/ Delete member\n    btn = ev.target.closest('.hbm-del-member-btn');\n    if(btn){ HBM.delM(btn.getAttribute('data-sid')); return; }\n  });\n\n  \/* ------------------------------------------------------------------\n     Global HBM object (called from inline onclick in dynamic tables)\n  ------------------------------------------------------------------ *\/\n  window.HBM={\n    approve:function(sid){\n      hxr('approve_member',{studentId:sid},function(err){\n        if(err){alert(err);return;}\n        loadAdminMembers();\n        showPopup('Approved','<p>Student <b>'+esc(sid)+'<\/b> approved.<\/p>');\n      });\n    },\n    reject:function(sid){\n      if(!confirm('Reject this student?')) return;\n      hxr('reject_member',{studentId:sid},function(err){\n        if(err){alert(err);return;}\n        loadAdminMembers();\n        showPopup('Rejected','<p>Student <b>'+esc(sid)+'<\/b> rejected.<\/p>');\n      });\n    },\n    editMById:function(sid){\n      \/\/ Fetch member data fresh from server then open edit popup\n      var fd=new FormData();\n      fd.append('action','hbm_action'); fd.append('hbm_action','get_member');\n      fd.append('nonce',NONCE); fd.append('studentId',sid);\n      fetch(AJAX,{method:'POST',body:fd})\n        .then(function(r){return r.json();})\n        .then(function(j){\n          if(j.success) HBM.editM(j.data);\n          else alert(j.data||'Could not load member data.');\n        }).catch(function(e){alert(e.message);});\n    },\n    editM:function(m){\n      showPopup('Edit Membership',\n        '<div class=\"hbm-form-grid\">'+\n        '<div><label>Name<\/label><input class=\"hbm-field\" id=\"he-name\" value=\"'+esc(m.name)+'\"><\/div>'+\n        '<div><label>Education<\/label><input class=\"hbm-field\" id=\"he-edu\" value=\"'+esc(m.education)+'\"><\/div>'+\n        '<div><label>Institution<\/label><input class=\"hbm-field\" id=\"he-inst\" value=\"'+esc(m.institution)+'\"><\/div>'+\n        '<div><label>PIN Code<\/label><input class=\"hbm-field\" id=\"he-pin\" value=\"'+esc(m.pincode)+'\"><\/div>'+\n        '<div><label>Mandal<\/label><input class=\"hbm-field\" id=\"he-mandal\" value=\"'+esc(m.mandal)+'\"><\/div>'+\n        '<div><label>Parent Mobile<\/label><input class=\"hbm-field\" id=\"he-pmob\" value=\"'+esc(m.parent_mobile)+'\"><\/div>'+\n        '<div><label>Student Mobile<\/label><input class=\"hbm-field\" id=\"he-smob\" value=\"'+esc(m.student_mobile)+'\"><\/div>'+\n        '<div><label>Gotram<\/label><input class=\"hbm-field\" id=\"he-gotram\" value=\"'+esc(m.gotram)+'\"><\/div>'+\n        '<div class=\"hbm-full\"><label>Saakha<\/label><select class=\"hbm-select\" id=\"he-saakha\">'+\n        ['Madhva','Vydiki','Niyogi','Sree Vyshnava'].map(function(s){\n          return '<option value=\"'+s+'\"'+(s===m.saakha?' selected':'')+'>'+s+'<\/option>';\n        }).join('')+'<\/select><\/div><\/div>'+\n        '<div class=\"hbm-btn-row\"><button class=\"hbm-btn hbm-btn-primary\" id=\"hbm-saveMemberBtn\" data-sid=\"'+esc(m.student_id)+'\">Save Changes<\/button><\/div>'\n      );\n      setTimeout(function(){\n        var btn=document.getElementById('hbm-saveMemberBtn');\n        if(btn) btn.addEventListener('click',function(){ HBM.saveM(this.getAttribute('data-sid')); });\n      },50);\n    },\n    saveM:function(sid){\n      hxr('edit_member',{\n        studentId:sid,\n        name:document.getElementById('he-name').value.trim(),\n        education:document.getElementById('he-edu').value.trim(),\n        institution:document.getElementById('he-inst').value.trim(),\n        pincode:document.getElementById('he-pin').value.replace(\/\\D\/g,''),\n        parentMobile:document.getElementById('he-pmob').value.replace(\/\\D\/g,''),\n        studentMobile:document.getElementById('he-smob').value.replace(\/\\D\/g,''),\n        gotram:document.getElementById('he-gotram').value.trim(),\n        saakha:document.getElementById('he-saakha').value\n      },function(err,data){\n        if(err){alert(err);return;}\n        loadAdminMembers();\n        showPopup('Saved','<p>Record updated. New password: <b>'+esc(data.newPassword)+'<\/b><\/p>');\n      });\n    },\n    delM:function(sid){\n      if(!confirm('Delete membership + all tickets for '+sid+'?')) return;\n      hxr('delete_member',{studentId:sid},function(err){\n        if(err){alert(err);return;}\n        loadAdminMembers(); loadAdminTickets();\n        showPopup('Deleted','<p>Membership <b>'+esc(sid)+'<\/b> deleted.<\/p>');\n      });\n    },\n    replyT:function(no,req,existing){\n      \/\/ Store ticket number in a data attribute on the Save button\n      \/\/ to avoid esc() mangling the onclick string\n      showPopup('Reply to Ticket',\n        '<div class=\"hbm-kv\"><div>Ticket<\/div><div>'+esc(no)+'<\/div><\/div>'+\n        '<div class=\"hbm-kv\"><div>Request<\/div><div>'+esc(req).replace(\/\\n\/g,'<br>')+'<\/div><\/div>'+\n        '<div style=\"margin-top:12px\"><label>Admin Reply<\/label>'+\n        '<textarea class=\"hbm-textarea\" id=\"hbm-replyTxt\" placeholder=\"Type reply here\">'+esc(existing)+'<\/textarea><\/div>'+\n        '<div class=\"hbm-btn-row\"><button class=\"hbm-btn hbm-btn-primary\" id=\"hbm-saveReplyBtn\" data-no=\"'+esc(no)+'\">Save Reply<\/button><\/div>'\n      );\n      \/\/ Attach click handler after popup is rendered\n      setTimeout(function(){\n        var btn=document.getElementById('hbm-saveReplyBtn');\n        if(btn) btn.addEventListener('click', function(){\n          HBM.saveReply(this.getAttribute('data-no'));\n        });\n      }, 50);\n    },\n    saveReply:function(no){\n      var t=document.getElementById('hbm-replyTxt');\n      if(!t||!t.value.trim()){alert('Please enter a reply.');return;}\n      hxr('reply_ticket',{ticketNo:no,adminReply:t.value.trim()},function(err){\n        if(err){alert(err);return;}\n        loadAdminTickets();\n        showPopup('Reply Saved','<p>Reply saved for <b>'+esc(no)+'<\/b>.<\/p>');\n      });\n    },\n    closeT:function(no){\n      hxr('close_ticket',{ticketNo:no},function(err){\n        if(err){alert(err);return;}\n        loadAdminTickets();\n        showPopup('Closed','<p>Ticket <b>'+esc(no)+'<\/b> closed.<\/p>');\n      });\n    },\n    delT:function(no){\n      if(!confirm('Delete ticket '+no+'?')) return;\n      hxr('delete_ticket',{ticketNo:no},function(err){\n        if(err){alert(err);return;}\n        loadAdminTickets();\n        showPopup('Deleted','<p>Ticket <b>'+esc(no)+'<\/b> deleted.<\/p>');\n      });\n    }\n  };\n\n  \/* ==================================================================\n     MAIN INIT \u2013 attach all listeners after DOM is ready\n     This is the critical fix: nothing runs until elements exist.\n  ================================================================== *\/\n  function init(){\n\n    \/* Popup close *\/\n    on('hbm-popupOkBtn','click',hidePopup);\n\n    \/* Photo popup *\/\n    on('hbm-photoPopup','click',function(){\n      var pp=g('hbm-photoPopup'); if(pp) pp.style.display='none';\n    });\n    document.addEventListener('click',function(ev){\n      var img=ev.target.closest('.hbm-thumb');\n      if(img){\n        var pp=g('hbm-photoPopup'), pi=g('hbm-photoPopupImg');\n        if(pp&&pi){ pi.src=img.src; pp.style.display='flex'; }\n      }\n    });\n    on('hbm-popup','click',function(ev){ if(ev.target===g('hbm-popup')) hidePopup(); });\n\n    \/* Live computed fields *\/\n    ['hbm-dob','hbm-pincode','hbm-studentMobile'].forEach(function(id){\n      ['input','keyup','change','blur'].forEach(function(ev){ on(id,ev,refreshComputed); });\n    });\n    refreshComputed();\n\n    \/* ---- Membership submit ---- *\/\n    on('hbm-submitMemberBtn','click',function(){\n      clearMsg('hbm-memberMsg');\n      refreshComputed();\n\n      var name        = (g('hbm-name')||{}).value||'';         name=name.trim();\n      var fatherName  = (g('hbm-fatherName')||{}).value||'';   fatherName=fatherName.trim();\n      var motherName  = (g('hbm-motherName')||{}).value||'';   motherName=motherName.trim();\n      var dob         = (g('hbm-dob')||{}).value||'';          dob=dob.trim();\n      var education   = (g('hbm-education')||{}).value||'';    education=education.trim();\n      var institution = (g('hbm-institution')||{}).value||'';  institution=institution.trim();\n      var pincode     = (g('hbm-pincode')||{}).value||'';      pincode=pincode.trim();\n      var parentMob   = ((g('hbm-parentMobile')||{}).value||'').replace(\/\\D\/g,'');\n      var studentMob  = ((g('hbm-studentMobile')||{}).value||'').replace(\/\\D\/g,'');\n      var gotram      = (g('hbm-gotram')||{}).value||'';       gotram=gotram.trim();\n      var saakha      = (g('hbm-saakha')||{}).value||'';\n      var photoInput  = g('hbm-photo');\n      var photoFile   = photoInput && photoInput.files[0] ? photoInput.files[0] : null;\n      var dobInfo     = parseDOB(dob);\n\n      if(!name||!fatherName||!motherName||!dob||!education||!institution||!pincode||!parentMob||!studentMob||!gotram){\n        setMsg('hbm-memberMsg','err','Please fill in all required fields.'); return;\n      }\n      if(!dobInfo){ setMsg('hbm-memberMsg','err','Invalid Date of Birth. Use DDMMYYYY, DD\/MM\/YYYY or DD-MM-YYYY.'); return; }\n      if(dobInfo.age>=20||dobInfo.age<0){ setMsg('hbm-memberMsg','err','Only students below 20 years allowed.'); return; }\n      if(!\/^\\d{6}$\/.test(pincode)){ setMsg('hbm-memberMsg','err','PIN code must be 6 digits.'); return; }\n      if(parentMob.length!==10){ setMsg('hbm-memberMsg','err','Parent mobile must be 10 digits.'); return; }\n      if(studentMob.length!==10){ setMsg('hbm-memberMsg','err','Student mobile must be 10 digits.'); return; }\n      if(!saakha){ setMsg('hbm-memberMsg','err','Please select Saakha.'); return; }\n\n      var btn=g('hbm-submitMemberBtn');\n      if(btn){ btn.disabled=true; btn.textContent='Submitting\\u2026'; }\n\n      compressImage(photoFile, function(photoData){\n        hxr('submit_membership',{\n          name:name, fatherName:fatherName, motherName:motherName, dob:dob,\n          education:education, institution:institution, pincode:pincode,\n          parentMobile:parentMob, studentMobile:studentMob,\n          gotram:gotram, saakha:saakha, photoData:photoData\n        }, function(err,data){\n          if(btn){ btn.disabled=false; btn.textContent='Submit Membership'; }\n          if(err){ setMsg('hbm-memberMsg','err',esc(err)); return; }\n\n          var sid=g('hbm-studentId'); if(sid) sid.value=data.studentId;\n          var apw=g('hbm-autoPassword'); if(apw) apw.value=data.password;\n\n          showPopup('Membership Submitted',\n            '<div class=\"hbm-kv\"><div>Student ID<\/div><div><b>'+esc(data.studentId)+'<\/b><\/div><\/div>'+\n            '<div class=\"hbm-kv\"><div>Password<\/div><div><b>'+esc(data.password)+'<\/b> <span class=\"hbm-small\">(last 5 digits of mobile)<\/span><\/div><\/div>'+\n            '<div class=\"hbm-kv\"><div>Name<\/div><div>'+esc(data.name)+'<\/div><\/div>'+\n            '<div class=\"hbm-kv\"><div>Age<\/div><div>'+esc(data.age)+'<\/div><\/div>'+\n            '<div class=\"hbm-kv\"><div>Education<\/div><div>'+esc(data.education)+'<\/div><\/div>'+\n            '<div class=\"hbm-kv\"><div>PIN \/ Mandal<\/div><div>'+esc(data.pincode)+' \/ '+esc(data.mandal)+'<\/div><\/div>'+\n            '<div class=\"hbm-note\">Save your Student ID and password. Admin approval is required.<\/div>'\n          );\n\n          ['hbm-name','hbm-fatherName','hbm-motherName','hbm-dob','hbm-education',\n           'hbm-institution','hbm-pincode','hbm-parentMobile','hbm-studentMobile',\n           'hbm-gotram','hbm-age','hbm-mandal','hbm-autoPassword','hbm-studentId'\n          ].forEach(function(id){ var e=g(id); if(e) e.value=''; });\n          var sk=g('hbm-saakha'); if(sk) sk.value='';\n          try{ var ph=g('hbm-photo'); if(ph) ph.value=''; }catch(x){}\n        });\n      });\n    });\n\n    \/* ---- Clear form ---- *\/\n    on('hbm-resetFormBtn','click',function(){\n      ['hbm-name','hbm-fatherName','hbm-motherName','hbm-dob','hbm-education',\n       'hbm-institution','hbm-pincode','hbm-parentMobile','hbm-studentMobile',\n       'hbm-gotram','hbm-age','hbm-mandal','hbm-autoPassword','hbm-studentId'\n      ].forEach(function(id){ var e=g(id); if(e) e.value=''; });\n      var sk=g('hbm-saakha'); if(sk) sk.value='';\n      try{ var ph=g('hbm-photo'); if(ph) ph.value=''; }catch(x){}\n      clearMsg('hbm-memberMsg');\n    });\n\n    \/* ---- Student login ---- *\/\n    on('hbm-studentLoginBtn','click',function(){\n      clearMsg('hbm-loginMsg');\n      var id=((g('hbm-loginStudentId')||{}).value||'').trim();\n      var pw=((g('hbm-loginPassword')||{}).value||'').trim();\n      if(!id||!pw){ setMsg('hbm-loginMsg','err','Please enter Student ID and password.'); return; }\n      hxr('student_login',{studentId:id,password:pw},function(err,data){\n        if(err){ setMsg('hbm-loginMsg','err',esc(err)); return; }\n        setMsg('hbm-loginMsg','ok','Login successful.');\n        renderDashboard(data);\n      });\n    });\n\n    \/* ---- Student logout ---- *\/\n    on('hbm-studentLogoutBtn','click',function(){\n      hxr('student_logout',{},function(){\n        clearMsg('hbm-loginMsg');\n        var si=g('hbm-loginStudentId'); if(si) si.value='';\n        var lp=g('hbm-loginPassword'); if(lp) lp.value='';\n        var dash=g('hbm-studentDashboard'); if(dash) dash.classList.add('hbm-hidden');\n        \/\/ Show login fields again\n        var lf=g('hbm-loginFields'); if(lf) lf.classList.remove('hbm-hidden');\n        var lb=g('hbm-loginBtnRow'); if(lb) lb.classList.remove('hbm-hidden');\n      });\n    });\n\n    \/* ---- Submit ticket ---- *\/\n    on('hbm-submitTicketBtn','click',function(){\n      clearMsg('hbm-ticketMsg');\n      var body=((g('hbm-requestBody')||{}).value||'').trim();\n      if(!body){ setMsg('hbm-ticketMsg','err','Please enter request body.'); return; }\n      hxr('submit_ticket',{requestBody:body},function(err,data){\n        if(err){ setMsg('hbm-ticketMsg','err',esc(err)); return; }\n        setMsg('hbm-ticketMsg','ok','Request ticket submitted.');\n        var rb=g('hbm-requestBody'); if(rb) rb.value='';\n        showPopup('Ticket Submitted',\n          '<div class=\"hbm-kv\"><div>Ticket No.<\/div><div><b>'+esc(data.ticketNo)+'<\/b><\/div><\/div>'+\n          '<div class=\"hbm-kv\"><div>Status<\/div><div><span class=\"hbm-badge hbm-badge-pending\">Pending<\/span><\/div><\/div>'+\n          '<div class=\"hbm-kv\"><div>Request<\/div><div>'+esc(data.requestBody).replace(\/\\n\/g,'<br>')+'<\/div><\/div>'\n        );\n        loadMyTickets();\n        if(adminOpen){ loadAdminTickets(); }\n      });\n    });\n\n    \/* ---- Admin open ---- *\/\n    on('hbm-openAdminBtn','click',function(){\n      clearMsg('hbm-adminMsg');\n      var pw=((g('hbm-adminLockInput')||{}).value||'').trim();\n      if(!pw){ setMsg('hbm-adminMsg','err','Please enter admin lock password.'); return; }\n      hxr('admin_open',{lockPassword:pw},function(err){\n        if(err){ setMsg('hbm-adminMsg','err',esc(err)); return; }\n        adminOpen=true;\n        var st=g('hbm-adminState'); if(st) st.value='Unlocked';\n        var ap=g('hbm-adminPanel'); if(ap) ap.classList.remove('hbm-hidden');\n        setMsg('hbm-adminMsg','ok','Admin panel unlocked.');\n        loadAdminMembers(); loadAdminTickets();\n      });\n    });\n\n    \/* ---- Admin close ---- *\/\n    on('hbm-closeAdminBtn','click',function(){\n      hxr('admin_close',{},function(){\n        adminOpen=false;\n        var st=g('hbm-adminState'); if(st) st.value='Locked';\n        var ap=g('hbm-adminPanel'); if(ap) ap.classList.add('hbm-hidden');\n        clearMsg('hbm-adminMsg');\n        var al=g('hbm-adminLockInput'); if(al) al.value='';\n      });\n    });\n\n    \/* ---- Restore all sessions on page load ---- *\/\n    \/\/ Check student session\n    hxr('get_student_data',{},function(err,data){\n      if(!err && data){\n        setMsg('hbm-loginMsg','ok','Session restored. Welcome back, '+esc(data.name)+'.');\n        renderDashboard(data);\n      }\n    });\n    \/\/ Check admin session\n    hxr('check_admin_session',{},function(err,data){\n      if(!err && data && data.isAdmin){\n        adminOpen=true;\n        var st=g('hbm-adminState'); if(st) st.value='Unlocked';\n        var ap=g('hbm-adminPanel'); if(ap) ap.classList.remove('hbm-hidden');\n        setMsg('hbm-adminMsg','ok','Admin session active.');\n        loadAdminMembers();\n        loadAdminTickets();\n      }\n    });\n\n    \/* ---- Auto-refresh admin tables every 30 seconds if admin panel open ---- *\/\n    setInterval(function(){\n      if(adminOpen){ loadAdminMembers(); loadAdminTickets(); }\n    }, 30000);\n\n  } \/* end init() *\/\n\n  \/* Run when DOM is ready *\/\n  if(document.readyState==='loading'){\n    document.addEventListener('DOMContentLoaded', init);\n  } else {\n    init();\n  }\n\n  \/* ---- Debug helper (activated by ?hbm_debug=1 in URL) ---- *\/\n  if(window.location.search.indexOf('hbm_debug=1')!==-1){\n    var dp=document.getElementById('hbm-debugPanel');\n    if(dp) dp.classList.remove('hbm-hidden');\n  }\n\n  window.HBM_runDebug = function(){\n    var out=document.getElementById('hbm-debugOut');\n    if(out) out.textContent='Running...';\n    var fd=new FormData();\n    fd.append('action','hbm_action');\n    fd.append('hbm_action','hbm_debug');\n    fd.append('nonce',NONCE);\n    fetch(AJAX,{method:'POST',body:fd})\n      .then(function(r){ return r.text(); })\n      .then(function(txt){\n        if(out) out.textContent='AJAX URL: '+AJAX+'\\n\\nRaw response:\\n'+txt;\n      })\n      .catch(function(e){\n        if(out) out.textContent='Fetch error: '+e.message;\n      });\n  };\n\n})();\n    <\/script>\n    <\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-11894","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/indianbrahmins.com\/index.php\/wp-json\/wp\/v2\/pages\/11894","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/indianbrahmins.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/indianbrahmins.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/indianbrahmins.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/indianbrahmins.com\/index.php\/wp-json\/wp\/v2\/comments?post=11894"}],"version-history":[{"count":33,"href":"https:\/\/indianbrahmins.com\/index.php\/wp-json\/wp\/v2\/pages\/11894\/revisions"}],"predecessor-version":[{"id":12834,"href":"https:\/\/indianbrahmins.com\/index.php\/wp-json\/wp\/v2\/pages\/11894\/revisions\/12834"}],"wp:attachment":[{"href":"https:\/\/indianbrahmins.com\/index.php\/wp-json\/wp\/v2\/media?parent=11894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}