/* ================================
   DM’s Table — Player Tabs (Left Header)
   File: dmTable.css (section: players)
   Dependencies: markup from dmTable_players.js
   Theme vars used (fallbacks provided):
     --background, --surface, --text, --muted, --primary, --border, --danger, --shadow
=================================== */





.dmTable_refCloseAllBtn {
  border: none !important;
}

.dmTable_refPickerGroup {
  border-left: 1px dotted rgb(from var(--primary) r g b / .275) !important;
  margin: 5px;
  padding: 15px;
  /* background-color: rgb(from var(--primary) r g b / .125); */
}

.dmTable_refPickerGroupTitle {
  border-bottom: 1px solid rgb(from var(--primary) r g b / .5);
  margin-bottom: 10px;
  padding-bottom: 3px;
  text-transform: uppercase;
  font-size: 0.825rem;
  color: var(--primary);
}

.dmTable_refPickerTitle {
  font-size: 0.75rem;
  color: var(-text);
  margin-left: 5px;
}


.dmtable_minimalBox {
  border: 1px dotted rgb(from var(--primary) r g b / .475) !important;
  width: 150px;
  height: 30px;
  border-radius: 4px;
  outline: none;
}

.dmtable_minimalBox:focus,
.dmtable_minimalBox:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 40%, transparent);
}



.dmTable_dicePanel {
  margin-right: 0px;
  margin-top: 10px;
}

.dmtable_dieLabel {
  margin-right: 5px;
  font-size: 0.7rem;
  margin-top: 5px;
}

.dmtable_dieSize {
    width: 25px;
  height: 25px;
  display: inline-block;
}
.dmtable_dieImage20 {
  background-color: var(--primary);
  mask-image: url('../images/ui/d20.png');
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url('../images/ui/d20.png');
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}
.dmtable_dieImage12 {
  background-color: var(--primary);
  mask-image: url('../images/ui/d12.png');
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url('../images/ui/d12.png');
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}
.dmtable_dieImage10 {
  background-color: var(--primary);
  mask-image: url('../images/ui/d10.png');
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url('../images/ui/d10.png');
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}
.dmtable_dieImage8 {
  background-color: var(--primary);
  mask-image: url('../images/ui/d8.png');
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url('../images/ui/d8.png');
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}
.dmtable_dieImage6 {
  background-color: var(--primary);
  mask-image: url('../images/ui/d6.png');
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url('../images/ui/d6.png');
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}
.dmtable_dieImage4 {
  background-color: var(--primary);
  mask-image: url('../images/ui/d4.png');
  mask-repeat: no-repeat;
  mask-size: contain;
  -webkit-mask-image: url('../images/ui/d4.png');
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}


/* Ensure the text column uses available width */
.dmTable_item_media .dmTable_item_media_body {
  min-width: 0;        /* allows text to wrap correctly in flex */
  font-size: 0.95rem;
  line-height: 1.35;
}

/* On very small screens, stack image above description */
@media (max-width: 575.98px){
  .dmTable_item_media {
    flex-direction: column;
  }
  .dmTable_item_media .dmTable_item_img {
    max-width: 100%;
    height: auto;
  }
}

.dmTable_item_media {
  align-items: center !important;
}

/* Keep image sizing (you already set 150px earlier) */
.dmTable_item_media .dmTable_item_img {
  max-height: 350px;
  width: auto;
  object-fit: cover;
  object-position: top left;
  flex: 0 0 auto;
}



.dmTable_toolbarLeft {
  font-size: 1.1rem;
  color: var(--primary);
}



.cardNameTitle {
  font-size: 1.3rem;
  color: var(--primary);
  font-weight: 500;
  line-height:1.3;
  border-bottom: 1px dotted rgb(from var(--primary) r g b / .275);
}

.dmTable_mstrAbilName {
  margin-left: 10px;
  color: var(--primary);
  font-size: 0.9rem;
}

.dmTable_mstrAbilDesc {
  padding-left: 25px;
  color: var(--text);
  font-size: 0.8rem;
}

.dmTableSrch_hdr--item {
  background-color: #67009b99 !important;
}
.dmTableSrch_hdr--spell {
  background-color: #00989b99 !important;
}

.dmTableSrch_hdr--monster {
  background-color: #a1000099 !important;
}

.dmTableSrch_hdr--poisons {
  background-color: #2e560099 !important;
}

.dmTableSrch_hdr--potions {
  background-color: #bd007899 !important;
}

.dmTableSrch_hdr--equipment {
  background-color: #56310099 !important;
}


.dmTableSrch_hdr--feat {
  background-color: #08009c99 !important;
}

.notesCardHeader {
    background: rgba(18, 88, 217, 0.625) !important;
}















































/* The reference card as a flex column container */
.dmTable_referenceCard {
  position: relative;            /* so the picker overlay can be absolutely positioned inside */
  display: flex;
  flex-direction: column;
}

/* Let the card body fill available space in the card */
.dmTable_referenceCard .dmTable_cardBody {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;              /* scrolling will happen in refContent */
}

/* Tabs row at the top of the body */
.dmTable_referenceCard .dmTable_refTabsRow {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px 2px;
  border-bottom: 1px solid var(--primary);
}

