/* =========================================================
   BookVault Study Board / OSCE Board
   File target: static/css/core.css

   Safe prefixed classes only:
   bv-study-*
========================================================= */

.bv-study-shell {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
  padding: 24px;
  color: var(--bv-text-main);
}

.bv-study-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
  padding: 22px;
  border: 1px solid var(--bv-border-color, var(--bv-border-main));
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)),
    var(--bv-bg-card, var(--bv-bg-panel));
  box-shadow: 0 14px 40px rgba(0,0,0,0.16);
}

.bv-study-header h1 {
  margin: 0;
  font-family: var(--bv-font-heading, inherit);
  font-size: clamp(24px, 3vw, 38px);
  letter-spacing: 0.02em;
  color: var(--bv-text-main);
}

.bv-study-header p {
  margin: 6px 0 0;
  color: var(--bv-text-subtle);
  font-size: 14px;
}

/* =========================================================
   Empty states
========================================================= */

.bv-study-empty {
  padding: 42px 24px;
  border: 1px dashed var(--bv-border-color, var(--bv-border-main));
  border-radius: 18px;
  text-align: center;
  background: var(--bv-bg-card, var(--bv-bg-panel));
  color: var(--bv-text-main);
}

.bv-study-empty h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.bv-study-empty p {
  margin: 0 0 16px;
  color: var(--bv-text-subtle);
}

.bv-study-empty--compact {
  margin-top: 18px;
  padding: 30px 20px;
}

/* =========================================================
   Folder shell
========================================================= */

.bv-study-folder {
  margin-bottom: 26px;
  padding: 18px;
  border: 1px solid var(--bv-border-color, var(--bv-border-main));
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.035), rgba(0,0,0,0.02)),
    var(--bv-bg-card, var(--bv-bg-panel));
  box-shadow: 0 10px 28px rgba(0,0,0,0.12);
}

.bv-study-folder__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.bv-study-folder__title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--bv-text-main);
  font: inherit;
  font-weight: 800;
  font-size: 22px;
  text-align: left;
  cursor: pointer;
}

.bv-study-folder__title:hover {
  color: var(--bv-accent-primary);
}

.bv-study-folder__title span[contenteditable="true"] {
  outline: none;
  border-radius: 8px;
  padding: 4px 6px;
}

.bv-study-folder__title span[contenteditable="true"]:focus {
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bv-accent-primary) 55%, transparent);
}

.bv-study-folder__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.bv-study-badge {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid var(--bv-border-color, var(--bv-border-main));
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  color: var(--bv-text-subtle);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =========================================================
   Batch grid
========================================================= */

.bv-study-batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.bv-study-batch {
  position: relative;
  border: 1px solid var(--bv-border-color, var(--bv-border-main));
  border-radius: 16px;
  background: var(--bv-bg-card, var(--bv-bg-panel));
  color: var(--bv-text-main);
  overflow: hidden;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.bv-study-batch--minimized {
  min-height: 135px;
  padding: 18px 14px 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bv-study-batch--minimized:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(0,0,0,0.18);
}

.bv-study-batch--expanded {
  grid-column: 1 / -1;
  padding: 20px;
  border-left-width: 6px;
}

.bv-study-batch__thumb {
  width: 100%;
  text-align: center;
  pointer-events: none;
}

.bv-study-batch__title {
  max-width: 100%;
  margin: 0 auto 8px;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bv-study-batch__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: rgba(255,255,255,0.10);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bv-study-batch__hint {
  margin-top: 9px;
  color: var(--bv-text-subtle);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0;
  transform: translateY(5px);
  transition: 160ms ease;
}

.bv-study-batch--minimized:hover .bv-study-batch__hint {
  opacity: 1;
  transform: translateY(0);
}

.bv-study-mini-delete {
  position: absolute;
  top: 9px;
  right: 10px;
  z-index: 2;
  border: 0;
  background: transparent;
  color: var(--bv-text-subtle);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
}

.bv-study-mini-delete:hover {
  color: #ef4444;
  opacity: 1;
}

/* =========================================================
   Expanded batch
========================================================= */

.bv-study-batch__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--bv-border-color, var(--bv-border-main));
}

.bv-study-batch__titlewrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.bv-study-batch__titlewrap h3 {
  margin: 0;
  outline: none;
  border-radius: 8px;
  padding: 5px 7px;
  font-size: 21px;
  font-weight: 900;
  color: var(--bv-text-main);
}

.bv-study-batch__titlewrap h3:focus {
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bv-accent-primary) 55%, transparent);
}

.bv-study-batch__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* =========================================================
   Ingest / Extract area
========================================================= */

.bv-study-ingest {
  margin-top: 16px;
  padding: 14px;
  border: 1px dashed var(--bv-border-color, var(--bv-border-main));
  border-radius: 14px;
  background: rgba(255,255,255,0.035);
}

.bv-study-ingest textarea {
  width: 100%;
  min-height: 105px;
  resize: vertical;
  box-sizing: border-box;
}

.bv-study-ingest__actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.bv-study-loader {
  color: var(--bv-accent-primary);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =========================================================
   Table
========================================================= */

.bv-study-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 18px;
  border: 1px solid var(--bv-border-color, var(--bv-border-main));
  border-radius: 14px;
}

.bv-study-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-size: 13px;
}

.bv-study-table th {
  padding: 11px 10px;
  background: rgba(255,255,255,0.06);
  color: var(--bv-text-subtle);
  border-bottom: 1px solid var(--bv-border-color, var(--bv-border-main));
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bv-study-table td {
  padding: 9px 10px;
  border-bottom: 1px solid color-mix(in srgb, var(--bv-border-color, var(--bv-border-main)) 65%, transparent);
  vertical-align: top;
}

.bv-study-table tbody tr:last-child td {
  border-bottom: 0;
}

.bv-study-editable {
  min-height: 22px;
  padding: 5px 6px;
  border-radius: 8px;
  outline: none;
  color: var(--bv-text-main);
}

.bv-study-editable:hover {
  background: rgba(255,255,255,0.05);
}

.bv-study-editable:focus {
  background: var(--bv-bg-main);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bv-accent-primary) 55%, transparent);
}

.bv-study-table-actions {
  width: 54px;
  text-align: center;
}

/* =========================================================
   Flashcards
========================================================= */

.bv-study-section-label {
  margin: 20px 0 12px;
  color: var(--bv-text-subtle);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.bv-study-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(275px, 1fr));
  gap: 14px;
}

