/*
 * Styles for the server-rendered pages, loaded after the older section
 * stylesheets so these rules take precedence.
 */

/* ==========================================================================
   Server-rendered page helpers
   ========================================================================== */

[hidden] { display: none !important; }

.lang-btn { text-decoration: none; display: inline-flex; align-items: center; line-height: 1.4; }

.topbar-admin-link {
  background: var(--brand-gold, #f59e0b);
  color: #111827 !important;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.75rem;
}

.mobile-nav-header-right { display: flex; align-items: center; gap: 8px; }
.mobile-sub-toggle { width: 100%; background: transparent; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }

.anchor-target { position: absolute; margin-top: -120px; }

.section-heading { margin-bottom: 24px; }
.section-heading .section-main-title { margin-top: 6px; }
.title-separator-center { margin: 8px auto 0; }
.section-subtitle { color: #64748b; font-size: 0.95rem; margin-top: 8px; }
.section-subtitle.text-left { text-align: left; margin-bottom: 20px; }
.section-cta { text-align: center; margin-top: 25px; }

.btn-inline { display: inline-flex; align-items: center; gap: 8px; width: auto; padding: 10px 22px; text-decoration: none; }
.btn-block { display: block; width: 100%; margin-top: 12px; padding: 11px; }
.btn-small { width: auto; padding: 6px 14px; font-size: 0.8rem; }
.btn-whatsapp { margin-top: 20px; background: #1f9d55; }

.empty-state { padding: 24px; text-align: center; color: #64748b; font-size: 0.95rem; }

/* Placeholder avatar when a member has no uploaded photo */
.member-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e8efff, #d6e4ff);
  color: var(--brand-blue, #08399f);
  font-weight: 800;
  font-size: 2.4rem;
  letter-spacing: 0.04em;
}
.message-thumb.member-initials { font-size: 2rem; }

.message-signature { clear: both; margin-top: 10px; font-weight: 700; color: var(--brand-green); }

/* Forms */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-field-error { color: #b91c1c; font-size: 0.8rem; margin: 4px 0 0; min-height: 0; }
.form-field-error:empty { display: none; }
.form-input.has-error, .form-textarea.has-error { border-color: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12); }
.form-alert { padding: 10px 14px; border-radius: var(--radius-md); margin-bottom: 14px; font-size: 0.9rem; }
.form-alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }

.toast.is-leaving { opacity: 0; transform: translateY(10px); transition: all 0.3s ease; }

/* About page */
.about-facts { display: flex; flex-wrap: wrap; gap: 12px 28px; margin: 18px 0 6px; }
.about-facts dt { font-size: 0.78rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.04em; }
.about-facts dd { margin: 2px 0 0; font-weight: 700; color: var(--navy-900); }
.about-profile-photo { margin: 0; }
.about-profile-photo img { width: 100%; max-height: 380px; object-fit: cover; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.about-profile-photo figcaption { font-size: 0.82rem; color: #64748b; margin-top: 8px; }
.ui-icon-lg { width: 2rem; height: 2rem; }

.principles-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--grid-gap, 20px); }
.principle-item { background: #f8fafc; padding: 18px 20px; border-radius: var(--radius-md); border-left: 4px solid var(--brand-green); }
.principle-item strong { display: block; color: var(--navy-900); margin-bottom: 4px; }
.principle-item span { font-size: 0.9rem; color: #64748b; }

/* Services */
.service-img-placeholder { height: 100%; min-height: 180px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #eef4ff, #e7f8ef); color: var(--brand-blue, #08399f); }
.service-img-placeholder .ui-icon { width: 3rem; height: 3rem; opacity: 0.6; }
.service-card-items { margin: 10px 0 0; padding-left: 1.1rem; list-style: disc; font-size: 0.88rem; color: #475569; line-height: 1.7; }
.rate-cell { font-weight: 700; }
.rate-savings { color: var(--brand-green); }
.rate-loans { color: #b45309; }
.rate-welfare { color: #1d4ed8; }
.table-footnote { font-size: 0.82rem; color: #64748b; margin-top: 12px; }
.pearls-code { font-weight: 700; color: var(--brand-green); }
.pearls-actual { font-weight: 700; color: #166534; }

/* Notices */
.notice-toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--brand-border); }
.notice-toolbar .notice-tabs-header { background: transparent; border: 0; padding: 0; flex-wrap: wrap; }
.notice-toolbar .notice-tab-btn { text-decoration: none; }
.notice-search-form { display: flex; gap: 8px; flex: 1; min-width: 240px; max-width: 460px; }
.home-notice-list-item { text-decoration: none; color: inherit; }
.notice-archive-list { padding: 0; }
.notice-detail-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.notice-detail-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; font-size: 0.88rem; color: #475569; margin-bottom: 18px; }
.notice-detail-image { width: 100%; border-radius: var(--radius-md); border: 1px solid var(--brand-border); margin-bottom: 20px; }
.notice-detail-body { white-space: pre-line; line-height: 1.9; font-size: 1rem; color: #1e293b; }
.notice-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.notice-related-title { font-size: 1.05rem; font-weight: 800; color: var(--navy-900); margin-bottom: 12px; }
@media (max-width: 900px) { .notice-detail-layout { grid-template-columns: 1fr; } }

.site-pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 24px; }
.page-link { padding: 6px 12px; border: 1px solid var(--brand-border); border-radius: 8px; text-decoration: none; color: var(--navy-900); font-weight: 600; font-size: 0.88rem; }
.page-link.is-current { background: var(--brand-blue, #08399f); color: #fff; border-color: var(--brand-blue, #08399f); }
.page-link.is-disabled { color: #94a3b8; }

/* Popup notice (summary variant) */
.popup-notice-heading { font-weight: 700; font-size: 1.05rem; }
.popup-notice-x { color: #fff; font-size: 26px; border: 0; background: transparent; cursor: pointer; }
.popup-notice-summary { font-size: 0.95rem; color: #334155; line-height: 1.7; margin-bottom: 15px; }
.popup-notice-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.popup-notice-actions a, .notice-a4-actions a { text-decoration: none; width: auto; padding: 8px 18px; }
.notice-a4-wrap, .popup-notice-dialog { position: relative; z-index: 10; }

/* Downloads */
.btn-download-doc.is-disabled { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; cursor: default; }
.gallery-filter-wrap .product-tab-btn { text-decoration: none; }

/* Gallery lightbox */
.gallery-card { display: block; color: inherit; text-decoration: none; }
.lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(5, 20, 51, 0.92); display: flex; align-items: center; justify-content: center; padding: 20px; }
.lightbox-figure { margin: 0; max-width: min(1000px, 100%); text-align: center; }
.lightbox-figure img { max-width: 100%; max-height: 78vh; border-radius: 8px; }
.lightbox-figure figcaption { color: #e2e8f0; margin-top: 12px; font-size: 0.95rem; }
.lightbox-close { position: absolute; top: 14px; right: 18px; font-size: 34px; color: #fff; background: none; border: 0; cursor: pointer; }
.lightbox-nav { background: rgba(255, 255, 255, 0.12); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 18px; flex-shrink: 0; }

/* Contact */
.contact-list { display: flex; flex-direction: column; gap: 16px; list-style: none; padding: 0; }
.contact-list li { display: flex; gap: 14px; align-items: flex-start; }
.contact-detail-text strong { display: block; color: var(--navy-900); }
.contact-detail-text span, .contact-detail-text a { color: #475569; font-size: 0.95rem; }
.contact-form-panel { background: #f8fafc; padding: var(--card-padding, 24px); border-radius: var(--radius-lg); border: 1px solid var(--brand-border); }
.contact-form-title { font-size: 1.25rem; font-weight: 800; color: var(--navy-900); margin-bottom: 6px; }
.contact-form-subtitle { font-size: 0.88rem; color: #64748b; margin-bottom: 18px; }
.grievance-text { font-size: 0.88rem; color: #475569; margin: 0; line-height: 1.6; }
.grievance-phone-link { display: inline-flex; align-items: center; gap: 6px; background: #fff; padding: 8px 16px; border-radius: 8px; border: 1px solid #bbf7d0; font-weight: 700; color: var(--navy-900); text-decoration: none; }
.contact-map { margin-top: 24px; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--brand-border); }
.contact-map iframe { display: block; width: 100%; height: 360px; border: 0; }
.footer-about-text { font-size: 0.92rem; line-height: 1.7; color: #94a3b8; }
.footer-contact-list { color: #94a3b8; font-size: 0.92rem; }
.footer-contact-list a { color: inherit; }

/* Slider caption call to action */
.slider-caption-title { display: block; font-size: 1.15em; margin-bottom: 4px; }
.slider-caption-btn { display: inline-block; margin-top: 10px; padding: 6px 16px; background: #fff; color: var(--brand-blue, #08399f); border-radius: 999px; font-weight: 700; font-size: 0.85rem; text-decoration: none; }

/* Calculator */
.calc-form-panel { display: block; padding-top: 12px; }
.calc-label-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.calc-label { font-weight: 700; font-size: 0.88rem; color: #1e293b; display: block; margin: 10px 0 6px; }
.calc-label-row .calc-label { margin: 0; }
.calc-sublabel { font-size: 0.8rem; color: #64748b; display: block; margin-bottom: 4px; }
.calc-badge { font-size: 0.75rem; background: #eef4ff; color: var(--brand-blue, #08399f); padding: 2px 8px; border-radius: 8px; font-weight: 700; border: 1px solid #bfd4fd; }
.calc-range { width: 100%; margin: 4px 0 10px; accent-color: var(--brand-blue, #08399f); }
.calc-inputs-grid { margin-bottom: 8px; }
.calc-disclaimer { font-size: 0.78rem; color: #64748b; margin: 8px 0 0; }
.calculator-page-card { max-width: 960px; margin: 0 auto; }
output.result-input { display: block; }

.notice-a4-letterhead-name-ne, .notice-a4-letterhead-name-en { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 520px) {
  .notice-a4-letterhead { flex-direction: column; gap: 8px; padding: 22px 16px 12px; }
  .notice-a4-letterhead-name-ne { font-size: 1.05rem; }
}
.stat-value-amount { white-space: nowrap; }
.stat-currency { font-size: 0.6em; font-weight: 600; margin-right: 4px; opacity: 0.8; }

/* ==========================================================================
   UI refinements
   ========================================================================== */

/* Devanagari reads badly when justified (large gaps between words). */
.about-text, .message-body, .pillar-desc, .timeline-desc, .notice-detail-body, .footer-about-text {
  text-align: left !important;
}

/* --- Topbar: icons were dark blue on a dark blue bar --- */
.topbar .ui-icon { color: #9fc0ff; }
.topbar .contact-info a { color: inherit; text-decoration: none; }

/* --- Hero: full-width photo with a readable caption on the left --- */
.hero-slider-section { background: var(--navy-900); }
.hero-slider-section .slider-container { max-width: none; }
.slide-item img {
  height: clamp(340px, 42vw, 560px);
  max-height: none;
}
.slide-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5, 20, 51, 0.82) 0%, rgba(5, 20, 51, 0.5) 42%, rgba(5, 20, 51, 0) 72%);
  pointer-events: none;
}
.slider-caption {
  top: 44%;
  bottom: auto;
  left: max(24px, calc((100% - var(--container-max)) / 2 + 24px));
  transform: translateY(-50%);
  z-index: 2;
  max-width: min(560px, 78%);
  padding: 0;
  background: none;
  backdrop-filter: none;
  border: 0;
  box-shadow: none;
  color: #ffffff;
  text-align: left;
  white-space: normal;
  font-size: clamp(1.35rem, 2.6vw, 2.25rem);
  font-weight: 800;
  line-height: 1.3;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}
.slider-caption-title {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #bff5d6;
  margin-bottom: 10px;
  text-shadow: none;
}
.slider-caption-btn {
  display: table;
  margin-top: 18px;
  padding: 10px 22px;
  background: var(--brand-green, #01a755);
  color: #ffffff;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  text-shadow: none;
  transition: background 0.2s ease;
}
.slider-caption-btn:hover { background: #018a47; }
.slider-dots-bar { bottom: 58px; z-index: 3; }
.slider-dot { border: 0; cursor: pointer; }
.slider-ctrl-btn { background: rgba(255, 255, 255, 0.14); backdrop-filter: blur(4px); }

/* --- Quick links under the hero --- */
.quick-gateway-card { gap: 2px; }
.gateway-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: #eef4ff; color: var(--brand-blue, #08399f); }

/* --- Home about + notices --- */
.about-box .section-tag { margin-bottom: 6px; }
.about-box .about-title { font-size: clamp(1.25rem, 2vw, 1.6rem); line-height: 1.35; }
.about-action-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.about-action-buttons .btn-about-action {
  width: auto !important;
  padding: 10px 20px !important;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.about-facts { padding-top: 16px; border-top: 1px solid var(--brand-border); }

.notice-badge-pill.bg-red { background-color: #fee2e2; color: #b91c1c; }
.notice-badge-pill.bg-blue { background-color: #e0eaff; color: #1d4ed8; }
.home-notice-item-time { display: inline-flex; align-items: center; gap: 4px; }

/* --- Section headings: subtitles belong under the (centred) title --- */
.section-heading .section-subtitle { text-align: center; max-width: 640px; margin-left: auto; margin-right: auto; }

/* --- Buttons that should size to their label --- */
.btn-calculate.btn-inline, .btn-reset.btn-inline {
  display: inline-flex;
  width: auto !important;
  padding: 10px 24px !important;
  text-decoration: none;
}
.btn-calculate.btn-small { width: auto !important; padding: 6px 14px !important; font-size: 0.8rem; white-space: nowrap; }
.btn-block { display: block; width: 100% !important; text-align: center; text-decoration: none; }

/* --- Financial highlights: a clean figure grid instead of decorative icons --- */
.stat-item-card { text-align: left; padding: 20px 22px; }
.stat-name-label { font-size: 0.88rem; color: #475569; margin-bottom: 6px; }
.stat-value-amount { font-size: clamp(1.2rem, 1.8vw, 1.5rem); color: var(--navy-900); }
.stat-currency { color: #64748b; }

/* --- Service cards: the bullet list reads better left aligned --- */
.service-card-body-bagmati { text-align: left; }
.service-card-name-bagmati { text-align: left; }
.service-card-items { padding-left: 1.1rem; }
.service-card-items li { margin-bottom: 2px; }

/* --- Home contact card: details stack so long addresses are readable --- */
.contact-quick-pills { display: flex; flex-direction: column; gap: 8px; }
.contact-pill-item { width: 100%; }
.contact-pill-text span, .contact-pill-text a { white-space: normal; overflow: visible; text-overflow: clip; }

/* --- Leadership messages --- */
.message-card-title { text-align: left; }

/* --- Tablets and phones --- */
@media (max-width: 991px) {
  .hero-slider-section, .slider-container, .slide-item { height: auto !important; max-height: none !important; }
  .slide-item img { height: 300px !important; }
  .slider-caption {
    top: auto !important;
    bottom: 40px !important;
    left: 20px !important;
    right: 20px;
    transform: none !important;
    max-width: none !important;
    padding: 0 !important;
    font-size: 1.2rem !important;
    text-align: left !important;
  }
  .slide-item::after { background: linear-gradient(0deg, rgba(5, 20, 51, 0.85) 0%, rgba(5, 20, 51, 0.35) 55%, rgba(5, 20, 51, 0.05) 100%); }
  .slider-ctrl-btn { display: none; }
  .slider-dots-bar { bottom: 14px; }
  .slider-caption-btn { margin-top: 12px; padding: 8px 16px; font-size: 0.85rem; }
}

@media (max-width: 600px) {
  .slide-item img { height: 280px !important; }
  .quick-gateway-grid { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 6px !important; padding: 8px !important; }
  .quick-gateway-card { padding: 10px 4px !important; }
  .gateway-icon { width: 36px; height: 36px; border-radius: 10px; margin-bottom: 4px; }
  .gateway-title { font-size: 0.8rem; }
  .gateway-sub { display: none; }
  .about-action-buttons .btn-about-action { flex: 1 1 auto; justify-content: center; }
  .stat-item-card { padding: 14px 16px; }
}

/* Icons inside filled buttons/tabs should follow the text colour. */
.product-tab-btn.active .ui-icon,
.calc-tab-btn.active .ui-icon,
.btn-calculate .ui-icon,
.btn-scheme-apply .ui-icon { color: currentColor; }

.stat-grid-bagmati { align-items: start; }
.stat-item-card { min-height: 0; }

@media (max-width: 600px) {
  /* Two figures per row keeps the eight highlights to one screen. */
  .stat-grid-bagmati { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px !important; }
  .stat-item-card { padding: 12px !important; }
  .stat-value-amount { font-size: 1rem !important; white-space: normal; margin-bottom: 0; }
  .stat-currency { display: block; font-size: 0.72rem; margin-bottom: 2px; }
}

/* Section tags sit centred above centred headings. */
.section-heading .section-tag { display: table; margin: 0 auto 4px; }

.scheme-table td.rate-savings { color: var(--brand-green); }
.scheme-table td.rate-loans { color: #b45309; }
.scheme-table td.rate-welfare { color: #1d4ed8; }

/* Committees often have two or three people; centre them instead of leaving a gap. */
.leadership-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
.leadership-grid .leader-card { width: calc((100% - 3 * var(--grid-gap, 20px)) / 4); min-width: 200px; }
@media (max-width: 991px) {
  .leadership-grid .leader-card { width: calc((100% - var(--grid-gap, 20px)) / 2); min-width: 0; }
  .leader-photo-wrap { height: 170px !important; }
}

/* Contact page: details beside the form on wide screens. */
.contact-layout-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: start;
}
@media (max-width: 900px) {
  .contact-layout-split { grid-template-columns: minmax(0, 1fr); }
}

/* Gallery overlay: date on its own line above the caption. */
.gallery-overlay { display: flex; flex-direction: column; align-items: flex-start; }
.gallery-caption { display: block; }

.btn-calculate.btn-whatsapp { background-color: #1f9d55 !important; box-shadow: 0 4px 12px rgba(31, 157, 85, 0.25) !important; }
.site-footer h3 { text-transform: none; }
