/* ==========================================================================
   Global Integrated Headline Navigation Bar (.global-headline-bar)
   Shared across Portal, Admin Console, Audit Report, Methodology & Guides
   ========================================================================== */

.global-headline-bar,
.ghb-integrated-toolbar {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.3;
  letter-spacing: -0.005em;

  /* Default (Dark Mode) Glass Surface */
  background: rgba(11, 24, 21, 0.9);
  border: 1px solid rgba(197, 155, 39, 0.36);
  color: #f0f6f4;
  box-shadow:
    0 12px 32px -8px rgba(0, 0, 0, 0.55),
    0 1px 0 0 rgba(255, 255, 255, 0.06) inset;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  transition: background-color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.global-headline-bar {
  position: sticky;
  top: 0.5rem;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  margin-bottom: 1.5rem;
  border-radius: 14px;
}

.ghb-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.42rem;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: nowrap;
  width: 100%;
}

.ghb-sub-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.38rem;
  flex-wrap: nowrap !important;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
  white-space: nowrap;
  width: 100%;
  padding-top: 0.38rem;
  border-top: 1px solid rgba(197, 155, 39, 0.22);
}

.ghb-top-row::-webkit-scrollbar,
.ghb-sub-row::-webkit-scrollbar {
  display: none;
}

.ghb-cat-row {
  display: none;
  position: absolute !important;
  top: calc(100% + 6px) !important;
  left: 0.75rem !important;
  right: 0.75rem !important;
  z-index: 1200 !important;
  align-items: center;
  gap: 0.4rem !important;
  flex-wrap: wrap !important;
  padding: 0.65rem 0.9rem !important;
  border-radius: 12px !important;
  background: rgba(11, 24, 21, 0.97) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(212, 175, 55, 0.42) !important;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.45) !important;
}

html.light .ghb-cat-row,
[data-theme="light"] .ghb-cat-row {
  background: rgba(255, 253, 248, 0.98) !important;
  border-color: rgba(179, 137, 29, 0.38) !important;
  box-shadow: 0 12px 28px rgba(28, 40, 38, 0.16) !important;
}

[data-theme="sepia"] .ghb-cat-row {
  background: rgba(249, 242, 226, 0.98) !important;
  border-color: rgba(180, 134, 11, 0.4) !important;
}

.ghb-cat-row.open {
  display: flex;
}

html.light .global-headline-bar,
[data-theme="light"] .global-headline-bar,
html.light .ghb-integrated-toolbar,
[data-theme="light"] .ghb-integrated-toolbar {
  background: rgba(255, 253, 248, 0.92);
  border-color: rgba(179, 137, 29, 0.34);
  color: #1c2826;
  box-shadow:
    0 10px 28px -8px rgba(28, 40, 38, 0.14),
    0 2px 6px rgba(179, 137, 29, 0.08),
    0 1px 0 0 rgba(255, 255, 255, 0.95) inset;
}

[data-theme="sepia"] .global-headline-bar,
[data-theme="sepia"] .ghb-integrated-toolbar {
  background: rgba(249, 242, 226, 0.95);
  border-color: rgba(180, 134, 11, 0.38);
  color: #241d15;
  box-shadow:
    0 10px 26px -8px rgba(60, 42, 16, 0.16),
    0 1px 0 0 rgba(255, 252, 244, 0.85) inset;
}

/* ---------- Zone 1: Brand Crest ---------- */
.ghb-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  padding: 0.25rem 0.45rem 0.25rem 0.25rem;
  border-radius: 10px;
  color: inherit;
  flex-shrink: 0;
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.ghb-brand:hover {
  background: rgba(229, 185, 76, 0.1);
}

.ghb-crest {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  background: linear-gradient(135deg, rgba(229, 185, 76, 0.22), rgba(16, 185, 129, 0.18));
  border: 1px solid rgba(229, 185, 76, 0.48);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}

html.light .ghb-crest,
[data-theme="light"] .ghb-crest,
[data-theme="sepia"] .ghb-crest {
  background: linear-gradient(135deg, #fdf6e3, #eef7f3);
  border-color: rgba(179, 137, 29, 0.42);
  box-shadow: 0 2px 6px rgba(179, 137, 29, 0.14);
}

.ghb-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.ghb-brand-ar {
  font-family: 'Amiri', 'Noto Nastaliq Urdu', 'Scheherazade New', serif;
  font-size: 1.02rem;
  font-weight: 700;
  color: #e5b94c;
  letter-spacing: 0;
  white-space: nowrap;
}

html.light .ghb-brand-ar,
[data-theme="light"] .ghb-brand-ar,
[data-theme="sepia"] .ghb-brand-ar {
  color: #9a7110;
}

.ghb-brand-sub {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #8ea7a0;
  white-space: nowrap;
}

html.light .ghb-brand-sub,
[data-theme="light"] .ghb-brand-sub,
[data-theme="sepia"] .ghb-brand-sub {
  color: #64746f;
}

/* ---------- Zone 2: Center Segmented Nav Tray ---------- */
.ghb-nav {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 10px;
  background: rgba(6, 14, 12, 0.52);
  border: 1px solid rgba(33, 61, 54, 0.85);
  flex-wrap: nowrap !important;
  flex-shrink: 0;
}

html.light .ghb-nav,
[data-theme="light"] .ghb-nav {
  background: rgba(235, 227, 209, 0.62);
  border-color: rgba(179, 137, 29, 0.22);
}

[data-theme="sepia"] .ghb-nav {
  background: rgba(220, 205, 174, 0.55);
  border-color: rgba(166, 124, 30, 0.28);
}

.ghb-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.34rem 0.56rem;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.77rem;
  font-weight: 600;
  color: #b8cdc7;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

html.light .ghb-link,
[data-theme="light"] .ghb-link,
[data-theme="sepia"] .ghb-link {
  color: #3a4c47;
}

.ghb-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

html.light .ghb-link:hover,
[data-theme="light"] .ghb-link:hover,
[data-theme="sepia"] .ghb-link:hover {
  background: rgba(255, 255, 255, 0.72);
  color: #162420;
}

.ghb-link.active {
  background: linear-gradient(135deg, rgba(229, 185, 76, 0.22), rgba(16, 185, 129, 0.16));
  color: #f6d57a;
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(229, 185, 76, 0.45);
}

html.light .ghb-link.active,
[data-theme="light"] .ghb-link.active,
[data-theme="sepia"] .ghb-link.active {
  background: #ffffff;
  color: #926d10;
  box-shadow:
    0 2px 8px rgba(179, 137, 29, 0.2),
    inset 0 -2px 0 #b3891d;
}

.ghb-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.08rem 0.38rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  line-height: 1.25;
}

html.light .ghb-badge,
[data-theme="light"] .ghb-badge,
[data-theme="sepia"] .ghb-badge {
  background: rgba(5, 150, 105, 0.12);
  color: #047857;
  border-color: rgba(5, 150, 105, 0.3);
}

/* Integrated Guide Pair (EN | UR) */
.ghb-guide-pair {
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  padding: 1px;
  background: rgba(255, 255, 255, 0.03);
}

html.light .ghb-guide-pair,
[data-theme="light"] .ghb-guide-pair,
[data-theme="sepia"] .ghb-guide-pair {
  background: rgba(179, 137, 29, 0.08);
}

.ghb-guide-sep {
  width: 1px;
  height: 14px;
  background: rgba(148, 163, 184, 0.32);
  margin: 0 1px;
}

.ghb-urdu-link {
  font-family: 'Noto Nastaliq Urdu', 'Amiri', serif;
  font-size: 0.82rem;
  line-height: 1.55;
  padding-top: 0.22rem;
  padding-bottom: 0.26rem;
}

