.files-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.files-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: rgba(12, 16, 36, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 32px rgba(5, 8, 24, 0.16);
}

.files-mode-btn {
  min-height: 42px;
  min-width: 138px;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(255, 245, 236, 0.88);
  font: inherit;
  cursor: pointer;
  transition: background 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, color 0.22s ease;
}

.files-mode-btn.is-active {
  color: #fff;
  background: linear-gradient(90deg, rgba(105, 150, 255, 0.18) 0%, rgba(187, 109, 255, 0.16) 100%);
  border-color: rgba(227, 194, 255, 0.48);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 0 18px rgba(183, 119, 255, 0.3);
}

.files-workspace {
  display: grid;
  grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.files-upload-panel {
  height: 100%;
}

.files-time-machine-panel,
.files-list-view {
  min-width: 0;
}

.files-workspace[data-files-active-mode="time-machine"] .files-list-view,
.files-workspace[data-files-active-mode="list"] .files-time-machine-panel {
  display: none;
}

.files-time-machine-stage {
  display: grid;
  gap: 1rem;
}

.files-time-hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 320px);
  gap: 1rem;
  align-items: stretch;
}

.files-time-preview-shell {
  position: relative;
  min-height: 360px;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 186, 131, 0.2), transparent 28%),
    radial-gradient(circle at 78% 22%, rgba(130, 171, 255, 0.16), transparent 32%),
    linear-gradient(145deg, rgba(10, 16, 34, 0.96) 0%, rgba(7, 11, 25, 0.96) 100%);
  box-shadow: 0 24px 54px rgba(4, 7, 20, 0.26);
}

.files-time-preview-media {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.files-time-preview-media img,
.files-time-preview-media .files-time-video-poster,
.files-time-preview-media .files-time-preview-fallback {
  width: 100%;
  height: 100%;
  display: block;
}

.files-time-preview-media img,
.files-time-preview-media .files-time-video-poster {
  object-fit: cover;
}

.files-time-preview-fallback {
  display: grid;
  place-items: center;
  gap: 0.6rem;
  color: rgba(255, 245, 236, 0.94);
  text-align: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at 50% 24%, rgba(255, 198, 145, 0.28), transparent 26%),
    linear-gradient(140deg, rgba(25, 32, 62, 0.9) 0%, rgba(8, 12, 28, 0.98) 100%);
}

.files-time-preview-fallback strong {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  letter-spacing: 0.05em;
}

.files-time-preview-fallback span {
  opacity: 0.82;
}

.files-time-preview-cta {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  width: 88px;
  height: 88px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(12, 14, 26, 0.52);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow:
    0 16px 28px rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  backdrop-filter: blur(12px);
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.files-time-preview-cta:hover,
.files-time-preview-cta:focus-visible {
  transform: translate(-50%, -50%) scale(1.03);
  background: rgba(18, 22, 40, 0.66);
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.28),
    0 0 24px rgba(174, 120, 255, 0.22);
}

.files-time-preview-cta .ik-icon {
  width: 34px;
  height: 34px;
}

.files-time-meta-card {
  display: grid;
  gap: 1rem;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(10, 16, 38, 0.9) 0%, rgba(9, 12, 30, 0.82) 100%);
  padding: 1.2rem;
  box-shadow: 0 22px 44px rgba(5, 8, 22, 0.2);
}

.files-time-kicker,
.files-time-timeline h2 {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.files-time-kicker {
  font-size: 0.9rem;
  opacity: 0.78;
}

.files-time-selected-date {
  display: block;
  margin-top: 0.4rem;
  font-size: clamp(1.3rem, 2.4vw, 2rem);
  line-height: 1.15;
  color: #ffd6f3;
}

.files-time-meta-grid {
  display: grid;
  gap: 0.7rem;
  padding-top: 0.2rem;
}

.files-time-meta-item {
  display: grid;
  gap: 0.18rem;
  color: rgba(255, 245, 236, 0.86);
}

.files-time-meta-item b {
  font-weight: 700;
  opacity: 0.76;
}

.files-time-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.files-time-action {
  width: 100%;
}

.files-time-action-wide {
  grid-column: 1 / -1;
}

.files-time-note {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 236, 224, 0.9);
}

