.period-timeline {
  --period-accent: #1a6b4a;
  --period-ink: #1a6b4a;
  container-type: inline-size;
  padding: 19px 23px;
  border: 1px solid #e1eae3;
  border-radius: 14px;
  background: #f8fbf9;
  color: #1e3025;
}
.period-timeline-ok       { --period-accent: #1a6b4a; --period-ink: #1a6b4a; }
.period-timeline-warn     { --period-accent: #d97706; --period-ink: #8a5706; }
.period-timeline-danger   { --period-accent: #d44;    --period-ink: #a03030; }
.period-timeline-upcoming { --period-accent: #9aa39c; --period-ink: #66716b; }

.period-timeline-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
}

.period-timeline-heading strong { font-weight: 600; }
.period-timeline-heading span { color: #718077; font-size: 12px; white-space: nowrap; }

.period-timeline-status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  color: var(--period-ink);
  font-size: 12.5px;
  font-weight: 600;
}
.period-timeline-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--period-accent);
}

.period-timeline-track {
  position: relative;
  height: 44px;
  margin: 18px 5px 23px;
  border-radius: 999px;
  background: #e3eae5;
}
.period-timeline-has-ticks .period-timeline-track { margin-bottom: 36px; }

.period-timeline-fill {
  display: block;
  width: var(--period-progress);
  height: 100%;
  border-radius: 999px 0 0 999px;
  background: var(--period-accent);
}

.period-timeline-tick {
  position: absolute;
  top: calc(100% + 5px);
  width: 16px;
  height: 24px;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 4px;
  background: transparent;
  cursor: default;
}
.period-timeline-tick-line {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 6px;
  transform: translate(-50%, -50%);
  border-radius: 1px;
  background: #b9c4bc;
}
.period-timeline-tick-label {
  position: absolute;
  top: calc(50% + 6px);
  left: 50%;
  transform: translateX(var(--tick-label-shift, -50%));
  display: none;
  padding: 1px 4px;
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(30, 48, 37, .14);
  color: #5d6a61;
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
}
.period-timeline-tick.has-label .period-timeline-tick-label { display: block; }

.period-timeline-marker {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: var(--period-progress);
  bottom: 8px;
  width: 3px;
  transform: translateX(-50%);
  border-radius: 3px;
  background: #fff;
  pointer-events: none;
}

.period-timeline-remaining {
  position: absolute;
  inset: 0 0 0 var(--period-progress);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  color: var(--period-ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  pointer-events: none;
  z-index: 3;
}
.period-timeline-tight .period-timeline-remaining { left: 0; justify-content: flex-end; }
.period-timeline-tight .period-timeline-remaining > span {
  background: #e3eae5;
  padding: 6px 10px;
  border-radius: 999px;
}
.period-timeline-tight .period-timeline-fill { border-radius: inherit; }

.period-timeline-dates {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.period-timeline-dates > div { display: flex; flex-direction: column; gap: 5px; }
.period-timeline-dates > div:last-child { text-align: right; }
.period-timeline-dates span { color: #87938b; font-size: 10px; font-weight: 600; text-transform: uppercase; }
.period-timeline-dates strong { font-size: 13px; font-weight: 600; }

/* Milestone labels yield to tight cards; the ticks stay, and hover / keyboard
   focus / tap always reveal the exact date for every milestone. */
.period-timeline-tick:focus { outline: none; }
.period-timeline-tick:focus-visible {
  outline: 2px solid var(--period-accent);
  outline-offset: 2px;
}

/* Narrow cards shed alternate labels first, then all labels — the ticks stay,
   and hover / focus / tap still reveals every milestone date. */
@container (max-width: 320px) {
  .period-timeline-tick.has-label.alt .period-timeline-tick-label { display: none; }
  .period-timeline-heading span { white-space: normal; text-align: right; }
}
@container (max-width: 240px) {
  .period-timeline-tick.has-label .period-timeline-tick-label { display: none; }
  .period-timeline-heading { flex-direction: column; gap: 3px; }
}

.period-timeline-tick:hover .period-timeline-tick-label,
.period-timeline-tick:focus .period-timeline-tick-label,
.period-timeline-tick:focus-visible .period-timeline-tick-label,
.period-timeline-tick:active .period-timeline-tick-label { display: block; }

@media (prefers-reduced-motion: reduce) {
  .period-timeline * { transition: none !important; animation: none !important; }
}

#overview-lease-period .period-timeline { margin-top: 20px; }
.tenant-card .period-timeline { margin: 15px 0; }

.maintenance-card .period-timeline,
.service-card .period-timeline {
  margin: 0 17px 16px;
  padding: 13px 14px;
  border-radius: 9px;
}
.maintenance-card .period-timeline-heading,
.service-card .period-timeline-heading { font-size: 12px; }
.maintenance-card .period-timeline-heading span,
.service-card .period-timeline-heading span { font-size: 11px; }
.maintenance-card .period-timeline-status,
.service-card .period-timeline-status { font-size: 11px; }
.maintenance-card .period-timeline-track,
.service-card .period-timeline-track { height: 44px; margin: 18px 4px; }
.maintenance-card .period-timeline-has-ticks .period-timeline-track,
.service-card .period-timeline-has-ticks .period-timeline-track { margin-bottom: 32px; }
.maintenance-card .period-timeline-dates strong,
.service-card .period-timeline-dates strong { font-size: 11px; }

@media (max-width: 480px) {
  .period-timeline { padding: 16px; }
  .period-timeline-dates strong { font-size: 12px; }
}