/* ---------- Zone 3: Right Utilities Cluster ---------- */
.ghb-utilities,
#global-nav-utilities,
#rbac-pill-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.36rem;
  flex-wrap: nowrap !important;
  flex-shrink: 0;
  overflow: visible;
}

.rbac-identity-btn {
  position: relative;
  z-index: 2;
  pointer-events: auto;
}

.ghb-theme-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.32rem 0.62rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: #f0f6f4;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.15s ease;
}

html.light .ghb-theme-btn,
[data-theme="light"] .ghb-theme-btn,
[data-theme="sepia"] .ghb-theme-btn {
  background: #ffffff;
  border-color: rgba(179, 137, 29, 0.3);
  color: #1c2826;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.ghb-theme-btn:hover {
  border-color: #c59b27;
  transform: translateY(-1px);
}

.ghb-kbd {
  font-family: 'Inter', ui-monospace, monospace;
  font-size: 0.67rem;
  font-weight: 700;
  padding: 0.08rem 0.35rem;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.14);
  color: inherit;
  line-height: 1.2;
}

/* RTL adjustments (WORKBENCH_HELP_URDU.html) */
html[dir="rtl"] .ghb-link,
html[dir="rtl"] .ghb-theme-btn {
  font-family: 'Noto Nastaliq Urdu', 'Inter', serif;
}

html[dir="rtl"] .ghb-link.ghb-ltr-font {
  font-family: 'Inter', system-ui, sans-serif;
}

/* ---------- Deck 2: Integrated Corpus Tabs, Filter & Universal 81-Vol Switcher ---------- */
.ghb-corpus-tabs {
  display: inline-flex;
  align-items: center;
  gap: 0.26rem;
  flex-wrap: nowrap !important;
  flex-shrink: 0;
}

.ghb-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.3rem 0.58rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(255, 255, 255, 0.04);
  color: #b8cdc7;
  font-family: 'Inter', 'Noto Nastaliq Urdu', system-ui, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.ghb-tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border-color: rgba(197, 155, 39, 0.45);
}

.ghb-tab-btn.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.24), rgba(197, 155, 39, 0.2));
  color: #a7f3d0;
  border-color: rgba(16, 185, 129, 0.52);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
}

html.light .ghb-tab-btn,
[data-theme="light"] .ghb-tab-btn,
[data-theme="sepia"] .ghb-tab-btn {
  background: rgba(255, 255, 255, 0.65);
  border-color: rgba(179, 137, 29, 0.24);
  color: #3a4c47;
}

html.light .ghb-tab-btn:hover,
[data-theme="light"] .ghb-tab-btn:hover,
[data-theme="sepia"] .ghb-tab-btn:hover {
  background: #ffffff;
  color: #162420;
  border-color: rgba(179, 137, 29, 0.5);
}

html.light .ghb-tab-btn.active,
[data-theme="light"] .ghb-tab-btn.active,
[data-theme="sepia"] .ghb-tab-btn.active {
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff;
  border-color: #047857;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

.ghb-sub-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  flex-wrap: nowrap !important;
  flex: 0 1 auto;
  justify-content: flex-end;
}

.ghb-vol-filter-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.48rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(6, 14, 12, 0.56);
  min-width: 140px;
  max-width: 240px;
  flex: 0 1 200px;
}

html.light .ghb-vol-filter-wrap,
[data-theme="light"] .ghb-vol-filter-wrap,
[data-theme="sepia"] .ghb-vol-filter-wrap {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(179, 137, 29, 0.3);
}

.ghb-vol-filter-icon {
  font-size: 0.78rem;
  opacity: 0.8;
  flex-shrink: 0;
}

.ghb-vol-filter-input {
  border: none;
  outline: none;
  background: transparent;
  color: inherit;
  font-family: 'Inter', 'Noto Nastaliq Urdu', system-ui, sans-serif;
  font-size: 0.78rem;
  width: 100%;
  min-width: 90px;
  padding: 0.12rem 0;
}

.ghb-vol-filter-input::placeholder {
  color: #7c968f;
}

html.light .ghb-vol-filter-input::placeholder,
[data-theme="light"] .ghb-vol-filter-input::placeholder,
[data-theme="sepia"] .ghb-vol-filter-input::placeholder {
  color: #72817c;
}

.ghb-match-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.42rem;
  border-radius: 999px;
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
  white-space: nowrap;
  flex-shrink: 0;
}

html.light .ghb-match-badge,
[data-theme="light"] .ghb-match-badge,
[data-theme="sepia"] .ghb-match-badge {
  background: rgba(5, 150, 105, 0.1);
  color: #047857;
  border-color: rgba(5, 150, 105, 0.28);
}

.ghb-vol-select {
  padding: 0.34rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(197, 155, 39, 0.36);
  background: rgba(6, 14, 12, 0.75);
  color: #f0f6f4;
  font-family: 'Inter', 'Noto Nastaliq Urdu', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  max-width: 280px;
  cursor: pointer;
}

html.light .ghb-vol-select,
[data-theme="light"] .ghb-vol-select,
[data-theme="sepia"] .ghb-vol-select {
  background: #ffffff;
  border-color: rgba(179, 137, 29, 0.35);
  color: #1c2826;
}

.ghb-disc-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.34rem 0.64rem;
  border-radius: 8px;
  border: 1px solid rgba(197, 155, 39, 0.38);
  background: rgba(229, 185, 76, 0.12);
  color: #f6d57a;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.ghb-disc-toggle-btn:hover,
.ghb-disc-toggle-btn.active {
  background: rgba(229, 185, 76, 0.24);
  border-color: #e5b94c;
}

html.light .ghb-disc-toggle-btn,
[data-theme="light"] .ghb-disc-toggle-btn,
[data-theme="sepia"] .ghb-disc-toggle-btn {
  background: rgba(179, 137, 29, 0.1);
  border-color: rgba(179, 137, 29, 0.35);
  color: #855e0a;
}

html.light .ghb-disc-toggle-btn.active,
[data-theme="light"] .ghb-disc-toggle-btn.active,
[data-theme="sepia"] .ghb-disc-toggle-btn.active {
  background: rgba(179, 137, 29, 0.22);
  color: #5e4204;
}

/* Edition Mode Pills (Bilingual | Urdu | Workbench) in Deck 2 */
.ghb-edition-pills {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: rgba(6, 14, 12, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.24);
}

html.light .ghb-edition-pills,
[data-theme="light"] .ghb-edition-pills,
[data-theme="sepia"] .ghb-edition-pills {
  background: rgba(235, 227, 209, 0.65);
  border-color: rgba(179, 137, 29, 0.24);
}

.ghb-edition-link {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  padding: 0.24rem 0.54rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.74rem;
  font-weight: 600;
  color: #b8cdc7;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ghb-edition-link:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
}

.ghb-edition-link.active {
  background: rgba(16, 185, 129, 0.22);
  color: #a7f3d0;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.45);
}

html.light .ghb-edition-link,
[data-theme="light"] .ghb-edition-link,
[data-theme="sepia"] .ghb-edition-link {
  color: #3a4c47;
}

html.light .ghb-edition-link:hover,
[data-theme="light"] .ghb-edition-link:hover,
[data-theme="sepia"] .ghb-edition-link:hover {
  background: rgba(255, 255, 255, 0.72);
  color: #162420;
}

html.light .ghb-edition-link.active,
[data-theme="light"] .ghb-edition-link.active,
[data-theme="sepia"] .ghb-edition-link.active {
  background: #ffffff;
  color: #047857;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08), inset 0 -2px 0 #059669;
}

