/* app/assets/stylesheets/components/schedule.css */

.schedule-container {}
.schedule-container .column-hidden { display: none; }

/* -- Filters --
   Canonical filter-bar look (style guide#filter-bar): tinted surface with
   hairline border, label + control pairs, optional right-aligned action
   group. .schedule-filters is shared across schedule/games/standings. */

.schedule-filters {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: var(--text-sm);

  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.schedule-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.schedule-filter__label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-3);
  letter-spacing: 0.12em;
}

.schedule-filter__select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font: inherit;
  color: var(--ink);
  width: 100%;
  min-width: 100px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.schedule-filter__select:hover {
  border-color: var(--ink-3);
}
.schedule-filter__select:focus {
  outline: 0;
  border-color: var(--accent-dark);
  box-shadow: var(--focus-ring);
}

/* -- Period navigation arrows -- */
.period-nav {
  display: flex;
  align-items: stretch;
}
.period-nav__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 10px;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.period-nav__arrow:first-child {
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  border-right: none;
}
.period-nav__arrow:last-child {
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  border-left: none;
}
.period-nav__arrow:hover:not(:disabled) {
  background: var(--accent-subtle);
  color: var(--accent);
}
.period-nav__arrow:disabled {
  opacity: 0.4;
  cursor: default;
}
.period-nav__select {
  border-radius: 0;
  min-width: 110px;
}

/* -- Filter Action Buttons --
   Match the canonical .btn / .btn--primary / .btn--secondary look so
   filter-bar buttons sit consistently with action buttons elsewhere. */

.schedule-actions__bulk-add,
.schedule-actions__rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.4rem;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s;
}
.schedule-actions__bulk-add:hover,
.schedule-actions__rank:hover {
  background: var(--accent-dark);
}

.schedule-actions__clear,
.schedule-actions__rank-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.schedule-actions__clear:hover,
.schedule-actions__rank-cancel:hover {
  background: var(--bg-2);
  border-color: var(--ink-3);
}

.schedule-filters--actions {
  border-top: none;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin-top: 0;
}

.schedule-filters + .schedule-filters--actions {
  border-bottom-left-radius: var(--r-md);
  border-bottom-right-radius: var(--r-md);
}

.schedule-filters:not(.schedule-filters--actions) + .schedule-filters--actions {
  /* adjacent sibling: collapse gap between rows */
}
.schedule-filters:has(+ .schedule-filters--actions) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line-2);
}

.schedule-filter-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
  align-items: flex-end;
}

/* -- Column picker dropdown -- */
.column-picker {
  position: relative;
}
.column-picker__summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  list-style: none;
}
.column-picker__summary::-webkit-details-marker { display: none; }
.column-picker__summary::after {
  content: "▾";
  font-size: 10px;
  color: var(--ink-3);
}
.column-picker__count {
  font-weight: 400;
  color: var(--ink-3);
}
.column-picker__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  min-width: 180px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  padding: 6px 0;
}
.column-picker__section {
  padding: 4px 8px;
}
.column-picker__group-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 4px 2px;
}
.column-picker__item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  font-size: var(--text-sm);
  color: var(--ink);
  cursor: pointer;
  border-radius: var(--r-xs);
}
.column-picker__item:hover {
  background: var(--bg-2);
}
.column-picker__item--locked {
  color: var(--ink-3);
  cursor: default;
}
.column-picker__divider {
  border-top: 1px solid var(--line-2);
  margin: 4px 0;
}
.column-picker__footer {
  padding: 6px 12px;
  border-top: 1px solid var(--line-2);
  text-align: center;
}
.column-picker__reset {
  font-size: var(--text-xs);
  color: var(--accent);
}

/* -- Multi-select dropdown (location filter) -- */

.multi-select {
  position: relative;
}

.multi-select__trigger {
  text-align: left;
  cursor: pointer;
}

.multi-select__trigger--disabled {
  color: var(--ink-4);
  cursor: default;
}

.multi-select__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  min-width: 200px;
  width: max-content;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  padding: 0.25rem 0;
}

.multi-select__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}

.multi-select__option:hover {
  background: var(--bg-2);
}

.multi-select__option input[type="checkbox"] {
  accent-color: var(--accent);
  margin: 0;
  flex-shrink: 0;
}

/* --  Table --  */

.schedule-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  margin: 0;
}

.schedule-table-wrap { overflow-x: auto; overflow-y: visible; }