.bv-study-memory-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 15px;
  border: 1px solid var(--bv-border-color, var(--bv-border-main));
  border-top-width: 5px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.045), rgba(0,0,0,0.015)),
    var(--bv-bg-card, var(--bv-bg-panel));
  box-shadow: 0 10px 24px rgba(0,0,0,0.10);
}

.bv-study-memory-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--bv-border-color, var(--bv-border-main));
}

.bv-study-memory-card h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  color: var(--bv-text-main);
}

.bv-study-memory-card__field {
  font-size: 13px;
  color: var(--bv-text-main);
}

.bv-study-memory-card__field span {
  display: block;
  margin-bottom: 3px;
  color: var(--bv-text-subtle);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bv-study-muted {
  color: var(--bv-text-subtle);
  font-size: 12px;
}

/* =========================================================
   Links
========================================================= */

.bv-study-play-link,
.bv-study-source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.bv-study-play-link {
  border: 1px solid rgba(239,68,68,0.45);
  background: rgba(239,68,68,0.12);
  color: #ef4444;
}

.bv-study-play-link:hover {
  background: #ef4444;
  color: white;
}

.bv-study-source-link {
  border: 1px solid color-mix(in srgb, var(--bv-accent-primary) 45%, transparent);
  background: color-mix(in srgb, var(--bv-accent-primary) 12%, transparent);
  color: var(--bv-accent-primary);
}

/* =========================================================
   Color dots
========================================================= */

.bv-study-color-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.bv-study-batch--minimized > .bv-study-color-row {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 160ms ease;
}

.bv-study-batch--minimized:hover > .bv-study-color-row {
  opacity: 1;
  pointer-events: auto;
}

.bv-study-color-dot {
  width: 15px;
  height: 15px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.35);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.bv-study-color-dot:hover {
  transform: scale(1.25);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.12);
}

.bv-study-color-dot--gray {
  background: #94a3b8;
}

.bv-study-color-dot--red {
  background: #ef4444;
}

.bv-study-color-dot--orange {
  background: #f97316;
}

.bv-study-color-dot--green {
  background: #10b981;
}

.bv-study-color-dot--blue {
  background: #3b82f6;
}

.bv-study-color-dot--purple {
  background: #a855f7;
}

/* =========================================================
   Color tints
========================================================= */

.bv-study-tint-gray {
  border-color: rgba(148,163,184,0.52);
}

.bv-study-tint-red {
  border-color: rgba(239,68,68,0.62);
  background:
    linear-gradient(135deg, rgba(239,68,68,0.13), rgba(255,255,255,0.02)),
    var(--bv-bg-card, var(--bv-bg-panel));
}

.bv-study-tint-orange {
  border-color: rgba(249,115,22,0.62);
  background:
    linear-gradient(135deg, rgba(249,115,22,0.13), rgba(255,255,255,0.02)),
    var(--bv-bg-card, var(--bv-bg-panel));
}

.bv-study-tint-green {
  border-color: rgba(16,185,129,0.62);
  background:
    linear-gradient(135deg, rgba(16,185,129,0.13), rgba(255,255,255,0.02)),
    var(--bv-bg-card, var(--bv-bg-panel));
}

.bv-study-tint-blue {
  border-color: rgba(59,130,246,0.62);
  background:
    linear-gradient(135deg, rgba(59,130,246,0.13), rgba(255,255,255,0.02)),
    var(--bv-bg-card, var(--bv-bg-panel));
}

.bv-study-tint-purple {
  border-color: rgba(168,85,247,0.62);
  background:
    linear-gradient(135deg, rgba(168,85,247,0.13), rgba(255,255,255,0.02)),
    var(--bv-bg-card, var(--bv-bg-panel));
}

.bv-study-memory-card--gray {
  border-top-color: #94a3b8;
}

.bv-study-memory-card--red {
  border-top-color: #ef4444;
}

.bv-study-memory-card--orange {
  border-top-color: #f97316;
}

.bv-study-memory-card--green {
  border-top-color: #10b981;
}

.bv-study-memory-card--blue {
  border-top-color: #3b82f6;
}

.bv-study-memory-card--purple {
  border-top-color: #a855f7;
}

/* =========================================================
   Column editor modal
========================================================= */

.bv-study-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(0,0,0,0.58);
  backdrop-filter: blur(6px);
}

.bv-study-modal__panel {
  width: min(560px, 96vw);
  max-height: min(720px, 90vh);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--bv-border-color, var(--bv-border-main));
  border-radius: 18px;
  background: var(--bv-bg-card, var(--bv-bg-panel));
  color: var(--bv-text-main);
  box-shadow: 0 24px 70px rgba(0,0,0,0.35);
}

.bv-study-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.bv-study-modal__head h2 {
  margin: 0;
  font-size: 21px;
}

.bv-study-modal__head p {
  margin: 5px 0 0;
  color: var(--bv-text-subtle);
  font-size: 13px;
}

.bv-study-columns-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 16px 0;
}

.bv-study-column-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--bv-border-color, var(--bv-border-main));
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
}

.bv-study-modal__addrow {
  display: flex;
  gap: 10px;
  align-items: center;
}

.bv-study-modal__addrow .bv-input {
  flex: 1;
}

/* =========================================================
   Responsive
========================================================= */

@media (max-width: 860px) {
  .bv-study-shell {
    padding: 16px;
  }

  .bv-study-header,
  .bv-study-folder__head,
  .bv-study-batch__head {
    align-items: stretch;
    flex-direction: column;
  }

  .bv-study-folder__actions,
  .bv-study-batch__actions {
    justify-content: flex-start;
  }

  .bv-study-batch-grid,
  .bv-study-card-grid {
    grid-template-columns: 1fr;
  }

  .bv-study-modal__addrow {
    flex-direction: column;
  }

  .bv-study-modal__addrow .bv-input,
  .bv-study-modal__addrow .bv-btn {
    width: 100%;
  }
}
/* =========================================================
   Study Board colour picker visibility fix
   Makes dots visible even when BookVault/global button styles interfere
========================================================= */

.bv-study-color-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.bv-study-color-dot {
  appearance: none !important;
  -webkit-appearance: none !important;

  width: 16px !important;
  min-width: 16px !important;
  max-width: 16px !important;

  height: 16px !important;
  min-height: 16px !important;
  max-height: 16px !important;

  padding: 0 !important;
  margin: 0 !important;

  border-radius: 999px !important;
  border: 1px solid rgba(0,0,0,0.18) !important;

  cursor: pointer !important;
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.65),
    0 2px 6px rgba(0,0,0,0.16) !important;

  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;

  opacity: 1 !important;
  visibility: visible !important;
}

