/* ─────────────── HOME / LIBRARY (3-column rebuild) ───────────────
   Loaded after styles.css to override the buried-library layout. */

.home-view.library-mode {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
  padding: 16px 18px 18px;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
}

.home-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse at 92% 18%, var(--accent-soft), transparent 50%),
    linear-gradient(135deg, #16181b 0%, #0f1113 100%);
}
.home-header .eyebrow {
  margin: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.2em;
}
.home-header h2 {
  margin: 4px 0 3px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.home-header .subhead {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  max-width: 560px;
}
.home-header-stats {
  display: grid;
  grid-auto-flow: column;
  gap: 8px;
}
.home-header-stats .qs-tile {
  min-width: 82px;
  padding: 9px 14px;
  gap: 3px;
}
.home-header-stats .qs-value {
  font-size: 19px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.home-header-stats .qs-tile label {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.1em;
}
#homeReadyPack { font-size: 12.5px; }

/* Narrow home view: stats drop under the title. (The board's single-column
   override lives at the END of this file so it wins the cascade against the
   base #drillTable rule below.) */
@media (max-width: 880px) {
  .home-header { grid-template-columns: minmax(0, 1fr); }
  .home-header-stats { grid-auto-flow: row; grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 540px) {
  .home-header-stats { grid-template-columns: repeat(2, 1fr); }
  .home-view.library-mode { padding: 10px; }
}
#homeReadyPack.is-ready { color: var(--accent); }

.home-pack-summary {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.home-pack-summary.hidden { display: none; }
.home-pack-summary .ps-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.home-pack-summary .ps-meta {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}
.home-pack-summary .ps-stats {
  display: flex;
  gap: 16px;
  color: var(--muted);
  font-size: 12px;
}
.home-pack-summary .ps-stats > div {
  display: grid;
  gap: 2px;
  text-align: right;
  min-width: 60px;
}
.home-pack-summary .ps-stats strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.home-pack-summary .ps-stats label {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.home-pack-summary .ps-score {
  padding-right: 12px;
  border-right: 1px solid var(--line);
  margin-right: 4px;
}
.home-pack-summary .ps-score strong {
  font-size: 22px;
}
.home-pack-summary .ps-score.score-good strong { color: var(--good); }
.home-pack-summary .ps-score.score-ok strong { color: var(--orange); }
.home-pack-summary .ps-score.score-bad strong { color: var(--bad); }
.score-good-text { color: var(--good) !important; }
.score-bad-text { color: var(--bad) !important; }

/* row-meta score color */
.home-view.library-mode .lr-label span.score-good { color: rgba(90, 210, 122, 0.9); }
.home-view.library-mode .lr-label span.score-ok   { color: rgba(245, 164, 75, 0.9); }
.home-view.library-mode .lr-label span.score-bad  { color: rgba(239, 91, 91, 0.85); }

/* Override the older library-board styles inherited from styles.css */
.home-view.library-mode #drillTable.library-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  min-height: 520px;
  overflow: hidden;
  min-width: 0;
}

.home-view.library-mode .library-column {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  padding: 0;
}

.home-view.library-mode .library-column-head {
  display: grid;
  gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0%, transparent 100%);
}
.home-view.library-mode .library-column-head h3 {
  margin: 0;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-2);
}
.home-view.library-mode .library-column-head p {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}
.home-view.library-mode .library-head-actions {
  display: flex;
  gap: 6px;
}
.home-view.library-mode .library-head-actions .mini-button {
  flex: 1;
  text-align: center;
}
.home-view.library-mode .library-head-actions .primary-mini {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #181206;
  border-color: var(--accent-3);
  font-weight: 700;
}
.home-view.library-mode .library-head-actions .primary-mini:hover {
  background: linear-gradient(180deg, #efc068 0%, var(--accent) 100%);
  color: #181206;
}

.home-view.library-mode .library-tree {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 8px 12px;
  overflow-y: auto;
  max-height: none;
}

.home-view.library-mode .library-tree .library-empty {
  padding: 20px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

/* Single-row library item (folder or leaf) */
.home-view.library-mode .library-row {
  position: relative;
  display: grid;
  grid-template-columns: 16px 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px 7px calc(8px + var(--depth, 0) * 16px);
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.home-view.library-mode .library-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}
.home-view.library-mode .library-row.active {
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.home-view.library-mode .library-row.is-folder {
  background: rgba(245, 164, 75, 0.04);
}
.home-view.library-mode .library-row.is-folder:hover {
  background: rgba(245, 164, 75, 0.09);
}
.home-view.library-mode .library-row.is-folder.expanded {
  border-color: rgba(245, 164, 75, 0.18);
}

/* ── drag & drop visual feedback ── */
.home-view.library-mode .library-row.dragging {
  opacity: 0.45;
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.04);
}
.home-view.library-mode .library-row.drop-above {
  box-shadow: 0 -2px 0 var(--accent), 0 -8px 12px -8px var(--accent-glow);
}
.home-view.library-mode .library-row.drop-below {
  box-shadow: 0 2px 0 var(--accent), 0 8px 12px -8px var(--accent-glow);
}
.home-view.library-mode .library-row.drop-into {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}
.home-view.library-mode .library-tree.drop-col-end {
  background:
    linear-gradient(180deg, transparent 0%, var(--accent-softer) 100%);
  box-shadow: inset 0 -2px 0 var(--accent);
}
.home-view.library-mode .library-row {
  cursor: grab;
}
.home-view.library-mode .library-row.dragging {
  cursor: grabbing;
}

.home-view.library-mode .lr-chev {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  transition: transform 120ms;
}
.home-view.library-mode .library-row.is-folder .lr-chev::after {
  content: "\25B8"; /* right-pointing triangle */
}
.home-view.library-mode .library-row.is-folder.expanded .lr-chev {
  transform: rotate(90deg);
}

.home-view.library-mode .lr-icon {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--muted);
}
.home-view.library-mode .library-row.is-folder .lr-icon {
  color: var(--orange);
}
.home-view.library-mode .library-row.is-range .lr-icon { color: #c084fc; }
.home-view.library-mode .library-row.is-drill .lr-icon { color: #60a5fa; }
.home-view.library-mode .library-row.is-pack .lr-icon { color: var(--accent); }
.home-view.library-mode .library-row.is-routine .lr-icon { color: #34d399; }

/* ── Routine editor ── */
.routine-days {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--inset);
  padding: 6px;
}
.routine-days > .muted { padding: 10px; }
.routine-day {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.routine-day.is-current { border-color: var(--accent-line); }
.routine-day .rd-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.routine-day .rd-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.routine-day .rd-name {
  min-height: 28px;
  padding: 2px 8px;
  font-size: 12.5px;
  font-weight: 600;
  width: 160px;
}
.routine-day .rd-badge {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  white-space: nowrap;
}
.routine-day .rd-meta { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.routine-day .rd-actions { display: flex; gap: 4px; }
.routine-day .rd-actions .mini-button { min-height: 26px; padding: 0 8px; font-size: 11px; }
.routine-day .rd-drills { display: flex; flex-direction: column; gap: 4px; }
.routine-day .rd-empty { color: var(--muted); font-size: 12px; padding: 4px 6px; }
.routine-target-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.routine-target-label .input { min-height: 30px; padding: 2px 8px; font-size: 12px; width: 120px; }
.routine-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px;
}
.routine-entry.is-missing { border-color: rgba(248, 113, 113, 0.5); }
.routine-entry .re-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.routine-entry .re-head strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.routine-entry .re-kind {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  white-space: nowrap;
}
.routine-entry .re-config {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}
.routine-entry .re-config label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}
.routine-entry .re-config .input {
  min-height: 28px;
  padding: 2px 8px;
  font-size: 12px;
}
.routine-entry .re-config .re-line { width: 180px; }
.routine-entry .re-config .re-hands { width: 72px; }
.routine-entry .re-actions .mini-button { min-height: 26px; padding: 0 8px; font-size: 11px; }
.routine-entry .re-actions { display: flex; gap: 6px; }
.routine-sources { max-height: 220px; }
.routine-source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12.5px;
}
.routine-source-row:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}
.routine-source-row .rs-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.routine-source-row .rs-info strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.routine-source-row .rs-info span { color: var(--muted); font-size: 11.5px; }

.home-view.library-mode .lr-label {
  min-width: 0;
  display: grid;
  gap: 1px;
  pointer-events: none;
}
.home-view.library-mode .lr-label strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0;
}
.home-view.library-mode .lr-label span {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}
.home-view.library-mode .library-row.active .lr-label strong {
  color: var(--accent);
}

.home-view.library-mode .lr-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
  max-width: 156px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms;
}
.home-view.library-mode .library-row:hover .lr-actions,
.home-view.library-mode .library-row.active .lr-actions {
  opacity: 1;
  pointer-events: auto;
}
.home-view.library-mode .lr-btn {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  max-width: 58px;
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: background 120ms, border-color 120ms, color 120ms;
}
.home-view.library-mode .lr-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-2);
  color: var(--text);
}
.home-view.library-mode .lr-btn.primary {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  border-color: transparent;
  color: #181206;
  font-weight: 700;
}
.home-view.library-mode .lr-btn.primary:hover {
  background: linear-gradient(180deg, #efc068 0%, var(--accent) 100%);
  color: #181206;
}
/* Routine names and progress need the full column width. Keep their controls
   on a separate, wrapping row, including when using touch or the keyboard. */
.home-view.library-mode .library-row.is-routine {
  grid-template-columns: 16px 18px minmax(0, 1fr);
}
.home-view.library-mode .library-row.is-routine .lr-label span {
  white-space: normal;
  overflow-wrap: anywhere;
}
.home-view.library-mode .library-row.is-routine .lr-actions {
  grid-column: 2 / -1;
  justify-content: flex-start;
  min-width: 0;
  max-width: none;
  gap: 5px;
  opacity: 1;
  pointer-events: auto;
}
.home-view.library-mode .library-row.is-routine .lr-btn {
  max-width: none;
  height: 32px;
  padding: 0 9px;
}
.home-view.library-mode .lr-btn.danger:hover {
  background: rgba(239, 91, 91, 0.14);
  border-color: rgba(239, 91, 91, 0.4);
  color: var(--bad);
}

/* compact mini-button used in column heads */
.home-view.library-mode .mini-button {
  min-height: 30px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-2);
  transition: background 120ms, border-color 120ms;
}
.home-view.library-mode .mini-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-2);
  color: var(--text);
}