/* ---------- Universal 2-Deck Upgrade on Reading & Workbench Toolbars ---------- */
.top-toolbar.ghb-integrated-toolbar {
  position: sticky;
  top: 0.5rem;
  z-index: 1050;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0.44rem !important;
  padding: 0.48rem 0.8rem !important;
  border-radius: 15px !important;
  margin-bottom: 1rem !important;
}

.wb-header.ghb-integrated-toolbar {
  position: relative;
  top: 0;
  z-index: 1050;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0.34rem !important;
  padding: 0.36rem 0.8rem !important;
  border-radius: 0 !important;
  margin-bottom: 0 !important;
  flex-shrink: 0 !important;
}

.wb-main {
  min-height: 0 !important;
}

.ghb-top-row[dir="ltr"] .ghb-link,
.ghb-top-row[dir="ltr"] .ghb-theme-btn {
  font-family: 'Inter', system-ui, sans-serif;
}

.ghb-top-row[dir="ltr"] .ghb-urdu-link {
  font-family: 'Noto Nastaliq Urdu', 'Amiri', serif;
}

[data-theme="light"] .wb-header.ghb-integrated-toolbar .wb-btn,
[data-theme="sepia"] .wb-header.ghb-integrated-toolbar .wb-btn,
[data-theme="light"] .wb-header.ghb-integrated-toolbar .wb-select,
[data-theme="sepia"] .wb-header.ghb-integrated-toolbar .wb-select {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(179, 137, 29, 0.34);
  color: #1c2826;
}

[data-theme="light"] .wb-header.ghb-integrated-toolbar .wb-btn:hover,
[data-theme="sepia"] .wb-header.ghb-integrated-toolbar .wb-btn:hover {
  background: #ffffff;
  border-color: #b3891d;
}

[data-theme="light"] .wb-header.ghb-integrated-toolbar .wb-btn.active,
[data-theme="sepia"] .wb-header.ghb-integrated-toolbar .wb-btn.active,
[data-theme="light"] .wb-header.ghb-integrated-toolbar .wb-btn.primary,
[data-theme="sepia"] .wb-header.ghb-integrated-toolbar .wb-btn.primary {
  background: #059669;
  border-color: #047857;
  color: #ffffff;
}

[data-theme="light"] .wb-header.ghb-integrated-toolbar .wb-badge,
[data-theme="sepia"] .wb-header.ghb-integrated-toolbar .wb-badge {
  background: rgba(5, 150, 105, 0.12);
  color: #047857;
  border: 1px solid rgba(5, 150, 105, 0.28);
}

.ghb-integrated-toolbar .ghb-sub-row > * {
  max-width: 100%;
  flex-shrink: 0;
}

#global-headline-nav .ghb-sub-row > .view-tabs,
#global-headline-nav .ghb-sub-row > .nav-controls {
  display: inline-flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 0.35rem !important;
  flex-shrink: 0 !important;
}

#global-headline-nav .ghb-sub-row .view-tab-btn {
  padding: 0.3rem 0.62rem !important;
  font-size: 0.75rem !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

#global-headline-nav .ghb-sub-row .search-input-box {
  min-width: 150px !important;
  max-width: 245px !important;
  padding: 0.18rem 0.5rem !important;
}

#global-headline-nav .ghb-sub-row .vol-jump-select {
  max-width: 230px !important;
  padding: 0.28rem 0.5rem !important;
  font-size: 0.76rem !important;
}

.ghb-integrated-toolbar .ghb-sub-row > .toolbar-brand,
.ghb-integrated-toolbar .ghb-sub-row > .toolbar-controls,
.ghb-integrated-toolbar .ghb-sub-row > .wb-title,
.ghb-integrated-toolbar .ghb-sub-row > .wb-nav,
.ghb-integrated-toolbar .ghb-sub-row .ghb-wb-status-group {
  display: inline-flex !important;
  align-items: center !important;
  flex-wrap: nowrap !important;
  gap: 0.32rem !important;
  flex-shrink: 0 !important;
}

.ghb-integrated-toolbar .ghb-sub-row > .wb-title > span:not(.wb-badge),
.ghb-integrated-toolbar .ghb-sub-row > .toolbar-brand > span {
  display: none !important;
}

.ghb-integrated-toolbar .ghb-sub-row .wb-btn,
.ghb-integrated-toolbar .ghb-sub-row .wb-select,
.ghb-integrated-toolbar .ghb-sub-row .btn,
.ghb-integrated-toolbar .ghb-sub-row button,
.ghb-integrated-toolbar .ghb-sub-row select {
  padding: 0.25rem 0.5rem !important;
  font-size: 0.74rem !important;
  border-radius: 7px !important;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
}

.ghb-integrated-toolbar .ghb-sub-row input[type="search"] {
  padding: 0.22rem 0.48rem !important;
  font-size: 0.74rem !important;
  max-width: 155px;
  border-radius: 7px !important;
}

/* Suppress duplicate legacy Portal/Help/View/Theme links inside Deck 2 since Deck 1 & unified pills host them */
.ghb-integrated-toolbar .ghb-sub-row a[href$="index.html"],
.ghb-integrated-toolbar .ghb-sub-row a[href*="index.html?"],
.ghb-integrated-toolbar .ghb-sub-row a[href*="WORKBENCH_HELP"],
.ghb-integrated-toolbar .ghb-sub-row #btn-urdu,
.ghb-integrated-toolbar .ghb-sub-row #btn-bilingual,
.ghb-integrated-toolbar .ghb-sub-row #btn-english,
.ghb-integrated-toolbar .ghb-sub-row #themeSelect,
.ghb-integrated-toolbar .ghb-sub-row #themeBtn,
.ghb-integrated-toolbar .ghb-sub-row #wbThemeSelect,
.ghb-integrated-toolbar .ghb-sub-row #wbThemeBtn,
.ghb-integrated-toolbar .ghb-sub-row button[onclick="window.print()"] {
  display: none !important;
}

/* Absorb Workbench 3rd bar (.wb-subbar) cleanly into Row 2 */
.wb-header.ghb-integrated-toolbar + .wb-subbar,
.wb-subbar.ghb-subbar-integrated {
  display: none !important;
}

.ghb-integrated-toolbar .ghb-sub-row #verifyLabel {
  display: inline-flex !important;
  align-items: center;
  gap: 0.3rem;
  padding: 0.22rem 0.52rem;
  border-radius: 7px;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.42);
  color: #34d399;
  white-space: nowrap;
}

.ghb-integrated-toolbar .ghb-sub-row #verifyLabel.verified {
  background: #059669;
  border-color: #047857;
  color: #ffffff;
}

html.light .ghb-integrated-toolbar .ghb-sub-row #verifyLabel:not(.verified),
[data-theme="light"] .ghb-integrated-toolbar .ghb-sub-row #verifyLabel:not(.verified),
[data-theme="sepia"] .ghb-integrated-toolbar .ghb-sub-row #verifyLabel:not(.verified) {
  background: rgba(5, 150, 105, 0.1);
  border-color: rgba(5, 150, 105, 0.35);
  color: #047857;
}

.ghb-integrated-toolbar .ghb-sub-row #flaggedCountDisplay {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fbbf24;
  white-space: nowrap;
}

.ghb-integrated-toolbar .ghb-sub-row #flaggedCountDisplay:empty {
  display: none;
}

.ghb-integrated-toolbar .ghb-sub-row #pageMetadataDisplay {
  font-size: 0.71rem;
  max-width: 185px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.85;
  padding: 0.18rem 0.45rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.ghb-integrated-toolbar .ghb-sub-row #pageMetadataDisplay:empty {
  display: none;
}