.bv-study-color-dot:hover {
  transform: scale(1.25);
  box-shadow:
    0 0 0 3px rgba(255,255,255,0.9),
    0 4px 12px rgba(0,0,0,0.24) !important;
}

.bv-study-color-dot--gray {
  background-color: #94a3b8 !important;
}

.bv-study-color-dot--red {
  background-color: #ef4444 !important;
}

.bv-study-color-dot--orange {
  background-color: #f97316 !important;
}

.bv-study-color-dot--green {
  background-color: #10b981 !important;
}

.bv-study-color-dot--blue {
  background-color: #3b82f6 !important;
}

.bv-study-color-dot--purple {
  background-color: #a855f7 !important;
}

/* Visible colour picker for expanded batch header */
.bv-study-color-row--batch-expanded {
  padding: 6px 10px;
  border: 1px solid var(--bv-border-color, var(--bv-border-main));
  border-radius: 999px;
  background: rgba(255,255,255,0.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}
/* =========================================================
   Study Board expanded layout cleanup
   Fixes cramped expanded batch arrangement
========================================================= */

.bv-study-batch--expanded {
  display: block !important;
  width: 100%;
  padding: 26px 28px !important;
  box-sizing: border-box;
}

/* Header: title left, actions right */
.bv-study-batch__head {
  display: grid !important;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: start;
  gap: 18px;
  width: 100%;
  padding-bottom: 18px;
  margin-bottom: 18px;
}

/* Keep title area clean */
.bv-study-batch__titlewrap {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.bv-study-batch__titlewrap h3 {
  max-width: 100%;
  white-space: normal;
  line-height: 1.1;
}

/* Actions should sit in neat rows */
.bv-study-batch__actions {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  max-width: 620px;
}

/* Make colour picker not consume huge space */
.bv-study-color-row--batch-expanded {
  flex: 0 0 auto;
}

/* Table should occupy its own full row */
.bv-study-table-wrap {
  display: block !important;
  width: 100% !important;
  max-width: 100%;
  margin-top: 18px !important;
  margin-bottom: 24px !important;
  clear: both;
}

/* Prevent table from pushing cards sideways */
.bv-study-table {
  width: 100% !important;
  min-width: 760px;
}

/* Label must start a new section */
.bv-study-section-label {
  display: block !important;
  width: 100%;
  clear: both;
  margin-top: 24px !important;
  margin-bottom: 14px !important;
}

/* Flashcards should appear below table, not beside it */
.bv-study-card-grid {
  display: grid !important;
  width: 100%;
  clear: both;
  grid-template-columns: repeat(auto-fill, minmax(280px, 360px));
  gap: 16px;
  align-items: start;
}

/* Make cards slightly more compact and aligned */
.bv-study-memory-card {
  width: 100%;
  box-sizing: border-box;
}

/* Stop card colour dots from looking like white pills */
.bv-study-memory-card .bv-study-color-row {
  flex-wrap: nowrap;
  gap: 5px;
}

/* Wider screens: keep expanded area clean and readable */
@media (min-width: 1100px) {
  .bv-study-batch--expanded {
    padding: 28px 32px !important;
  }

  .bv-study-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 380px));
  }
}

/* Medium screens: stack actions under title */
@media (max-width: 1100px) {
  .bv-study-batch__head {
    grid-template-columns: 1fr;
  }

  .bv-study-batch__actions {
    justify-content: flex-start;
    max-width: none;
  }
}
/* =========================================================
   Study Board: force table + flashcards into clean vertical flow
========================================================= */

.bv-study-batch--expanded {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 0 !important;
}

/* Header stays first */
.bv-study-batch--expanded > .bv-study-batch__head {
  width: 100% !important;
  flex: 0 0 auto !important;
}

/* Extract box stays under header */
.bv-study-batch--expanded > .bv-study-ingest {
  width: 100% !important;
  flex: 0 0 auto !important;
}

/* Table gets its own full-width row */
.bv-study-batch--expanded > .bv-study-table-wrap {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 auto !important;
  margin-top: 26px !important;
  margin-bottom: 26px !important;
  clear: both !important;
}

/* The label must sit below the table, not beside it */
.bv-study-batch--expanded > .bv-study-section-label {
  display: block !important;
  width: 100% !important;
  flex: 0 0 auto !important;
  clear: both !important;
  margin: 0 0 14px 0 !important;
  padding-top: 0 !important;
  text-align: left !important;
}

/* Flashcards get their own full row */
.bv-study-batch--expanded > .bv-study-card-grid {
  display: grid !important;
  width: 100% !important;
  max-width: 100% !important;
  flex: 0 0 auto !important;
  clear: both !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 380px)) !important;
  gap: 18px !important;
  align-items: start !important;
  justify-content: start !important;
}

/* Let table use more room before horizontal scroll appears */
.bv-study-table {
  width: 100% !important;
  min-width: 900px !important;
}

/* Make flashcard section visually separated */
.bv-study-section-label {
  border-top: 1px solid var(--bv-border-color, var(--bv-border-main));
  padding-top: 22px !important;
}
.bv-study-flashcards-section {
  display: block !important;
  width: 100% !important;
  margin-top: 26px !important;
  clear: both !important;
}

.bv-study-flashcards-section .bv-study-section-label {
  display: block !important;
  width: 100% !important;
  margin: 0 0 14px 0 !important;
  padding-top: 22px !important;
  border-top: 1px solid var(--bv-border-color, var(--bv-border-main));
}

.bv-study-flashcards-section .bv-study-card-grid {
  display: grid !important;
  width: 100% !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 380px)) !important;
  gap: 18px !important;
  justify-content: start !important;
}
/* =========================================================
   Study Board: bottom flashcards + no sideways table scroll
========================================================= */

.bv-study-batch--expanded {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
}

/* Table always stays above flashcards */
.bv-study-table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: visible !important;
  margin-top: 22px !important;
  margin-bottom: 0 !important;
}

/* Let the table fit the available space instead of forcing scroll */
.bv-study-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

/* Allow text inside cells to wrap */
.bv-study-table th,
.bv-study-table td {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
  vertical-align: top !important;
}

/* Give columns reasonable widths */
.bv-study-table th:nth-child(1),
.bv-study-table td:nth-child(1) {
  width: 18%;
}

.bv-study-table th:nth-child(2),
.bv-study-table td:nth-child(2) {
  width: 18%;
}

.bv-study-table th:nth-child(3),
.bv-study-table td:nth-child(3) {
  width: 24%;
}

.bv-study-table th:nth-child(4),
.bv-study-table td:nth-child(4) {
  width: 32%;
}

.bv-study-table th:last-child,
.bv-study-table td:last-child {
  width: 48px;
}