/* text prompt dialog */
#textPromptDialog .dialog-body { gap: 14px; }
#textPromptDialog header h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  text-transform: none;
}
#textPromptDialog label {
  display: grid;
  gap: 6px;
}
#textPromptDialog input {
  font-size: 14px;
}

/* ── preflop drill dialog: folder-aware multi-select ── */
.preflop-drill-dialog { width: min(720px, calc(100vw - 40px)); }
.preflop-drill-dialog .panel-title.inline-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.preflop-drill-dialog .drill-source-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
}
.preflop-drill-dialog .drill-source-search {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 12px;
  width: 200px;
}
.drill-source-tree {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--inset);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drill-source-tree-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.drill-source-folder {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
  padding: 4px 4px 4px calc(4px + var(--depth, 0) * 16px);
}
.drill-source-folder .dsf-head {
  display: grid;
  grid-template-columns: 14px 18px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(245, 164, 75, 0.05);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  transition: background 120ms, border-color 120ms;
}
.drill-source-folder .dsf-head:hover {
  background: rgba(245, 164, 75, 0.10);
  border-color: rgba(245, 164, 75, 0.32);
}
.drill-source-folder .dsf-chev {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  font-size: 9px;
  color: var(--muted);
  transition: transform 120ms;
}
.drill-source-folder .dsf-chev::after { content: "\25B8"; }
.drill-source-folder.expanded .dsf-chev { transform: rotate(90deg); }
.drill-source-folder .dsf-icon { color: var(--orange); font-size: 13px; }
.drill-source-folder .dsf-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drill-source-folder .dsf-count {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}
.drill-source-folder .dsf-count.is-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent-line);
}
.drill-source-folder .dsf-select-all {
  min-height: 26px;
  padding: 0 10px;
  font-size: 11px;
}
.drill-source-leaf {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px 10px 6px calc(28px + var(--depth, 0) * 16px);
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12.5px;
  transition: background 120ms, border-color 120ms;
}
.drill-source-leaf:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}
.drill-source-leaf input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent);
}
.drill-source-leaf .dsl-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.drill-source-leaf .dsl-info strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drill-source-leaf .dsl-info > span {
  font-size: 11px;
  color: var(--muted);
}
.drill-source-leaf .dsl-info .dsl-spot-chips {
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.drill-source-leaf:has(input:checked) {
  background: var(--accent-softer);
  border-color: var(--accent-line);
}

/* trainer topbar: make H2 stand out so the current range is obvious */
.topbar h2#handTitle {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ── PREFLOP DRILL HEADER: bold "Now drilling" treatment ──
   When the trainer is on a preflop hand, the topbar gets a green tint
   and the H2 becomes large + accent-colored so it's impossible to miss
   which range is currently being drilled. */
.topbar.preflop-active {
  background:
    linear-gradient(180deg, var(--accent-softer), transparent 60%),
    linear-gradient(180deg, #131618 0%, rgba(19, 22, 24, 0.4) 100%);
  border-bottom: 1px solid var(--accent-line);
  box-shadow: inset 0 -2px 0 var(--accent-glow);
}
.topbar.preflop-active h2#handTitle {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #f8f5ee;
  text-shadow: 0 0 24px var(--accent-glow);
  line-height: 1.15;
}
.topbar.preflop-active p#spotLine {
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 10px;
  margin-bottom: 2px;
}