/* Unified Manuscript & Tafsir On-the-Fly View Mode Switching */
body[data-mode="urdu"] .bilingual-row {
  grid-template-columns: 1fr !important;
}

body[data-mode="urdu"] .bilingual-row .col-en,
body[data-mode="urdu"] .toc-title-en,
body[data-mode="urdu"] .title-en-pane {
  display: none !important;
}

body[data-mode="urdu"] .bilingual-row .col-ur {
  border-left: none !important;
  padding-left: 1.5rem;
}

body[data-mode="english"] .bilingual-row {
  grid-template-columns: 1fr !important;
}

body[data-mode="english"] .bilingual-row .col-ur,
body[data-mode="english"] .toc-title-ur,
body[data-mode="english"] .title-ur-pane {
  display: none !important;
}

body[data-mode="english"] .bilingual-row .col-en {
  border-left: none !important;
}

/* Unified Bilingual Mode Buttons in .ghb-edition-pills */
button.ghb-edition-link {
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

/* On-the-fly EN <-> Urdu Language Switcher (#ghb-lang-toggle) */
.ghb-lang-toggle {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border-radius: 999px;
  background: rgba(6, 14, 12, 0.56);
  border: 1px solid rgba(229, 185, 76, 0.45);
  flex-shrink: 0;
}

html.light .ghb-lang-toggle,
[data-theme="light"] .ghb-lang-toggle,
[data-theme="sepia"] .ghb-lang-toggle {
  background: rgba(235, 227, 209, 0.72);
  border-color: rgba(179, 137, 29, 0.4);
}

.ghb-lang-btn {
  border: none;
  background: transparent;
  color: #b8cdc7;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.25;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.ghb-lang-btn[data-lang="ur"] {
  font-family: 'Noto Nastaliq Urdu', 'Amiri', serif;
  font-size: 0.76rem;
  padding: 0.12rem 0.52rem;
}

html.light .ghb-lang-btn,
[data-theme="light"] .ghb-lang-btn,
[data-theme="sepia"] .ghb-lang-btn {
  color: #3a4c47;
}

.ghb-lang-btn.active {
  background: linear-gradient(135deg, #c59b27, #9e7a18);
  color: #ffffff !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

/* Global Bilingual Language Visibility Helpers */
html[data-ui-lang="ur"] [data-lang-only="en"] {
  display: none !important;
}

html:not([data-ui-lang="ur"]) [data-lang-only="ur"] {
  display: none !important;
}

html[data-ui-lang="ur"] .ghb-i18n-ur-font,
html[data-ui-lang="ur"] .ghb-nav .ghb-link,
html[data-ui-lang="ur"] .ghb-tab-btn,
html[data-ui-lang="ur"] .ghb-disc-toggle-btn,
html[data-ui-lang="ur"] .ghb-edition-link,
html[data-ui-lang="ur"] .ghb-en-level-btn {
  font-family: 'Noto Nastaliq Urdu', 'Amiri', 'Inter', serif;
}

/* ---------- Second English Translation Register Switcher (Scholarly EN vs. Grade 10–11 Modern Standard EN) ---------- */
.ghb-en-register-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.16rem;
  padding: 0.14rem;
  border-radius: 999px;
  border: 1px solid rgba(56, 189, 248, 0.42);
  background: rgba(14, 116, 144, 0.14);
  flex-shrink: 0;
  white-space: nowrap;
}

html.light .ghb-en-register-switch,
[data-theme="light"] .ghb-en-register-switch,
[data-theme="sepia"] .ghb-en-register-switch {
  background: rgba(2, 132, 199, 0.08);
  border-color: rgba(2, 132, 199, 0.36);
}

.ghb-en-level-btn {
  font-family: 'Inter', 'Noto Nastaliq Urdu', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.52rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: #bae6fd;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.ghb-en-level-btn:hover {
  color: #ffffff;
  background: rgba(56, 189, 248, 0.18);
}

html.light .ghb-en-level-btn,
[data-theme="light"] .ghb-en-level-btn,
[data-theme="sepia"] .ghb-en-level-btn {
  color: #0369a1;
}

html.light .ghb-en-level-btn:hover,
[data-theme="light"] .ghb-en-level-btn:hover,
[data-theme="sepia"] .ghb-en-level-btn:hover {
  background: rgba(2, 132, 199, 0.12);
  color: #075985;
}

.ghb-en-level-btn.active[data-en-level="academic"] {
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff !important;
  box-shadow: 0 1px 5px rgba(4, 120, 87, 0.35);
}

.ghb-en-level-btn.active[data-en-level="modern"] {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff !important;
  box-shadow: 0 1px 5px rgba(37, 99, 235, 0.35);
}

.ghb-en-level-btn.active[data-en-level="both"] {
  background: linear-gradient(135deg, #059669, #2563eb);
  color: #ffffff !important;
  box-shadow: 0 1px 5px rgba(37, 99, 235, 0.35);
}

/* Reading Edition Grade 10-11 Status Banner & Badges */
#ghb-modern-en-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0.85rem 0 1.15rem;
  padding: 0.72rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(2, 132, 199, 0.45);
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.14), rgba(37, 99, 235, 0.08));
  color: #e0f2fe;
  font-family: 'Inter', 'Noto Nastaliq Urdu', system-ui, sans-serif;
  font-size: 0.82rem;
  line-height: 1.45;
  direction: ltr;
}

html[data-ui-lang="ur"] #ghb-modern-en-status-banner {
  direction: rtl;
}

html.light #ghb-modern-en-status-banner,
[data-theme="light"] #ghb-modern-en-status-banner,
[data-theme="sepia"] #ghb-modern-en-status-banner {
  background: linear-gradient(135deg, rgba(224, 242, 254, 0.92), rgba(239, 246, 255, 0.96));
  color: #0c4a6e;
  border-color: rgba(2, 132, 199, 0.38);
}

.ghb-modern-banner-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.ghb-modern-banner-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.32rem 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(2, 132, 199, 0.48);
  background: rgba(2, 132, 199, 0.16);
  color: inherit;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, transform 0.14s ease;
}

.ghb-modern-banner-btn:hover {
  background: rgba(2, 132, 199, 0.28);
  transform: translateY(-1px);
}

.en-reg-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.14rem 0.56rem;
  margin-bottom: 0.42rem;
  border-radius: 999px;
  font-family: 'Inter', 'Noto Nastaliq Urdu', system-ui, sans-serif;
  font-size: 0.69rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  direction: ltr;
}

.en-reg-badge.is-pending {
  background: rgba(2, 132, 199, 0.12);
  color: #0369a1;
  border: 1px dashed rgba(2, 132, 199, 0.45);
}

.en-reg-badge.is-modern {
  background: rgba(2, 132, 199, 0.16);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.45);
}

.en-reg-badge.is-academic {
  background: rgba(5, 150, 105, 0.12);
  color: #047857;
  border: 1px solid rgba(5, 150, 105, 0.38);
}

[data-theme="dark"] .en-reg-badge.is-pending {
  color: #7dd3fc;
}

[data-theme="dark"] .en-reg-badge.is-modern {
  color: #93c5fd;
}

[data-theme="dark"] .en-reg-badge.is-academic {
  color: #6ee7b7;
}

.en-modern-placeholder-card {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1.5px dashed rgba(2, 132, 199, 0.48);
  background: rgba(2, 132, 199, 0.06);
  color: inherit;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.88rem;
  line-height: 1.55;
  direction: ltr;
  text-align: left;
}