/* Long URLs should wrap instead of causing horizontal scroll */
.bv-study-editable {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

/* Flashcards are always below the table */
.bv-study-flashcards-section {
  display: block !important;
  width: 100% !important;
  margin-top: 34px !important;
  clear: both !important;
}

/* Section title sits directly above cards */
.bv-study-flashcards-section .bv-study-section-label {
  display: block !important;
  width: 100% !important;
  margin: 0 0 14px 0 !important;
  padding-top: 22px !important;
  border-top: 1px solid var(--bv-border-color, var(--bv-border-main));
  text-align: left !important;
}

/* Cards sit below the title */
.bv-study-flashcards-section .bv-study-card-grid {
  display: grid !important;
  width: 100% !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 380px)) !important;
  gap: 18px !important;
  justify-content: start !important;
}

/* On smaller screens, make table more compact */
@media (max-width: 900px) {
  .bv-study-table {
    font-size: 12px !important;
  }

  .bv-study-table th,
  .bv-study-table td {
    padding: 8px 6px !important;
  }

  .bv-study-flashcards-section .bv-study-card-grid {
    grid-template-columns: 1fr !important;
  }
}
/* =========================================================
   FINAL FORCE PATCH — Study Board vertical workspace
   Use after theme CSS and after all previous studyboard rules
========================================================= */

#studyBoard .bv-study-batch--expanded {
  display: grid !important;
  grid-template-columns: 1fr !important;
  width: 100% !important;
  align-items: stretch !important;
}

/* Header full width */
#studyBoard .bv-study-batch--expanded > .bv-study-batch__head {
  grid-column: 1 / -1 !important;
  width: 100% !important;
}

/* Extract area full width */
#studyBoard .bv-study-batch--expanded > .bv-study-ingest {
  grid-column: 1 / -1 !important;
  width: 100% !important;
}

/* Table full width and above cards */
#studyBoard .bv-study-batch--expanded > .bv-study-table-wrap {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: 100% !important;
  display: block !important;
  overflow-x: visible !important;
  margin-top: 24px !important;
  margin-bottom: 30px !important;
}

/* Table should wrap instead of scrolling sideways */
#studyBoard .bv-study-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

#studyBoard .bv-study-table th,
#studyBoard .bv-study-table td,
#studyBoard .bv-study-editable {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}

/* Old non-wrapper fallback */
#studyBoard .bv-study-batch--expanded > .bv-study-section-label {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  display: block !important;
  margin-top: 28px !important;
  margin-bottom: 14px !important;
  padding-top: 22px !important;
  border-top: 1px solid var(--bv-border-color, var(--bv-border-main)) !important;
}

#studyBoard .bv-study-batch--expanded > .bv-study-card-grid {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 380px)) !important;
  gap: 18px !important;
  justify-content: start !important;
}

/* New wrapper version */
#studyBoard .bv-study-flashcards-section {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  display: block !important;
  margin-top: 30px !important;
}

#studyBoard .bv-study-flashcards-section .bv-study-section-label {
  display: block !important;
  width: 100% !important;
  margin: 0 0 14px 0 !important;
  padding-top: 22px !important;
  border-top: 1px solid var(--bv-border-color, var(--bv-border-main)) !important;
}

#studyBoard .bv-study-flashcards-section .bv-study-card-grid {
  display: grid !important;
  width: 100% !important;
  grid-template-columns: repeat(auto-fill, minmax(280px, 380px)) !important;
  gap: 18px !important;
  justify-content: start !important;
}
/* =========================================================
   FINAL PATCH — make Study Board table extend full width
========================================================= */

#studyBoard .bv-study-batch--expanded > .bv-study-table-wrap {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  display: block !important;
  box-sizing: border-box !important;
  align-self: stretch !important;
}

/* Table fills the whole available right side */
#studyBoard .bv-study-table {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}

/* Better column spread across the full row */
#studyBoard .bv-study-table th:nth-child(1),
#studyBoard .bv-study-table td:nth-child(1) {
  width: 18% !important;
}

#studyBoard .bv-study-table th:nth-child(2),
#studyBoard .bv-study-table td:nth-child(2) {
  width: 18% !important;
}

#studyBoard .bv-study-table th:nth-child(3),
#studyBoard .bv-study-table td:nth-child(3) {
  width: 24% !important;
}

#studyBoard .bv-study-table th:nth-child(4),
#studyBoard .bv-study-table td:nth-child(4) {
  width: 34% !important;
}

#studyBoard .bv-study-table th:last-child,
#studyBoard .bv-study-table td:last-child {
  width: 64px !important;
}

/* Keep long URLs wrapping instead of shrinking the rest */
#studyBoard .bv-study-table td,
#studyBoard .bv-study-table th,
#studyBoard .bv-study-editable {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}
/* =========================================================
   ABSOLUTE FINAL — force Study Board expanded batch to one lane
========================================================= */

#studyBoard .bv-study-batch-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
  gap: 16px !important;
}

/* Expanded batch must occupy the whole grid row */
#studyBoard .bv-study-batch-grid > .bv-study-batch--expanded {
  grid-column: 1 / -1 !important;
}

/* Expanded batch itself becomes one vertical lane only */
#studyBoard .bv-study-batch--expanded {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-auto-flow: row !important;
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box !important;
}

/* Every direct section inside the expanded batch spans the whole lane */
#studyBoard .bv-study-batch--expanded > * {
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box !important;
  justify-self: stretch !important;
}

/* Header can still be title-left/actions-right */
#studyBoard .bv-study-batch--expanded > .bv-study-batch__head {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 18px !important;
  align-items: start !important;
}

/* The table wrapper must not shrink to content width */
#studyBoard .bv-study-batch--expanded .bv-study-table-wrap {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  overflow-x: visible !important;
  box-sizing: border-box !important;
}

/* Table fills the wrapper */
#studyBoard .bv-study-batch--expanded .bv-study-table {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

/* Column spread */
#studyBoard .bv-study-batch--expanded .bv-study-table th:nth-child(1),
#studyBoard .bv-study-batch--expanded .bv-study-table td:nth-child(1) {
  width: 16% !important;
}

#studyBoard .bv-study-batch--expanded .bv-study-table th:nth-child(2),
#studyBoard .bv-study-batch--expanded .bv-study-table td:nth-child(2) {
  width: 16% !important;
}

#studyBoard .bv-study-batch--expanded .bv-study-table th:nth-child(3),
#studyBoard .bv-study-batch--expanded .bv-study-table td:nth-child(3) {
  width: 22% !important;
}