/* Canonical card-table header look (style guide). */
.schedule-table thead th {
  padding: 6px 10px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.schedule-table thead th[data-tooltip] { cursor: default; }

/* Right-align tooltips near the table's right edge so they don't get clipped
   by the scroll container. */
.schedule-table th:nth-last-child(-n+4)[data-tooltip]:hover::after,
.schedule-table th:nth-last-child(-n+4)[data-tooltip]:focus-visible::after,
.schedule-table td:nth-last-child(-n+4) [data-tooltip]:hover::after,
.schedule-table td:nth-last-child(-n+4) [data-tooltip]:focus-visible::after,
.schedule-table td:nth-last-child(-n+4)[data-tooltip]:hover::after,
.schedule-table td:nth-last-child(-n+4)[data-tooltip]:focus-visible::after {
  left: auto;
  right: 0;
  transform: none;
}

.schedule-table tbody td {
  border-top: 1px solid var(--line-2);
  padding: 6px 10px;
}
.schedule-table tbody tr:first-child td { border-top: 0; }
.schedule-table tbody tr:last-child td  { padding-bottom: 10px; }

.schedule-table tbody td { white-space: nowrap; }
.schedule-table .match-cell--save { width: 3rem; }
.schedule-table .match-cell--team { width: 50%; }

/* Sticky edge columns */
.schedule-table .match-cell--actions-header {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface-2);
  border-left: 1px solid var(--border);
  padding: 6px 6px;
}
.schedule-table .match-cell--actions {
  position: sticky;
  right: 0;
  z-index: 2;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 6px 6px;
}
.schedule-table .match-cell--actions:has(.action-menu.is-open) {
  z-index: 10;
}
.schedule-table tbody tr:hover .match-cell--actions {
  background: var(--bg-2);
}

.schedule-table .elo-section-start { border-left: 1px solid var(--line); }
.schedule-table .elo-section-end   { border-right: 1px solid var(--line); }

.schedule-table th.center,
.schedule-table td.center { text-align: center; }
.schedule-table .elo-pos { color: var(--success); font-weight: 600; }
.schedule-table .elo-neg { color: var(--danger); font-weight: 600; }

.schedule-table__stacked-header {
  line-height: 1.3;
}
.schedule-table__header-group {
  display: block;
}

.schedule-table tbody tr:hover {
  background: var(--bg-2);
}
.schedule-row {
  height: auto;
  min-height: 2rem;
}

.schedule-row--finalized {
  background-color: var(--bg-2);
}

/* Empty-state row shown when no matches match the current filters. */
.schedule-table__empty-row:hover { background: transparent; }
.schedule-table__empty {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--ink-3);
  font-style: italic;
  font-size: 0.95rem;
}
/* -- GROUP BY group sections -- */

.schedule-group {
  margin-bottom: 1.5rem;
}

.schedule-group__header {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0 0.25rem 0.5rem;
}

/* Block-position badge on pool groups — same accent treatment as the
   scheduler's BLOCK n label. HQ-only; player surfaces never show numbers. */
.schedule-group__block-badge {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-light);
  color: var(--accent);
  white-space: nowrap;
}

.schedule-group__label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.schedule-group__count {
  font-size: var(--text-xs);
  color: var(--ink-3);
  font-weight: 600;
}

.schedule-group .card {
  overflow-x: auto;
  overflow-y: hidden;
}

.schedule-notice-banner {
  padding: 6px 12px;
  margin: 0 0 8px;
  background: var(--info-soft);
  border-left: 3px solid var(--info);
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  color: var(--ink-2);
  line-height: 1.4;
}
.schedule-game-note-icon {
  position: relative;
  color: #EAB308;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.schedule-game-note-icon svg {
  width: 16px;
  height: 16px;
}
.schedule-game-note-popover {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  min-width: 200px;
  max-width: 320px;
  padding: 8px 10px;
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: var(--r-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  font-size: var(--text-sm);
  color: #fff;
  white-space: normal;
  line-height: 1.4;
}
.schedule-game-note-popover.is-open {
  display: block;
}

.schedule-group .schedule-table tbody td {
  background: var(--surface);
}
.schedule-group .schedule-table tbody tr:hover td {
  background: var(--bg-2);
}

/* -- Elo chip in team cells -- */

.elo-chip {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--bg-2);
  color: var(--ink-3);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  margin-left: 4px;
  vertical-align: baseline;
}