/* ── range builder: PIO chart import row ── */
.range-import-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line-2);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
}
.range-import-row .muted {
  font-size: 12px;
  line-height: 1.4;
  flex: 1 1 220px;
  min-width: 0;
}
.import-status {
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 600;
}
.import-status.good {
  color: var(--accent);
}
.import-status.bad {
  color: var(--bad);
}

/* Folder-level Pio chart importer: a compact queue on the left and one quick
   metadata confirmation card on the right. */
.batch-range-import-dialog {
  width: min(940px, calc(100vw - 40px));
  max-width: 940px;
}
.batch-range-import-dialog .dialog-body {
  max-height: min(780px, calc(100vh - 40px));
}
.batch-import-layout {
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(0, 1.6fr);
  gap: 14px;
  min-height: 410px;
  overflow: hidden;
}
.batch-import-queue {
  display: grid;
  align-content: start;
  gap: 3px;
  min-width: 0;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
}
.batch-import-queue-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
}
.batch-import-queue-item:hover { background: rgba(255, 255, 255, 0.04); }
.batch-import-queue-item.active {
  border-color: var(--accent-line);
  background: var(--accent-softer);
  color: var(--text);
}
.batch-import-queue-item.confirmed .batch-import-queue-status { color: var(--good); }
.batch-import-queue-item.skipped { opacity: 0.48; }
.batch-import-queue-item > span:last-child { min-width: 0; }
.batch-import-queue-item strong,
.batch-import-queue-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.batch-import-queue-item strong { font-size: 12px; }
.batch-import-queue-item small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.batch-import-queue-status {
  font-size: 15px;
  font-weight: 900;
  text-align: center;
  color: var(--accent);
}
.batch-import-review {
  display: grid;
  align-content: start;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.022);
}
.batch-import-file-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}
.batch-import-file-head h3 {
  margin: 3px 0 0;
  font-size: 18px;
  overflow-wrap: anywhere;
}
.batch-import-counts {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 99px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}
.batch-import-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.batch-import-form label { display: grid; gap: 5px; color: var(--text-2); font-size: 12px; }
.batch-import-form .batch-import-name { grid-column: 1 / -1; }
.batch-import-preview {
  display: grid;
  gap: 8px;
  padding-top: 3px;
}
.batch-import-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.batch-import-actions span {
  padding: 5px 9px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 700;
}
.batch-range-import-dialog footer { display: flex; align-items: center; gap: 8px; }
.batch-import-footer-spacer { flex: 1; }