/* Workbench Dual English Register Editor Container */
.wb-modern-en-wrap {
  border-left: 3px solid #0284c7;
  padding: 0.5rem 0.65rem;
  margin-top: 0.45rem;
  border-radius: 6px;
  background: rgba(2, 132, 199, 0.05);
}

.wb-modern-en-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  color: #0369a1;
}

[data-theme="dark"] .wb-modern-en-header {
  color: #7dd3fc;
}

.editable-en-modern {
  font-family: 'Inter', 'Georgia', system-ui, sans-serif;
  font-size: 0.96rem;
  line-height: 1.68;
  direction: ltr;
  text-align: left;
  min-height: 2.2rem;
  padding: 0.35rem 0.45rem;
  border-radius: 4px;
  border: 1px dashed rgba(2, 132, 199, 0.35);
  background: rgba(255, 255, 255, 0.55);
  outline: none;
}

[data-theme="dark"] .editable-en-modern {
  background: rgba(15, 23, 42, 0.55);
  color: #f1f5f9;
}

.editable-en-modern:empty::before {
  content: attr(data-placeholder);
  opacity: 0.6;
  font-style: italic;
}

@media (max-width: 1180px) {
  .ghb-kbd {
    display: none;
  }
  .ghb-link {
    padding: 0.32rem 0.48rem;
    font-size: 0.74rem;
  }
}

@media (max-width: 1020px) {
  .ghb-top-row,
  .ghb-sub-row {
    justify-content: flex-start;
  }
  .ghb-brand {
    margin-inline-end: 0.25rem;
  }
  .ghb-sub-controls {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .global-headline-bar,
  .top-toolbar.ghb-integrated-toolbar {
    position: static;
    padding: 0.45rem !important;
    gap: 0.38rem !important;
  }
  .ghb-brand-sub,
  .ghb-theme-label {
    display: none;
  }
  .ghb-link {
    padding: 0.3rem 0.48rem;
    font-size: 0.73rem;
  }
  .ghb-vol-filter-wrap {
    min-width: 130px;
  }
  .ghb-vol-select {
    max-width: 220px;
  }
}

@media print {
  .global-headline-bar,
  .ghb-integrated-toolbar {
    display: none !important;
  }
}

/* ==========================================================================
   Responsive collapse (site_nav.js adds .sn-burger / .sn-controls-btn)
   ≤1280px : top row = brand + Menu + Controls + theme; links, account and
             the reader/workbench controls open as wrapped panels.
   ≤900px  : bilingual / workbench layouts stack; no sideways overflow.
   ========================================================================== */
.sn-burger,
.sn-controls-btn {
  display: none;
}

@media (max-width: 1280px) {
  .global-headline-bar,
  .ghb-integrated-toolbar {
    position: sticky !important;
    top: 0;
    z-index: 1100;
  }
  .global-headline-bar.sn-menu-open,
  .global-headline-bar.sn-controls-open,
  .ghb-integrated-toolbar.sn-menu-open,
  .ghb-integrated-toolbar.sn-controls-open {
    max-height: calc(100dvh - 0.5rem);
    overflow-y: auto;
  }

  .global-headline-bar .ghb-top-row,
  .ghb-integrated-toolbar .ghb-top-row,
  .global-headline-bar .ghb-sub-row,
  .ghb-integrated-toolbar .ghb-sub-row {
    flex-wrap: wrap !important;
    overflow: visible !important;
    white-space: normal;
    justify-content: flex-start;
  }

  .sn-burger,
  .sn-controls-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-height: 38px;
    padding: 0.3rem 0.7rem;
    border-radius: 9px;
    border: 1px solid rgba(197, 155, 39, 0.45);
    background: rgba(197, 155, 39, 0.1);
    color: inherit;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
  }
  .sn-burger[aria-expanded="true"],
  .sn-controls-btn[aria-expanded="true"] {
    background: rgba(197, 155, 39, 0.28);
  }
  .ghb-top-row .ghb-brand {
    margin-inline-end: auto;
  }

  /* Top row: only brand, Menu, Controls, theme stay visible */
  .ghb-top-row .ghb-nav {
    display: none !important;
    order: 20;
    width: 100%;
    flex-wrap: wrap !important;
    flex-shrink: 1;
  }
  .ghb-top-row .ghb-nav .ghb-link {
    flex: 1 1 42%;
    justify-content: center;
    min-height: 40px;
  }
  .ghb-top-row .ghb-utilities {
    display: contents;
  }
  .ghb-top-row .ghb-utilities > :not(.ghb-theme-btn) {
    display: none !important;
  }
  .ghb-theme-label {
    display: none;
  }

  .sn-menu-open .ghb-top-row .ghb-nav {
    display: flex !important;
  }
  .sn-menu-open .ghb-top-row .ghb-utilities > :not(.ghb-theme-btn) {
    display: flex !important;
    order: 21;
    flex: 1 1 auto;
    justify-content: center;
  }

  /* Second row: collapsed behind Controls on readers / workbenches */
  .ghb-integrated-toolbar > .ghb-sub-row {
    display: none;
  }
  .ghb-integrated-toolbar.sn-controls-open > .ghb-sub-row {
    display: flex;
  }
  .ghb-sub-row .toolbar-brand,
  .ghb-sub-row .toolbar-controls,
  .ghb-sub-row .wb-title,
  .ghb-sub-row .wb-nav,
  .ghb-sub-row .wb-subbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    width: 100%;
    min-width: 0;
  }
  .ghb-sub-row select,
  .ghb-sub-row input {
    max-width: 100%;
    min-height: 36px;
  }
  .ghb-sub-row .ghb-vol-filter-wrap {
    max-width: 100% !important;
    flex: 1 1 140px !important;
  }
}

@media (max-width: 900px) {
  html,
  body {
    max-width: 100%;
    overflow-x: clip; /* clip, not hidden: hidden breaks the sticky bar */
  }
  /* Readers: stack Urdu / English columns and tighten the page frame */
  body[data-mode="bilingual"] .title-grid,
  .bilingual-row,
  body[data-mode="bilingual"] .bilingual-row {
    grid-template-columns: 1fr !important;
  }
  .book-wrapper,
  body[data-mode="bilingual"] .book-wrapper {
    padding: 1rem 0.8rem !important;
    margin: 0.75rem auto 3rem !important;
  }
  .toc-grid {
    grid-template-columns: 1fr !important;
  }
  /* Workbench: panes stack and scroll as one column */
  .wb-main {
    grid-template-columns: 1fr !important;
    overflow-y: auto !important;
  }
  .wb-pane {
    height: auto !important;
    min-height: 70vh;
    border-right: none;
  }
}