.schedule-division-pill {
  display: inline-block;
  padding: 1px 7px;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--r-pill);
  background: var(--bg-2);
  color: var(--ink-2);
  white-space: nowrap;
}

/* -- Match Cells / Edit -- */

.match-cell {
  position: relative;
  height: 100%;
  padding: 0;
  vertical-align: middle;
  overflow: hidden;
}
.match-cell__display{
  display: block;
  cursor: pointer;
  text-decoration: none;
  border-radius: 4px;
  padding: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.match-cell__display:hover{
  background-color: var(--ink-4);
}

.match-cell__display--readonly {
  cursor: default;
}
.match-cell__display--readonly:hover {
  background-color: transparent;
}

.match-cell__input {
  width: 4rem;
  padding: 0 0.5rem;
  border: 1px solid var(--bg-2);
  border-radius: 8px;
}

.match-cell--actions {
  width: 4rem;
  white-space: nowrap;
  overflow: visible;
}

.match-cell__checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1.1rem;
  height: 1.1rem;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
  background: var(--surface);
  vertical-align: middle;
  margin-right: 0.35rem;
  position: relative;
}

.match-cell__checkbox:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

.match-cell__checkbox:checked::after {
  content: "✓";
  position: absolute;
  inset: 0;
  color: var(--white);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
}

.game-cell__locked-score {
  display: inline-block;
  width: 100%;
  text-align: center;
  padding: 0.25rem 0;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* -- Bulk actions dropdown (in last column header) -- */

.schedule-table thead th.match-cell--actions-header {
  position: sticky;
  right: 0;
  z-index: 2;
  padding: 0 0.5rem;
  overflow: visible;
  white-space: nowrap;
}

.bulk-actions__select-all {
  margin-right: 0.35rem;
}

.bulk-actions__select-all:indeterminate {
  background-color: var(--accent);
  border-color: var(--accent);
}

.bulk-actions__select-all:indeterminate::after {
  content: "–";
  position: absolute;
  inset: 0;
  color: var(--white);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1rem;
  text-align: center;
}

.bulk-actions {
  position: relative;
  display: inline-block;
}

.bulk-actions__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  background: var(--accent);
  color: var(--white);
  border: none;
  border-radius: 50%;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.bulk-actions__toggle:hover {
  filter: brightness(95%);
}

.bulk-actions__menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--ink-4);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 160px;
  z-index: 50;
}

.bulk-actions__menu button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  cursor: pointer;
  color: var(--danger);
}

.bulk-actions__menu button:hover {
  background-color: var(--bg-2);
}

/* -- Sortable headers -- */

.schedule-table__sort {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.schedule-table__sort:hover {
  color: var(--accent);
}

.schedule-table__sort.is-active {
  font-weight: 700;
}

/* -- Pagination -- */

.schedule-footer {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0;
}

/* ==============================================
   BULK SCHEDULE PAGE
   ============================================== */

/* Modal overlay — shown when the turbo frame has content */
turbo-frame#modal:not(:empty) {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: block;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
}

/* Bulk schedule modal panel */
.bulk-schedule {
  display: flex;
  flex-direction: column;
  width: min(1200px, 96vw);
  height: min(88vh, 860px);
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
}

.bulk-schedule__header {
  flex-shrink: 0;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--ink-4);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.bulk-schedule__title {
  font-size: 1.5rem;
  font-weight: 700;
}

.bulk-schedule__division-filter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bulk-schedule__content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.bulk-schedule__footer {
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--ink-4);
  background: var(--surface);
}

/* -- Sections -- */

.bulk-section {
  border: 1px solid var(--ink-4);
  border-radius: 10px;
  overflow: visible;
}

.bulk-section__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  border-radius: 10px;
}

.bulk-section__toggle:hover { background: var(--bg-2); }

.bulk-section__header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.bulk-section__heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.bulk-section__number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--ink);
  color: var(--white);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.bulk-section__label {
  font-weight: 700;
  font-size: 1rem;
}

.bulk-section__chevron {
  font-size: 0.75rem;
  color: var(--ink-3);
}

.bulk-section__body {
  padding: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bulk-section__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--bg-2);
}

/* -- Form rows -- */

.bulk-form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: flex-start;
}

.bulk-form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 140px;
}

.bulk-form-group--wide { flex: 1; min-width: 220px; }
.bulk-form-group--relative { position: relative; }
.bulk-form-group--date { flex: 1.4; min-width: 11rem; }