/* Tab list: horizontal, scrollable if many tabs */
.dmTable_referenceCard .dmTable_refTabsRow {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;   /* allow taller rows if it wraps */
  gap: 4px;
  padding: 4px 6px 2px;
  border-bottom: 1px solid var(--primary);
}

/* Let the tabs wrap into multiple rows instead of scrolling horizontally */
.dmTable_referenceCard .dmTable_refTabList {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;           /* <-- key change: allow wrapping */
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-x: visible;       /* no horizontal scrollbar */
  row-gap: 2px;              /* a bit of vertical breathing room between rows */
}

/* Individual tab pill */
.dmTable_referenceCard .dmTable_refTab {
  padding: 2px 8px;
  margin-right: 4px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  background: transparent;
  color: var(--text);
  opacity: 0.75;
}

/* Active tab highlight */
.dmTable_referenceCard .dmTable_refTabActive {
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.35);
  opacity: 1;
}

/* "+" button next to tabs */
.dmTable_referenceCard .dmTable_refTabAdd {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.8;
}

.dmTable_referenceCard .dmTable_refTabAdd:hover {
  background: rgba(255, 255, 255, 0.05);
  opacity: 1;
}

/* Main content area: fills the rest of the card body */
.dmTable_referenceCard .dmTable_refContent {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 6px 8px;
}

/* Empty-state message */
.dmTable_referenceCard .dmTable_refEmpty {
  font-size: 12px;
  opacity: 0.8;
  padding: 8px;
}


/* Full-card overlay inside the reference card */
.dmTable_referenceCard .dmTable_refPickerOverlay {
  position: absolute;
  inset: 0;                                   /* top:0; right:0; bottom:0; left:0 */
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: flex-start;                    /* panel near top */
  justify-content: center;
  padding-top: 32px;                          /* spacing from top edge */
  z-index: 2;                                 /* above card content */
}

/* The picker panel itself */
.dmTable_referenceCard .dmTable_refPickerPanel {
  background: var(--background);
  color: var(--text);
  border-radius: 10px;
  border: 1px solid var(--primary);
  width: min(360px, 90%);
  max-height: 80%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
}

/* Picker header row */
.dmTable_referenceCard .dmTable_refPickerHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--primary);
  font-weight: 600;
}

/* Close button in picker header */
.dmTable_referenceCard .dmTable_refPickerClose {
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.8;
}

.dmTable_referenceCard .dmTable_refPickerClose:hover {
  opacity: 1;
}

/* Picker body scroll area */
.dmTable_referenceCard .dmTable_refPickerBody {
  padding: 4px 0;
  overflow: auto;
}

/* List of reference options */
.dmTable_referenceCard .dmTable_refPickerList {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Individual reference option row */
.dmTable_referenceCard .dmTable_refPickerItem {
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.dmTable_referenceCard .dmTable_refPickerItem:hover {
  background: rgba(255,255,255,0.06);
}

/* Title + path styling */
.dmTable_referenceCard .dmTable_refPickerTitle {
  font-weight: 500;
}

.dmTable_referenceCard .dmTable_refPickerPath {
  font-size: 11px;
  opacity: 0.65;
}


/* Ref tab layout: label + tiny close button */
.dmTable_referenceCard .dmTable_refTab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 8px;
  margin-right: 4px;
  font-size: 12px;
  border: 1px solid transparent;
    border-radius: 6px 6px 0 0;
  cursor: pointer;
  white-space: nowrap;
  background: transparent;
  color: var(--text);
  opacity: 0.75;
}

.dmTable_referenceCard .dmTable_refTabActive {
  border-color: var(--primary);
  background: rgb(from var(--primary) r g b / .275);
  opacity: 1;
}



/* Tiny “x” button inside each tab */
.dmTable_referenceCard .dmTable_refTabClose {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0.65;
  opacity: 0.7;
  font-size: 0.7rem;
}

.dmTable_referenceCard .dmTable_refTabClose:hover {
  opacity: 1;
}





































.dmTable_notesTabsRow {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding-bottom: 2px;
}

.dmTable_notesTabList {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  overflow-x: auto;
}

.dmTable_notesTab {
  position: relative;
  padding: 3px 8px;
  border-radius: 6px 6px 0 0;
  background: rgba(0,0,0,.2);
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
}

.dmTable_notesTabActive {
  background: rgb(from var(--primary) r g b / .275);
  border-bottom: 1px solid var(--background);
}

.dmTable_notesTabTitle {
  display: inline-block;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dmTable_notesTabAdd {
  border: none;
  background: rgba(255,255,255,.05);
  border-radius: 999px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.dmTable_notesTabAdd:hover {
  background: rgba(255,255,255,.1);
}

.dmTable_noteToolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.dmTable_noteBlockSelect {
  background: var(--background);
  color: var(--text);
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.2);
  font-size: 12px;
  padding: 2px 6px;
}

.dmTable_notesCard {
  display: flex;
  flex-direction: column;
}

.dmTable_notesCard .dmTable_cardHeader {
  flex: 0 0 auto;
}

.dmTable_notesCard .dmTable_cardBody {
  flex: 1 1 auto;
  min-height: 0;         /* important so flex item can shrink */
  display: flex;
  flex-direction: column;
  overflow: hidden;      /* body itself doesn’t scroll; the editor will */
}

.dmTable_notesCard .dmTable_scrollGutter {
  flex: 0 0 auto;
}

.dmTable_notesCard .dmTable_resizeHandle {
  flex: 0 0 auto;
}

.dmTable_notesCard .dmTable_notesTabsRow,
.dmTable_notesCard .dmTable_noteToolbar {
  flex: 0 0 auto;
}

.dmTable_notesCard .dmTable_notesArea {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: auto;  /* scroll inside the editor if content exceeds card height */
  box-sizing: border-box;
  border-radius: 5px;
}

.dmTable_notesCard .dmTable_notesTabsRow {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  padding: 4px 6px 2px;
  border-bottom: 1px solid var(--primary);
}

.dmTable_notesCard .dmTable_notesTabList {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  row-gap: 2px;
}

/* Tab pill */
.dmTable_notesCard .dmTable_notesTab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  margin-right: 4px;
  font-size: 12px;
  border-radius: 5px 5px 0 0;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  background: transparent;
  color: var(--text);
  opacity: 0.75;
}

.dmTable_notesCard .dmTable_notesTabActive {
  border-color: var(--primary);
  background: rgb(from var(--primary) r g b / .275);
  opacity: 1;
}

/* Close button inside tab */
.dmTable_notesCard .dmTable_notesTabClose {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0.65;
  opacity: 0.7;
  font-size: 0.7rem;
}

.dmTable_notesCard .dmTable_notesTabClose:hover {
  opacity: 1;
}

/* + and archive buttons */
.dmTable_notesCard .dmTable_notesTabAdd,
.dmTable_notesCard .dmTable_notesArchiveBtn {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.8;
}

.dmTable_notesCard .dmTable_notesTabAdd:hover,
.dmTable_notesCard .dmTable_notesArchiveBtn:hover {
  background: rgba(255,255,255,0.05);
  opacity: 1;
}

.dmTable_notesCard .dmTable_notesArchiveOverlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 32px;
  z-index: 3;
}