@media (max-width: 480px) {
  .sn-burger .sn-lb,
  .sn-controls-btn .sn-lb {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .sn-burger,
  .sn-controls-btn {
    min-width: 38px;
    justify-content: center;
    padding: 0.3rem 0.55rem;
  }
  .sn-ic {
    font-size: 1.05rem;
  }
  .ghb-top-row .ghb-brand-sub {
    display: none;
  }
  .ghb-top-row .ghb-brand-ar {
    font-size: 0.92rem;
  }
  .ghb-top-row .ghb-brand {
    min-width: 0;
  }
}

@media (max-width: 1280px) {
  .ghb-integrated-toolbar,
  .global-headline-bar {
    direction: ltr;
  }
  .ghb-integrated-toolbar .ghb-sub-row .toolbar-brand,
  .ghb-integrated-toolbar .ghb-sub-row .toolbar-controls,
  .ghb-integrated-toolbar .ghb-sub-row .wb-title,
  .ghb-integrated-toolbar .ghb-sub-row .wb-nav,
  .ghb-integrated-toolbar .ghb-sub-row .wb-subbar,
  .ghb-integrated-toolbar .ghb-sub-row .ghb-edition-pills,
  .ghb-integrated-toolbar .ghb-sub-row .ghb-sub-controls,
  .ghb-integrated-toolbar .ghb-sub-row .ghb-corpus-tabs {
    flex-wrap: wrap !important;
    overflow: visible !important;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .ghb-integrated-toolbar .ghb-sub-row .ghb-vol-select,
  .ghb-integrated-toolbar .ghb-sub-row .wb-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }
  .ghb-integrated-toolbar .ghb-sub-row .ghb-edition-link {
    flex: 1 1 auto;
    justify-content: center;
  }
}

@media (max-width: 1280px) {
  .global-headline-bar .view-tabs,
  .global-headline-bar .nav-controls,
  .global-headline-bar .search-input-box {
    flex-wrap: wrap !important;
    overflow: visible !important;
    max-width: 100%;
    min-width: 0;
  }
  .global-headline-bar .view-tab-btn {
    flex: 1 1 auto;
    justify-content: center;
  }
  .global-headline-bar .vol-jump-select {
    max-width: 100%;
    min-width: 0;
    flex: 1 1 180px;
  }
}

@media (max-width: 1280px) {
  #global-headline-nav .ghb-sub-row > .view-tabs,
  #global-headline-nav .ghb-sub-row > .nav-controls,
  #global-headline-nav .ghb-sub-row > .ghb-corpus-tabs {
    flex-wrap: wrap !important;
    overflow: visible !important;
    max-width: 100% !important;
    width: 100%;
  }
  #global-headline-nav .ghb-sub-row .view-tab-btn,
  #global-headline-nav .ghb-sub-row .ghb-tab-btn {
    flex: 1 1 auto;
    white-space: normal;
  }
}

@media (max-width: 1280px) {
  #global-headline-nav .ghb-sub-row .view-tab-btn {
    white-space: normal !important;
    flex-shrink: 1 !important;
  }
  #global-headline-nav .ghb-sub-row > .nav-controls .search-input-box {
    flex: 1 1 100%;
  }
}

/* ---- Workbench pane headers: never force the pane wider than its column ---- */
.wb-main { grid-template-columns: minmax(0,1fr) minmax(0,1.1fr) minmax(0,1.1fr); }
.wb-pane { min-width: 0; overflow-x: hidden; }
.wb-pane .pane-header { flex-wrap: wrap; gap: 0.3rem 0.6rem; }
.wb-pane .pane-header > * { min-width: 0; max-width: 100%; }
.wb-pane .ghb-en-register-switch { flex-wrap: wrap; max-width: 100%; }

/* Three columns are too tight below ~1100px: stack them as one column */
@media (max-width: 1100px) {
  .wb-main {
    grid-template-columns: minmax(0,1fr) !important;
    overflow-y: auto !important;
  }
  .wb-pane { height: auto !important; min-height: 70vh; border-right: none; }
}

/* ---- Desktop: second row wraps instead of scrolling sideways ---- */
.ghb-integrated-toolbar .ghb-sub-row {
  flex-wrap: wrap !important;
  overflow: visible !important;
  white-space: normal;
  row-gap: 0.3rem;
}
.ghb-integrated-toolbar .ghb-sub-row .toolbar-brand,
.ghb-integrated-toolbar .ghb-sub-row .toolbar-controls,
.ghb-integrated-toolbar .ghb-sub-row .wb-title,
.ghb-integrated-toolbar .ghb-sub-row .wb-nav,
.ghb-integrated-toolbar .ghb-sub-row .wb-subbar,
.ghb-integrated-toolbar .ghb-sub-row .ghb-sub-controls {
  flex-wrap: wrap;
  min-width: 0;
  row-gap: 0.3rem;
}