#studyBoard .bv-study-batch--expanded .bv-study-table th:nth-child(4),
#studyBoard .bv-study-batch--expanded .bv-study-table td:nth-child(4) {
  width: auto !important;
}

#studyBoard .bv-study-batch--expanded .bv-study-table th:last-child,
#studyBoard .bv-study-batch--expanded .bv-study-table td:last-child {
  width: 64px !important;
}

/* Wrap text and URLs */
#studyBoard .bv-study-batch--expanded .bv-study-table th,
#studyBoard .bv-study-batch--expanded .bv-study-table td,
#studyBoard .bv-study-batch--expanded .bv-study-editable {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}
/* =========================================================
   NUCLEAR PATCH — force expanded table to full Study Board width
========================================================= */

/* The expanded card must be a single vertical block */
#studyBoard .bv-study-batch-grid .bv-study-batch--expanded {
  display: block !important;
  grid-column: 1 / -1 !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

/* Header remains normal */
#studyBoard .bv-study-batch--expanded .bv-study-batch__head {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  width: 100% !important;
  max-width: none !important;
  box-sizing: border-box !important;
}

/* Table wrapper must become full-width block */
#studyBoard .bv-study-table-wrap {
  display: block !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  box-sizing: border-box !important;
  overflow-x: visible !important;
}

/* When inside expanded batch, force it to stretch edge-to-edge */
#studyBoard .bv-study-batch--expanded .bv-study-table-wrap {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  align-self: stretch !important;
  justify-self: stretch !important;
}

/* The actual table must fill the wrapper */
#studyBoard .bv-study-batch--expanded .bv-study-table {
  width: 100% !important;
  min-width: 100% !important;
  max-width: 100% !important;
  table-layout: fixed !important;
  border-collapse: collapse !important;
}

/* Column spread across the whole table */
#studyBoard .bv-study-batch--expanded .bv-study-table th:nth-child(1),
#studyBoard .bv-study-batch--expanded .bv-study-table td:nth-child(1) {
  width: 16% !important;
}

#studyBoard .bv-study-batch--expanded .bv-study-table th:nth-child(2),
#studyBoard .bv-study-batch--expanded .bv-study-table td:nth-child(2) {
  width: 16% !important;
}

#studyBoard .bv-study-batch--expanded .bv-study-table th:nth-child(3),
#studyBoard .bv-study-batch--expanded .bv-study-table td:nth-child(3) {
  width: 22% !important;
}

#studyBoard .bv-study-batch--expanded .bv-study-table th:nth-child(4),
#studyBoard .bv-study-batch--expanded .bv-study-table td:nth-child(4) {
  width: auto !important;
}

#studyBoard .bv-study-batch--expanded .bv-study-table th:last-child,
#studyBoard .bv-study-batch--expanded .bv-study-table td:last-child {
  width: 64px !important;
}

/* Long text/URLs wrap instead of shrinking the table */
#studyBoard .bv-study-batch--expanded .bv-study-table th,
#studyBoard .bv-study-batch--expanded .bv-study-table td,
#studyBoard .bv-study-batch--expanded .bv-study-editable {
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: break-word !important;
}
/* =========================================================
   Study Board — Independent AI Fields + URL Source UI
========================================================= */

#studyBoard .bv-study-ai-fields-panel {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin: 24px 0 28px !important;
  padding: 18px !important;
  border: 1px solid var(--bv-border-color, var(--bv-border-main)) !important;
  border-radius: 16px !important;
  background:
    linear-gradient(135deg, rgba(168,85,247,0.08), rgba(255,255,255,0.025)),
    var(--bv-bg-card, var(--bv-bg-panel)) !important;
}

#studyBoard .bv-study-ai-fields-panel__head {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  gap: 16px !important;
  margin-bottom: 16px !important;
}

#studyBoard .bv-study-ai-fields-panel__head h4 {
  margin: 0 !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: var(--bv-text-main) !important;
}

#studyBoard .bv-study-ai-fields-panel__head p {
  margin: 5px 0 0 !important;
  color: var(--bv-text-subtle) !important;
  font-size: 12px !important;
}

#studyBoard .bv-study-ai-field-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
  gap: 14px !important;
  width: 100% !important;
}

#studyBoard .bv-study-ai-field-card {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  padding: 12px !important;
  border: 1px solid var(--bv-border-color, var(--bv-border-main)) !important;
  border-radius: 14px !important;
  background: rgba(255,255,255,0.045) !important;
  box-sizing: border-box !important;
}

#studyBoard .bv-study-ai-field-card__top {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 8px !important;
  align-items: center !important;
}

#studyBoard .bv-study-ai-field-label {
  width: 100% !important;
  margin: 0 !important;
  font-weight: 800 !important;
}

#studyBoard .bv-study-ai-field-value {
  width: 100% !important;
  min-height: 92px !important;
  resize: vertical !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  line-height: 1.45 !important;
}

/* URL source panel */

#studyBoard .bv-study-url-panel {
  display: block !important;
  width: 100% !important;
  box-sizing: border-box !important;
  margin: 16px 0 24px !important;
  padding: 16px !important;
  border: 1px dashed var(--bv-border-color, var(--bv-border-main)) !important;
  border-radius: 16px !important;
  background:
    linear-gradient(135deg, rgba(59,130,246,0.08), rgba(255,255,255,0.025)),
    var(--bv-bg-card, var(--bv-bg-panel)) !important;
}

#studyBoard .bv-study-url-panel__head {
  display: flex !important;
  justify-content: space-between !important;
  gap: 16px !important;
  margin-bottom: 12px !important;
}

#studyBoard .bv-study-url-panel__head h4 {
  margin: 0 !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
  color: var(--bv-text-main) !important;
}

#studyBoard .bv-study-url-panel__head p {
  margin: 5px 0 0 !important;
  color: var(--bv-text-subtle) !important;
  font-size: 12px !important;
}

#studyBoard .bv-study-url-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 10px !important;
  align-items: center !important;
}

#studyBoard .bv-study-url-row .bv-input {
  width: 100% !important;
  margin: 0 !important;
}

#studyBoard .bv-study-url-status {
  margin-top: 10px !important;
  color: var(--bv-text-subtle) !important;
  font-size: 12px !important;
  font-family: var(--bv-font-mono, monospace) !important;
}

/* Responsive */

@media (max-width: 820px) {
  #studyBoard .bv-study-ai-fields-panel__head,
  #studyBoard .bv-study-url-panel__head {
    flex-direction: column !important;
  }

  #studyBoard .bv-study-url-row {
    grid-template-columns: 1fr !important;
  }

  #studyBoard .bv-study-url-row .bv-btn {
    width: 100% !important;
  }
}
/* =========================================================
   Study Board — Card Evidence Attachments
========================================================= */