.bulk-form-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08rem;
  color: var(--ink-3);
}

.bulk-form-select,
.bulk-form-input {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.35rem 0.5rem;
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
}

.bulk-form-select:hover,
.bulk-form-input:hover {
  border-color: var(--ink-3);
}
.bulk-form-select:focus,
.bulk-form-input:focus {
  outline: 0;
  border-color: var(--accent-dark);
  box-shadow: var(--focus-ring);
}

.bulk-add-link {
  font-size: 0.75rem;
  color: var(--ink-3);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  text-decoration: underline;
}
.bulk-add-link:hover { color: var(--ink); }

.bulk-inline-add {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.bulk-inline-add__input { flex: 1; }

/* -- Time slot tag input -- */

.bulk-tag-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.35rem 0.5rem;
  min-height: 2.25rem;
  cursor: text;
  transition: border-color 0.15s;
}

.bulk-tag-input--locations { cursor: pointer; }
.bulk-tag-input--locations:hover { border-color: var(--ink-3); }

.bulk-tag-placeholder {
  color: var(--ink-4);
  font-size: 0.9rem;
}

.bulk-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-2);
  border: 1px solid var(--ink-4);
  border-radius: 99px;
  padding: 0 0.5rem 0 0.65rem;
  height: 1.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.bulk-chip__remove {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  color: var(--ink-3);
  font-size: 1rem;
}
.bulk-chip__remove:hover { color: var(--red); }

.bulk-time-input {
  border: none;
  outline: none;
  font-size: 0.85rem;
  min-width: 90px;
  background: transparent;
}

.bulk-tag-add {
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 50%;
  width: 1.4rem;
  height: 1.4rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bulk-tag-add:hover { filter: brightness(90%); }

/* -- Location dropdown -- */

.bulk-location-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 20;
  min-width: 340px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--ink-4);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.bulk-dropdown-empty {
  padding: 0.75rem;
  color: var(--ink-3);
  font-size: 0.85rem;
}

/* -- Custom dropdowns (period, facility) -- */

.bulk-dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.35rem 0.5rem;
  font: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.bulk-dropdown-trigger:hover {
  border-color: var(--ink-3);
}
.bulk-dropdown-trigger:focus {
  outline: 0;
  border-color: var(--accent-dark);
  box-shadow: var(--focus-ring);
}
.bulk-dropdown-trigger--selected {
  border-color: var(--accent);
  font-weight: 600;
}
.bulk-dropdown-trigger--template {
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
  white-space: nowrap;
}
.bulk-dropdown-trigger__arrow {
  font-size: 0.6rem;
  color: var(--ink-3);
  flex-shrink: 0;
}

.bulk-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  min-width: 220px;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* -- Template dropdown -- */

.bulk-template-dropdown-wrap {
  position: relative;
}

.bulk-template-menu {
  right: 0;
  left: auto;
  min-width: 280px;
}

.bulk-template-save-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--bg-2);
}

/* -- Form grid (2-column) -- */

.bulk-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .bulk-form-grid { grid-template-columns: 1fr; }
}

.bulk-form-half {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bulk-form-pair {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.bulk-form-bottom-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  border-top: 1px solid var(--bg-2);
}

.bulk-form-bottom-row .bulk-section__actions {
  flex: 1;
  align-self: flex-end;
}

.bulk-form-bottom-row .btn {
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  border-radius: 99px;
}

/* -- Time adder -- */

.bulk-chip--new {
  background: none;
  border: 1px dashed var(--line);
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--ink-3);
  /* Match chip height exactly */
  height: 1.6rem;
  line-height: 1;
  padding: 0 0.5rem;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.bulk-chip--new:hover { border-color: var(--ink); color: var(--ink); }

.bulk-time-adder {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px dashed var(--line);
  border-radius: 99px;
  padding: 0 0.4rem 0 0.5rem;
  /* Same height as chips */
  height: 1.6rem;
  flex-shrink: 0;
}

/* Smaller confirm checkmark */
.bulk-time-confirm.tg-btn--icon {
  width: 1.1rem;
  height: 1.1rem;
  font-size: 0.6rem;
  flex-shrink: 0;
}

/* -- Duration spinner -- */

.bulk-duration-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--ink-4);
  border-radius: 8px;
  overflow: hidden;
  max-width: 9rem;
}