@media (max-width: 760px) {
  .batch-import-layout { grid-template-columns: 1fr; }
  .batch-import-queue { max-height: 160px; }
  .batch-import-form { grid-template-columns: 1fr; }
  .batch-import-form .batch-import-name { grid-column: auto; }
}

/* ── range builder: paint-weight slider above the matrix ── */
.paint-weight-bar {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) 78px auto;
  gap: 12px;
  align-items: center;
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
}
.paint-weight-bar .pw-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}
.paint-weight-bar .pw-slider {
  width: 100%;
  accent-color: var(--accent);
}
.paint-weight-bar .pw-input {
  height: 32px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.paint-weight-bar .pw-pct {
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  min-width: 44px;
  text-align: right;
}
.paint-weight-hint {
  margin: 4px 4px 12px;
  font-size: 11.5px;
  line-height: 1.45;
}

/* ── range builder: per-option color swatch + inline palette picker ── */
.range-option-swatch {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  transition: transform 100ms, box-shadow 100ms;
}
.range-option-swatch:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.range-color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  margin: 8px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--inset);
}
.range-color-chip {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.4);
  transition: transform 100ms, border-color 100ms;
}
.range-color-chip:hover {
  transform: scale(1.1);
  border-color: rgba(255, 255, 255, 0.5);
}
.range-color-chip.selected {
  border-color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 0 2px var(--accent);
}