#studyBoard .bv-study-attachments {
  display: block !important;
  width: 100% !important;
  margin-top: 14px !important;
  padding-top: 12px !important;
  border-top: 1px dashed var(--bv-border-color, var(--bv-border-main)) !important;
}

#studyBoard .bv-study-attachments__head {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 10px !important;
  margin-bottom: 10px !important;
}

#studyBoard .bv-study-attachments__head span {
  color: var(--bv-text-subtle) !important;
  font-size: 10px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
}

#studyBoard .bv-study-attachments__head .bv-btn {
  padding: 5px 8px !important;
  font-size: 10px !important;
}

#studyBoard .bv-study-attachments__list {
  display: grid !important;
  gap: 10px !important;
}

#studyBoard .bv-study-attachments-empty {
  padding: 10px !important;
  border: 1px dashed var(--bv-border-color, var(--bv-border-main)) !important;
  border-radius: 10px !important;
  color: var(--bv-text-subtle) !important;
  font-size: 12px !important;
  background: rgba(255,255,255,0.025) !important;
}

#studyBoard .bv-study-attachment-card {
  display: grid !important;
  gap: 8px !important;
  padding: 10px !important;
  border: 1px solid var(--bv-border-color, var(--bv-border-main)) !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,0.045) !important;
  box-sizing: border-box !important;
}

#studyBoard .bv-study-attachment-card__top {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 8px !important;
  align-items: center !important;
}

#studyBoard .bv-study-attachment-card__top .bv-input,
#studyBoard .bv-study-attachment-title,
#studyBoard .bv-study-attachment-value {
  width: 100% !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

#studyBoard .bv-study-attachment-title {
  font-weight: 800 !important;
}

#studyBoard .bv-study-attachment-value {
  min-height: 62px !important;
  resize: vertical !important;
  line-height: 1.4 !important;
}

#studyBoard .bv-study-attachment-card--url {
  border-left: 4px solid #3b82f6 !important;
}

#studyBoard .bv-study-attachment-card--note {
  border-left: 4px solid #94a3b8 !important;
}

#studyBoard .bv-study-attachment-card--image {
  border-left: 4px solid #10b981 !important;
}

#studyBoard .bv-study-attachment-card--vault_clip {
  border-left: 4px solid #a855f7 !important;
}

#studyBoard .bv-study-attachment-link,
#studyBoard .bv-study-vault-chip {
  display: inline-flex !important;
  width: fit-content !important;
  align-items: center !important;
  padding: 5px 8px !important;
  border-radius: 8px !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.04em !important;
  text-decoration: none !important;
}

#studyBoard .bv-study-attachment-link {
  color: #3b82f6 !important;
  border: 1px solid rgba(59,130,246,0.45) !important;
  background: rgba(59,130,246,0.10) !important;
}

#studyBoard .bv-study-attachment-link:hover {
  color: white !important;
  background: #3b82f6 !important;
}

#studyBoard .bv-study-vault-chip {
  color: #a855f7 !important;
  border: 1px solid rgba(168,85,247,0.45) !important;
  background: rgba(168,85,247,0.10) !important;
}

#studyBoard .bv-study-image-upload-row {
  display: grid !important;
  gap: 6px !important;
}

#studyBoard .bv-study-image-input {
  width: 100% !important;
  font-size: 12px !important;
  color: var(--bv-text-subtle) !important;
}

#studyBoard .bv-study-attachment-image-preview {
  width: 100% !important;
  border: 1px solid var(--bv-border-color, var(--bv-border-main)) !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: rgba(0,0,0,0.12) !important;
}

#studyBoard .bv-study-attachment-image-preview img {
  display: block !important;
  width: 100% !important;
  max-height: 220px !important;
  object-fit: contain !important;
}
/* =========================================================
   Study Board — Vault Evidence Picker Modal
========================================================= */

#studyBoard .bv-study-vault-actions {
  display: grid !important;
  gap: 8px !important;
}

.bv-study-vault-picker {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10050 !important;
  display: none;
  align-items: center !important;
  justify-content: center !important;
  padding: 24px !important;
  background: rgba(0,0,0,0.62) !important;
  backdrop-filter: blur(6px) !important;
}

.bv-study-vault-picker__panel {
  width: min(1120px, 96vw) !important;
  max-height: 90vh !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
  padding: 22px !important;
  border: 1px solid var(--bv-border-color, var(--bv-border-main)) !important;
  background: var(--bv-bg-card, var(--bv-bg-panel)) !important;
  color: var(--bv-text-main) !important;
  box-shadow: 0 24px 80px rgba(0,0,0,0.38) !important;
}

.bv-study-vault-picker__head {
  display: flex !important;
  justify-content: space-between !important;
  gap: 16px !important;
  align-items: flex-start !important;
}

.bv-study-vault-picker__head h2 {
  margin: 0 !important;
  font-size: 22px !important;
}

.bv-study-vault-picker__head p {
  margin: 5px 0 0 !important;
  color: var(--bv-text-subtle) !important;
  font-size: 13px !important;
}

.bv-study-vault-picker__search .bv-input {
  width: 100% !important;
  margin: 0 !important;
}

.bv-study-vault-picker__status,
.bv-study-vault-picker__empty,
.bv-study-vault-picker__error {
  color: var(--bv-text-subtle) !important;
  font-size: 12px !important;
  font-family: var(--bv-font-mono, monospace) !important;
}

.bv-study-vault-picker__grid {
  overflow: auto !important;
  padding-right: 8px !important;
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)) !important;
  gap: 14px !important;
}

.bv-study-vault-pick-card {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  padding: 12px !important;
  border: 1px solid var(--bv-border-color, var(--bv-border-main)) !important;
  background: rgba(255,255,255,0.045) !important;
}

.bv-study-vault-pick-card__top {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 10px !important;
  align-items: start !important;
}

.bv-study-vault-pick-card__meta {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  margin-bottom: 6px !important;
  color: var(--bv-text-subtle) !important;
  font-size: 10px !important;
}

.bv-study-vault-pick-card__meta code,
.bv-study-vault-pick-card__meta span {
  padding: 3px 6px !important;
  border: 1px solid var(--bv-border-color, var(--bv-border-main)) !important;
  background: rgba(255,255,255,0.04) !important;
}

.bv-study-vault-pick-card h3 {
  margin: 0 !important;
  font-size: 14px !important;
  line-height: 1.25 !important;
}

