/* ==========================================================================
   Back in Business – Exam Builder (front.css)
   ========================================================================== */

/* ------------------------------
   Stepper (top progress)
   ------------------------------ */
.bibh-steps{
  display:flex;
  gap:24px;
  align-items:center;
  margin:8px 0 20px;
}

.bibh-step{
  display:inline-flex;
  align-items:center;
  gap:10px;
  color:#888;
  font-weight:600;
  line-height:1;
  background:transparent;
  padding:8px 14px;
  cursor:pointer;
  border: solid 1px #3c887b!important;
}

.bibh-step span{
  width:28px;
  height:28px;
  border-radius:50%;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  background:#eee;
  font-weight:700;
}

.bibh-step.is-active{
  background:#d2e08c!important;
  border-radius:30px;
  color:#3c887b!important;
}

.bibh-step.is-active span{
  background:#3c887b;
  color:#fff;
}

.bibh-step:hover{
  background:#3c887b !important;
  color:#fff !important;
}

.bibh-step:hover span{
  background:#fff;
  color:#3c887b;
}

.bibh-step:focus-visible{
  outline:2px solid #3c887b;
  outline-offset:2px;
}


/* ------------------------------
   Layout (Selection mode)
   Questions (left, wide) | My Exam (right, 420px)
   ------------------------------ */
.bibh-wrap{--gap:24px;}
.bibh-wrap .bibh-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(300px,400px); /* LEFT flexible, RIGHT capped but shrinkable */
  gap:var(--gap);
  align-items:start
}
.bibh-grid>aside{grid-column:1;min-width:0} /* Question Bank left */
.bibh-grid>main{grid-column:2;min-width:0}  /* My Exam right */

.bibh-right h2,.bibh-left h2{margin:0 0 10px}

/* ------------------------------
   Filters
   ------------------------------ */
.bibh-filters{
  display:flex;
  gap: 10px;
  margin:8px 0 14px;
  padding:8px 0 14px;
  position:sticky;
  top:130px;
  z-index: 1;
  background:transparent;
}
.bibh-filters select,
.bibh-filters input[type="search"]{
  width:100%;
  padding:10px 12px;
}

/* ------------------------------
   Custom question creator
   ------------------------------ */