.dmTable_notesCard .dmTable_notesArchivePanel {
  background: var(--background);
  color: var(--text);
  border-radius: 10px;
  border: 1px solid var(--primary);
  width: min(360px, 90%);
  max-height: 80%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 13px;
}

.dmTable_notesCard .dmTable_notesArchiveHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--primary);
  font-weight: 600;
}

.dmTable_notesCard .dmTable_notesArchiveClose {
  border: none;
  background: transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  opacity: 0.8;
}

.dmTable_notesCard .dmTable_notesArchiveClose:hover {
  opacity: 1;
}

.dmTable_notesCard .dmTable_notesArchiveBody {
  padding: 4px 0;
  overflow: auto;
}

.dmTable_notesCard .dmTable_notesArchiveList {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dmTable_notesCard .dmTable_notesArchiveItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.dmTable_notesCard .dmTable_notesArchiveTitle {
  font-weight: 500;
  margin-right: 8px;
}

.dmTable_notesCard .dmTable_notesArchiveButtons {
  display: inline-flex;
  gap: 4px;
}

.dmTable_notesCard .dmTable_notesArchiveEmpty {
  padding: 10px;
  font-size: 12px;
  opacity: 0.8;
}


.dmTable_notesCard .dmTable_tbBtn {
  border: 0;
  background-color: transparent;
}
























/* ================================
   DM’s Table — Conditions
=================================== */

  .dmTable_condWrap{ 
    position:relative; 
    display:inline-block; 
  }

  .dmTable_condBtn{ 
    display:inline-flex; 
    align-items:center; 
    gap:.25rem; 
  }

  .dmTable_condMenu{
    position:fixed; /* portal + fixed to escape card overflow */
    z-index: 100000; /* above cards */
    left: 0; top: 0; /* set by JS */
    background: var(--background); 
    color: var(--primary);
    border:1px solid var(--primary); 
    border-radius: .35rem; 
    padding:.5rem; 
    width: clamp(220px, 40vw, 420px);
    box-shadow:0 8px 24px rgba(0,0,0,.35);
    max-height: 60vh; 
    overflow: auto; /* scroll menu itself, not the card */
  }

  .dmTable_condGrid{
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); /* responsive */
    gap:.35rem;
  }

  .dmTable_condToggle {
    display:inline-flex; 
    align-items:center; 
    justify-content:flex-start;
    gap:.35rem; 
    padding:.35rem .5rem; 
    border:1px solid transparent; 
    border-radius:.4rem;
    background: transparent; 
    color: var(--primary); 
    cursor:pointer; 
    font-size:.92rem;
  }

  .dmTable_condToggle[aria-pressed="true"]{
    background: rgb(from var(--primary) r g b / .575); 
    color: var(--background); 
    border-color: var(--primary);
  }

  .dmTable_condBadgeWrap{ 
    display:flex; 
    flex-wrap:wrap; 
    gap:.35rem; 
    margin-top:.5rem; 
  }

  .dmTable_condBadge{
    display:inline-flex; 
    align-items:center; 
    gap:.25rem; 
    padding:.1rem .45rem;
    border:1px solid var(--primary); 
    border-color: rgb(from var(--primary) r g b / .5);
    border-radius:.4rem; 
    font-size:.8rem; 
    background: transparent;
  }

  .dmTable_condBadge .x{ 
    cursor:pointer; 
    font-weight:700; 
    opacity:.85; 
  }

  .dmtk-hpControls { 
    display:flex; 
    flex-wrap:wrap; 
    gap:.75rem; 
    justify-content:center; 
    margin-top:.5rem; 
  }

  .dmtk-inlineEditor { 
    display:inline-flex; 
    gap:.35rem; 
    align-items:center; 
    margin-left:.35rem; 
  }

  .dmtk-inlineNum { 
    width: 5.5rem; 
    padding:.25rem .4rem; 
  }

  .dmTableHP_btn {
    border: 1px solid;
    background-color: var(--background);
    padding: 3px;
    width: 100px;
    font-size: 0.8rem;
  }

  .dbTableHP_dmg {
    background-color: rgb(from var(--danger) r g b / .675);
    border: 1px solid var(--danger);
    color: var(--background);
    font-weight: 300;
  }

  .dbTableHP_heal {
    background-color: rgb(from var(--success) r g b / .675);
    border: 1px solid var(--success);
    color: var(--background);
    font-weight: 300;
  }

  .dbTableHP_tmp {
    background-color: rgb(195, 139, 44, 0.675);
    border: 1px solid rgb(195, 139, 44);
    color: var(--background);
    font-weight: 300;
  }