.bv-study-vault-pick-card p {
  margin: 0 !important;
  color: var(--bv-text-main) !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
}

.bv-study-vault-pick-card__img {
  width: 100% !important;
  max-height: 180px !important;
  object-fit: contain !important;
  border: 1px solid var(--bv-border-color, var(--bv-border-main)) !important;
  background: rgba(0,0,0,0.1) !important;
}

#studyBoard .bv-study-vault-quote {
  padding: 9px !important;
  border-left: 3px solid #a855f7 !important;
  background: rgba(168,85,247,0.08) !important;
  color: var(--bv-text-main) !important;
  font-size: 12px !important;
  line-height: 1.45 !important;
}
/* =========================================================
   Study Board — Vault source link row
========================================================= */

#studyBoard .bv-study-vault-source-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

#studyBoard .bv-study-vault-source-row .bv-btn {
  padding: 5px 9px !important;
  font-size: 10px !important;
}
/* =========================================================
   Study Board — Attachment toggle pills
========================================================= */

#studyBoard .bv-study-attachment-card {
  padding: 0 !important;
  overflow: hidden !important;
}

#studyBoard .bv-study-attachment-pill {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 10px !important;
  align-items: center !important;
  padding: 10px !important;
  cursor: pointer !important;
  background: rgba(255,255,255,0.05) !important;
}

#studyBoard .bv-study-attachment-pill:hover {
  background: rgba(255,255,255,0.09) !important;
}

#studyBoard .bv-study-attachment-pill__main {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  min-width: 0 !important;
}

#studyBoard .bv-study-attachment-pill__main strong {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: 12px !important;
}

#studyBoard .bv-study-attachment-pill__type {
  flex: 0 0 auto !important;
  padding: 3px 7px !important;
  border: 1px solid var(--bv-border-color, var(--bv-border-main)) !important;
  border-radius: 999px !important;
  color: var(--bv-text-subtle) !important;
  background: rgba(255,255,255,0.04) !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.06em !important;
}

#studyBoard .bv-study-attachment-pill__actions {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

#studyBoard .bv-study-attachment-pill__action,
#studyBoard .bv-study-attachment-pill__delete {
  appearance: none !important;
  border: 1px solid var(--bv-border-color, var(--bv-border-main)) !important;
  background: var(--btn-bg, transparent) !important;
  color: var(--bv-text-main) !important;
  padding: 4px 7px !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
  cursor: pointer !important;
}

#studyBoard .bv-study-attachment-pill__action:hover,
#studyBoard .bv-study-attachment-pill__delete:hover {
  border-color: var(--bv-accent-primary) !important;
  color: var(--bv-accent-primary) !important;
}

#studyBoard .bv-study-attachment-pill__delete {
  min-width: 26px !important;
}

#studyBoard .bv-study-attachment-editor {
  display: grid !important;
  gap: 8px !important;
  padding: 10px !important;
}

#studyBoard .bv-study-attachment-card.is-collapsed {
  box-shadow: none !important;
}

#studyBoard .bv-study-attachment-card.is-collapsed .bv-study-attachment-pill {
  border-bottom: 0 !important;
}

@media (max-width: 700px) {
  #studyBoard .bv-study-attachment-pill {
    grid-template-columns: 1fr !important;
  }

  #studyBoard .bv-study-attachment-pill__actions {
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
  }
}
/* =========================================================
   Study Board — cleaner expanded batch action toolbar
========================================================= */

#studyBoard .bv-study-batch__head {
  display: grid !important;
  grid-template-columns: minmax(260px, 1fr) auto !important;
  align-items: start !important;
  gap: 18px !important;
}

#studyBoard .bv-study-batch__actions {
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 8px !important;
  max-width: none !important;
  min-width: 0 !important;
}

#studyBoard .bv-study-batch__actions .bv-btn {
  flex: 0 0 auto !important;
  min-width: 88px !important;
  padding: 10px 14px !important;
  white-space: nowrap !important;
}

/* Keep colour dots compact */
#studyBoard .bv-study-color-row--batch-expanded {
  flex: 0 0 auto !important;
  padding: 7px 10px !important;
  margin-right: 4px !important;
}

/* Make the main action buttons visually distinct */
#studyBoard .bv-study-batch__actions .bv-btn:nth-of-type(1) {
  /* Close */
  border-color: rgba(148,163,184,0.55) !important;
}

#studyBoard .bv-study-batch__actions .bv-btn:nth-of-type(2) {
  /* Columns */
  border-color: rgba(168,85,247,0.55) !important;
}

#studyBoard .bv-study-batch__actions .bv-btn:nth-of-type(3) {
  /* Extract */
  border-color: rgba(59,130,246,0.65) !important;
  color: #3b82f6 !important;
}

#studyBoard .bv-study-batch__actions .bv-btn:nth-of-type(4) {
  /* + URL */
  border-color: rgba(16,185,129,0.65) !important;
  color: #10b981 !important;
}

#studyBoard .bv-study-batch__actions .bv-btn:nth-of-type(5) {
  /* + Card */
  border-color: rgba(249,115,22,0.65) !important;
  color: #f97316 !important;
}

#studyBoard .bv-study-batch__actions .bv-btn:nth-of-type(6) {
  /* Delete */
  border-color: rgba(239,68,68,0.75) !important;
  color: #ef4444 !important;
}

/* Stronger hover feedback */
#studyBoard .bv-study-batch__actions .bv-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18) !important;
}

#studyBoard .bv-study-batch__actions .bv-btn:nth-of-type(3):hover {
  background: rgba(59,130,246,0.14) !important;
}

#studyBoard .bv-study-batch__actions .bv-btn:nth-of-type(4):hover {
  background: rgba(16,185,129,0.14) !important;
}

#studyBoard .bv-study-batch__actions .bv-btn:nth-of-type(5):hover {
  background: rgba(249,115,22,0.14) !important;
}

#studyBoard .bv-study-batch__actions .bv-btn:nth-of-type(6):hover {
  background: rgba(239,68,68,0.14) !important;
}

/* On medium screens, allow wrapping but keep Delete aligned */
@media (max-width: 1250px) {
  #studyBoard .bv-study-batch__head {
    grid-template-columns: 1fr !important;
  }

  #studyBoard .bv-study-batch__actions {
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
  }

  #studyBoard .bv-study-batch__actions .bv-btn {
    min-width: 92px !important;
  }
}
/* =========================================================
   Study Board — theme-proof expanded batch header/layout
   Fixes Glassmorphism + Archive Terminal button/title collapse
========================================================= */

/* Expanded batch must always be a vertical document flow */
#studyBoard .bv-study-batch--expanded {
  display: block !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  overflow: visible !important;
}