/* ---- Grouped dropdowns in the second row (built by site_nav.js) ---- */
.sn-group { position: relative; display: inline-flex; flex: 0 0 auto; }
.sn-group-btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 32px; padding: 0.25rem 0.7rem;
  border-radius: 9px; border: 1px solid rgba(197,155,39,0.45);
  background: rgba(197,155,39,0.1); color: inherit;
  font: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer;
  white-space: nowrap;
}
.sn-group-btn::after { content: "▾"; font-size: 0.7em; opacity: 0.8; }
.sn-group.sn-open > .sn-group-btn { background: rgba(197,155,39,0.28); }
.sn-panel {
  display: none; position: absolute; top: calc(100% + 6px); inset-inline-start: 0;
  z-index: 1300; min-width: 230px; max-width: min(92vw, 440px);
  padding: 0.6rem; gap: 0.45rem; flex-wrap: wrap; align-items: center;
  border-radius: 12px; border: 1px solid rgba(197,155,39,0.45);
  background: #15201d; color: #f3efe4;
  box-shadow: 0 14px 34px -8px rgba(0,0,0,0.45);
  white-space: normal; overflow: visible; direction: ltr;
}
html.light .sn-panel, [data-theme="light"] .sn-panel { background: #fffdf8; color: #1c2826; }
[data-theme="sepia"] .sn-panel { background: #f9f2e2; color: #241d15; }
.sn-group.sn-open > .sn-panel { display: flex; }
.sn-panel > * { max-width: 100%; }
.sn-panel .sn-plabel {
  flex: 1 1 100%; font-size: 0.68rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; opacity: 0.65; margin-top: 0.1rem;
}
.sn-panel .sn-plabel:first-child { margin-top: 0; }

/* Collapsed bar scrolls vertically, so dropdowns expand in-flow there */
@media (max-width: 1280px) {
  .sn-group.sn-open { flex: 1 1 100%; flex-direction: column; }
  .sn-group.sn-open > .sn-group-btn { align-self: flex-start; }
  .sn-panel { position: static; max-width: 100%; margin-top: 0.4rem; min-width: 0; }
}

/* Top-row "More" group: dropdown on desktop, flattened inside the Menu panel */
.ghb-nav .sn-panel { flex-direction: column; align-items: stretch; min-width: 170px; }
.ghb-nav .sn-panel .ghb-link { width: 100%; justify-content: flex-start; }
.ghb-nav .sn-group.sn-has-active > .sn-group-btn { border-color: var(--gold, #c59b27); background: rgba(197,155,39,0.28); }
@media (max-width: 1280px) {
  .ghb-nav .sn-group,
  .ghb-nav .sn-panel { display: contents !important; }
  .ghb-nav .sn-group-btn { display: none !important; }
  .ghb-nav .sn-panel { position: static; }
}

/* Desktop: let the top-row dropdown escape the row (row no longer needs to scroll) */
@media (min-width: 1281px) {
  .ghb-top-row { overflow: visible !important; }
}

/* Info pages: the volume picker sized itself to its longest option (~1000px) */
.ghb-sub-controls { min-width: 0; max-width: 100%; flex-wrap: wrap; }
.ghb-sub-controls .ghb-vol-select,
.ghb-sub-row .ghb-vol-select { width: auto; max-width: min(100%, 420px); min-width: 0; text-overflow: ellipsis; }

/* Audit report: long link text in volume cards must wrap, not widen the page */
.vol-grid, .vol-card, .info-box, .info-list, .info-list li { min-width: 0; }
.info-list a { white-space: normal; overflow-wrap: anywhere; }

/* ==========================================================================
   Permission-based visibility (classes set on <html> by access_control.js)
   ========================================================================== */
html.rbac-no-workbench a[href*="_Proofreading_Workbench"],
html.rbac-no-workbench .ms-btn.locked,
html.rbac-no-workbench #wbTopLink { display: none !important; }
html.rbac-no-audit a[href*="RECONCILIATION_REPORT"] { display: none !important; }
html.rbac-no-admin a[href*="ADMIN_CONSOLE"],
html.rbac-no-admin #portal-admin-btn { display: none !important; }
html.rbac-no-export a[href$=".md"],
html.rbac-no-export a[href*=".md?"],
html.rbac-no-export a[href*=".md#"] { display: none !important; }
html.rbac-no-print #rbac-print-btn,
html.rbac-no-print #wb-print-btn,
html.rbac-no-print button[onclick="window.print()"] { display: none !important; }
html.rbac-guest .rbac-card-role-badge { display: none !important; }

/* ==========================================================================
   Single-line volume bar (.vb-compact) for readers and workbenches
   ========================================================================== */
.ghb-integrated-toolbar.vb-compact {
  overflow: visible !important; max-height: none !important;
  padding: 0.35rem 0.75rem !important;
}
.vb-compact > .ghb-top-row,
.vb-compact > .ghb-sub-row { display: none !important; }
.vb-row {
  display: flex; align-items: center; gap: 0.4rem;
  flex-wrap: nowrap; min-width: 0; width: 100%;
  font-size: 0.8rem; white-space: nowrap;
}
.vb-row > * { flex: 0 0 auto; }
.vb-row .vb-btn,
.vb-row .rbac-search-trigger,
.vb-row .rbac-identity-btn,
.vb-row #bmDrawerBtn,
.vb-row .vb-badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  min-height: 32px; padding: 0.2rem 0.6rem; border-radius: 9px;
  border: 1px solid rgba(197,155,39,0.45); background: rgba(197,155,39,0.08);
  color: inherit; font: inherit; font-size: 0.78rem; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.vb-row .vb-btn:hover { background: rgba(197,155,39,0.2); }
.vb-row .vb-btn:disabled { opacity: 0.4; cursor: default; }
.vb-row .vb-home { font-weight: 700; }
.vb-row .vb-primary { background: #0d5c3a; border-color: #10b981; color: #fff; }
.vb-row .vb-badge { cursor: default; font-weight: 500; background: transparent; }
.vb-row .vb-title {
  flex: 0 1 auto; min-width: 0; max-width: 26ch; overflow: hidden; text-overflow: ellipsis;
  font-weight: 700; font-size: 0.82rem; opacity: 0.9;
}
.vb-row .vb-sep { width: 1px; align-self: stretch; margin: 0.25rem 0.1rem; background: rgba(197,155,39,0.35); }
.vb-row .vb-spacer { flex: 1 1 auto; }

/* segmented controls: edition + English level */
.vb-row .vb-seg {
  display: inline-flex; align-items: stretch; border: 1px solid rgba(197,155,39,0.45);
  border-radius: 9px; overflow: hidden; min-height: 32px; gap: 0; padding: 0; background: transparent;
}
.vb-row .vb-seg > button {
  border: 0; border-inline-end: 1px solid rgba(197,155,39,0.3); background: transparent;
  color: inherit; font: inherit; font-size: 0.78rem; font-weight: 600;
  padding: 0.2rem 0.6rem; cursor: pointer; white-space: nowrap; border-radius: 0; min-height: 0; margin: 0;
}
.vb-row .vb-seg > button:last-child { border-inline-end: 0; }
.vb-row .vb-seg > button.active { background: #0d5c3a; color: #fff; }
.vb-row .vb-modes > button[data-view-mode="urdu"] { font-size: 0.86rem; }

/* page navigation */
.vb-pagenav { display: inline-flex; align-items: center; gap: 0.25rem; }
.vb-goto {
  display: inline-flex; align-items: center; gap: 0.2rem; min-height: 32px;
  padding: 0 0.45rem; border-radius: 9px; border: 1px solid rgba(197,155,39,0.45);
  font-size: 0.76rem; cursor: text;
}
.vb-goto-input {
  width: 3.4em; border: 0; background: transparent; color: inherit;
  font: inherit; font-weight: 700; text-align: center; padding: 0.1rem 0; outline: none;
}
.vb-goto:focus-within { border-color: #10b981; box-shadow: 0 0 0 2px rgba(16,185,129,0.25); }
.vb-goto-input.vb-bad { color: #dc2626; }
.vb-goto-total { opacity: 0.65; }
.vb-lbl-sm { opacity: 0.65; }

/* workbench verify + flags */
.vb-row .vb-verify {
  display: inline-flex; align-items: center; gap: 0.3rem; min-height: 32px;
  padding: 0.2rem 0.6rem; border-radius: 9px; border: 1px solid rgba(16,185,129,0.55);
  font-weight: 700; cursor: pointer; margin: 0;
}
.vb-row .vb-flags.vb-has-flags { border-color: #f59e0b; background: rgba(245,158,11,0.15); }
.vb-row .vb-count { font-weight: 800; }

/* dropdown groups in the bar: always float (override the ≤1280px in-flow rule) */
.vb-row .vb-group.sn-open { flex: 0 0 auto !important; flex-direction: row !important; }
.vb-row .vb-group > .sn-panel {
  position: absolute !important; top: calc(100% + 6px); max-width: min(92vw, 420px) !important;
  min-width: 240px !important; margin-top: 0 !important; flex-direction: column; align-items: stretch;
}
.vb-row .vb-group > .sn-group-btn::after { content: none; }
.vb-row .vb-psec { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.vb-row .vb-psec > * { margin: 0 !important; }
.vb-row .vb-psec .ghb-link,
.vb-row .vb-psec a.wb-btn,
.vb-row .vb-psec a.workbench-link {
  display: flex; width: 100%; justify-content: flex-start; text-decoration: none;
}
.vb-row .vb-psec input[type="search"] { width: 100%; min-height: 30px; padding: 0.2rem 0.5rem; border-radius: 8px; border: 1px solid rgba(197,155,39,0.45); background: transparent; color: inherit; font: inherit; }
.vb-row .vb-psec .ghb-en-register-switch { display: inline-flex; }

/* responsive: shed labels first, then the title, then wrap */
@media (max-width: 1280px) {
  .vb-row .vb-title { max-width: 16ch; }
}
@media (max-width: 1100px) {
  .vb-row .vb-lbl { display: none; }
  .vb-row .rbac-search-trigger kbd { display: none; }
  .vb-row .vb-title { display: none; }
}
@media (max-width: 820px) {
  .vb-row { flex-wrap: wrap; row-gap: 0.35rem; }
  .vb-row .vb-sep { display: none; }
  .vb-row .vb-modes, .vb-row .vb-register { order: 10; }
  .vb-row .rbac-identity-btn .rbac-user-name { display: none; }
}
@media (max-width: 480px) {
  .ghb-integrated-toolbar.vb-compact { padding: 0.3rem 0.5rem !important; }
  .vb-row { gap: 0.3rem; }
  .vb-row .vb-seg > button { padding: 0.2rem 0.45rem; }
  .vb-row .vb-btn, .vb-row .rbac-search-trigger, .vb-row #bmDrawerBtn { padding: 0.2rem 0.45rem; }
  .vb-row .vb-goto-input { width: 2.8em; }
  .vb-row .vb-badge { display: none; }
}
/* compact identity pill + title room */
.vb-row .vb-title { flex: 0 1 26ch; min-width: 6ch; }
.vb-row .rbac-identity-btn { gap: 0.3rem; max-width: 190px; }
.vb-row .rbac-identity-btn .rbac-user-name { display: inline-block; max-width: 9ch; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.vb-row .rbac-identity-btn .rbac-role-chip { font-size: 0.68rem; padding: 0.05rem 0.35rem; }
.vb-row .vb-register::before { content: "EN"; align-self: center; font-size: 0.66rem; font-weight: 800; opacity: 0.6; padding: 0 0.4rem; border-inline-end: 1px solid rgba(197,155,39,0.3); }
.vb-row { flex-wrap: wrap; row-gap: 0.35rem; }
@media (max-width: 1520px) {
  .vb-row .rbac-search-trigger kbd { display: none; }
  .vb-row .vb-prev .vb-lbl, .vb-row .vb-next .vb-lbl { display: none; }
}
.vb-row .vb-title { flex: 0 1 auto; max-width: 22ch; }
@media (max-width: 1600px) {
  .vb-row .rbac-identity-btn .rbac-user-name { display: none; }
  .vb-row .rbac-identity-btn > span:last-child { display: none; }
}
/* Switching texts goes through the portal: no cross-volume jumps in readers */
html.vb-on .prev-vol-link,
html.vb-on .next-vol-link { display: none !important; }
.ghb-integrated-toolbar.vb-compact { position: sticky !important; top: 0; z-index: 1000; }
@media (max-width: 820px) {
  .vb-row .rbac-search-trigger > [data-i18n] { display: none; }
  .vb-row .rbac-search-trigger::before { content: "🔎"; }
  .vb-row .vb-register::before { display: none; }
  .vb-row .vb-pagenav { order: 5; }
}
@media (max-width: 820px) { .vb-row .vb-identity { order: 6; } }
@media (max-width: 1400px) { .vb-row .vb-lbl { display: none; } }

/* ==========================================================================
   One bar everywhere: portal + info pages use the same .vb-row
   ========================================================================== */
.global-headline-bar.vb-compact {
  position: sticky !important; top: 0; z-index: 1000;
  padding: 0.35rem 0.75rem !important; overflow: visible !important; max-height: none !important;
  display: block !important;
}
.global-headline-bar.vb-compact > .ghb-top-row,
.global-headline-bar.vb-compact > .ghb-sub-row,
.global-headline-bar.vb-compact > .ghb-cat-row { display: none !important; }
.vb-row .vb-home.active { background: #0d5c3a; border-color: #10b981; color: #fff; }
.vb-row .vb-flag:disabled { opacity: 0.4; cursor: default; }
.vb-pagenav.vb-disabled { opacity: 0.45; }
.vb-pagenav.vb-disabled .vb-goto { cursor: default; }
.vb-row .vb-psec .ghb-link.vb-current { background: rgba(197,155,39,0.28); font-weight: 800; }

/* Catalogue filters under the bar (portal, audit) */
.vb-browse {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem;
  margin: 0.6rem 0 0.4rem; font-size: 0.8rem;
}
.vb-browse .view-tabs { display: inline-flex; flex-wrap: wrap; gap: 0.3rem; margin: 0; }
.vb-browse .search-input-box { flex: 1 1 220px; max-width: 420px; margin: 0; }
.vb-browse .ghb-disc-toggle-btn { margin: 0; }
.vb-browse + .ghb-cat-row { margin-bottom: 0.6rem; }

/* Portal cards: the whole card is the single link to the text */
.para-card.vb-card { position: relative; cursor: pointer; }
.para-card.vb-card .vb-card-link { color: inherit; text-decoration: none; }
.para-card.vb-card .vb-card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
.para-card.vb-card:hover, .para-card.vb-card:focus-within { border-color: var(--accent-gold, #c59b27); box-shadow: 0 8px 22px -10px rgba(0,0,0,0.35); }
.para-card.vb-card .vb-card-link:focus-visible { outline: none; }
.para-card.vb-card:focus-within { outline: 2px solid #10b981; outline-offset: 2px; }
/* Size the bar by its own width (info pages sit in a narrower column) */
.ghb-integrated-toolbar.vb-compact,
.global-headline-bar.vb-compact { container-type: inline-size; container-name: vbbar; }
@container vbbar (max-width: 1380px) {
  .vb-row .vb-lbl { display: none; }
  .vb-row .rbac-search-trigger kbd { display: none; }
  .vb-row .rbac-identity-btn .rbac-user-name,
  .vb-row .rbac-identity-btn > span:last-child { display: none; }
}
@container vbbar (max-width: 1060px) { .vb-row .vb-title { display: none; } }
@container vbbar (max-width: 800px) {
  .vb-row { flex-wrap: wrap; row-gap: 0.35rem; }
  .vb-row .vb-sep { display: none; }
  .vb-row .vb-pagenav.vb-disabled, .vb-row .vb-flag:disabled { display: none; }
}
/* Streamlined portal cards: titles + topic summaries only */
.para-card.vb-card .status-badge,
.para-card.vb-card .chip.vb-stat,
.para-card.vb-card .metadata-chips.vb-empty,
html.vb-on .section-banner-meta { display: none !important; }
/* Portal cards in Urdu */
.para-card .vb-ur { font-family: var(--font-urdu, 'Noto Nastaliq Urdu', serif); text-align: right; line-height: 2; }
.para-card .juz-title-latin .vb-ur, .para-card .juz-title-latin.vb-ur { font-size: 1.02em; }
.para-card .surah-scope .vb-ur, .para-card .surah-scope.vb-ur { font-size: 0.92em; display: block; }
.para-card.vb-card-ur .metadata-chips { justify-content: flex-end; }
.para-card .chip.vb-ur { line-height: 1.9; padding-top: 0.05rem; padding-bottom: 0.05rem; }
#bookmarks-dashboard[data-ur], footer[data-ur] { direction: rtl; text-align: right; }
/* Internal build credit (links to a file that is not deployed) */
footer p:has(> a[href*=".agents/"]) { display: none; }
/* Account section in More */
.vb-row .vb-account { width: 100%; padding: 0.4rem 0.5rem; border-radius: 8px; background: rgba(197,155,39,0.1); line-height: 1.45; }
.vb-row .vb-acc-name { font-weight: 800; }
.vb-row .vb-acc-role { font-size: 0.76rem; }
.vb-row .vb-acc-caps { font-size: 0.72rem; opacity: 0.75; white-space: normal; }
.vb-row .vb-acc-switch { display: flex; flex-direction: column; gap: 0.2rem; width: 100%; font-size: 0.7rem; opacity: 0.9; }
.vb-row .vb-acc-switch select { padding: 0.3rem; border-radius: 6px; font: inherit; font-size: 0.78rem; }
.vb-row .vb-psec button.ghb-link { width: 100%; text-align: left; background: none; border: 1px solid rgba(197,155,39,0.35); border-radius: 8px; padding: 0.35rem 0.6rem; cursor: pointer; color: inherit; font: inherit; }
/* Role chips on portal cards: not needed with the Account section */
.para-card .rbac-card-role-badge { display: none !important; }
/* EN / اردو switch fixed in the bar */
.vb-row .vb-lang { flex: 0 0 auto; order: 0; }
.vb-row .vb-lang .ghb-lang-btn { border: 0; border-inline-end: 1px solid rgba(197,155,39,0.3); background: transparent; color: inherit; font: inherit; font-size: 0.78rem; font-weight: 700; padding: 0.2rem 0.55rem; cursor: pointer; border-radius: 0; margin: 0; }
.vb-row .vb-lang .ghb-lang-btn:last-child { border-inline-end: 0; }
.vb-row .vb-lang .ghb-lang-btn.active { background: #0d5c3a; color: #fff; }
