/* ===== 時間軸專用樣式 ===== */

/* ===== Layout ===== */
.scheduler-layout {
  display: flex;
  height: calc(100vh - 52px);
  overflow: hidden;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: visible;
  flex-shrink: 0;
}
.sidebar-section {
  padding: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.sidebar-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

/* Coach list */
.coach-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background .1s;
}
/* Activity filter tags */
.filter-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 8px;
  position: relative;
}
.filter-btn {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--gray-200);
  background: #fff;
  color: var(--gray-500);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.filter-btn:hover { border-color: var(--gray-300); }
.filter-btn.has-filter {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}
.filter-btn .filter-count {
  background: var(--primary);
  color: #fff;
  font-size: 0.6rem;
  padding: 0 5px;
  border-radius: 8px;
  line-height: 1.4;
}
.filter-dropdown {
  position: fixed;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  z-index: 200;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  width: 320px;
}
.filter-tag {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--gray-200);
  background: #fff;
  color: var(--gray-500);
  transition: all .12s;
  white-space: nowrap;
  user-select: none;
}
.filter-tag:hover { border-color: var(--gray-300); background: var(--gray-50); }
.filter-tag.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

/* Drag handle */
.drag-handle {
  cursor: grab;
  color: var(--gray-300);
  font-size: 0.85rem;
  padding: 0 2px;
  user-select: none;
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: -1px;
}
.drag-handle:hover { color: var(--gray-500); }
.drag-handle:active { cursor: grabbing; }

/* Dragging states */
.coach-item.dragging,
.category-header.dragging,
.activity-chip.dragging {
  opacity: .4;
}
.coach-item.drag-over {
  border-top: 2px solid var(--primary);
}
.category-header.drag-over {
  border-top: 2px solid var(--primary);
}

.coach-item:hover { background: var(--gray-50); }
.coach-item.active {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  padding-left: 5px;
}
.coach-item input { flex-shrink: 0; }
.coach-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}
.coach-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coach-type-badge {
  font-size: 0.6rem;
  color: #fff;
  padding: 1px 5px;
  border-radius: 4px;
  font-weight: 600;
  flex-shrink: 0;
}

/* Activity chips (draggable) */
.activity-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  background: #fff;
  border: 1.5px solid var(--gray-200);
  cursor: grab;
  transition: all .15s;
  margin-bottom: 4px;
  user-select: none;
}
.activity-chip:hover {
  border-color: var(--gray-300);
  box-shadow: 0 2px 4px rgba(0,0,0,.06);
}
.activity-chip.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(14,165,233,.15);
}
.activity-chip:active { cursor: grabbing; }
.chip-color {
  width: 4px;
  height: 20px;
  border-radius: 2px;
  flex-shrink: 0;
}
.chip-icon { font-size: 1rem; }
.chip-name { flex: 1; font-weight: 500; }
.chip-duration {
  font-size: 0.7rem;
  color: var(--gray-400);
  white-space: nowrap;
}

/* Subcategory expand */
.category-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 6px;
  margin-bottom: 2px;
}
.category-header:hover { background: var(--gray-50); }
.category-header .arrow {
  font-size: 0.7rem;
  transition: transform .15s;
  color: var(--gray-400);
}
.category-header .arrow.open { transform: rotate(90deg); }
.category-items { padding-left: 8px; }
.category-items.collapsed { display: none; }

/* ===== Main Area ===== */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Date navigation */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
}
.date-nav .date-text {
  font-size: 1rem;
  font-weight: 600;
  min-width: 180px;
  text-align: center;
}
.date-nav .btn { padding: 4px 10px; }

/* ===== Timeline Grid ===== */
.timeline-wrapper {
  flex: 1;
  overflow: auto;
  position: relative;
  background: var(--gray-50);
}
.timeline-scroll {
  display: inline-block;
  min-width: 100%;
}

