:root{
  color-scheme:dark;
}

*{
  box-sizing:border-box;
}

body{
  margin:0;
  background:#111;
  color:#ededed;
  font:15px system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  display:flex;
  min-height:100vh;
}

aside{
  width:250px;
  flex-shrink:0;
  background:#181818;
  border-right:1px solid #292929;
  padding:24px 14px;
}

aside>b{
  display:block;
  font-size:22px;
  padding:4px 12px 18px;
}

nav{
  display:grid;
  gap:7px;
}

nav button{
  width:100%;
  min-height:46px;
  padding:11px 14px;
  background:transparent;
  color:#bdbdbd;
  border:1px solid transparent;
  border-radius:10px;
  font-size:15px;
  text-align:left;
  cursor:pointer;
}

nav button:hover{
  background:#242424;
  color:#fff;
}

main{
  flex:1;
  min-width:0;
}

header{
  height:72px;
  border-bottom:1px solid #292929;
  display:flex;
  gap:10px;
  padding:13px 18px;
  position:sticky;
  top:0;
  background:#111;
  z-index:5;
}

header input{
  flex:1;
  min-width:0;
  background:#1b1b1b;
  color:#eee;
  border:1px solid #303030;
  border-radius:11px;
  padding:12px 15px;
  font-size:15px;
  outline:none;
}

button{
  background:#1e1e1e;
  color:#eee;
  border:1px solid #303030;
  border-radius:10px;
  padding:10px 14px;
  cursor:pointer;
}

button:hover{
  background:#292929;
}

#upload{
  min-width:115px;
}

#content{
  padding:24px;
  max-width:1500px;
  margin:auto;
}

.topline{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:15px;
  margin-bottom:24px;
}

.breadcrumbs{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:15px;
}

.crumb-back{
  padding:9px 13px;
}

.crumb-current{
  font-weight:600;
}

.crumb-separator{
  color:#666;
}

.top-actions{
  display:flex;
  gap:8px;
}

.primary{
  background:#eee;
  color:#111;
  border-color:#eee;
}

.bar{
  margin-bottom:18px;
}

.bar h2{
  margin:0 0 4px;
  font-size:24px;
}

.muted{
  color:#858585;
}

.section-title{
  color:#999;
  font-size:13px;
  margin:20px 0 10px;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:13px;
}

.card{
  background:#191919;
  border:1px solid #292929;
  border-radius:13px;
  padding:13px;
  min-width:0;
}

.folder-card{
  min-height:115px;
}

.folder-main{
  display:flex;
  align-items:center;
  gap:13px;
  cursor:pointer;
  min-height:55px;
}

.folder-icon{
  width:36px;
  height:27px;
  display:block;
  position:relative;
  background:#888;
  border-radius:4px;
  flex-shrink:0;
}

.folder-icon:before{
  content:"";
  position:absolute;
  width:15px;
  height:5px;
  left:3px;
  top:-4px;
  background:#888;
  border-radius:3px 3px 0 0;
}

.item-text{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:4px;
}

.item-text b{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.preview{
  height:145px;
  margin-bottom:12px;
  border-radius:9px;
  background:#111;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}

.preview img{
  width:100%;
  height:100%;
  object-fit:cover;
}

.file-symbol{
  width:48px;
  height:58px;
  border:2px solid #777;
  border-radius:5px;
  position:relative;
  display:block;
}

.file-symbol:after{
  content:"";
  position:absolute;
  left:10px;
  right:10px;
  bottom:12px;
  height:2px;
  background:#666;
  box-shadow:0 -7px 0 #666,-0 -14px 0 #666;
}

.video-symbol{
  border-radius:8px;
}

.video-symbol:before{
  content:"";
  position:absolute;
  left:17px;
  top:17px;
  border-left:12px solid #888;
  border-top:8px solid transparent;
  border-bottom:8px solid transparent;
}

.audio-symbol:before{
  content:"";
  position:absolute;
  width:10px;
  height:28px;
  left:17px;
  top:12px;
  border:2px solid #888;
  border-radius:4px;
}

.generic-symbol{
  border-radius:4px;
}

.card-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:12px;
}

.card-actions button{
  font-size:12px;
  padding:8px 10px;
}

.danger{
  color:#ff8d8d;
}

.empty{
  text-align:center;
  padding:70px 20px;
}

.empty-title{
  font-size:18px;
  margin-bottom:6px;
}

.stats{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr));
  gap:12px;
}

.stat{
  background:#191919;
  border:1px solid #292929;
  border-radius:13px;
  padding:20px;
}

.stat b{
  display:block;
  font-size:25px;
  margin-bottom:5px;
}

.tags{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

#viewer{
  position:fixed;
  inset:0;
  z-index:100;
  display:flex;
  align-items:center;
  justify-content:center;
}

.viewer-bg{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.9);
}

.viewer-content{
  position:relative;
  z-index:2;
  max-width:94vw;
  max-height:88vh;
  display:flex;
  align-items:center;
  justify-content:center;
}

.viewer-image{
  max-width:94vw;
  max-height:88vh;
  object-fit:contain;
}

.viewer-video{
  max-width:94vw;
  max-height:88vh;
}

.viewer-close{
  position:absolute;
  z-index:3;
  right:18px;
  top:18px;
  padding:11px 15px;
  background:#222;
}

@media(max-width:700px){
  body{
    display:block;
  }

  aside{
    display:none;
  }

  header{
    height:64px;
    padding:9px;
  }

  #content{
    padding:14px;
  }

  .topline{
    align-items:stretch;
    flex-direction:column;
  }

  .top-actions{
    width:100%;
  }

  .top-actions button{
    flex:1;
    min-height:44px;
  }

  .grid{
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:9px;
  }

  .card{
    padding:10px;
    border-radius:11px;
  }

  .preview{
    height:120px;
  }

  .card-actions{
    flex-direction:column;
  }

  .card-actions button{
    width:100%;
    min-height:38px;
  }

  .bar h2{
    font-size:21px;
  }
}
