/* ── Reset & Base ─────────────────────────────── */
body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  overflow: hidden;
  display: flex;
}

/* Form controls don't inherit the page font by default */
button,
input {
  font-family: inherit;
}

/* ── Views ────────────────────────────────────── */
/* Hidden views stay laid out (visibility), so their measurements stay valid;
   team-view.css and lens-timeline.css hide their own views the same way */
[data-view="timeline"] .timeline-container {
  visibility: hidden;
}

[data-view="classic"] .team-view,
[data-view="classic"] [data-sidebar="teams"] {
  display: none;
}

/* ── Sidebar ──────────────────────────────────── */
.people-sidebar {
  position: relative;
  z-index: 200;
  width: 260px;
  min-width: 260px;
  height: 100vh;
  background: #ffffff;
  border-left: 1px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid #ebebeb;
  flex-shrink: 0;
}

.sidebar-title {
  margin: 0 0 12px 0;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #999;
}

/* Tabs */
.sidebar-tabs {
  display: flex;
  gap: 4px;
  background: #f4f4f4;
  border-radius: 6px;
  padding: 3px;
}

.tab-btn {
  flex: 1;
  padding: 5px 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab-btn.active {
  background: #ffffff;
  color: #222;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.tab-btn:hover:not(.active) {
  color: #444;
}

.people-search {
  width: 100%;
  box-sizing: border-box;
  margin-top: 10px;
  padding: 7px 9px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fff;
  color: #222;
  font: inherit;
  font-size: 12px;
  outline: none;
}

.people-search:focus {
  border-color: #4f86c6;
  box-shadow: 0 0 0 2px rgba(79, 134, 198, 0.15);
}

.comparison-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 18px;
  margin-top: 9px;
  color: #777;
  font-size: 11px;
}

.comparison-panel.has-overlap {
  color: #26734d;
}

.comparison-panel.no-overlap {
  color: #b34b43;
}

.clear-comparison {
  padding: 3px 7px;
  border: 1px solid #ddd;
  background: #fff;
  color: #777;
  font-size: 11px;
}

.clear-comparison:hover {
  background: #f4f4f4;
  color: #444;
}

/* People list */
.people-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  overflow-y: auto;
  flex: 1;
}

.people-list::-webkit-scrollbar {
  width: 4px;
}
.people-list::-webkit-scrollbar-track {
  background: transparent;
}
.people-list::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 4px;
}

/* Person row */
.person-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  cursor: default;
  transition: background 0.1s, opacity 0.2s ease;
}

.person-select {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #4f86c6;
  cursor: pointer;
  flex-shrink: 0;
}

.person-row:hover {
  background: #f7f7f7;
}

/* Rows select the person in the Timeline view (click or Enter) */
.person-row:focus {
  outline: none;
}

.person-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* When sidebar has a highlight, fade non-highlighted rows */
.people-list.has-highlight .person-row {
  opacity: 0.6;
}

.people-list.has-highlight .person-row.highlighted {
  opacity: 1;
  background: #f0f7ff;
}

/* Avatar */
.person-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
}

/* Photo sits over the initials; portraits are framed head-and-shoulders, so bias to the top */
.person-avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
}

/* Info block */
.person-info {
  flex: 1;
  min-width: 0;
}

.person-info-name {
  font-size: 12.5px; /* Poppins runs wide */
  font-weight: 600;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-info-duration {
  font-size: 10.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #888;
  margin-top: 2px;
}

/* Status dot */
.person-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.person-status.active {
  background: #4caf50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

.person-status.left {
  background: #ccc;
}

/* Empty state */
.people-list-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 12px;
  color: #bbb;
}

/* ── Controls strip ───────────────────────────── */
/* A soft raised strip centred at the bottom of the main area: navigation,
   in/out/net tiles, period slider. Every section has a fixed width, so the
   strip's width (and position) never changes with numbers, period or view.
   Centred with auto margins rather than a transform, so text stays crisp. */
.controls {
  --ctrl-ink: var(--surface-ink);
  --ctrl-muted: var(--surface-muted);
  --ctrl-accent: var(--accent); /* the one colour for the one control */
  --ctrl-in: var(--pos);
  --ctrl-out: var(--neg);
  --ctrl-line: var(--line);
  --ctrl-track: var(--track);

  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  z-index: 1000;
  display: flex;
  align-items: stretch;
  width: fit-content;
  margin: 0 auto;
  padding: 10px 4px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--surface-shadow);
  backdrop-filter: blur(8px);
  color: var(--ctrl-ink);
  font-family: var(--font);
  user-select: none;
}