/* Header */
.timeline-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 2px solid var(--gray-200);
}
.timeline-label-col {
  width: 120px;
  flex-shrink: 0;
  padding: 8px;
  font-size: 0.75rem;
  color: var(--gray-500);
  border-right: 1px solid var(--gray-200);
}
.timeline-grid-header {
  display: flex;
  position: relative;
}
.time-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  font-size: 0.7rem;
  border-left: 1px solid var(--gray-200);
  height: 32px;
}
.time-mark span {
  position: absolute;
  left: -1px;
  transform: translateX(-50%);
  white-space: nowrap;
}
.time-mark.hour span {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.7rem;
}
.time-mark.half span {
  font-weight: 400;
  color: var(--gray-400);
  font-size: 0.6rem;
}

/* Rows */
.timeline-row {
  display: flex;
  border-bottom: 3px solid var(--gray-300);
  min-height: 64px;
}
.timeline-row:hover { background: rgba(14,165,233,.02); }

.row-label {
  width: 120px;
  flex-shrink: 0;
  padding: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  border-right: 1px solid var(--gray-200);
  background: #fff;
  position: sticky;
  left: 0;
  z-index: 5;
}
.row-label .row-drag {
  cursor: grab;
  color: var(--gray-300);
  font-size: 0.75rem;
  user-select: none;
  flex-shrink: 0;
  letter-spacing: -1px;
}
.row-label .row-drag:hover { color: var(--gray-500); }
.row-label .row-drag:active { cursor: grabbing; }
.row-label .coach-avatar { width: 24px; height: 24px; font-size: 0.65rem; }
.row-label .name { font-size: 0.8rem; font-weight: 500; }
.timeline-row.dragging { opacity: .4; }
.timeline-row.row-drag-over { border-top: 2px solid var(--primary); }

/* Grid cells area */
.timeline-cells {
  position: relative;
  flex: 1;
  background:
    repeating-linear-gradient(
      90deg,
      var(--gray-100) 0px,
      var(--gray-100) 1px,
      transparent 1px,
      transparent 48px
    );
}
/* Hour lines (every 2 cells) */
.timeline-cells::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      90deg,
      var(--gray-200) 0px,
      var(--gray-200) 1px,
      transparent 1px,
      transparent 96px
    );
  pointer-events: none;
  z-index: 1;
}

/* ===== Schedule Blocks ===== */
.schedule-block {
  position: absolute;
  top: 4px;
  height: calc(100% - 8px);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 0.75rem;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  cursor: pointer;
  z-index: 3;
  overflow: hidden;
  transition: box-shadow .15s, transform .1s;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.schedule-block:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transform: translateY(-1px);
  z-index: 4;
}
.schedule-block .block-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.schedule-block .block-time {
  font-size: 0.65rem;
  opacity: .85;
  white-space: nowrap;
}
.schedule-block .block-location {
  font-size: 0.6rem;
  opacity: .7;
}

/* Resize handles (custom blocks) */
.schedule-block .resize-handle {
  position: absolute;
  top: 0;
  width: 8px;
  height: 100%;
  cursor: ew-resize;
  z-index: 5;
}
.schedule-block .resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: rgba(255,255,255,.5);
}
.schedule-block .resize-handle-left { left: 0; }
.schedule-block .resize-handle-left::after { left: 2px; }
.schedule-block .resize-handle-right { right: 0; }
.schedule-block .resize-handle-right::after { right: 2px; }
.schedule-block:hover .resize-handle::after {
  background: rgba(255,255,255,.85);
}

/* Editable block name */
.schedule-block .block-name-input {
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(255,255,255,.5);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0;
  width: 100%;
  outline: none;
}
.schedule-block .block-name-input::placeholder {
  color: rgba(255,255,255,.6);
}
.schedule-block .block-name-input:focus {
  border-bottom-color: rgba(255,255,255,.9);
}

/* Duration badge (shown during resize) */
.resize-duration-badge {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

/* Pay badge on block */
.schedule-block .block-pay {
  font-size: 0.65rem;
  opacity: .9;
  background: rgba(0,0,0,.2);
  padding: 0 4px;
  border-radius: 3px;
  width: fit-content;
}

/* Row daily total */
.row-total {
  width: 72px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-left: 1px solid var(--gray-200);
  position: sticky;
  right: 0;
  z-index: 5;
}
.row-total.collapsed {
  width: 20px;
  min-width: 20px;
}
.total-amount {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--success);
}
.total-amount.zero {
  color: var(--gray-300);
  font-weight: 400;
}