/* ================================
   DM’s Table — Player Tabs (Left Header)
=================================== */

/* Bar container */
/* ---- DM’s Table: Player Tabs (Left Header) ---- */

/* ===== Players Card (screen-space) ===== */
.dmTable_card.dmTable_playerCardShell {
  position: fixed; /* JS sets x/y */
  background: var(--background);
  color: var(--text);
  border: 1px solid var(--primary);
  border-color: rgb(from var(--primary) r g b / .5);
  border-radius: .5rem;
  box-shadow: 0 12px 28px rgba(0,0,0,.4);
  overflow: hidden;
  
  /* width/height set by JS */
}

/* Card header */
.dmTable_cardHeader {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; padding: .4rem .55rem;
  background: var(--primary);
  color: var(--background);
  border-bottom: 1px solid var(--primary);
  user-select: none;
}

/* Card body */
.dmTable_cardBody { height: calc(100% - 40px - 36px); /* header ~40 + tabs ~36 */ }
.dmTable_cardBodyInner { height: 100%; overflow: auto; padding: .6rem; }

/* Inline row for chooser (dropdown + Link) */
.dmTable_rowInline { display: flex; align-items: center; gap: .5rem; }
.dmTable_rowInline > * { flex: 1 1 auto; }
.dmTable_rowInline > .dmTable_btn { flex: 0 0 auto; }

/* Inputs */
.dmTable_charForm .form-row { margin-bottom: .4rem; }
.dmTable_charForm label { display:block; font-size:.8rem; opacity:.9; margin-bottom:.15rem; }
.dmTable_charForm input,
.dmTable_charForm select {
  width: 100%;
  background: var(--background);
  color: var(--text);
  border: 1px solid var(--primary);
  border-color: rgb(from var(--primary) r g b / .5);
  border-radius: .375rem;
  padding: .35rem .5rem;
  font-size: .95rem;
}

/* Stat block layout (portrait-friendly) */
.dmTable_statBlock {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: .6rem;
}
.dmTable_portrait {
  width:96px; height:128px; border:1px solid rgb(from var(--primary) r g b / .5);
  border-radius:.25rem; background:#00000022; display:none; overflow:hidden;
}
.dmTable_portrait img { width:100%; height:100%; object-fit:cover; display:block; }
.dmTable_statMain .line { margin:.25rem 0; font-size:.95rem; }
.dmTable_abilityRow {
  display:grid; grid-template-columns: repeat(6, 1fr);
  gap:.25rem; margin:.35rem 0;
}
.dmTable_ability {
  text-align:center; border:1px solid rgb(from var(--primary) r g b / .5);
  border-radius:.25rem; padding:.25rem .2rem;
}
.dmTable_ability .lbl { font-weight:700; font-size:.8rem; }
.dmTable_ability .score { font-size:1rem; font-weight:700; }
.dmTable_ability .mod { font-size:.85rem; opacity:.9; }
.dmTable_hr { height:1px; background:rgb(from var(--primary) r g b / .5); margin:.45rem 0; }
.dmTable_smallNote { font-size:.85rem; opacity:.8; }



/* Header: title takes available space; buttons flush right */
.dmTable_cardHeader{
  display:flex; align-items:center; gap:.5rem;
  padding:.4rem .55rem; background:var(--primary); color:var(--background);
  border-bottom:1px solid var(--primary);
}



