/* ─── Appointment History Band ─────────────────────────────── */

#appointment-mode-overlay .appointment-history-band-panel {
  flex: 0 0 290px;
  min-height: 0;
  background: #ffffff;
  border: 1px solid #dbe3ee;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

#appointment-mode-overlay .appointment-history-band-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem 0.65rem;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

#appointment-mode-overlay .appointment-history-band-kicker {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.12rem;
}

#appointment-mode-overlay .appointment-history-band-header h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 800;
  color: #0f172a;
}

#appointment-mode-overlay .appointment-history-band-controls {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.45rem;
}

#appointment-mode-overlay .appointment-history-band-range-btn {
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #334155;
  font-size: 0.79rem;
  font-weight: 700;
  padding: 0.42rem 0.7rem;
  cursor: pointer;
}

#appointment-mode-overlay .appointment-history-band-range-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

#appointment-mode-overlay .appointment-history-band-range-btn.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

#appointment-mode-overlay .appointment-history-band-surface {
  position: relative;
  height: calc(100% - 58px);
  min-height: 0;
  padding: 0.28rem 0.7rem 0.22rem;
  background: #ffffff;
  overflow: hidden;
}

#appointment-mode-overlay .appointment-history-band-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  color: #64748b;
  font-size: 0.92rem;
  text-align: center;
  padding: 1rem;
}

#appointment-mode-overlay .appointment-history-band-canvas {
  position: relative;
  width: 100%;
  height: 100%;
}

#appointment-mode-overlay .appointment-history-band-rail {
  position: absolute;
  left: 0;
  right: 0;
  top: 86px;
  height: 34px;
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid #1d4ed8;
  overflow: visible;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.14);
}

#appointment-mode-overlay .appointment-history-band-month-segment {
  position: relative;
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0 0.1rem;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border-left: 1px solid rgba(255,255,255,0.3);
}

#appointment-mode-overlay .appointment-history-band-month-segment:first-child {
  border-left: none;
}

#appointment-mode-overlay .appointment-history-band-month-segment.is-year-break {
  box-shadow: inset 3px 0 0 rgba(255,255,255,0.88);
}

#appointment-mode-overlay .appointment-history-band-month-segment--interactive {
  cursor: pointer;
}

#appointment-mode-overlay .appointment-history-band-month-segment--interactive:hover {
  background: linear-gradient(180deg, #3b82f6 0%, #2563eb 100%);
}

#appointment-mode-overlay .appointment-history-band-month-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

#appointment-mode-overlay .appointment-history-band-month-label.is-hidden {
  visibility: hidden;
}

#appointment-mode-overlay .appointment-history-band-year-divider {
  position: absolute;
  top: -8px;
  bottom: -1px;
  left: 0;
  width: 0;
  border-left: 3px solid rgba(255,255,255,0.92);
  pointer-events: none;
}

#appointment-mode-overlay .appointment-history-band-year-inline {
  display: none;
}

#appointment-mode-overlay .appointment-history-band-year-block {
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 800;
  border-left: 3px solid rgba(255,255,255,0.88);
  border-right: 1px solid rgba(255,255,255,0.3);
}

#appointment-mode-overlay .appointment-history-band-rail--expanded {
  display: flex;
}

#appointment-mode-overlay .appointment-history-band-day-segment {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  border-left: 1px solid rgba(255,255,255,0.18);
}

#appointment-mode-overlay .appointment-history-band-day-segment:first-child {
  border-left: none;
}

#appointment-mode-overlay .appointment-history-band-day-tick {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 1px;
  height: 10px;
  background: rgba(255,255,255,0.38);
  transform: translateX(-50%);
}

#appointment-mode-overlay .appointment-history-band-day-tick.is-major {
  height: 15px;
  background: rgba(255,255,255,0.88);
}

#appointment-mode-overlay .appointment-history-band-day-label {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  color: #ffffff;
  white-space: nowrap;
}

#appointment-mode-overlay .appointment-history-band-day-label.is-hidden {
  visibility: hidden;
}

#appointment-mode-overlay .appointment-history-band-expanded-empty {
  position: absolute;
  left: 50%;
  top: 22px;
  transform: translateX(-50%);
  font-size: 0.88rem;
  font-weight: 700;
  color: #64748b;
}

#appointment-mode-overlay .appointment-history-band-tick {
  position: absolute;
  bottom: -7px;
  left: 50%;
  width: 1px;
  height: 9px;
  background: rgba(30, 41, 59, 0.24);
  transform: translateX(-50%);
}

#appointment-mode-overlay .appointment-history-band-event,
#appointment-mode-overlay .appointment-history-band-stack {
  position: absolute;
  transform: translateX(-50%);
  font: inherit;
  text-align: left;
}

#appointment-mode-overlay .appointment-history-band-event {
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

#appointment-mode-overlay .appointment-history-band-event--top,
#appointment-mode-overlay .appointment-history-band-stack--top {
  top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#appointment-mode-overlay .appointment-history-band-event--bottom,