/* Ghost block (during drag) */
.ghost-block {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  opacity: .8;
  border-radius: 6px;
  padding: 4px 8px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

/* Snap preview */
.snap-preview {
  position: absolute;
  top: 2px;
  height: calc(100% - 4px);
  border-radius: 6px;
  border: 2px dashed;
  opacity: .4;
  z-index: 2;
  pointer-events: none;
  transition: left .1s, opacity .1s;
}
.snap-preview.valid { border-color: var(--success); background: rgba(34,197,94,.1); }
.snap-preview.conflict { border-color: var(--danger); background: rgba(239,68,68,.1); }

/* ===== Now Line ===== */
.now-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--danger);
  z-index: 6;
  pointer-events: none;
}

/* ===== Block Detail Popover ===== */
.block-popover {
  position: fixed;
  z-index: 200;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  padding: 14px;
  min-width: 260px;
  max-width: 300px;
  max-height: 85vh;
  overflow-y: auto;
  font-size: 0.85rem;
}
.pop-drag-handle {
  width: 100%;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  margin: -8px 0 4px;
}
.pop-drag-handle:active { cursor: grabbing; }
.pop-drag-handle::after {
  content: '';
  width: 32px;
  height: 4px;
  border-radius: 2px;
  background: var(--gray-300);
}
.pop-drag-handle:hover::after { background: var(--gray-500); }
.block-popover .pop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.block-popover .pop-title { font-weight: 600; }
.block-popover .pop-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--gray-700);
}
.block-popover .pop-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
}