/* Header becomes two clean rows: title then actions */
#studyBoard .bv-study-batch--expanded > .bv-study-batch__head {
  display: grid !important;
  grid-template-columns: 1fr !important;
  grid-template-areas:
    "title"
    "actions" !important;
  gap: 16px !important;
  align-items: start !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
  margin-bottom: 24px !important;
}

/* Title row full width */
#studyBoard .bv-study-batch--expanded .bv-study-batch__titlewrap {
  grid-area: title !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 14px !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

/* Prevent title from becoming vertical letters */
#studyBoard .bv-study-batch--expanded .bv-study-batch__titlewrap h3 {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  line-height: 1.15 !important;
}

/* Badge beside title, not pushing title into a vertical stack */
#studyBoard .bv-study-batch--expanded .bv-study-badge {
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

/* Action toolbar becomes its own full-width row */
#studyBoard .bv-study-batch--expanded .bv-study-batch__actions {
  grid-area: actions !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

/* Colour dots should not crush the title/actions */
#studyBoard .bv-study-batch--expanded .bv-study-color-row--batch-expanded {
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: none !important;
  min-width: max-content !important;
  box-sizing: border-box !important;
}

/* Buttons stay normal-sized but can wrap cleanly */
#studyBoard .bv-study-batch--expanded .bv-study-batch__actions .bv-btn {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 92px !important;
  max-width: none !important;
  white-space: nowrap !important;
  text-align: center !important;
  box-sizing: border-box !important;
}

/* Delete button no longer gets stranded weirdly */
#studyBoard .bv-study-batch--expanded .bv-study-batch__actions .bv-btn:last-child {
  margin-left: 0 !important;
}

/* Extract panel must always sit below the header/actions */
#studyBoard .bv-study-batch--expanded > .bv-study-ingest,
#studyBoard .bv-study-batch--expanded > .bv-study-url-panel,
#studyBoard .bv-study-batch--expanded > .bv-study-ai-fields-panel,
#studyBoard .bv-study-batch--expanded > .bv-study-workspace-table,
#studyBoard .bv-study-batch--expanded > .bv-study-flashcards-section {
  display: block;
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  clear: both !important;
  box-sizing: border-box !important;
}

/* Keep ingest textarea from inheriting weird theme widths */
#studyBoard .bv-study-ingest textarea,
#studyBoard .bv-study-ingest .bv-input {
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

/* On wide screens, allow the toolbar to sit right if desired */
@media (min-width: 1200px) {
  #studyBoard .bv-study-batch--expanded .bv-study-batch__actions {
    justify-content: flex-start !important;
  }
}
/* =========================================================
   Study Board — align expanded batch toolbar to right
========================================================= */

#studyBoard .bv-study-batch--expanded .bv-study-batch__actions {
  justify-content: flex-end !important;
  width: 100% !important;
}

/* Keep title/card count on the left */
#studyBoard .bv-study-batch--expanded .bv-study-batch__titlewrap {
  justify-content: flex-start !important;
}

/* Keep buttons from stretching */
#studyBoard .bv-study-batch--expanded .bv-study-batch__actions .bv-btn {
  flex: 0 0 auto !important;
}

/* On smaller screens, allow wrapping but still right-align */
@media (max-width: 900px) {
  #studyBoard .bv-study-batch--expanded .bv-study-batch__actions {
    justify-content: flex-start !important;
  }
}
/* =========================================================
   Study Board — title + actions on same row
========================================================= */

#studyBoard .bv-study-batch--expanded > .bv-study-batch__head {
  display: grid !important;
  grid-template-columns: minmax(260px, 1fr) auto !important;
  grid-template-areas: "title actions" !important;
  align-items: center !important;
  gap: 18px !important;
  width: 100% !important;
  margin-bottom: 24px !important;
}

/* Left side: title + card badge */
#studyBoard .bv-study-batch--expanded .bv-study-batch__titlewrap {
  grid-area: title !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 14px !important;
  min-width: 0 !important;
}

/* Prevent vertical title collapse */
#studyBoard .bv-study-batch--expanded .bv-study-batch__titlewrap h3 {
  display: block !important;
  margin: 0 !important;
  min-width: 0 !important;
  max-width: 100% !important;
  white-space: normal !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
  writing-mode: horizontal-tb !important;
  text-orientation: mixed !important;
  line-height: 1.15 !important;
}

/* Right side: colour dots + buttons */
#studyBoard .bv-study-batch--expanded .bv-study-batch__actions {
  grid-area: actions !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  width: auto !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

/* Compact buttons so they fit on the title row */
#studyBoard .bv-study-batch--expanded .bv-study-batch__actions .bv-btn {
  flex: 0 0 auto !important;
  min-width: 86px !important;
  width: auto !important;
  padding: 10px 13px !important;
  white-space: nowrap !important;
}

/* Colour dots stay compact */
#studyBoard .bv-study-batch--expanded .bv-study-color-row--batch-expanded {
  flex: 0 0 auto !important;
  min-width: max-content !important;
  margin-right: 4px !important;
}

/* On narrower screens, stack safely */
@media (max-width: 1200px) {
  #studyBoard .bv-study-batch--expanded > .bv-study-batch__head {
    grid-template-columns: 1fr !important;
    grid-template-areas:
      "title"
      "actions" !important;
    align-items: start !important;
  }

  #studyBoard .bv-study-batch--expanded .bv-study-batch__actions {
    justify-content: flex-start !important;
  }
}
/* =========================================================
   Study Board — restore flashcard colour dot control
========================================================= */

/* Flashcards need their own stacking context */
#studyBoard .bv-study-memory-card {
  position: relative !important;
  overflow: visible !important;
}

/* Card top row: title left, colour dots right */
#studyBoard .bv-study-memory-card__top {
  position: relative !important;
  z-index: 5 !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 12px !important;
  width: 100% !important;
  pointer-events: auto !important;
}

/* Prevent the title from covering the dots */
#studyBoard .bv-study-memory-card__top h4 {
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
  overflow-wrap: anywhere !important;
  pointer-events: auto !important;
}

/* Make card colour row clickable above all theme layers */
#studyBoard .bv-study-memory-card__top .bv-study-color-row {
  position: relative !important;
  z-index: 20 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 7px !important;
  width: auto !important;
  min-width: max-content !important;
  pointer-events: auto !important;
}

/* Make every colour dot definitely clickable */
#studyBoard .bv-study-memory-card__top .bv-study-color-dot {
  position: relative !important;
  z-index: 25 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  flex: 0 0 auto !important;
}