:root {
  --bg: #0e1116;
  --panel: #151a22;
  --panel-alt: #1b2330;
  --text: #edf2f7;
  --muted: #9fb0c4;
  --border: #2a3547;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.top-header {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(21, 26, 34, 0.98), rgba(21, 26, 34, 0.94));
  backdrop-filter: blur(2px);
}

.identity {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.profile-photo {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 1px solid var(--border);
  object-fit: cover;
  background: #0b1017;
}

.profile-name {
  margin: 0;
  font-size: 1.1rem;
}

.profile-details {
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  background: rgba(255, 255, 255, 0.02);
}

.profile-details summary {
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.profile-details summary::after {
  /* Duidelijke status op de toggle zelf: open of dicht. */
  content: "▼ Uitklappen";
  font-size: 0.83rem;
  color: #c5d3e4;
}

.profile-details[open] summary::after {
  content: "▲ Inklappen";
  color: #e2e8f0;
}

.profile-extra {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: calc(100vh - 92px);
}

.timeline-panel {
  padding: 1rem;
  border-right: 1px solid var(--border);
  background: var(--panel);
}

.timeline-head h2 {
  margin: 0;
  font-size: 1rem;
}

.subtitle {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.timeline {
  margin-top: 1rem;
  height: calc(100vh - 6.5rem);
  overflow-y: auto;
  padding-right: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.timeline-item {
  border: 1px solid var(--border);
  border-left: 9px solid var(--item-color, #64748b);
  border-radius: 8px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0));
  color: var(--text);
  text-align: left;
  padding: var(--item-padding-y, 0.5rem) 0.65rem;
  width: 100%;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease;
}

.timeline-item:hover {
  transform: translateX(2px);
}

.timeline-item.active {
  border-color: var(--item-color, #94a3b8);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--item-color, #94a3b8), transparent 45%);
}

.timeline-item .period {
  font-size: var(--period-size, 0.78rem);
  color: var(--muted);
}

.timeline-item .employer {
  margin-top: 0.25rem;
  font-weight: 600;
  font-size: var(--employer-size, 0.98rem);
}

.timeline-item .role {
  margin-top: 0.15rem;
  font-size: var(--role-size, 0.9rem);
}

.tag {
  display: inline-flex;
  align-items: center;
  margin-top: 0.35rem;
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: clamp(0.58rem, 0.4rem + 0.24vw, 0.72rem);
  color: var(--muted);
  width: fit-content;
}

.tag--zzp {
  color: #86efac;
  border-color: #166534;
  background: rgba(34, 197, 94, 0.18);
}

.tag--loondienst {
  color: #93c5fd;
  border-color: #1e40af;
  background: rgba(59, 130, 246, 0.2);
}

.details-panel {
  padding: 1.2rem;
  background: var(--panel-alt);
}

.mobile-back-btn {
  display: none;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
  cursor: pointer;
}

.mobile-back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.detail-card {
  max-width: 1000px;
}

.detail-header h2 {
  margin: 0;
}

.detail-header .header-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.detail-header .period {
  margin-top: 0.3rem;
  color: var(--muted);
}

.summary {
  margin-top: 0.9rem;
  line-height: 1.45;
}

.blocks {
  margin-top: 1rem;
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
}

.block h3 {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
}

.block ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.25rem;
}

.chips {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 0.2rem 0.6rem;
  font-size: 0.8rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  body {
    overflow: hidden;
    overscroll-behavior-y: none;
  }

  .layout {
    position: relative;
    grid-template-columns: 1fr;
    min-height: calc(100dvh - 92px);
    overflow: hidden;
  }

  .timeline-panel,
  .details-panel {
    position: absolute;
    inset: 0;
    height: 100%;
    overscroll-behavior-y: contain;
  }

  .timeline-panel {
    display: flex;
    flex-direction: column;
    border-right: 0;
    border-bottom: 0;
    z-index: 2;
    overflow: hidden;
  }

  .details-panel {
    z-index: 3;
    transform: translateX(100%);
    transition: transform 220ms ease;
    overflow-y: auto;
    padding-bottom: calc(1.2rem + 100px);
  }

  body.mobile-detail-open .details-panel {
    transform: translateX(0);
  }

  .mobile-back-btn {
    display: inline-flex;
    position: sticky;
    top: 0;
    z-index: 5;
    margin-bottom: 0.8rem;
    background: rgba(27, 35, 48, 0.98);
    /* Sterke glow zodat de knop leesbaar blijft over alle content. */
    box-shadow:
      0 0 0 1px rgba(148, 163, 184, 0.35),
      0 0 18px rgba(59, 130, 246, 0.45),
      0 10px 24px rgba(2, 6, 23, 0.7);
  }

  .timeline {
    margin-top: 1rem;
    height: auto;
    flex: 1;
    min-height: 0;
  }
}