.files-time-note strong {
  color: #ffc2d4;
  font-size: 1rem;
}

.files-time-timeline {
  position: relative;
  overflow: hidden;
  padding: 1.1rem 1.15rem 1.2rem;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    radial-gradient(circle at 50% 0%, rgba(178, 116, 255, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(9, 14, 34, 0.9) 0%, rgba(8, 12, 28, 0.95) 100%);
}

.files-time-timeline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.files-time-timeline-head h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.files-time-timeline-hint {
  margin: 0;
  opacity: 0.78;
  font-size: 0.92rem;
}

.files-time-timeline-nav {
  display: inline-flex;
  gap: 0.55rem;
}

.files-time-nav-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.files-time-nav-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.files-time-nav-btn .ik-icon {
  width: 20px;
  height: 20px;
}

.files-time-rail-shell {
  position: relative;
  padding-top: 3.6rem;
}

.files-time-rail-viewport {
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 0.2rem;
  scrollbar-width: none;
}

.files-time-rail-viewport::-webkit-scrollbar {
  display: none;
}

.files-time-rail {
  position: relative;
  min-width: 100%;
  height: 240px;
}

.files-time-rail-glow,
.files-time-rail-line {
  position: absolute;
  left: 48px;
  right: 48px;
  top: 142px;
  height: 8px;
  border-radius: 999px;
}

.files-time-rail-glow {
  background: linear-gradient(90deg, rgba(116, 175, 255, 0.35) 0%, rgba(206, 117, 255, 0.35) 50%, rgba(255, 171, 188, 0.35) 100%);
  filter: blur(18px);
}

.files-time-rail-line {
  background: linear-gradient(90deg, #79b0ff 0%, #bf81ff 52%, #ffb1c0 100%);
  box-shadow: 0 0 24px rgba(177, 145, 255, 0.24);
}

.files-time-range {
  position: absolute;
  left: 48px;
  right: 48px;
  top: 130px;
  width: calc(100% - 96px);
  height: 28px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  z-index: 3;
}

.files-time-range::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
}

.files-time-range::-moz-range-track {
  height: 8px;
  background: transparent;
}

.files-time-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  margin-top: -11px;
  background: radial-gradient(circle at center, #fff 0%, #e1c0ff 42%, #8f6dff 75%, #6b70ff 100%);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 9px rgba(186, 126, 255, 0.16), 0 0 24px rgba(196, 120, 255, 0.54);
}

.files-time-range::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: radial-gradient(circle at center, #fff 0%, #e1c0ff 42%, #8f6dff 75%, #6b70ff 100%);
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 9px rgba(186, 126, 255, 0.16), 0 0 24px rgba(196, 120, 255, 0.54);
}

.files-time-markers,
.files-time-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.files-time-marker,
.files-time-tick {
  position: absolute;
  left: calc(48px + var(--tm-position, 0) * (100% - 96px));
  transform: translateX(-50%);
}

.files-time-marker {
  top: 18px;
  pointer-events: auto;
  z-index: 2;
}

.files-time-marker::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 86px;
  width: 2px;
  height: 46px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.06));
}

.files-time-marker-btn {
  width: 96px;
  display: grid;
  gap: 0.42rem;
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 0;
}

.files-time-thumb {
  position: relative;
  width: 96px;
  height: 78px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(140deg, rgba(19, 25, 56, 0.98), rgba(8, 12, 28, 0.96));
  box-shadow: 0 14px 24px rgba(5, 8, 24, 0.18);
}

.files-time-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.files-time-thumb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 0.65rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: rgba(255, 244, 234, 0.86);
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 193, 144, 0.22), transparent 28%),
    linear-gradient(145deg, rgba(28, 35, 68, 0.98) 0%, rgba(10, 14, 30, 0.96) 100%);
}

.files-time-marker.is-active .files-time-thumb {
  border-color: rgba(228, 176, 255, 0.92);
  box-shadow:
    0 0 0 3px rgba(194, 128, 255, 0.28),
    0 18px 34px rgba(6, 10, 28, 0.24),
    0 0 24px rgba(203, 133, 255, 0.32);
}