/* --- Player card (unchanged base; still reset-proof via .dmTable_pcardShell) --- */
.dmTable_pcardShell { 
  position:absolute; 
  display:flex; 
  flex-direction:column;
  background:var(--background); 
  color:var(--text);
  border: 1px solid rgb(from var(--primary) r g b / .5);
  border-radius: 6px 3px 0 3px !important;  /* TL TR BR BL order supports slash too */
}





/* Tabs */
.dmTable_pcardShell .tabsBar{
  display:flex; align-items:center; gap:.35rem; padding:.3rem .4rem;
  border-bottom:1px solid rgb(from var(--primary) r g b / .5); background:var(--background);
}



.dmTable_pcardShell .dmTable_tabActions{ display:inline-flex; gap:.3rem; }

.dmTable_pcardShell .dmTable_tabAction{
  display:inline-flex; align-items:center; justify-content:center; width:1.45rem; height:1.2rem;
  border:1px solid rgb(from var(--primary) r g b / .5); border-radius:.25rem; background:transparent; color:currentColor;
  font-weight:700; cursor:pointer;
}



/* Body + collapse */
.dmTable_pcardShell .dmTable_cardBody{ flex:1 1 auto; min-height:0; }
.dmTable_pcardShell .dmTable_cardBodyInner{ height:100%; overflow:auto; padding:.6rem; }
.dmTable_pcardShell.is-collapsed .tabsBar,
.dmTable_pcardShell.is-collapsed .dmTable_cardBody,
.dmTable_pcardShell.is-collapsed .dmTable_pResize{ display:none !important; }

/* Resize handle (image) */
.dmTable_pResize{
  position:absolute; right:6px; bottom:6px; width:16px; height:16px;
  background-repeat:no-repeat; background-position:center; background-size:contain;
  cursor:nwse-resize; opacity:.9;
}