.bulk-duration-wrap .bulk-duration-input {
  border: none;
  border-radius: 0;
  /* flex-basis: 0 + grow lets the input fill leftover space while
     keeping the spin buttons pinned to the right edge */
  flex: 1 1 0;
  width: 0;
  min-width: 0;
}

.bulk-duration-wrap .bulk-duration-input:hover,
.bulk-duration-wrap .bulk-duration-input:focus {
  box-shadow: none;
  outline: none;
}

.bulk-duration-wrap:hover,
.bulk-duration-wrap:focus-within {
  border-color: var(--line);
  box-shadow: var(--focus-ring);
}

.bulk-duration-btns {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--ink-4);
}

.bulk-duration-btn {
  background: var(--surface);
  border: none;
  cursor: pointer;
  flex: 1;
  padding: 0 0.4rem;
  font-size: 0.45rem;
  line-height: 1;
  color: var(--ink-3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.bulk-duration-btn:hover { background: var(--bg-2); color: var(--ink); }
.bulk-duration-btn:first-child { border-bottom: 1px solid var(--ink-4); }

/* -- Duration input (standalone, keep old class working) -- */

.bulk-duration-input {
  max-width: 6rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.9rem;
  background: var(--surface);
}

/* -- Period add button -- */

.bulk-period-add-row {
  border-bottom: 1px solid var(--bg-2);
  margin-bottom: 0.25rem;
  padding-bottom: 0.25rem;
}

.bulk-period-add-btn {
  color: var(--accent-dark) !important;
  font-weight: 600 !important;
}

/* -- Template bar -- */

.bulk-template-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.bulk-match-count {
  font-size: 0.85rem;
  color: var(--ink-3);
  margin-top: 0.15rem;
}

/* -- Generated matches table -- */

.bulk-table-wrap {
  overflow-x: auto;
  padding: 0 1rem;
}

.bulk-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

/* Canonical card-table header look (style guide) — applied here because the
   bulk modal IS the card surface (no separate .card wrapper). */
.bulk-table thead th {
  text-align: left;
  padding: 10px 12px;
  background: var(--surface-2);
  font-size: 0.77rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.bulk-table tbody td {
  border-top: 1px solid var(--line-2);
}
.bulk-table tbody tr:first-child td { border-top: 0; }
.bulk-table tbody tr:hover { background: var(--surface-2); }

.bulk-cell {
  padding: 0.45rem 0.75rem;
  vertical-align: middle;
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
}
.bulk-cell:hover { background: var(--bg-2); }

/* Native <input type="date"> needs more horizontal room than the formatted
   "Apr 30" display text, so reserve column width on the date column. */
.bulk-table th[data-sort-field="scheduled_date"],
.bulk-cell[data-field="scheduled_date"] { min-width: 9rem; }

.bulk-table-empty {
  text-align: center;
  padding: 2rem;
  color: var(--ink-3);
  font-size: 0.9rem;
}

/* -- Cell inline edit -- */

.bulk-cell-input {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.2rem 0.4rem;
  font-size: 0.875rem;
  background: var(--surface);
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.bulk-cell-input:focus { outline: none; border-color: var(--accent); }

/* Apply to all — styled like a small pill button (similar to Clear) */
.bulk-apply-all {
  background: var(--ink-4);
  border: none;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  padding: 0.15rem 0.5rem;
}
.bulk-apply-all:hover { filter: brightness(93%); }

/* -- Pagination -- */

.bulk-pagination {
  display: flex;
  justify-content: center;
  border-top: 1px solid var(--bg-2);
}

/* -- Sort indicators -- */

.bulk-th--sortable {
  cursor: pointer;
  user-select: none;
}
.bulk-th--sortable:hover { color: var(--ink); }

.bulk-th--asc::after  { content: " ↑"; font-size: 0.65rem; }
.bulk-th--desc::after { content: " ↓"; font-size: 0.65rem; }

/* -- Delete column -- */

.bulk-th--delete {
  width: 2rem;
}

.bulk-cell-delete {
  padding: 0.1rem 0.25rem;
  text-align: center;
  vertical-align: middle;
}

.bulk-row-delete {
  background: none;
  border: none;
  color: var(--ink-4);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.1rem 0.25rem;
  border-radius: 4px;
  transition: color 0.1s;
}
.bulk-row-delete:hover { color: var(--danger); }

/* -- Editing cell — absolute overlay so cell size never changes -- */

.bulk-cell--editing {
  /* Keep padding so row height matches non-editing cells */
  padding: 0.45rem 0.75rem;
  vertical-align: middle;
  position: relative;
}

.bulk-cell-edit-wrap {
  /* Fill the exact cell area without affecting layout */
  position: absolute;
  inset: 0;
  padding: 0.2rem 0.4rem;
  display: flex;
  align-items: center;
  background: var(--surface);
  z-index: 5;
  border-radius: 6px;
  box-shadow: 0 0 0 2px var(--accent);
}

/* -- Floating apply-all popup -- */

.bulk-apply-all-popup {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  z-index: 20;
  white-space: nowrap;
  pointer-events: auto;
}

/* ── Action bar (bulk selection) ── */
.bulk-action-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--gray-900);
  color: white;
  border-radius: var(--r-md);
  margin-bottom: 0.6rem;
  font-size: 0.857rem;
}
.bulk-action-bar[hidden] { display: none; }
.bulk-action-bar__count { font-weight: 700; }
.bulk-action-bar__count b { color: var(--cyan-400, #22D3EE); }
.bulk-action-bar__spacer { margin-left: auto; }
.bulk-action-bar__btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; font-size: 0.786rem; font-weight: 600;
  border-radius: var(--r-sm); border: none; cursor: pointer;
  white-space: nowrap;
}
.bulk-action-bar__btn--primary { background: var(--cyan-500, #06B6D4); color: white; }
.bulk-action-bar__btn--primary:hover { opacity: 0.9; }
.bulk-action-bar__btn--secondary {
  background: rgba(255,255,255,0.12); color: white;
  border: 1px solid rgba(255,255,255,0.2);
}
.bulk-action-bar__btn--secondary:hover { background: rgba(255,255,255,0.2); }
.bulk-action-bar__btn--danger {
  background: var(--danger, #EF4444); color: white;
}
.bulk-action-bar__btn--danger:hover { background: var(--danger-hover, #DC2626); }
.bulk-action-bar__dismiss {
  background: transparent; color: var(--gray-400); border: none;
  font-size: 0.857rem; padding: 4px 8px; cursor: pointer;
}
.bulk-action-bar__dismiss:hover { color: white; }

/* ── Referee picker modal ── */
.referee-picker { width: min(620px, 96vw); }
.referee-picker__targets {
  padding: 0.5rem 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.786rem;
  color: var(--ink-3);
}
.referee-picker__facility { margin-bottom: 0.5rem; }
.referee-picker__facility:last-child { margin-bottom: 0; }
.referee-picker__facility-name { font-weight: 600; color: var(--ink-2); }
.referee-picker__chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.referee-picker__chip {
  display: inline-block; padding: 2px 8px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); white-space: nowrap; font-weight: 600;
}
.referee-picker__row {
  cursor: pointer; display: flex; flex-direction: column;
  gap: 2px; padding: 0.5rem; border-radius: var(--r-sm);
  border: 1px solid transparent; transition: background 0.1s;
}
.referee-picker__row:hover { background: var(--bg-2); }
.referee-picker__row--selected {
  background: var(--accent-subtle); border-color: var(--accent);
}
.referee-picker__row--overlap { background: var(--warning-soft); }
.referee-picker__row--overlap:hover { background: var(--warning-soft); }
.referee-picker__row--overlap.referee-picker__row--selected {
  background: var(--warning-soft); border-color: var(--warning);
}
.referee-picker__team-name { font-weight: 600; }
.referee-picker__detail {
  font-size: 0.786rem; color: var(--ink-3); padding-left: 24px;
}
.referee-picker__detail--warn { color: var(--warning-dark, #D97706); }
.referee-picker__footer {
  padding: 0.6rem 1rem;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 0.5rem;
}

/* ── Edit Game modal ── */

.edit-game-matchup {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1rem 1.25rem;
  background: var(--bg);
}

.edit-game-matchup__teams {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
}

.edit-game-matchup__vs {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  padding-bottom: 0.45rem;
  flex-shrink: 0;
}

.edit-game-matchup__referee {
  margin-top: 1rem;
  max-width: 60%;
  margin-left: auto;
  margin-right: auto;
}

.edit-game-section-title {
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin: 0 0 0.25rem;
}

.edit-game-period-chip {
  display: inline-block;
  font-size: var(--text-xs);
  color: var(--ink-3);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 0.2rem 0.6rem;
  margin-top: 0.25rem;
}

.edit-game-period-chip:empty {
  display: none;
}