/* ===== Segmented Control ===== */
.seg-ctrl {
  display: flex;
  background: var(--gray-100);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
.seg-btn {
  flex: 1;
  padding: 4px 0;
  font-size: 0.78rem;
  border: none;
  background: transparent;
  border-radius: 4px;
  color: var(--gray-500);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.seg-btn.active {
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}

/* ===== Student Assignment in Popover ===== */
.pop-students {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
}
.pop-students-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pop-students-title .count {
  font-weight: 400;
  color: var(--gray-400);
}
.student-list {
  margin-bottom: 6px;
}
.student-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid var(--gray-50);
  font-size: 0.75rem;
}
.student-row:last-child { border-bottom: none; }
.student-row .sr-info { flex: 1; min-width: 0; }
.student-row .sr-name { font-weight: 600; }
.student-row .sr-meta { font-size: 0.65rem; color: var(--gray-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.student-row .sr-status {
  font-size: 0.6rem; padding: 1px 6px; border-radius: 8px;
  white-space: nowrap; flex-shrink: 0;
}
.student-row .sr-status.paid { background: #dcfce7; color: #166534; }
.student-row .sr-status.unpaid { background: #fef3c7; color: #92400e; }
.student-row .sr-remove {
  cursor: pointer; font-size: 0.7rem; color: var(--gray-300);
  flex-shrink: 0; padding: 2px;
}
.student-row .sr-remove:hover { color: var(--danger); }
.student-row .sr-activity {
  font-size: 0.6rem; color: var(--gray-500);
}
.sr-tank-ctrl {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
}
.sr-tank-btn {
  width: 20px; height: 20px;
  border-radius: 4px;
  border: 1px solid var(--gray-200);
  background: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-500);
  transition: all .12s;
  padding: 0;
}
.sr-tank-btn:hover { background: var(--gray-100); }
.sr-tank-btn.nitrox-btn { color: #166534; }
.sr-tank-btn.nitrox-btn:hover { background: #dcfce7; }

/* Expandable detail */
.student-row .sr-detail {
  display: none;
  font-size: 0.65rem;
  color: var(--gray-500);
  margin-top: 2px;
}
.student-row.expanded .sr-detail { display: block; }
.student-row .sr-toggle {
  cursor: pointer; color: var(--gray-300); font-size: 0.6rem;
  flex-shrink: 0; padding: 2px 4px;
}
.student-row .sr-toggle:hover { color: var(--primary); }

/* Student search dropdown */
.student-search-wrap {
  position: relative;
}
.student-search {
  width: 100%;
  padding: 5px 8px;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: inherit;
}
.student-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(76,203,225,.12);
}
.student-dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 2px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  max-height: 160px;
  overflow-y: auto;
  z-index: 10;
}
.student-option {
  padding: 6px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background .1s;
}
.student-option:hover { background: var(--gray-50); }
.student-option .so-name { font-weight: 500; }
.student-option .so-meta { font-size: 0.65rem; color: var(--gray-400); }
.student-option .so-status {
  font-size: 0.6rem;
  padding: 1px 5px;
  border-radius: 8px;
}
.student-option .so-status.paid { background: #dcfce7; color: #166534; }
.student-option .so-status.unpaid { background: #fef3c7; color: #92400e; }
.student-option.already { opacity: .4; pointer-events: none; }
.student-empty {
  padding: 10px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--gray-400);
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--gray-400);
  text-align: center;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ===== Week View ===== */
.week-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  height: 40px;
}
.week-toolbar label { font-size: 0.8rem; color: var(--gray-500); }
.week-toolbar select {
  padding: 4px 8px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
}

.week-grid-wrapper {
  flex: 1;
  overflow: auto;
  background: var(--gray-50);
  position: relative;
}
.week-container {
  min-width: 100%;
}

/* Week header (day names) */
.week-header-cell {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 2px solid var(--gray-200);
  padding: 8px 4px;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  border-right: 1px solid var(--gray-100);
}
.week-header-cell.today {
  color: var(--primary);
  background: var(--primary-light);
}
.week-header-cell .day-name { color: var(--gray-500); font-weight: 400; font-size: 0.7rem; }
.week-header-cell .day-num { font-size: 1rem; }

/* Time label column */
.week-time-label {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #fff;
  border-right: 1px solid var(--gray-200);
  font-size: 0.65rem;
  color: var(--gray-500);
  text-align: right;
  padding: 0 6px;
  height: 40px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  transform: translateY(-6px);
}
.week-time-label.hour { font-weight: 600; color: var(--gray-700); font-size: 0.7rem; }

/* Day column cells */
.week-day-col {
  position: relative;
  border-right: 1px solid var(--gray-100);
  min-height: 40px;
  background:
    repeating-linear-gradient(
      180deg,
      var(--gray-100) 0px,
      var(--gray-100) 1px,
      transparent 1px,
      transparent 40px
    );
}
.week-day-col.unavailable {
  background:
    repeating-linear-gradient(
      -45deg,
      rgba(148,163,184,.06),
      rgba(148,163,184,.06) 4px,
      rgba(148,163,184,.12) 4px,
      rgba(148,163,184,.12) 8px
    );
}
.week-day-col.available {
  background:
    repeating-linear-gradient(
      180deg,
      rgba(34,197,94,.06) 0px,
      rgba(34,197,94,.06) 1px,
      rgba(34,197,94,.12) 1px,
      rgba(34,197,94,.12) 40px
    );
}

/* Vertical blocks */
.week-block {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 5px;
  padding: 3px 4px;
  font-size: 0.65rem;
  color: #fff;
  overflow: hidden;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
  transition: box-shadow .15s, transform .1s;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  line-height: 1.3;
}
.week-block:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  transform: scale(1.02);
  z-index: 4;
}
/* Week block resize handles (vertical) */
.week-block .resize-handle-top,
.week-block .resize-handle-bottom {
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
  z-index: 5;
}
.week-block .resize-handle-top { top: 0; }
.week-block .resize-handle-bottom { bottom: 0; }
.week-block .resize-handle-top::after,
.week-block .resize-handle-bottom::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,.3);
  transition: background .15s;
}
.week-block .resize-handle-top::after { top: 2px; }
.week-block .resize-handle-bottom::after { bottom: 2px; }
.week-block:hover .resize-handle-top::after,
.week-block:hover .resize-handle-bottom::after {
  background: rgba(255,255,255,.7);
}

.week-block .wb-name {
  font-weight: 600;
  font-size: 0.65rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.week-block .wb-time {
  font-size: 0.55rem;
  opacity: .85;
  white-space: nowrap;
}

/* Week now line (horizontal) */
.week-now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--danger);
  z-index: 6;
  pointer-events: none;
}
.week-now-line::before {
  content: '';
  position: absolute;
  left: -3px;
  top: -3px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
}