.ctrl-cell {
  display: flex;
  align-items: center;
  padding: 0 14px;
}

.ctrl-trend {
  display: flex;
  border-left: 1px solid var(--ctrl-line);
}

.ctrl-period {
  border-left: 1px solid var(--ctrl-line);
}

.ctrl-caption {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ctrl-muted);
}

/* Navigation: round raised buttons */
.ctrl-nav {
  gap: 8px;
}

/* .controls prefix so these beat the global button styles */
.controls .ctrl-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background: var(--button);
  color: var(--ctrl-ink);
  box-shadow: var(--button-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

.controls .ctrl-btn:hover {
  background: var(--button-hover);
  color: var(--ctrl-accent);
  box-shadow: var(--button-shadow-hover);
}

.controls .ctrl-btn:active {
  transform: scale(0.94);
}

.controls .ctrl-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.ctrl-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* In / out / net: caption over a fixed-width number */
.ctrl-stats {
  gap: 6px;
}

.ctrl-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 50px;
}

.ctrl-value {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.ctrl-arrow {
  width: 8px;
  height: 8px;
  fill: currentColor;
}

.tile-in .ctrl-value {
  color: var(--ctrl-in);
}

.tile-out .ctrl-value {
  color: var(--ctrl-out);
}

.tile-net .ctrl-value {
  color: var(--ctrl-muted);
}

.ctrl-trend[data-trend="growing"] .tile-net .ctrl-value {
  color: var(--ctrl-in);
}

.ctrl-trend[data-trend="shrinking"] .tile-net .ctrl-value {
  color: var(--ctrl-out);
}

/* Period: caption + value, then 1mo [slider] All */
.ctrl-period {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  width: 196px;
}

/* Left-aligned so the value's start never moves as its text changes */
.ctrl-period-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ctrl-period-head label {
  cursor: pointer;
}

.ctrl-period-label {
  font-size: 11px;
  font-weight: 500;
}

.ctrl-period-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl-end {
  font-size: 9px;
  font-weight: 500;
  color: var(--ctrl-muted);
}

.ctrl-slider {
  --fill: 0;
  position: relative;
  flex: 1;
  height: 22px;
}

/* Track filled up to the thumb's centre: 7px = half the thumb */
.ctrl-range {
  --fill-stop: calc(7px + (100% - 14px) * var(--fill));
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 16px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.ctrl-range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--ctrl-accent) var(--fill-stop), var(--ctrl-track) var(--fill-stop));
}

.ctrl-range::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--ctrl-accent) var(--fill-stop), var(--ctrl-track) var(--fill-stop));
}

.ctrl-range::-webkit-slider-thumb {
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: none;
  border-radius: 50%;
  background: var(--thumb);
  box-shadow: var(--thumb-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
}

.ctrl-range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--thumb);
  box-shadow: var(--thumb-shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ctrl-range:hover::-webkit-slider-thumb,
.ctrl-range:active::-webkit-slider-thumb {
  transform: scale(1.15);
}

.ctrl-range:hover::-moz-range-thumb,
.ctrl-range:active::-moz-range-thumb {
  transform: scale(1.15);
}

.ctrl-range:focus {
  outline: none;
}

/* Keyboard focus: a ring around the slider (Chromium doesn't repaint the
   thumb's halo on focus reliably), plus a soft halo around the thumb */
.ctrl-range:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
  border-radius: 8px;
}

.ctrl-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 6px var(--accent-soft), var(--thumb-shadow);
}

.ctrl-range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 6px var(--accent-soft), var(--thumb-shadow);
}

/* One tick per period step, centred under each thumb position */
.ctrl-ticks {
  position: absolute;
  top: 17px;
  left: 6px;
  right: 6px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.ctrl-ticks span {
  width: 2px;
  height: 4px;
  border-radius: 1px;
  background: var(--ctrl-track);
}

.ctrl-ticks span.on {
  background: var(--ctrl-accent);
  opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
  .controls .ctrl-btn,
  .ctrl-range::-webkit-slider-thumb {
    transition: none;
  }
}

button {
  padding: 8px 15px;
  border: none;
  border-radius: 4px;
  background-color: #4caf50;
  color: white;
  cursor: pointer;
}

button:hover {
  background-color: #45a049;
}
