*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #FFFFFF;
  color: #000000;
  line-height: 1.5;
  overflow-x: hidden;
}

.layout {
  min-height: 100vh;
}

.main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
@media (max-width: 480px) {
  .main {
    padding: 24px 12px 28px;
    gap: 16px;
  }
}

.site-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 20px 0;
}
@media (max-width: 480px) {
  .site-header {
    padding: 16px 0;
  }
}

.site-header__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.site-header__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #5B4CFF;
}

.site-header__meta {
  font-size: 12px;
  color: #757575;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .stats-grid .stat-card:nth-child(4) {
    grid-column: 1/-1;
  }
}

.stat-card {
  background: #F7F7F7;
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
@media (max-width: 480px) {
  .stat-card {
    padding: 16px 12px;
  }
}

.stat-card__value {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #000000;
  line-height: 1;
}
@media (max-width: 480px) {
  .stat-card__value {
    font-size: 28px;
  }
}

.stat-card__value--location {
  font-size: 18px;
  letter-spacing: -0.01em;
  line-height: 1.2;
  word-break: break-word;
}

.stat-card__label {
  font-size: 12px;
  color: #757575;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.stat-card__sub {
  font-size: 12px;
  color: #5B4CFF;
  font-weight: 600;
  margin-top: 4px;
}

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 16px;
}
@media (max-width: 900px) {
  .charts-row {
    grid-template-columns: 1fr;
  }
}

.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 700px) {
  .bottom-row {
    grid-template-columns: 1fr;
  }
}

.chart-card {
  background: #F7F7F7;
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (max-width: 480px) {
  .chart-card {
    padding: 16px 12px;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
  }
}

.chart-card__title {
  font-size: 15px;
  font-weight: 600;
  color: #1E1E1E;
  letter-spacing: -0.01em;
}
@media (max-width: 480px) {
  .chart-card__title {
    font-size: 14px;
  }
}

.chart-card__body {
  position: relative;
  height: 220px;
}
.chart-card__body canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}
@media (max-width: 480px) {
  .chart-card__body {
    height: 200px;
    min-width: 0;
    width: 100%;
  }
}

.heatmap-wrap {
  display: flex;
  gap: 8px;
  overflow: hidden;
}
@media (max-width: 480px) {
  .heatmap-wrap {
    min-width: 0;
    width: 100%;
  }
}

.heatmap-days {
  display: grid;
  grid-template-rows: repeat(7, 13px);
  gap: 3px;
  padding-top: 2px;
  flex-shrink: 0;
}
.heatmap-days span {
  font-size: 10px;
  color: #757575;
  line-height: 13px;
}
@media (max-width: 480px) {
  .heatmap-days {
    grid-template-rows: repeat(7, 11px);
    gap: 2px;
  }
  .heatmap-days span {
    line-height: 11px;
    font-size: 9px;
  }
}

.heatmap-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
}
.heatmap-scroll::-webkit-scrollbar {
  height: 4px;
}
.heatmap-scroll::-webkit-scrollbar-track {
  background: transparent;
}
.heatmap-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 2px;
}

.heatmap-grid {
  display: grid;
  grid-template-rows: repeat(7, 13px);
  grid-auto-columns: 13px;
  grid-auto-flow: column;
  gap: 3px;
}
@media (max-width: 480px) {
  .heatmap-grid {
    grid-template-rows: repeat(7, 11px);
    grid-auto-columns: 11px;
    gap: 2px;
  }
}

.heatmap-cell {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}
.heatmap-cell--0 {
  background: #D4CCFF;
}
.heatmap-cell--1 {
  background: #5B4CFF;
}
.heatmap-cell--2 {
  background: #E0E0E0;
}
@media (max-width: 480px) {
  .heatmap-cell {
    width: 11px;
    height: 11px;
  }
}

.heatmap-tooltip {
  position: fixed;
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
  display: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.heatmap-tooltip.visible {
  display: block;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
}
.heatmap-legend .heatmap-legend__label {
  font-size: 10px;
  color: #757575;
}
.heatmap-legend .heatmap-cell {
  display: inline-block;
}

.time-heatmap-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.time-heatmap-grid {
  display: grid;
  grid-template-columns: 30px repeat(7, 1fr);
  gap: 2px;
  align-items: center;
  max-width: fit-content;
}

.time-heatmap-header {
  grid-column: 1;
}

.time-heatmap-header-cell {
  font-size: 12px;
  text-align: center;
  line-height: 1;
  color: #1E1E1E;
  font-weight: 500;
}

.time-heatmap-row-label {
  font-size: 20px;
  text-align: center;
  line-height: 1;
  position: relative;
  cursor: help;
}
.time-heatmap-row-label::after {
  content: attr(data-time);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 10px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 10;
  margin-bottom: 8px;
}
.time-heatmap-row-label:hover::after {
  opacity: 1;
  visibility: visible;
}

.locations-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.location-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.location-item__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.location-item__name {
  font-size: 12px;
  color: #1E1E1E;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 75%;
}

.location-item__count {
  font-size: 12px;
  color: #757575;
  font-weight: 600;
  flex-shrink: 0;
}

.location-item__bar-track {
  height: 4px;
  background: #F0F0F0;
  border-radius: 2px;
  overflow: hidden;
}

.location-item__bar-fill {
  height: 100%;
  background: #5B4CFF;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.visits-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.visit-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  gap: 12px;
}
.visit-item:last-child {
  border-bottom: none;
}
@media (max-width: 480px) {
  .visit-item {
    padding: 4px 0;
    gap: 8px;
  }
}

.visit-item__location {
  font-size: 12px;
  font-weight: 500;
  color: #1E1E1E;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.visit-item__meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.visit-item__date {
  font-size: 10px;
  color: #757575;
}

.visit-item__time {
  font-size: 10px;
  color: #5B4CFF;
  font-weight: 600;
}