.seat.to-act strong {
  box-shadow: 0 0 0 2px #22c55e, 0 0 14px rgba(34, 197, 94, 0.45);
}
.seat.last-aggressor strong {
  box-shadow: 0 0 0 2px #f59e0b, 0 0 14px rgba(245, 158, 11, 0.4);
}
.batch-import-prior-hint {
  margin: 8px 0 0;
  font-size: 12px;
}

/* hide the Packs panel in the sidebar while training — focus on the table */
.app-shell.trainer-mode #packsPanel {
  display: none;
}

/* ── time bank countdown bar above the action buttons ── */
.time-bank-bar {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, #15181b, #101314);
}
.time-bank-bar.hidden { display: none !important; }
.time-bank-bar .tb-label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.time-bank-bar .tb-value {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 44px;
}
.time-bank-bar .tb-track {
  height: 6px;
  border-radius: 999px;
  background: #1a1f23;
  border: 1px solid var(--line);
  overflow: hidden;
}
.time-bank-bar .tb-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 200ms linear, background 200ms;
  box-shadow: 0 0 12px var(--accent-glow);
}
.time-bank-bar.warn .tb-fill { background: linear-gradient(90deg, var(--orange), #f5c987); box-shadow: 0 0 12px rgba(245, 164, 75, 0.4); }
.time-bank-bar.danger .tb-fill { background: linear-gradient(90deg, var(--bad), #ff8c84); box-shadow: 0 0 12px rgba(239, 91, 91, 0.5); }
.time-bank-bar.warn .tb-value { color: var(--orange); }
.time-bank-bar.danger .tb-value { color: var(--bad); }
.time-bank-bar.expired .tb-value { color: var(--bad); text-shadow: 0 0 16px rgba(239, 91, 91, 0.6); }

/* folder picker */
#folderPickerDialog .dialog-body { gap: 14px; }
#folderPickerDialog header h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  text-transform: none;
}
.folder-picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--inset);
}
.folder-picker-option {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.folder-picker-option:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line-2);
}
.folder-picker-option.current {
  border-color: var(--accent-line);
  background: var(--accent-softer);
}
.folder-picker-option .fp-icon {
  font-size: 14px;
  color: var(--orange);
}
.folder-picker-option.is-root .fp-icon { color: var(--muted); }
.folder-picker-option strong {
  display: block;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-picker-option span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.folder-picker-option .fp-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── responsive library board (kept last so it wins the cascade) ── */
@media (max-width: 1360px) {
  .home-view.library-mode #drillTable.library-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-height: 0;
    overflow: visible;
  }
  .home-view.library-mode .library-column { min-height: 0; }
  .home-view.library-mode .library-tree { max-height: 380px; }
}
@media (max-width: 720px) {
  .home-view.library-mode #drillTable.library-board {
    grid-template-columns: minmax(0, 1fr);
  }
  .home-view.library-mode .library-tree { max-height: 320px; }
}
/* One-way publication of desktop content; browser progress remains separate. */
.library-publish { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.library-publish.hidden { display: none; }
.publish-library-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 40px; }
.publish-library-button svg { flex: 0 0 auto; }
.publish-library-button .publish-check { display: none; }
.publish-library-button[data-state="synced"] { color: var(--green); border-color: var(--green); }
.publish-library-button[data-state="synced"] .publish-check { display: block; }
.publish-library-button[data-state="synced"] .publish-arrow { display: none; }
.publish-library-button[data-state="publishing"] svg { animation: publish-pulse 1s ease-in-out infinite alternate; }
.publish-library-status { max-width: 440px; font-size: 12px; line-height: 1.5; }
.publish-library-status[data-error="true"] { color: var(--red); }
@keyframes publish-pulse { to { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .publish-library-button[data-state="publishing"] svg { animation: none; } }
