.history-view { display: flex; flex-direction: column; height: 100%; }

.history-mode-bar {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mode-btn {
  min-height: 34px;
  padding: 0 var(--sp-3);
  border: 1.5px solid var(--border-hi);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  transition: all .15s;
  background: none;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.mode-btn.active {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(251,113,133,.1);
}

.history-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-2);
  text-transform: capitalize;
}

.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cal-container {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-3) var(--sp-2) var(--sp-8);
}

.cal-loading, .cal-error {
  text-align: center;
  padding: var(--sp-8) var(--sp-4);
  color: var(--text-3);
  font-size: 15px;
}

.cal-grid {
  display: grid;
  gap: var(--sp-2);
  min-width: 100%;
}

.cal-time-axis {
  position: relative;
  height: 480px;
  flex-shrink: 0;
}

.cal-hour {
  position: absolute;
  left: 0;
  font-size: 9px;
  color: var(--text-3);
  line-height: 1;
  transform: translateY(-50%);
  white-space: nowrap;
}

.cal-col {
  display: flex;
  flex-direction: column;
  min-width: 44px;
}

.cal-col-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-align: center;
  padding-bottom: var(--sp-2);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.cal-col-body {
  position: relative;
  background: var(--bg-1);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.cal-block {
  position: absolute;
  left: 1px;
  right: 1px;
  border-radius: 2px;
  opacity: .85;
  min-height: 20px;
  transition: opacity .15s;
}
.cal-block:hover { opacity: 1; }

/* Day view */
.day-view { display: flex; flex-direction: column; height: 100%; }

.day-view-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  padding: var(--sp-2) var(--sp-4) 0;
  text-transform: uppercase;
  letter-spacing: .6px;
}

.day-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-2) var(--sp-4) var(--sp-2);
  border-bottom: 1px solid var(--border);
}

.day-summary-empty {
  padding: var(--sp-2) var(--sp-4);
  color: var(--text-3);
  font-size: 13px;
}

.day-summary-row {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
  min-height: 24px;
}

.day-summary-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.day-summary-type {
  font-weight: 600;
  color: var(--text-1);
  min-width: 62px;
}

.day-summary-section { display: contents; }

.day-summary-entry {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--text-2);
  padding: 1px 0 1px 18px;
  line-height: 1.5;
}

.day-summary-time {
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
  flex-shrink: 0;
}

.day-summary-detail {
  color: var(--text-2);
}

/* Cal block labels in day view */
.cal-block-label {
  display: block;
  font-size: 9px;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  padding: 2px 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
  text-transform: capitalize;
}

.cal-block-active {
  animation: cal-pulse 2s ease-in-out infinite;
}

@keyframes cal-pulse {
  0%, 100% { opacity: .85; }
  50% { opacity: 1; }
}

/* Hour grid lines */
.cal-col-body::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent calc(100% / 24 * 3 - 1px),
    var(--border) calc(100% / 24 * 3 - 1px),
    var(--border) calc(100% / 24 * 3)
  );
  pointer-events: none;
  opacity: .4;
}