/* Simple kv table */
.dmTable_kv{ width:100%; border-collapse:collapse; font-size:.95rem; }
.dmTable_kv th, .dmTable_kv td{
  border:1px solid rgb(from var(--primary) r g b / .5);
  padding:.35rem .45rem; vertical-align:top;
}
.dmTable_kv thead th{ background:rgb(from var(--primary) r g b / .15); }
.dmTable_kv tbody tr:nth-child(even){ background:#00000010; }
.dmTable_pcardShell .dmTable_smallNote{ font-size:.9rem; opacity:.85; }







/* Resize grip (bottom-right) */
.dmTable_resizeHandle {
  position: absolute; right: 6px; bottom: 6px; width: 16px; height: 16px;
  border-right: 2px solid rgb(from var(--primary) r g b / .5);
  border-bottom: 2px solid rgb(from var(--primary) r g b / .5);
  cursor: nwse-resize;
  opacity: .8;
}

.dmTable_resizeHandle{ pointer-events:auto; }
.is-collapsed .dmTable_resizeHandle{ display:none; }

.dmTable_pcardShell .dmTablePlayer_cardTitle{ 
  margin-left: 30px;
  white-space:normal;
  flex:1 1 auto; 
  min-width:0; 
  font-weight:300; 
}

.dmTable_pcardShell .dmTable_dragIcon{
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  opacity: .9;
  background-repeat: no-repeat; 
  background-position: center; 
  background-size: contain;
  cursor: grab;
}

.dmTablePlayer_cardBtns{ 
  flex:0 0 auto; 
  display:inline-flex; 
  gap:.3rem; 
}

.dmTablePlayer_btn {
  display: inline-flex;
  align-items: center; 
  justify-content: center;
  background: transparent; color: var(--background);
  border: none;
  color: var(--background);
  margin-right: 15px;
}

/* Header */
.dmTable_pcardShell .dmTablePlayer_cardHeader{
  height: 30px;
  display:flex;
  align-items:center;
  gap:.5rem;
  padding: .4rem 0rem; 
  color:var(--background);
  background: rgba(9, 78, 41, 0.625);
  border-bottom:1px solid var(--primary);
  cursor: grab;
}

/* container for tabs already exists: .dmTable_playersTabs */

.dmTable_tabNav {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 28px;
  height: 28px;
  margin: 0 .25rem;
  background: transparent;
  color: var(--text);
  border-radius: 4px;
}

.dmTable_tabNav:disabled { 
  opacity:.4; 
  pointer-events:none; 
}

/* Tabs bar (inside card) */
.dmTable_playersTabs.tabsBar {
  display: flex; 
  align-items: center; 
  gap: .35rem;
  padding: .3rem .4rem;
  background: var(--background);
}

.tabBtn {
  position: relative;
  border: 1px solid rgb(from var(--primary) r g b / .5);
  background: #70809035;
  color: var(--text);
  border-radius: .6rem .6rem 0 0;
  padding: .25rem .6rem;
  cursor: pointer; user-select: none;
    text-transform: capitalize;

}



.dmTable_tabPlus { 
  margin-left: auto; 
  border: 1px dotted;
  background: transparent;
  border-radius: 5px;
  width: 18px;
}

.dmTable_tabPlus i {
  font-size: 14px;
  color: var(--primary);
  position: relative;
  left: -6px;
}

.dmTable_playerTab {
  font-weight: 300;
  border-radius: 0;
  font-size: 0.8rem;
}

.dmTable_playerTab:first-child {
  font-weight: 300;
  border-radius: 5px 0px 0 5px;
}

.dmTable_playerTab:last-child {
  font-weight: 300;
  border-radius: 0px 5px 5px 0;
}

.dmTable_playerTab .dmTable_playerX {
  margin-left: .5rem; 
  font-weight: 300; 
  cursor: pointer;
}



/* selected player tab */

.tabBtn:hover {
  background-color: inherit;
}

.tab_classIcon {
  position: relative;
  top: 2px;
  width: 1.5em;   /* scales with text */
  height: 1.5em;
  margin-right: 5px;
}

.tabBtn.is-active {
  border-top: 2px solid #000000;
  border-bottom: 3px solid #000000;
  color: #ffffff;
  text-shadow: 2px 2px 5px #333;
}

.tabBtn:first-child.is-active {
  border-top: 2px solid #000000;
  border-bottom: 3px solid #000000;
  border-left: 2px solid #000000;
}

.tabBtn:last-child.is-active {
  border-top: 2px solid #000000;
  border-bottom: 3px solid #000000;
  border-right: 2px solid #000000;
}

.playerTab_barbarian {
  background-color: #A8323288;
}

.playerTab_bard {
  background-color: #C75AF688;
}

.playerTab_cleric {
  background-color: #E0C05C88;
}

.playerTab_druid {
  background-color: #3A9A5F88;
}

.playerTab_fighter {
  background-color: #70809088;
}

.playerTab_monk {
  background-color: #C48A3F88;
}

.playerTab_paladin {
  background-color: #D5C28F88;
}

.playerTab_ranger {
  background-color: #4B8B3B88;
}

.playerTab_rogue {
  background-color: #2C2C2C88;
}

.playerTab_sorcerer {
  background-color: #B041FF88;
}

.playerTab_warlock {
  background-color: #3B006688;
}

.playerTab_wizard {
  background-color: #0088FF88;
}

.playerTab_shaman {
  background-color: #6F3C9B88;
}

.playerTab_spellbinder {
  background-color: #FF6F3C88;
}

.playerTab_witch {
  background-color: #5C2E7E88;
}

.playerTab_templar {
  background-color: #B7B8C588;
}

/* Responsive compact Ability Grid */
.dmtk-ability-grid{
  display: grid;
  gap: 4px;
  /* Auto-stack: each card is at least 100px wide, grows to fill */
  grid-template-columns: repeat(auto-fit, minmax(35px, 1fr));
  padding-bottom: 12px; /* room for the arrow tips */
}

/* On large screens, lock to exactly 6 columns */
@media (min-width: 992px){
  .dmtk-ability-grid{
    grid-template-columns: repeat(6, 1fr);
  }
}

.dmtk-ability-card{
  position: relative;
  border: 1px dotted var(--primary);
  border-radius: 5px;
  background: var(--background);
  padding: 6px;                 /* <- these numbers are referenced below */
  text-align: center;
  overflow: hidden;             /* ensures header radius clips cleanly */
}



/* Compact type scale */
.dmtk-ability-label{
  --label-bg: var(--primary);
  --label-fg: #fff;

  display: block;
  background: rgb(from var(--primary) r g b / .475);
  color: var(--background);
  padding: 4px 6px;

  /* cancel the card’s padding so the header touches the border */
  margin: -6px -6px 6px -6px;   /* top/right/bottom/left; top/side = -card padding */
  border-radius: 4px 4px 0 0;   /* match (card radius - 1px) */
  font-size: .7rem;
  font-weight: 300;
  letter-spacing: .02em;
}

.dmtk-ability-score{
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
}
.dmtk-ability-mod{
  margin-top: 5px;
  font-size: .65rem;
  opacity: .9;
}




/* Stats grid (HP / Max / Temp / AC / Speed) */
.dmtk-stat-grid{
  --stat-border: var(--primary);
  --stat-bg: var(--background);
  --label-fg: var(--background);

  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  padding-bottom: 6px;
}

/* Lock to 5 columns on larger screens */
@media (min-width: 992px){
  .dmtk-stat-grid{ grid-template-columns: repeat(5, 1fr); }
}

.dmtk-stat-card{
  position: relative;
  border-radius: 6px;
  background: var(--stat-bg);
  padding: 10px;
  text-align: center;
  overflow: hidden; /* so header rounding clips cleanly */
}

/* Full-bleed header bar */
.dmtk-stat-label{
  display: block;
  background: rgb(from var(--primary) r g b / .2);
  color: var(--text);
  padding: 4px 6px;
  margin: -6px -6px 6px -6px;   /* cancel card padding on top/sides */
  border-radius: 5px 5px 0 0;   /* match (card radius - 1px) */
  font-size: .7rem;
  font-weight: 300;
  letter-spacing: .02em;
}

.dmtk-stat-value{
  font-size: .85rem;
  font-weight: 800;
  line-height: 1;
  color: var(--primary);
}

.dmtk-stat-sub{
  margin-top: 2px;
  font-size: .7rem;
  opacity: .85;
}

.dmtk-player-titleHeader{
  display: flex;
  align-items: center;
  gap: 8px;
}

/* name can truncate nicely if long */
.dmtk-player-name{
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 1.5rem;
}

/* push buttons to the far right */
.dmTable_viewActions{
  margin-left: auto;          /* <-- the magic */
  display: inline-flex;
  align-items: center;
}

.dmtk-player-titleHeader {
  color: var(--primary);
  font-size: 1.2rem;
  border-bottom: 1px dotted var(--primary);
}

.dmtk-player-playerdetails {
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 10px; 
}

.dmtk-player-playerdetails .dmTablePlayerCardBtn{
  margin-left: auto;      /* shove to right edge */
  display: inline-flex;   /* center icon nicely */
  align-items: center;
  justify-content: center;
  color: var(--danger);
}

.dmTablePlayerCardBtn {
  border: none;
  background-color: transparent;
  color: var(--primary);
}

.dmTable_playerTab.is-armed {
  outline: 1px solid var(--danger, var(--danger, #aa2222));
  outline-offset: 1px;
}

.dmTable_pcardShell .dmTable_tabAction.delete.is-armed{
  background:rgb(from var(--danger) r g b / .475);
  color:#fff; 
  border-color:var(--danger);
}

/* Card-level alert bar (delete confirm) */
.dmTable_pcardShell .dmTable_alert{
  margin-bottom: 5px;
  display:none; 
  padding:.35rem .6rem; 
  border-bottom:2px solid darkred;
  border-top:1px solid darkred;
  background: rgb(from var(--danger) r g b / .475);
  color:var(--text); 
  font-size: 0.85rem;
  font-weight:300;
  color: darkred;
}

.dmTable_pcardShell .dmTable_alert.is-visible{ 
  display:block; 
}

.playerCardInitIcons{
    width: 22px !important;
    height: 22px !important;
    line-height: 24px;              /* helps with icon-font baselines */
    transform: translateY(2px);
    margin-right: 3px;
}

.playerCardInitLabel {
  font-size: 1.25rem;
  margin-right: 25px;
  color: var(--text);
}





























































/* =========================
   AUTH GATE
   Theme vars: --background, --text, --primary
========================= */



/* Auth gate panel */
.dmTable_authGate{
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  margin: 24px auto;
  max-width: 860px;
  background: var(--background);
  color: var(--text);
  border: 1px solid var(--primary);
  border-radius: 12px;
}

.dmTable_authWrap{ text-align: center; }

.dmTable_authTitle{
  margin: 0 0 8px;
  color: var(--primary);
  font-weight: 700;
  font-family: "Faculty Glyphic", sans-serif;
  font-size: 1.25rem;
}

.dmTable_authText{ opacity: .95; margin: 0 0 12px; }

.dmTable_authActions{ display: inline-flex; gap: 8px; }

.dmTable_btn{
  background: var(--background);
  color: var(--text);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 6px 12px;
  line-height: 1.2;
  text-decoration: none;
}
.dmTable_btn:hover{ background: rgba(0,0,0,.05); }


.dmTable_authWrap{
  height: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;      /* horizontal centering */
  justify-content: center;  /* vertical centering */
  text-align: center;
  gap: 10px;
}



























/* =========================
   DM's Table Main
   Theme vars: --background, --text, --primary
========================= */

/* Toolbar: sticky full width (inside page flow) */
.dmTable_toolbar{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--background);
  color: var(--text);
  border-bottom: 1px dotted rgb(from var(--primary) r g b / .275);
}

/* Left side grows, keeping the right group pushed to the edge */
.dmTable_toolbarLeft{
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
}

.dmTable_toolbarTitle{
  color: var(--primary);
  font-weight: 600;
  letter-spacing: .3px;
  /* use your site font */
  font-family: "Faculty Glyphic", sans-serif;
}

.dmTable_toolbarSub{
  opacity: .85;
  font-size: .9rem;
}

/* Right side stays tight and right-aligned */
.dmTable_toolbarRight{
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;        /* pushes this group to the right */
  justify-content: flex-end;
}

/* Buttons: inherit your existing button styling class if any */
.dmTable_btn{
  border: none;
  background: transparent;
  color: var(--text);
  padding: 6px 10px;
  line-height: 1.2;
}

.dmTable_btn:hover{
  background: rgba(0,0,0,.05); /* safe on light/dark; tweak if needed */
}

.dmTable_btnDanger{
  border-color: var(--primary);
  /* keep background same; you can tint text if desired */
}

/* Narrow screens: let items wrap, keep right group aligned right on its own row */
@media (max-width: 768px){
  .dmTable_toolbar{
    flex-wrap: wrap;
    row-gap: 8px;
  }
  .dmTable_toolbarLeft{
    flex: 1 1 100%;
  }
  .dmTable_toolbarRight{
    flex: 1 1 100%;
    justify-content: flex-end;
  }
}



.dmTable_btn:hover { background: color-mix(in srgb, var(--background) 86%, #000 14%); }
.dmTable_btnDanger { border-color: color-mix(in srgb, #ff3b30 60%, var(--background)); color: #ff7b73; }
.dmTable_btnDanger:hover { background: color-mix(in srgb, #ff3b30 14%, var(--background)); }

/* Stage only provides scrollable height */
.dmTable_stage{
  position: relative;
  min-height: 200vh;
}

/* Cards (absolute in PAGE space; appended to <body>) */
.dmTable_card{
  position: absolute;
  display: flex;
  flex-direction: column;

  --dmTable-resize: 0px;                 /* handle box */
  --dmTable-scrollbar: 0px;               /* set by JS; 0 on overlay scrollbars */

  padding-bottom: calc(var(--dmTable-resize) + 8px); /* height clearance only */
  padding-right: var(--dmTable-scrollbar);           /* just the scrollbar width */

  background: var(--background);
  color: var(--text);
  border: 1px solid var(--primary);
  border-radius: 6px 3px 0 3px !important;  /* TL TR BR BL order supports slash too */
}

.killShadows {
    --bs-box-shadow: none;
    --bs-box-shadow-sm: none;
    --bs-box-shadow-lg: none;
    /* Some themes also use a card-specific var */
    --bs-card-box-shadow: none;

    box-shadow: none !important;   /* hard kill */
}

.addCardShadow {
    /* box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 4px, rgba(0, 0, 0, 0.3) 0px 7px 13px -3px, rgba(0, 0, 0, 0.2) 0px -3px 0px inset !important; */
    box-shadow: 1px 10px 13px -8px rgb(from var(--primary) r g b / .475) !important;
    -webkit-box-shadow: 1px 10px 13px -8px rgb(from var(--primary) r g b / .475) !important;
    -moz-box-shadow: 1px 10px 13px -8px rgb(from var(--primary) r g b / .475) !important;
}

.dmTable_cardHeader{
  height: 30px;
  display: grid; grid-template-columns: 36px 1fr auto;
  align-items: center; gap: 8px; padding: 0 8px;
  border-bottom: 1px solid var(--primary);
  background: rgb(from var(--primary) r g b / .775);
  color: var(--background);
  font-weight: 300;
}

.dmTable_dragHandle{ display: grid; place-items: center; cursor: grab; touch-action: none; }
.dmTable_dragHandle:active{ cursor: grabbing; }
.dmTable_cardTitle{ font-weight: 300; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dmTable_cardBody{ 
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  /* small inner breathing room that doesn't cause a big blank */
  padding-right: 6px;
  scrollbar-gutter: stable;               /* avoids jumps when bar appears */
}

.dmTable_resizeHandle{
  position: absolute;
  bottom: 6px;             /* inside the card padding corner */
  right: 6px;              /* inside the card padding corner */
  width: 22px;             /* hit area larger than the visual */
  height: 22px;
  cursor: nwse-resize;
  z-index: 2;

  /* no border/tile now — the PNG is the visual */
  background: none;
  border: 0;
}



.dmTable_resizeHandle::after{
  content: "";
  position: absolute;
  inset: 0;                /* center inside the hit box */
  margin: auto;
  width: 24px;             /* actual art size */
  height: 24px;

  background-repeat: no-repeat;
  background-position: right bottom; /* bias to the corner */
  background-size: 20px 20px;

  /* swap in your asset paths */
  background-image: image-set( url("../images/ui/corner.png"));

  pointer-events: none;          /* keep dragging on the handle */
  -webkit-user-drag: none;
  user-select: none;
}

/* Collapsed state */
.dmTable_card.dmTable_isCollapsed{ height: 30px !important; min-height: 30px !important; }
.dmTable_card.dmTable_isCollapsed .dmTable_cardBody{ display: none !important; }
.dmTable_card.dmTable_isCollapsed .dmTable_resizeHandle{ display: none !important; }

/* Content helpers */
.dmTable_kv{ display: grid; grid-template-columns: 120px 1fr; gap: 6px; margin-bottom: 6px; }
.dmTable_kv > span{ opacity: .75; }
.dmTable_divider{ height: 1px; background: color-mix(in srgb, var(--background) 50%, #000 50%); margin: 8px 0; }
.dmTable_rich p{ margin: 0 0 .5rem; }
.dmTable_rich ul, .dmTable_rich ol{ margin: 0 0 .5rem 1.2rem; }

@media (max-width: 768px){
  .dmTable_kv{ grid-template-columns: 90px 1fr; }
}

.dmTable_cardHeader{
  flex: 0 0 auto;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.dmTable_cardTools .dmTable_toolBtn{
  cursor: pointer;      /* override the header's move cursor for buttons */
  color: var(--background);
  background: transparent;
  border: none;
  font-weight: 300;
}

/* Reserve space so the vertical scrollbar never sits under the resize handle */
.dmTable_scrollGutter{
  height: 28px;        /* tweak if your handle is larger */
  flex: 0 0 auto;
  background: transparent;
  pointer-events: none; /* purely spacing */
}


#dmTable_searchPanel .dmTable_footHint{ opacity:.85; }
#dmTable_searchPanel .dmTable_footMsg{
  display:block;
  margin-top:6px;
  min-height:1.2em;            /* keeps layout steady even before a message */
  color: var(--text);
  font-size: 0.9rem;
  text-align: center;
}

.dmTable_cardHeader{

  font-weight: 300 !important; 
  white-space: nowrap; 
  overflow: hidden; 
  text-overflow: ellipsis;
  
}