/* Week ghost */
.week-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 1000;
  opacity: .75;
  border-radius: 6px;
  padding: 4px 8px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  min-width: 80px;
  text-align: center;
}
.week-snap-preview {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 6px;
  border: 2px dashed;
  opacity: .4;
  z-index: 2;
  pointer-events: none;
}
.week-snap-preview.valid { border-color: var(--success); background: rgba(34,197,94,.1); }
.week-snap-preview.conflict { border-color: var(--danger); background: rgba(239,68,68,.1); }

/* View toggle */
.view-toggle {
  display: flex;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  overflow: hidden;
}
.view-toggle button {
  padding: 3px 10px;
  font-size: 0.8rem;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  font-weight: 500;
  transition: all .15s;
}
.view-toggle button.active {
  background: var(--primary);
  color: #fff;
}

/* Daily stats tags */
.stat-tag {
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  border: 1.5px solid var(--gray-200);
  background: #fff;
  color: var(--gray-700);
}
.stat-tag:hover { border-color: var(--gray-400); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.stat-tag .tag-count { font-weight: 700; }
.stat-tank {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gray-700);
  white-space: nowrap;
}

/* Stat detail popover */
.stat-popover {
  position: fixed;
  z-index: 200;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0,0,0,.18);
  padding: 14px 18px;
  min-width: 260px;
  font-size: 0.82rem;
}
.stat-popover .sp-title {
  font-weight: 600;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-100);
}
.stat-popover .sp-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  color: var(--gray-700);
}
.stat-popover .sp-row .sp-val { font-weight: 600; }

/* Week column resize handle */
.week-col-resizer {
  position: absolute;
  right: -6px;
  top: 0;
  bottom: 0;
  width: 12px;
  cursor: col-resize;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
}
.week-col-resizer::before {
  content: '⋮';
  font-size: 0.7rem;
  color: var(--gray-300);
  letter-spacing: -2px;
  transition: color .15s;
}
.week-col-resizer:hover::before {
  color: var(--primary);
}
.week-col-resizer::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  border-radius: 1px;
  background: transparent;
  transition: background .15s;
}
.week-col-resizer:hover::after {
  background: var(--primary);
}

/* ===== Pay Report Modal ===== */
.report-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.report-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
}
.report-header h2 { font-size: 1.1rem; }
.report-tabs {
  display: flex;
  gap: 0;
  margin: 0 24px 8px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  overflow: hidden;
}
.report-tab {
  flex: 1;
  padding: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--gray-500);
  transition: all .15s;
}
.report-tab.active {
  background: var(--primary);
  color: #fff;
}
.report-period {
  padding: 4px 24px 12px;
  font-size: 0.8rem;
  color: var(--gray-500);
  text-align: center;
}
.report-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 24px 20px;
}

/* Report table */
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.report-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .3px;
  border-bottom: 2px solid var(--gray-200);
}
.report-table th:not(:first-child) { text-align: right; }
.report-table td {
  padding: 10px;
  border-bottom: 1px solid var(--gray-50);
}
.report-table td:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.report-table tr:hover td { background: var(--gray-50); }
.report-table .coach-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.report-table .total-row td {
  font-weight: 600;
  border-top: 2px solid var(--gray-200);
  border-bottom: none;
  background: var(--gray-50);
}
.report-table .amount { font-weight: 500; }
.report-table .amount.highlight {
  color: var(--success);
  font-weight: 600;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .sidebar.mobile-open {
    display: flex;
    position: fixed;
    inset: 52px 0 0 0;
    width: 100%;
    z-index: 50;
    background: #fff;
  }
  .row-label { width: 60px; }
  .row-label .name { font-size: 0.7rem; }
  .timeline-label-col { width: 60px; }
}