#appointment-mode-overlay .appointment-history-band-stack--bottom {
  top: 98px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#appointment-mode-overlay .appointment-history-band-stack-row {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
}

#appointment-mode-overlay .appointment-history-band-stack-card-wrap {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  width: var(--appointment-history-card-width, 120px);
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

#appointment-mode-overlay .appointment-history-band-event-card {
  position: relative;
  z-index: 3;
  width: var(--appointment-history-card-width, 120px);
  min-height: 56px;
  border-radius: 12px;
  border: 1px solid #dbe3ee;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  padding: 0.32rem 0.42rem 0.36rem;
  box-sizing: border-box;
  transform: translateX(var(--appointment-history-card-shift, 0px));
}

#appointment-mode-overlay .appointment-history-band-stack-card-wrap:focus-visible .appointment-history-band-event-card,
#appointment-mode-overlay .appointment-history-band-stack-card-wrap:hover .appointment-history-band-event-card,
#appointment-mode-overlay .appointment-history-band-event:focus-visible .appointment-history-band-event-card,
#appointment-mode-overlay .appointment-history-band-event:hover .appointment-history-band-event-card {
  border-color: #60a5fa;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.16);
}

#appointment-mode-overlay .appointment-history-band-stack-shadow {
  position: absolute;
  left: 50%;
  width: var(--appointment-history-card-width, 120px);
  min-height: 56px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #dbe3ee;
  box-sizing: border-box;
  transform: translateX(-50%);
  z-index: 1;
  pointer-events: none;
}

#appointment-mode-overlay .appointment-history-band-stack-shadow--1 {
  top: 4px;
  opacity: 0.82;
}

#appointment-mode-overlay .appointment-history-band-stack-shadow--2 {
  top: 8px;
  opacity: 0.66;
}

#appointment-mode-overlay .appointment-history-band-event-titleline {
  display: block;
  font-size: 0.75rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.16;
  margin-bottom: 0.14rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#appointment-mode-overlay .appointment-history-band-event-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 1.14;
  color: #475569;
}

#appointment-mode-overlay .appointment-history-band-event-stem {
  width: 1px;
  background: rgba(37, 99, 235, 0.42);
  flex: 0 0 auto;
}

#appointment-mode-overlay .appointment-history-band-event-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid #2563eb;
  box-sizing: border-box;
  flex: 0 0 auto;
}

#appointment-mode-overlay .appointment-history-band-stack-nav {
  position: absolute;
  left: calc(100% + 6px);
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}


#appointment-mode-overlay .appointment-history-band-stack-arrow {
  width: 18px;
  height: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #ffffff;
  color: #475569;
  font-size: 0.52rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

#appointment-mode-overlay .appointment-history-band-stack-arrow:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

#appointment-mode-overlay .appointment-history-band-stack-count {
  min-width: 18px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}

#appointment-mode-overlay .appointment-history-band-event--call .appointment-history-band-event-dot,
#appointment-mode-overlay .appointment-history-band-stack--call .appointment-history-band-event-dot {
  border-color: #16a34a;
}

#appointment-mode-overlay .appointment-history-band-event--call .appointment-history-band-event-card,
#appointment-mode-overlay .appointment-history-band-stack--call .appointment-history-band-event-card {
  border-top: 3px solid #16a34a;
}

#appointment-mode-overlay .appointment-history-band-event--note .appointment-history-band-event-dot,
#appointment-mode-overlay .appointment-history-band-stack--note .appointment-history-band-event-dot {
  border-color: #2563eb;
}

#appointment-mode-overlay .appointment-history-band-event--note .appointment-history-band-event-card,
#appointment-mode-overlay .appointment-history-band-stack--note .appointment-history-band-event-card {
  border-top: 3px solid #2563eb;
}

#appointment-mode-overlay .appointment-history-band-event--appointment .appointment-history-band-event-dot,
#appointment-mode-overlay .appointment-history-band-stack--appointment .appointment-history-band-event-dot {
  border-color: #7c3aed;
}

#appointment-mode-overlay .appointment-history-band-event--appointment .appointment-history-band-event-card,
#appointment-mode-overlay .appointment-history-band-stack--appointment .appointment-history-band-event-card {
  border-top: 3px solid #7c3aed;
}

#appointment-mode-overlay .appointment-history-band-event--task .appointment-history-band-event-dot,
#appointment-mode-overlay .appointment-history-band-stack--task .appointment-history-band-event-dot {
  border-color: #ea580c;
}

#appointment-mode-overlay .appointment-history-band-event--task .appointment-history-band-event-card,
#appointment-mode-overlay .appointment-history-band-stack--task .appointment-history-band-event-card {
  border-top: 3px solid #ea580c;
}

@media (max-width: 1180px) {
  #appointment-mode-overlay .appointment-history-band-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #appointment-mode-overlay .appointment-history-band-controls {
    width: 100%;
    justify-content: flex-start;
  }
}