.files-time-marker.is-active::after {
  background: linear-gradient(180deg, rgba(255, 233, 255, 0.8), rgba(255, 255, 255, 0.12));
}

.files-time-tick {
  top: 176px;
  display: grid;
  gap: 0.45rem;
  justify-items: center;
  color: rgba(255, 244, 234, 0.82);
  font-size: 0.9rem;
}

.files-time-tick::before {
  content: '';
  width: 2px;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
}

.files-time-bubble {
  position: absolute;
  left: calc(48px + var(--tm-bubble-position, 0) * (100% - 96px));
  top: 0;
  transform: translateX(-50%);
  z-index: 4;
  min-width: 210px;
  max-width: 280px;
  display: grid;
  gap: 0.55rem;
  justify-items: center;
  padding: 0.85rem 0.95rem 0.95rem;
  border-radius: 20px;
  border: 1px solid rgba(225, 186, 255, 0.54);
  background: linear-gradient(180deg, rgba(39, 27, 69, 0.92) 0%, rgba(18, 21, 48, 0.94) 100%);
  box-shadow:
    0 18px 36px rgba(6, 10, 28, 0.28),
    0 0 26px rgba(183, 121, 255, 0.2);
}

.files-time-bubble::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 18px;
  height: 18px;
  background: inherit;
  border-right: inherit;
  border-bottom: inherit;
  transform: translateX(-50%) rotate(45deg);
}

.files-time-bubble-thumb {
  width: 124px;
  height: 78px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(140deg, rgba(23, 30, 66, 0.98), rgba(8, 12, 28, 0.96));
}

.files-time-bubble-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.files-time-bubble-date {
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  color: rgba(255, 238, 246, 0.98);
}

.files-list-view .files-list {
  margin-top: 0.4rem;
}

.files-security-note {
  margin: 1rem 0 0;
  color: rgba(255, 245, 236, 0.78);
  font-size: 0.95rem;
}

.files-time-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 0.6rem;
}

.files-time-empty strong {
  font-family: 'Cinzel', serif;
  font-size: 1.35rem;
}

@media (max-width: 1140px) {
  .files-time-hero-panel {
    grid-template-columns: 1fr;
  }

  .files-time-meta-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .files-header {
    flex-direction: column;
  }

  .files-workspace {
    grid-template-columns: 1fr;
  }

  .files-upload-panel {
    order: 3;
  }

  .files-time-machine-panel,
  .files-list-view {
    order: 2;
  }
}

@media (max-width: 720px) {
  .files-mode-switch {
    width: 100%;
  }

  .files-mode-btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .files-time-machine-panel {
    padding: 0.9rem;
  }

  .files-time-preview-shell {
    min-height: 260px;
    border-radius: 22px;
  }

  .files-time-preview-cta {
    width: 74px;
    height: 74px;
  }

  .files-time-preview-cta .ik-icon {
    width: 28px;
    height: 28px;
  }

  .files-time-meta-card {
    padding: 1rem;
    border-radius: 20px;
  }

  .files-time-selected-date {
    font-size: 1.55rem;
  }

  .files-time-actions {
    grid-template-columns: 1fr;
  }

  .files-time-rail-shell {
    padding-top: 3rem;
  }

  .files-time-rail {
    min-width: max(680px, 100%);
    height: 218px;
  }

  .files-time-marker,
  .files-time-tick {
    left: calc(24px + var(--tm-position, 0) * (100% - 48px));
  }

  .files-time-bubble {
    left: calc(24px + var(--tm-bubble-position, 0) * (100% - 48px));
  }

  .files-time-rail-glow,
  .files-time-rail-line {
    left: 24px;
    right: 24px;
  }

  .files-time-range {
    left: 24px;
    right: 24px;
    width: calc(100% - 48px);
  }

  .files-time-marker-btn,
  .files-time-thumb {
    width: 84px;
  }

  .files-time-thumb {
    height: 70px;
    border-radius: 16px;
  }

  .files-time-marker::after {
    top: 78px;
    height: 42px;
  }

  .files-time-tick {
    top: 166px;
    font-size: 0.82rem;
  }

  .files-security-note {
    font-size: 0.9rem;
  }
}