.bibh-custom{border:1px solid #3c887b;border-radius:30px;margin:0 0 14px;background:#fdfdfd;box-shadow:0 2px 6px rgba(0,0,0,0.05);overflow:hidden}
.bibh-custom__toggle{width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;background:transparent;border:0;font-size:1.05rem;font-weight:700;color:#2f6d86;cursor:pointer;text-align:left}
.bibh-custom__title{margin:0;line-height:1.3}
.bibh-custom__chevron{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:50%;color:#3c887b;background-color: #ffffff;transition:transform .2s ease,background .2s ease,color .2s ease}
.bibh-custom__chevron svg{width:16px;height:16px;display:block}
.bibh-custom.is-open .bibh-custom__chevron{transform:rotate(-180deg);color:#fff;background-color:#3c887b;}
.bibh-custom__panel{display:none;padding:0 16px 16px;overflow:hidden}
.bibh-custom.is-open .bibh-custom__panel{display:block}
.bibh-custom__label{display:block;font-weight:600;font-size:.95rem;margin:12px 0 4px;color:#1f3b4a}
.bibh-custom__textarea{width:100%;padding:10px 12px;border-radius:30px;border:1px solid #dcdcdc;min-height:90px;resize:vertical}
.bibh-custom__inline{display:flex;align-items:center;gap:8px;margin-top:10px;flex-wrap:wrap}
.bibh-custom__input{width:72px;max-width:72px;flex:0 0 72px;padding:8px 10px;border-radius:30px;border:1px solid #dcdcdc;text-align:center}
.bibh-custom__input--full{width:100%;max-width:100%;flex:1 1 100%;text-align:left;margin-bottom:8px}
.bibh-custom__inline .bibh-custom__label{margin:0;line-height:1.2;}

/* ------------------------------
   Question Bank (cards)
   NOTE: Markup uses .bibh-bank__list
   ------------------------------ */
.bibh-bank__list{display:grid;grid-template-columns:1fr;gap:14px}
.bibh-card{
  display:grid;
  grid-template-columns:minmax(0,520px) minmax(0,1fr);
  gap:16px;
  border:1px solid #e8e8e8;
  border-radius:30px;
  padding:14px;
  background:#fcfcfc;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  align-items:start;
  min-width:0;
}
.bibh-card .preview{
  position:relative;
  background:#fff;
  border:1px solid #f0f0f0;
  border-radius:30px;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}
/* Tip lightbulb badge on card preview — hidden until tip is active */
.bibh-card__tip-badge{
  display:none;
  position:absolute;
  top:10px;
  right:10px;
  width:32px;
  height:32px;
  border-radius:50%;
  background:#fff8e1;
  border:2px solid #f9a825;
  font-size:16px;
  line-height:32px;
  text-align:center;
  z-index:3;
  box-shadow:0 2px 6px rgba(0,0,0,.15);
  pointer-events:none;
}
.bibh-card--has-tip .bibh-card__tip-badge{
  display:block;
}
.bibh-card .preview img{width:100%;height:auto;object-fit:contain;background:#fff}
.bibh-card-carousel{position:relative;display:flex;align-items:center;justify-content:center;width:100%}
.bibh-card-carousel img{max-width:100%;height:auto;display:block}
.bibh-card-single{display:flex;align-items:center;justify-content:center;width:100%}
.bibh-card-single img{max-width:100%;height:auto;display:block}
.bibh-card-arrow{position:absolute;top:50%;transform:translateY(-50%);border:none;background:rgba(0,0,0,0.4);color:#fff;width:28px;height:28px;border-radius:50%;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;font-size:14px}
.bibh-card-arrow-left{left:6px}
.bibh-card-arrow-right{right:6px}
.bibh-card-arrow.is-disabled{opacity:.5;cursor:not-allowed}
.bibh-card .meta{
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
  gap:8px;
  padding:2px 0;
}
.bibh-card .meta .bibh-name{
  font-weight:700;
  font-size:1.05rem;
  color:#1f3b4a;
  margin:0;
  line-height:1.3;
}
.bibh-card .meta .bibh-badges{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  padding:0;
}
.bibh-card .meta .bibh-meta-row{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  font-size:0.88rem;
  color:#555;
  padding:4px 0;
  border-top:1px solid #f0f0f0;
}
.bibh-card .meta .bibh-meta-row span{
  display:inline-flex;
  align-items:center;
  gap:4px;
}
.bibh-card .meta .bibh-meta-row strong{
  font-weight:600;
  color:#1f3b4a;
}
.bibh-controls{display:flex;gap:8px;flex-wrap:wrap;margin-top:auto;padding-top:6px}

/* ------------------------------
   My Exam (right column)
   ------------------------------ */
   .bibh-myexam__header{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;margin:0 0 6px; flex-direction: column;}
.bibh-myexam__header h2{margin:0;text-align:left!important}
.bibh-myexam__meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:.95rem;color:#222}
.bibh-myexam__meta strong{font-weight:700}
.bibh-myexam__meta-divider{opacity:.6}

/* Review-only "Name your exam" + page actions, inside the My Exam header (step 2/3) */
.bibh-myexam__namebar{display:none}
.bibh-wrap.is-review .bibh-myexam__namebar{
  display:flex;flex-direction:column;align-items:center;gap:10px;margin-top:14px;width:100%;
}
.bibh-myexam__name-label{font-weight:600;color:#1f3b4a;font-size:.95rem}
.bibh-myexam__name-input{
  width:100%;max-width:420px;text-align:center;padding:10px 16px;
  border:1px solid #cfd8dc;border-radius:30px;font-size:1rem;
}
.bibh-myexam__pageactions{display:flex;flex-wrap:nowrap;gap:12px;justify-content:center;margin-top:4px}
.bibh-myexam__pageactions .bibh-btn{white-space:nowrap}
/* Hide the step-1 sticky Clear/Review bar while in review */
.bibh-wrap.is-review #bibhTopCancelReview{display:none !important}
/* The cog FAB is replaced by the Page Settings button */
.bibh-settings-fab{display:none !important}
/* Page Settings button hover should match the plain Clear button
   (the theme styles <button>:hover green, so force the .bibh-btn look). */
#bibhPageSettingsBtn:hover,
#bibhPageSettingsBtn:focus{ background:#f0f0f0 !important; color:#222 !important; border-color:#ddd !important; }
/* Make it clear an exam can't save without a name: red border + tint while invalid. */
.bibh-myexam__name-input[aria-invalid="true"]{ border-color:#b00020 !important; background:#fff5f5; }
#bibhTitleError{ font-weight:600; }
   
.bibh-list{list-style:none;padding-left:0;margin:0 0 10px;counter-reset:bibh-basket}
.bibh-list>li{counter-increment:bibh-basket;border:1px dashed #e8e8e8;border-radius:30px;padding:12px 14px;margin:10px 0;cursor:grab;}
/* Number circle inside the card (matches the quiz builder). Uses a CSS counter so it
   auto-renumbers on reorder, and a child element (not li::before, which is the Case Study chip). */
.bibh-list__num{flex:0 0 auto;width:26px;height:26px;border-radius:50%;background:#f2f7f7;color:#7c8a90;font-size:11px;font-weight:800;display:flex;align-items:center;justify-content:center}
.bibh-list__num::before{content:counter(bibh-basket)}

/* Hide legacy per-question mark/time boxes */
.bibh-list input[type="number"],
.bibh-list .bibh-legacy-time,
.bibh-list .bibh-legacy-marks{display:none}

/* ------------------------------
   Buttons
   ------------------------------ */
.bibh-btn{display:inline-flex;padding:8px 14px;border-radius:30px;border:1px solid #ddd;background:#f7f7f7;text-decoration:none;color:#222;cursor:pointer;align-items: center;
    justify-content: center;}
.bibh-btn:hover{background:#f0f0f0}
.bibh-btn.primary{background:#d2e08c;color:#3c887b;border-color:#d2e08c}
/* Compact circular "×" remove button for My Exam list items */
.bibh-btn--x{width:30px;height:30px;padding:0;justify-content:center;font-size:15px;line-height:1;font-weight:700;color:#b71c1c;flex-shrink:0}
.bibh-btn--x:hover{background:#fdecea;border-color:#f5c6cb;color:#b71c1c}
.bibh-btn.ghost{background:transparent;border:1px solid #cfcfcf;color:inherit}
.bibh-btn--tip{gap:6px;border-color:#f0d36e;background:#fff6c7;color:#5a4a00}
.bibh-btn--tip:hover{background:#f9ecab}
.bibh-btn--tip.is-active{background:#3c887b;color:#fff;border-color:#3c887b}
.bibh-btn--tip.is-active .bibh-tip-icon{color:#fff}
.bibh-tip-icon{display:inline-flex;align-items:center;justify-content:center;font-size:15px;line-height:1}
.bibh-tip-toggle{position:relative;display:inline-flex;align-items:center}
.bibh-tip-tooltip{position:absolute;left:0;top:100%;margin-top:8px;min-width:220px;max-width:280px;padding:10px 12px;border-radius:30px;background:#fff9dd;border:1px solid #e3d29b;box-shadow:0 10px 24px rgba(0,0,0,0.12);opacity:0;visibility:hidden;transform:translateY(6px);transition:opacity .2s ease,transform .2s ease,visibility .2s ease;z-index:10}
.bibh-tip-toggle:hover .bibh-tip-tooltip,
.bibh-tip-toggle:focus-within .bibh-tip-tooltip{opacity:1;visibility:visible;transform:translateY(0)}
.bibh-tip-tooltip__title{font-weight:700;color:#6d5600;margin-bottom:4px}
.bibh-tip-tooltip__body{font-size:12px;line-height:1.4;color:#3d3d3d;white-space:pre-wrap}
/* Bottom Clear/Review duplicate hidden — the top bar (#bibhTopCancelReview) is the single,
   always-visible control. Buttons stay in the DOM so existing JS click-proxies keep working. */
.bibh-actions{display:none !important}
/* Top Clear/Review bar: sticky so it stays in view while scrolling a long question list, side by side. */
.bibh-wrap:not(.is-review) #bibhTopCancelReview{
  position:sticky;
  top:8px;
  z-index:50;
  display:flex !important;
  flex-wrap:nowrap;
  gap:12px;
  justify-content:center;
  background:#fff;
  padding:10px 0;
  border-radius:30px;
}
#bibhTopCancelReview .bibh-btn{white-space:nowrap}

/* ------------------------------
   Review mode
   ------------------------------ */
.bibh-reviewbar{display:none;margin:0 0 16px}
.bibh-wrap.is-review .bibh-reviewbar{display:block}
.bibh-reviewbar__inner{
  display:grid;grid-template-columns:1fr minmax(280px,720px) 1fr;gap:12px;align-items:center
}
.bibh-reviewbar__left{justify-self:start}
.bibh-reviewbar__center{justify-self:center;text-align:center}
.bibh-reviewbar__right{justify-self:end}
.bibh-reviewbar__label{display:block;font-size:.9rem;opacity:.8;margin-bottom:6px}
.bibh-reviewbar__title{width:min(720px,80vw);max-width:720px;text-align:center;padding:10px 14px}


/* In review mode, hide bank and stretch exam full-width */
.bibh-wrap.is-review .bibh-grid{
  grid-template-columns: 1fr !important;
}
.bibh-wrap.is-review .bibh-grid > aside{
  display: none !important;
}
.bibh-wrap.is-review .bibh-grid > main{
  grid-column: 1 !important;
  width: 100% !important;
  max-width: none !important;
}

.bibh-pages{
   display:block;
}

.bibh-page{
  position:relative;
  width:560px;
  max-width:560px;
  aspect-ratio:210/297;
  background:#fff;
  border:1px solid #ddd;
  box-shadow:0 3px 12px rgba(0,0,0,.06);
  overflow:hidden;
}


/* ------------------------------
   Modal (PDF Preview)
   ------------------------------ */
.bibh-modal{position:fixed;inset:0;background:rgba(0,0,0,.55);display:none;z-index:9999;padding:24px}
.bibh-modal[aria-hidden="false"],.bibh-modal.is-open{display:block!important}
.bibh-modal__dialog{width:min(1100px,96vw);height:min(90vh,96vh);margin:0 auto;position:relative;background:#fff;border-radius:30px;box-shadow:0 20px 50px rgba(0,0,0,.3);overflow:hidden}
.bibh-modal__close{position:absolute;top:10px;right:12px;width:44px;height:44px;border:0;border-radius:50%;background:#1f2937;color:#fff;cursor:pointer;font-size:30px;line-height:1;z-index:5;box-shadow:0 2px 8px rgba(0,0,0,.25)}
.bibh-modal__close:hover{background:#111827}
#bibhModalFrame{position:absolute;inset:48px 0 0 0;height:calc(100% - 48px);width:100%;border:0}
#bibhModalImage{position:absolute;inset:48px 0 0 0;height:calc(100% - 48px);width:100%;object-fit:contain;display:none;margin:0 auto}
#bibhModalImage.is-visible{display:block}
.bibh-modal-open{overflow:hidden}

.bibh-modal__nav{position:absolute;top:50%;transform:translateY(-50%);width:44px;height:44px;border:0;border-radius:50%;background:rgba(31,41,55,.85);color:#fff;font-size:28px;line-height:1;cursor:pointer;z-index:5}
.bibh-modal__nav--prev{left:12px}
.bibh-modal__nav--next{right:12px}
.bibh-modal__counter{position:absolute;top:18px;left:18px;background:rgba(31,41,55,.85);color:#fff;font-size:12px;padding:4px 8px;border-radius:999px;z-index:5}

/* Exam Builder: constrain the preview modal to the viewport so images/PDFs stay visible */
.bibh-exam-preview-modal .bibh-modal__dialog{width:min(1100px,90vw);max-width:90vw;max-height:90vh;height:90vh;display:flex;flex-direction:column;overflow:hidden}
.bibh-exam-preview-modal .bibh-exam-preview-modal__content{position:relative;flex:1 1 auto;height:calc(90vh - 32px);max-height:calc(90vh - 32px);padding:48px 16px 16px;display:flex;align-items:center;justify-content:center;overflow:auto;box-sizing:border-box;min-height:0}
.bibh-exam-preview-modal #bibhModalFrame,.bibh-exam-preview-modal #bibhModalImage{position:static;width:100%;max-width:100%;max-height:100%;border:0}
.bibh-exam-preview-modal #bibhModalFrame{height:100%}
.bibh-exam-preview-modal #bibhModalImage{height:auto;width:auto;display:block;object-fit:contain;margin:0 auto}
.bibh-exam-preview-modal #bibhModalImage:not(.is-visible){display:none}

/* ------------------------------
   Visibility & dropdown safety
   ------------------------------ */
.bibh-wrap .bibh-steps{display:flex!important;gap:24px;align-items:center;margin:8px 0 20px;visibility:visible!important;opacity:1!important;}
.bibh-wrap .bibh-steps,.bibh-wrap .bibh-steps *{color:#333;font-size:16px!important;line-height:1.5!important}
.bibh-wrap h2{text-align: center; color:#222!important}
.bibh-wrap .bibh-filters select,
.bibh-wrap .bibh-filters input[type="search"]{
  position:static;
  z-index:auto;
  color:#1f3b4a;
  -webkit-text-fill-color:#1f3b4a;
  font-size:14px;
  background:#fff!important;
  border-radius: 30px;
  border: 1px solid #3c887b;
  padding:10px 14px;
  cursor:pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bibh-wrap .bibh-filters select:hover,
.bibh-wrap .bibh-filters input[type="search"]:hover{
  border-color:#2a6b5e;
  box-shadow: 0 0 0 3px rgba(60,136,123,0.12);
}
.bibh-wrap .bibh-filters select:focus,
.bibh-wrap .bibh-filters input[type="search"]:focus{
  outline:none;
  border-color:#2a6b5e;
  box-shadow: 0 0 0 3px rgba(60,136,123,0.2);
}
.bibh-wrap .bibh-filters select option{color:#222!important;background:#fff!important}
.bibh-wrap select,.bibh-wrap input,.bibh-wrap .bibh-step span{display:flex;visibility:visible!important;opacity:1!important; border-radius: 30px!important;}
.bibh-modal{position:fixed!important;inset:0!important;z-index:9999!important}

/* ------------------------------
   Responsive
   ------------------------------ */
@media (max-width:1024px){
  .bibh-wrap .bibh-grid{grid-template-columns:1fr}
  .bibh-wrap .bibh-left{position:static}
  .bibh-grid>main{grid-column:1}
}
@media (max-width:900px){
  .bibh-card{grid-template-columns:320px 1fr}
}
@media (max-width:1024px){
  .bibh-wrap{padding:0 12px}

  /* Mobile review: flat sortable list instead of A4 pages */
  .bibh-mobile-reorder{
    list-style:none;
    margin:0;
    padding:0;
    display:flex;
    flex-direction:column;
    gap:16px;
  }
  .bibh-mobile-reorder .bibh-block{
    position:relative !important;
    width:100% !important;
    max-width:100% !important;
    border:1px solid #e0e0e0;
    border-radius:30px;
    background:#fff;
    box-shadow:0 2px 8px rgba(0,0,0,0.06);
    overflow:hidden;
  }
  .bibh-mobile-reorder .bibh-block__head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:10px 12px;
    background:#f8fafb;
    border-bottom:1px solid #eee;
    font-weight:600;
    font-size:0.95rem;
    gap:6px;
    cursor:default;
  }
  .bibh-move-arrows{
    display:inline-flex;
    gap:4px;
    margin-left:auto;
  }
  .bibh-move-arrows button{
    width:34px;
    height:34px;
    border:1px solid #d0d0d0;
    border-radius:30px;
    background:#fff;
    font-size:18px;
    line-height:1;
    cursor:pointer;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    color:#333;
    transition:background 0.12s ease, border-color 0.12s ease;
    -webkit-tap-highlight-color:transparent;
  }
  .bibh-move-arrows button:active{
    background:#e8f5f2;
    border-color:#3c887b;
  }
  .bibh-move-arrows button.is-disabled,
  .bibh-move-arrows button:disabled{
    opacity:0.3;
    cursor:default;
    pointer-events:none;
  }
  .bibh-mobile-reorder .bibh-block__thumb{
    width:100% !important;
    height:auto !important;
    max-height:none !important;
    display:block;
    object-fit:contain;
  }
  .bibh-mobile-reorder .bibh-block__ph{
    height:200px;
    border-radius:0;
  }
  .bibh-mobile-reorder .bibh-block-placeholder{
    min-height:80px;
    border:2px dashed #91d1db;
    border-radius:30px;
    background:#f0fafb;
  }

  /* Hide A4 page containers on mobile review */
  .bibh-mobile-reorder ~ .bibh-page,
  .bibh-mobile-reorder ~ .bibh-page-row{
    display:none !important;
  }
}

/* ==============================
   Mobile floating basket FAB + drawer
   ============================== */
.bibh-basket-fab{
  display:none; /* shown via media query */
}
.bibh-basket-backdrop{
  display:none;
}
.bibh-basket-drawer{
  display:none;
}
@media (max-width:1024px){
  /* Hide the right-column basket on mobile/tablet step 1 */
  .bibh-wrap:not(.is-review) .bibh-right{
    display:none !important;
  }

  /* FAB button */
  .bibh-basket-fab{
    display:flex;
    position:fixed;
    bottom:24px;
    right:24px;
    z-index:9990;
    width:56px;
    height:56px;
    border-radius:50%;
    background:#3c887b;
    color:#fff;
    border:none;
    box-shadow:0 4px 16px rgba(0,0,0,0.2);
    align-items:center;
    justify-content:center;
    cursor:pointer;
    -webkit-tap-highlight-color:transparent;
    transition:transform 0.15s ease;
  }
  .bibh-basket-fab:active{transform:scale(0.92)}
  .bibh-basket-fab__count{
    position:absolute;
    top:-4px;
    right:-4px;
    min-width:22px;
    height:22px;
    border-radius:30px;
    background:#d32f2f;
    color:#fff;
    font-size:12px;
    font-weight:700;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:0 5px;
  }
  .bibh-basket-fab:not(.has-items) .bibh-basket-fab__count{
    display:none;
  }
  /* Bounce when a question is added */
  .bibh-basket-fab.bibh-fab-bounce{
    animation:bibhFabBounce 0.45s ease;
  }
  .bibh-basket-fab.bibh-fab-bounce .bibh-basket-fab__count{
    animation:bibhCountPop 0.45s ease;
  }
  @keyframes bibhFabBounce{
    0%  {transform:scale(1)}
    25% {transform:scale(1.18)}
    50% {transform:scale(0.95)}
    75% {transform:scale(1.06)}
    100%{transform:scale(1)}
  }
  @keyframes bibhCountPop{
    0%  {transform:scale(1)}
    30% {transform:scale(1.4)}
    60% {transform:scale(0.9)}
    100%{transform:scale(1)}
  }
  /* Hide FAB during review stage */
  .bibh-wrap.is-review ~ .bibh-basket-fab,
  body:has(.bibh-wrap.is-review) .bibh-basket-fab{
    display:none !important;
  }

  /* Backdrop */
  .bibh-basket-backdrop{
    display:none;
    position:fixed;
    inset:0;
    z-index:9991;
    background:rgba(0,0,0,0.4);
    -webkit-tap-highlight-color:transparent;
  }
  .bibh-basket-backdrop.is-visible{display:block}

  /* Drawer */
  .bibh-basket-drawer{
    display:block;
    position:fixed;
    bottom:0;
    left:0;
    right:0;
    z-index:9992;
    background:#fff;
    border-radius:30px 30px 0 0;
    box-shadow:0 -4px 24px rgba(0,0,0,0.15);
    max-height:80vh;
    overflow-y:auto;
    -webkit-overflow-scrolling:touch;
    transform:translateY(100%);
    transition:transform 0.25s ease;
  }
  .bibh-basket-drawer.is-open{
    transform:translateY(0);
  }
  .bibh-basket-drawer__header{
    display:flex;
    align-items:center;
    gap:12px;
    padding:16px 18px 12px;
    border-bottom:1px solid #eee;
    position:sticky;
    top:0;
    background:#fff;
    z-index:1;
    border-radius:30px 30px 0 0;
  }
  .bibh-basket-drawer__header h3{
    margin:0;
    font-size:1.1rem;
    color:#1f3b4a;
  }
  .bibh-basket-drawer__meta{
    display:flex;
    gap:12px;
    font-size:0.85rem;
    color:#555;
    margin-left:auto;
  }
  .bibh-basket-drawer__meta strong{font-weight:700;color:#1f3b4a}
  .bibh-basket-drawer__close{
    width:36px;
    height:36px;
    border:none;
    background:#f0f0f0;
    border-radius:50%;
    font-size:22px;
    line-height:1;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#333;
    flex-shrink:0;
  }

  /* Drawer list */
  .bibh-basket-drawer__list{
    list-style:none;
    margin:0;
    padding:8px 16px;
  }
  .bibh-basket-drawer__item{
    display:flex;
    align-items:center;
    gap:8px;
    padding:10px 0;
    border-bottom:1px solid #f0f0f0;
  }
  .bibh-basket-drawer__item:last-child{border-bottom:none}
  .bibh-basket-drawer__pos{
    font-weight:700;
    color:#888;
    font-size:0.85rem;
    min-width:24px;
  }
  .bibh-basket-drawer__title{
    flex:1;
    font-size:0.9rem;
    color:#1f3b4a;
    font-weight:500;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .bibh-basket-drawer__btns{
    display:flex;
    gap:4px;
    flex-shrink:0;
  }
  .bibh-basket-drawer__btns button{
    width:32px;
    height:32px;
    border:1px solid #ddd;
    border-radius:30px;
    background:#fff;
    font-size:16px;
    line-height:1;
    cursor:pointer;
    display:flex;
    align-items:center;
    justify-content:center;
    color:#333;
    -webkit-tap-highlight-color:transparent;
  }
  .bibh-basket-drawer__btns button:active{
    background:#e8f5f2;
    border-color:#3c887b;
  }
  .bibh-basket-drawer__btns button.is-disabled,
  .bibh-basket-drawer__btns button:disabled{
    opacity:0.25;
    pointer-events:none;
  }
  .bibh-drawer-remove{color:#d32f2f !important;font-weight:700}
  .bibh-basket-drawer__empty{
    padding:24px 0;
    text-align:center;
    color:#999;
    font-style:italic;
  }

  /* Drawer actions */
  .bibh-basket-drawer__actions{
    display:flex;
    gap:10px;
    padding:12px 16px 20px;
    border-top:1px solid #eee;
    position:sticky;
    bottom:0;
    background:#fff;
  }
  .bibh-basket-drawer__actions .bibh-btn{
    flex:1;
    text-align:center;
    padding:12px;
    border-radius:30px;
    font-weight:600;
  }



  body.bibh-drawer-open{overflow:hidden}
}

@media (max-width:640px){
  .bibh-card{grid-template-columns:1fr}
  .bibh-steps{gap:14px}
  .bibh-step span{width:24px;height:24px}

  /* Builder PDF preview modal — full-screen bottom sheet on phones */
  .bibh-exam-preview-modal{align-items:flex-end !important;padding:0 !important;}
  .bibh-exam-preview-modal .bibh-modal__dialog{
    width:100vw !important;
    max-width:100vw !important;
    height:92vh !important;
    max-height:92vh !important;
    border-radius:16px 16px 0 0 !important;
    box-shadow:0 -8px 40px rgba(0,0,0,.25) !important;
  }
  .bibh-exam-preview-modal .bibh-exam-preview-modal__content{
    overflow:auto !important;
    -webkit-overflow-scrolling:touch;
    height:100% !important;
    max-height:none !important;
    padding:48px 0 0 !important;
  }
  .bibh-modal__print-footer{padding:10px 16px;}
  .bibh-modal__print-footer .bibhme-print{width:100%;justify-content:center;}
}

/* ==============================
   Settings FAB + drawer (all screen sizes)
   ============================== */
.bibh-settings-fab{
  display:flex;
  position:fixed;
  bottom:24px;
  right:24px;
  z-index:9990;
  width:56px;
  height:56px;
  border-radius:50%;
  background:#3c887b;
  color:#fff;
  border:none;
  box-shadow:0 4px 16px rgba(0,0,0,0.2);
  align-items:center;
  justify-content:center;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  transition:transform 0.15s ease;
  font-size:24px;
}
.bibh-settings-fab:active{transform:scale(0.92)}

.bibh-settings-drawer{
  display:block;
  position:fixed;
  bottom:0;
  left:0;
  right:0;
  z-index:9992;
  background:#fff;
  border-radius:30px 30px 0 0;
  box-shadow:0 -4px 24px rgba(0,0,0,0.15);
  max-height:60vh;
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
  transform:translateY(100%);
  transition:transform 0.25s ease;
  padding:0 0 20px;
}
.bibh-settings-drawer.is-open{
  transform:translateY(0);
}
.bibh-settings-drawer__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 18px 12px;
  border-bottom:1px solid #eee;
  position:sticky;
  top:0;
  background:#fff;
  border-radius:30px 30px 0 0;
  z-index:1;
}
.bibh-settings-drawer__header h3{
  margin:0;
  font-size:1.1rem;
  color:#1f3b4a;
}
.bibh-settings-drawer__close{
  width:36px;
  height:36px;
  border:none;
  background:#f0f0f0;
  border-radius:50%;
  font-size:22px;
  line-height:1;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#333;
}
.bibh-settings-drawer__body{
  padding:16px 18px;
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.bibh-settings-drawer__body .bibh-toggle-pill{
  padding:10px 12px;
  background:#fff;
  border:1px solid #eee;
  border-radius:30px;
  gap:8px;
}
.bibh-settings-drawer__body .bibh-toggle-pill.is-active{
  background:#e8f5f2;
  border-color:#3c887b;
}

/* Download top bar (all screen sizes) */
.bibh-review-topbar{
  display:flex;
  gap:10px;
  padding:12px 0 16px;
}
.bibh-review-topbar .button{
  flex:1;
  padding:14px 10px;
  border-radius:30px;
  font-size:0.95rem;
  font-weight:600;
  text-align:center;
}

/* Force hidden by default (helps if theme styles interfere) */
.bibh-reviewbar { display: none !important; }
/* Only show in step 2 */
.bibh-wrap.is-review .bibh-reviewbar { display: block !important; }

/* Review help */
.bibh-review-help{
  margin-top:8px;
  font-size:.9rem;
  color:#666;
}

/* ==============================
   REVIEW STAGE: A4 pages + blocks
   ============================== */
.bibh-page__stack{
  position:absolute;
  inset:24px;                /* page margins */
  overflow:hidden;
  list-style:none;
  margin:0 !important;
  padding-left: 10px !important;
  padding-right: 10px !important;
}
.bibh-block{
  background:#fafafa;
  border:1px dashed #cfcfcf;
  border-radius:30px;
  margin:10px 0;
  padding:10px;
  cursor:grab;
}
.bibh-block .bibh-block__head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  margin-bottom:8px;
  font-weight:600;
  font-size:0.95rem;
  position:relative;
  z-index:2;
  cursor:grab;
}
.bibh-block .bibh-block__thumb{
  width:100%;
  height:auto;
  display:block;
  border-radius:30px;
  background:#f5f5f5;
  pointer-events:none;
}
.bibh-block__ph{
  width:100%;
  height:520px;              /* visible fallback when no PDF thumb */
  border-radius:30px;
  background:#f5f5f5;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#888;
  font-weight:600;
  letter-spacing:0.08em;
}
.bibh-block-placeholder{
  background:repeating-linear-gradient(45deg,#eee,#eee 6px,#f8f8f8 6px,#f8f8f8 12px);
  border:1px dashed #bbb;
  border-radius:30px;
  height:120px;
  min-height:80px;
  margin:10px 0;
}
.bibh-block__remove{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:24px;
  height:24px;
  margin-left:6px;
  color:#fff;
  font-size:16px;
  line-height:1;
  cursor:pointer;
  flex-shrink:0;
}
.bibh-block__remove:hover{ background:#b71c1c; }
.bibh-block--custom{background:#fff;border-style:solid;}
.bibh-block__custom-body{color:#133c4f;font-size:0.95rem;line-height:1.5;margin-top:4px;}
.bibh-block__custom-text{margin:0;white-space:pre-wrap;}
.bibh-block__lines{display:flex;flex-direction:column;gap:6px;margin-top:10px;}
.bibh-block__line{border-bottom:1px solid #000;height:18px;}
.bibh-block--clamped { overflow: hidden; }
.bibh-block--clamped .bibh-block__thumb {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}
/* Ensure drag works even if theme disables pointer events/select */
.bibh-page__stack,
.bibh-block,
.bibh-block__head {
  pointer-events: auto;
  user-select: text;
}

/* In review, hide bank & stretch right column full width (you already have stepper styles) */
.bibh-wrap.is-review .bibh-grid{grid-template-columns:1fr}
.bibh-wrap.is-review .bibh-grid>aside{display:none}
.bibh-wrap.is-review .bibh-grid>main{grid-column:1}


/* =========================================================
   BIBH – Review controls + PDF export helpers (append-only)
   ========================================================= */

/* Original sidebar — replaced by settings FAB + drawer on all screen sizes.
   ID selector ensures this wins over any theme or plugin override. */
.bibh-review-controls,
#bibhDownloadControls {
  display: none !important;
}

.bibh-toggle-wrap{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bibh-toggle-pill{
  display: inline-flex;
  align-items: center;
  gap: 12px;
  border: none;
  background: transparent;
  padding: 4px 0;
  cursor: pointer;
  color: inherit;
  font-weight: 600;
  box-shadow: none;
}

.bibh-toggle-text{
  white-space: nowrap;
}

.bibh-toggle-pill:hover, .bibh-toggle-pill:focus{
  background: transparent;
  color: #3d3d3d;
}

.bibh-toggle-switch{
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #e8e8e8;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
  flex-shrink: 0;
}

.bibh-toggle-knob{
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.2s ease;
}

.bibh-toggle-pill.is-active .bibh-toggle-switch{
  background: #3e816f;
}

.bibh-toggle-pill.is-active .bibh-toggle-knob{
  transform: translateX(20px);
}

.bibh-toggle-pill:focus-visible .bibh-toggle-switch{
  outline: 2px solid #3e816f;
  outline-offset: 2px;
}

/* ---------------------------------------------------------
   A4 page sizing for export (questions + solutions)
   We keep your 794px preview sizing, but when exporting from
   the off-screen sandbox or solutions view, force exact A4.
   --------------------------------------------------------- */
#bibhExportSandbox .bibh-page,
.bibh-solutions .bibh-page{
  width: 210mm !important;
  height: 297mm !important;
  aspect-ratio: auto !important;
}

/* Ensure page content fits within margins during export */
#bibhExportSandbox .bibh-page__stack,
.bibh-solutions .bibh-page__stack{
  inset: 24px !important;      /* same margins as preview */
  overflow: hidden !important;
}

/* ---------------------------------------------------------
   Solutions visibility
   By default, hide answers/marking in the Review preview.
   When exporting the Solutions PDF we add .bibh-solutions.
   --------------------------------------------------------- */
.bibh-block__answer,
.bibh-block__solution,
.bibh-block__marking{
  display: none;
}

.bibh-solutions .bibh-block__answer,
.bibh-solutions .bibh-block__solution,
.bibh-solutions .bibh-block__marking,
.bibh-page.is-solutions .bibh-block__answer,
.bibh-page.is-solutions .bibh-block__solution,
.bibh-page.is-solutions .bibh-block__marking{
  display: block;
}



/* ===========================================
   REVIEW: two-column layout (pages + controls)
   =========================================== */
/* Review layout — single column, sidebar replaced by settings FAB */
.bibh-review__layout{
  display: block;
}

/* keep all existing page styles via .bibh-pages */
.bibh-review__pages{
    padding-top: 2pc;
}

/* Ensure export sandbox/solutions force true A4 size */
#bibhExportSandbox .bibh-page,
.bibh-solutions .bibh-page{
  width: 210mm !important;
  height: 297mm !important;
  aspect-ratio: auto !important;
}
#bibhExportSandbox .bibh-page__stack,
.bibh-solutions .bibh-page__stack{
  inset: 24px !important;
  overflow: hidden !important;
}


.bibh-card .meta .bibh-name {
  font-weight: 600;
  margin: 6px 0 4px;
}

.bibh-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 30px;
  background: #e8f5f2;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: #2a6b5e;
  border: 1px solid #c5e4dc;
}
.bibh-chip--hl{background:#fff3e0;color:#b45309;border-color:#fdd89b}
.bibh-chip--ol{background:#e8eaf6;color:#3949ab;border-color:#c5cae9}
/* Case Study = green, Sample Paper = red (swapped 2026-06-22) */
.bibh-chip--case{background:#e8f5f2;color:#2a6b5e;border-color:#c5e4dc}
.bibh-chip--paper{background:#fce4ec;color:#c62828;border-color:#f8bbd0}

.bibh-badges {
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    padding-bottom: 0;
}

.bibh-right{
    position: sticky;
    top: 140px;
    max-height: calc(100vh - 200px);
    overflow: auto;
}

bibh-myexam .bibh-chip,
.bibh-myexam .bibh-badges {
  display: none !important;
}

.bibh-wrap.is-review .bibh-right{
  position:static;
  top:auto;
  max-height:none;
  overflow:visible;
  align-self:stretch;
}

/* "In exam" toggle state */
.bibh-card .bibh-controls .bibh-btn.in-exam,
.bibh-btn.in-exam {
  background: #d32f2f !important;   /* red */
  color: #fff !important;            /* white text */
  border-color: #d32f2f !important;
}

/* Hover/focus state for better feedback */
.bibh-card .bibh-controls .bibh-btn.in-exam:hover,
.bibh-card .bibh-controls .bibh-btn.in-exam:focus,
.bibh-btn.in-exam:hover,
.bibh-btn.in-exam:focus {
  background: #b71c1c !important;
  border-color: #b71c1c !important;
  color: #fff !important;
}

/* make it feel draggable everywhere */
.bibh-page__stack .bibh-block { cursor: grab; }


/* clearer drop affordance if you like */
.bibh-page__stack.is-drag-over { outline: 2px dashed #91d1db; outline-offset: 4px; }

/* Inside a page stack, avoid paying for top/bottom margins unnecessarily */
.bibh-page__stack > .bibh-block:first-child { margin-top: 0; }
.bibh-page__stack > .bibh-block:last-child  { margin-bottom: 0; }

.bibh-page,
.bibh-page__stack,
.bibh-block { box-sizing: border-box; }


/* ------------------------------
   Saved Exams List (bibh_my_exams)
   ------------------------------ */
.bibh-my-exams {
  margin: 0 auto !important;
  max-width: 900px !important;
  color: #2c2c2c;
}

.bibh-my-exams__notice {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: 30px;
  background: #f9fafb;
  font-weight: 600;
}

.bibh-my-exams__notice--success { border-color: #b8e3c5; background: #f1fbf4; color: #1f6f3c; }
.bibh-my-exams__notice--error   { border-color: #f5c2c7; background: #fff1f2; color: #9a1c2f; }
.bibh-my-exams__notice--muted   { color: #6b7280; }

.bibh-my-exams__inner { width: 100%; display: flex; flex-direction: column; gap: 12px; }

.bibh-my-exams__toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.bibh-my-exams__bulk {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bibh-my-exams__bulk select {
  padding: 10px 12px;
  border-radius: 30px;
  border: 1px solid #e8e8e8;
  background: #fff;
}

.bibh-my-exams__table-wrap {
  border: 1px solid #e8e8e8 !important;
  background: #fff !important;
  border-radius: 30px !important;
  box-shadow: 2px 2px 7px rgba(0, 0, 0, 0.07) !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 6pc !important;
}

.bibh-my-exams__table {
  border: none !important;
  width: 100% !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  font-size: 16px !important;
}

.bibh-my-exams__table thead {
  background: rgba(0, 0, 0, 0.04) !important;
  color: #2b2b2b !important;
  font-weight: 700 !important;
}

.bibh-my-exams__table th,
.bibh-my-exams__table td {
  padding: 14px 18px !important;
  border: 0px !important;
  text-align: left !important;
  white-space: nowrap;
}
.bibh-my-exams__table td:nth-child(1) {
  white-space: normal;
  min-width: 120px;
}

.bibh-my-exams__table tbody tr:last-child td { border-bottom: 0; }

.bibh-my-exams__cell--select { width: 50px; text-align: center; }
.bibh-my-exams__cell--select input[type="checkbox"] { width: 18px; height: 18px; }

/* Row actions (Edit link under exam title) */
.bibh-my-exams__row-actions {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1;
}
.bibh-my-exams__edit-link {
  color: #3a8a72;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
.bibh-my-exams__edit-link:hover {
  color: #2a6b58;
  text-decoration: underline;
}

/* Rename link — same style as edit/duplicate */
.bibh-my-exams__rename-link {
  color: #3a8a72;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.15s;
  margin-left: 10px;
  cursor: pointer;
}
.bibh-my-exams__rename-link:hover {
  color: #2a6b58;
  text-decoration: underline;
}

/* Duplicate link — same style as edit but visually distinct */
.bibh-my-exams__duplicate-link {
  color: #3a8a72;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.15s;
  margin-left: 10px;
}
.bibh-my-exams__duplicate-link:hover {
  color: #2a6b58;
  text-decoration: underline;
}

/* Delete link */
.bibh-my-exams__delete-link {
  color: #c0392b;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.15s;
  margin-left: 10px;
}
.bibh-my-exams__delete-link:hover {
  color: #922b21;
  text-decoration: underline;
}

/* Label badge — small teal chip under the exam title */
.bibh-my-exams__label-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  border-radius: 20px;
  background: #e8f4f0;
  color: #2a6b58;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  vertical-align: middle;
  white-space: nowrap;
}

/* Filter bar above the exam table */
.bibh-my-exams__filter-bar {
  margin-bottom: 14px;
}
.bibh-my-exams__filter-input {
  width: 100%;
  max-width: 340px;
  padding: 9px 14px;
  border: 1px solid #dde8e5;
  border-radius: 30px;
  font-size: 14px;
  color: #203d48;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.bibh-my-exams__filter-input:focus {
  border-color: #3a8a72;
  box-shadow: 0 0 0 3px rgba(58,138,114,0.12);
}


.bibh-sort {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bibh-sort__icon {
  font-size: 13px;
  color: #9ca3af;
}

.bibh-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  cursor: pointer;
}

.bibh-pill--download {
  background: #3c887b;
  color: #fff;
  border-color: #3c887b;
}

.bibh-pill--download:hover,
.bibh-pill--download:focus-visible { background: #27644d; color: #fff; border-color: #27644d; }

/* Generate PDFs button — outlined teal, shows when a copy has no PDFs yet */
.bibh-pill--generate {
  background: #fff;
  color: #3c887b;
  border-color: #3c887b;
  font-family: inherit;
}
.bibh-pill--generate:hover,
.bibh-pill--generate:focus-visible { background: #3c887b; color: #fff; }
.bibh-pill--generate:disabled { opacity: 0.6; cursor: wait; }

.bibh-pill--action {
  background: #3c887b;
  color: #fff;
  border-color: #3c887b;
}

.bibh-pill--action:hover,
.bibh-pill--action:focus-visible { background: #0b1221; color: #fff; border-color: #0b1221; }

/* Tablet: tighter padding */
@media (max-width: 900px) {
  .bibh-my-exams__table th,
  .bibh-my-exams__table td {
    padding: 10px 10px !important;
    font-size: 14px !important;
  }
  .bibh-pill {
    padding: 7px 10px;
    font-size: 13px;
  }
}

/* Mobile: convert table to labelled cards */
@media (max-width: 600px) {
  .bibh-my-exams { padding: 0; }
  .bibh-my-exams__inner { width: 100%; }
  .bibh-my-exams__table-wrap {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;
    overflow: visible !important;
    border-radius: 0 !important;
  }
  .bibh-my-exams__table,
  .bibh-my-exams__table thead,
  .bibh-my-exams__table tbody,
  .bibh-my-exams__table tr,
  .bibh-my-exams__table th,
  .bibh-my-exams__table td {
    display: block !important;
  }
  .bibh-my-exams__table thead {
    display: none !important;
  }
  .bibh-my-exams__table tbody tr {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 30px;
    padding: 18px 20px;
    margin-bottom: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
  }
  .bibh-my-exams__table td {
    padding: 4px 0 !important;
    border: none !important;
    white-space: normal !important;
    text-align: left !important;
  }
  /* Label each cell with its column name */
  .bibh-my-exams__table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: #9aada8;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 2px;
  }
  /* Title */
  .bibh-my-exams__table td:nth-child(1) {
    font-weight: 700;
    font-size: 1.1rem;
    padding-bottom: 10px !important;
  }
  /* Date + Marks on one line */
  .bibh-my-exams__table td:nth-child(2),
  .bibh-my-exams__table td:nth-child(3) {
    display: inline-block !important;
    width: auto !important;
    margin-right: 16px;
    padding-bottom: 6px !important;
  }
  /* Download buttons — stack full-width for easy tapping */
  .bibh-my-exams__table td:nth-child(4),
  .bibh-my-exams__table td:nth-child(5) {
    display: block !important;
    width: 100% !important;
    padding-top: 6px !important;
  }
  .bibh-my-exams__table td:nth-child(4) .bibh-pill,
  .bibh-my-exams__table td:nth-child(5) .bibh-pill {
    display: block;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    padding: 11px 16px;
    font-size: 14px;
  }

  /* Row actions (Edit · Duplicate) — space them out on mobile */
  .bibh-my-exams__row-actions {
    margin-top: 6px;
    font-size: 13px;
  }
  .bibh-my-exams__duplicate-link,
  .bibh-my-exams__delete-link {
    margin-left: 8px;
  }

  /* Label badge wraps gracefully */
  .bibh-my-exams__label-badge {
    margin-left: 0;
    margin-top: 4px;
    display: inline-block;
  }

  /* Filter bar full-width on mobile */
  .bibh-my-exams__filter-input {
    max-width: 100%;
  }

  /* Toolbar: stack bulk action dropdown + Apply button */
  .bibh-my-exams__toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .bibh-my-exams__bulk {
    flex-direction: column;
    gap: 6px;
  }
  .bibh-my-exams__bulk select,
  .bibh-my-exams__bulk .bibh-pill--action {
    width: 100%;
    box-sizing: border-box;
  }
}

/* ===========================
 * PDF building overlay
 * =========================== */
#bibh-pdf-loader {
  position: fixed;
  inset: 0; /* top/right/bottom/left: 0 */
  background: rgba(0, 0, 0, 0.45);
  z-index: 9999;
  display: none;              /* toggled via JS */
  align-items: center;
  justify-content: center;
}

/* Inner box */
.bibh-pdf-loader-inner {
  background: #ffffff;
  padding: 24px 32px 22px;
  border-radius: 30px;
  text-align: center;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  min-width: 260px;
  max-width: 340px;
}

/* Circular spinner */
.bibh-pdf-spinner {
  width: 42px;
  height: 42px;
  margin: 0 auto 12px auto;
  border-radius: 50%;
  border: 4px solid #e0e0e0;
  border-top-color: #1a73e8;  /* change to brand colour if you like */
  animation: bibh-spin 0.75s linear infinite;
}

@keyframes bibh-spin {
  to {
    transform: rotate(360deg);
  }
}

#bibh-pdf-loader p {
  margin: 0;
  font-size: 14px;
  color: #202124;
}

#bibh-pdf-loader p span {
  font-weight: 600;
  display: block;
  margin-bottom: 2px;
}

#bibh-pdf-loader small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: #5f6368;
}

/* Hide top Cancel/Review buttons during Step 2 (Review stage) */
.bibh-wrap.is-review #bibhTopCancelReview {
  display: none !important;
}

/* ------------------------------
   Bank pagination
   ------------------------------ */
.bibh-bank__pager{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  margin:14px 0 0;
}

.bibh-bank__pager-btn{
  border:1px solid #ddd;
  background:#3e7994;
  border-radius:30px;
  padding:8px 14px;
  cursor:pointer;
}

.bibh-bank__pager-btn[disabled]{
  opacity:.5;
  cursor:not-allowed;
}

.bibh-bank__pager-info{
  font-weight:600;
  color:#203d48;
}

/* ==============================
   Case Study group — visual bracket
   Targets data-case-role="case" (parent) and data-case-role="case-child"
   set by liForItem() and the Step 2 block renderer.
   ============================== */

/* ── My Exam basket sidebar ───────────────────── */
.bibh-list > li[data-case-role="case"],
.bibh-list > li[data-case-role="case-child"] {
  border-color: #3c887b;
  border-style: solid;
  background: #eef7f5;
}

/* Collapse the gap between group members so they read as one unit */
.bibh-list > li[data-case-role="case"]       { margin-bottom: 3px; }
.bibh-list > li[data-case-role="case-child"] { margin-top: 3px; padding-left: 22px; }

/* "Case Study" label chip above the parent title */
.bibh-list > li[data-case-role="case"]::before {
  content: "Case Study";
  display: block;
  width: fit-content;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #2a6b58;
  background: #c8ece6;
  border-radius: 30px;
  padding: 2px 10px;
  margin-bottom: 5px;
}

/* ── Mobile basket drawer ─────────────────────── */
.bibh-basket-drawer__item[data-case-role="case"],
.bibh-basket-drawer__item[data-case-role="case-child"] {
  background: #eef7f5;
  border-bottom-color: #b8dfd9;
  box-shadow: inset 3px 0 0 #3c887b;
  padding-left: 6px;
}

/* Slight extra indent on drawer child titles */
.bibh-basket-drawer__item[data-case-role="case-child"] .bibh-basket-drawer__title {
  padding-left: 8px;
}

/* ── Step 2 desktop blocks ────────────────────── */
.bibh-block[data-case-role="case"],
.bibh-block[data-case-role="case-child"] {
  border-color: #3c887b;
  border-style: solid;
  background: #eef7f5;
}

/* ── Step 2 mobile blocks ─────────────────────── */
.bibh-mobile-reorder .bibh-block[data-case-role="case"],
.bibh-mobile-reorder .bibh-block[data-case-role="case-child"] {
  border-color: #3c887b;
  background: #eef7f5;
}

/* ── Builder modal: exam PDF print footer ─────────────────────────────────── */
/* Footer bar with Print button — hidden until JS opens an exam PDF in modal   */
.bibh-modal__print-footer {
  padding: 12px 18px;
  text-align: center;
  border-top: 1px solid #e5e7eb;
  background: #fafafa;
  flex-shrink: 0;
}
.bibh-modal__print-footer[hidden] { display: none; }
.bibh-modal__print-footer .bibhme-print {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 26px; font-size: .95rem; font-weight: 600;
  background: #2a6b58; color: #fff; border: none; border-radius: 6px; cursor: pointer;
}
.bibh-modal__print-footer .bibhme-print:hover { background: #1f5244; }
/* When the print footer is visible, release the hard pixel height on the content
   area. flex:1 1 0 + min-height:0 fills remaining flex space correctly — the
   iframe's height:100% then resolves against this flex-sized parent and fills
   the area fully, even without an explicit calc() height.                     */
.bibh-modal--with-print.bibh-exam-preview-modal .bibh-exam-preview-modal__content {
  flex: 1 1 0 !important;
  height: 0 !important;
  max-height: none !important;
  min-height: 0 !important;
}
